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) + ), + ); }, ) );