File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -216,7 +216,9 @@ class _InputPageState extends State<InputPage> {
216216 style: TextStyle (color: Colors .white, fontSize: 20 ),
217217 ),
218218 onPressed: () {
219- if (flavourSelected != null ) {
219+ if (flavourSelected == null ) {
220+ buildShowDialog (context);
221+ } else {
220222 double price =
221223 flavourSelected == Flavours .Margarita ? 11.5 : 13.5 ;
222224
@@ -242,4 +244,20 @@ class _InputPageState extends State<InputPage> {
242244 ],
243245 ));
244246 }
247+
248+ Future <String > buildShowDialog (BuildContext context) {
249+ return showDialog <String >(
250+ context: context,
251+ builder: (BuildContext context) => AlertDialog (
252+ title: const Text ('No flavour selected' ),
253+ content: const Text ('Please select a pizza flavour' ),
254+ actions: < Widget > [
255+ TextButton (
256+ onPressed: () => Navigator .pop (context, 'OK' ),
257+ child: const Text ('OK' ),
258+ ),
259+ ],
260+ ),
261+ );
262+ }
245263}
You can’t perform that action at this time.
0 commit comments