0

This code in question. Each item in the list is a Row with two Columns of text. Just this causes massive performance drops even in release mode. Currently trying to build a Reddit style layout for posts. Using Columns nested in a Row is drastically reducing performance. My guess is it's because Row's and Column's size themselves based on their children so nesting them increases the needed calculations for size. I just don't know how to work around this.

new ListView.builder(
    controller: new ScrollController(initialScrollOffset: this.offset),
    key: new UniqueKey(),
    itemCount: this._posts != null ? this._posts.length : 0,
    itemBuilder: (BuildContext context, int i) {
      return new PostCard(
        widget._posts[i],
      );
    },
  ),

The return of PostCard looks like this (example):

return new Container(
  child: new Row(
    crossAxisAlignment: CrossAxisAlignment.start,
    children: <Widget>[
      new Column(
        children: <Widget>[
          new Text("Hello World"),
          new Text("Hello World"),
          new Text("Hello World"),
          new Text("Hello World"),
        ],
      ),
      new Column(
        children: <Widget>[
          new Text("Hello World"),
          new Text("Hello World"),
          new Text("Hello World"),
          new Text("Hello World"),
        ],
      ),
    ],
  ),
);

Edit: Screenshot of full UI sample. Same level of jank as the nested Column example above.

New account can't embed, but here's my goal.

  • Can you post a sample screen of what you are trying to accomplish? – Vinoth Kumar Jun 01 '18 at 08:48
  • @VinothKumar yep added to post – Kellan Mebane Jun 01 '18 at 17:55
  • Try to stretch row and column width to full screen with mainAxisSize: MainAxisSize.max, for Row and crossAxisAlignment: CrossAxisAlignment.stretch, for column – Vinoth Kumar Jun 01 '18 at 18:05
  • Yeah I can build the UI fine, it's just that scrolling through a list of these cards is less than 30fps on release. I'm guessing it's just a product of Flutter in it's infancy since even the Hamilton App and https://stackoverflow.com/questions/44396075/equivalent-of-relativelayout-in-flutter the top answer from this post have the same janky scrolling. Quick Edit: I'm running all of these on the S7 Edge. – Kellan Mebane Jun 01 '18 at 21:02

1 Answers1

-2

Update. Tested on other phones, problem doesn't exist. Issue is only with my specific phone (S7 Edge on 7.0).