Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
B
Byodv2
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Dio Maulana
Byodv2
Commits
fabd3fc0
Commit
fabd3fc0
authored
Sep 15, 2022
by
Dio Maulana
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
home page fix
parent
21db6841
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
942 additions
and
662 deletions
+942
-662
config.json
assets/config.json
+1
-1
api.dart
lib/api/api.dart
+7
-0
search_menu.dart
lib/bloc/search_menu.dart
+25
-15
helper.dart
lib/helper/helper.dart
+2
-0
poni_bottom_sheet.dart
lib/helper/widget/poni_bottom_sheet.dart
+4
-7
style.dart
lib/helper/widget/style.dart
+31
-3
filter_menu.dart
lib/models/filter_menu.dart
+23
-20
bottom_sheet_menu.dart
lib/ui/home/bottom_sheet_menu.dart
+208
-121
cat_list.dart
lib/ui/home/cat_list.dart
+20
-10
fav_grid_menu.dart
lib/ui/home/fav_grid_menu.dart
+36
-7
fav_list.dart
lib/ui/home/fav_list.dart
+5
-0
menu_list_utama.dart
lib/ui/home/menu_list_utama.dart
+79
-11
new_home2.dart
lib/ui/home/new_home2.dart
+493
-467
pubspec.lock
pubspec.lock
+7
-0
pubspec.yaml
pubspec.yaml
+1
-0
No files found.
assets/config.json
View file @
fabd3fc0
{
"base_url"
:
"https://romi-dev2.ravku.com/"
,
"title"
:
"Ravintola Dev BYOD"
,
"isResponsive"
:
tru
e
,
"isResponsive"
:
fals
e
,
"debug"
:
true
}
\ No newline at end of file
lib/api/api.dart
View file @
fabd3fc0
...
...
@@ -335,6 +335,7 @@ class Api {
"sold_in_store"
:
false
,
"type"
:
typeCategory
,
"category_name"
:
dataCat
[
d
][
'name'
],
"category_id"
:
dataCat
[
d
][
'id'
],
"description"
:
''
,
"group_id"
:
''
,
"group_name"
:
''
,
...
...
@@ -391,6 +392,7 @@ class Api {
"sold_in_store"
:
false
,
"type"
:
typeGroup
,
"category_name"
:
dataCat
[
d
][
'name'
],
"category_id"
:
dataCat
[
d
][
'id'
],
"description"
:
''
,
"group_id"
:
menuList
[
i
][
'group_id'
],
"group_name"
:
menuList
[
i
][
'group_name'
],
...
...
@@ -411,6 +413,7 @@ class Api {
"sold_in_store"
:
menuList
[
i
][
'sold_in_store'
],
"type"
:
typeMenu
,
"category_name"
:
dataCat
[
d
][
'name'
],
"category_id"
:
dataCat
[
d
][
'id'
],
"description"
:
menuList
[
i
][
'description'
],
"group_name"
:
menuList
[
i
][
'group_name'
],
"group_id"
:
menuList
[
i
][
'group_id'
],
...
...
@@ -437,6 +440,7 @@ class Api {
"sold_in_store"
:
false
,
"type"
:
typeCategory
,
"category_name"
:
favGroup
[
s
][
'name'
],
"category_id"
:
favGroup
[
s
][
'id'
],
"description"
:
''
,
"group_id"
:
''
,
"group_name"
:
''
,
...
...
@@ -486,6 +490,7 @@ class Api {
"sold_in_store"
:
false
,
"type"
:
typeGroup
,
"category_name"
:
favGroup
[
s
][
'name'
],
"category_id"
:
favGroup
[
s
][
'id'
],
"description"
:
''
,
"group_id"
:
favDetail
[
i
][
'group_id'
],
"group_name"
:
favDetail
[
i
][
'group_name'
],
...
...
@@ -507,6 +512,7 @@ class Api {
"sold_in_store"
:
favDetail
[
i
][
'sold_in_store'
],
"type"
:
typeMenu
,
"category_name"
:
favGroup
[
s
][
'name'
],
"category_id"
:
favGroup
[
s
][
'id'
],
"description"
:
favDetail
[
i
][
'description'
],
"group_name"
:
favDetail
[
i
][
'group_name'
],
"group_id"
:
favDetail
[
i
][
'group_id'
],
...
...
@@ -532,6 +538,7 @@ class Api {
isSell:
false
,
type:
typeCategory
,
categoryName:
''
,
categoryId:
''
,
description:
''
,
groupId:
''
,
groupName:
''
,
...
...
lib/bloc/search_menu.dart
View file @
fabd3fc0
...
...
@@ -26,8 +26,29 @@ import 'package:byod/models/filter_menu.dart';
import
'package:flutter_bloc/flutter_bloc.dart'
;
class
SearchMenu
extends
Cubit
<
List
<
dynamic
>>
{
SearchMenu
()
:
super
([[],
'All'
,
false
]);
// return arraynya [list<Category>, SelectedCat, bool dari ini lagi search by text or not,]
SearchMenu
()
:
super
([
[
FilterMenu
(
id:
'start'
,
name:
''
,
price:
''
,
originalPrice:
''
,
imageUrlMedium:
''
,
imageUrlThumbnail:
''
,
isSell:
false
,
type:
typeMenu
,
categoryName:
''
,
categoryId:
''
,
description:
''
,
groupName:
''
,
groupId:
''
,
)
],
'All'
,
false
]);
// return arraynya [list<Category>, SelectedCat, bool dari search by text(typing) or not,]
void
searchMenu
(
List
<
FilterMenu
>
oldMenu
,
{
...
...
@@ -63,22 +84,11 @@ class SearchMenu extends Cubit<List<dynamic>> {
if
(
indexGroupId
==
-
1
&&
indexGroup
!=
-
1
)
{
searchMenu
.
add
(
oldMenu
[
indexGroup
]);
}
searchMenu
.
add
(
x
);
}
// for (var menu in x.menu) {
// if (menu.name.toLowerCase().contains(keyword.toLowerCase())) {
// // searchMenu.add(menu);
// menuSearch.add(menu);
// var x = {
// "id": cat.id,
// "name": cat.name,
// "menu": menuSearch,
// };
// searchMenu.add(Category.createCategory(x));
// }
// }
}
}
else
{
searchMenu
=
oldMenu
;
}
}
else
{
if
(
categorySelected
!=
''
)
{
...
...
lib/helper/helper.dart
View file @
fabd3fc0
...
...
@@ -249,6 +249,8 @@ const textColorTabel = Color(0xff333333);
const
textColorBlack
=
Color
(
0xff000000
);
const
textColorRed
=
Color
(
0xffE73636
);
const
textGrey
=
Color
(
0xffE0E0E0
);
const
textGreyDeskripsi
=
Color
(
0xffBDBDBD
);
const
backgroundColorBottomSheet
=
Color
(
0xffE5E5E5
);
const
textColorModalHeaderNama
=
Color
(
0xffCCCCFF
);
const
gridCardBackgroundColor
=
Color
(
0xffFFFFFF
);
Color
buttonColor
=
...
...
lib/helper/widget/poni_bottom_sheet.dart
View file @
fabd3fc0
import
'package:flutter/material.dart'
;
import
'../helper.dart'
;
class
PoniBottomSheet
extends
StatelessWidget
{
const
PoniBottomSheet
({
Key
?
key
})
:
super
(
key:
key
);
@override
Widget
build
(
BuildContext
context
)
{
double
widthScreen
=
responsiveWidthScreen
(
context
);
return
Container
(
width:
widthScreen
*
0.3
,
height:
MediaQuery
.
of
(
context
).
size
.
height
*
0.008
,
width:
50
,
height:
3
,
decoration:
BoxDecoration
(
borderRadius:
BorderRadius
.
circular
(
roundedButton
),
color:
Colors
.
grey
),
borderRadius:
BorderRadius
.
circular
(
7
),
color:
const
Color
(
0xffD9D9D9
)
),
// child: Divider(
// color: buttonColor.withOpacity(0.6),
// thickness: MediaQuery.of(context).size.height * 0.008,
...
...
lib/helper/widget/style.dart
View file @
fabd3fc0
...
...
@@ -162,11 +162,12 @@ TextStyle deskripsiMenuStyle({
TextStyle
amountMenuStyle
(
{
font
=
16
,
Color
color
=
textColorBlack
,
FontWeight
fontWeight
=
FontWeight
.
w300
,
})
{
return
TextStyle
(
fontFamily:
(
fontFamily
==
''
)
?
null
:
fontFamily
,
fontSize:
font
,
fontWeight:
FontWeight
.
w300
,
fontWeight:
fontWeight
,
color:
color
,
);
}
...
...
@@ -212,7 +213,7 @@ TextStyle textCountItem({
Color
color
=
textInButton
,
})
{
return
TextStyle
(
fontFamily:
'Robot'
,
fontFamily:
'Robot
o
'
,
fontSize:
font
,
fontWeight:
FontWeight
.
w500
,
color:
color
,
...
...
@@ -350,6 +351,24 @@ Text textAmountMenu(BuildContext context, int amount) {
// );
}
TextStyle
textDeskripsiHeader
(
)
{
return
const
TextStyle
(
fontFamily:
'Roboto'
,
fontWeight:
FontWeight
.
w500
,
fontSize:
14
,
color:
textColorBlack
,
);
}
TextStyle
textDeskripsi
(
)
{
return
const
TextStyle
(
fontFamily:
'Roboto'
,
fontWeight:
FontWeight
.
w400
,
fontSize:
14
,
color:
textGreyDeskripsi
,
);
}
Text
textAmountCoret
(
BuildContext
context
,
int
hargaCoret
)
{
return
defaultText
(
context
,
...
...
@@ -398,7 +417,7 @@ Text textMenuNameBottomShetModalMenu(BuildContext context, String text) {
text
,
maxLines:
2
,
overFlow:
TextOverflow
.
ellipsis
,
style:
textStyleMenuList
(
context
),
style:
menuNameBottomSheet
(
),
);
// return Text(
// text,
...
...
@@ -408,6 +427,15 @@ Text textMenuNameBottomShetModalMenu(BuildContext context, String text) {
// );
}
TextStyle
menuNameBottomSheet
(
)
{
return
const
TextStyle
(
fontFamily:
'Roboto'
,
fontWeight:
FontWeight
.
w500
,
fontSize:
28
,
color:
textColorBlack
,
);
}
Text
textDescriptionBottomShetModalMenu
(
BuildContext
context
,
String
text
)
{
return
defaultText
(
context
,
...
...
lib/models/filter_menu.dart
View file @
fabd3fc0
...
...
@@ -10,6 +10,7 @@ class FilterMenu {
final
bool
isSell
;
final
int
type
;
final
String
categoryName
;
final
String
categoryId
;
final
String
description
;
final
String
groupName
;
final
String
groupId
;
...
...
@@ -28,6 +29,7 @@ class FilterMenu {
required
this
.
isSell
,
required
this
.
type
,
required
this
.
categoryName
,
required
this
.
categoryId
,
required
this
.
description
,
required
this
.
groupName
,
required
this
.
groupId
,
...
...
@@ -39,25 +41,26 @@ class FilterMenu {
factory
FilterMenu
.
createMenu
(
Map
<
String
,
dynamic
>
json
)
{
return
FilterMenu
(
id:
json
[
'id'
],
name:
json
[
'name'
],
price:
json
[
'price'
],
originalPrice:
json
[
'original_price'
],
imageUrlMedium:
json
[
'image_medium'
],
imageUrlThumbnail:
json
[
'image_thumbnail'
],
isSell:
json
[
'sold_in_store'
],
type:
json
[
'type'
],
categoryName:
json
[
'category_name'
],
description:
json
[
'description'
],
groupName:
json
[
'group_name'
],
groupId:
json
[
'group_id'
],
isFavMenu:
(
json
[
'is_fav'
]
==
null
)
?
false
:
json
[
'is_fav'
],
variantCat:
json
[
'variant_cat'
],
favGroupId:
(
json
[
'favorite_group_id'
]
==
null
)
?
''
:
json
[
'favorite_group_id'
],
favGroupName:
(
json
[
'favorite_group_name'
]
==
null
)
?
''
:
json
[
'favorite_group_name'
]);
id:
json
[
'id'
],
name:
json
[
'name'
],
price:
json
[
'price'
],
originalPrice:
json
[
'original_price'
],
imageUrlMedium:
json
[
'image_medium'
],
imageUrlThumbnail:
json
[
'image_thumbnail'
],
isSell:
json
[
'sold_in_store'
],
type:
json
[
'type'
],
categoryName:
json
[
'category_name'
],
categoryId:
json
[
'category_id'
],
description:
json
[
'description'
],
groupName:
json
[
'group_name'
],
groupId:
json
[
'group_id'
],
isFavMenu:
(
json
[
'is_fav'
]
==
null
)
?
false
:
json
[
'is_fav'
],
variantCat:
json
[
'variant_cat'
],
favGroupId:
(
json
[
'favorite_group_id'
]
==
null
)
?
''
:
json
[
'favorite_group_id'
],
favGroupName:
(
json
[
'favorite_group_name'
]
==
null
)
?
''
:
json
[
'favorite_group_name'
],
);
}
}
lib/ui/home/bottom_sheet_menu.dart
View file @
fabd3fc0
...
...
@@ -63,50 +63,19 @@ class _ShowMenuModalState extends State<ShowMenuModal> {
return
Container
(
padding:
EdgeInsets
.
symmetric
(
horizontal:
leftRigthPadding
),
child:
Container
(
height:
MediaQuery
.
of
(
context
).
size
.
height
*
0.9
,
margin:
EdgeInsets
.
only
(
left:
widthScreen
*
0.005
,
right:
widthScreen
*
0.005
,
top:
MediaQuery
.
of
(
context
).
size
.
height
*
0.005
,
bottom:
MediaQuery
.
of
(
context
).
size
.
height
*
0.005
),
decoration:
BoxDecoration
(
borderRadius:
BorderRadius
.
only
(
topRight:
Radius
.
circular
(
roundedImage
),
topLeft:
Radius
.
circular
(
roundedImage
)),
color:
backgroundColor
),
height:
704
,
child:
Container
(
margin:
EdgeInsets
.
only
(
left:
widthScreen
*
0.05
,
right:
widthScreen
*
0.05
,
top:
MediaQuery
.
of
(
context
).
size
.
height
*
0.02
,
bottom:
MediaQuery
.
of
(
context
).
size
.
height
*
0.02
),
margin:
const
EdgeInsets
.
symmetric
(
horizontal:
16
,
),
child:
Column
(
children:
[
const
PoniBottomSheet
(),
SizedBox
(
height:
MediaQuery
.
of
(
context
).
size
.
height
*
0.03
,
const
SizedBox
(
height:
8
,
),
Container
(
// height: MediaQuery.of(context).size.height * 0.45,
width:
double
.
infinity
,
decoration:
BoxDecoration
(
borderRadius:
BorderRadius
.
circular
(
roundedImage
),
color:
disabledColor
.
withOpacity
(
0.8
),
),
child:
ClipRRect
(
borderRadius:
BorderRadius
.
circular
(
roundedImage
),
child:
(
widget
.
imageUrl
!=
''
)
?
Image
(
fit:
BoxFit
.
fill
,
image:
NetworkImage
(
widget
.
imageUrl
),
)
:
const
Image
(
fit:
BoxFit
.
fill
,
image:
AssetImage
(
'assets/noimage.png'
)),
),
),
SizedBox
(
height:
MediaQuery
.
of
(
context
).
size
.
height
*
0.02
,
const
PoniBottomSheet
(),
const
SizedBox
(
height:
32
,
),
Align
(
alignment:
Alignment
.
topLeft
,
...
...
@@ -115,105 +84,223 @@ class _ShowMenuModalState extends State<ShowMenuModal> {
widget
.
namaMenu
,
),
),
SizedBox
(
height:
MediaQuery
.
of
(
context
).
size
.
height
*
0.02
,
const
SizedBox
(
height:
30
,
),
ClipRRect
(
borderRadius:
BorderRadius
.
circular
(
21
),
child:
(
widget
.
imageUrl
!=
''
)
?
Image
(
width:
343
,
height:
350
,
fit:
BoxFit
.
fill
,
image:
NetworkImage
(
widget
.
imageUrl
),
)
:
const
Image
(
width:
343
,
height:
350
,
fit:
BoxFit
.
fill
,
image:
AssetImage
(
'assets/noimage.png'
)),
),
const
SizedBox
(
height:
20
,
),
(
widget
.
description
!=
''
)
?
Align
(
alignment:
Alignment
.
topLeft
,
child:
textDescriptionBottomShetModalMenu
(
child:
defaultText
(
context
,
widget
.
description
,
'Deskripsi'
,
style:
textDeskripsiHeader
(),
),
)
:
const
SizedBox
(),
const
SizedBox
(
height:
12
,
),
(
widget
.
description
!=
''
)
?
SizedBox
(
height:
MediaQuery
.
of
(
context
).
size
.
height
*
0.02
,
?
Align
(
alignment:
Alignment
.
topLeft
,
child:
defaultText
(
context
,
widget
.
description
,
maxLines:
5
,
overFlow:
TextOverflow
.
ellipsis
,
style:
textDeskripsi
(),
),
)
:
const
SizedBox
(),
Align
(
alignment:
Alignment
.
topLeft
,
child:
textAmoutBottomShetModalMenu
(
context
,
widget
.
hargaMenu
,
),
),
SizedBox
(
height:
MediaQuery
.
of
(
context
).
size
.
height
*
0.02
,
const
SizedBox
(
height:
31
,
),
const
Spacer
(),
GestureDetector
(
onTap:
()
{
if
(
widget
.
isSell
)
{
if
(
widget
.
isHavevariant
)
{
if
(
indexListOrderan
==
-
1
)
{
Navigator
.
pop
(
context
);
context
.
read
<
OrderVariantTemporaryBloc
>()
.
insertDataVariant
(
Container
(
padding:
const
EdgeInsets
.
only
(
bottom:
18
),
child:
Row
(
mainAxisAlignment:
MainAxisAlignment
.
spaceBetween
,
children:
[
defaultText
(
context
,
'Rp
${formatNumber().format(widget.hargaMenu)}
'
,
style:
amountMenuStyle
(
font:
20
,
fontWeight:
FontWeight
.
w500
),
),
GestureDetector
(
onTap:
()
{
if
(
widget
.
isSell
)
{
if
(
widget
.
isHavevariant
)
{
if
(
indexListOrderan
==
-
1
)
{
Navigator
.
pop
(
context
);
context
.
read
<
OrderVariantTemporaryBloc
>()
.
insertDataVariant
(
widget
.
id
,
widget
.
hargaMenu
,
1
,
[]);
// check pada bloc untuk mengethui list arraynya
Navigator
.
push
(
context
,
MaterialPageRoute
(
builder:
(
_
)
=>
VariantCat
(
namaMenu:
widget
.
namaMenu
,
variantCategories:
widget
.
variantCat
,
initPrice:
widget
.
hargaMenu
,
idItem:
widget
.
id
,
imageUrl:
widget
.
imageUrl
,
listCurrentOrder:
list
,
orderDetail:
OrderDetail
(
allIdVariant:
''
,
totalItem:
0
,
totalHarga:
0
,
note:
''
,
orderVariant:
[]),
)));
}
else
{
Navigator
.
pop
(
context
);
showModalBottomSheet
(
backgroundColor:
Colors
.
white
.
withOpacity
(
0
),
isScrollControlled:
true
,
context:
context
,
builder:
(
context
)
{
return
CustomizeVariant
(
orders:
list
[
indexListOrderan
],
variantCat:
widget
.
variantCat
);
},
);
}
}
else
{
initialValue
+=
1
;
context
.
read
<
OrdersBloc
>().
insertData
([
[
widget
.
id
,
widget
.
namaMenu
,
initialValue
,
widget
.
hargaMenu
,
list
,
widget
.
imageUrl
,
orderVariants
,
widget
.
hargaMenu
,
1
,
[]);
// check pada bloc untuk mengethui list arraynya
Navigator
.
push
(
(
indexListOrderan
!=
-
1
)
?
list
[
indexListOrderan
].
note
:
''
,
]
],
context
);
Navigator
.
pop
(
context
);
}
}
},
child:
Container
(
height:
38
,
width:
119
,
decoration:
BoxDecoration
(
borderRadius:
BorderRadius
.
circular
(
6
),
color:
buttonColor
,
),
child:
Center
(
child:
defaultText
(
context
,
MaterialPageRoute
(
builder:
(
_
)
=>
VariantCat
(
namaMenu:
widget
.
namaMenu
,
variantCategories:
widget
.
variantCat
,
initPrice:
widget
.
hargaMenu
,
idItem:
widget
.
id
,
imageUrl:
widget
.
imageUrl
,
listCurrentOrder:
list
,
orderDetail:
OrderDetail
(
allIdVariant:
''
,
totalItem:
0
,
totalHarga:
0
,
note:
''
,
orderVariant:
[]),
)));
}
else
{
Navigator
.
pop
(
context
);
showModalBottomSheet
(
backgroundColor:
Colors
.
white
.
withOpacity
(
0
),
isScrollControlled:
true
,
context:
context
,
builder:
(
context
)
{
return
CustomizeVariant
(
orders:
list
[
indexListOrderan
],
variantCat:
widget
.
variantCat
);
},
);
}
}
else
{
initialValue
+=
1
;
context
.
read
<
OrdersBloc
>().
insertData
([
[
widget
.
id
,
widget
.
namaMenu
,
initialValue
,
widget
.
hargaMenu
,
list
,
widget
.
imageUrl
,
orderVariants
,
widget
.
hargaMenu
,
(
indexListOrderan
!=
-
1
)
?
list
[
indexListOrderan
].
note
:
''
,
]
],
context
);
Navigator
.
pop
(
context
);
}
}
},
child:
buttonBottom
(
context
,
(
widget
.
isSell
)
?
"Tambahkan Orderan"
:
"Habis"
,
(
widget
.
isSell
)
?
buttonColor
:
disabledColor
,
double
.
infinity
,
'Tambah'
,
style:
addButtonMenu
(),
),
),
),
)
],
),
)
// GestureDetector(
// onTap: () {
// if (widget.isSell) {
// if (widget.isHavevariant) {
// if (indexListOrderan == -1) {
// Navigator.pop(context);
// context
// .read<OrderVariantTemporaryBloc>()
// .insertDataVariant(
// widget.id,
// widget.hargaMenu,
// 1,
// []); // check pada bloc untuk mengethui list arraynya
// Navigator.push(
// context,
// MaterialPageRoute(
// builder: (_) => VariantCat(
// namaMenu: widget.namaMenu,
// variantCategories: widget.variantCat,
// initPrice: widget.hargaMenu,
// idItem: widget.id,
// imageUrl: widget.imageUrl,
// listCurrentOrder: list,
// orderDetail: OrderDetail(
// allIdVariant: '',
// totalItem: 0,
// totalHarga: 0,
// note: '',
// orderVariant: []),
// )));
// } else {
// Navigator.pop(context);
// showModalBottomSheet(
// backgroundColor: Colors.white.withOpacity(0),
// isScrollControlled: true,
// context: context,
// builder: (context) {
// return CustomizeVariant(
// orders: list[indexListOrderan],
// variantCat: widget.variantCat);
// },
// );
// }
// } else {
// initialValue += 1;
// context.read<OrdersBloc>().insertData([
// [
// widget.id,
// widget.namaMenu,
// initialValue,
// widget.hargaMenu,
// list,
// widget.imageUrl,
// orderVariants,
// widget.hargaMenu,
// (indexListOrderan != -1)
// ? list[indexListOrderan].note
// : '',
// ]
// ], context);
// Navigator.pop(context);
// }
// }
// },
// child: buttonBottom(
// context,
// (widget.isSell) ? "Tambahkan Orderan" : "Habis",
// (widget.isSell) ? buttonColor : disabledColor,
// double.infinity,
// ),
// )
],
),
),
...
...
lib/ui/home/cat_list.dart
View file @
fabd3fc0
// ignore_for_file: must_be_immutable
import
'package:byod/bloc/menu_selected_bar.dart'
;
import
'package:byod/models/fav_group.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter_bloc/flutter_bloc.dart'
;
...
...
@@ -10,9 +11,15 @@ import '../../models/category_list.dart';
class
CategoryListHome
extends
StatefulWidget
{
List
<
CategoryList
>
categoryList
;
List
<
FavoriteGroup
>
favList
;
ScrollController
scrollController
;
// ScrollController scrollControllerMenu;
CategoryListHome
({
Key
?
key
,
required
this
.
categoryList
,
required
this
.
scrollController
,
required
this
.
favList
,
// required this.scrollControllerMenu,
})
:
super
(
key:
key
);
@override
...
...
@@ -21,14 +28,7 @@ class CategoryListHome extends StatefulWidget {
class
_CategoryListHomeState
extends
State
<
CategoryListHome
>
{
int
selectedIndex
=
0
;
List
<
String
>
catMenu
=
[
'All Item'
,
'New'
,
'Discount'
,
'Food'
,
'Beverage'
,
'Additional'
];
@override
Widget
build
(
BuildContext
context
)
{
return
BlocBuilder
<
MenuSelectedBar
,
List
<
dynamic
>>(
...
...
@@ -40,15 +40,25 @@ class _CategoryListHomeState extends State<CategoryListHome> {
itemBuilder:
(
context
,
i
)
{
return
GestureDetector
(
onTap:
()
{
FocusScopeNode
currentFocus
=
FocusScope
.
of
(
context
);
if
(!
currentFocus
.
hasPrimaryFocus
)
{
currentFocus
.
unfocus
();
}
context
.
read
<
MenuSelectedBar
>()
.
selectedBarMenu
(
i
,
widget
.
categoryList
[
i
].
name
);
.
selectedBarMenu
(
i
,
widget
.
categoryList
[
i
].
id
);
widget
.
scrollController
.
animateTo
(
(
widget
.
favList
.
isNotEmpty
)
?
371
:
0
,
duration:
Duration
(
milliseconds:
animatedTime
),
curve:
Curves
.
fastOutSlowIn
,
);
},
child:
Container
(
color:
backgroundColor
,
margin:
EdgeInsets
.
only
(
left:
(
i
==
0
)
?
0
:
28.335
,
right:
(
i
==
catMenu
.
length
-
1
)
?
0
:
28.335
),
right:
(
i
==
widget
.
categoryList
.
length
-
1
)
?
0
:
28.335
),
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
...
...
lib/ui/home/fav_grid_menu.dart
View file @
fabd3fc0
...
...
@@ -60,12 +60,17 @@ class FavGridMenu extends StatelessWidget {
height:
widthGrid
-
(
2
*
paddingLeftRigthGrid
),
decoration:
BoxDecoration
(
borderRadius:
BorderRadius
.
circular
(
8
),
// color: Colors.red
,
color:
disabledColor
.
withOpacity
(
0.8
)
,
),
child:
GestureDetector
(
onTap:
()
{
FocusScopeNode
currentFocus
=
FocusScope
.
of
(
context
);
if
(!
currentFocus
.
hasPrimaryFocus
)
{
currentFocus
.
unfocus
();
}
showModalBottomSheet
(
backgroundColor:
backgroundColor
.
withOpacity
(
0
)
,
backgroundColor:
Colors
.
white
,
isScrollControlled:
true
,
context:
context
,
builder:
(
context
)
{
...
...
@@ -88,11 +93,15 @@ class FavGridMenu extends StatelessWidget {
},
child:
ClipRRect
(
borderRadius:
BorderRadius
.
circular
(
8
),
child:
Image
(
fit:
BoxFit
.
fill
,
image:
NetworkImage
(
categoryFavAfterSelect
[
i
].
imageUrlMedium
),
),
child:
(
categoryFavAfterSelect
[
i
].
imageUrlMedium
!=
''
)
?
Image
(
fit:
BoxFit
.
fill
,
image:
NetworkImage
(
categoryFavAfterSelect
[
i
].
imageUrlMedium
),
)
:
const
Image
(
fit:
BoxFit
.
fill
,
image:
AssetImage
(
'assets/noimage.png'
)),
),
),
),
...
...
@@ -177,6 +186,11 @@ class FavGridMenu extends StatelessWidget {
?
GestureDetector
(
key:
const
Key
(
'AddButton'
),
onTap:
()
{
FocusScopeNode
currentFocus
=
FocusScope
.
of
(
context
);
if
(!
currentFocus
.
hasPrimaryFocus
)
{
currentFocus
.
unfocus
();
}
if
(
menuFav
.
isSell
)
{
if
(
menuFav
.
variantCat
.
isNotEmpty
)
{
if
(
indexListOrderan
==
-
1
)
{
...
...
@@ -273,6 +287,11 @@ class FavGridMenu extends StatelessWidget {
children:
[
GestureDetector
(
onTap:
()
{
FocusScopeNode
currentFocus
=
FocusScope
.
of
(
context
);
if
(!
currentFocus
.
hasPrimaryFocus
)
{
currentFocus
.
unfocus
();
}
showModalBottomSheet
(
backgroundColor:
backgroundColor
,
isScrollControlled:
true
,
...
...
@@ -310,6 +329,11 @@ class FavGridMenu extends StatelessWidget {
),
GestureDetector
(
onTap:
()
{
FocusScopeNode
currentFocus
=
FocusScope
.
of
(
context
);
if
(!
currentFocus
.
hasPrimaryFocus
)
{
currentFocus
.
unfocus
();
}
if
(
initialValue
>
0
)
{
initialValue
-=
1
;
context
.
read
<
OrdersBloc
>().
insertData
([
...
...
@@ -350,6 +374,11 @@ class FavGridMenu extends StatelessWidget {
),
GestureDetector
(
onTap:
()
{
FocusScopeNode
currentFocus
=
FocusScope
.
of
(
context
);
if
(!
currentFocus
.
hasPrimaryFocus
)
{
currentFocus
.
unfocus
();
}
initialValue
+=
1
;
context
.
read
<
OrdersBloc
>().
insertData
([
[
...
...
lib/ui/home/fav_list.dart
View file @
fabd3fc0
...
...
@@ -30,6 +30,11 @@ class _FavoriteListState extends State<FavoriteList> {
itemBuilder:
(
context
,
i
)
{
return
GestureDetector
(
onTap:
()
{
FocusScopeNode
currentFocus
=
FocusScope
.
of
(
context
);
if
(!
currentFocus
.
hasPrimaryFocus
)
{
currentFocus
.
unfocus
();
}
context
.
read
<
FavSelectedBar
>()
.
selectedBarFav
(
i
,
widget
.
favoriteList
[
i
].
id
);
...
...
lib/ui/home/menu_list_utama.dart
View file @
fabd3fc0
// ignore_for_file: sized_box_for_whitespace
import
'package:byod/bloc/order_bloc.dart'
;
import
'package:byod/helper/widget/poni_bottom_sheet.dart'
;
import
'package:byod/models/orders.dart'
;
import
'package:byod/ui/home/variant_cat.dart'
;
import
'package:flutter/material.dart'
;
...
...
@@ -13,6 +14,7 @@ import '../../helper/widget/style.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'
;
class
MenuListUtama
extends
StatelessWidget
{
...
...
@@ -20,10 +22,14 @@ class MenuListUtama extends StatelessWidget {
Key
?
key
,
required
this
.
categoryNonFav
,
required
this
.
i
,
required
this
.
widthScreen
,
required
this
.
scrollController
,
})
:
super
(
key:
key
);
final
List
<
FilterMenu
>
categoryNonFav
;
final
int
i
;
final
double
widthScreen
;
final
ScrollController
scrollController
;
@override
Widget
build
(
BuildContext
context
)
{
...
...
@@ -107,17 +113,56 @@ class MenuListUtama extends StatelessWidget {
width:
12
,
height:
double
.
infinity
,
),
Container
(
width:
125
,
height:
125
,
decoration:
BoxDecoration
(
borderRadius:
BorderRadius
.
circular
(
14
)),
child:
ClipRRect
(
borderRadius:
BorderRadius
.
circular
(
14
),
child:
Image
(
image:
NetworkImage
(
categoryNonFav
[
i
].
imageUrlMedium
,
),
GestureDetector
(
onTap:
()
{
FocusScopeNode
currentFocus
=
FocusScope
.
of
(
context
);
if
(!
currentFocus
.
hasPrimaryFocus
)
{
currentFocus
.
unfocus
();
}
showModalBottomSheet
(
backgroundColor:
Colors
.
white
,
isScrollControlled:
true
,
context:
context
,
builder:
(
context
)
{
return
ShowMenuModal
(
imageUrl:
categoryNonFav
[
i
].
imageUrlMedium
,
namaMenu:
categoryNonFav
[
i
].
name
,
hargaMenu:
amountParseToInt
(
categoryNonFav
[
i
].
price
),
isHavevariant:
categoryNonFav
[
i
].
variantCat
.
isNotEmpty
?
true
:
false
,
description:
categoryNonFav
[
i
].
description
,
id:
categoryNonFav
[
i
].
id
,
variantCat:
categoryNonFav
[
i
].
variantCat
,
isSell:
categoryNonFav
[
i
].
isSell
,
);
},
);
},
child:
Container
(
width:
125
,
height:
125
,
decoration:
BoxDecoration
(
borderRadius:
BorderRadius
.
circular
(
14
),
color:
disabledColor
.
withOpacity
(
0.8
),
),
child:
ClipRRect
(
borderRadius:
BorderRadius
.
circular
(
14
),
child:
(
categoryNonFav
[
i
].
imageUrlMedium
!=
''
)
?
Image
(
fit:
BoxFit
.
fill
,
image:
NetworkImage
(
categoryNonFav
[
i
].
imageUrlMedium
,
),
)
:
const
Image
(
fit:
BoxFit
.
fill
,
image:
AssetImage
(
'assets/noimage.png'
),
),
),
),
)
...
...
@@ -181,6 +226,12 @@ class MenuListUtama extends StatelessWidget {
const
Spacer
(),
GestureDetector
(
onTap:
()
{
FocusScopeNode
currentFocus
=
FocusScope
.
of
(
context
);
if
(!
currentFocus
.
hasPrimaryFocus
)
{
currentFocus
.
unfocus
();
}
if
(
menuUtama
.
isSell
)
{
if
(
menuUtama
.
variantCat
.
isNotEmpty
)
{
if
(
indexListOrderan
==
-
1
)
{
...
...
@@ -282,6 +333,11 @@ class MenuListUtama extends StatelessWidget {
children:
[
GestureDetector
(
onTap:
()
{
FocusScopeNode
currentFocus
=
FocusScope
.
of
(
context
);
if
(!
currentFocus
.
hasPrimaryFocus
)
{
currentFocus
.
unfocus
();
}
showModalBottomSheet
(
backgroundColor:
backgroundColor
,
isScrollControlled:
true
,
...
...
@@ -330,6 +386,12 @@ class MenuListUtama extends StatelessWidget {
left:
0
,
child:
GestureDetector
(
onTap:
()
{
FocusScopeNode
currentFocus
=
FocusScope
.
of
(
context
);
if
(!
currentFocus
.
hasPrimaryFocus
)
{
currentFocus
.
unfocus
();
}
if
(
initialValue
>
0
)
{
initialValue
-=
1
;
context
.
read
<
OrdersBloc
>().
insertData
([
...
...
@@ -365,6 +427,12 @@ class MenuListUtama extends StatelessWidget {
right:
0
,
child:
GestureDetector
(
onTap:
()
{
FocusScopeNode
currentFocus
=
FocusScope
.
of
(
context
);
if
(!
currentFocus
.
hasPrimaryFocus
)
{
currentFocus
.
unfocus
();
}
initialValue
+=
1
;
context
.
read
<
OrdersBloc
>().
insertData
([
[
...
...
lib/ui/home/new_home2.dart
View file @
fabd3fc0
...
...
@@ -4,6 +4,7 @@ import 'package:byod/bloc/branch_exist.dart';
import
'package:byod/bloc/fav_selected_bar.dart'
;
import
'package:byod/bloc/menu_selected_bar.dart'
;
import
'package:byod/bloc/order_bloc.dart'
;
import
'package:byod/bloc/search_menu.dart'
;
import
'package:byod/helper/helper.dart'
;
import
'package:byod/helper/widget/style.dart'
;
import
'package:byod/models/filter_menu.dart'
;
...
...
@@ -11,6 +12,7 @@ import 'package:byod/models/orders.dart';
import
'package:flutter/material.dart'
;
import
'package:flutter_bloc/flutter_bloc.dart'
;
import
'package:flutter_easyloading/flutter_easyloading.dart'
;
import
'package:scrollable_positioned_list/scrollable_positioned_list.dart'
;
import
'../../bloc/filter_menu.dart'
;
import
'../../helper/widget/button_dialog.dart'
;
...
...
@@ -42,6 +44,7 @@ class _NewHome2State extends State<NewHome2> {
final
_scrollController
=
ScrollController
();
final
_scrollFavItem
=
ScrollController
();
final
_scrollMenuItem
=
ScrollController
();
final
scrollMenuItemList
=
ItemScrollController
();
late
bool
isScrollableMenu
=
false
;
// final double positionCustomScrollViewFixed = 345.5 - 10;
...
...
@@ -67,21 +70,23 @@ class _NewHome2State extends State<NewHome2> {
setState
(()
{
isFirstLoad
=
false
;
});
// double positionCustomScrollView = _scrollController.position.pixels;
// print(positionCustomScrollView);
// if (_scrollController.position.pixels >=
// (_scrollController.position.maxScrollExtent - 100)) {}
double
positionCustomScrollView
=
_scrollController
.
position
.
pixels
;
double
positionCustomScrollViewMax
=
_scrollController
.
position
.
maxScrollExtent
;
//
double positionCustomScrollView = _scrollController.position.pixels;
//
double positionCustomScrollViewMax =
//
_scrollController.position.maxScrollExtent;
// if (isSearchActive) {
if
(
positionCustomScrollView
>=
positionCustomScrollViewMax
)
{
setState
(()
{
isScrollableMenu
=
true
;
});
}
else
{
setState
(()
{
isScrollableMenu
=
false
;
});
}
// if (positionCustomScrollView >= positionCustomScrollViewMax - 50
) {
//
setState(() {
//
isScrollableMenu = true;
//
});
//
} else {
//
setState(() {
//
isScrollableMenu = false;
//
});
//
}
// } else {
// if (positionCustomScrollView >=
// positionCustomScrollViewSearchFalseFixed) {
...
...
@@ -105,39 +110,47 @@ class _NewHome2State extends State<NewHome2> {
}
}
});
_scrollMenuItem
.
addListener
(()
{
double
positionMenuItemScrollView
=
_scrollMenuItem
.
position
.
pixels
;
//
_scrollMenuItem.addListener(() {
//
double positionMenuItemScrollView = _scrollMenuItem.position.pixels;
double
positionMenuItemScrollViewMin
=
_scrollMenuItem
.
position
.
minScrollExtent
;
double
positionMenuItemScrollViewMax
=
_scrollMenuItem
.
position
.
maxScrollExtent
;
if
(
positionMenuItemScrollView
==
positionMenuItemScrollViewMin
&&
_scrollController
.
position
.
pixels
==
_scrollController
.
position
.
maxScrollExtent
)
{
setState
(()
{
isScrollableMenu
=
false
;
});
}
if
(
positionMenuItemScrollView
>=
positionMenuItemScrollViewMax
-
100
)
{
if
(
allMenu
.
length
>=
countMenuToDisplay
)
{
_getMoreData
(
countMenuToDisplay
,
allMenu
);
}
}
});
//
double positionMenuItemScrollViewMin =
//
_scrollMenuItem.position.minScrollExtent;
//
double positionMenuItemScrollViewMax =
//
_scrollMenuItem.position.maxScrollExtent;
//
if (positionMenuItemScrollView == positionMenuItemScrollViewMin &&
//
_scrollController.position.pixels ==
//
_scrollController.position.maxScrollExtent) {
//
setState(() {
//
isScrollableMenu = false;
//
});
//
}
//
if (positionMenuItemScrollView >= positionMenuItemScrollViewMax - 100) {
//
if (allMenu.length >= countMenuToDisplay) {
//
_getMoreData(countMenuToDisplay, allMenu);
//
}
//
}
//
});
super
.
initState
();
}
_getMoreData
(
int
menuToDisplay
,
List
<
FilterMenu
>
allMenu
)
{
setState
(()
{
if
((
allMenu
.
length
-
countMenuToDisplay
)
>
maxItemMenu
)
{
countMenuToDisplay
+=
maxItemMenu
;
}
else
{
countMenuToDisplay
=
allMenu
.
length
;
}
});
}
// _getMoreData(int menuToDisplay, List<FilterMenu> allMenu) {
// setState(() {
// if ((allMenu.length - countMenuToDisplay) > maxItemMenu) {
// countMenuToDisplay += maxItemMenu;
// } else {
// countMenuToDisplay = allMenu.length;
// }
// });
// }
// scrollToMenuCat(id) {
// int indexCategory = categoryNonFav.indexWhere((categoryNonFav) =>
// categoryNonFav.categoryId == id && categoryNonFav.type == typeCategory);
// if (indexCategory != -1 && isScrollableMenu) {
// scrollMenuItemList.jumpTo(index: indexCategory);
// }
// }
_getMoreDataFav
(
int
menuToDisplay
,
List
<
FilterMenu
>
allMenuFav
)
{
setState
(()
{
...
...
@@ -189,7 +202,6 @@ class _NewHome2State extends State<NewHome2> {
String
userName
=
prefs
.
getString
(
"userName"
)
??
""
;
double
widthScreen
=
responsiveWidthScreen
(
context
);
double
maxWidthScreen
=
getMaxWidthScreen
(
context
,
useResponsive
);
return
BlocBuilder
<
BranchExist
,
String
>(
builder:
(
contextBracnhExist
,
restoran
)
{
void
onTapOkPop
()
{
...
...
@@ -248,16 +260,17 @@ class _NewHome2State extends State<NewHome2> {
"id"
:
"0"
,
};
// all dulu, biar ada bisa klik all
catListTemp
.
add
(
CategoryList
.
createCategoryList
(
nn
));
categoryList
=
catListTemp
;
for
(
var
nameCat
in
categoryNonFav
)
{
if
(
nameCat
.
type
==
typeCategory
)
{
var
n
=
{
"id"
:
nameCat
.
id
,
"name"
:
nameCat
.
categoryName
};
cat
egoryList
cat
ListTemp
.
add
(
CategoryList
.
createCategoryList
(
n
));
}
categoryList
=
catListTemp
;
}
List
<
FavoriteGroup
>
favGroupTemp
=
[];
for
(
var
nameFav
in
categoryFav
)
{
...
...
@@ -271,12 +284,16 @@ class _NewHome2State extends State<NewHome2> {
}
favList
=
favGroupTemp
;
if
(
isFirstLoad
)
{
context
.
read
<
FavSelectedBar
>()
.
selectedBarFav
(
0
,
favList
[
0
].
id
);
context
.
read
<
MenuSelectedBar
>()
.
selectedBarMenu
(
0
,
categoryList
[
0
].
id
);
if
(
favList
.
isNotEmpty
)
{
context
.
read
<
FavSelectedBar
>()
.
selectedBarFav
(
0
,
favList
[
0
].
id
);
}
if
(
categoryList
.
isNotEmpty
)
{
context
.
read
<
MenuSelectedBar
>()
.
selectedBarMenu
(
0
,
categoryList
[
0
].
id
);
}
}
}
...
...
@@ -294,273 +311,204 @@ class _NewHome2State extends State<NewHome2> {
categoryFavAfterSelect
=
temporSelectedFav
;
}
return
BlocBuilder
<
MenuSelectedBar
,
List
<
dynamic
>>(
builder:
(
contextSelectedBarMenu
,
listDynamicBarMenu
)
{
if
(
categoryNonFav
.
isNotEmpty
&&
categoryList
.
isNotEmpty
)
{
List
<
FilterMenu
>
temprSelectedMenu
=
[];
for
(
var
nameCat
in
categoryNonFav
)
{
if
(
listDynamicBarMenu
.
length
==
2
&&
nameCat
.
categoryName
==
listDynamicBarMenu
[
1
])
{
temprSelectedMenu
.
add
(
nameCat
);
}
}
if
(
listDynamicBarMenu
.
length
==
2
&&
listDynamicBarMenu
[
0
]
==
0
)
{
categoryMenuAfterSelect
=
categoryNonFav
;
}
else
{
categoryMenuAfterSelect
=
temprSelectedMenu
;
}
// if (listDynamicBarMenu.length == 2 &&
// listDynamicBarMenu[1] != "0" &&
// isScrollableMenu == true &&
// _scrollController.position.pixels ==
// _scrollController
// .position.maxScrollExtent &&
// _scrollMenuItem.position.pixels > 0) {
// _scrollMenuItem.animateTo(
// 10,
// duration:
// Duration(milliseconds: animatedTime),
// curve: Curves.fastOutSlowIn,
// );
// }
}
return
BlocBuilder
<
OrdersBloc
,
List
<
Orders
>>(
builder:
(
contextOrders
,
listOrders
)
{
int
totalItem
=
0
;
int
totalHarga
=
0
;
if
(
listOrders
.
isNotEmpty
)
{
int
fixTotalHarga
=
0
;
int
totalHargaOrderDetail
=
0
;
int
totalHargaBukanOrderDetail
=
0
;
return
BlocBuilder
<
SearchMenu
,
List
<
dynamic
>>(
builder:
(
contextSearch
,
listSearch
)
{
// if (listSearch[0].isNotEmpty) {
// print(listSearch[0]);
// }
int
fixTotalItem
=
0
;
int
totalItemOrderDetail
=
0
;
int
totalItemBukanOrderDetail
=
0
;
for
(
var
i
=
0
;
i
<
listOrders
.
length
;
i
++)
{
// totalItem += listOrders[i].totalItem;
// check apakah ada order detail. kalau ada rekalkulasi total harga sesuai order detail
if
(
listOrders
[
i
].
orderDetail
.
isEmpty
)
{
totalHargaBukanOrderDetail
+=
(
listOrders
[
i
].
totalItem
*
listOrders
[
i
].
totalHarga
);
totalItemBukanOrderDetail
+=
listOrders
[
i
].
totalItem
;
return
BlocBuilder
<
MenuSelectedBar
,
List
<
dynamic
>>(
builder:
(
contextSelectedBarMenu
,
listDynamicBarMenu
)
{
if
(
isSearchActive
)
{
if
(
categoryNonFav
.
isNotEmpty
&&
categoryList
.
isNotEmpty
)
{
if
(
listSearch
[
0
].
length
==
1
&&
listSearch
[
0
][
0
].
id
==
'start'
)
{
List
<
FilterMenu
>
temprSelectedMenu
=
[];
for
(
var
nameCat
in
categoryNonFav
)
{
if
(
listDynamicBarMenu
.
length
==
2
&&
nameCat
.
categoryId
==
listDynamicBarMenu
[
1
])
{
temprSelectedMenu
.
add
(
nameCat
);
}
}
if
(
listDynamicBarMenu
.
length
==
2
&&
listDynamicBarMenu
[
0
]
==
0
)
{
categoryMenuAfterSelect
=
categoryNonFav
;
}
else
{
categoryMenuAfterSelect
=
temprSelectedMenu
;
}
}
else
{
for
(
int
kk
=
0
;
kk
<
listOrders
[
i
]
.
orderDetail
.
length
;
kk
++)
{
totalHargaOrderDetail
+=
listOrders
[
i
]
.
orderDetail
[
kk
]
.
totalHarga
;
totalItemOrderDetail
+=
listOrders
[
i
]
.
orderDetail
[
kk
]
.
totalItem
;
// for (var nameCatSearch
// in listSearch[0]) {
// if (listDynamicBarMenu.length == 2) {
// if (listDynamicBarMenu[1] != "0" &&
// nameCatSearch.categoryId ==
// listDynamicBarMenu[1]) {
// temprSearchMenu
// .add(nameCatSearch);
// }
// }
// }
if
(
listDynamicBarMenu
[
1
]
!=
"0"
)
{
List
<
FilterMenu
>
temprSearchMenu
=
[];
for
(
var
nameMenuSearch
in
listSearch
[
0
])
{
if
(
listDynamicBarMenu
[
1
]
==
nameMenuSearch
.
categoryId
)
{
temprSearchMenu
.
add
(
nameMenuSearch
);
}
}
categoryMenuAfterSelect
=
temprSearchMenu
;
}
else
{
categoryMenuAfterSelect
=
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
{
if
(
categoryNonFav
.
isNotEmpty
&&
categoryList
.
isNotEmpty
)
{
List
<
FilterMenu
>
temprSelectedMenu
=
[];
for
(
var
nameCat
in
categoryNonFav
)
{
if
(
listDynamicBarMenu
.
length
==
2
&&
nameCat
.
categoryId
==
listDynamicBarMenu
[
1
])
{
temprSelectedMenu
.
add
(
nameCat
);
}
fixTotalHarga
=
totalHargaOrderDetail
;
fixTotalItem
=
totalItemOrderDetail
;
}
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,
// );
// }
}
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'
),
),
),
Expanded
(
child:
CustomScrollView
(
controller:
_scrollController
,
slivers:
[
SliverToBoxAdapter
(
child:
SizedBox
(
height:
(
isSearchActive
)
?
spacerHeight
:
0
,
),
),
SliverToBoxAdapter
(
child:
Container
(
height:
favListHeight
,
child:
FavoriteList
(
favoriteList:
favList
,
),
),
),
const
SliverToBoxAdapter
(
child:
SizedBox
(
height:
13.5
,
),
),
SliverToBoxAdapter
(
child:
Container
(
height:
favItemHeight
,
child:
ListView
.
builder
(
controller:
_scrollFavItem
,
scrollDirection:
Axis
.
horizontal
,
itemCount:
(
categoryFavAfterSelect
.
length
)
>
countMenuFavToDisplay
?
countMenuFavToDisplay
:
categoryFavAfterSelect
.
length
,
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
,
itemBuilder:
(
context
,
i
)
{
return
MenuListUtama
(
categoryNonFav:
categoryMenuAfterSelect
,
i:
i
,
);
},
),
)),
],
),
),
],
return
BlocBuilder
<
OrdersBloc
,
List
<
Orders
>>(
builder:
(
contextOrders
,
listOrders
)
{
int
totalItem
=
0
;
int
totalHarga
=
0
;
if
(
listOrders
.
isNotEmpty
)
{
int
fixTotalHarga
=
0
;
int
totalHargaOrderDetail
=
0
;
int
totalHargaBukanOrderDetail
=
0
;
int
fixTotalItem
=
0
;
int
totalItemOrderDetail
=
0
;
int
totalItemBukanOrderDetail
=
0
;
for
(
var
i
=
0
;
i
<
listOrders
.
length
;
i
++)
{
// totalItem += listOrders[i].totalItem;
// check apakah ada order detail. kalau ada rekalkulasi total harga sesuai order detail
if
(
listOrders
[
i
]
.
orderDetail
.
isEmpty
)
{
totalHargaBukanOrderDetail
+=
(
listOrders
[
i
].
totalItem
*
listOrders
[
i
].
totalHarga
);
totalItemBukanOrderDetail
+=
listOrders
[
i
].
totalItem
;
}
else
{
for
(
int
kk
=
0
;
kk
<
listOrders
[
i
]
.
orderDetail
.
length
;
kk
++)
{
totalHargaOrderDetail
+=
listOrders
[
i
]
.
orderDetail
[
kk
]
.
totalHarga
;
totalItemOrderDetail
+=
listOrders
[
i
]
.
orderDetail
[
kk
]
.
totalItem
;
}
fixTotalHarga
=
totalHargaOrderDetail
;
fixTotalItem
=
totalItemOrderDetail
;
}
}
totalHarga
=
fixTotalHarga
+
totalHargaBukanOrderDetail
;
totalItem
=
fixTotalItem
+
totalItemBukanOrderDetail
;
}
return
ScreenResponsive
(
widget:
coreHome
(
context
,
widthScreen
,
maxWidthScreen
,
paddingLeftRight
,
appBarHeight
,
tableNumber
,
userName
,
searchFieldHeight
,
spacerHeight
,
favListHeight
,
favItemHeight
,
spacerAboveCat
,
spacerAboveCatList
,
catListHeight
,
spacerAboveMenuItem
,
heightLeft
,
totalItem
,
listOrders
,
totalHarga
,
tableMode
,
),
),
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'
),
),
)
],
widthScreen:
MediaQuery
.
of
(
context
).
size
.
width
,
isCoreLayout:
true
,
);
},
);
},
);
...
...
@@ -596,10 +544,228 @@ class _NewHome2State extends State<NewHome2> {
);
}
SizedBox
searchField
(
double
searchFieldHeight
)
{
return
SizedBox
(
Stack
coreHome
(
BuildContext
context
,
double
widthScreen
,
double
maxWidthScreen
,
double
paddingLeftRight
,
double
appBarHeight
,
String
tableNumber
,
String
userName
,
double
searchFieldHeight
,
double
spacerHeight
,
double
favListHeight
,
double
favItemHeight
,
double
spacerAboveCat
,
double
spacerAboveCatList
,
double
catListHeight
,
double
spacerAboveMenuItem
,
double
heightLeft
,
int
totalItem
,
List
<
Orders
>
listOrders
,
int
totalHarga
,
int
tableMode
)
{
return
Stack
(
children:
[
Container
(
width:
widthScreen
,
height:
MediaQuery
.
of
(
context
).
size
.
height
,
padding:
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
,
categoryNonFav
,
)
:
const
SizedBox
(
key:
Key
(
'SearchField'
),
),
),
Expanded
(
child:
CustomScrollView
(
controller:
_scrollController
,
slivers:
[
SliverToBoxAdapter
(
child:
SizedBox
(
height:
(
isSearchActive
)
?
spacerHeight
:
0
,
),
),
SliverToBoxAdapter
(
child:
(
favList
.
isNotEmpty
)
?
Container
(
height:
favListHeight
,
child:
FavoriteList
(
favoriteList:
favList
,
),
)
:
const
SizedBox
(),
),
SliverToBoxAdapter
(
child:
SizedBox
(
height:
(
categoryFavAfterSelect
.
isNotEmpty
)
?
13.5
:
0
,
),
),
SliverToBoxAdapter
(
child:
(
categoryFavAfterSelect
.
isNotEmpty
)
?
Container
(
height:
favItemHeight
,
child:
ListView
.
builder
(
controller:
_scrollFavItem
,
scrollDirection:
Axis
.
horizontal
,
itemCount:
(
categoryFavAfterSelect
.
length
)
>
countMenuFavToDisplay
?
countMenuFavToDisplay
:
categoryFavAfterSelect
.
length
,
itemBuilder:
(
context
,
i
)
{
double
paddingLeftRigthGrid
=
9
;
double
widthGrid
=
136
;
return
FavGridMenu
(
categoryFavAfterSelect:
categoryFavAfterSelect
,
widthGrid:
widthGrid
,
paddingLeftRigthGrid:
paddingLeftRigthGrid
,
i:
i
,
);
},
),
)
:
const
SizedBox
(),
),
SliverToBoxAdapter
(
child:
SizedBox
(
height:
(
categoryFavAfterSelect
.
isNotEmpty
)
?
spacerAboveCat
:
0
,
),
),
SliverToBoxAdapter
(
child:
(
categoryFavAfterSelect
.
isNotEmpty
)
?
defaultText
(
context
,
'Category'
,
style:
categoryStyle
(),
)
:
const
SizedBox
(),
),
SliverToBoxAdapter
(
child:
SizedBox
(
height:
(
categoryFavAfterSelect
.
isNotEmpty
)
?
spacerAboveCatList
:
0
,
),
),
SliverPersistentHeader
(
pinned:
true
,
delegate:
Delegate
(
catListHeight
,
categoryList
,
_scrollController
,
favList
,
),
),
SliverToBoxAdapter
(
child:
SizedBox
(
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
(
delegate:
SliverChildBuilderDelegate
(
(
context
,
index
)
{
return
MenuListUtama
(
categoryNonFav:
categoryMenuAfterSelect
,
i:
index
,
widthScreen:
widthScreen
,
scrollController:
_scrollController
,
);
},
childCount:
categoryMenuAfterSelect
.
length
,
),
),
],
),
),
],
),
),
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'
),
),
)
],
);
}
Container
searchField
(
double
searchFieldHeight
,
List
<
FilterMenu
>
categoryNonFav
)
{
return
Container
(
margin:
const
EdgeInsets
.
only
(
bottom:
5
),
height:
searchFieldHeight
,
child:
TextField
(
onChanged:
(
sarchValue
)
{
context
.
read
<
SearchMenu
>().
searchMenu
(
categoryNonFav
,
keyword:
sarchValue
.
toString
(),
isSearch:
true
,
);
},
key:
const
Key
(
'SearchField'
),
style:
TextStyle
(
color:
Colors
.
black
,
...
...
@@ -607,6 +773,8 @@ class _NewHome2State extends State<NewHome2> {
fontSize:
15
,
),
decoration:
InputDecoration
(
filled:
true
,
fillColor:
Colors
.
white
,
enabledBorder:
OutlineInputBorder
(
borderSide:
BorderSide
(
width:
1
,
...
...
@@ -857,159 +1025,6 @@ class _NewHome2State extends State<NewHome2> {
);
}
// Container girdFavItem(
// List<FilterMenu> favListItem,
// int i,
// double widthGrid,
// double paddingLeftRigthGrid,
// BuildContext context,
// ) {
// bool addCondition = true;
// return Container(
// margin: EdgeInsets.only(
// left: (i == 0) ? 0 : 8, // paling awal gausah dikasih margin
// right: (i == favListItem.length - 1)
// ? 0
// : 8, // paling akhir gausah dikasi margin
// ),
// decoration: BoxDecoration(
// borderRadius: BorderRadius.circular(5),
// color: gridCardBackgroundColor,
// ),
// height: double.infinity,
// width: widthGrid,
// child: Container(
// margin: EdgeInsets.only(
// top: 8,
// left: paddingLeftRigthGrid,
// right: paddingLeftRigthGrid,
// bottom: 16,
// ),
// // color: Colors.red,
// child: Column(
// children: [
// Container(
// width: widthGrid - (2 * paddingLeftRigthGrid),
// height: widthGrid - (2 * paddingLeftRigthGrid),
// decoration: BoxDecoration(
// borderRadius: BorderRadius.circular(8),
// // color: Colors.red,
// ),
// child: ClipRRect(
// borderRadius: BorderRadius.circular(8),
// child: Image(
// fit: BoxFit.fill,
// image: NetworkImage(favListItem[i].imageUrlMedium),
// ),
// ),
// ),
// const SizedBox(
// height: 3,
// ),
// Container(
// width: widthGrid - (2 * paddingLeftRigthGrid),
// height: 28,
// // color: Colors.blue,
// child: Row(
// crossAxisAlignment: CrossAxisAlignment.end,
// children: [
// Expanded(
// child: defaultText(
// context,
// favListItem[i].name,
// maxLines: 2,
// overFlow: TextOverflow.ellipsis,
// style: menuNameGridFav(),
// ),
// ),
// Container(
// width: 40,
// child: defaultText(
// context,
// 'Rp ${formatNumber().format(amountParseToInt(favListItem[i].price))}',
// maxLines: 3,
// overFlow: TextOverflow.ellipsis,
// style: menuPriceGridFav(),
// ),
// )
// ],
// ),
// ),
// const SizedBox(
// height: 16,
// ),
// (addCondition)
// ? Container(
// height: 30,
// width: widthGrid - (2 * paddingLeftRigthGrid),
// decoration: BoxDecoration(
// borderRadius: BorderRadius.circular(6),
// color: buttonColor,
// ),
// child: Center(
// child: defaultText(
// context,
// 'Tambah',
// style: addButtonGridFav(),
// ),
// ),
// )
// : Container(
// height: 30,
// width: widthGrid - (2 * paddingLeftRigthGrid),
// child: Row(
// children: [
// 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,
// ),
// Container(
// width: 22,
// height: 22,
// child: const Image(
// image: AssetImage('assets/icons/minus.png'),
// ),
// ),
// Expanded(
// child: Center(
// child: defaultText(
// context,
// '10',
// style: amountGridFav(),
// ),
// ),
// ),
// Container(
// width: 22,
// height: 22,
// child: const Image(
// image: AssetImage('assets/icons/plus.png'),
// ),
// )
// ],
// ),
// )
// ],
// ),
// ),
// );
// }
Container
customAppBar
(
BuildContext
context
,
double
paddingLeftRight
,
double
appBarHeight
,
String
tableNumber
,
String
userName
)
{
String
barName
;
...
...
@@ -1019,8 +1034,6 @@ class _NewHome2State extends State<NewHome2> {
barName
=
"Meja
$tableNumber
"
;
}
return
Container
(
// color: Colors.red,
margin:
EdgeInsets
.
symmetric
(
horizontal:
paddingLeftRight
),
height:
appBarHeight
,
child:
Row
(
children:
[
...
...
@@ -1115,15 +1128,28 @@ class _NewHome2State extends State<NewHome2> {
class
Delegate
extends
SliverPersistentHeaderDelegate
{
final
double
catListHeight
;
final
ScrollController
scrollController
;
// final ScrollController scrollControllerMenu;
final
List
<
CategoryList
>
categoryList
;
Delegate
(
this
.
catListHeight
,
this
.
categoryList
);
final
List
<
FavoriteGroup
>
favList
;
Delegate
(
this
.
catListHeight
,
this
.
categoryList
,
this
.
scrollController
,
this
.
favList
,
// this.scrollControllerMenu,
);
@override
Widget
build
(
BuildContext
context
,
double
shrinkOffset
,
bool
overlapsContent
)
{
return
Container
(
color:
backgroundColor
,
height:
catListHeight
,
child:
CategoryListHome
(
categoryList:
categoryList
,
scrollController:
scrollController
,
favList:
favList
,
// scrollControllerMenu: scrollControllerMenu,
),
);
}
...
...
pubspec.lock
View file @
fabd3fc0
...
...
@@ -261,6 +261,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "6.0.3"
scrollable_positioned_list:
dependency: "direct main"
description:
name: scrollable_positioned_list
url: "https://pub.dartlang.org"
source: hosted
version: "0.3.4"
shared_preferences:
dependency: "direct main"
description:
...
...
pubspec.yaml
View file @
fabd3fc0
...
...
@@ -34,6 +34,7 @@ dependencies:
http
:
^0.13.4
intl
:
^0.17.0
loading_animations
:
^2.2.0
scrollable_positioned_list
:
^0.3.4
shared_preferences
:
^2.0.15
shimmer
:
^2.0.0
url_launcher
:
^6.1.5
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment