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

How are passwords stolen from companies if they only store hashes?

How do you justify more code being written by following clean code practices?

Error in master's thesis, I do not know what to do

What is the difference between something being completely legal and being completely decriminalized?

How old is Nick Fury?

UK Tourist Visa- Enquiry

Do I need to convey a moral for each of my blog post?

Should I be concerned about student access to a test bank?

DisplayForm problem with pi in FractionBox

label a part of commutative diagram

Hackerrank All Women's Codesprint 2019: Name the Product

When did hardware antialiasing start being available?

Single word to change groups

Writing in a Christian voice

How to balance a monster modification (zombie)?

Why do I have a large white artefact on the rendered image?

PTIJ: Why do we make a Lulav holder?

Can a university suspend a student even when he has left university?

Exit shell with shortcut (not typing exit) that closes session properly

How to find the largest number(s) in a list of elements, possibly non-unique?

How do researchers send unsolicited emails asking for feedback on their works?

Which partition to make active?

Pre-Employment Background Check With Consent For Future Checks

Help with identifying unique aircraft over NE Pennsylvania



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
    Mar 7 at 9:17















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
    Mar 7 at 9:17













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 Mar 7 at 9:16







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
    Mar 7 at 9:17

















  • 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
    Mar 7 at 9:17
















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
Mar 7 at 9:17





@TruongSinh Done. I hope it's clear now

– Isaac
Mar 7 at 9:17












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
    Mar 7 at 9:19











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

    – user969068
    Mar 7 at 10:13












  • Thanks, I'll take a look at that

    – Isaac
    Mar 7 at 11:05










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
    Mar 7 at 9:19











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

    – user969068
    Mar 7 at 10:13












  • Thanks, I'll take a look at that

    – Isaac
    Mar 7 at 11:05















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
    Mar 7 at 9:19











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

    – user969068
    Mar 7 at 10:13












  • Thanks, I'll take a look at that

    – Isaac
    Mar 7 at 11:05













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
    Mar 7 at 9:19











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

    – user969068
    Mar 7 at 10:13












  • Thanks, I'll take a look at that

    – Isaac
    Mar 7 at 11:05

















  • 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
    Mar 7 at 9:19











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

    – user969068
    Mar 7 at 10:13












  • Thanks, I'll take a look at that

    – Isaac
    Mar 7 at 11:05
















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
Mar 7 at 9:19





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
Mar 7 at 9:19













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

– user969068
Mar 7 at 10:13






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

– user969068
Mar 7 at 10:13














Thanks, I'll take a look at that

– Isaac
Mar 7 at 11:05





Thanks, I'll take a look at that

– Isaac
Mar 7 at 11:05



















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

Save data to MySQL database using ExtJS and PHP [closed]2019 Community Moderator ElectionHow can I prevent SQL injection in PHP?Which MySQL data type to use for storing boolean valuesPHP: Delete an element from an arrayHow do I connect to a MySQL Database in Python?Should I use the datetime or timestamp data type in MySQL?How to get a list of MySQL user accountsHow Do You Parse and Process HTML/XML in PHP?Reference — What does this symbol mean in PHP?How does PHP 'foreach' actually work?Why shouldn't I use mysql_* functions in PHP?

Compiling GNU Global with universal-ctags support Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Data science time! April 2019 and salary with experience The Ask Question Wizard is Live!Tags for Emacs: Relationship between etags, ebrowse, cscope, GNU Global and exuberant ctagsVim and Ctags tips and trickscscope or ctags why choose one over the other?scons and ctagsctags cannot open option file “.ctags”Adding tag scopes in universal-ctagsShould I use Universal-ctags?Universal ctags on WindowsHow do I install GNU Global with universal ctags support using Homebrew?Universal ctags with emacsHow to highlight ctags generated by Universal Ctags in Vim?

Add ONERROR event to image from jsp tldHow to add an image to a JPanel?Saving image from PHP URLHTML img scalingCheck if an image is loaded (no errors) with jQueryHow to force an <img> to take up width, even if the image is not loadedHow do I populate hidden form field with a value set in Spring ControllerStyling Raw elements Generated from JSP tagds with Jquery MobileLimit resizing of images with explicitly set width and height attributeserror TLD use in a jsp fileJsp tld files cannot be resolved