Reputation: 105
My page contains a flatbutton. When I press on that button, Navigate to another page(It contains 50 textformfield) too slow. How to resolve it?.Here is my code for sample.
@override
_SampleState createState() => _SampleState();
}
class _SampleState extends State<Sample> {
@override
Widget build(BuildContext context) {
return Scaffold(
body: SingleChildScrollView(child: Column(children: [Table(children: [
TableRow(children: [Column(children: [Text('Name')],),Column(children: [TextFormField(decoration:InputDecoration())],)]),
TableRow(children: [Column(children: [Text('Name')],),Column(children: [TextFormField(decoration:InputDecoration())],)]),
TableRow(children: [Column(children: [Text('Name')],),Column(children: [TextFormField(decoration:InputDecoration())],)]),//repeat 60 times
],)],),),);}}
Upvotes: 0
Views: 212
Reputation: 852
You should probably use a Listview.builder
what you're doing currently is painting all 50 textfields at the same time even if they're not on the screen.
Upvotes: 3