Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

async build GCWTool ListItem #1846

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions lib/application/tools/widget/gcw_toollist.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,25 +34,40 @@ class _GCWToolListState extends State<GCWToolList> {
);
}



Widget _buildItems() {
return ListView.separated(
physics: const AlwaysScrollableScrollPhysics(),
itemCount: widget.toolList.length + 1,
separatorBuilder: (BuildContext context, int index) => const Divider(),
itemBuilder: (BuildContext context, int i) {
return _buildRow(context, i);
return _buildFutureRowItems(context, i);
},
);
}

Widget _buildRow(BuildContext context, int index) {
Widget _buildFutureRowItems(BuildContext context, int index) {
// Vertical space after the list items
if (index == widget.toolList.length) {
return const ListTile();
}

var tool = widget.toolList[index];

return FutureBuilder<ListTile>(
future: _buildRow(context, tool),
builder: (BuildContext context, AsyncSnapshot<ListTile> snapshot) {
if (snapshot.hasData) {
return snapshot.data!;
} else {
return Container();
}
});
}

Future<ListTile> _buildRow(BuildContext context, GCWTool tool) async {

Future<void> _navigateToSubPage(BuildContext context) async {
Navigator.push(context, NoAnimationMaterialPageRoute<GCWTool>(builder: (context) => tool));
}
Expand Down