User
User

Reputation: 105

Flutter page comes too slow, when page size is high

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 sampleScreenshot shows, the first page is stuck when navigation button pressed. After 5 seconds the next page comes.

  @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

Answers (1)

Mathiew Abbas
Mathiew Abbas

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

Related Questions