Flutter - Listview inside Listview. Scrolling causes incorrect infoBackground ListView becomes black when scrollingListview Scroll to the end of the list after updating the listListView inside ScrollView is not scrolling on AndroidFlutter Listview in a Listview scrolling weirdnessFlutter Layout: How can I put a Row inside a Flex (or another Row) in Flutter? Also using Stack widgetFlutter ListView inside Cardflutter - scrolling listview inside listview builderFlutter ListView wrong scroll gesture direction (not scroll direction) inside a RotatedBoxFlutter change tabbar on scrolling ListviewUnable to scroll MapView inside Stack with ListView ( Flutter )

Why isn't a binary file shown as 0s and 1s?

Inside Out and Back to Front

When we are talking about black hole evaporation - what exactly happens?

How do you name this compound using IUPAC system (including steps)?

Did Hitler say this quote about homeschooling?

Does a hash function have a Upper bound on input length?

The most secure way to handle someone forgetting to verify their account?

When will the last unambiguous evidence of mankind disappear?

"This used to be my phone number"

Company looks for long-term employees, but I know I won't be interested in staying long

Does unblocking power bar outlets through short extension cords increase fire risk?

How to belay quickly ascending top-rope climbers?

Do higher dimensions have axes?

When a ball on a rope swings in a circle, is there both centripetal force and tension force?

Extract the attribute names from a large number of Shapefiles

Linux ext4 restore file and directory access rights after bad backup/restore

Parser for STL stereolithography data files

How to determine Platform Event Size in Apex to ensure to be within < 1 MB

Three Subway Escalators

Brute-force the switchboard

Why are there few or no black super GMs?

How slow ( not zero) can a car engine run without hurting engine and saving on fuel

How did Jayne know when to shoot?

Should I have shared a document with a former employee?



Flutter - Listview inside Listview. Scrolling causes incorrect info


Background ListView becomes black when scrollingListview Scroll to the end of the list after updating the listListView inside ScrollView is not scrolling on AndroidFlutter Listview in a Listview scrolling weirdnessFlutter Layout: How can I put a Row inside a Flex (or another Row) in Flutter? Also using Stack widgetFlutter ListView inside Cardflutter - scrolling listview inside listview builderFlutter ListView wrong scroll gesture direction (not scroll direction) inside a RotatedBoxFlutter change tabbar on scrolling ListviewUnable to scroll MapView inside Stack with ListView ( Flutter )






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















I'm having trouble with a listview.builder inside a listview.builder.
When I scroll to the bottom and scroll back to the top, the listview items in the second listview show information from other categories.



There seems to be limited info on this. I've tried adding a key to each of the listview builders. All to no avail.



See this example, where the data that appears under the "Hot Food" category changes from Hot foods to drinks after scrolling down and up again.
Gif of screen with correct, then incorrect data.



body: new ListView.builder(
key: new Key(new Random(20).toString()),
shrinkWrap: true,
itemCount: catData == null ? 0 : catData.length,
itemBuilder: (BuildContext context, currCat)
currCatId = int.parse(catData[currCat]['itemCategoryId']);
print(
"ListView1 catdata: " + catData[currCat]['itemCategoryDesc']);
return new Column(mainAxisSize: MainAxisSize.min, children: <
Widget>[
new Flexible(
fit: FlexFit.loose,
child: new Row(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
new Expanded(
child: new ListTile(
title: new Text(catData[currCat]['itemCategoryDesc']),
),
)
],
),
),
new Flexible(
child:
menuSubList(int.parse(catData[currCat]['itemCategoryId'])),
)
]);
));



return new ListView.builder(
addAutomaticKeepAlives: true,
key: new Key(new Random(20).toString()),
physics: NeverScrollableScrollPhysics(),
shrinkWrap: true,
padding: EdgeInsets.all(0.0),
itemCount: subCatData == null ? 0 : subCatData.length,
itemBuilder: (BuildContext context, i)
return new Column(mainAxisSize: MainAxisSize.min,
children: <Widget>[
new Flexible(
fit: FlexFit.loose,
child: new Row(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
new Flexible(
fit: FlexFit.loose,
child:
new ListTile(
leading: Image.network(
"http://thisipswich.com/ssimg/$subCatData[i]['menuItemPic'] != null ? subCatData[i]['menuItemPic'] : 'noimage.png'",
fit: BoxFit.scaleDown,
width: 75.0,
height: 75.0,
),
// dense: true,
title: new Text(new ConvertTitle().convertTitleCase(
"$subCatData[i]['menuItemDesc'] $subCatData[i]['menuItemPrice']")),
subtitle: new Text(
"Cat: $subCatData[i]["itemCategoryDesc"] $subCatData[i]['menuItemVegetarian'] == '1' ? 'nVeg' : ''"),
onTap: ()
var datapass = subCatData[i];
var menuIdPass = subCatData[i]['menuItemId'];
_selectMenuItem(datapass, menuIdPass);
,
),
),
new IconButton(
icon: new Icon(Icons.add_shopping_cart),
onPressed: ()
_addItemToCart(context, i);

),
]
),

),

]
);


);


 List getMenuByCat(int catId) 
print("getMenubyCat. catId: " + catId.toString());
print("getMEnubyCat. Data: " + data.toString());
List dataCopy = data.map((element)=>element).toList();
// List dataCopy = new List.from(data);
menuItemByCat = dataCopy
.where((item) => item['menuItemCategory'] == catId.toString())
.toList();
return menuItemByCat;










share|improve this question
























  • Hi, Thanks for the suggestion. Random(20) and Random(21) still results in same behavior.

    – Duncan Pullen
    Mar 26 at 12:03











  • tried with: both set to new Random(), then one set to new Random(20) and the other Random(). Still same behavior. Even tried Random().nextInt(10000000).

    – Duncan Pullen
    Mar 26 at 12:14











  • Previous poster recommended troubleshooting the key and the Random generated strings.

    – Duncan Pullen
    Mar 26 at 12:24

















0















I'm having trouble with a listview.builder inside a listview.builder.
When I scroll to the bottom and scroll back to the top, the listview items in the second listview show information from other categories.



There seems to be limited info on this. I've tried adding a key to each of the listview builders. All to no avail.



See this example, where the data that appears under the "Hot Food" category changes from Hot foods to drinks after scrolling down and up again.
Gif of screen with correct, then incorrect data.



body: new ListView.builder(
key: new Key(new Random(20).toString()),
shrinkWrap: true,
itemCount: catData == null ? 0 : catData.length,
itemBuilder: (BuildContext context, currCat)
currCatId = int.parse(catData[currCat]['itemCategoryId']);
print(
"ListView1 catdata: " + catData[currCat]['itemCategoryDesc']);
return new Column(mainAxisSize: MainAxisSize.min, children: <
Widget>[
new Flexible(
fit: FlexFit.loose,
child: new Row(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
new Expanded(
child: new ListTile(
title: new Text(catData[currCat]['itemCategoryDesc']),
),
)
],
),
),
new Flexible(
child:
menuSubList(int.parse(catData[currCat]['itemCategoryId'])),
)
]);
));



return new ListView.builder(
addAutomaticKeepAlives: true,
key: new Key(new Random(20).toString()),
physics: NeverScrollableScrollPhysics(),
shrinkWrap: true,
padding: EdgeInsets.all(0.0),
itemCount: subCatData == null ? 0 : subCatData.length,
itemBuilder: (BuildContext context, i)
return new Column(mainAxisSize: MainAxisSize.min,
children: <Widget>[
new Flexible(
fit: FlexFit.loose,
child: new Row(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
new Flexible(
fit: FlexFit.loose,
child:
new ListTile(
leading: Image.network(
"http://thisipswich.com/ssimg/$subCatData[i]['menuItemPic'] != null ? subCatData[i]['menuItemPic'] : 'noimage.png'",
fit: BoxFit.scaleDown,
width: 75.0,
height: 75.0,
),
// dense: true,
title: new Text(new ConvertTitle().convertTitleCase(
"$subCatData[i]['menuItemDesc'] $subCatData[i]['menuItemPrice']")),
subtitle: new Text(
"Cat: $subCatData[i]["itemCategoryDesc"] $subCatData[i]['menuItemVegetarian'] == '1' ? 'nVeg' : ''"),
onTap: ()
var datapass = subCatData[i];
var menuIdPass = subCatData[i]['menuItemId'];
_selectMenuItem(datapass, menuIdPass);
,
),
),
new IconButton(
icon: new Icon(Icons.add_shopping_cart),
onPressed: ()
_addItemToCart(context, i);

),
]
),

),

]
);


);


 List getMenuByCat(int catId) 
print("getMenubyCat. catId: " + catId.toString());
print("getMEnubyCat. Data: " + data.toString());
List dataCopy = data.map((element)=>element).toList();
// List dataCopy = new List.from(data);
menuItemByCat = dataCopy
.where((item) => item['menuItemCategory'] == catId.toString())
.toList();
return menuItemByCat;










share|improve this question
























  • Hi, Thanks for the suggestion. Random(20) and Random(21) still results in same behavior.

    – Duncan Pullen
    Mar 26 at 12:03











  • tried with: both set to new Random(), then one set to new Random(20) and the other Random(). Still same behavior. Even tried Random().nextInt(10000000).

    – Duncan Pullen
    Mar 26 at 12:14











  • Previous poster recommended troubleshooting the key and the Random generated strings.

    – Duncan Pullen
    Mar 26 at 12:24













0












0








0








I'm having trouble with a listview.builder inside a listview.builder.
When I scroll to the bottom and scroll back to the top, the listview items in the second listview show information from other categories.



There seems to be limited info on this. I've tried adding a key to each of the listview builders. All to no avail.



See this example, where the data that appears under the "Hot Food" category changes from Hot foods to drinks after scrolling down and up again.
Gif of screen with correct, then incorrect data.



body: new ListView.builder(
key: new Key(new Random(20).toString()),
shrinkWrap: true,
itemCount: catData == null ? 0 : catData.length,
itemBuilder: (BuildContext context, currCat)
currCatId = int.parse(catData[currCat]['itemCategoryId']);
print(
"ListView1 catdata: " + catData[currCat]['itemCategoryDesc']);
return new Column(mainAxisSize: MainAxisSize.min, children: <
Widget>[
new Flexible(
fit: FlexFit.loose,
child: new Row(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
new Expanded(
child: new ListTile(
title: new Text(catData[currCat]['itemCategoryDesc']),
),
)
],
),
),
new Flexible(
child:
menuSubList(int.parse(catData[currCat]['itemCategoryId'])),
)
]);
));



return new ListView.builder(
addAutomaticKeepAlives: true,
key: new Key(new Random(20).toString()),
physics: NeverScrollableScrollPhysics(),
shrinkWrap: true,
padding: EdgeInsets.all(0.0),
itemCount: subCatData == null ? 0 : subCatData.length,
itemBuilder: (BuildContext context, i)
return new Column(mainAxisSize: MainAxisSize.min,
children: <Widget>[
new Flexible(
fit: FlexFit.loose,
child: new Row(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
new Flexible(
fit: FlexFit.loose,
child:
new ListTile(
leading: Image.network(
"http://thisipswich.com/ssimg/$subCatData[i]['menuItemPic'] != null ? subCatData[i]['menuItemPic'] : 'noimage.png'",
fit: BoxFit.scaleDown,
width: 75.0,
height: 75.0,
),
// dense: true,
title: new Text(new ConvertTitle().convertTitleCase(
"$subCatData[i]['menuItemDesc'] $subCatData[i]['menuItemPrice']")),
subtitle: new Text(
"Cat: $subCatData[i]["itemCategoryDesc"] $subCatData[i]['menuItemVegetarian'] == '1' ? 'nVeg' : ''"),
onTap: ()
var datapass = subCatData[i];
var menuIdPass = subCatData[i]['menuItemId'];
_selectMenuItem(datapass, menuIdPass);
,
),
),
new IconButton(
icon: new Icon(Icons.add_shopping_cart),
onPressed: ()
_addItemToCart(context, i);

),
]
),

),

]
);


);


 List getMenuByCat(int catId) 
print("getMenubyCat. catId: " + catId.toString());
print("getMEnubyCat. Data: " + data.toString());
List dataCopy = data.map((element)=>element).toList();
// List dataCopy = new List.from(data);
menuItemByCat = dataCopy
.where((item) => item['menuItemCategory'] == catId.toString())
.toList();
return menuItemByCat;










share|improve this question
















I'm having trouble with a listview.builder inside a listview.builder.
When I scroll to the bottom and scroll back to the top, the listview items in the second listview show information from other categories.



There seems to be limited info on this. I've tried adding a key to each of the listview builders. All to no avail.



See this example, where the data that appears under the "Hot Food" category changes from Hot foods to drinks after scrolling down and up again.
Gif of screen with correct, then incorrect data.



body: new ListView.builder(
key: new Key(new Random(20).toString()),
shrinkWrap: true,
itemCount: catData == null ? 0 : catData.length,
itemBuilder: (BuildContext context, currCat)
currCatId = int.parse(catData[currCat]['itemCategoryId']);
print(
"ListView1 catdata: " + catData[currCat]['itemCategoryDesc']);
return new Column(mainAxisSize: MainAxisSize.min, children: <
Widget>[
new Flexible(
fit: FlexFit.loose,
child: new Row(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
new Expanded(
child: new ListTile(
title: new Text(catData[currCat]['itemCategoryDesc']),
),
)
],
),
),
new Flexible(
child:
menuSubList(int.parse(catData[currCat]['itemCategoryId'])),
)
]);
));



return new ListView.builder(
addAutomaticKeepAlives: true,
key: new Key(new Random(20).toString()),
physics: NeverScrollableScrollPhysics(),
shrinkWrap: true,
padding: EdgeInsets.all(0.0),
itemCount: subCatData == null ? 0 : subCatData.length,
itemBuilder: (BuildContext context, i)
return new Column(mainAxisSize: MainAxisSize.min,
children: <Widget>[
new Flexible(
fit: FlexFit.loose,
child: new Row(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
new Flexible(
fit: FlexFit.loose,
child:
new ListTile(
leading: Image.network(
"http://thisipswich.com/ssimg/$subCatData[i]['menuItemPic'] != null ? subCatData[i]['menuItemPic'] : 'noimage.png'",
fit: BoxFit.scaleDown,
width: 75.0,
height: 75.0,
),
// dense: true,
title: new Text(new ConvertTitle().convertTitleCase(
"$subCatData[i]['menuItemDesc'] $subCatData[i]['menuItemPrice']")),
subtitle: new Text(
"Cat: $subCatData[i]["itemCategoryDesc"] $subCatData[i]['menuItemVegetarian'] == '1' ? 'nVeg' : ''"),
onTap: ()
var datapass = subCatData[i];
var menuIdPass = subCatData[i]['menuItemId'];
_selectMenuItem(datapass, menuIdPass);
,
),
),
new IconButton(
icon: new Icon(Icons.add_shopping_cart),
onPressed: ()
_addItemToCart(context, i);

),
]
),

),

]
);


);


 List getMenuByCat(int catId) 
print("getMenubyCat. catId: " + catId.toString());
print("getMEnubyCat. Data: " + data.toString());
List dataCopy = data.map((element)=>element).toList();
// List dataCopy = new List.from(data);
menuItemByCat = dataCopy
.where((item) => item['menuItemCategory'] == catId.toString())
.toList();
return menuItemByCat;







listview flutter refresh






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 26 at 11:54







Duncan Pullen

















asked Mar 26 at 11:35









Duncan PullenDuncan Pullen

54 bronze badges




54 bronze badges












  • Hi, Thanks for the suggestion. Random(20) and Random(21) still results in same behavior.

    – Duncan Pullen
    Mar 26 at 12:03











  • tried with: both set to new Random(), then one set to new Random(20) and the other Random(). Still same behavior. Even tried Random().nextInt(10000000).

    – Duncan Pullen
    Mar 26 at 12:14











  • Previous poster recommended troubleshooting the key and the Random generated strings.

    – Duncan Pullen
    Mar 26 at 12:24

















  • Hi, Thanks for the suggestion. Random(20) and Random(21) still results in same behavior.

    – Duncan Pullen
    Mar 26 at 12:03











  • tried with: both set to new Random(), then one set to new Random(20) and the other Random(). Still same behavior. Even tried Random().nextInt(10000000).

    – Duncan Pullen
    Mar 26 at 12:14











  • Previous poster recommended troubleshooting the key and the Random generated strings.

    – Duncan Pullen
    Mar 26 at 12:24
















Hi, Thanks for the suggestion. Random(20) and Random(21) still results in same behavior.

– Duncan Pullen
Mar 26 at 12:03





Hi, Thanks for the suggestion. Random(20) and Random(21) still results in same behavior.

– Duncan Pullen
Mar 26 at 12:03













tried with: both set to new Random(), then one set to new Random(20) and the other Random(). Still same behavior. Even tried Random().nextInt(10000000).

– Duncan Pullen
Mar 26 at 12:14





tried with: both set to new Random(), then one set to new Random(20) and the other Random(). Still same behavior. Even tried Random().nextInt(10000000).

– Duncan Pullen
Mar 26 at 12:14













Previous poster recommended troubleshooting the key and the Random generated strings.

– Duncan Pullen
Mar 26 at 12:24





Previous poster recommended troubleshooting the key and the Random generated strings.

– Duncan Pullen
Mar 26 at 12:24












0






active

oldest

votes










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%2f55356180%2fflutter-listview-inside-listview-scrolling-causes-incorrect-info%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes




Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.







Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.



















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%2f55356180%2fflutter-listview-inside-listview-scrolling-causes-incorrect-info%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

Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript