import 'package:flutter/material.dart'; Route buyTicketsDialogBuilder(BuildContext context, Object? arguments) { return DialogRoute( context: context, builder: (BuildContext context) { return AlertDialog( title: const Text('How many Tickets?'), content: PurchaseTicketsContent(), actions: [ TextButton( style: TextButton.styleFrom( textStyle: Theme.of(context).textTheme.labelLarge, ), child: const Text('Purchase',style: TextStyle(color: Colors.green),), onPressed: () { // Handle the purchase with the selected ticketCount Navigator.of(context).pop(); }, ), TextButton( style: TextButton.styleFrom( textStyle: Theme.of(context).textTheme.labelLarge, ), child: const Text('Cancel'), onPressed: () { Navigator.of(context).pop(); }, ), ], ); }, ); } class PurchaseTicketsContent extends StatefulWidget { const PurchaseTicketsContent({super.key}); @override State createState() => _PurchaseTicketsContentState(); } int ticketCount = 1; class _PurchaseTicketsContentState extends State { @override Widget build(BuildContext context) { return Column( mainAxisSize: MainAxisSize.min, children: [ Text( 'Select an amount of Tickets you want to purchase', ), SizedBox(height: 20,), Row( mainAxisAlignment: MainAxisAlignment.center, children: [ InkWell( onTap: () { setState(() { if (ticketCount > 1) ticketCount--; }); }, child: Icon(Icons.remove_circle), ), Padding( padding: const EdgeInsets.all(8.0), child: Text( '$ticketCount', style: TextStyle(fontSize: 40), ), ), InkWell( onTap: () { setState(() { ticketCount++; }); }, child: Icon(Icons.add_circle_rounded), ), ], ) ], ); } }