Flutter Expansion Tile not opening from card list view on tap The 2019 Stack Overflow Developer Survey Results Are In Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern) The Ask Question Wizard is Live! Data science time! April 2019 and salary with experienceFlutter : Can I add a Header Row to a ListViewFlutter Card ShapeFlutter : Bad state: Stream has already been listened toHow to scroll list view builder of expansion tile auto scroll to the end of list in Flutter?Flutter: Navigation drawer with expansion tileUsing Expansion Tile with ListView in FlutterHow to make 'stacked card list view' in flutter?hello ,,,,,when I am clicking on card then show me this error how to fix this errorFlutter : Is it possible to create multiple elements in a expansion tile?Flutter Vertical viewport was given unbounded height

Take groceries in checked luggage

Are my PIs rude or am I just being too sensitive?

Can a novice safely splice in wire to lengthen 5V charging cable?

How to copy the contents of all files with a certain name into a new file?

Scientific Reports - Significant Figures

Make it rain characters

How should I replace vector<uint8_t>::const_iterator in an API?

How is simplicity better than precision and clarity in prose?

How can I protect witches in combat who wear limited clothing?

How to stretch delimiters to envolve matrices inside of a kbordermatrix?

Didn't get enough time to take a Coding Test - what to do now?

The following signatures were invalid: EXPKEYSIG 1397BC53640DB551

What aspect of planet Earth must be changed to prevent the industrial revolution?

Is it ethical to upload a automatically generated paper to a non peer-reviewed site as part of a larger research?

How to pronounce 1ターン?

Do warforged have souls?

How did the audience guess the pentatonic scale in Bobby McFerrin's presentation?

Did the UK government pay "millions and millions of dollars" to try to snag Julian Assange?

Windows 10: How to Lock (not sleep) laptop on lid close?

Finding the path in a graph from A to B then back to A with a minimum of shared edges

"... to apply for a visa" or "... and applied for a visa"?

Derivation tree not rendering

Wall plug outlet change

Do working physicists consider Newtonian mechanics to be "falsified"?



Flutter Expansion Tile not opening from card list view on tap



The 2019 Stack Overflow Developer Survey Results Are In
Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)
The Ask Question Wizard is Live!
Data science time! April 2019 and salary with experienceFlutter : Can I add a Header Row to a ListViewFlutter Card ShapeFlutter : Bad state: Stream has already been listened toHow to scroll list view builder of expansion tile auto scroll to the end of list in Flutter?Flutter: Navigation drawer with expansion tileUsing Expansion Tile with ListView in FlutterHow to make 'stacked card list view' in flutter?hello ,,,,,when I am clicking on card then show me this error how to fix this errorFlutter : Is it possible to create multiple elements in a expansion tile?Flutter Vertical viewport was given unbounded height



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















I have a list view which are list of card build dynamically. In one part of the card I put one column and put an arrow down button/icon. On click I want to open more details in an expansion tile. So I create a widget function for it. I notice the function is being called cause I put a print in it but the expansion tile is not being build right below the card.



First part is here I build my dynamic cards.



 itemBuilder: (BuildContext ctxt, int index) 
return new Container(

margin: new EdgeInsets.fromLTRB(0, 10, 20, 0),
decoration: new BoxDecoration(
//color:Color.fromRGBO(255, 255,255, 1),
borderRadius: new BorderRadius.only(
topRight: const Radius.circular(35),
bottomRight: const Radius.circular(35)
),

),
width: double.infinity,
height: 55,
child:Card(
elevation: 5,
//color: Color.fromRGBO(255, 255, 255, 1),
clipBehavior: Clip.antiAlias,
shape: RoundedRectangleBorder(
borderRadius: new BorderRadius.only(
topRight: const Radius.circular(35),
bottomRight: const Radius.circular(35)
),
),

child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[



Container(
width: 90,

child:
Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
//new Row(
// mainAxisSize: MainAxisSize.max,

//children: <Widget>[
new Text(
"200", style: TextStyle(color:Colors.blue),
),
new Text(
"mmm", style: TextStyle(color:Colors.black),
),
// new Icon(Icons.account_circle)
//style: Theme.of(context).textTheme.body2

],
),
Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
GestureDetector(
onTap: ()
print("Calling expansion tile");
expansionList(context,index);
,
child: Icon(Icons.arrow_drop_down),
)



]
)
//style: Theme.of(context).textTheme.body2

],
),
)
]
)
)
);



Thus on tap function I call this function expansionList(context,index); which I have shown below the details of the function. But the tile is not being open. How to make the tile to open dynamically on tap.



Widget expansionList(BuildContext context, int index) 
print("In expansion tile");
return new ExpansionTile(

title: Text(
"TEST",
style: TextStyle(fontSize: 28.0),
),
children: <Widget>[
Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
//new Row(
// mainAxisSize: MainAxisSize.max,

//children: <Widget>[
new Text(
"200", style: TextStyle(color:Colors.blue),
),
new Text(
"mmm", style: TextStyle(color:Colors.black),
),
// new Icon(Icons.account_circle)
//style: Theme.of(context).textTheme.body2

],
),


]


);










share|improve this question






















  • @KiroConeski I dont quite get your on the Widget to stateful one. I dont quite on your logic either.

    – newbie
    Mar 8 at 14:30











  • sorry @newbie. I misunderstood your question, that's why I deleted the comment. But, please read the ExpandedTile documentation flutter.dev/docs/catalog/samples/expansion-tile-sample. What you are trying to implement with the above code, is your own Expanded Tile logic. You're not using it as you should

    – Kiro Coneski
    Mar 8 at 14:36

















0















I have a list view which are list of card build dynamically. In one part of the card I put one column and put an arrow down button/icon. On click I want to open more details in an expansion tile. So I create a widget function for it. I notice the function is being called cause I put a print in it but the expansion tile is not being build right below the card.



First part is here I build my dynamic cards.



 itemBuilder: (BuildContext ctxt, int index) 
return new Container(

margin: new EdgeInsets.fromLTRB(0, 10, 20, 0),
decoration: new BoxDecoration(
//color:Color.fromRGBO(255, 255,255, 1),
borderRadius: new BorderRadius.only(
topRight: const Radius.circular(35),
bottomRight: const Radius.circular(35)
),

),
width: double.infinity,
height: 55,
child:Card(
elevation: 5,
//color: Color.fromRGBO(255, 255, 255, 1),
clipBehavior: Clip.antiAlias,
shape: RoundedRectangleBorder(
borderRadius: new BorderRadius.only(
topRight: const Radius.circular(35),
bottomRight: const Radius.circular(35)
),
),

child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[



Container(
width: 90,

child:
Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
//new Row(
// mainAxisSize: MainAxisSize.max,

//children: <Widget>[
new Text(
"200", style: TextStyle(color:Colors.blue),
),
new Text(
"mmm", style: TextStyle(color:Colors.black),
),
// new Icon(Icons.account_circle)
//style: Theme.of(context).textTheme.body2

],
),
Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
GestureDetector(
onTap: ()
print("Calling expansion tile");
expansionList(context,index);
,
child: Icon(Icons.arrow_drop_down),
)



]
)
//style: Theme.of(context).textTheme.body2

],
),
)
]
)
)
);



Thus on tap function I call this function expansionList(context,index); which I have shown below the details of the function. But the tile is not being open. How to make the tile to open dynamically on tap.



Widget expansionList(BuildContext context, int index) 
print("In expansion tile");
return new ExpansionTile(

title: Text(
"TEST",
style: TextStyle(fontSize: 28.0),
),
children: <Widget>[
Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
//new Row(
// mainAxisSize: MainAxisSize.max,

//children: <Widget>[
new Text(
"200", style: TextStyle(color:Colors.blue),
),
new Text(
"mmm", style: TextStyle(color:Colors.black),
),
// new Icon(Icons.account_circle)
//style: Theme.of(context).textTheme.body2

],
),


]


);










share|improve this question






















  • @KiroConeski I dont quite get your on the Widget to stateful one. I dont quite on your logic either.

    – newbie
    Mar 8 at 14:30











  • sorry @newbie. I misunderstood your question, that's why I deleted the comment. But, please read the ExpandedTile documentation flutter.dev/docs/catalog/samples/expansion-tile-sample. What you are trying to implement with the above code, is your own Expanded Tile logic. You're not using it as you should

    – Kiro Coneski
    Mar 8 at 14:36













0












0








0


1






I have a list view which are list of card build dynamically. In one part of the card I put one column and put an arrow down button/icon. On click I want to open more details in an expansion tile. So I create a widget function for it. I notice the function is being called cause I put a print in it but the expansion tile is not being build right below the card.



First part is here I build my dynamic cards.



 itemBuilder: (BuildContext ctxt, int index) 
return new Container(

margin: new EdgeInsets.fromLTRB(0, 10, 20, 0),
decoration: new BoxDecoration(
//color:Color.fromRGBO(255, 255,255, 1),
borderRadius: new BorderRadius.only(
topRight: const Radius.circular(35),
bottomRight: const Radius.circular(35)
),

),
width: double.infinity,
height: 55,
child:Card(
elevation: 5,
//color: Color.fromRGBO(255, 255, 255, 1),
clipBehavior: Clip.antiAlias,
shape: RoundedRectangleBorder(
borderRadius: new BorderRadius.only(
topRight: const Radius.circular(35),
bottomRight: const Radius.circular(35)
),
),

child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[



Container(
width: 90,

child:
Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
//new Row(
// mainAxisSize: MainAxisSize.max,

//children: <Widget>[
new Text(
"200", style: TextStyle(color:Colors.blue),
),
new Text(
"mmm", style: TextStyle(color:Colors.black),
),
// new Icon(Icons.account_circle)
//style: Theme.of(context).textTheme.body2

],
),
Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
GestureDetector(
onTap: ()
print("Calling expansion tile");
expansionList(context,index);
,
child: Icon(Icons.arrow_drop_down),
)



]
)
//style: Theme.of(context).textTheme.body2

],
),
)
]
)
)
);



Thus on tap function I call this function expansionList(context,index); which I have shown below the details of the function. But the tile is not being open. How to make the tile to open dynamically on tap.



Widget expansionList(BuildContext context, int index) 
print("In expansion tile");
return new ExpansionTile(

title: Text(
"TEST",
style: TextStyle(fontSize: 28.0),
),
children: <Widget>[
Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
//new Row(
// mainAxisSize: MainAxisSize.max,

//children: <Widget>[
new Text(
"200", style: TextStyle(color:Colors.blue),
),
new Text(
"mmm", style: TextStyle(color:Colors.black),
),
// new Icon(Icons.account_circle)
//style: Theme.of(context).textTheme.body2

],
),


]


);










share|improve this question














I have a list view which are list of card build dynamically. In one part of the card I put one column and put an arrow down button/icon. On click I want to open more details in an expansion tile. So I create a widget function for it. I notice the function is being called cause I put a print in it but the expansion tile is not being build right below the card.



First part is here I build my dynamic cards.



 itemBuilder: (BuildContext ctxt, int index) 
return new Container(

margin: new EdgeInsets.fromLTRB(0, 10, 20, 0),
decoration: new BoxDecoration(
//color:Color.fromRGBO(255, 255,255, 1),
borderRadius: new BorderRadius.only(
topRight: const Radius.circular(35),
bottomRight: const Radius.circular(35)
),

),
width: double.infinity,
height: 55,
child:Card(
elevation: 5,
//color: Color.fromRGBO(255, 255, 255, 1),
clipBehavior: Clip.antiAlias,
shape: RoundedRectangleBorder(
borderRadius: new BorderRadius.only(
topRight: const Radius.circular(35),
bottomRight: const Radius.circular(35)
),
),

child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[



Container(
width: 90,

child:
Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
//new Row(
// mainAxisSize: MainAxisSize.max,

//children: <Widget>[
new Text(
"200", style: TextStyle(color:Colors.blue),
),
new Text(
"mmm", style: TextStyle(color:Colors.black),
),
// new Icon(Icons.account_circle)
//style: Theme.of(context).textTheme.body2

],
),
Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
GestureDetector(
onTap: ()
print("Calling expansion tile");
expansionList(context,index);
,
child: Icon(Icons.arrow_drop_down),
)



]
)
//style: Theme.of(context).textTheme.body2

],
),
)
]
)
)
);



Thus on tap function I call this function expansionList(context,index); which I have shown below the details of the function. But the tile is not being open. How to make the tile to open dynamically on tap.



Widget expansionList(BuildContext context, int index) 
print("In expansion tile");
return new ExpansionTile(

title: Text(
"TEST",
style: TextStyle(fontSize: 28.0),
),
children: <Widget>[
Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
//new Row(
// mainAxisSize: MainAxisSize.max,

//children: <Widget>[
new Text(
"200", style: TextStyle(color:Colors.blue),
),
new Text(
"mmm", style: TextStyle(color:Colors.black),
),
// new Icon(Icons.account_circle)
//style: Theme.of(context).textTheme.body2

],
),


]


);







flutter flutter-layout






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 8 at 13:36









newbienewbie

558




558












  • @KiroConeski I dont quite get your on the Widget to stateful one. I dont quite on your logic either.

    – newbie
    Mar 8 at 14:30











  • sorry @newbie. I misunderstood your question, that's why I deleted the comment. But, please read the ExpandedTile documentation flutter.dev/docs/catalog/samples/expansion-tile-sample. What you are trying to implement with the above code, is your own Expanded Tile logic. You're not using it as you should

    – Kiro Coneski
    Mar 8 at 14:36

















  • @KiroConeski I dont quite get your on the Widget to stateful one. I dont quite on your logic either.

    – newbie
    Mar 8 at 14:30











  • sorry @newbie. I misunderstood your question, that's why I deleted the comment. But, please read the ExpandedTile documentation flutter.dev/docs/catalog/samples/expansion-tile-sample. What you are trying to implement with the above code, is your own Expanded Tile logic. You're not using it as you should

    – Kiro Coneski
    Mar 8 at 14:36
















@KiroConeski I dont quite get your on the Widget to stateful one. I dont quite on your logic either.

– newbie
Mar 8 at 14:30





@KiroConeski I dont quite get your on the Widget to stateful one. I dont quite on your logic either.

– newbie
Mar 8 at 14:30













sorry @newbie. I misunderstood your question, that's why I deleted the comment. But, please read the ExpandedTile documentation flutter.dev/docs/catalog/samples/expansion-tile-sample. What you are trying to implement with the above code, is your own Expanded Tile logic. You're not using it as you should

– Kiro Coneski
Mar 8 at 14:36





sorry @newbie. I misunderstood your question, that's why I deleted the comment. But, please read the ExpandedTile documentation flutter.dev/docs/catalog/samples/expansion-tile-sample. What you are trying to implement with the above code, is your own Expanded Tile logic. You're not using it as you should

– Kiro Coneski
Mar 8 at 14:36












1 Answer
1






active

oldest

votes


















1














What you do now is - on each click you:



  • call print method - it prints to console.

  • call a function that returns ExpansionTile widget.

But you do nothing with the returned value, it doesn't even has a chance to get into your widget tree, it's simply built and nothing done with it.



ExpansionTile is a widget which consists of:




  • 3 slots each can hold Widget(or tree):



    1. Widget leading - usually you place avatar/icon/checkbox here

    2. Widget title - main content of a tile

    3. Widget trailing - the end of tile, best place for dropdown arrow (included in ExpansionTile by default)


  • and a children array - what is shown when expanded;


Code:



 @override
Widget build(BuildContext context)
return Container(
child: ListView.builder(itemBuilder: (BuildContext ctxt, int index)
return new Container(
margin: new EdgeInsets.fromLTRB(0, 10, 20, 0),
decoration: new BoxDecoration(
//color:Color.fromRGBO(255, 255,255, 1),
borderRadius: new BorderRadius.only(
topRight: const Radius.circular(35),
bottomRight: const Radius.circular(35)),
),
width: double.infinity,
// height: 55,
child: Card(
elevation: 5,
clipBehavior: Clip.antiAlias,
shape: RoundedRectangleBorder(
borderRadius: new BorderRadius.only(
topRight: const Radius.circular(35),
bottomRight: const Radius.circular(35)),
),
child: expansionList(ctxt, index),
),
);
),
);



And place whatever you want on collapsed tile in leading and title, if you want customize the arrow - use custom trailing.



 Widget expansionList(BuildContext context, int index) 
print("Building expansion tile");
return new ExpansionTile(
initiallyExpanded: false,
leading: Icon(Icons.all_inclusive),
title: Column(
children: <Widget>[
Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Text('Content'),
RaisedButton(
child: Text('Button'),
onPressed: () ,
),
Text('Row 1'),
],
),
Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Text('Content row 2'),
],
),
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
Text('Content row 3')
],
)
],
),
children: <Widget>[
Image.network(
"https://cdn.sstatic.net/Sites/stackoverflow/company/img/logos/so/so-logo.png",
height: 55,
),
],
);



https://media.giphy.com/media/FPpU31paQvrOgPpaAx/giphy.gif



PS get familiar with code formatting hot-key combo, and always put trailing commas - the code will auto-format much nicer






share|improve this answer

























  • in my card I want to have more section/column and only the last section I want to have the down arrow and on click of it I want to show details

    – newbie
    Mar 8 at 14:40











  • Are you sure you need a card here? You are free to put columns/rows/whatever in title slot

    – Buffer Underflow
    Mar 8 at 14:47











  • beside card what else could I design with round shape on the top right and bottom right. I need one section for date one section for details and one section to show distance travelled and beside it I want the down arrow

    – newbie
    Mar 8 at 14:49











  • I mean, you don't want to put all content in Card, instead you put content into title of ExpansionTile, and put the whole ExpansionTile as the only child of Card. Well, try to launch my code, it's already doing exactly what u ask for

    – Buffer Underflow
    Mar 8 at 14:53











  • I already launch and testing your codes but in my emulator it says bottom overflowed by 43 pixels and when I press the arrow nothing shows below and it again give that bottom overflowed by 11 pixels

    – newbie
    Mar 8 at 14:55











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%2f55064341%2fflutter-expansion-tile-not-opening-from-card-list-view-on-tap%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









1














What you do now is - on each click you:



  • call print method - it prints to console.

  • call a function that returns ExpansionTile widget.

But you do nothing with the returned value, it doesn't even has a chance to get into your widget tree, it's simply built and nothing done with it.



ExpansionTile is a widget which consists of:




  • 3 slots each can hold Widget(or tree):



    1. Widget leading - usually you place avatar/icon/checkbox here

    2. Widget title - main content of a tile

    3. Widget trailing - the end of tile, best place for dropdown arrow (included in ExpansionTile by default)


  • and a children array - what is shown when expanded;


Code:



 @override
Widget build(BuildContext context)
return Container(
child: ListView.builder(itemBuilder: (BuildContext ctxt, int index)
return new Container(
margin: new EdgeInsets.fromLTRB(0, 10, 20, 0),
decoration: new BoxDecoration(
//color:Color.fromRGBO(255, 255,255, 1),
borderRadius: new BorderRadius.only(
topRight: const Radius.circular(35),
bottomRight: const Radius.circular(35)),
),
width: double.infinity,
// height: 55,
child: Card(
elevation: 5,
clipBehavior: Clip.antiAlias,
shape: RoundedRectangleBorder(
borderRadius: new BorderRadius.only(
topRight: const Radius.circular(35),
bottomRight: const Radius.circular(35)),
),
child: expansionList(ctxt, index),
),
);
),
);



And place whatever you want on collapsed tile in leading and title, if you want customize the arrow - use custom trailing.



 Widget expansionList(BuildContext context, int index) 
print("Building expansion tile");
return new ExpansionTile(
initiallyExpanded: false,
leading: Icon(Icons.all_inclusive),
title: Column(
children: <Widget>[
Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Text('Content'),
RaisedButton(
child: Text('Button'),
onPressed: () ,
),
Text('Row 1'),
],
),
Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Text('Content row 2'),
],
),
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
Text('Content row 3')
],
)
],
),
children: <Widget>[
Image.network(
"https://cdn.sstatic.net/Sites/stackoverflow/company/img/logos/so/so-logo.png",
height: 55,
),
],
);



https://media.giphy.com/media/FPpU31paQvrOgPpaAx/giphy.gif



PS get familiar with code formatting hot-key combo, and always put trailing commas - the code will auto-format much nicer






share|improve this answer

























  • in my card I want to have more section/column and only the last section I want to have the down arrow and on click of it I want to show details

    – newbie
    Mar 8 at 14:40











  • Are you sure you need a card here? You are free to put columns/rows/whatever in title slot

    – Buffer Underflow
    Mar 8 at 14:47











  • beside card what else could I design with round shape on the top right and bottom right. I need one section for date one section for details and one section to show distance travelled and beside it I want the down arrow

    – newbie
    Mar 8 at 14:49











  • I mean, you don't want to put all content in Card, instead you put content into title of ExpansionTile, and put the whole ExpansionTile as the only child of Card. Well, try to launch my code, it's already doing exactly what u ask for

    – Buffer Underflow
    Mar 8 at 14:53











  • I already launch and testing your codes but in my emulator it says bottom overflowed by 43 pixels and when I press the arrow nothing shows below and it again give that bottom overflowed by 11 pixels

    – newbie
    Mar 8 at 14:55















1














What you do now is - on each click you:



  • call print method - it prints to console.

  • call a function that returns ExpansionTile widget.

But you do nothing with the returned value, it doesn't even has a chance to get into your widget tree, it's simply built and nothing done with it.



ExpansionTile is a widget which consists of:




  • 3 slots each can hold Widget(or tree):



    1. Widget leading - usually you place avatar/icon/checkbox here

    2. Widget title - main content of a tile

    3. Widget trailing - the end of tile, best place for dropdown arrow (included in ExpansionTile by default)


  • and a children array - what is shown when expanded;


Code:



 @override
Widget build(BuildContext context)
return Container(
child: ListView.builder(itemBuilder: (BuildContext ctxt, int index)
return new Container(
margin: new EdgeInsets.fromLTRB(0, 10, 20, 0),
decoration: new BoxDecoration(
//color:Color.fromRGBO(255, 255,255, 1),
borderRadius: new BorderRadius.only(
topRight: const Radius.circular(35),
bottomRight: const Radius.circular(35)),
),
width: double.infinity,
// height: 55,
child: Card(
elevation: 5,
clipBehavior: Clip.antiAlias,
shape: RoundedRectangleBorder(
borderRadius: new BorderRadius.only(
topRight: const Radius.circular(35),
bottomRight: const Radius.circular(35)),
),
child: expansionList(ctxt, index),
),
);
),
);



And place whatever you want on collapsed tile in leading and title, if you want customize the arrow - use custom trailing.



 Widget expansionList(BuildContext context, int index) 
print("Building expansion tile");
return new ExpansionTile(
initiallyExpanded: false,
leading: Icon(Icons.all_inclusive),
title: Column(
children: <Widget>[
Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Text('Content'),
RaisedButton(
child: Text('Button'),
onPressed: () ,
),
Text('Row 1'),
],
),
Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Text('Content row 2'),
],
),
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
Text('Content row 3')
],
)
],
),
children: <Widget>[
Image.network(
"https://cdn.sstatic.net/Sites/stackoverflow/company/img/logos/so/so-logo.png",
height: 55,
),
],
);



https://media.giphy.com/media/FPpU31paQvrOgPpaAx/giphy.gif



PS get familiar with code formatting hot-key combo, and always put trailing commas - the code will auto-format much nicer






share|improve this answer

























  • in my card I want to have more section/column and only the last section I want to have the down arrow and on click of it I want to show details

    – newbie
    Mar 8 at 14:40











  • Are you sure you need a card here? You are free to put columns/rows/whatever in title slot

    – Buffer Underflow
    Mar 8 at 14:47











  • beside card what else could I design with round shape on the top right and bottom right. I need one section for date one section for details and one section to show distance travelled and beside it I want the down arrow

    – newbie
    Mar 8 at 14:49











  • I mean, you don't want to put all content in Card, instead you put content into title of ExpansionTile, and put the whole ExpansionTile as the only child of Card. Well, try to launch my code, it's already doing exactly what u ask for

    – Buffer Underflow
    Mar 8 at 14:53











  • I already launch and testing your codes but in my emulator it says bottom overflowed by 43 pixels and when I press the arrow nothing shows below and it again give that bottom overflowed by 11 pixels

    – newbie
    Mar 8 at 14:55













1












1








1







What you do now is - on each click you:



  • call print method - it prints to console.

  • call a function that returns ExpansionTile widget.

But you do nothing with the returned value, it doesn't even has a chance to get into your widget tree, it's simply built and nothing done with it.



ExpansionTile is a widget which consists of:




  • 3 slots each can hold Widget(or tree):



    1. Widget leading - usually you place avatar/icon/checkbox here

    2. Widget title - main content of a tile

    3. Widget trailing - the end of tile, best place for dropdown arrow (included in ExpansionTile by default)


  • and a children array - what is shown when expanded;


Code:



 @override
Widget build(BuildContext context)
return Container(
child: ListView.builder(itemBuilder: (BuildContext ctxt, int index)
return new Container(
margin: new EdgeInsets.fromLTRB(0, 10, 20, 0),
decoration: new BoxDecoration(
//color:Color.fromRGBO(255, 255,255, 1),
borderRadius: new BorderRadius.only(
topRight: const Radius.circular(35),
bottomRight: const Radius.circular(35)),
),
width: double.infinity,
// height: 55,
child: Card(
elevation: 5,
clipBehavior: Clip.antiAlias,
shape: RoundedRectangleBorder(
borderRadius: new BorderRadius.only(
topRight: const Radius.circular(35),
bottomRight: const Radius.circular(35)),
),
child: expansionList(ctxt, index),
),
);
),
);



And place whatever you want on collapsed tile in leading and title, if you want customize the arrow - use custom trailing.



 Widget expansionList(BuildContext context, int index) 
print("Building expansion tile");
return new ExpansionTile(
initiallyExpanded: false,
leading: Icon(Icons.all_inclusive),
title: Column(
children: <Widget>[
Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Text('Content'),
RaisedButton(
child: Text('Button'),
onPressed: () ,
),
Text('Row 1'),
],
),
Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Text('Content row 2'),
],
),
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
Text('Content row 3')
],
)
],
),
children: <Widget>[
Image.network(
"https://cdn.sstatic.net/Sites/stackoverflow/company/img/logos/so/so-logo.png",
height: 55,
),
],
);



https://media.giphy.com/media/FPpU31paQvrOgPpaAx/giphy.gif



PS get familiar with code formatting hot-key combo, and always put trailing commas - the code will auto-format much nicer






share|improve this answer















What you do now is - on each click you:



  • call print method - it prints to console.

  • call a function that returns ExpansionTile widget.

But you do nothing with the returned value, it doesn't even has a chance to get into your widget tree, it's simply built and nothing done with it.



ExpansionTile is a widget which consists of:




  • 3 slots each can hold Widget(or tree):



    1. Widget leading - usually you place avatar/icon/checkbox here

    2. Widget title - main content of a tile

    3. Widget trailing - the end of tile, best place for dropdown arrow (included in ExpansionTile by default)


  • and a children array - what is shown when expanded;


Code:



 @override
Widget build(BuildContext context)
return Container(
child: ListView.builder(itemBuilder: (BuildContext ctxt, int index)
return new Container(
margin: new EdgeInsets.fromLTRB(0, 10, 20, 0),
decoration: new BoxDecoration(
//color:Color.fromRGBO(255, 255,255, 1),
borderRadius: new BorderRadius.only(
topRight: const Radius.circular(35),
bottomRight: const Radius.circular(35)),
),
width: double.infinity,
// height: 55,
child: Card(
elevation: 5,
clipBehavior: Clip.antiAlias,
shape: RoundedRectangleBorder(
borderRadius: new BorderRadius.only(
topRight: const Radius.circular(35),
bottomRight: const Radius.circular(35)),
),
child: expansionList(ctxt, index),
),
);
),
);



And place whatever you want on collapsed tile in leading and title, if you want customize the arrow - use custom trailing.



 Widget expansionList(BuildContext context, int index) 
print("Building expansion tile");
return new ExpansionTile(
initiallyExpanded: false,
leading: Icon(Icons.all_inclusive),
title: Column(
children: <Widget>[
Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Text('Content'),
RaisedButton(
child: Text('Button'),
onPressed: () ,
),
Text('Row 1'),
],
),
Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Text('Content row 2'),
],
),
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
Text('Content row 3')
],
)
],
),
children: <Widget>[
Image.network(
"https://cdn.sstatic.net/Sites/stackoverflow/company/img/logos/so/so-logo.png",
height: 55,
),
],
);



https://media.giphy.com/media/FPpU31paQvrOgPpaAx/giphy.gif



PS get familiar with code formatting hot-key combo, and always put trailing commas - the code will auto-format much nicer







share|improve this answer














share|improve this answer



share|improve this answer








edited Mar 8 at 15:07

























answered Mar 8 at 14:35









Buffer UnderflowBuffer Underflow

10625




10625












  • in my card I want to have more section/column and only the last section I want to have the down arrow and on click of it I want to show details

    – newbie
    Mar 8 at 14:40











  • Are you sure you need a card here? You are free to put columns/rows/whatever in title slot

    – Buffer Underflow
    Mar 8 at 14:47











  • beside card what else could I design with round shape on the top right and bottom right. I need one section for date one section for details and one section to show distance travelled and beside it I want the down arrow

    – newbie
    Mar 8 at 14:49











  • I mean, you don't want to put all content in Card, instead you put content into title of ExpansionTile, and put the whole ExpansionTile as the only child of Card. Well, try to launch my code, it's already doing exactly what u ask for

    – Buffer Underflow
    Mar 8 at 14:53











  • I already launch and testing your codes but in my emulator it says bottom overflowed by 43 pixels and when I press the arrow nothing shows below and it again give that bottom overflowed by 11 pixels

    – newbie
    Mar 8 at 14:55

















  • in my card I want to have more section/column and only the last section I want to have the down arrow and on click of it I want to show details

    – newbie
    Mar 8 at 14:40











  • Are you sure you need a card here? You are free to put columns/rows/whatever in title slot

    – Buffer Underflow
    Mar 8 at 14:47











  • beside card what else could I design with round shape on the top right and bottom right. I need one section for date one section for details and one section to show distance travelled and beside it I want the down arrow

    – newbie
    Mar 8 at 14:49











  • I mean, you don't want to put all content in Card, instead you put content into title of ExpansionTile, and put the whole ExpansionTile as the only child of Card. Well, try to launch my code, it's already doing exactly what u ask for

    – Buffer Underflow
    Mar 8 at 14:53











  • I already launch and testing your codes but in my emulator it says bottom overflowed by 43 pixels and when I press the arrow nothing shows below and it again give that bottom overflowed by 11 pixels

    – newbie
    Mar 8 at 14:55
















in my card I want to have more section/column and only the last section I want to have the down arrow and on click of it I want to show details

– newbie
Mar 8 at 14:40





in my card I want to have more section/column and only the last section I want to have the down arrow and on click of it I want to show details

– newbie
Mar 8 at 14:40













Are you sure you need a card here? You are free to put columns/rows/whatever in title slot

– Buffer Underflow
Mar 8 at 14:47





Are you sure you need a card here? You are free to put columns/rows/whatever in title slot

– Buffer Underflow
Mar 8 at 14:47













beside card what else could I design with round shape on the top right and bottom right. I need one section for date one section for details and one section to show distance travelled and beside it I want the down arrow

– newbie
Mar 8 at 14:49





beside card what else could I design with round shape on the top right and bottom right. I need one section for date one section for details and one section to show distance travelled and beside it I want the down arrow

– newbie
Mar 8 at 14:49













I mean, you don't want to put all content in Card, instead you put content into title of ExpansionTile, and put the whole ExpansionTile as the only child of Card. Well, try to launch my code, it's already doing exactly what u ask for

– Buffer Underflow
Mar 8 at 14:53





I mean, you don't want to put all content in Card, instead you put content into title of ExpansionTile, and put the whole ExpansionTile as the only child of Card. Well, try to launch my code, it's already doing exactly what u ask for

– Buffer Underflow
Mar 8 at 14:53













I already launch and testing your codes but in my emulator it says bottom overflowed by 43 pixels and when I press the arrow nothing shows below and it again give that bottom overflowed by 11 pixels

– newbie
Mar 8 at 14:55





I already launch and testing your codes but in my emulator it says bottom overflowed by 43 pixels and when I press the arrow nothing shows below and it again give that bottom overflowed by 11 pixels

– newbie
Mar 8 at 14:55



















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%2f55064341%2fflutter-expansion-tile-not-opening-from-card-list-view-on-tap%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

1928 у кіно

Захаров Федір Захарович

Ель Греко