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
400dfcbf
Commit
400dfcbf
authored
Oct 19, 2022
by
Jasa Digital
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed bug di halaman confirmation gabisa refresh
parent
ab387a28
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
817 additions
and
441 deletions
+817
-441
order_bloc.dart
lib/bloc/order_bloc.dart
+5
-2
note_modal_bottom_sheet.dart
lib/helper/widget/note_modal_bottom_sheet.dart
+34
-4
confirm_order.dart
lib/ui/confirm_order/confirm_order.dart
+775
-432
fav_grid_menu.dart
lib/ui/home/fav_grid_menu.dart
+1
-1
menu_list_utama.dart
lib/ui/home/menu_list_utama.dart
+1
-1
order_view_bill_new.dart
lib/ui/viewbill/order_view_bill_new.dart
+1
-1
No files found.
lib/bloc/order_bloc.dart
View file @
400dfcbf
...
...
@@ -9,6 +9,7 @@ class OrdersBloc extends Cubit<List<Orders>> {
if
(
json
[
'action'
]
==
'editVariant'
)
{
// hanya ketika bottom sheet muncul untuk order yang mempunyai variant
// Orders singleOrder = list[0][1];
List
<
Orders
>
newResult
=
[];
List
<
Orders
>
listOrders
=
json
[
'list_orders'
];
OrderDetail
singleOrderDetail
=
json
[
'single_order_detail'
];
...
...
@@ -27,14 +28,16 @@ class OrdersBloc extends Cubit<List<Orders>> {
singleOrderDetail
.
totalItem
;
listOrders
[
indexListOrder
].
orderDetail
[
indexListOrderDetail
].
totalHarga
=
singleOrderDetail
.
totalHarga
;
listOrders
[
indexListOrder
].
orderDetail
[
indexListOrderDetail
].
note
=
singleOrderDetail
.
note
;
if
(
singleOrderDetail
.
totalItem
==
0
)
{
listOrders
[
indexListOrder
].
orderDetail
.
removeAt
(
indexListOrderDetail
);
if
(
listOrders
[
indexListOrder
].
orderDetail
.
isEmpty
)
{
listOrders
.
removeAt
(
indexListOrder
);
}
}
emit
(
listOrders
);
newResult
=
listOrders
;
emit
(
newResult
);
}
else
{
var
listOrderOld
=
json
[
'old_order'
];
// orderan lama
List
<
Orders
>
orders
=
[];
...
...
lib/helper/widget/note_modal_bottom_sheet.dart
View file @
400dfcbf
// ignore_for_file: must_be_immutable
import
'package:byod/helper/widget/style.dart'
;
import
'package:byod/models/order_details.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter_bloc/flutter_bloc.dart'
;
...
...
@@ -19,7 +20,7 @@ class NoteModalBottomSheet extends StatelessWidget {
required
this
.
initialValue
,
required
this
.
orderVariants
,
required
this
.
menuItem
,
required
this
.
lis
r
Orders
,
required
this
.
lis
t
Orders
,
required
this
.
from
,
this
.
idOrderan
=
''
,
this
.
noteInit
=
''
,
...
...
@@ -27,15 +28,19 @@ class NoteModalBottomSheet extends StatelessWidget {
this
.
menuName
=
''
,
this
.
imageUrl
=
''
,
this
.
priceMemu
=
0
,
this
.
editVariantConfirmationPage
=
false
,
required
this
.
contextFrom
,
this
.
indexOrder
=
0
,
this
.
indexOrderDetail
=
0
,
})
:
super
(
key:
key
);
late
TextEditingController
noteController
;
final
int
initialValue
;
final
List
<
OrderVariant
>
orderVariants
;
final
FilterMenu
menuItem
;
final
List
<
Orders
>
lis
r
Orders
;
final
List
<
Orders
>
lis
t
Orders
;
final
String
from
;
final
bool
editVariantConfirmationPage
;
final
String
idOrderan
;
final
String
noteInit
;
final
BuildContext
contextFrom
;
...
...
@@ -43,6 +48,8 @@ class NoteModalBottomSheet extends StatelessWidget {
final
String
menuName
;
final
String
imageUrl
;
final
int
priceMemu
;
final
int
indexOrder
;
final
int
indexOrderDetail
;
@override
Widget
build
(
BuildContext
context
)
{
...
...
@@ -99,7 +106,7 @@ class NoteModalBottomSheet extends StatelessWidget {
'menu_name'
:
menuItem
.
name
,
'initvalue'
:
initialValue
,
'menu_price'
:
amountParseToInt
(
menuItem
.
price
),
'old_order'
:
lis
r
Orders
,
'old_order'
:
lis
t
Orders
,
'image_url'
:
menuItem
.
imageUrlMedium
,
'total_price'
:
amountParseToInt
(
menuItem
.
price
),
'order_variant'
:
orderVariants
,
...
...
@@ -117,13 +124,36 @@ class NoteModalBottomSheet extends StatelessWidget {
context
.
read
<
ViewBillBloc
>().
getBill
();
});
}
}
else
if
(
from
==
fromConfirmationPage
&&
editVariantConfirmationPage
)
{
OrderDetail
orderDetailNow
=
OrderDetail
(
allIdVariant:
listOrders
[
indexOrder
]
.
orderDetail
[
indexOrderDetail
]
.
allIdVariant
,
totalItem:
listOrders
[
indexOrder
]
.
orderDetail
[
indexOrderDetail
]
.
totalItem
,
totalHarga:
listOrders
[
indexOrder
]
.
orderDetail
[
indexOrderDetail
]
.
totalHarga
,
note:
noteController
.
text
,
orderVariant:
listOrders
[
indexOrder
]
.
orderDetail
[
indexOrderDetail
]
.
orderVariant
,
);
Map
<
String
,
dynamic
>
insertData
=
{
'action'
:
'editVariant'
,
'list_orders'
:
listOrders
,
'single_order_detail'
:
orderDetailNow
,
};
context
.
read
<
OrdersBloc
>().
insertData
(
insertData
);
}
else
if
(
from
==
fromConfirmationPage
)
{
Map
<
String
,
dynamic
>
insertData
=
{
'menu_id'
:
idMenu
,
'menu_name'
:
menuName
,
'initvalue'
:
initialValue
,
'menu_price'
:
priceMemu
,
'old_order'
:
lis
r
Orders
,
'old_order'
:
lis
t
Orders
,
'image_url'
:
menuItem
.
imageUrlMedium
,
'total_price'
:
priceMemu
,
'order_variant'
:
orderVariants
,
...
...
lib/ui/confirm_order/confirm_order.dart
View file @
400dfcbf
// ignore_for_file: sized_box_for_whitespace
import
'package:byod/helper/helper.dart'
;
import
'package:byod/helper/widget/plus_minus_button.dart'
;
import
'package:byod/helper/widget/style.dart'
;
import
'package:byod/ui/screen_responsive.dart'
;
import
'package:flutter/material.dart'
;
...
...
@@ -46,7 +45,7 @@ class CoreConfirm extends StatelessWidget {
double
widthRowForNote
=
MediaQuery
.
of
(
context
).
size
.
width
-
20
-
12
-
80
-
20
;
return
BlocBuilder
<
OrdersBloc
,
List
<
Orders
>>(
builder:
(
c
ontext
,
listOrders
)
{
builder:
(
c
tx
,
listOrders
)
{
int
totalHarga
=
0
;
List
indexTidakAdaVariant
=
[];
List
indexAdaVariant
=
[];
...
...
@@ -128,14 +127,11 @@ class CoreConfirm extends StatelessWidget {
height:
24
,
),
for
(
var
i
in
indexAdaVariant
)
Container
(
child:
listWithVariant
(
listOrders
,
i
,
context
,
indexAdaVariant
,
widthRowForNote
,
),
VariantOrder
(
i:
i
,
indexAdaVariant:
indexAdaVariant
,
widthRowForNote:
widthRowForNote
,
listOrders:
listOrders
,
),
for
(
int
j
in
indexTidakAdaVariant
)
Column
(
...
...
@@ -217,72 +213,6 @@ class CoreConfirm extends StatelessWidget {
),
)
:
const
SizedBox
(),
// (listOrders[i]
// .orderDetail
// .isNotEmpty)
// ? defaultText(
// context,
// 'Variant : ',
// maxLines: 2,
// overFlow:
// TextOverflow.ellipsis,
// style: viewbillStyle(
// font: 12,
// fontWeight:
// FontWeight.w300,
// ),
// )
// : const SizedBox(),
// if (listOrders[i]
// .orderDetail
// .isNotEmpty)
// for (int a = 0;
// a < variantCaption.length;
// a++)
// if (variantCaption[a] != '')
// // defaultText(
// // context,
// // listOrders[i]
// // .orderDetail[0]
// // .orderVariant[a]
// // .name,
// // maxLines: 2,
// // overFlow:
// // TextOverflow.ellipsis,
// // style: viewbillStyle(
// // font: 12,
// // fontWeight:
// // FontWeight.w300,
// // ),
// // ),
// Row(
// children: [
// defaultText(
// context,
// "${variantCaption[a]} : ",
// maxLines: 2,
// overFlow:
// TextOverflow.ellipsis,
// style: viewbillStyle(
// font: 12,
// fontWeight:
// FontWeight.w300,
// ),
// ),
// defaultText(
// context,
// variantName[a],
// maxLines: 2,
// overFlow:
// TextOverflow.ellipsis,
// style: viewbillStyle(
// font: 12,
// fontWeight:
// FontWeight.w300,
// ),
// ),
// ],
// )
],
)
],
...
...
@@ -318,7 +248,7 @@ class CoreConfirm extends StatelessWidget {
noteController:
noteController
,
initialValue:
listOrders
[
j
].
totalItem
,
orderVariants:
[],
orderVariants:
const
[],
menuItem:
FilterMenu
(
id:
''
,
name:
''
,
...
...
@@ -334,7 +264,7 @@ class CoreConfirm extends StatelessWidget {
groupName:
''
,
groupId:
''
,
),
lis
r
Orders:
listOrders
,
lis
t
Orders:
listOrders
,
from:
fromConfirmationPage
,
contextFrom:
context
,
idMenu:
listOrders
[
j
].
id
,
...
...
@@ -758,141 +688,175 @@ class CoreConfirm extends StatelessWidget {
},
);
}
}
class
VariantOrder
extends
StatefulWidget
{
VariantOrder
({
Key
?
key
,
required
this
.
i
,
required
this
.
indexAdaVariant
,
required
this
.
widthRowForNote
,
required
this
.
listOrders
,
})
:
super
(
key:
key
);
var
i
;
final
List
indexAdaVariant
;
final
double
widthRowForNote
;
final
List
<
Orders
>
listOrders
;
Column
listWithVariant
(
List
<
Orders
>
listOrders
,
i
,
BuildContext
context
,
List
<
dynamic
>
indexAdaVariant
,
double
widthRowForNote
,
)
{
@override
State
<
VariantOrder
>
createState
()
=>
_VariantOrderState
();
}
class
_VariantOrderState
extends
State
<
VariantOrder
>
{
@override
Widget
build
(
BuildContext
context
)
{
// dippecah lagi masing2 indexnya
int
indexOrder
=
int
.
parse
(
i
.
split
(
'|'
)[
0
]);
int
indexOrderDetail
=
int
.
parse
(
i
.
split
(
'|'
)[
1
]);
int
indexOrder
=
int
.
parse
(
widget
.
i
.
split
(
'|'
)[
0
]);
int
indexOrderDetail
=
int
.
parse
(
widget
.
i
.
split
(
'|'
)[
1
]);
List
<
String
>
variantCaption
=
[];
List
<
String
>
variantName
=
[];
if
(
listOrders
[
indexOrder
].
orderDetail
.
isNotEmpty
)
{
if
(
widget
.
listOrders
[
indexOrder
].
orderDetail
.
isNotEmpty
)
{
for
(
int
y
=
0
;
y
<
listOrders
[
indexOrder
]
.
orderDetail
[
indexOrderDetail
]
.
orderVariant
.
length
;
widget
.
listOrders
[
indexOrder
].
orderDetail
[
indexOrderDetail
]
.
orderVariant
.
length
;
y
++)
{
int
indexCaption
=
variantCaption
.
indexWhere
((
element
)
=>
element
==
listOrders
[
indexOrder
]
.
orderDetail
[
indexOrderDetail
]
.
orderVariant
[
y
]
.
caption
);
widget
.
listOrders
[
indexOrder
].
orderDetail
[
indexOrderDetail
]
.
orderVariant
[
y
].
caption
);
if
(
indexCaption
==
-
1
)
{
variantCaption
.
add
(
listOrders
[
indexOrder
]
.
orderDetail
[
indexOrderDetail
]
.
orderVariant
[
y
]
.
caption
);
variantName
.
add
(
listOrders
[
indexOrder
]
.
orderDetail
[
indexOrderDetail
]
.
orderVariant
[
y
]
.
name
);
variantCaption
.
add
(
widget
.
listOrders
[
indexOrder
]
.
orderDetail
[
indexOrderDetail
].
orderVariant
[
y
].
caption
);
variantName
.
add
(
widget
.
listOrders
[
indexOrder
]
.
orderDetail
[
indexOrderDetail
].
orderVariant
[
y
].
name
);
}
else
{
variantName
[
indexCaption
]
+=
",
${listOrders[indexOrder].orderDetail[indexOrderDetail].orderVariant[y].name}
"
;
",
${
widget.
listOrders[indexOrder].orderDetail[indexOrderDetail].orderVariant[y].name}
"
;
}
}
}
return
Column
(
children:
[
Container
(
width:
double
.
infinity
,
padding:
const
EdgeInsets
.
symmetric
(
horizontal:
paddingLeftRight
,
vertical:
16
,
),
color:
backgroundWhite
,
child:
Row
(
crossAxisAlignment:
CrossAxisAlignment
.
center
,
mainAxisAlignment:
MainAxisAlignment
.
start
,
children:
[
(
listOrders
[
indexOrder
].
imageUrl
!=
''
)
?
Image
(
width:
80
,
height:
80
,
fit:
BoxFit
.
fill
,
image:
NetworkImage
(
listOrders
[
indexOrder
].
imageUrl
),
)
:
const
Image
(
width:
80
,
height:
80
,
fit:
BoxFit
.
fill
,
image:
AssetImage
(
'assets/noimage.png'
),
return
Container
(
// child: listWithVariant(
// listOrders,
// i,
// context,
// indexAdaVariant,
// widthRowForNote,
// ),
child:
Column
(
children:
[
Container
(
width:
double
.
infinity
,
padding:
const
EdgeInsets
.
symmetric
(
horizontal:
paddingLeftRight
,
vertical:
16
,
),
color:
backgroundWhite
,
child:
Row
(
crossAxisAlignment:
CrossAxisAlignment
.
center
,
mainAxisAlignment:
MainAxisAlignment
.
start
,
children:
[
(
widget
.
listOrders
[
indexOrder
].
imageUrl
!=
''
)
?
Image
(
width:
80
,
height:
80
,
fit:
BoxFit
.
fill
,
image:
NetworkImage
(
widget
.
listOrders
[
indexOrder
].
imageUrl
),
)
:
const
Image
(
width:
80
,
height:
80
,
fit:
BoxFit
.
fill
,
image:
AssetImage
(
'assets/noimage.png'
),
),
const
SizedBox
(
width:
12
,
),
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
mainAxisAlignment:
MainAxisAlignment
.
center
,
children:
[
Container
(
width:
widget
.
widthRowForNote
,
child:
defaultText
(
context
,
widget
.
listOrders
[
indexOrder
].
namaMenu
,
// maxLines: 2,
// overFlow: TextOverflow.ellipsis,
style:
menuNameListViewBill
(),
),
),
const
SizedBox
(
width:
12
,
),
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
mainAxisAlignment:
MainAxisAlignment
.
center
,
children:
[
Container
(
width:
widthRowForNote
,
child:
defaultText
(
const
SizedBox
(
height:
6
,
),
defaultText
(
context
,
listOrders
[
indexOrder
].
namaMenu
,
// maxLines: 2,
// overFlow: TextOverflow.ellipsis,
style:
menuNameListViewBill
(),
'
${widget.listOrders[indexOrder].orderDetail[indexOrderDetail].totalItem}
X Rp
${formatNumber().format(widget.listOrders[indexOrder].satuanHarga)}
'
,
style:
viewbillStyle
(
font:
12
,
fontWeight:
FontWeight
.
w300
,
),
),
),
const
SizedBox
(
height:
6
,
),
defaultText
(
context
,
'
${listOrders[indexOrder].orderDetail[indexOrderDetail].totalItem}
X Rp
${formatNumber().format(listOrders[indexOrder].satuanHarga)}
'
,
style:
viewbillStyle
(
font:
12
,
fontWeight:
FontWeight
.
w300
,
const
SizedBox
(
height:
6
,
),
),
const
SizedBox
(
height:
6
,
),
for
(
int
a
=
0
;
a
<
variantCaption
.
length
;
a
++)
if
(
variantCaption
[
a
]
!=
''
)
// defaultText(
// context,
// listOrders[i]
// .orderDetail[0]
// .orderVariant[a]
// .name,
// maxLines: 2,
// overFlow:
// TextOverflow.ellipsis,
// style: viewbillStyle(
// font: 12,
// fontWeight:
// FontWeight.w300,
// ),
// ),
Container
(
width:
widthRowForNote
,
child:
Row
(
children:
[
defaultText
(
context
,
"
${variantCaption[a]}
: "
,
// maxLines: 2,
// overFlow: TextOverflow.ellipsis,
style:
viewbillStyle
(
font:
12
,
fontWeight:
FontWeight
.
w300
,
for
(
int
a
=
0
;
a
<
variantCaption
.
length
;
a
++)
if
(
variantCaption
[
a
]
!=
''
)
// defaultText(
// context,
// listOrders[i]
// .orderDetail[0]
// .orderVariant[a]
// .name,
// maxLines: 2,
// overFlow:
// TextOverflow.ellipsis,
// style: viewbillStyle(
// font: 12,
// fontWeight:
// FontWeight.w300,
// ),
// ),
Container
(
width:
widget
.
widthRowForNote
,
child:
Row
(
children:
[
defaultText
(
context
,
"
${variantCaption[a]}
: "
,
// maxLines: 2,
// overFlow: TextOverflow.ellipsis,
style:
viewbillStyle
(
font:
12
,
fontWeight:
FontWeight
.
w300
,
),
),
),
defaultText
(
defaultText
(
context
,
variantName
[
a
],
// maxLines: 2,
// overFlow: TextOverflow.ellipsis,
style:
viewbillStyle
(
font:
12
,
fontWeight:
FontWeight
.
w300
,
),
),
],
),
),
(
widget
.
listOrders
[
indexOrder
].
orderDetail
[
indexOrderDetail
]
.
note
!=
''
)
?
Container
(
width:
widget
.
widthRowForNote
,
child:
defaultText
(
context
,
variantName
[
a
]
,
"Catatan:
${widget.listOrders[indexOrder].orderDetail[indexOrderDetail].note}
"
,
// maxLines: 2,
// overFlow: TextOverflow.ellipsis,
style:
viewbillStyle
(
...
...
@@ -900,269 +864,648 @@ class CoreConfirm extends StatelessWidget {
fontWeight:
FontWeight
.
w300
,
),
),
],
),
),
(
listOrders
[
indexOrder
].
orderDetail
[
indexOrderDetail
].
note
!=
''
)
?
Container
(
width:
widthRowForNote
,
child:
defaultText
(
context
,
"Catatan:
${listOrders[indexOrder].orderDetail[indexOrderDetail].note}
"
,
// maxLines: 2,
// overFlow: TextOverflow.ellipsis,
style:
viewbillStyle
(
font:
12
,
fontWeight:
FontWeight
.
w300
,
),
),
)
:
const
SizedBox
(),
],
)
],
),
),
Container
(
width:
double
.
infinity
,
color:
backgroundWhite
,
padding:
const
EdgeInsets
.
only
(
left:
paddingLeftRight
,
right:
paddingLeftRight
,
bottom:
10
,
)
:
const
SizedBox
(),
],
)
],
),
),
child:
Row
(
children:
[
GestureDetector
(
onTap:
()
{
final
noteController
=
TextEditingController
(
text:
listOrders
[
indexOrder
]
.
orderDetail
[
indexOrderDetail
]
.
note
);
FocusScopeNode
currentFocus
=
FocusScope
.
of
(
context
);
Container
(
width:
double
.
infinity
,
color:
backgroundWhite
,
padding:
const
EdgeInsets
.
only
(
left:
paddingLeftRight
,
right:
paddingLeftRight
,
bottom:
10
,
),
child:
Row
(
children:
[
GestureDetector
(
onTap:
()
{
final
noteController
=
TextEditingController
(
text:
widget
.
listOrders
[
indexOrder
]
.
orderDetail
[
indexOrderDetail
].
note
);
FocusScopeNode
currentFocus
=
FocusScope
.
of
(
context
);
if
(!
currentFocus
.
hasPrimaryFocus
)
{
currentFocus
.
unfocus
();
}
showModalBottomSheet
(
backgroundColor:
backgroundColor
,
isScrollControlled:
true
,
context:
context
,
builder:
(
context
)
{
return
NoteModalBottomSheet
(
noteController:
noteController
,
initialValue:
listOrders
[
indexOrder
].
totalItem
,
orderVariants:
const
[],
menuItem:
FilterMenu
(
id:
''
,
name:
''
,
price:
''
,
originalPrice:
''
,
imageUrlMedium:
''
,
imageUrlThumbnail:
''
,
isSell:
false
,
type:
1
,
categoryName:
''
,
categoryId:
''
,
description:
''
,
groupName:
''
,
groupId:
''
,
if
(!
currentFocus
.
hasPrimaryFocus
)
{
currentFocus
.
unfocus
();
}
showModalBottomSheet
(
backgroundColor:
backgroundColor
,
isScrollControlled:
true
,
context:
context
,
builder:
(
context
)
{
return
NoteModalBottomSheet
(
noteController:
noteController
,
initialValue:
widget
.
listOrders
[
indexOrder
].
totalItem
,
orderVariants:
const
[],
menuItem:
FilterMenu
(
id:
''
,
name:
''
,
price:
''
,
originalPrice:
''
,
imageUrlMedium:
''
,
imageUrlThumbnail:
''
,
isSell:
false
,
type:
1
,
categoryName:
''
,
categoryId:
''
,
description:
''
,
groupName:
''
,
groupId:
''
,
),
listOrders:
widget
.
listOrders
,
from:
fromConfirmationPage
,
contextFrom:
context
,
idMenu:
widget
.
listOrders
[
indexOrder
].
id
,
menuName:
widget
.
listOrders
[
indexOrder
].
namaMenu
,
priceMemu:
widget
.
listOrders
[
indexOrder
].
satuanHarga
,
imageUrl:
widget
.
listOrders
[
indexOrder
].
imageUrl
,
editVariantConfirmationPage:
true
,
indexOrder:
indexOrder
,
indexOrderDetail:
indexOrderDetail
,
);
},
);
},
child:
Container
(
height:
30
,
width:
98
,
decoration:
BoxDecoration
(
borderRadius:
BorderRadius
.
circular
(
21
),
color:
buttonColor
),
child:
Row
(
mainAxisAlignment:
MainAxisAlignment
.
center
,
crossAxisAlignment:
CrossAxisAlignment
.
center
,
children:
[
const
Image
(
height:
16
,
width:
16
,
image:
AssetImage
(
'assets/icons/note.png'
),
),
lisrOrders:
listOrders
,
from:
fromConfirmationPage
,
contextFrom:
context
,
idMenu:
listOrders
[
indexOrder
].
id
,
menuName:
listOrders
[
indexOrder
].
namaMenu
,
priceMemu:
listOrders
[
indexOrder
].
satuanHarga
,
imageUrl:
listOrders
[
indexOrder
].
imageUrl
,
);
},
);
},
child:
Container
(
height:
30
,
width:
98
,
decoration:
BoxDecoration
(
borderRadius:
BorderRadius
.
circular
(
21
),
color:
buttonColor
),
child:
Row
(
mainAxisAlignment:
MainAxisAlignment
.
center
,
crossAxisAlignment:
CrossAxisAlignment
.
center
,
children:
[
const
Image
(
height:
16
,
width:
16
,
image:
AssetImage
(
'assets/icons/note.png'
),
),
const
SizedBox
(
width:
10
,
),
Container
(
height:
16
,
child:
Center
(
child:
defaultText
(
context
,
(
listOrders
[
indexOrder
].
note
!=
''
)
?
'Ubah'
:
'Catatan'
,
style:
noteViewBill
(
color:
textInButton
,
const
SizedBox
(
width:
10
,
),
Container
(
height:
16
,
child:
Center
(
child:
defaultText
(
context
,
(
widget
.
listOrders
[
indexOrder
].
note
!=
''
)
?
'Ubah'
:
'Catatan'
,
style:
noteViewBill
(
color:
textInButton
,
),
),
),
)
,
)
]
,
)
],
)
,
),
),
),
const
Spacer
(),
Stack
(
children:
[
Container
(
width:
94
,
height:
22
,
decoration:
BoxDecoration
(
borderRadius:
BorderRadius
.
circular
(
30
),
color:
backgroundColor
,
),
child:
Center
(
child:
defaultText
(
context
,
listOrders
[
indexOrder
]
.
orderDetail
[
indexOrderDetail
]
.
totalItem
.
toString
(),
style:
amountViewBillButton
(),
const
Spacer
(),
Stack
(
children:
[
Container
(
width:
94
,
height:
22
,
decoration:
BoxDecoration
(
borderRadius:
BorderRadius
.
circular
(
30
),
color:
backgroundColor
,
),
child:
Center
(
child:
defaultText
(
context
,
widget
.
listOrders
[
indexOrder
]
.
orderDetail
[
indexOrderDetail
].
totalItem
.
toString
(),
style:
amountViewBillButton
(),
),
),
),
),
Positioned
(
left:
0
,
child:
GestureDetector
(
onTap:
()
{
FocusScopeNode
currentFocus
=
FocusScope
.
of
(
context
);
Positioned
(
left:
0
,
child:
GestureDetector
(
onTap:
()
{
FocusScopeNode
currentFocus
=
FocusScope
.
of
(
context
);
if
(!
currentFocus
.
hasPrimaryFocus
)
{
currentFocus
.
unfocus
();
}
int
totalHarga
=
listOrders
[
indexOrder
]
.
orderDetail
[
indexOrderDetail
]
.
totalHarga
.
toInt
();
int
totalItem
=
listOrders
[
indexOrder
]
.
orderDetail
[
indexOrderDetail
]
.
totalItem
.
toInt
();
int
satuanHarga
=
totalHarga
~/
totalItem
;
OrderDetail
orderDetailNow
=
OrderDetail
(
allIdVariant:
listOrders
[
indexOrder
]
.
orderDetail
[
indexOrderDetail
]
.
allIdVariant
,
totalItem:
listOrders
[
indexOrder
]
.
orderDetail
[
indexOrderDetail
]
.
totalItem
-
1
,
totalHarga:
listOrders
[
indexOrder
]
.
orderDetail
[
indexOrderDetail
]
.
totalHarga
-
satuanHarga
,
note:
listOrders
[
indexOrder
]
.
orderDetail
[
indexOrderDetail
]
.
note
,
orderVariant:
listOrders
[
indexOrder
]
.
orderDetail
[
indexOrderDetail
]
.
orderVariant
,
);
Map
<
String
,
dynamic
>
insertData
=
{
'action'
:
'editVariant'
,
'list_orders'
:
listOrders
,
'single_order_detail'
:
orderDetailNow
,
};
context
.
read
<
OrdersBloc
>().
insertData
(
insertData
);
},
child:
Container
(
width:
22
,
height:
22
,
child:
Image
(
image:
AssetImage
((
isExcelso
)
?
'assets/icons/minus-gold.png'
:
'assets/icons/minus-blue.png'
),
if
(!
currentFocus
.
hasPrimaryFocus
)
{
currentFocus
.
unfocus
();
}
int
totalHarga
=
widget
.
listOrders
[
indexOrder
]
.
orderDetail
[
indexOrderDetail
].
totalHarga
.
toInt
();
int
totalItem
=
widget
.
listOrders
[
indexOrder
]
.
orderDetail
[
indexOrderDetail
].
totalItem
.
toInt
();
int
satuanHarga
=
totalHarga
~/
totalItem
;
OrderDetail
orderDetailNow
=
OrderDetail
(
allIdVariant:
widget
.
listOrders
[
indexOrder
]
.
orderDetail
[
indexOrderDetail
].
allIdVariant
,
totalItem:
widget
.
listOrders
[
indexOrder
]
.
orderDetail
[
indexOrderDetail
].
totalItem
-
1
,
totalHarga:
widget
.
listOrders
[
indexOrder
]
.
orderDetail
[
indexOrderDetail
].
totalHarga
-
satuanHarga
,
note:
widget
.
listOrders
[
indexOrder
]
.
orderDetail
[
indexOrderDetail
].
note
,
orderVariant:
widget
.
listOrders
[
indexOrder
]
.
orderDetail
[
indexOrderDetail
].
orderVariant
,
);
Map
<
String
,
dynamic
>
insertData
=
{
'action'
:
'editVariant'
,
'list_orders'
:
widget
.
listOrders
,
'single_order_detail'
:
orderDetailNow
,
};
context
.
read
<
OrdersBloc
>().
insertData
(
insertData
);
setState
(()
{});
},
child:
Container
(
width:
22
,
height:
22
,
child:
Image
(
image:
AssetImage
((
isExcelso
)
?
'assets/icons/minus-gold.png'
:
'assets/icons/minus-blue.png'
),
),
),
),
),
),
Positioned
(
right:
0
,
child:
GestureDetector
(
onTap:
()
{
FocusScopeNode
currentFocus
=
FocusScope
.
of
(
context
);
Positioned
(
right:
0
,
child:
GestureDetector
(
onTap:
()
{
FocusScopeNode
currentFocus
=
FocusScope
.
of
(
context
);
if
(!
currentFocus
.
hasPrimaryFocus
)
{
currentFocus
.
unfocus
();
}
int
totalHarga
=
listOrders
[
indexOrder
]
.
orderDetail
[
indexOrderDetail
]
.
totalHarga
.
toInt
();
int
totalItem
=
listOrders
[
indexOrder
]
.
orderDetail
[
indexOrderDetail
]
.
totalItem
.
toInt
();
int
satuanHarga
=
totalHarga
~/
totalItem
;
OrderDetail
orderDetailNow
=
OrderDetail
(
allIdVariant:
listOrders
[
indexOrder
]
.
orderDetail
[
indexOrderDetail
]
.
allIdVariant
,
totalItem:
listOrders
[
indexOrder
]
.
orderDetail
[
indexOrderDetail
]
.
totalItem
+
1
,
totalHarga:
listOrders
[
indexOrder
]
.
orderDetail
[
indexOrderDetail
]
.
totalHarga
+
satuanHarga
,
note:
listOrders
[
indexOrder
]
.
orderDetail
[
indexOrderDetail
]
.
note
,
orderVariant:
listOrders
[
indexOrder
]
.
orderDetail
[
indexOrderDetail
]
.
orderVariant
,
);
Map
<
String
,
dynamic
>
insertData
=
{
'action'
:
'editVariant'
,
'list_orders'
:
listOrders
,
'single_order_detail'
:
orderDetailNow
,
};
context
.
read
<
OrdersBloc
>().
insertData
(
insertData
);
},
child:
Container
(
width:
22
,
height:
22
,
child:
Image
(
image:
AssetImage
((
isExcelso
)
?
'assets/icons/plus-gold.png'
:
'assets/icons/plus.png'
),
if
(!
currentFocus
.
hasPrimaryFocus
)
{
currentFocus
.
unfocus
();
}
int
totalHarga
=
widget
.
listOrders
[
indexOrder
]
.
orderDetail
[
indexOrderDetail
].
totalHarga
.
toInt
();
int
totalItem
=
widget
.
listOrders
[
indexOrder
]
.
orderDetail
[
indexOrderDetail
].
totalItem
.
toInt
();
int
satuanHarga
=
totalHarga
~/
totalItem
;
OrderDetail
orderDetailNow
=
OrderDetail
(
allIdVariant:
widget
.
listOrders
[
indexOrder
]
.
orderDetail
[
indexOrderDetail
].
allIdVariant
,
totalItem:
widget
.
listOrders
[
indexOrder
]
.
orderDetail
[
indexOrderDetail
].
totalItem
+
1
,
totalHarga:
widget
.
listOrders
[
indexOrder
]
.
orderDetail
[
indexOrderDetail
].
totalHarga
+
satuanHarga
,
note:
widget
.
listOrders
[
indexOrder
]
.
orderDetail
[
indexOrderDetail
].
note
,
orderVariant:
widget
.
listOrders
[
indexOrder
]
.
orderDetail
[
indexOrderDetail
].
orderVariant
,
);
Map
<
String
,
dynamic
>
insertData
=
{
'action'
:
'editVariant'
,
'list_orders'
:
widget
.
listOrders
,
'single_order_detail'
:
orderDetailNow
,
};
context
.
read
<
OrdersBloc
>().
insertData
(
insertData
);
setState
(()
{});
},
child:
Container
(
width:
22
,
height:
22
,
child:
Image
(
image:
AssetImage
((
isExcelso
)
?
'assets/icons/plus-gold.png'
:
'assets/icons/plus.png'
),
),
),
),
)
,
)
]
,
),
const
SizedBox
(
width:
12
,
)
]
,
)
],
)
,
const
SizedBox
(
width:
12
,
)
],
)
,
),
),
const
SizedBox
(
height:
24
,
)
]
,
const
SizedBox
(
height:
24
,
)
],
)
,
);
}
}
// Column listWithVariant(
// List<Orders> listOrders,
// i,
// BuildContext context,
// List<dynamic> indexAdaVariant,
// double widthRowForNote,
// ) {
// // dippecah lagi masing2 indexnya
// int indexOrder = int.parse(i.split('|')[0]);
// int indexOrderDetail = int.parse(i.split('|')[1]);
// List<String> variantCaption = [];
// List<String> variantName = [];
// if (listOrders[indexOrder].orderDetail.isNotEmpty) {
// for (int y = 0;
// y <
// listOrders[indexOrder]
// .orderDetail[indexOrderDetail]
// .orderVariant
// .length;
// y++) {
// int indexCaption = variantCaption.indexWhere((element) =>
// element ==
// listOrders[indexOrder]
// .orderDetail[indexOrderDetail]
// .orderVariant[y]
// .caption);
// if (indexCaption == -1) {
// variantCaption.add(listOrders[indexOrder]
// .orderDetail[indexOrderDetail]
// .orderVariant[y]
// .caption);
// variantName.add(listOrders[indexOrder]
// .orderDetail[indexOrderDetail]
// .orderVariant[y]
// .name);
// } else {
// variantName[indexCaption] +=
// ", ${listOrders[indexOrder].orderDetail[indexOrderDetail].orderVariant[y].name}";
// }
// }
// }
// return Column(
// children: [
// Container(
// width: double.infinity,
// padding: const EdgeInsets.symmetric(
// horizontal: paddingLeftRight,
// vertical: 16,
// ),
// color: backgroundWhite,
// child: Row(
// crossAxisAlignment: CrossAxisAlignment.center,
// mainAxisAlignment: MainAxisAlignment.start,
// children: [
// (listOrders[indexOrder].imageUrl != '')
// ? Image(
// width: 80,
// height: 80,
// fit: BoxFit.fill,
// image: NetworkImage(listOrders[indexOrder].imageUrl),
// )
// : const Image(
// width: 80,
// height: 80,
// fit: BoxFit.fill,
// image: AssetImage('assets/noimage.png'),
// ),
// const SizedBox(
// width: 12,
// ),
// Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// mainAxisAlignment: MainAxisAlignment.center,
// children: [
// Container(
// width: widthRowForNote,
// child: defaultText(
// context,
// listOrders[indexOrder].namaMenu,
// // maxLines: 2,
// // overFlow: TextOverflow.ellipsis,
// style: menuNameListViewBill(),
// ),
// ),
// const SizedBox(
// height: 6,
// ),
// defaultText(
// context,
// '${listOrders[indexOrder].orderDetail[indexOrderDetail].totalItem} X Rp ${formatNumber().format(listOrders[indexOrder].satuanHarga)}',
// style: viewbillStyle(
// font: 12,
// fontWeight: FontWeight.w300,
// ),
// ),
// const SizedBox(
// height: 6,
// ),
// for (int a = 0; a < variantCaption.length; a++)
// if (variantCaption[a] != '')
// // defaultText(
// // context,
// // listOrders[i]
// // .orderDetail[0]
// // .orderVariant[a]
// // .name,
// // maxLines: 2,
// // overFlow:
// // TextOverflow.ellipsis,
// // style: viewbillStyle(
// // font: 12,
// // fontWeight:
// // FontWeight.w300,
// // ),
// // ),
// Container(
// width: widthRowForNote,
// child: Row(
// children: [
// defaultText(
// context,
// "${variantCaption[a]} : ",
// // maxLines: 2,
// // overFlow: TextOverflow.ellipsis,
// style: viewbillStyle(
// font: 12,
// fontWeight: FontWeight.w300,
// ),
// ),
// defaultText(
// context,
// variantName[a],
// // maxLines: 2,
// // overFlow: TextOverflow.ellipsis,
// style: viewbillStyle(
// font: 12,
// fontWeight: FontWeight.w300,
// ),
// ),
// ],
// ),
// ),
// (listOrders[indexOrder].orderDetail[indexOrderDetail].note !=
// '')
// ? Container(
// width: widthRowForNote,
// child: defaultText(
// context,
// "Catatan: ${listOrders[indexOrder].orderDetail[indexOrderDetail].note}",
// // maxLines: 2,
// // overFlow: TextOverflow.ellipsis,
// style: viewbillStyle(
// font: 12,
// fontWeight: FontWeight.w300,
// ),
// ),
// )
// : const SizedBox(),
// ],
// )
// ],
// ),
// ),
// Container(
// width: double.infinity,
// color: backgroundWhite,
// padding: const EdgeInsets.only(
// left: paddingLeftRight,
// right: paddingLeftRight,
// bottom: 10,
// ),
// child: Row(
// children: [
// GestureDetector(
// onTap: () {
// final noteController = TextEditingController(
// text: listOrders[indexOrder]
// .orderDetail[indexOrderDetail]
// .note);
// FocusScopeNode currentFocus = FocusScope.of(context);
// if (!currentFocus.hasPrimaryFocus) {
// currentFocus.unfocus();
// }
// showModalBottomSheet(
// backgroundColor: backgroundColor,
// isScrollControlled: true,
// context: context,
// builder: (context) {
// return NoteModalBottomSheet(
// noteController: noteController,
// initialValue: listOrders[indexOrder].totalItem,
// orderVariants: const [],
// menuItem: FilterMenu(
// id: '',
// name: '',
// price: '',
// originalPrice: '',
// imageUrlMedium: '',
// imageUrlThumbnail: '',
// isSell: false,
// type: 1,
// categoryName: '',
// categoryId: '',
// description: '',
// groupName: '',
// groupId: '',
// ),
// listOrders: listOrders,
// from: fromConfirmationPage,
// contextFrom: context,
// idMenu: listOrders[indexOrder].id,
// menuName: listOrders[indexOrder].namaMenu,
// priceMemu: listOrders[indexOrder].satuanHarga,
// imageUrl: listOrders[indexOrder].imageUrl,
// editVariantConfirmationPage: true,
// indexOrder: indexOrder,
// indexOrderDetail: indexOrderDetail,
// );
// },
// );
// },
// child: Container(
// height: 30,
// width: 98,
// decoration: BoxDecoration(
// borderRadius: BorderRadius.circular(21),
// color: buttonColor),
// child: Row(
// mainAxisAlignment: MainAxisAlignment.center,
// crossAxisAlignment: CrossAxisAlignment.center,
// children: [
// const Image(
// height: 16,
// width: 16,
// image: AssetImage('assets/icons/note.png'),
// ),
// const SizedBox(
// width: 10,
// ),
// Container(
// height: 16,
// child: Center(
// child: defaultText(
// context,
// (listOrders[indexOrder].note != '')
// ? 'Ubah'
// : 'Catatan',
// style: noteViewBill(
// color: textInButton,
// ),
// ),
// ),
// )
// ],
// ),
// ),
// ),
// const Spacer(),
// Stack(
// children: [
// Container(
// width: 94,
// height: 22,
// decoration: BoxDecoration(
// borderRadius: BorderRadius.circular(30),
// color: backgroundColor,
// ),
// child: Center(
// child: defaultText(
// context,
// listOrders[indexOrder]
// .orderDetail[indexOrderDetail]
// .totalItem
// .toString(),
// style: amountViewBillButton(),
// ),
// ),
// ),
// Positioned(
// left: 0,
// child: GestureDetector(
// onTap: () {
// FocusScopeNode currentFocus = FocusScope.of(context);
// if (!currentFocus.hasPrimaryFocus) {
// currentFocus.unfocus();
// }
// int totalHarga = listOrders[indexOrder]
// .orderDetail[indexOrderDetail]
// .totalHarga
// .toInt();
// int totalItem = listOrders[indexOrder]
// .orderDetail[indexOrderDetail]
// .totalItem
// .toInt();
// int satuanHarga = totalHarga ~/ totalItem;
// OrderDetail orderDetailNow = OrderDetail(
// allIdVariant: listOrders[indexOrder]
// .orderDetail[indexOrderDetail]
// .allIdVariant,
// totalItem: listOrders[indexOrder]
// .orderDetail[indexOrderDetail]
// .totalItem -
// 1,
// totalHarga: listOrders[indexOrder]
// .orderDetail[indexOrderDetail]
// .totalHarga -
// satuanHarga,
// note: listOrders[indexOrder]
// .orderDetail[indexOrderDetail]
// .note,
// orderVariant: listOrders[indexOrder]
// .orderDetail[indexOrderDetail]
// .orderVariant,
// );
// Map<String, dynamic> insertData = {
// 'action': 'editVariant',
// 'list_orders': listOrders,
// 'single_order_detail': orderDetailNow,
// };
// context.read<OrdersBloc>().insertData(insertData);
// },
// child: Container(
// width: 22,
// height: 22,
// child: Image(
// image: AssetImage((isExcelso)
// ? 'assets/icons/minus-gold.png'
// : 'assets/icons/minus-blue.png'),
// ),
// ),
// ),
// ),
// Positioned(
// right: 0,
// child: GestureDetector(
// onTap: () {
// FocusScopeNode currentFocus = FocusScope.of(context);
// if (!currentFocus.hasPrimaryFocus) {
// currentFocus.unfocus();
// }
// int totalHarga = listOrders[indexOrder]
// .orderDetail[indexOrderDetail]
// .totalHarga
// .toInt();
// int totalItem = listOrders[indexOrder]
// .orderDetail[indexOrderDetail]
// .totalItem
// .toInt();
// int satuanHarga = totalHarga ~/ totalItem;
// OrderDetail orderDetailNow = OrderDetail(
// allIdVariant: listOrders[indexOrder]
// .orderDetail[indexOrderDetail]
// .allIdVariant,
// totalItem: listOrders[indexOrder]
// .orderDetail[indexOrderDetail]
// .totalItem +
// 1,
// totalHarga: listOrders[indexOrder]
// .orderDetail[indexOrderDetail]
// .totalHarga +
// satuanHarga,
// note: listOrders[indexOrder]
// .orderDetail[indexOrderDetail]
// .note,
// orderVariant: listOrders[indexOrder]
// .orderDetail[indexOrderDetail]
// .orderVariant,
// );
// Map<String, dynamic> insertData = {
// 'action': 'editVariant',
// 'list_orders': listOrders,
// 'single_order_detail': orderDetailNow,
// };
// context.read<OrdersBloc>().insertData(insertData);
// },
// child: Container(
// width: 22,
// height: 22,
// child: Image(
// image: AssetImage((isExcelso)
// ? 'assets/icons/plus-gold.png'
// : 'assets/icons/plus.png'),
// ),
// ),
// ),
// )
// ],
// ),
// const SizedBox(
// width: 12,
// )
// ],
// ),
// ),
// const SizedBox(
// height: 24,
// )
// ],
// );
// }
Future
<
dynamic
>
modalInputName
(
BuildContext
context
,
TextEditingController
nameController
,
List
<
Orders
>
listOrders
)
{
return
showDialog
(
...
...
lib/ui/home/fav_grid_menu.dart
View file @
400dfcbf
...
...
@@ -397,7 +397,7 @@ class FavGridMenu extends StatelessWidget {
initialValue:
initialValue
,
orderVariants:
orderVariants
,
menuItem:
menuFav
,
lis
r
Orders:
list
,
lis
t
Orders:
list
,
from:
fromMenu
,
contextFrom:
context
,
);
...
...
lib/ui/home/menu_list_utama.dart
View file @
400dfcbf
...
...
@@ -446,7 +446,7 @@ class MenuListUtama extends StatelessWidget {
initialValue:
initialValue
,
orderVariants:
orderVariants
,
menuItem:
menuUtama
,
lis
r
Orders:
list
,
lis
t
Orders:
list
,
from:
fromMenu
,
contextFrom:
context
,
);
...
...
lib/ui/viewbill/order_view_bill_new.dart
View file @
400dfcbf
...
...
@@ -369,7 +369,7 @@ class _OrderViewBillNewState extends State<OrderViewBillNew> {
description:
''
,
groupName:
''
,
groupId:
''
),
lis
r
Orders:
const
[],
lis
t
Orders:
const
[],
from:
fromBill
,
idOrderan:
widget
.
billDetail
.
id
,
contextFrom:
contextOrderViewBill
,
...
...
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