85 lines
2.3 KiB
Dart
85 lines
2.3 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
Route<Object?> buyTicketsDialogBuilder(BuildContext context, Object? arguments) {
|
|
return DialogRoute<void>(
|
|
context: context,
|
|
builder: (BuildContext context) {
|
|
return AlertDialog(
|
|
title: const Text('How many Tickets?'),
|
|
content: PurchaseTicketsContent(),
|
|
actions: <Widget>[
|
|
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<PurchaseTicketsContent> createState() => _PurchaseTicketsContentState();
|
|
}
|
|
int ticketCount = 1;
|
|
class _PurchaseTicketsContentState extends State<PurchaseTicketsContent> {
|
|
@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),
|
|
),
|
|
],
|
|
)
|
|
],
|
|
);
|
|
}
|
|
} |