Commit ec2a72b9 authored by Dio Maulana's avatar Dio Maulana

home page dan variant page

parent 21f22719
...@@ -244,10 +244,11 @@ double heightTombol = 0.06; // untuk dikalikan di height media query ...@@ -244,10 +244,11 @@ double heightTombol = 0.06; // untuk dikalikan di height media query
//** core warna */ //** core warna */
// const Color backgroundColor = Colors.white; // const Color backgroundColor = Colors.white;
const Color backgroundColor = Color(0xffE5E5E5); const Color backgroundColor = Color(0xffF4F4F4);
const textColorTabel = Color(0xff333333); const textColorTabel = Color(0xff333333);
const textColorBlack = Color(0xff000000); const textColorBlack = Color(0xff000000);
const textColorRed = Color(0xffE73636); const textColorRed = Color(0xffE73636);
const textColorPlaceHolder = Color(0xffA89C9C);
const textGrey = Color(0xffE0E0E0); const textGrey = Color(0xffE0E0E0);
const textGreyDeskripsi = Color(0xffBDBDBD); const textGreyDeskripsi = Color(0xffBDBDBD);
const backgroundColorBottomSheet = Color(0xffE5E5E5); const backgroundColorBottomSheet = Color(0xffE5E5E5);
...@@ -420,6 +421,10 @@ const heigthButtonBottom = 0.08; ...@@ -420,6 +421,10 @@ const heigthButtonBottom = 0.08;
const positionedBottom = 0.01; const positionedBottom = 0.01;
//** padding bottom untuk button stack */ //** padding bottom untuk button stack */
//** padding left right page */
const double paddingLeftRight = 20;
//** padding left right page */
//** Max widht screen */ //** Max widht screen */
bool useResponsive = isResponsive; bool useResponsive = isResponsive;
const double maxWidthScreens = 500; const double maxWidthScreens = 500;
...@@ -471,6 +476,9 @@ const double pencilSize = 0.02; ...@@ -471,6 +476,9 @@ const double pencilSize = 0.02;
const String backIcon = '\uf060'; const String backIcon = '\uf060';
const double backIconSize = 0.03; const double backIconSize = 0.03;
const String arrowBack = '\uf060';
const double arrowBackSize = 17;
const String shopingBag = '\uf290'; const String shopingBag = '\uf290';
const double shopingBagSize = 0.03; const double shopingBagSize = 0.03;
......
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';
...@@ -26,6 +24,15 @@ Text defaultText( ...@@ -26,6 +24,15 @@ Text defaultText(
); );
} }
TextStyle appBarNameVariant({font = 17, Color color = textColorBlack}) {
return TextStyle(
fontFamily: 'Mulish',
fontSize: font,
fontWeight: FontWeight.w700,
color: color,
);
}
TextStyle tableNameStyle({font = 20, Color color = textColorTabel}) { TextStyle tableNameStyle({font = 20, Color color = textColorTabel}) {
return TextStyle( return TextStyle(
fontFamily: (fontFamily == '') ? null : fontFamily, fontFamily: (fontFamily == '') ? null : fontFamily,
...@@ -58,7 +65,7 @@ TextStyle menuNameGridFav( ...@@ -58,7 +65,7 @@ TextStyle menuNameGridFav(
return TextStyle( return TextStyle(
fontFamily: 'Roboto', fontFamily: 'Roboto',
fontSize: font, fontSize: font,
fontWeight: FontWeight.w500, fontWeight: FontWeight.w600,
color: color, color: color,
); );
} }
...@@ -118,7 +125,7 @@ TextStyle subCategoryStyle({ ...@@ -118,7 +125,7 @@ TextStyle subCategoryStyle({
return TextStyle( return TextStyle(
fontFamily: 'Roboto', fontFamily: 'Roboto',
fontSize: font, fontSize: font,
fontWeight: FontWeight.w500, fontWeight: FontWeight.w600,
color: color, color: color,
); );
} }
...@@ -142,7 +149,7 @@ TextStyle menuNameStyle({ ...@@ -142,7 +149,7 @@ TextStyle menuNameStyle({
return TextStyle( return TextStyle(
fontFamily: 'Roboto', fontFamily: 'Roboto',
fontSize: font, fontSize: font,
fontWeight: FontWeight.w500, fontWeight: FontWeight.w600,
color: color, color: color,
); );
} }
...@@ -272,6 +279,19 @@ Text fontAwesome(BuildContext context, String unicode, double fontSize, ...@@ -272,6 +279,19 @@ Text fontAwesome(BuildContext context, String unicode, double fontSize,
); );
} }
Text fontAwesomeNew(String unicode, double fontSize,
{Color? color, isBold = true}) {
return Text(
unicode,
style: TextStyle(
fontFamily: 'FontAwesome',
fontSize: fontSize,
color: color,
fontWeight: (isBold) ? FontWeight.w600 : FontWeight.w400,
),
);
}
Text fontAwesomeCart(BuildContext context, String unicode, double fontSize, Text fontAwesomeCart(BuildContext context, String unicode, double fontSize,
{Color? color, isBold = true}) { {Color? color, isBold = true}) {
// double widthScreens = responsiveWidthScreen(context); // double widthScreens = responsiveWidthScreen(context);
...@@ -533,6 +553,20 @@ TextStyle textStyleAddButton( ...@@ -533,6 +553,20 @@ TextStyle textStyleAddButton(
); );
} }
TextStyle variantStyleText(
{Color? textColor,
TextDecoration? decoration,
font = 20,
FontWeight? fontWeight}) {
return TextStyle(
fontFamily: (fontFamily == '') ? null : fontFamily,
fontSize: font,
fontWeight: (fontWeight == null) ? FontWeight.w600 : fontWeight,
color: (textColor == null) ? null : textColorBlack,
decoration: (decoration == null) ? null : decoration,
);
}
TextStyle textStyleRefresh(context) { TextStyle textStyleRefresh(context) {
return TextStyle( return TextStyle(
fontFamily: (fontFamily == '') ? null : fontFamily, fontFamily: (fontFamily == '') ? null : fontFamily,
......
class CategoryList { class CategoryList {
final String name; final String name;
final String id; final String id;
final double offset;
CategoryList({ CategoryList({
required this.name, required this.name,
required this.id, required this.id,
required this.offset,
}); });
factory CategoryList.createCategoryList(Map<String, dynamic> json) { factory CategoryList.createCategoryList(Map<String, dynamic> json) {
return CategoryList( return CategoryList(
id: json['id'], id: json['id'],
name: json['name'], name: json['name'],
offset: json['offset'] ?? 0,
); );
} }
} }
...@@ -49,8 +49,10 @@ class _CategoryListHomeState extends State<CategoryListHome> { ...@@ -49,8 +49,10 @@ class _CategoryListHomeState extends State<CategoryListHome> {
.read<MenuSelectedBar>() .read<MenuSelectedBar>()
.selectedBarMenu(i, widget.categoryList[i].id); .selectedBarMenu(i, widget.categoryList[i].id);
widget.scrollController.animateTo( widget.scrollController.animateTo(
(widget.favList.isNotEmpty) ? 371 : 0, (widget.favList.isNotEmpty)
duration: Duration(milliseconds: animatedTime), ? 371
: 0, // 371 sudah dihituing pixelnya untuk awal banget dari menu item
duration: const Duration(milliseconds: 500),
curve: Curves.fastOutSlowIn, curve: Curves.fastOutSlowIn,
); );
}, },
...@@ -78,7 +80,7 @@ class _CategoryListHomeState extends State<CategoryListHome> { ...@@ -78,7 +80,7 @@ class _CategoryListHomeState extends State<CategoryListHome> {
key: const Key('underline'), key: const Key('underline'),
margin: const EdgeInsets.only(top: 27), margin: const EdgeInsets.only(top: 27),
width: 30, width: 30,
height: 2, height: 1,
color: buttonColor) color: buttonColor)
: const SizedBox( : const SizedBox(
key: Key('underline'), key: Key('underline'),
......
...@@ -357,9 +357,8 @@ class FavGridMenu extends StatelessWidget { ...@@ -357,9 +357,8 @@ class FavGridMenu extends StatelessWidget {
child: Container( child: Container(
width: 22, width: 22,
height: 22, height: 22,
child: Image( child: const Image(
color: buttonColor, image: AssetImage('assets/icons/minus-blue.png'),
image: const AssetImage('assets/icons/minus.png'),
), ),
), ),
), ),
......
...@@ -63,7 +63,7 @@ class _FavoriteListState extends State<FavoriteList> { ...@@ -63,7 +63,7 @@ class _FavoriteListState extends State<FavoriteList> {
key: const Key('underline'), key: const Key('underline'),
margin: const EdgeInsets.only(top: 2), margin: const EdgeInsets.only(top: 2),
width: 30, width: 30,
height: 2, height: 1,
color: buttonColor) color: buttonColor)
: const SizedBox( : const SizedBox(
key: Key('underline'), key: Key('underline'),
......
...@@ -15,6 +15,7 @@ import '../../models/order_details.dart'; ...@@ -15,6 +15,7 @@ import '../../models/order_details.dart';
import '../../models/order_variants.dart'; import '../../models/order_variants.dart';
import 'bottom_sheet_menu.dart'; import 'bottom_sheet_menu.dart';
import 'bottom_sheet_variant.dart'; import 'bottom_sheet_variant.dart';
import 'variant_cat_new.dart';
class MenuListUtama extends StatelessWidget { class MenuListUtama extends StatelessWidget {
const MenuListUtama({ const MenuListUtama({
...@@ -242,27 +243,37 @@ class MenuListUtama extends StatelessWidget { ...@@ -242,27 +243,37 @@ class MenuListUtama extends StatelessWidget {
1, 1,
[], [],
); // check pada bloc untuk mengethui list arraynya ); // 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: [],
// ),
// )));
Navigator.push( Navigator.push(
context, context,
MaterialPageRoute( MaterialPageRoute(
builder: (_) => VariantCat( builder: (_) => VariantCatNew(
namaMenu: menuUtama.name, initPrice:
variantCategories: amountParseToInt(menuUtama.price),
menuUtama.variantCat, 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 { } else {
showModalBottomSheet( showModalBottomSheet(
backgroundColor: Colors.white.withOpacity(0), backgroundColor: Colors.white.withOpacity(0),
...@@ -417,7 +428,7 @@ class MenuListUtama extends StatelessWidget { ...@@ -417,7 +428,7 @@ class MenuListUtama extends StatelessWidget {
child: Image( child: Image(
color: buttonColor, color: buttonColor,
image: const AssetImage( image: const AssetImage(
'assets/icons/minus.png'), 'assets/icons/minus-blue.png'),
), ),
), ),
), ),
......
...@@ -198,7 +198,6 @@ class _NewHome2State extends State<NewHome2> { ...@@ -198,7 +198,6 @@ class _NewHome2State extends State<NewHome2> {
favListHeight - favListHeight -
categoryFont - categoryFont -
spacerAboveCatList; spacerAboveCatList;
double paddingLeftRight = 20;
int tableMode = prefs.getInt('table_mode') ?? defaultTable; int tableMode = prefs.getInt('table_mode') ?? defaultTable;
String tableNumber = prefs.getString("table_number") ?? ""; String tableNumber = prefs.getString("table_number") ?? "";
...@@ -232,6 +231,14 @@ class _NewHome2State extends State<NewHome2> { ...@@ -232,6 +231,14 @@ class _NewHome2State extends State<NewHome2> {
return shouldPop ?? false; return shouldPop ?? false;
}, },
child: SafeArea( child: SafeArea(
child: GestureDetector(
onTap: () {
FocusScopeNode currentFocus = FocusScope.of(context);
if (!currentFocus.hasPrimaryFocus) {
currentFocus.unfocus();
}
},
child: Scaffold( child: Scaffold(
backgroundColor: backgroundColor, backgroundColor: backgroundColor,
body: (restoran == responseByodBranchExist) body: (restoran == responseByodBranchExist)
...@@ -261,20 +268,22 @@ class _NewHome2State extends State<NewHome2> { ...@@ -261,20 +268,22 @@ class _NewHome2State extends State<NewHome2> {
var nn = { var nn = {
"name": "All", "name": "All",
"id": "0", "id": "0",
"offset": 0,
}; // all dulu, biar ada bisa klik all }; // all dulu, biar ada bisa klik all
catListTemp.add(CategoryList.createCategoryList(nn)); catListTemp
.add(CategoryList.createCategoryList(nn));
for (var nameCat in categoryNonFav) { for (var nameCat in categoryNonFav) {
if (nameCat.type == typeCategory) { if (nameCat.type == typeCategory) {
var n = { var n = {
"id": nameCat.id, "id": nameCat.id,
"name": nameCat.categoryName "name": nameCat.categoryName,
}; };
catListTemp catListTemp
.add(CategoryList.createCategoryList(n)); .add(CategoryList.createCategoryList(n));
} }
categoryList = catListTemp;
} }
categoryList = catListTemp;
List<FavoriteGroup> favGroupTemp = []; List<FavoriteGroup> favGroupTemp = [];
for (var nameFav in categoryFav) { for (var nameFav in categoryFav) {
if (nameFav.type == typeCategory) { if (nameFav.type == typeCategory) {
...@@ -307,7 +316,8 @@ class _NewHome2State extends State<NewHome2> { ...@@ -307,7 +316,8 @@ class _NewHome2State extends State<NewHome2> {
List<FilterMenu> temporSelectedFav = []; List<FilterMenu> temporSelectedFav = [];
for (var nameFav in categoryFav) { for (var nameFav in categoryFav) {
if (nameFav.type == typeMenu && if (nameFav.type == typeMenu &&
nameFav.favGroupId == listDynamicBar['id']) { nameFav.favGroupId ==
listDynamicBar['id']) {
temporSelectedFav.add(nameFav); temporSelectedFav.add(nameFav);
} }
} }
...@@ -316,10 +326,6 @@ class _NewHome2State extends State<NewHome2> { ...@@ -316,10 +326,6 @@ class _NewHome2State extends State<NewHome2> {
return BlocBuilder<SearchMenu, List<dynamic>>( return BlocBuilder<SearchMenu, List<dynamic>>(
builder: (contextSearch, listSearch) { builder: (contextSearch, listSearch) {
// if (listSearch[0].isNotEmpty) {
// print(listSearch[0]);
// }
return BlocBuilder<MenuSelectedBar, return BlocBuilder<MenuSelectedBar,
Map<String, dynamic>>( Map<String, dynamic>>(
builder: (contextSelectedBarMenu, builder: (contextSelectedBarMenu,
...@@ -329,14 +335,16 @@ class _NewHome2State extends State<NewHome2> { ...@@ -329,14 +335,16 @@ class _NewHome2State extends State<NewHome2> {
categoryList.isNotEmpty) { categoryList.isNotEmpty) {
if (listSearch[0].length == 1 && if (listSearch[0].length == 1 &&
listSearch[0][0].id == 'start') { listSearch[0][0].id == 'start') {
List<FilterMenu> temprSelectedMenu = []; List<FilterMenu> temprSelectedMenu =
[];
for (var nameCat in categoryNonFav) { for (var nameCat in categoryNonFav) {
if (nameCat.categoryId == if (nameCat.categoryId ==
listDynamicBarMenu['id']) { listDynamicBarMenu['id']) {
temprSelectedMenu.add(nameCat); temprSelectedMenu.add(nameCat);
} }
} }
if (listDynamicBarMenu['index'] == 0) { if (listDynamicBarMenu['index'] ==
0) {
categoryMenuAfterSelect = categoryMenuAfterSelect =
categoryNonFav; categoryNonFav;
} else { } else {
...@@ -344,19 +352,9 @@ class _NewHome2State extends State<NewHome2> { ...@@ -344,19 +352,9 @@ class _NewHome2State extends State<NewHome2> {
temprSelectedMenu; temprSelectedMenu;
} }
} else { } else {
// for (var nameCatSearch
// in listSearch[0]) {
// if (listDynamicBarMenu.length == 2) {
// if (listDynamicBarMenu[1] != "0" &&
// nameCatSearch.categoryId ==
// listDynamicBarMenu[1]) {
// temprSearchMenu
// .add(nameCatSearch);
// }
// }
// }
if (listDynamicBarMenu['id'] != "0") { if (listDynamicBarMenu['id'] != "0") {
List<FilterMenu> temprSearchMenu = []; List<FilterMenu> temprSearchMenu =
[];
for (var nameMenuSearch for (var nameMenuSearch
in listSearch[0]) { in listSearch[0]) {
if (listDynamicBarMenu['id'] == if (listDynamicBarMenu['id'] ==
...@@ -371,29 +369,7 @@ class _NewHome2State extends State<NewHome2> { ...@@ -371,29 +369,7 @@ class _NewHome2State extends State<NewHome2> {
categoryMenuAfterSelect = categoryMenuAfterSelect =
listSearch[0]; listSearch[0];
} }
// if (listDynamicBarMenu.length == 2 &&
// listDynamicBarMenu[0] == 0) {
// categoryMenuAfterSelect =
// categoryNonFav;
// } else {
// categoryMenuAfterSelect =
// temprSelectedMenu;
// }
} }
// if (listDynamicBarMenu.length == 2 &&
// isScrollableMenu == true &&
// _scrollController.position.pixels ==
// _scrollController
// .position.maxScrollExtent &&
// _scrollMenuItem.position.pixels > 0) {
// _scrollMenuItem.animateTo(
// 1,
// duration:
// Duration(milliseconds: animatedTime),
// curve: Curves.fastOutSlowIn,
// );
// }
} }
} else { } else {
if (categoryNonFav.isNotEmpty && if (categoryNonFav.isNotEmpty &&
...@@ -412,24 +388,11 @@ class _NewHome2State extends State<NewHome2> { ...@@ -412,24 +388,11 @@ class _NewHome2State extends State<NewHome2> {
categoryMenuAfterSelect = categoryMenuAfterSelect =
temprSelectedMenu; temprSelectedMenu;
} }
// if (listDynamicBarMenu.length == 2 &&
// isScrollableMenu == true &&
// _scrollController.position.pixels ==
// _scrollController
// .position.maxScrollExtent &&
// _scrollMenuItem.position.pixels > 0) {
// _scrollMenuItem.animateTo(
// 1,
// duration:
// Duration(milliseconds: animatedTime),
// curve: Curves.fastOutSlowIn,
// );
// }
} }
} }
return BlocBuilder<OrdersBloc, List<Orders>>( return BlocBuilder<OrdersBloc,
List<Orders>>(
builder: (contextOrders, listOrders) { builder: (contextOrders, listOrders) {
int totalItem = 0; int totalItem = 0;
int totalHarga = 0; int totalHarga = 0;
...@@ -472,7 +435,8 @@ class _NewHome2State extends State<NewHome2> { ...@@ -472,7 +435,8 @@ class _NewHome2State extends State<NewHome2> {
} }
fixTotalHarga = fixTotalHarga =
totalHargaOrderDetail; totalHargaOrderDetail;
fixTotalItem = totalItemOrderDetail; fixTotalItem =
totalItemOrderDetail;
} }
} }
totalHarga = fixTotalHarga + totalHarga = fixTotalHarga +
...@@ -485,7 +449,6 @@ class _NewHome2State extends State<NewHome2> { ...@@ -485,7 +449,6 @@ class _NewHome2State extends State<NewHome2> {
context, context,
widthScreen, widthScreen,
maxWidthScreen, maxWidthScreen,
paddingLeftRight,
appBarHeight, appBarHeight,
tableNumber, tableNumber,
userName, userName,
...@@ -538,6 +501,7 @@ class _NewHome2State extends State<NewHome2> { ...@@ -538,6 +501,7 @@ class _NewHome2State extends State<NewHome2> {
: const SizedBox(), : const SizedBox(),
), ),
), ),
),
); );
}, },
); );
...@@ -547,7 +511,6 @@ class _NewHome2State extends State<NewHome2> { ...@@ -547,7 +511,6 @@ class _NewHome2State extends State<NewHome2> {
BuildContext context, BuildContext context,
double widthScreen, double widthScreen,
double maxWidthScreen, double maxWidthScreen,
double paddingLeftRight,
double appBarHeight, double appBarHeight,
String tableNumber, String tableNumber,
String userName, String userName,
...@@ -569,7 +532,7 @@ class _NewHome2State extends State<NewHome2> { ...@@ -569,7 +532,7 @@ class _NewHome2State extends State<NewHome2> {
Container( Container(
width: widthScreen, width: widthScreen,
height: MediaQuery.of(context).size.height, height: MediaQuery.of(context).size.height,
padding: EdgeInsets.symmetric(horizontal: paddingLeftRight), padding: const EdgeInsets.symmetric(horizontal: paddingLeftRight),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
...@@ -684,32 +647,6 @@ class _NewHome2State extends State<NewHome2> { ...@@ -684,32 +647,6 @@ class _NewHome2State extends State<NewHome2> {
height: spacerAboveMenuItem, height: spacerAboveMenuItem,
), ),
), ),
// SliverToBoxAdapter(
// child: Container(
// height: heightLeft,
// child: ListView.builder(
// controller:
// (isScrollableMenu) ? _scrollMenuItem : null,
// // itemScrollController:
// // (isScrollableMenu) ? scrollMenuItemList : null,
// physics: (!isScrollableMenu)
// ? const NeverScrollableScrollPhysics()
// : null,
// shrinkWrap: (isScrollableMenu) ? true : false,
// // itemCount: (categoryMenuAfterSelect.length) >
// // countMenuToDisplay
// // ? countMenuToDisplay
// // : categoryMenuAfterSelect.length,
// itemCount: categoryMenuAfterSelect.length,
// itemBuilder: (context, i) {
// return MenuListUtama(
// categoryNonFav: categoryMenuAfterSelect,
// i: i,
// );
// },
// ),
// ),
// ),
SliverList( SliverList(
delegate: SliverChildBuilderDelegate( delegate: SliverChildBuilderDelegate(
(context, index) { (context, index) {
...@@ -729,7 +666,9 @@ class _NewHome2State extends State<NewHome2> { ...@@ -729,7 +666,9 @@ class _NewHome2State extends State<NewHome2> {
], ],
), ),
), ),
AnimatedSwitcher( Container(
width: widthScreen,
child: AnimatedSwitcher(
duration: Duration(milliseconds: animatedTime), duration: Duration(milliseconds: animatedTime),
transitionBuilder: (Widget child, Animation<double> animation) { transitionBuilder: (Widget child, Animation<double> animation) {
return ScaleTransition(scale: animation, child: child); return ScaleTransition(scale: animation, child: child);
...@@ -743,10 +682,12 @@ class _NewHome2State extends State<NewHome2> { ...@@ -743,10 +682,12 @@ class _NewHome2State extends State<NewHome2> {
totalHarga, totalHarga,
tableMode, tableMode,
userName, userName,
widthScreen,
) )
: const SizedBox( : const SizedBox(
key: Key('ButtonBottomCart'), key: Key('ButtonBottomCart'),
), ),
),
) )
], ],
); );
...@@ -813,7 +754,8 @@ class _NewHome2State extends State<NewHome2> { ...@@ -813,7 +754,8 @@ class _NewHome2State extends State<NewHome2> {
int totalItem, int totalItem,
int totalHarga, int totalHarga,
int tableMode, int tableMode,
String namaPelanggan) { String namaPelanggan,
double widthScreen) {
String itemString; String itemString;
if (totalItem > 1) { if (totalItem > 1) {
itemString = '$totalItem Items'; itemString = '$totalItem Items';
...@@ -931,13 +873,15 @@ class _NewHome2State extends State<NewHome2> { ...@@ -931,13 +873,15 @@ class _NewHome2State extends State<NewHome2> {
Positioned( Positioned(
bottom: 0, bottom: 0,
child: Container( child: Container(
width: MediaQuery.of(context).size.width, width: widthScreen,
height: 61, height: 61,
decoration: BoxDecoration( decoration: BoxDecoration(
color: buttonColor, color: buttonColor,
borderRadius: const BorderRadius.only( borderRadius: const BorderRadius.only(
topRight: Radius.circular(20), topRight: Radius.circular(20),
topLeft: Radius.circular(10), topLeft: Radius.circular(10),
// bottomLeft: Radius.circular(50),
// bottomRight: Radius.circular(50),
), ),
), ),
child: Row( child: Row(
...@@ -1001,11 +945,12 @@ class _NewHome2State extends State<NewHome2> { ...@@ -1001,11 +945,12 @@ class _NewHome2State extends State<NewHome2> {
left: paddingLeftRight, left: paddingLeftRight,
), ),
height: 43, height: 43,
width: MediaQuery.of(context).size.width - 157, width: widthScreen - 157,
decoration: BoxDecoration( decoration: BoxDecoration(
color: buttonColor, color: buttonColor,
borderRadius: const BorderRadius.only( borderRadius: const BorderRadius.only(
topLeft: Radius.circular(20), topLeft: Radius.circular(20),
bottomRight: Radius.circular(20),
), ),
), ),
child: Align( child: Align(
...@@ -1033,6 +978,7 @@ class _NewHome2State extends State<NewHome2> { ...@@ -1033,6 +978,7 @@ class _NewHome2State extends State<NewHome2> {
barName = "Meja $tableNumber"; barName = "Meja $tableNumber";
} }
return Container( return Container(
margin: const EdgeInsets.only(top: 24),
height: appBarHeight, height: appBarHeight,
child: Row( child: Row(
children: [ children: [
...@@ -1050,8 +996,8 @@ class _NewHome2State extends State<NewHome2> { ...@@ -1050,8 +996,8 @@ class _NewHome2State extends State<NewHome2> {
}, },
child: const Image( child: const Image(
image: AssetImage('assets/icons/search.png'), image: AssetImage('assets/icons/search.png'),
height: 20, height: 24,
width: 20, width: 24,
), ),
), ),
const SizedBox( const SizedBox(
...@@ -1064,8 +1010,8 @@ class _NewHome2State extends State<NewHome2> { ...@@ -1064,8 +1010,8 @@ class _NewHome2State extends State<NewHome2> {
}, },
child: const Image( child: const Image(
image: AssetImage('assets/icons/book.png'), image: AssetImage('assets/icons/book.png'),
height: 20, height: 24,
width: 20, width: 24,
), ),
), ),
], ],
...@@ -1094,35 +1040,6 @@ class _NewHome2State extends State<NewHome2> { ...@@ -1094,35 +1040,6 @@ class _NewHome2State extends State<NewHome2> {
), ),
); );
} }
// AnimatedSwitcher seearchField(BuildContext context) {
// return AnimatedSwitcher(
// duration: const Duration(milliseconds: 500),
// transitionBuilder: (Widget child, Animation<double> animation) {
// return ScaleTransition(scale: animation, child: child);
// },
// child: TextField(
// key: const Key('SearchField'),
// decoration: InputDecoration(
// focusedBorder: OutlineInputBorder(
// borderSide: BorderSide(
// width: 1,
// color: buttonColor,
// ),
// ),
// prefixIcon: const Image(
// image: AssetImage('assets/icons/search.png'),
// height: 20,
// width: 20,
// ),
// hintText: 'Example: nasi',
// border: OutlineInputBorder(
// borderRadius: BorderRadius.circular(6),
// ),
// ),
// ),
// );
// }
} }
class Delegate extends SliverPersistentHeaderDelegate { class Delegate extends SliverPersistentHeaderDelegate {
...@@ -1170,20 +1087,33 @@ class CustomClipPath extends CustomClipper<Path> { ...@@ -1170,20 +1087,33 @@ class CustomClipPath extends CustomClipper<Path> {
Path getClip(Size size) { Path getClip(Size size) {
// buat clipnya di https://shapemaker.web.app/#/ // 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();
double w = size.width;
Path path0 = Path(); Path path0 = Path();
path0.moveTo(0, 0); path0.moveTo(0, 0);
path0.lineTo(0, size.height); path0.lineTo(0, size.height);
path0.lineTo(size.width, size.height); path0.lineTo(w, size.height);
path0.quadraticBezierTo(size.width, size.height * 0.6250000, size.width, path0.quadraticBezierTo(
size.height * 0.5042857); w * 1.0004167, size.height * 0.6267857, w, size.height * 0.5985714);
path0.cubicTo( path0.cubicTo(w * 0.9452083, size.height * 0.4360714, w * 0.9633333,
size.width * 0.8616667, size.height * 0.3653571, w * 0.9500000, size.height * 0.2142857);
size.height * 0.4364286, path0.quadraticBezierTo(
size.width * 0.9810417, w * 0.9337500, size.height * 0.0164286, w * 0.8716667, 0);
size.height * 0.0007143, path0.lineTo(0, 0);
size.width * 0.7191667,
0);
path0.quadraticBezierTo(size.width * 0.5468750, 0, 0, 0);
path0.close(); path0.close();
return path0; return path0;
} }
......
// ignore_for_file: sized_box_for_whitespace, must_be_immutable
import 'package:byod/helper/helper.dart';
import 'package:byod/helper/widget/style.dart';
import 'package:byod/models/order_details.dart';
import 'package:byod/ui/home/variant_new.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import '../../bloc/order_variant_value.dart';
import '../../main.dart';
import '../../models/variant_categories.dart';
class VariantCatNew extends StatefulWidget {
final List<VariantCategories> variantCategories;
final int initPrice;
const VariantCatNew({
Key? key,
required this.variantCategories,
required this.initPrice,
}) : super(key: key);
@override
State<VariantCatNew> createState() => _VariantCatNewState();
}
class _VariantCatNewState extends State<VariantCatNew> {
final noteCatController = TextEditingController();
OrderDetail orderDetail = OrderDetail(
allIdVariant: '',
totalItem: 0,
totalHarga: 0,
note: '',
orderVariant: [],
);
@override
void initState() {
context
.read<OrderVariantValueBloc>()
.setOrderVariant('', '', '', 0, 0, [], '');
super.initState();
}
@override
Widget build(BuildContext context) {
FocusScopeNode currentFocus = FocusScope.of(context);
double widthScreen = responsiveWidthScreen(context);
return SafeArea(
child: GestureDetector(
onTap: () {
if (!currentFocus.hasPrimaryFocus) {
currentFocus.unfocus();
}
},
child: Scaffold(
backgroundColor: backgroundColor,
body: Container(
padding: const EdgeInsets.symmetric(horizontal: paddingLeftRight),
child: Column(
children: [
Container(
margin: const EdgeInsets.only(
top: 15,
bottom: 20,
),
child: Row(
children: [
GestureDetector(
onTap: () {
Navigator.pop(context);
},
child: Container(
width: 24,
height: 24,
child: Center(
child: fontAwesomeNew(
arrowBack,
arrowBackSize,
),
),
),
),
const SizedBox(
width: 16,
),
Center(
child: defaultText(
context,
'Custom Pesanan',
style: appBarNameVariant(),
),
),
],
),
),
Expanded(
child: ListView(
children: [
ListView.builder(
physics:
const NeverScrollableScrollPhysics(), // to disable GridView's scrolling
shrinkWrap: true,
itemCount: widget.variantCategories.length,
itemBuilder: ((context, index) {
return Container(
width: double.infinity,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
margin: EdgeInsets.only(
bottom:
MediaQuery.of(context).size.height *
0.01,
top: MediaQuery.of(context).size.height *
0.01),
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
defaultText(
context,
widget.variantCategories[index].caption,
style: variantStyleText(),
),
defaultText(
context,
(widget.variantCategories[index].type ==
typeMandatory)
? 'Pilih Salah Satu'
: (widget.variantCategories[index]
.type ==
typeAutoInsert)
? 'Sudah termasuk'
: 'Optional',
style: variantStyleText(
font: 12,
fontWeight: FontWeight.w300,
),
)
],
),
),
const Divider(
thickness: 0.5,
color: textColorBlack,
),
VariantNew(
variants:
widget.variantCategories[index].variant,
captioncategories:
widget.variantCategories[index].caption,
type: widget.variantCategories[index].type,
initPrice: widget.initPrice,
idCategory:
widget.variantCategories[index].id,
orderDetail: orderDetail,
),
],
),
);
})),
const SizedBox(
height: 74,
),
defaultText(
context,
"Note :",
style: variantStyleText(
font: 20,
fontWeight: FontWeight.w400,
),
),
const SizedBox(
height: 12,
),
// TextField(
// maxLength: maxLengthTextField,
// maxLines: 2,
// autofocus: false,
// keyboardType: TextInputType.text,
// controller: noteCatController,
// style: textStyleNormalFont(context),
// decoration: InputDecoration(
// prefixIcon: Image(
// image: const AssetImage('assets/icons/search.png'),
// color: Colors.grey.withOpacity(0.8),
// height: 20,
// width: 20,
// ),
// hintText: placeHolderNote,
// hintStyle: TextStyle(
// color: Colors.grey,
// fontSize:
// MediaQuery.of(context).size.height * normalFont,
// ),
// ),
// ),
Container(
height: 35,
child: TextField(
maxLength: maxLengthTextField,
autofocus: false,
style: const TextStyle(
color: textColorBlack,
fontFamily: 'OpenSans',
fontSize: 10,
fontWeight: FontWeight.w400,
),
textAlignVertical: TextAlignVertical.center,
decoration: InputDecoration(
counterText: "",
filled: true,
enabledBorder: OutlineInputBorder(
borderSide: const BorderSide(
width: 1,
color: textColorPlaceHolder,
),
borderRadius: BorderRadius.circular(21),
),
focusedBorder: OutlineInputBorder(
borderSide: const BorderSide(
width: 1,
color: textColorPlaceHolder,
),
borderRadius: BorderRadius.circular(21),
),
prefixIcon: const Image(
image: AssetImage('assets/icons/note-grey.png'),
color: textColorPlaceHolder,
height: 13.33,
width: 13.33,
),
fillColor: backgroundColor,
contentPadding: EdgeInsets.zero,
hintText: placeHolderNote,
hintStyle: const TextStyle(
color: textColorPlaceHolder,
fontFamily: 'OpenSans',
fontSize: 10,
fontWeight: FontWeight.w400,
),
),
),
),
SizedBox(
height: MediaQuery.of(context).size.height * 0.03,
),
(isExcelso)
? (!currentFocus.hasPrimaryFocus)
? SizedBox(
height:
MediaQuery.of(context).size.height * 0.5,
)
: const SizedBox()
: const SizedBox()
],
),
)
],
),
),
),
));
}
}
// ignore_for_file: sized_box_for_whitespace
import 'package:byod/bloc/order_variant_temporary.dart';
import 'package:byod/bloc/order_variant_value.dart';
import 'package:byod/helper/widget/style.dart';
import 'package:byod/models/order_details.dart';
import 'package:byod/models/order_variants.dart';
import 'package:byod/models/variants.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import '../../helper/helper.dart';
// ignore: must_be_immutable
class VariantNew extends StatefulWidget {
List<Variants> variants;
String captioncategories;
int type;
int initPrice;
String idCategory;
OrderDetail orderDetail;
VariantNew(
{Key? key,
required this.variants,
required this.captioncategories,
required this.type,
required this.initPrice,
required this.idCategory,
required this.orderDetail})
: super(key: key);
@override
State<VariantNew> createState() => _VariantNewState();
}
class _VariantNewState extends State<VariantNew> {
String variantMenu = '';
List<dynamic> variantRadio = [];
List<String> optionalVariant = [];
@override
Widget build(BuildContext context) {
double widthScreen = responsiveWidthScreen(context);
double currentScreen = MediaQuery.of(context).size.width;
double maxWidthScreen = getMaxWidthScreen(context, useResponsive);
// if (variantRadio.isNotEmpty) {
// print(variantRadio[0]);
// }
FocusScopeNode currentFocus = FocusScope.of(context);
return BlocBuilder<OrderVariantValueBloc, List<OrderVariant>>(
builder: (context, orderVariants) {
return ListView.builder(
physics:
const NeverScrollableScrollPhysics(), // to disable GridView's scrolling
shrinkWrap: true,
itemCount: widget.variants.length,
itemBuilder: ((context, i) {
var priceVariant = amountParseToInt(widget.variants[i].price);
return BlocBuilder<OrderVariantTemporaryBloc, List<dynamic>>(
builder: (context, listOrders) {
var listOrder = listOrders[0];
var itemId = listOrder[0];
var satuanPrice = listOrder[1];
var initialValue = listOrder[2];
return variantList(
widthScreen,
i,
context,
priceVariant,
itemId,
satuanPrice,
initialValue,
orderVariants,
maxWidthScreen,
currentFocus);
// return variantList(widthScreen, i, context, priceVariant,
// itemId, satuanPrice, initialValue, orderVariants);
},
);
}));
},
);
}
Container variantList(
double widthScreen,
int i,
BuildContext context,
int priceVariant,
itemId,
satuanPrice,
initialValue,
List<OrderVariant> orderVariants,
double maxWidthScreen,
FocusScopeNode currentFocus,
) {
return Container(
width: (widthScreen > maxWidthScreen) ? maxWidthScreen : widthScreen,
child: Column(
children: [
Row(
children: [
Container(
width: 160,
child: defaultText(
context,
widget.variants[i].name,
maxLines: 2,
overFlow: TextOverflow.ellipsis,
style: variantStyleText(
fontWeight: FontWeight.w300,
font: 12,
),
),
),
Expanded(
// width: 170,
// color: Colors.blue,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Container(
child: defaultText(
context,
(priceVariant > 0)
? formatNumber().format(priceVariant)
: "Free",
style: variantStyleText(
fontWeight: FontWeight.w300,
font: 12,
),
)),
(widget.type == typeMandatory)
? radioButton(
i,
itemId,
satuanPrice,
initialValue,
variantRadio,
priceVariant,
widget.idCategory,
orderVariants,
currentFocus,
)
: (widget.type == typeOptional)
? checkBoxButton(
i,
itemId,
satuanPrice,
initialValue,
variantRadio,
priceVariant,
widget.idCategory,
orderVariants,
currentFocus,
)
: const SizedBox()
],
),
),
],
)
],
),
);
}
Checkbox checkBoxButton(
int i,
String itemId,
int satuanHarga,
int initialValue,
List<dynamic> variantRadio,
int priceVariant,
String idCategory,
List<OrderVariant> orderVariants,
FocusScopeNode currentFocus,
) {
return Checkbox(
activeColor: buttonColor,
value: (optionalVariant.contains(widget.variants[i].id) == true)
? true
: false,
onChanged: (value) {
if (!currentFocus.hasPrimaryFocus) {
currentFocus.unfocus();
}
(value == true)
? optionalVariant.add(widget.variants[i].id)
: optionalVariant.remove(widget.variants[i].id);
context.read<OrderVariantValueBloc>().setOrderVariant(
idCategory,
widget.variants[i].id,
widget.variants[i].name,
priceVariant,
typeOptional,
orderVariants,
widget.captioncategories,
forChecBox: value);
setState(() {});
});
}
Radio<String> radioButton(
int i,
String itemId,
int satuanHarga,
int initialValue,
List<dynamic> variantRadio,
int priceVariant,
String idCategory,
List<OrderVariant> orderVariants,
FocusScopeNode currentFocus) {
return Radio(
value: widget.variants[i].id,
groupValue: variantMenu,
hoverColor: buttonColor,
activeColor: buttonColor,
onChanged: (newValue) {
if (!currentFocus.hasPrimaryFocus) {
currentFocus.unfocus();
}
// buat list untuk radio button
variantMenu = newValue.toString();
context.read<OrderVariantValueBloc>().setOrderVariant(
idCategory,
variantMenu.toString(),
widget.variants[i].name,
priceVariant,
typeMandatory,
orderVariants,
widget.captioncategories,
);
setState(() {});
});
}
}
...@@ -62,7 +62,7 @@ flutter: ...@@ -62,7 +62,7 @@ flutter:
- asset: assets/fonts/roboto/Roboto-Regular.ttf - asset: assets/fonts/roboto/Roboto-Regular.ttf
- family: OpenSans - family: OpenSans
fonts: fonts:
- asset: assets/fonts/roboto/Roboto-Regular.ttf - asset: assets/fonts/open_sans/OpenSans-Regular.ttf
- family: RobotoFlex - family: RobotoFlex
fonts: fonts:
- asset: assets/fonts/roboto_flex/RobotoFlex-Regular.ttf - asset: assets/fonts/roboto_flex/RobotoFlex-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