Simple Flutter list view choppy scrolling












0














I've been evaluating Flutter for use in an app and started with a very simple example of a list of text. After building this first view, I noticed the list view had choppy scrolling so I looked closer at the showcase apps and it turns out that while Reflectly, for example, is a beautiful app, it suffers from the same problem - very choppy scrolling with a simple list of text. So far I have confirmed this on the iOS simulator, an iPhone XR, Samsung Galaxy Android device and Android Pixel 2 XL simulator.



I don't see discussions around this so I wonder if I'm doing something wrong but also skeptical I am given how simple my example is and that Reflectly has the same issue.



What I'd love from the community is to understand:
1. Am I doing anything obviously wrong / stupid to cause this
2. If you run on your device, do you see what I see?
3. Is this known and will be worked on? If I commit to Flutter, can I feel comfortable that my lists will scroll smoothly in the near future?



Below is the code you can run to reproduce this (sorry it's a bit contrived but I wanted to play around with various Flutter/Dart features):



import 'package:flutter/material.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'My List',
home: Scaffold(
appBar: AppBar(
title: Text('My List'),
backgroundColor: Color.fromRGBO(255, 0, 0, 0.9),
),
body: Padding(
padding: EdgeInsets.all(16.0),
child: Column(
children: [
Expanded(child: TimeSelector()),
],
)),
));
}
}

abstract class ListItem {}

class TimeHeader implements ListItem {
final String header;

TimeHeader(this.header);
}

class TimeOption implements ListItem {
final String timeString;
final String meridian;

TimeOption(this.timeString, this.meridian);
}

final List<ListItem> litems = [
TimeHeader("Morning"),
TimeOption("10:00", "am"),
TimeOption("10:30", "am"),
TimeOption("11:30", "am"),
TimeHeader("Afternoon"),
TimeOption("1:00", "pm"),
TimeOption("1:30", "pm"),
TimeOption("2:30", "pm"),
TimeHeader("Night"),
TimeOption("5:30", "pm"),
TimeOption("6:30", "pm"),
TimeOption("7:30", "pm"),
TimeOption("8:30", "pm"),
TimeOption("9:30", "pm"),
TimeOption("10:30", "pm"),
TimeOption("11:30", "pm"),
TimeOption("11:45", "pm"),
TimeOption("11:49", "pm"),
];

class TimeSelector extends StatelessWidget {
final _headerFont = new TextStyle(fontWeight: FontWeight.w600, fontSize: 13.0, color: Color.fromRGBO(164, 164, 164, 1));
final _smallerFont = const TextStyle(fontSize: 12.0);

@override
ListView build(BuildContext context) {
return new ListView.builder(
padding: const EdgeInsets.all(16.0),
itemCount: litems.length,
itemBuilder: (BuildContext ctxt, int index) => _buildItem(ctxt, index),
);
}

Widget _buildItem(BuildContext ctxt, int index) {
final item = litems[index];

if (item is TimeHeader) {
return new ListTile(
title: Text(
item.header,
style: _headerFont,
),
);
} else if (item is TimeOption) {
return new ListTile(
title: Text(
item.timeString + item.meridian.toUpperCase(),
style: _smallerFont,
),
);
} else {
return new Text("UNKNOWN");
}
}
}









share|improve this question






















  • code seems fine but what you exact mean by choppy scrolling ?
    – jagdish
    Nov 21 at 5:43










  • tested your code on my simulators work as excepted has no apparent issues.
    – Saed Nabil
    Nov 21 at 5:49










  • choppy means it does not scroll smooth, it jumps a little bit. you have to pay close attention to notice it and it's a little more apparent on the iphone / iOS simulator. scroll slowly and you'll see that it feels like frames are being skipped
    – Tony
    Nov 21 at 9:52










  • are you in release mode ?
    – Raouf Rahiche
    Nov 21 at 9:58










  • your code should work fine in release mode
    – pskink
    Nov 21 at 10:13
















0














I've been evaluating Flutter for use in an app and started with a very simple example of a list of text. After building this first view, I noticed the list view had choppy scrolling so I looked closer at the showcase apps and it turns out that while Reflectly, for example, is a beautiful app, it suffers from the same problem - very choppy scrolling with a simple list of text. So far I have confirmed this on the iOS simulator, an iPhone XR, Samsung Galaxy Android device and Android Pixel 2 XL simulator.



I don't see discussions around this so I wonder if I'm doing something wrong but also skeptical I am given how simple my example is and that Reflectly has the same issue.



What I'd love from the community is to understand:
1. Am I doing anything obviously wrong / stupid to cause this
2. If you run on your device, do you see what I see?
3. Is this known and will be worked on? If I commit to Flutter, can I feel comfortable that my lists will scroll smoothly in the near future?



Below is the code you can run to reproduce this (sorry it's a bit contrived but I wanted to play around with various Flutter/Dart features):



import 'package:flutter/material.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'My List',
home: Scaffold(
appBar: AppBar(
title: Text('My List'),
backgroundColor: Color.fromRGBO(255, 0, 0, 0.9),
),
body: Padding(
padding: EdgeInsets.all(16.0),
child: Column(
children: [
Expanded(child: TimeSelector()),
],
)),
));
}
}

abstract class ListItem {}

class TimeHeader implements ListItem {
final String header;

TimeHeader(this.header);
}

class TimeOption implements ListItem {
final String timeString;
final String meridian;

TimeOption(this.timeString, this.meridian);
}

final List<ListItem> litems = [
TimeHeader("Morning"),
TimeOption("10:00", "am"),
TimeOption("10:30", "am"),
TimeOption("11:30", "am"),
TimeHeader("Afternoon"),
TimeOption("1:00", "pm"),
TimeOption("1:30", "pm"),
TimeOption("2:30", "pm"),
TimeHeader("Night"),
TimeOption("5:30", "pm"),
TimeOption("6:30", "pm"),
TimeOption("7:30", "pm"),
TimeOption("8:30", "pm"),
TimeOption("9:30", "pm"),
TimeOption("10:30", "pm"),
TimeOption("11:30", "pm"),
TimeOption("11:45", "pm"),
TimeOption("11:49", "pm"),
];

class TimeSelector extends StatelessWidget {
final _headerFont = new TextStyle(fontWeight: FontWeight.w600, fontSize: 13.0, color: Color.fromRGBO(164, 164, 164, 1));
final _smallerFont = const TextStyle(fontSize: 12.0);

@override
ListView build(BuildContext context) {
return new ListView.builder(
padding: const EdgeInsets.all(16.0),
itemCount: litems.length,
itemBuilder: (BuildContext ctxt, int index) => _buildItem(ctxt, index),
);
}

Widget _buildItem(BuildContext ctxt, int index) {
final item = litems[index];

if (item is TimeHeader) {
return new ListTile(
title: Text(
item.header,
style: _headerFont,
),
);
} else if (item is TimeOption) {
return new ListTile(
title: Text(
item.timeString + item.meridian.toUpperCase(),
style: _smallerFont,
),
);
} else {
return new Text("UNKNOWN");
}
}
}









share|improve this question






















  • code seems fine but what you exact mean by choppy scrolling ?
    – jagdish
    Nov 21 at 5:43










  • tested your code on my simulators work as excepted has no apparent issues.
    – Saed Nabil
    Nov 21 at 5:49










  • choppy means it does not scroll smooth, it jumps a little bit. you have to pay close attention to notice it and it's a little more apparent on the iphone / iOS simulator. scroll slowly and you'll see that it feels like frames are being skipped
    – Tony
    Nov 21 at 9:52










  • are you in release mode ?
    – Raouf Rahiche
    Nov 21 at 9:58










  • your code should work fine in release mode
    – pskink
    Nov 21 at 10:13














0












0








0







I've been evaluating Flutter for use in an app and started with a very simple example of a list of text. After building this first view, I noticed the list view had choppy scrolling so I looked closer at the showcase apps and it turns out that while Reflectly, for example, is a beautiful app, it suffers from the same problem - very choppy scrolling with a simple list of text. So far I have confirmed this on the iOS simulator, an iPhone XR, Samsung Galaxy Android device and Android Pixel 2 XL simulator.



I don't see discussions around this so I wonder if I'm doing something wrong but also skeptical I am given how simple my example is and that Reflectly has the same issue.



What I'd love from the community is to understand:
1. Am I doing anything obviously wrong / stupid to cause this
2. If you run on your device, do you see what I see?
3. Is this known and will be worked on? If I commit to Flutter, can I feel comfortable that my lists will scroll smoothly in the near future?



Below is the code you can run to reproduce this (sorry it's a bit contrived but I wanted to play around with various Flutter/Dart features):



import 'package:flutter/material.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'My List',
home: Scaffold(
appBar: AppBar(
title: Text('My List'),
backgroundColor: Color.fromRGBO(255, 0, 0, 0.9),
),
body: Padding(
padding: EdgeInsets.all(16.0),
child: Column(
children: [
Expanded(child: TimeSelector()),
],
)),
));
}
}

abstract class ListItem {}

class TimeHeader implements ListItem {
final String header;

TimeHeader(this.header);
}

class TimeOption implements ListItem {
final String timeString;
final String meridian;

TimeOption(this.timeString, this.meridian);
}

final List<ListItem> litems = [
TimeHeader("Morning"),
TimeOption("10:00", "am"),
TimeOption("10:30", "am"),
TimeOption("11:30", "am"),
TimeHeader("Afternoon"),
TimeOption("1:00", "pm"),
TimeOption("1:30", "pm"),
TimeOption("2:30", "pm"),
TimeHeader("Night"),
TimeOption("5:30", "pm"),
TimeOption("6:30", "pm"),
TimeOption("7:30", "pm"),
TimeOption("8:30", "pm"),
TimeOption("9:30", "pm"),
TimeOption("10:30", "pm"),
TimeOption("11:30", "pm"),
TimeOption("11:45", "pm"),
TimeOption("11:49", "pm"),
];

class TimeSelector extends StatelessWidget {
final _headerFont = new TextStyle(fontWeight: FontWeight.w600, fontSize: 13.0, color: Color.fromRGBO(164, 164, 164, 1));
final _smallerFont = const TextStyle(fontSize: 12.0);

@override
ListView build(BuildContext context) {
return new ListView.builder(
padding: const EdgeInsets.all(16.0),
itemCount: litems.length,
itemBuilder: (BuildContext ctxt, int index) => _buildItem(ctxt, index),
);
}

Widget _buildItem(BuildContext ctxt, int index) {
final item = litems[index];

if (item is TimeHeader) {
return new ListTile(
title: Text(
item.header,
style: _headerFont,
),
);
} else if (item is TimeOption) {
return new ListTile(
title: Text(
item.timeString + item.meridian.toUpperCase(),
style: _smallerFont,
),
);
} else {
return new Text("UNKNOWN");
}
}
}









share|improve this question













I've been evaluating Flutter for use in an app and started with a very simple example of a list of text. After building this first view, I noticed the list view had choppy scrolling so I looked closer at the showcase apps and it turns out that while Reflectly, for example, is a beautiful app, it suffers from the same problem - very choppy scrolling with a simple list of text. So far I have confirmed this on the iOS simulator, an iPhone XR, Samsung Galaxy Android device and Android Pixel 2 XL simulator.



I don't see discussions around this so I wonder if I'm doing something wrong but also skeptical I am given how simple my example is and that Reflectly has the same issue.



What I'd love from the community is to understand:
1. Am I doing anything obviously wrong / stupid to cause this
2. If you run on your device, do you see what I see?
3. Is this known and will be worked on? If I commit to Flutter, can I feel comfortable that my lists will scroll smoothly in the near future?



Below is the code you can run to reproduce this (sorry it's a bit contrived but I wanted to play around with various Flutter/Dart features):



import 'package:flutter/material.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'My List',
home: Scaffold(
appBar: AppBar(
title: Text('My List'),
backgroundColor: Color.fromRGBO(255, 0, 0, 0.9),
),
body: Padding(
padding: EdgeInsets.all(16.0),
child: Column(
children: [
Expanded(child: TimeSelector()),
],
)),
));
}
}

abstract class ListItem {}

class TimeHeader implements ListItem {
final String header;

TimeHeader(this.header);
}

class TimeOption implements ListItem {
final String timeString;
final String meridian;

TimeOption(this.timeString, this.meridian);
}

final List<ListItem> litems = [
TimeHeader("Morning"),
TimeOption("10:00", "am"),
TimeOption("10:30", "am"),
TimeOption("11:30", "am"),
TimeHeader("Afternoon"),
TimeOption("1:00", "pm"),
TimeOption("1:30", "pm"),
TimeOption("2:30", "pm"),
TimeHeader("Night"),
TimeOption("5:30", "pm"),
TimeOption("6:30", "pm"),
TimeOption("7:30", "pm"),
TimeOption("8:30", "pm"),
TimeOption("9:30", "pm"),
TimeOption("10:30", "pm"),
TimeOption("11:30", "pm"),
TimeOption("11:45", "pm"),
TimeOption("11:49", "pm"),
];

class TimeSelector extends StatelessWidget {
final _headerFont = new TextStyle(fontWeight: FontWeight.w600, fontSize: 13.0, color: Color.fromRGBO(164, 164, 164, 1));
final _smallerFont = const TextStyle(fontSize: 12.0);

@override
ListView build(BuildContext context) {
return new ListView.builder(
padding: const EdgeInsets.all(16.0),
itemCount: litems.length,
itemBuilder: (BuildContext ctxt, int index) => _buildItem(ctxt, index),
);
}

Widget _buildItem(BuildContext ctxt, int index) {
final item = litems[index];

if (item is TimeHeader) {
return new ListTile(
title: Text(
item.header,
style: _headerFont,
),
);
} else if (item is TimeOption) {
return new ListTile(
title: Text(
item.timeString + item.meridian.toUpperCase(),
style: _smallerFont,
),
);
} else {
return new Text("UNKNOWN");
}
}
}






performance flutter






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 21 at 4:45









Tony

10.4k26113177




10.4k26113177












  • code seems fine but what you exact mean by choppy scrolling ?
    – jagdish
    Nov 21 at 5:43










  • tested your code on my simulators work as excepted has no apparent issues.
    – Saed Nabil
    Nov 21 at 5:49










  • choppy means it does not scroll smooth, it jumps a little bit. you have to pay close attention to notice it and it's a little more apparent on the iphone / iOS simulator. scroll slowly and you'll see that it feels like frames are being skipped
    – Tony
    Nov 21 at 9:52










  • are you in release mode ?
    – Raouf Rahiche
    Nov 21 at 9:58










  • your code should work fine in release mode
    – pskink
    Nov 21 at 10:13


















  • code seems fine but what you exact mean by choppy scrolling ?
    – jagdish
    Nov 21 at 5:43










  • tested your code on my simulators work as excepted has no apparent issues.
    – Saed Nabil
    Nov 21 at 5:49










  • choppy means it does not scroll smooth, it jumps a little bit. you have to pay close attention to notice it and it's a little more apparent on the iphone / iOS simulator. scroll slowly and you'll see that it feels like frames are being skipped
    – Tony
    Nov 21 at 9:52










  • are you in release mode ?
    – Raouf Rahiche
    Nov 21 at 9:58










  • your code should work fine in release mode
    – pskink
    Nov 21 at 10:13
















code seems fine but what you exact mean by choppy scrolling ?
– jagdish
Nov 21 at 5:43




code seems fine but what you exact mean by choppy scrolling ?
– jagdish
Nov 21 at 5:43












tested your code on my simulators work as excepted has no apparent issues.
– Saed Nabil
Nov 21 at 5:49




tested your code on my simulators work as excepted has no apparent issues.
– Saed Nabil
Nov 21 at 5:49












choppy means it does not scroll smooth, it jumps a little bit. you have to pay close attention to notice it and it's a little more apparent on the iphone / iOS simulator. scroll slowly and you'll see that it feels like frames are being skipped
– Tony
Nov 21 at 9:52




choppy means it does not scroll smooth, it jumps a little bit. you have to pay close attention to notice it and it's a little more apparent on the iphone / iOS simulator. scroll slowly and you'll see that it feels like frames are being skipped
– Tony
Nov 21 at 9:52












are you in release mode ?
– Raouf Rahiche
Nov 21 at 9:58




are you in release mode ?
– Raouf Rahiche
Nov 21 at 9:58












your code should work fine in release mode
– pskink
Nov 21 at 10:13




your code should work fine in release mode
– pskink
Nov 21 at 10:13

















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%2f53405399%2fsimple-flutter-list-view-choppy-scrolling%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes
















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.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • 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%2f53405399%2fsimple-flutter-list-view-choppy-scrolling%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

Wiesbaden

Marschland

Dieringhausen