Commit 21db6841 authored by Dio Maulana's avatar Dio Maulana

14/09/22 new home byod

parent 0add2b63
...@@ -247,7 +247,9 @@ double heightTombol = 0.06; // untuk dikalikan di height media query ...@@ -247,7 +247,9 @@ double heightTombol = 0.06; // untuk dikalikan di height media query
const Color backgroundColor = Color(0xffE5E5E5); const Color backgroundColor = Color(0xffE5E5E5);
const textColorTabel = Color(0xff333333); const textColorTabel = Color(0xff333333);
const textColorBlack = Color(0xff000000); const textColorBlack = Color(0xff000000);
const textColorRed = Color(0xffE73636);
const textGrey = Color(0xffE0E0E0); const textGrey = Color(0xffE0E0E0);
const textColorModalHeaderNama = Color(0xffCCCCFF);
const gridCardBackgroundColor = Color(0xffFFFFFF); const gridCardBackgroundColor = Color(0xffFFFFFF);
Color buttonColor = Color buttonColor =
(!isExcelso) ? const Color(0xff003366) : const Color(0xffccb46c); (!isExcelso) ? const Color(0xff003366) : const Color(0xffccb46c);
...@@ -477,6 +479,7 @@ const double refreshIconSize = 0.02; ...@@ -477,6 +479,7 @@ const double refreshIconSize = 0.02;
//** max item menu */ //** max item menu */
const int maxItemMenu = 10; const int maxItemMenu = 10;
const int maxItemMenuFav = 10;
//** max item menu */ //** max item menu */
//** type menu */ //** type menu */
......
import 'package:byod/helper/widget/style.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import '../../bloc/order_bloc.dart';
import '../../models/filter_menu.dart';
import '../../models/order_variants.dart';
import '../../models/orders.dart';
import '../helper.dart';
class NoteModalBottomSheet extends StatelessWidget {
const NoteModalBottomSheet({
Key? key,
required this.noteController,
required this.initialValue,
required this.orderVariants,
required this.menuItem,
required this.lisrOrders,
}) : super(key: key);
final TextEditingController noteController;
final int initialValue;
final List<OrderVariant> orderVariants;
final FilterMenu menuItem;
final List<Orders> lisrOrders;
@override
Widget build(BuildContext context) {
return Container(
margin: const EdgeInsets.symmetric(horizontal: 20),
height: MediaQuery.of(context).size.height * 0.9,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
margin: const EdgeInsets.only(
top: 20,
bottom: 20,
),
child: defaultText(
context,
'catatan untuk pesanan',
style: textHeaderNote(),
),
),
const Divider(
thickness: 2,
color: Colors.white,
),
TextField(
maxLength: maxLengthTextField,
maxLines: 5,
autofocus: true,
keyboardType: TextInputType.text,
controller: noteController,
style: noteModal(),
decoration: InputDecoration(
border: InputBorder.none,
hintText: placeHolderNote,
hintStyle: const TextStyle(
color: Colors.grey,
fontFamily: 'OpenSans',
fontSize: 14,
),
),
),
const Divider(
thickness: 2,
color: Colors.white,
),
const SizedBox(
height: 20,
),
GestureDetector(
onTap: () {
context.read<OrdersBloc>().insertData([
[
menuItem.id,
menuItem.name,
initialValue,
amountParseToInt(menuItem.price),
lisrOrders,
menuItem.imageUrlMedium,
orderVariants,
amountParseToInt(menuItem.price),
noteController.text
]
], context);
Navigator.pop(context);
},
child: Align(
alignment: Alignment.centerRight,
child: Container(
height: 36,
width: 89,
decoration: BoxDecoration(
color: buttonColor,
borderRadius: BorderRadius.circular(21),
),
child: Center(
child: defaultText(
context,
"Simpan",
style: simpanButtonNote(),
),
),
),
),
)
],
),
);
}
}
import 'dart:ui';
import 'package:byod/helper/helper.dart'; import 'package:byod/helper/helper.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
...@@ -205,6 +207,55 @@ TextStyle textAmountButtonBottomCart({ ...@@ -205,6 +207,55 @@ TextStyle textAmountButtonBottomCart({
); );
} }
TextStyle textCountItem({
font = 20,
Color color = textInButton,
}) {
return TextStyle(
fontFamily: 'Robot',
fontSize: font,
fontWeight: FontWeight.w500,
color: color,
);
}
TextStyle textHeaderNote({
font = 20,
Color color = textColorBlack,
}) {
return TextStyle(
fontFamily: 'Mulish',
fontSize: font,
fontWeight: FontWeight.w700,
color: color,
);
}
TextStyle simpanButtonNote({
font = 16,
Color color = textInButton,
FontWeight fontWeight = FontWeight.w400,
}) {
return TextStyle(
fontFamily: 'OpenSans',
fontSize: font,
fontWeight: fontWeight,
color: color,
);
}
TextStyle modalNamaHeader({
font = 14,
Color color = textColorModalHeaderNama,
}) {
return TextStyle(
fontFamily: 'OpenSans',
fontSize: font,
fontWeight: FontWeight.w400,
color: color,
);
}
Text fontAwesome(BuildContext context, String unicode, double fontSize, Text fontAwesome(BuildContext context, String unicode, double fontSize,
{Color? color, isBold = true}) { {Color? color, isBold = true}) {
// double widthScreens = responsiveWidthScreen(context); // double widthScreens = responsiveWidthScreen(context);
...@@ -389,6 +440,15 @@ Text textAddButton(BuildContext context, String text) { ...@@ -389,6 +440,15 @@ Text textAddButton(BuildContext context, String text) {
// )); // ));
} }
TextStyle noteModal() {
return const TextStyle(
fontFamily: 'OpenSans',
fontWeight: FontWeight.w400,
color: textColorBlack,
fontSize: 14,
);
}
TextStyle textStyleListHistoryOrder(context, TextStyle textStyleListHistoryOrder(context,
{font = listHistoryFontName, isBold = false}) { {font = listHistoryFontName, isBold = false}) {
return TextStyle( return TextStyle(
......
// ignore_for_file: sized_box_for_whitespace, avoid_unnecessary_containers
import 'package:byod/models/orders.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import '../../bloc/order_bloc.dart';
import '../../bloc/order_variant_temporary.dart';
import '../../helper/helper.dart'; import '../../helper/helper.dart';
import '../../helper/widget/note_modal_bottom_sheet.dart';
import '../../helper/widget/style.dart'; import '../../helper/widget/style.dart';
import '../../models/filter_menu.dart'; import '../../models/filter_menu.dart';
import '../../models/order_details.dart';
import '../../models/order_variants.dart';
import 'bottom_sheet_menu.dart';
import 'bottom_sheet_variant.dart';
import 'variant_cat.dart';
class FavGridMenu extends StatelessWidget { class FavGridMenu extends StatelessWidget {
const FavGridMenu({ const FavGridMenu({
...@@ -20,7 +32,6 @@ class FavGridMenu extends StatelessWidget { ...@@ -20,7 +32,6 @@ class FavGridMenu extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
bool addCondition = false;
return Container( return Container(
margin: EdgeInsets.only( margin: EdgeInsets.only(
left: (i == 0) ? 0 : 8, // paling awal gausah dikasih margin left: (i == 0) ? 0 : 8, // paling awal gausah dikasih margin
...@@ -51,11 +62,37 @@ class FavGridMenu extends StatelessWidget { ...@@ -51,11 +62,37 @@ class FavGridMenu extends StatelessWidget {
borderRadius: BorderRadius.circular(8), borderRadius: BorderRadius.circular(8),
// color: Colors.red, // color: Colors.red,
), ),
child: ClipRRect( child: GestureDetector(
borderRadius: BorderRadius.circular(8), onTap: () {
child: Image( showModalBottomSheet(
fit: BoxFit.fill, backgroundColor: backgroundColor.withOpacity(0),
image: NetworkImage(categoryFavAfterSelect[i].imageUrlMedium), isScrollControlled: true,
context: context,
builder: (context) {
return ShowMenuModal(
imageUrl: categoryFavAfterSelect[i].imageUrlMedium,
namaMenu: categoryFavAfterSelect[i].name,
hargaMenu:
amountParseToInt(categoryFavAfterSelect[i].price),
isHavevariant:
categoryFavAfterSelect[i].variantCat.isNotEmpty
? true
: false,
description: categoryFavAfterSelect[i].description,
id: categoryFavAfterSelect[i].id,
variantCat: categoryFavAfterSelect[i].variantCat,
isSell: categoryFavAfterSelect[i].isSell,
);
},
);
},
child: ClipRRect(
borderRadius: BorderRadius.circular(8),
child: Image(
fit: BoxFit.fill,
image:
NetworkImage(categoryFavAfterSelect[i].imageUrlMedium),
),
), ),
), ),
), ),
...@@ -94,28 +131,164 @@ class FavGridMenu extends StatelessWidget { ...@@ -94,28 +131,164 @@ class FavGridMenu extends StatelessWidget {
const SizedBox( const SizedBox(
height: 16, height: 16,
), ),
(addCondition) addRemoveQuantity(context, categoryFavAfterSelect[i])
? Container( ],
),
),
);
}
BlocBuilder addRemoveQuantity(BuildContext context, FilterMenu menuFav) {
List<OrderVariant> orderVariants = [];
return BlocBuilder<OrdersBloc, List<Orders>>(
builder: (contextOrders, list) {
bool
addCondition; // true untuk menampilkan tambah, false untuk menampilkan quantity plus minus
int indexListOrderan =
list.indexWhere((listOrderan) => listOrderan.id == menuFav.id);
int initialValue;
if (indexListOrderan != -1) {
if (menuFav.variantCat.isNotEmpty) {
addCondition = true; // kalau menu itu ada variantnya, biarin true
} else {
addCondition = false;
}
initialValue = list[indexListOrderan].totalItem;
} else {
addCondition = true;
initialValue = 0;
}
String variantButtonCount = '';
if (initialValue == 1 && menuFav.variantCat.isNotEmpty) {
variantButtonCount = '$initialValue Item';
} else if (initialValue > 1 && menuFav.variantCat.isNotEmpty) {
variantButtonCount = '$initialValue Items';
}
final noteController = TextEditingController(
text: (indexListOrderan != -1) ? list[indexListOrderan].note : '');
return AnimatedSwitcher(
duration: Duration(milliseconds: animatedTime),
transitionBuilder: (Widget child, Animation<double> animation) {
return ScaleTransition(scale: animation, child: child);
},
child: (addCondition)
? GestureDetector(
key: const Key('AddButton'),
onTap: () {
if (menuFav.isSell) {
if (menuFav.variantCat.isNotEmpty) {
if (indexListOrderan == -1) {
context
.read<OrderVariantTemporaryBloc>()
.insertDataVariant(
menuFav.id,
amountParseToInt(menuFav.price),
1,
[],
); // check pada bloc untuk mengethui list arraynya
Navigator.push(
context,
MaterialPageRoute(
builder: (_) => VariantCat(
namaMenu: menuFav.name,
variantCategories: menuFav.variantCat,
initPrice:
amountParseToInt(menuFav.price),
idItem: menuFav.id,
imageUrl: menuFav.imageUrlThumbnail,
listCurrentOrder: list,
orderDetail: OrderDetail(
allIdVariant: '',
totalItem: 0,
totalHarga: 0,
note: '',
orderVariant: [],
),
)));
} else {
showModalBottomSheet(
backgroundColor: Colors.white.withOpacity(0),
isScrollControlled: true,
context: context,
builder: (context) {
return CustomizeVariant(
orders: list[indexListOrderan],
variantCat: menuFav.variantCat);
},
);
}
} else {
if (initialValue == 0) {
initialValue += 1;
context.read<OrdersBloc>().insertData([
[
menuFav.id,
menuFav.name,
initialValue,
amountParseToInt(menuFav.price),
list,
menuFav.imageUrlMedium,
orderVariants,
amountParseToInt(menuFav.price),
(indexListOrderan != -1)
? list[indexListOrderan].note
: ''
]
], context);
// setState(() {});
}
}
}
},
child: Container(
height: 30, height: 30,
width: widthGrid - (2 * paddingLeftRigthGrid), width: widthGrid - (2 * paddingLeftRigthGrid),
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(6), borderRadius: BorderRadius.circular(6),
color: buttonColor, color: (menuFav.isSell) ? buttonColor : Colors.grey,
), ),
child: Center( child: Center(
child: defaultText( child: defaultText(
context, context,
'Tambah', (menuFav.isSell == false)
? 'Habis'
: (initialValue == 0)
? 'Tambah'
: (initialValue > 0 &&
menuFav.variantCat.isNotEmpty)
? variantButtonCount
: 'Tambah',
style: addButtonGridFav(), style: addButtonGridFav(),
), ),
), ),
) ),
: Container( )
height: 30, : Container(
width: widthGrid - (2 * paddingLeftRigthGrid), key: const Key('AddButton'),
child: Row( height: 30,
children: [ width: widthGrid - (2 * paddingLeftRigthGrid),
Container( child: Row(
children: [
GestureDetector(
onTap: () {
showModalBottomSheet(
backgroundColor: backgroundColor,
isScrollControlled: true,
context: context,
builder: (context) {
return NoteModalBottomSheet(
noteController: noteController,
initialValue: initialValue,
orderVariants: orderVariants,
menuItem: menuFav,
lisrOrders: list,
);
},
);
},
child: Container(
width: 27, width: 27,
height: 24, height: 24,
decoration: BoxDecoration( decoration: BoxDecoration(
...@@ -131,38 +304,82 @@ class FavGridMenu extends StatelessWidget { ...@@ -131,38 +304,82 @@ class FavGridMenu extends StatelessWidget {
), ),
), ),
), ),
const SizedBox( ),
width: 5, const SizedBox(
), width: 5,
Container( ),
GestureDetector(
onTap: () {
if (initialValue > 0) {
initialValue -= 1;
context.read<OrdersBloc>().insertData([
[
menuFav.id,
menuFav.name,
initialValue,
amountParseToInt(menuFav.price),
list,
menuFav.imageUrlMedium,
orderVariants,
amountParseToInt(menuFav.price),
(indexListOrderan != -1)
? list[indexListOrderan].note
: ''
]
], context);
// setState(() {});
}
},
child: Container(
width: 22, width: 22,
height: 22, height: 22,
child: const Image( child: Image(
image: AssetImage('assets/icons/minus.png'), color: buttonColor,
image: const AssetImage('assets/icons/minus.png'),
), ),
), ),
Expanded( ),
child: Center( Expanded(
child: defaultText( child: Center(
context, child: defaultText(
'10', context,
style: amountGridFav(), initialValue.toString(),
), style: amountGridFav(),
), ),
), ),
Container( ),
GestureDetector(
onTap: () {
initialValue += 1;
context.read<OrdersBloc>().insertData([
[
menuFav.id,
menuFav.name,
initialValue,
amountParseToInt(menuFav.price),
list,
menuFav.imageUrlMedium,
orderVariants,
amountParseToInt(menuFav.price),
(indexListOrderan != -1)
? list[indexListOrderan].note
: '',
]
], context);
},
child: Container(
width: 22, width: 22,
height: 22, height: 22,
child: const Image( child: const Image(
image: AssetImage('assets/icons/plus.png'), image: AssetImage('assets/icons/plus.png'),
), ),
) ),
], )
), ],
) ),
], ),
), );
), },
); );
} }
} }
// ignore_for_file: sized_box_for_whitespace // ignore_for_file: sized_box_for_whitespace
import 'package:byod/bloc/order_bloc.dart';
import 'package:byod/models/orders.dart';
import 'package:byod/ui/home/variant_cat.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import '../../bloc/order_variant_temporary.dart';
import '../../helper/helper.dart'; import '../../helper/helper.dart';
import '../../helper/widget/note_modal_bottom_sheet.dart';
import '../../helper/widget/style.dart'; import '../../helper/widget/style.dart';
import '../../models/filter_menu.dart'; import '../../models/filter_menu.dart';
import '../../models/order_details.dart';
import '../../models/order_variants.dart';
import 'bottom_sheet_variant.dart';
class MenuListUtama extends StatelessWidget { class MenuListUtama extends StatelessWidget {
const MenuListUtama({ const MenuListUtama({
...@@ -18,7 +27,6 @@ class MenuListUtama extends StatelessWidget { ...@@ -18,7 +27,6 @@ class MenuListUtama extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
bool addCondition = false;
return Column( return Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
...@@ -53,7 +61,10 @@ class MenuListUtama extends StatelessWidget { ...@@ -53,7 +61,10 @@ class MenuListUtama extends StatelessWidget {
: const SizedBox(), : const SizedBox(),
(categoryNonFav[i].type == typeMenu) (categoryNonFav[i].type == typeMenu)
? Container( ? Container(
margin: const EdgeInsets.symmetric(vertical: 19), margin: EdgeInsets.only(
top: 19,
bottom: (i + 1 == categoryNonFav.length) ? 85 : 19,
),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.end, crossAxisAlignment: CrossAxisAlignment.end,
children: [ children: [
...@@ -117,111 +128,291 @@ class MenuListUtama extends StatelessWidget { ...@@ -117,111 +128,291 @@ class MenuListUtama extends StatelessWidget {
height: 8, height: 8,
width: double.infinity, width: double.infinity,
), ),
(addCondition) addRemoveQuantity(context, categoryNonFav[i])
? Container( ],
height: 36, ),
width: double.infinity, )
child: Row( : const SizedBox(),
children: [ ],
const Spacer(), );
Container( }
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10), BlocBuilder addRemoveQuantity(BuildContext context, FilterMenu menuUtama) {
color: buttonColor, List<OrderVariant> orderVariants = [];
), return BlocBuilder<OrdersBloc, List<Orders>>(
height: double.infinity, builder: (contextOrders, list) {
width: 125, bool
child: Center( addCondition; // true untuk menampilkan tambah, false untuk menampilkan quantity plus minus
child: defaultText( int indexListOrderan =
context, list.indexWhere((listOrderan) => listOrderan.id == menuUtama.id);
'Tambah', int initialValue;
style: addButtonMenu(), if (indexListOrderan != -1) {
), if (menuUtama.variantCat.isNotEmpty) {
), addCondition = true; // kalau menu itu ada variantnya, biarin true
) } else {
], addCondition = false;
}
initialValue = list[indexListOrderan].totalItem;
} else {
addCondition = true;
initialValue = 0;
}
String variantButtonCount = '';
if (initialValue == 1 && menuUtama.variantCat.isNotEmpty) {
variantButtonCount = '$initialValue Item';
} else if (initialValue > 1 && menuUtama.variantCat.isNotEmpty) {
variantButtonCount = '$initialValue Items';
}
final noteController = TextEditingController(
text: (indexListOrderan != -1) ? list[indexListOrderan].note : '');
return AnimatedSwitcher(
duration: Duration(milliseconds: animatedTime),
transitionBuilder: (Widget child, Animation<double> animation) {
return ScaleTransition(scale: animation, child: child);
},
child: (addCondition)
? Container(
key: const Key('AddButtonMenuKey'),
height: 36,
width: double.infinity,
child: Row(
children: [
const Spacer(),
GestureDetector(
onTap: () {
if (menuUtama.isSell) {
if (menuUtama.variantCat.isNotEmpty) {
if (indexListOrderan == -1) {
context
.read<OrderVariantTemporaryBloc>()
.insertDataVariant(
menuUtama.id,
amountParseToInt(menuUtama.price),
1,
[],
); // check pada bloc untuk mengethui list arraynya
Navigator.push(
context,
MaterialPageRoute(
builder: (_) => VariantCat(
namaMenu: menuUtama.name,
variantCategories:
menuUtama.variantCat,
initPrice: amountParseToInt(
menuUtama.price),
idItem: menuUtama.id,
imageUrl:
menuUtama.imageUrlThumbnail,
listCurrentOrder: list,
orderDetail: OrderDetail(
allIdVariant: '',
totalItem: 0,
totalHarga: 0,
note: '',
orderVariant: [],
),
)));
} else {
showModalBottomSheet(
backgroundColor: Colors.white.withOpacity(0),
isScrollControlled: true,
context: context,
builder: (context) {
return CustomizeVariant(
orders: list[indexListOrderan],
variantCat: menuUtama.variantCat);
},
);
}
} else {
if (initialValue == 0) {
initialValue += 1;
context.read<OrdersBloc>().insertData([
[
menuUtama.id,
menuUtama.name,
initialValue,
amountParseToInt(menuUtama.price),
list,
menuUtama.imageUrlMedium,
orderVariants,
amountParseToInt(menuUtama.price),
(indexListOrderan != -1)
? list[indexListOrderan].note
: ''
]
], context);
// setState(() {});
}
}
}
},
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10),
color: buttonColor,
),
height: double.infinity,
width: 125,
child: Center(
child: defaultText(
context,
(menuUtama.isSell == false)
? 'Habis'
: (initialValue == 0)
? 'Tambah'
: (initialValue > 0 &&
menuUtama.variantCat.isNotEmpty)
? variantButtonCount
: 'Tambah',
style: addButtonMenu(),
), ),
) ),
: Container( ),
height: 36, )
width: 125, ],
child: Row( ),
children: [ )
Container( : Container(
width: 27, key: const Key('AddButtonMenuKey'),
height: 24, height: 36,
decoration: BoxDecoration( width: 125,
borderRadius: BorderRadius.circular(6), child: Row(
color: buttonColor, children: [
), GestureDetector(
child: const Center( onTap: () {
showModalBottomSheet(
backgroundColor: backgroundColor,
isScrollControlled: true,
context: context,
builder: (context) {
return NoteModalBottomSheet(
noteController: noteController,
initialValue: initialValue,
orderVariants: orderVariants,
menuItem: menuUtama,
lisrOrders: list,
);
},
);
},
child: Container(
width: 27,
height: 24,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(6),
color: buttonColor,
),
child: const Center(
child: Image(
width: 13.33,
height: 13.33,
color: textInButton,
image: AssetImage('assets/icons/note.png'),
),
),
),
),
const SizedBox(
width: 5,
),
Expanded(
child: Container(
height: 22,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(30),
color: Colors.white,
),
child: Stack(
children: [
Positioned(
left: 0,
child: GestureDetector(
onTap: () {
if (initialValue > 0) {
initialValue -= 1;
context.read<OrdersBloc>().insertData([
[
menuUtama.id,
menuUtama.name,
initialValue,
amountParseToInt(menuUtama.price),
list,
menuUtama.imageUrlMedium,
orderVariants,
amountParseToInt(menuUtama.price),
(indexListOrderan != -1)
? list[indexListOrderan].note
: ''
]
], context);
// setState(() {});
}
},
child: Container(
width: 22,
height: 22,
child: Image( child: Image(
width: 13.33, color: buttonColor,
height: 13.33, image: const AssetImage(
color: textInButton, 'assets/icons/minus.png'),
image:
AssetImage('assets/icons/note.png'),
), ),
), ),
), ),
const SizedBox( ),
width: 5, Positioned(
), right: 0,
Expanded( child: GestureDetector(
onTap: () {
initialValue += 1;
context.read<OrdersBloc>().insertData([
[
menuUtama.id,
menuUtama.name,
initialValue,
amountParseToInt(menuUtama.price),
list,
menuUtama.imageUrlMedium,
orderVariants,
amountParseToInt(menuUtama.price),
(indexListOrderan != -1)
? list[indexListOrderan].note
: '',
]
], context);
},
child: Container( child: Container(
width: 22,
height: 22, height: 22,
decoration: BoxDecoration( child: const Image(
borderRadius: BorderRadius.circular(30), image:
color: Colors.white, AssetImage('assets/icons/plus.png'),
), ),
child: Stack( ),
children: [ ),
Positioned( ),
left: 0, Center(
child: Container( child: Container(
width: 22, height: 22,
height: 22, child: Center(
child: const Image( child: defaultText(
image: AssetImage( context,
'assets/icons/minus.png'), initialValue.toString(),
), style: amountGridFav(),
),
),
Positioned(
right: 0,
child: Container(
width: 22,
height: 22,
child: const Image(
image: AssetImage(
'assets/icons/plus.png'),
),
),
),
Center(
child: Container(
height: 22,
child: Center(
child: defaultText(
context,
'10',
style: amountGridFav(),
),
),
),
),
],
), ),
), ),
), ),
], ),
), ],
) ),
], ),
),
],
),
), ),
) );
: const SizedBox(), },
],
); );
} }
} }
...@@ -3,17 +3,23 @@ ...@@ -3,17 +3,23 @@
import 'package:byod/bloc/branch_exist.dart'; import 'package:byod/bloc/branch_exist.dart';
import 'package:byod/bloc/fav_selected_bar.dart'; import 'package:byod/bloc/fav_selected_bar.dart';
import 'package:byod/bloc/menu_selected_bar.dart'; import 'package:byod/bloc/menu_selected_bar.dart';
import 'package:byod/bloc/order_bloc.dart';
import 'package:byod/helper/helper.dart'; import 'package:byod/helper/helper.dart';
import 'package:byod/helper/widget/style.dart'; import 'package:byod/helper/widget/style.dart';
import 'package:byod/models/filter_menu.dart'; import 'package:byod/models/filter_menu.dart';
import 'package:byod/models/orders.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import '../../bloc/filter_menu.dart'; import '../../bloc/filter_menu.dart';
import '../../helper/widget/button_dialog.dart'; import '../../helper/widget/button_dialog.dart';
import '../../main.dart'; import '../../main.dart';
import '../../models/fav_group.dart'; import '../../models/fav_group.dart';
import '../checkout/checkout.dart';
import '../checkout/fuction.dart';
import '../screen_responsive.dart'; import '../screen_responsive.dart';
import '../viewbill/view_bill.dart';
import 'cat_list.dart'; import 'cat_list.dart';
import 'fav_grid_menu.dart'; import 'fav_grid_menu.dart';
import 'fav_list.dart'; import 'fav_list.dart';
...@@ -34,6 +40,7 @@ class _NewHome2State extends State<NewHome2> { ...@@ -34,6 +40,7 @@ class _NewHome2State extends State<NewHome2> {
bool isFirstLoad = true; bool isFirstLoad = true;
final searchController = TextEditingController(); final searchController = TextEditingController();
final _scrollController = ScrollController(); final _scrollController = ScrollController();
final _scrollFavItem = ScrollController();
final _scrollMenuItem = ScrollController(); final _scrollMenuItem = ScrollController();
late bool isScrollableMenu = false; late bool isScrollableMenu = false;
...@@ -41,6 +48,17 @@ class _NewHome2State extends State<NewHome2> { ...@@ -41,6 +48,17 @@ class _NewHome2State extends State<NewHome2> {
// final double positionCustomScrollViewSearchFalseFixed = 349.5 - 10; // final double positionCustomScrollViewSearchFalseFixed = 349.5 - 10;
late List<FilterMenu> allMenu = []; late List<FilterMenu> allMenu = [];
late List<FilterMenu> allMenuFav = [];
List<CategoryList> categoryList = [];
List<FavoriteGroup> favList = [];
List<FilterMenu> categoryNonFav = [];
List<FilterMenu> categoryFav = [];
List<FilterMenu> categoryFavAfterSelect = [];
List<FilterMenu> categoryMenuAfterSelect = [];
late int countMenuToDisplay = maxItemMenu;
late int countMenuFavToDisplay = maxItemMenuFav;
@override @override
void initState() { void initState() {
...@@ -78,10 +96,22 @@ class _NewHome2State extends State<NewHome2> { ...@@ -78,10 +96,22 @@ class _NewHome2State extends State<NewHome2> {
// } // }
}, },
); );
_scrollFavItem.addListener(() {
double positionMenuFavScroll = _scrollFavItem.position.pixels;
double positionMenuFavMax = _scrollFavItem.position.maxScrollExtent;
if (positionMenuFavScroll >= positionMenuFavMax - 50) {
if (allMenuFav.length >= countMenuFavToDisplay) {
_getMoreDataFav(countMenuFavToDisplay, allMenuFav);
}
}
});
_scrollMenuItem.addListener(() { _scrollMenuItem.addListener(() {
double positionMenuItemScrollView = _scrollMenuItem.position.pixels; double positionMenuItemScrollView = _scrollMenuItem.position.pixels;
double positionMenuItemScrollViewMin = double positionMenuItemScrollViewMin =
_scrollMenuItem.position.minScrollExtent; _scrollMenuItem.position.minScrollExtent;
double positionMenuItemScrollViewMax =
_scrollMenuItem.position.maxScrollExtent;
if (positionMenuItemScrollView == positionMenuItemScrollViewMin && if (positionMenuItemScrollView == positionMenuItemScrollViewMin &&
_scrollController.position.pixels == _scrollController.position.pixels ==
_scrollController.position.maxScrollExtent) { _scrollController.position.maxScrollExtent) {
...@@ -89,11 +119,36 @@ class _NewHome2State extends State<NewHome2> { ...@@ -89,11 +119,36 @@ class _NewHome2State extends State<NewHome2> {
isScrollableMenu = false; isScrollableMenu = false;
}); });
} }
if (positionMenuItemScrollView >= positionMenuItemScrollViewMax - 100) {
if (allMenu.length >= countMenuToDisplay) {
_getMoreData(countMenuToDisplay, allMenu);
}
}
}); });
super.initState(); super.initState();
} }
_getMoreData(int menuToDisplay, List<FilterMenu> allMenu) {
setState(() {
if ((allMenu.length - countMenuToDisplay) > maxItemMenu) {
countMenuToDisplay += maxItemMenu;
} else {
countMenuToDisplay = allMenu.length;
}
});
}
_getMoreDataFav(int menuToDisplay, List<FilterMenu> allMenuFav) {
setState(() {
if ((allMenuFav.length - countMenuFavToDisplay) > maxItemMenuFav) {
countMenuFavToDisplay += maxItemMenuFav;
} else {
countMenuFavToDisplay = allMenuFav.length;
}
});
}
@override @override
void dispose() { void dispose() {
_scrollController.removeListener(() {}); _scrollController.removeListener(() {});
...@@ -130,14 +185,11 @@ class _NewHome2State extends State<NewHome2> { ...@@ -130,14 +185,11 @@ class _NewHome2State extends State<NewHome2> {
double paddingLeftRight = 20; double paddingLeftRight = 20;
int tableMode = prefs.getInt('table_mode') ?? defaultTable; int tableMode = prefs.getInt('table_mode') ?? defaultTable;
String tableNumber = prefs.getString("table_number") ?? "";
String userName = prefs.getString("userName") ?? "";
double widthScreen = responsiveWidthScreen(context); double widthScreen = responsiveWidthScreen(context);
double maxWidthScreen = getMaxWidthScreen(context, useResponsive); double maxWidthScreen = getMaxWidthScreen(context, useResponsive);
List<CategoryList> categoryList = [];
List<FavoriteGroup> favList = [];
List<FilterMenu> categoryNonFav = [];
List<FilterMenu> categoryFav = [];
List<FilterMenu> categoryFavAfterSelect = [];
List<FilterMenu> categoryMenuAfterSelect = [];
return BlocBuilder<BranchExist, String>( return BlocBuilder<BranchExist, String>(
builder: (contextBracnhExist, restoran) { builder: (contextBracnhExist, restoran) {
void onTapOkPop() { void onTapOkPop() {
...@@ -167,7 +219,7 @@ class _NewHome2State extends State<NewHome2> { ...@@ -167,7 +219,7 @@ class _NewHome2State extends State<NewHome2> {
child: SafeArea( child: SafeArea(
child: Scaffold( child: Scaffold(
backgroundColor: backgroundColor, backgroundColor: backgroundColor,
body: ((restoran == responseByodBranchExist)) body: (restoran == responseByodBranchExist)
? BlocBuilder<FilterMenuBloc, List<FilterMenu>>( ? BlocBuilder<FilterMenuBloc, List<FilterMenu>>(
builder: (contextBlocListCat, categoryDefault) { builder: (contextBlocListCat, categoryDefault) {
if (categoryDefault.isNotEmpty && if (categoryDefault.isNotEmpty &&
...@@ -175,20 +227,28 @@ class _NewHome2State extends State<NewHome2> { ...@@ -175,20 +227,28 @@ class _NewHome2State extends State<NewHome2> {
return errorResponseByod( return errorResponseByod(
'Gagal mendapatkan menu, silahkan refresh halaman / scan ulang barcode'); 'Gagal mendapatkan menu, silahkan refresh halaman / scan ulang barcode');
} else if (categoryDefault.isNotEmpty) { } else if (categoryDefault.isNotEmpty) {
List<FilterMenu> categoryFavTemp = [];
List<FilterMenu> categoryNonFavTemp = [];
for (var menu in categoryDefault) { for (var menu in categoryDefault) {
if (!menu.isFavMenu) { if (!menu.isFavMenu) {
categoryNonFav.add(menu); categoryNonFavTemp.add(menu);
} else { } else {
categoryFav.add(menu); categoryFavTemp.add(menu);
} }
} }
allMenu = categoryNonFav; categoryNonFav = categoryNonFavTemp;
categoryFav = categoryFavTemp;
allMenu = categoryNonFav;
allMenuFav = categoryFav;
List<CategoryList> catListTemp = [];
var nn = { var nn = {
"name": "All", "name": "All",
"id": "0", "id": "0",
}; // all dulu, biar ada bisa klik all }; // all dulu, biar ada bisa klik all
categoryList.add(CategoryList.createCategoryList(nn)); catListTemp.add(CategoryList.createCategoryList(nn));
categoryList = catListTemp;
for (var nameCat in categoryNonFav) { for (var nameCat in categoryNonFav) {
if (nameCat.type == typeCategory) { if (nameCat.type == typeCategory) {
var n = { var n = {
...@@ -199,15 +259,17 @@ class _NewHome2State extends State<NewHome2> { ...@@ -199,15 +259,17 @@ class _NewHome2State extends State<NewHome2> {
.add(CategoryList.createCategoryList(n)); .add(CategoryList.createCategoryList(n));
} }
} }
List<FavoriteGroup> favGroupTemp = [];
for (var nameFav in categoryFav) { for (var nameFav in categoryFav) {
if (nameFav.type == typeCategory) { if (nameFav.type == typeCategory) {
var nfav = { var nfav = {
"name": nameFav.categoryName, "name": nameFav.categoryName,
"id": nameFav.id "id": nameFav.id
}; };
favList.add(FavoriteGroup.add(nfav)); favGroupTemp.add(FavoriteGroup.add(nfav));
} }
} }
favList = favGroupTemp;
if (isFirstLoad) { if (isFirstLoad) {
context context
.read<FavSelectedBar>() .read<FavSelectedBar>()
...@@ -253,7 +315,11 @@ class _NewHome2State extends State<NewHome2> { ...@@ -253,7 +315,11 @@ class _NewHome2State extends State<NewHome2> {
} }
// if (listDynamicBarMenu.length == 2 && // if (listDynamicBarMenu.length == 2 &&
// listDynamicBarMenu[1] != "0" && // listDynamicBarMenu[1] != "0" &&
// isScrollableMenu == true) { // isScrollableMenu == true &&
// _scrollController.position.pixels ==
// _scrollController
// .position.maxScrollExtent &&
// _scrollMenuItem.position.pixels > 0) {
// _scrollMenuItem.animateTo( // _scrollMenuItem.animateTo(
// 10, // 10,
// duration: // duration:
...@@ -262,282 +328,241 @@ class _NewHome2State extends State<NewHome2> { ...@@ -262,282 +328,241 @@ class _NewHome2State extends State<NewHome2> {
// ); // );
// } // }
} }
return Stack( return BlocBuilder<OrdersBloc, List<Orders>>(
children: [ builder: (contextOrders, listOrders) {
Container( int totalItem = 0;
height: MediaQuery.of(context).size.height, int totalHarga = 0;
margin: EdgeInsets.symmetric( if (listOrders.isNotEmpty) {
horizontal: paddingLeftRight), int fixTotalHarga = 0;
child: Column( int totalHargaOrderDetail = 0;
crossAxisAlignment: int totalHargaBukanOrderDetail = 0;
CrossAxisAlignment.start,
children: [ int fixTotalItem = 0;
customAppBar(context, paddingLeftRight, int totalItemOrderDetail = 0;
appBarHeight), int totalItemBukanOrderDetail = 0;
SizedBox( for (var i = 0;
height: (isSearchActive) ? 16 : 20, i < listOrders.length;
), i++) {
AnimatedSwitcher( // totalItem += listOrders[i].totalItem;
duration: Duration( // check apakah ada order detail. kalau ada rekalkulasi total harga sesuai order detail
milliseconds: animatedTime), if (listOrders[i].orderDetail.isEmpty) {
transitionBuilder: (Widget child, totalHargaBukanOrderDetail +=
Animation<double> animation) { (listOrders[i].totalItem *
return ScaleTransition( listOrders[i].totalHarga);
scale: animation, child: child); totalItemBukanOrderDetail +=
}, listOrders[i].totalItem;
child: (isSearchActive) } else {
? SizedBox( for (int kk = 0;
height: searchFieldHeight, kk <
child: TextField( listOrders[i]
key: const Key( .orderDetail
'SearchField'), .length;
style: TextStyle( kk++) {
color: Colors.black, totalHargaOrderDetail += listOrders[i]
fontFamily: fontFamily, .orderDetail[kk]
fontSize: 15, .totalHarga;
totalItemOrderDetail += listOrders[i]
.orderDetail[kk]
.totalItem;
}
fixTotalHarga = totalHargaOrderDetail;
fixTotalItem = totalItemOrderDetail;
}
}
totalHarga = fixTotalHarga +
totalHargaBukanOrderDetail;
totalItem = fixTotalItem +
totalItemBukanOrderDetail;
}
return Stack(
children: [
Container(
height:
MediaQuery.of(context).size.height,
margin: EdgeInsets.symmetric(
horizontal: paddingLeftRight),
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
customAppBar(
context,
paddingLeftRight,
appBarHeight,
tableNumber,
userName,
),
SizedBox(
height:
(isSearchActive) ? 16 : 20,
),
AnimatedSwitcher(
duration: Duration(
milliseconds: animatedTime),
transitionBuilder: (Widget child,
Animation<double> animation) {
return ScaleTransition(
scale: animation,
child: child);
},
child: (isSearchActive)
? searchField(
searchFieldHeight,
)
: const SizedBox(
key: Key('SearchField'),
), ),
decoration: InputDecoration( ),
enabledBorder: Expanded(
OutlineInputBorder( child: CustomScrollView(
borderSide: BorderSide( controller: _scrollController,
width: 1, slivers: [
color: Colors.grey SliverToBoxAdapter(
.withOpacity(0.8), child: SizedBox(
), height: (isSearchActive)
), ? spacerHeight
focusedBorder: : 0,
OutlineInputBorder( ),
borderSide: BorderSide( ),
width: 1, SliverToBoxAdapter(
color: buttonColor, child: Container(
), height: favListHeight,
), child: FavoriteList(
prefixIcon: Image( favoriteList: favList,
image: const AssetImage(
'assets/icons/search.png'),
color: Colors.grey
.withOpacity(0.8),
height: 20,
width: 20,
),
hintText: 'Example: nasi',
hintStyle: TextStyle(
color: Colors.grey
.withOpacity(0.8),
fontFamily: fontFamily,
fontSize: 10,
),
border:
OutlineInputBorder(
borderRadius:
BorderRadius
.circular(6),
), ),
), ),
), ),
) const SliverToBoxAdapter(
: const SizedBox( child: SizedBox(
key: Key('SearchField'), height: 13.5,
), ),
),
Expanded(
child: CustomScrollView(
controller: _scrollController,
slivers: [
SliverToBoxAdapter(
child: SizedBox(
height: (isSearchActive)
? spacerHeight
: 0,
),
),
SliverToBoxAdapter(
child: Container(
height: favListHeight,
child: FavoriteList(
favoriteList: favList,
), ),
), SliverToBoxAdapter(
), child: Container(
const SliverToBoxAdapter( height: favItemHeight,
child: SizedBox( child: ListView.builder(
height: 13.5, controller:
), _scrollFavItem,
), scrollDirection:
SliverToBoxAdapter( Axis.horizontal,
child: Container( itemCount: (categoryFavAfterSelect
height: favItemHeight, .length) >
child: ListView.builder( countMenuFavToDisplay
scrollDirection: ? countMenuFavToDisplay
Axis.horizontal, : categoryFavAfterSelect
itemCount: .length,
categoryFavAfterSelect itemBuilder:
(context, i) {
double
paddingLeftRigthGrid =
9;
double widthGrid =
136;
return FavGridMenu(
categoryFavAfterSelect:
categoryFavAfterSelect,
widthGrid:
widthGrid,
paddingLeftRigthGrid:
paddingLeftRigthGrid,
i: i,
);
}),
),
),
SliverToBoxAdapter(
child: SizedBox(
height: spacerAboveCat,
),
),
SliverToBoxAdapter(
child: defaultText(
context,
'Category',
style: categoryStyle(),
),
),
SliverToBoxAdapter(
child: SizedBox(
height:
spacerAboveCatList,
),
),
SliverPersistentHeader(
pinned: true,
delegate: Delegate(
catListHeight,
categoryList,
),
),
SliverToBoxAdapter(
child: SizedBox(
height:
spacerAboveMenuItem,
),
),
SliverToBoxAdapter(
child: Container(
height: heightLeft,
child: ListView.builder(
controller:
(isScrollableMenu)
? _scrollMenuItem
: null,
physics: (!isScrollableMenu)
? const NeverScrollableScrollPhysics()
: null,
shrinkWrap:
(isScrollableMenu)
? true
: false,
itemCount: (categoryMenuAfterSelect
.length) >
countMenuToDisplay
? countMenuToDisplay
: categoryMenuAfterSelect
.length, .length,
itemBuilder: itemBuilder:
(context, i) { (context, i) {
double return MenuListUtama(
paddingLeftRigthGrid = categoryNonFav:
9; categoryMenuAfterSelect,
double widthGrid = 136;
return FavGridMenu(
categoryFavAfterSelect:
categoryFavAfterSelect,
widthGrid: widthGrid,
paddingLeftRigthGrid:
paddingLeftRigthGrid,
i: i, i: i,
); );
}), },
),
),
SliverToBoxAdapter(
child: SizedBox(
height: spacerAboveCat,
),
),
SliverToBoxAdapter(
child: defaultText(
context,
'Category',
style: categoryStyle(),
),
),
SliverToBoxAdapter(
child: SizedBox(
height: spacerAboveCatList,
),
),
SliverPersistentHeader(
pinned: true,
delegate: Delegate(
catListHeight,
categoryList,
),
),
SliverToBoxAdapter(
child: SizedBox(
height: spacerAboveMenuItem,
),
),
SliverToBoxAdapter(
child: Container(
height: heightLeft,
child: ListView.builder(
controller: (isScrollableMenu)
? _scrollMenuItem
: null,
physics: (!isScrollableMenu)
? const NeverScrollableScrollPhysics()
: null,
shrinkWrap: (isScrollableMenu)
? true
: false,
itemCount:
categoryMenuAfterSelect
.length,
itemBuilder: (context, i) {
return MenuListUtama(
categoryNonFav:
categoryMenuAfterSelect,
i: i,
);
},
),
)),
],
),
),
],
),
),
Positioned(
bottom: 40,
left: 0,
child: Container(
height: 43,
width: MediaQuery.of(context).size.width -
147,
decoration: BoxDecoration(
color: buttonColor,
borderRadius: const BorderRadius.only(
topLeft: Radius.circular(30),
),
),
),
),
Positioned(
bottom: 0,
child: Container(
width: MediaQuery.of(context).size.width,
height: 61,
decoration: BoxDecoration(
color: buttonColor,
borderRadius: const BorderRadius.only(
topRight: Radius.circular(30),
topLeft: Radius.circular(10),
),
),
child: Row(
crossAxisAlignment:
CrossAxisAlignment.center,
children: [
Expanded(
child: Container(
margin: EdgeInsets.only(
left: paddingLeftRight),
child: defaultText(
context,
'Rp 25,000',
style:
textAmountButtonBottomCart(),
),
),
),
Container(
width: 134,
height: 36,
decoration: BoxDecoration(
borderRadius:
BorderRadius.circular(28),
color: Colors.white,
),
child: Container(
padding:
const EdgeInsets.symmetric(
horizontal: 26,
vertical: 8),
child: Row(
crossAxisAlignment:
CrossAxisAlignment.center,
children: [
defaultText(
context,
"Pesan",
style: addButtonBottomCart(
color: buttonColor,
), ),
), )),
const SizedBox(
width: 7,
),
// fontAwesome(
// context,
// shoppingCart,
// 1,
// color: buttonColor,
// )
], ],
), ),
), ),
), ],
const SizedBox( ),
width: 23,
)
],
), ),
), AnimatedSwitcher(
) duration: Duration(
], milliseconds: animatedTime),
transitionBuilder: (Widget child,
Animation<double> animation) {
return ScaleTransition(
scale: animation, child: child);
},
child: (totalItem > 0)
? goTocheckOut(
context,
listOrders,
paddingLeftRight,
totalItem,
totalHarga,
tableMode,
userName,
)
: const SizedBox(
key: Key('ButtonBottomCart'),
),
)
],
);
},
); );
}, },
); );
...@@ -571,6 +596,267 @@ class _NewHome2State extends State<NewHome2> { ...@@ -571,6 +596,267 @@ class _NewHome2State extends State<NewHome2> {
); );
} }
SizedBox searchField(double searchFieldHeight) {
return SizedBox(
height: searchFieldHeight,
child: TextField(
key: const Key('SearchField'),
style: TextStyle(
color: Colors.black,
fontFamily: fontFamily,
fontSize: 15,
),
decoration: InputDecoration(
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(
width: 1,
color: Colors.grey.withOpacity(0.8),
),
),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(
width: 1,
color: buttonColor,
),
),
prefixIcon: Image(
image: const AssetImage('assets/icons/search.png'),
color: Colors.grey.withOpacity(0.8),
height: 20,
width: 20,
),
hintText: 'Example: nasi',
hintStyle: TextStyle(
color: Colors.grey.withOpacity(0.8),
fontFamily: fontFamily,
fontSize: 10,
),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(6),
),
),
),
);
}
GestureDetector goTocheckOut(
BuildContext context,
List<Orders> listOrders,
double paddingLeftRight,
int totalItem,
int totalHarga,
int tableMode,
String namaPelanggan) {
String itemString;
if (totalItem > 1) {
itemString = '$totalItem Items';
} else {
itemString = '$totalItem Item';
}
final nameController = TextEditingController();
return GestureDetector(
onTap: () {
if (tableMode == singleTable) {
if (namaPelanggan != '') {
checkOut(context, listOrders, namaPelanggan);
} else {
showDialog(
context: context,
builder: (BuildContext context) {
return AnimatedContainer(
duration: const Duration(milliseconds: 300),
child: AlertDialog(
scrollable: true,
title: defaultText(
context,
"Masukkan Nama",
style: modalNamaHeader(),
),
content: SizedBox(
height: 216,
width: 303,
child: Column(
children: [
TextField(
keyboardType: TextInputType.text,
controller: nameController,
style: textStyleNormalFont(context),
decoration: const InputDecoration(
labelText: 'Nama panggilan',
labelStyle: TextStyle(
fontFamily: 'OpenSans',
fontSize: 14,
color: textColorModalHeaderNama,
),
),
),
const SizedBox(
height: 47,
),
GestureDetector(
onTap: () {
if (nameController.text != '' ||
namaPelanggan != '') {
checkOut(
context, listOrders, nameController.text);
} else {
EasyLoading.showToast("Nama wajib diisi");
}
},
child: Container(
height: 43,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(31),
color: buttonColor),
child: Center(
child: defaultText(
context,
"Simpan",
style: simpanButtonNote(
font: 14,
fontWeight: FontWeight.w600,
),
),
),
),
),
const SizedBox(
height: 20,
),
GestureDetector(
onTap: () {
Navigator.pop(context);
},
child: Container(
height: 43,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(31),
color: Colors.transparent,
),
child: Center(
child: defaultText(
context,
"Batal",
style: simpanButtonNote(
font: 14,
fontWeight: FontWeight.w600,
color: textColorRed,
),
),
),
),
),
],
),
),
),
);
});
}
} else {
Navigator.push(context,
MaterialPageRoute(builder: (context) => const CheckOut()));
}
},
child: Stack(
key: const Key('ButtonBottomCart'),
children: [
Positioned(
bottom: 0,
child: Container(
width: MediaQuery.of(context).size.width,
height: 61,
decoration: BoxDecoration(
color: buttonColor,
borderRadius: const BorderRadius.only(
topRight: Radius.circular(20),
topLeft: Radius.circular(10),
),
),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Expanded(
child: Container(
margin: EdgeInsets.only(left: paddingLeftRight),
child: defaultText(
context,
"Rp ${formatNumber().format(totalHarga)}",
style: textAmountButtonBottomCart(),
),
),
),
Container(
width: 134,
height: 36,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(28),
color: Colors.white,
),
child: Container(
padding: const EdgeInsets.symmetric(
horizontal: 26, vertical: 8),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
defaultText(
context,
"Pesan",
style: addButtonBottomCart(
color: buttonColor,
),
),
const SizedBox(
width: 7,
),
const Image(
width: 20,
height: 20,
image: AssetImage('assets/icons/cart.png'))
],
),
),
),
const SizedBox(
width: 23,
)
],
),
),
),
Positioned(
bottom: 40,
left: 0,
child: ClipPath(
clipper: CustomClipPath(),
child: Container(
padding: EdgeInsets.only(
left: paddingLeftRight,
),
height: 43,
width: MediaQuery.of(context).size.width - 157,
decoration: BoxDecoration(
color: buttonColor,
borderRadius: const BorderRadius.only(
topLeft: Radius.circular(20),
),
),
child: Align(
alignment: Alignment.centerLeft,
child: defaultText(
context,
itemString,
style: textCountItem(),
),
),
),
),
),
],
),
);
}
// Container girdFavItem( // Container girdFavItem(
// List<FilterMenu> favListItem, // List<FilterMenu> favListItem,
// int i, // int i,
...@@ -724,8 +1010,14 @@ class _NewHome2State extends State<NewHome2> { ...@@ -724,8 +1010,14 @@ class _NewHome2State extends State<NewHome2> {
// ); // );
// } // }
Container customAppBar( Container customAppBar(BuildContext context, double paddingLeftRight,
BuildContext context, double paddingLeftRight, double appBarHeight) { double appBarHeight, String tableNumber, String userName) {
String barName;
if (userName != '') {
barName = 'Meja $tableNumber - $userName';
} else {
barName = "Meja $tableNumber";
}
return Container( return Container(
// color: Colors.red, // color: Colors.red,
margin: EdgeInsets.symmetric(horizontal: paddingLeftRight), margin: EdgeInsets.symmetric(horizontal: paddingLeftRight),
...@@ -734,7 +1026,7 @@ class _NewHome2State extends State<NewHome2> { ...@@ -734,7 +1026,7 @@ class _NewHome2State extends State<NewHome2> {
children: [ children: [
defaultText( defaultText(
context, context,
'Meja 12', barName,
style: tableNameStyle(), style: tableNameStyle(),
), ),
const Spacer(), const Spacer(),
...@@ -753,10 +1045,16 @@ class _NewHome2State extends State<NewHome2> { ...@@ -753,10 +1045,16 @@ class _NewHome2State extends State<NewHome2> {
const SizedBox( const SizedBox(
width: 16, width: 16,
), ),
const Image( GestureDetector(
image: AssetImage('assets/icons/book.png'), onTap: () {
height: 20, Navigator.push(
width: 20, context, MaterialPageRoute(builder: (_) => ViewBill()));
},
child: const Image(
image: AssetImage('assets/icons/book.png'),
height: 20,
width: 20,
),
), ),
], ],
)); ));
...@@ -785,34 +1083,34 @@ class _NewHome2State extends State<NewHome2> { ...@@ -785,34 +1083,34 @@ class _NewHome2State extends State<NewHome2> {
); );
} }
AnimatedSwitcher seearchField(BuildContext context) { // AnimatedSwitcher seearchField(BuildContext context) {
return AnimatedSwitcher( // return AnimatedSwitcher(
duration: const Duration(milliseconds: 500), // duration: const Duration(milliseconds: 500),
transitionBuilder: (Widget child, Animation<double> animation) { // transitionBuilder: (Widget child, Animation<double> animation) {
return ScaleTransition(scale: animation, child: child); // return ScaleTransition(scale: animation, child: child);
}, // },
child: TextField( // child: TextField(
key: const Key('SearchField'), // key: const Key('SearchField'),
decoration: InputDecoration( // decoration: InputDecoration(
focusedBorder: OutlineInputBorder( // focusedBorder: OutlineInputBorder(
borderSide: BorderSide( // borderSide: BorderSide(
width: 1, // width: 1,
color: buttonColor, // color: buttonColor,
), // ),
), // ),
prefixIcon: const Image( // prefixIcon: const Image(
image: AssetImage('assets/icons/search.png'), // image: AssetImage('assets/icons/search.png'),
height: 20, // height: 20,
width: 20, // width: 20,
), // ),
hintText: 'Example: nasi', // hintText: 'Example: nasi',
border: OutlineInputBorder( // border: OutlineInputBorder(
borderRadius: BorderRadius.circular(6), // borderRadius: BorderRadius.circular(6),
), // ),
), // ),
), // ),
); // );
} // }
} }
class Delegate extends SliverPersistentHeaderDelegate { class Delegate extends SliverPersistentHeaderDelegate {
...@@ -841,3 +1139,32 @@ class Delegate extends SliverPersistentHeaderDelegate { ...@@ -841,3 +1139,32 @@ class Delegate extends SliverPersistentHeaderDelegate {
return true; return true;
} }
} }
class CustomClipPath extends CustomClipper<Path> {
@override
Path getClip(Size size) {
// buat clipnya di https://shapemaker.web.app/#/
Path path0 = Path();
path0.moveTo(0, 0);
path0.lineTo(0, size.height);
path0.lineTo(size.width, size.height);
path0.quadraticBezierTo(size.width, size.height * 0.6250000, size.width,
size.height * 0.5042857);
path0.cubicTo(
size.width * 0.8616667,
size.height * 0.4364286,
size.width * 0.9810417,
size.height * 0.0007143,
size.width * 0.7191667,
0);
path0.quadraticBezierTo(size.width * 0.5468750, 0, 0, 0);
path0.close();
return path0;
}
@override
bool shouldReclip(CustomClipper<Path> oldClipper) {
return false;
}
}
...@@ -11,6 +11,7 @@ import 'package:byod/helper/widget/style.dart'; ...@@ -11,6 +11,7 @@ import 'package:byod/helper/widget/style.dart';
import 'package:byod/main.dart'; import 'package:byod/main.dart';
import 'package:byod/models/bill.dart'; import 'package:byod/models/bill.dart';
import 'package:byod/models/member_info.dart'; import 'package:byod/models/member_info.dart';
import 'package:byod/ui/home/new_home2.dart';
import 'package:byod/ui/payment/payment.dart'; import 'package:byod/ui/payment/payment.dart';
import 'package:byod/ui/screen_responsive.dart'; import 'package:byod/ui/screen_responsive.dart';
import 'package:byod/ui/viewbill/shimmer_bill.dart'; import 'package:byod/ui/viewbill/shimmer_bill.dart';
...@@ -419,7 +420,7 @@ Mohon menuju kasir untuk meminta bukti pembayaran'''; ...@@ -419,7 +420,7 @@ Mohon menuju kasir untuk meminta bukti pembayaran''';
context, context,
MaterialPageRoute( MaterialPageRoute(
builder: (_) => builder: (_) =>
const Home())); const NewHome2()));
}, },
child: Container( child: Container(
padding: EdgeInsets.symmetric( padding: EdgeInsets.symmetric(
...@@ -753,7 +754,7 @@ Mohon menuju kasir untuk meminta bukti pembayaran'''; ...@@ -753,7 +754,7 @@ Mohon menuju kasir untuk meminta bukti pembayaran''';
Navigator.push( Navigator.push(
context, context,
MaterialPageRoute( MaterialPageRoute(
builder: (_) => const Home())); builder: (_) => const NewHome2()));
}, },
child: Container( child: Container(
padding: EdgeInsets.symmetric( padding: EdgeInsets.symmetric(
...@@ -1246,8 +1247,8 @@ Mohon menuju kasir untuk meminta bukti pembayaran'''; ...@@ -1246,8 +1247,8 @@ Mohon menuju kasir untuk meminta bukti pembayaran''';
GestureDetector( GestureDetector(
onTap: () { onTap: () {
if (!widget.isHistory) { if (!widget.isHistory) {
Navigator.pushReplacement( Navigator.pushReplacement(context,
context, MaterialPageRoute(builder: (_) => Home())); MaterialPageRoute(builder: (_) => const NewHome2()));
context.read<BranchExist>().branchExist( context.read<BranchExist>().branchExist(
branchCode, brandCode, role, cashierName, sessionId); branchCode, brandCode, role, cashierName, sessionId);
} else { } else {
......
...@@ -73,6 +73,9 @@ flutter: ...@@ -73,6 +73,9 @@ flutter:
- asset: assets/fonts/font_awesome/fa-solid-900.ttf - asset: assets/fonts/font_awesome/fa-solid-900.ttf
weight: 600 weight: 600
- asset: assets/fonts/font_awesome/fa-regular-400.ttf - asset: assets/fonts/font_awesome/fa-regular-400.ttf
- family: Mulish
fonts:
- asset: assets/fonts/mulish/Mulish-Regular.ttf
# - family: NotoSans # - family: NotoSans
# fonts: # fonts:
# - asset: assets/fonts/noto_sans/NotoSans-Regular.ttf # - asset: assets/fonts/noto_sans/NotoSans-Regular.ttf
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment