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

Thal And Out Agency railway station See also References External links Navigation menuOfficial Web Site of Pakistan RailwaysArchivedOfficial Web Site of Pakistan Railwayseeexpanding ite

Posting a File and Associated Data to a RESTful WebService preferably as JSON2019 Community Moderator ElectionREST URI convention - Singular or plural name of resource while creating itUploading both data and files in one form using Ajax?How do I upload a file with metadata using a REST web service?REST API - file (ie images) processing - best practicesSpring: JSON data and file in the same requestREST API Put large dataPosting a file and JSON data to Spring rest serviceRESTful Web Service Upload/Download Large Data With JSONREST API Design sending JSON data and a file to the api in same requestPost JSONArray to REST servicePUT vs. POST in RESTParsing values from a JSON file?JavaScript/jQuery to download file via POST with JSON dataHow do I upload a file with metadata using a REST web service?How to POST JSON data with Curl from Terminal/Commandline to Test Spring REST?Separate REST JSON API server and client?what's the correct way to send a file from REST web service to client?How do I write JSON data to a file?What is “406-Not Acceptable Response” in HTTP?REST API - file (ie images) processing - best practices

How can I change the color of pagination dots of UIPageControl?How to change UIPageControl dotsIs there a way to change page indicator dots colorCustomize dot with image of UIPageControl at index 0 of UIPageControlNo visible @interface for 'NSObject<PageControlDelegate>' declares the selector 'pageControlPageDidChange:'How to change the color of pagination dots in UIPageControl with a different color per pagepagecontrol indicator custom image instead of DefaultChanging the colour of UIPageControl dots in MonoTouchpagecontrol selectable page visibility color?Alternative way to load ViewControllers on a UIPageControlHow to set only layer.border-color for UIpage control dots in swiftHow can I develop for iPhone using a Windows development machine?How to change the name of an iOS app?UITableView - change section header coloruipagecontrol indicator(dot)issueCustom UIPageControl dots color not changingchange the interspace between UIPageControl dotsHow to change Status Bar text color in iOSHow can I change image tintColor in iOS and WatchKitUIPageControl dots with larger space in between each dotsHow to change the color of pagination dots in UIPageControl with a different color per page