simple popup
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:maggs_victory_voyage/services/db_helper.dart';
|
import 'package:maggs_victory_voyage/services/db_helper.dart';
|
||||||
|
import 'package:maggs_victory_voyage/widgets/games_popup.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
import '../models/game.dart';
|
import '../models/game.dart';
|
||||||
@@ -82,7 +83,16 @@ class _GamesPageState extends State<GamesPage> {
|
|||||||
list.add(
|
list.add(
|
||||||
GamesButton(
|
GamesButton(
|
||||||
title: game.name,
|
title: game.name,
|
||||||
buttonPressed: () {},
|
buttonPressed: () {
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (context) => GamesPopup(
|
||||||
|
withPlacements: game.rewards.length > 1,
|
||||||
|
game: game,
|
||||||
|
onSubmitted: (_) {},
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
44
lib/widgets/games_popup.dart
Normal file
44
lib/widgets/games_popup.dart
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
import '../models/game.dart';
|
||||||
|
|
||||||
|
typedef IntCallback = Function(int);
|
||||||
|
|
||||||
|
class GamesPopup extends StatelessWidget {
|
||||||
|
const GamesPopup({
|
||||||
|
super.key,
|
||||||
|
this.withPlacements = false,
|
||||||
|
required this.onSubmitted,
|
||||||
|
required this.game,
|
||||||
|
});
|
||||||
|
final bool withPlacements;
|
||||||
|
final IntCallback onSubmitted;
|
||||||
|
final Game game;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return SizedBox(
|
||||||
|
height: 400,
|
||||||
|
width: 400,
|
||||||
|
child: AlertDialog(
|
||||||
|
title: _getTitle(withPlacements),
|
||||||
|
content: _getContent(withPlacements),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _getTitle(bool withPlacements) {
|
||||||
|
if (withPlacements) {
|
||||||
|
return const Text('Which place did you achieve?');
|
||||||
|
}
|
||||||
|
return Text('Confirm you won at ${game.name}');
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _getContent(bool withPlacements) {
|
||||||
|
if (withPlacements) {
|
||||||
|
return const Text('');
|
||||||
|
} else {
|
||||||
|
return const Text('');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user