diff --git a/lib/pages/games_page.dart b/lib/pages/games_page.dart index d73a57b..a7a1134 100644 --- a/lib/pages/games_page.dart +++ b/lib/pages/games_page.dart @@ -1,12 +1,12 @@ import 'package:flutter/material.dart'; import 'package:maggs_victory_voyage/services/db_helper.dart'; -import 'package:maggs_victory_voyage/widgets/GamesButton.dart'; import 'package:provider/provider.dart'; import '../models/game.dart'; import '../models/profile.dart'; import '../services/games_provider.dart'; import '../services/profiles_provider.dart'; +import '../widgets/games_button.dart'; class GamesPage extends StatefulWidget { const GamesPage({super.key}); @@ -79,7 +79,12 @@ class _GamesPageState extends State { } else { final List list = []; for (final game in games) { - list.add(const GamesButton()); + list.add( + GamesButton( + title: game.name, + buttonPressed: () {}, + ), + ); } return list; } diff --git a/lib/widgets/GamesButton.dart b/lib/widgets/GamesButton.dart deleted file mode 100644 index eb30213..0000000 --- a/lib/widgets/GamesButton.dart +++ /dev/null @@ -1,19 +0,0 @@ -import 'package:flutter/material.dart'; - -class GamesButton extends StatelessWidget { - const GamesButton({super.key}); - - @override - Widget build(BuildContext context) { - return Expanded( - child: Card( - child: Row(children: [ - const Text('Title'), - TextButton( - child: const Text('I won'), - onPressed: () {}, - ) - ]), - )); - } -} diff --git a/lib/widgets/games_button.dart b/lib/widgets/games_button.dart new file mode 100644 index 0000000..4648d2a --- /dev/null +++ b/lib/widgets/games_button.dart @@ -0,0 +1,34 @@ +import 'package:flutter/material.dart'; + +class GamesButton extends StatelessWidget { + const GamesButton( + {super.key, required this.title, required this.buttonPressed}); + final String title; + final VoidCallback buttonPressed; + + @override + Widget build(BuildContext context) { + return Expanded( + child: Card( + child: SizedBox( + width: double.infinity, + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + title, + style: Theme.of(context).textTheme.headlineSmall, + ), + const Padding(padding: EdgeInsets.symmetric(vertical: 10)), + FloatingActionButton.extended( + onPressed: buttonPressed, + label: const Text('I won'), + icon: const Icon(Icons.celebration), + ) + ], + ), + ), + ), + ); + } +}