How to change all items on Column dependin on which one has been tapped2019 Community Moderator ElectionHow to close Scaffold's drawer after an item tap?Flutter - Implementing a Navigation drawer with a TabBarView widget with dynamic Tab viewFlutter : Can I add a Header Row to a ListViewHow to offset a scaffold widget in Flutter?Flutter : Bad state: Stream has already been listened toFlutter Change Image source on tapHow to know which button is tapped in Flutter?onTap changes color of all Cards, not just the one that was tappedAnimate parent widget on event to fit child's sizehello ,,,,,when I am clicking on card then show me this error how to fix this error

Why does Central Limit Theorem break down in my simulation?

I can't die. Who am I?

How do I increase the number of TTY consoles?

What do you call someone who likes to pick fights?

Origin of the word “pushka”

PTIJ: Who was the sixth set of priestly clothes for?

Is it appropriate to ask a former professor to order a book for me through an inter-library loan?

Computation logic of Partway in TikZ

Can the Witch Sight warlock invocation see through the Mirror Image spell?

Is it a Cyclops number? "Nobody" knows!

Is it possible to clone a polymorphic object without manually adding overridden clone method into each derived class in C++?

What can I do if someone tampers with my SSH public key?

Create chunks from an array

Can one live in the U.S. and not use a credit card?

Graphic representation of a triangle using ArrayPlot

Help! My Character is too much for her story!

If sound is a longitudinal wave, why can we hear it if our ears aren't aligned with the propagation direction?

What should I do when a paper is published similar to my PhD thesis without citation?

Are these two graphs isomorphic? Why/Why not?

Writing text next to a table

Traveling to heavily polluted city, what practical measures can I take to minimize impact?

Giving a career talk in my old university, how prominently should I tell students my salary?

Why restrict private health insurance?

What is Tony Stark injecting into himself in Iron Man 3?



How to change all items on Column dependin on which one has been tapped



2019 Community Moderator ElectionHow to close Scaffold's drawer after an item tap?Flutter - Implementing a Navigation drawer with a TabBarView widget with dynamic Tab viewFlutter : Can I add a Header Row to a ListViewHow to offset a scaffold widget in Flutter?Flutter : Bad state: Stream has already been listened toFlutter Change Image source on tapHow to know which button is tapped in Flutter?onTap changes color of all Cards, not just the one that was tappedAnimate parent widget on event to fit child's sizehello ,,,,,when I am clicking on card then show me this error how to fix this error










0















I'm not sure if how to do this.



I have a Column of AnimatedContainers. Initially all of them are 200 height. I want to implement some kind of callback, so when user tap on one item, this one becomes smaller(say 100 height) and the rest of the item in the list disappear. My AnimatedContainers are Stateful widgets



I guess I would have to use to callbacks, one for the columnn (parent) and the other to notify the children, but I don't know how to do this.



Summarised, what I have right now is



Stateless(Column(Stateful(List<AnimatedContainer>)))



If something is not clear please comment



Thanks



EDIT to add some code and more info



class SectionButton extends StatefulWidget 
double screenHeight;
Stream stream;
int index;

SectionButton(this.screenHeight, this.stream, this.index);

@override
_SectionButtonState createState() => _SectionButtonState();


class _SectionButtonState extends State<SectionButton>
double height;
StreamSubscription streamSubscription;

initState()
super.initState();

this.height = this.widget.screenHeight / n_buttons;

streamSubscription =
widget.stream.listen((_) => collapse(this.widget.index));


void collapse(int i)
if (this.widget.index != i)
setState(()
this.height = 0;
);
else
setState(()
this.height = this.widget.screenHeight / appBarFraction;
);



@override
dispose()
super.dispose();
streamSubscription.cancel();


@override
Widget build(BuildContext context)
return AnimatedContainer(
height: this.height,
duration: Duration(milliseconds: 300),
);



class HomeScreen extends StatelessWidget
List<Widget> sections = [];
bool areCollapsed = false;
final changeNotifier = new StreamController.broadcast();

void createSections(screenHeight)
for (var i = 0; i < buttonNames.length; i++)
this.sections.add(GestureDetector(onTap:()
print("Section i was tapped");
changeNotifier.sink.add(i);, //THIS IS NOT WORKING
child: SectionButton(screenHeight, changeNotifier.stream, i),),);



@override
Widget build(BuildContext context)
final MediaQueryData mediaQueryData = MediaQuery.of(context);
double screenHeight =
mediaQueryData.size.height - mediaQueryData.padding.vertical;

createSections(screenHeight);

return SafeArea(
child: SizedBox.expand(
child: Column(children: this.sections)
),
);




BTW what I'm trying to implement is something like this:



ui menu










share|improve this question
























  • If you already have the current code, you could put it here so other can easily continue from there.

    – TruongSinh
    Mar 7 at 1:36











  • @TruongSinh Done. I hope it's clear now

    – Isaac
    2 days ago















0















I'm not sure if how to do this.



I have a Column of AnimatedContainers. Initially all of them are 200 height. I want to implement some kind of callback, so when user tap on one item, this one becomes smaller(say 100 height) and the rest of the item in the list disappear. My AnimatedContainers are Stateful widgets



I guess I would have to use to callbacks, one for the columnn (parent) and the other to notify the children, but I don't know how to do this.



Summarised, what I have right now is



Stateless(Column(Stateful(List<AnimatedContainer>)))



If something is not clear please comment



Thanks



EDIT to add some code and more info



class SectionButton extends StatefulWidget 
double screenHeight;
Stream stream;
int index;

SectionButton(this.screenHeight, this.stream, this.index);

@override
_SectionButtonState createState() => _SectionButtonState();


class _SectionButtonState extends State<SectionButton>
double height;
StreamSubscription streamSubscription;

initState()
super.initState();

this.height = this.widget.screenHeight / n_buttons;

streamSubscription =
widget.stream.listen((_) => collapse(this.widget.index));


void collapse(int i)
if (this.widget.index != i)
setState(()
this.height = 0;
);
else
setState(()
this.height = this.widget.screenHeight / appBarFraction;
);



@override
dispose()
super.dispose();
streamSubscription.cancel();


@override
Widget build(BuildContext context)
return AnimatedContainer(
height: this.height,
duration: Duration(milliseconds: 300),
);



class HomeScreen extends StatelessWidget
List<Widget> sections = [];
bool areCollapsed = false;
final changeNotifier = new StreamController.broadcast();

void createSections(screenHeight)
for (var i = 0; i < buttonNames.length; i++)
this.sections.add(GestureDetector(onTap:()
print("Section i was tapped");
changeNotifier.sink.add(i);, //THIS IS NOT WORKING
child: SectionButton(screenHeight, changeNotifier.stream, i),),);



@override
Widget build(BuildContext context)
final MediaQueryData mediaQueryData = MediaQuery.of(context);
double screenHeight =
mediaQueryData.size.height - mediaQueryData.padding.vertical;

createSections(screenHeight);

return SafeArea(
child: SizedBox.expand(
child: Column(children: this.sections)
),
);




BTW what I'm trying to implement is something like this:



ui menu










share|improve this question
























  • If you already have the current code, you could put it here so other can easily continue from there.

    – TruongSinh
    Mar 7 at 1:36











  • @TruongSinh Done. I hope it's clear now

    – Isaac
    2 days ago













0












0








0








I'm not sure if how to do this.



I have a Column of AnimatedContainers. Initially all of them are 200 height. I want to implement some kind of callback, so when user tap on one item, this one becomes smaller(say 100 height) and the rest of the item in the list disappear. My AnimatedContainers are Stateful widgets



I guess I would have to use to callbacks, one for the columnn (parent) and the other to notify the children, but I don't know how to do this.



Summarised, what I have right now is



Stateless(Column(Stateful(List<AnimatedContainer>)))



If something is not clear please comment



Thanks



EDIT to add some code and more info



class SectionButton extends StatefulWidget 
double screenHeight;
Stream stream;
int index;

SectionButton(this.screenHeight, this.stream, this.index);

@override
_SectionButtonState createState() => _SectionButtonState();


class _SectionButtonState extends State<SectionButton>
double height;
StreamSubscription streamSubscription;

initState()
super.initState();

this.height = this.widget.screenHeight / n_buttons;

streamSubscription =
widget.stream.listen((_) => collapse(this.widget.index));


void collapse(int i)
if (this.widget.index != i)
setState(()
this.height = 0;
);
else
setState(()
this.height = this.widget.screenHeight / appBarFraction;
);



@override
dispose()
super.dispose();
streamSubscription.cancel();


@override
Widget build(BuildContext context)
return AnimatedContainer(
height: this.height,
duration: Duration(milliseconds: 300),
);



class HomeScreen extends StatelessWidget
List<Widget> sections = [];
bool areCollapsed = false;
final changeNotifier = new StreamController.broadcast();

void createSections(screenHeight)
for (var i = 0; i < buttonNames.length; i++)
this.sections.add(GestureDetector(onTap:()
print("Section i was tapped");
changeNotifier.sink.add(i);, //THIS IS NOT WORKING
child: SectionButton(screenHeight, changeNotifier.stream, i),),);



@override
Widget build(BuildContext context)
final MediaQueryData mediaQueryData = MediaQuery.of(context);
double screenHeight =
mediaQueryData.size.height - mediaQueryData.padding.vertical;

createSections(screenHeight);

return SafeArea(
child: SizedBox.expand(
child: Column(children: this.sections)
),
);




BTW what I'm trying to implement is something like this:



ui menu










share|improve this question
















I'm not sure if how to do this.



I have a Column of AnimatedContainers. Initially all of them are 200 height. I want to implement some kind of callback, so when user tap on one item, this one becomes smaller(say 100 height) and the rest of the item in the list disappear. My AnimatedContainers are Stateful widgets



I guess I would have to use to callbacks, one for the columnn (parent) and the other to notify the children, but I don't know how to do this.



Summarised, what I have right now is



Stateless(Column(Stateful(List<AnimatedContainer>)))



If something is not clear please comment



Thanks



EDIT to add some code and more info



class SectionButton extends StatefulWidget 
double screenHeight;
Stream stream;
int index;

SectionButton(this.screenHeight, this.stream, this.index);

@override
_SectionButtonState createState() => _SectionButtonState();


class _SectionButtonState extends State<SectionButton>
double height;
StreamSubscription streamSubscription;

initState()
super.initState();

this.height = this.widget.screenHeight / n_buttons;

streamSubscription =
widget.stream.listen((_) => collapse(this.widget.index));


void collapse(int i)
if (this.widget.index != i)
setState(()
this.height = 0;
);
else
setState(()
this.height = this.widget.screenHeight / appBarFraction;
);



@override
dispose()
super.dispose();
streamSubscription.cancel();


@override
Widget build(BuildContext context)
return AnimatedContainer(
height: this.height,
duration: Duration(milliseconds: 300),
);



class HomeScreen extends StatelessWidget
List<Widget> sections = [];
bool areCollapsed = false;
final changeNotifier = new StreamController.broadcast();

void createSections(screenHeight)
for (var i = 0; i < buttonNames.length; i++)
this.sections.add(GestureDetector(onTap:()
print("Section i was tapped");
changeNotifier.sink.add(i);, //THIS IS NOT WORKING
child: SectionButton(screenHeight, changeNotifier.stream, i),),);



@override
Widget build(BuildContext context)
final MediaQueryData mediaQueryData = MediaQuery.of(context);
double screenHeight =
mediaQueryData.size.height - mediaQueryData.padding.vertical;

createSections(screenHeight);

return SafeArea(
child: SizedBox.expand(
child: Column(children: this.sections)
),
);




BTW what I'm trying to implement is something like this:



ui menu







flutter






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 2 days ago







Isaac

















asked Mar 6 at 23:07









IsaacIsaac

139216




139216












  • If you already have the current code, you could put it here so other can easily continue from there.

    – TruongSinh
    Mar 7 at 1:36











  • @TruongSinh Done. I hope it's clear now

    – Isaac
    2 days ago

















  • If you already have the current code, you could put it here so other can easily continue from there.

    – TruongSinh
    Mar 7 at 1:36











  • @TruongSinh Done. I hope it's clear now

    – Isaac
    2 days ago
















If you already have the current code, you could put it here so other can easily continue from there.

– TruongSinh
Mar 7 at 1:36





If you already have the current code, you could put it here so other can easily continue from there.

– TruongSinh
Mar 7 at 1:36













@TruongSinh Done. I hope it's clear now

– Isaac
2 days ago





@TruongSinh Done. I hope it's clear now

– Isaac
2 days ago












1 Answer
1






active

oldest

votes


















0














You have to store your height in a variable and wrap your widget with GestureDetector



GestureDetector(
onTap: ()
setState(() _height = 100.0; );
,
child: Container(
child: Text('Click Me'),
),
)


Alternatively, you can also use AnimatedSize Widget.




Animated widget that automatically transitions its size over a given
duration whenever the given child's size changes.







share|improve this answer























  • Yes, I know how to do that. What I don't know, is how to make callbacks or listeners from other widgets (fathers and children)

    – Isaac
    2 days ago











  • how are you managing your state? using any state manger such as scoped_model will help. pub.dartlang.org/packages/scoped_model

    – user969068
    2 days ago












  • Thanks, I'll take a look at that

    – Isaac
    2 days ago










Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55033616%2fhow-to-change-all-items-on-column-dependin-on-which-one-has-been-tapped%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














You have to store your height in a variable and wrap your widget with GestureDetector



GestureDetector(
onTap: ()
setState(() _height = 100.0; );
,
child: Container(
child: Text('Click Me'),
),
)


Alternatively, you can also use AnimatedSize Widget.




Animated widget that automatically transitions its size over a given
duration whenever the given child's size changes.







share|improve this answer























  • Yes, I know how to do that. What I don't know, is how to make callbacks or listeners from other widgets (fathers and children)

    – Isaac
    2 days ago











  • how are you managing your state? using any state manger such as scoped_model will help. pub.dartlang.org/packages/scoped_model

    – user969068
    2 days ago












  • Thanks, I'll take a look at that

    – Isaac
    2 days ago















0














You have to store your height in a variable and wrap your widget with GestureDetector



GestureDetector(
onTap: ()
setState(() _height = 100.0; );
,
child: Container(
child: Text('Click Me'),
),
)


Alternatively, you can also use AnimatedSize Widget.




Animated widget that automatically transitions its size over a given
duration whenever the given child's size changes.







share|improve this answer























  • Yes, I know how to do that. What I don't know, is how to make callbacks or listeners from other widgets (fathers and children)

    – Isaac
    2 days ago











  • how are you managing your state? using any state manger such as scoped_model will help. pub.dartlang.org/packages/scoped_model

    – user969068
    2 days ago












  • Thanks, I'll take a look at that

    – Isaac
    2 days ago













0












0








0







You have to store your height in a variable and wrap your widget with GestureDetector



GestureDetector(
onTap: ()
setState(() _height = 100.0; );
,
child: Container(
child: Text('Click Me'),
),
)


Alternatively, you can also use AnimatedSize Widget.




Animated widget that automatically transitions its size over a given
duration whenever the given child's size changes.







share|improve this answer













You have to store your height in a variable and wrap your widget with GestureDetector



GestureDetector(
onTap: ()
setState(() _height = 100.0; );
,
child: Container(
child: Text('Click Me'),
),
)


Alternatively, you can also use AnimatedSize Widget.




Animated widget that automatically transitions its size over a given
duration whenever the given child's size changes.








share|improve this answer












share|improve this answer



share|improve this answer










answered Mar 7 at 2:19









user969068user969068

79812147




79812147












  • Yes, I know how to do that. What I don't know, is how to make callbacks or listeners from other widgets (fathers and children)

    – Isaac
    2 days ago











  • how are you managing your state? using any state manger such as scoped_model will help. pub.dartlang.org/packages/scoped_model

    – user969068
    2 days ago












  • Thanks, I'll take a look at that

    – Isaac
    2 days ago

















  • Yes, I know how to do that. What I don't know, is how to make callbacks or listeners from other widgets (fathers and children)

    – Isaac
    2 days ago











  • how are you managing your state? using any state manger such as scoped_model will help. pub.dartlang.org/packages/scoped_model

    – user969068
    2 days ago












  • Thanks, I'll take a look at that

    – Isaac
    2 days ago
















Yes, I know how to do that. What I don't know, is how to make callbacks or listeners from other widgets (fathers and children)

– Isaac
2 days ago





Yes, I know how to do that. What I don't know, is how to make callbacks or listeners from other widgets (fathers and children)

– Isaac
2 days ago













how are you managing your state? using any state manger such as scoped_model will help. pub.dartlang.org/packages/scoped_model

– user969068
2 days ago






how are you managing your state? using any state manger such as scoped_model will help. pub.dartlang.org/packages/scoped_model

– user969068
2 days ago














Thanks, I'll take a look at that

– Isaac
2 days ago





Thanks, I'll take a look at that

– Isaac
2 days ago



















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55033616%2fhow-to-change-all-items-on-column-dependin-on-which-one-has-been-tapped%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Can't initialize raids on a new ASUS Prime B360M-A motherboard2019 Community Moderator ElectionSimilar to RAID config yet more like mirroring solution?Can't get motherboard serial numberWhy does the BIOS entry point start with a WBINVD instruction?UEFI performance Asus Maximus V Extreme

Identity Server 4 is not redirecting to Angular app after login2019 Community Moderator ElectionIdentity Server 4 and dockerIdentityserver implicit flow unauthorized_clientIdentityServer Hybrid Flow - Access Token is null after user successful loginIdentity Server to MVC client : Page Redirect After loginLogin with Steam OpenId(oidc-client-js)Identity Server 4+.NET Core 2.0 + IdentityIdentityServer4 post-login redirect not working in Edge browserCall to IdentityServer4 generates System.NullReferenceException: Object reference not set to an instance of an objectIdentityServer4 without HTTPS not workingHow to get Authorization code from identity server without login form

2005 Ahvaz unrest Contents Background Causes Casualties Aftermath See also References Navigation menue"At Least 10 Are Killed by Bombs in Iran""Iran"Archived"Arab-Iranians in Iran to make April 15 'Day of Fury'"State of Mind, State of Order: Reactions to Ethnic Unrest in the Islamic Republic of Iran.10.1111/j.1754-9469.2008.00028.x"Iran hangs Arab separatists"Iran Overview from ArchivedConstitution of the Islamic Republic of Iran"Tehran puzzled by forged 'riots' letter""Iran and its minorities: Down in the second class""Iran: Handling Of Ahvaz Unrest Could End With Televised Confessions""Bombings Rock Iran Ahead of Election""Five die in Iran ethnic clashes""Iran: Need for restraint as anniversary of unrest in Khuzestan approaches"Archived"Iranian Sunni protesters killed in clashes with security forces"Archived