delivery dialog
This commit is contained in:
@@ -4,8 +4,9 @@ import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import '../../../../../../application/checkout/checkout_form/checkout_form_bloc.dart';
|
||||
import '../../../../../../common/extension/extension.dart';
|
||||
import '../../../../../../common/theme/theme.dart';
|
||||
import '../../../../../../common/types/order_type.dart';
|
||||
import '../../../../../components/button/button.dart';
|
||||
import '../../../../../components/dialog/order_type_dialog.dart';
|
||||
import '../../../../../components/dialog/dialog.dart';
|
||||
|
||||
class HomeRightTitle extends StatelessWidget {
|
||||
// final TableModel? table;
|
||||
@@ -27,71 +28,47 @@ class HomeRightTitle extends StatelessWidget {
|
||||
children: [
|
||||
Expanded(
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: AppElevatedButton.filled(
|
||||
width: 180.0,
|
||||
height: 40,
|
||||
elevation: 0,
|
||||
onPressed: () {},
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
icon: Icon(Icons.list, color: Colors.white, size: 24),
|
||||
label: 'Daftar Pesanan',
|
||||
),
|
||||
),
|
||||
],
|
||||
children: [_buildButton('Daftar Pesanan', Icons.list, () {})],
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: AppElevatedButton.filled(
|
||||
width: 180.0,
|
||||
height: 40,
|
||||
elevation: 0,
|
||||
onPressed: () {
|
||||
_buildButton(
|
||||
state.orderType.value.toTitleCase(),
|
||||
state.orderType.icon,
|
||||
() {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return OrderTypeDialog();
|
||||
},
|
||||
);
|
||||
},
|
||||
),
|
||||
switch (state.orderType) {
|
||||
OrderType.dineIn => _buildButton(
|
||||
'Pilih Meja',
|
||||
Icons.table_restaurant_outlined,
|
||||
() {},
|
||||
),
|
||||
OrderType.takeAway => SizedBox.shrink(),
|
||||
OrderType.delivery => _buildButton(
|
||||
state.delivery == null
|
||||
? 'Pilih Pengiriman'
|
||||
: (state.delivery?.name ?? "-"),
|
||||
Icons.motorcycle_outlined,
|
||||
() {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return OrderTypeDialog();
|
||||
return DeliveryDialog();
|
||||
},
|
||||
);
|
||||
},
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
icon: Icon(
|
||||
state.orderType.icon,
|
||||
color: Colors.white,
|
||||
size: 24,
|
||||
),
|
||||
label: state.orderType.value.toTitleCase(),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: AppElevatedButton.filled(
|
||||
width: 180.0,
|
||||
height: 40,
|
||||
elevation: 0,
|
||||
icon: Icon(
|
||||
Icons.motorcycle_outlined,
|
||||
color: Colors.white,
|
||||
size: 24,
|
||||
),
|
||||
onPressed: () {
|
||||
// showDialog(
|
||||
// context: context,
|
||||
// builder: (context) {
|
||||
// return DeliveryDialog();
|
||||
// },
|
||||
// );
|
||||
},
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
label: 'Pilih Pengiriman',
|
||||
),
|
||||
),
|
||||
OrderType.freeTable => SizedBox.shrink(),
|
||||
},
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -101,4 +78,19 @@ class HomeRightTitle extends StatelessWidget {
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
Expanded _buildButton(String label, IconData icon, Function() onPressed) {
|
||||
return Expanded(
|
||||
child: AppElevatedButton.filled(
|
||||
width: 180.0,
|
||||
height: 40,
|
||||
elevation: 0,
|
||||
onPressed: onPressed,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
icon: Icon(icon, color: Colors.white, size: 24),
|
||||
label: label,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user