From 1f996cd2f66d40f0222032c72cc4a389bb6075c2 Mon Sep 17 00:00:00 2001 From: Fernando Martin Garcia Del Angel Date: Sun, 16 Feb 2020 21:58:55 -0600 Subject: [PATCH 1/2] Improved List Display Improved results display --- eight_queens/lib/results.dart | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/eight_queens/lib/results.dart b/eight_queens/lib/results.dart index b166907..7c11c4b 100644 --- a/eight_queens/lib/results.dart +++ b/eight_queens/lib/results.dart @@ -41,15 +41,20 @@ class _ResultsPageState extends State { @override Widget build(BuildContext context) { return Scaffold( - appBar: AppBar( - title: Text(widget.title), - ), - body: new ListView.builder( - itemCount: boards.length ?? 0, - itemBuilder: (BuildContext context, int index) { - return new Text(boards[index].toString()); - }, - ) + appBar: AppBar( + title: Text(widget.title), + ), + body: new ListView.builder( + itemCount: boards.length ?? 0, + itemBuilder: (BuildContext context, int index) { + String todisplay = ""; + for(int x = 0; x < boards[index].length; x++ ){ + todisplay += boards[index][x].toString(); + todisplay+= "\n"; + } + return Text(todisplay); + }, + ) ); } } \ No newline at end of file From f283fc6c77381df0cf0dbb4d1743b4aa1e09c4fb Mon Sep 17 00:00:00 2001 From: Fernando Martin Garcia Del Angel Date: Sun, 16 Feb 2020 22:07:56 -0600 Subject: [PATCH 2/2] Added title and subtitle tile Added better tiles and subtiles --- eight_queens/lib/results.dart | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/eight_queens/lib/results.dart b/eight_queens/lib/results.dart index 7c11c4b..cf843d3 100644 --- a/eight_queens/lib/results.dart +++ b/eight_queens/lib/results.dart @@ -37,6 +37,15 @@ class _ResultsPageState extends State { super.initState(); }); } + + Widget ResultItem(BuildContext context, int index) { + String todisplay = ""; + for(int x = 0; x < boards[index].length; x++ ){ + todisplay += boards[index][x].toString(); + todisplay+= "\n"; + } + return Text(todisplay); + } @override Widget build(BuildContext context) { @@ -47,12 +56,12 @@ class _ResultsPageState extends State { body: new ListView.builder( itemCount: boards.length ?? 0, itemBuilder: (BuildContext context, int index) { - String todisplay = ""; - for(int x = 0; x < boards[index].length; x++ ){ - todisplay += boards[index][x].toString(); - todisplay+= "\n"; - } - return Text(todisplay); + return ListTile( + title: Text('Result ${index+1}'), + subtitle: Container( + child: ResultItem(context, index) + ), + ); }, ) );