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
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:
flutter
add a comment |
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:
flutter
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
add a comment |
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:
flutter
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:
flutter
flutter
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
add a comment |
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
add a comment |
1 Answer
1
active
oldest
votes
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.
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
add a comment |
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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.
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
add a comment |
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.
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
add a comment |
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.
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.
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
add a comment |
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
add a comment |
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
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