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
16cd711c
Commit
16cd711c
authored
Oct 19, 2022
by
Jasa Digital
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add trigger refresh
parent
400dfcbf
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
643 additions
and
599 deletions
+643
-599
trigger_refresh_in_confirmation_page.dart
lib/bloc/trigger_refresh_in_confirmation_page.dart
+9
-0
main.dart
lib/main.dart
+2
-0
confirm_order.dart
lib/ui/confirm_order/confirm_order.dart
+632
-599
No files found.
lib/bloc/trigger_refresh_in_confirmation_page.dart
0 → 100644
View file @
16cd711c
import
'package:flutter_bloc/flutter_bloc.dart'
;
class
TriggerRefreshInConfirmationPage
extends
Cubit
<
bool
>
{
TriggerRefreshInConfirmationPage
()
:
super
(
false
);
void
trigger
(
bool
status
)
{
emit
(
status
);
}
}
lib/main.dart
View file @
16cd711c
...
@@ -33,6 +33,7 @@ import 'bloc/outlet_detail.dart';
...
@@ -33,6 +33,7 @@ import 'bloc/outlet_detail.dart';
import
'bloc/search_active.dart'
;
import
'bloc/search_active.dart'
;
import
'bloc/search_branch.dart'
;
import
'bloc/search_branch.dart'
;
import
'bloc/search_history.dart'
;
import
'bloc/search_history.dart'
;
import
'bloc/trigger_refresh_in_confirmation_page.dart'
;
import
'bloc/view_bill.dart'
;
import
'bloc/view_bill.dart'
;
import
'package:flutter/services.dart'
as
bundle_root
;
import
'package:flutter/services.dart'
as
bundle_root
;
...
@@ -197,6 +198,7 @@ class _MyAppState extends State<MyApp> {
...
@@ -197,6 +198,7 @@ class _MyAppState extends State<MyApp> {
BlocProvider
(
create:
(
_
)
=>
AddressUser
()),
BlocProvider
(
create:
(
_
)
=>
AddressUser
()),
BlocProvider
(
create:
(
_
)
=>
ExpandDetailOutlet
()),
BlocProvider
(
create:
(
_
)
=>
ExpandDetailOutlet
()),
BlocProvider
(
create:
(
_
)
=>
ChangeDeliveryPickupBloc
()),
BlocProvider
(
create:
(
_
)
=>
ChangeDeliveryPickupBloc
()),
BlocProvider
(
create:
(
_
)
=>
TriggerRefreshInConfirmationPage
()),
],
],
child:
MaterialApp
(
child:
MaterialApp
(
title:
(
widget
.
title
==
null
)
?
defaultTitle
:
widget
.
title
,
title:
(
widget
.
title
==
null
)
?
defaultTitle
:
widget
.
title
,
...
...
lib/ui/confirm_order/confirm_order.dart
View file @
16cd711c
...
@@ -7,6 +7,7 @@ import 'package:flutter/material.dart';
...
@@ -7,6 +7,7 @@ import 'package:flutter/material.dart';
import
'package:flutter_bloc/flutter_bloc.dart'
;
import
'package:flutter_bloc/flutter_bloc.dart'
;
import
'../../bloc/order_bloc.dart'
;
import
'../../bloc/order_bloc.dart'
;
import
'../../bloc/trigger_refresh_in_confirmation_page.dart'
;
import
'../../helper/prefs.dart'
;
import
'../../helper/prefs.dart'
;
import
'../../helper/widget/button_modal.dart'
;
import
'../../helper/widget/button_modal.dart'
;
import
'../../helper/widget/modal_input_name.dart'
;
import
'../../helper/widget/modal_input_name.dart'
;
...
@@ -44,646 +45,670 @@ class CoreConfirm extends StatelessWidget {
...
@@ -44,646 +45,670 @@ class CoreConfirm extends StatelessWidget {
double
widthScreen
=
responsiveWidthScreen
(
context
);
double
widthScreen
=
responsiveWidthScreen
(
context
);
double
widthRowForNote
=
double
widthRowForNote
=
MediaQuery
.
of
(
context
).
size
.
width
-
20
-
12
-
80
-
20
;
MediaQuery
.
of
(
context
).
size
.
width
-
20
-
12
-
80
-
20
;
return
BlocBuilder
<
OrdersBloc
,
List
<
Orders
>>(
return
BlocBuilder
<
TriggerRefreshInConfirmationPage
,
bool
>(
builder:
(
ctx
,
listOrders
)
{
builder:
(
_
,
trigger
)
{
int
totalHarga
=
0
;
return
BlocBuilder
<
OrdersBloc
,
List
<
Orders
>>(
List
indexTidakAdaVariant
=
[];
builder:
(
ctx
,
listOrders
)
{
List
indexAdaVariant
=
[];
int
totalHarga
=
0
;
List
indexTidakAdaVariant
=
[];
List
indexAdaVariant
=
[];
// if (listOrders.isNotEmpty) {
// if (listOrders.isNotEmpty) {
// int fixTotalHarga = 0;
// int fixTotalHarga = 0;
// int totalHargaOrderDetail = 0;
// int totalHargaOrderDetail = 0;
// int totalHargaBukanOrderDetail = 0;
// int totalHargaBukanOrderDetail = 0;
// for (var i = 0; i < listOrders.length; i++) {
// for (var i = 0; i < listOrders.length; i++) {
// if (listOrders[i].orderDetail.isEmpty) {
// if (listOrders[i].orderDetail.isEmpty) {
// // indexTidakAdaVariant.add(i);
// // indexTidakAdaVariant.add(i);
// totalHargaBukanOrderDetail +=
// totalHargaBukanOrderDetail +=
// (listOrders[i].totalItem * listOrders[i].totalHarga);
// (listOrders[i].totalItem * listOrders[i].totalHarga);
// } else {
// } else {
// // for (int kk = 0; kk < listOrders[i].orderDetail.length; kk++) {
// // for (int kk = 0; kk < listOrders[i].orderDetail.length; kk++) {
// // String indexWithVariant = '$i|$kk';
// // String indexWithVariant = '$i|$kk';
// // indexAdaVariant.add(indexWithVariant);
// // indexAdaVariant.add(indexWithVariant);
// // totalHargaOrderDetail +=
// // totalHargaOrderDetail +=
// // listOrders[i].orderDetail[kk].totalHarga;
// // listOrders[i].orderDetail[kk].totalHarga;
// // }
// // }
// fixTotalHarga = totalHargaOrderDetail;
// fixTotalHarga = totalHargaOrderDetail;
// }
// }
// }
// }
// totalHarga = fixTotalHarga + totalHargaBukanOrderDetail;
// totalHarga = fixTotalHarga + totalHargaBukanOrderDetail;
// }
// }
if
(
listOrders
.
isNotEmpty
)
{
if
(
listOrders
.
isNotEmpty
)
{
int
fixTotalHarga
=
0
;
int
fixTotalHarga
=
0
;
int
totalHargaOrderDetail
=
0
;
int
totalHargaOrderDetail
=
0
;
int
totalHargaBukanOrderDetail
=
0
;
int
totalHargaBukanOrderDetail
=
0
;
// int fixTotalItem = 0;
// int fixTotalItem = 0;
// int totalItemOrderDetail = 0;
// int totalItemOrderDetail = 0;
// int totalItemBukanOrderDetail = 0;
// int totalItemBukanOrderDetail = 0;
for
(
var
i
=
0
;
i
<
listOrders
.
length
;
i
++)
{
for
(
var
i
=
0
;
i
<
listOrders
.
length
;
i
++)
{
// totalItem += listOrders[i].totalItem;
// totalItem += listOrders[i].totalItem;
// check apakah ada order detail. kalau ada rekalkulasi total harga sesuai order detail
// check apakah ada order detail. kalau ada rekalkulasi total harga sesuai order detail
if
(
listOrders
[
i
].
orderDetail
.
isEmpty
)
{
if
(
listOrders
[
i
].
orderDetail
.
isEmpty
)
{
indexTidakAdaVariant
.
add
(
i
);
indexTidakAdaVariant
.
add
(
i
);
totalHargaBukanOrderDetail
+=
totalHargaBukanOrderDetail
+=
(
listOrders
[
i
].
totalItem
*
listOrders
[
i
].
totalHarga
);
(
listOrders
[
i
].
totalItem
*
listOrders
[
i
].
totalHarga
);
// totalItemBukanOrderDetail += listOrders[i].totalItem;
// totalItemBukanOrderDetail += listOrders[i].totalItem;
}
else
{
}
else
{
for
(
int
kk
=
0
;
kk
<
listOrders
[
i
].
orderDetail
.
length
;
kk
++)
{
for
(
int
kk
=
0
;
String
indexWithVariant
=
kk
<
listOrders
[
i
].
orderDetail
.
length
;
'
$i
|
$kk
'
;
// index orderan|index order detail
kk
++)
{
indexAdaVariant
.
add
(
indexWithVariant
);
String
indexWithVariant
=
totalHargaOrderDetail
+=
'
$i
|
$kk
'
;
// index orderan|index order detail
listOrders
[
i
].
orderDetail
[
kk
].
totalHarga
;
indexAdaVariant
.
add
(
indexWithVariant
);
// totalItemOrderDetail +=
totalHargaOrderDetail
+=
// listOrders[i].orderDetail[kk].totalItem;
listOrders
[
i
].
orderDetail
[
kk
].
totalHarga
;
// totalItemOrderDetail +=
// listOrders[i].orderDetail[kk].totalItem;
}
fixTotalHarga
=
totalHargaOrderDetail
;
// fixTotalItem = totalItemOrderDetail;
}
}
}
fixTotalHarga
=
totalHarga
OrderDetail
;
totalHarga
=
fixTotalHarga
+
totalHargaBukan
OrderDetail
;
//
fixTotalItem = totalItem
OrderDetail;
//
totalItem = fixTotalItem + totalItemBukan
OrderDetail;
}
}
}
totalHarga
=
fixTotalHarga
+
totalHargaBukanOrderDetail
;
// totalItem = fixTotalItem + totalItemBukanOrderDetail;
}
void
plus
()
{}
void
plus
()
{}
void
minus
()
{}
void
minus
()
{}
return
Container
(
return
Container
(
width:
widthScreen
,
width:
widthScreen
,
child:
Stack
(
child:
Stack
(
children:
[
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
children:
[
const
CustomAppBarConfirm
(),
Column
(
Expanded
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
child:
SingleChildScrollView
(
children:
[
physics:
const
AlwaysScrollableScrollPhysics
(),
const
CustomAppBarConfirm
(),
child:
Column
(
Expanded
(
children:
[
child:
SingleChildScrollView
(
const
SizedBox
(
physics:
const
AlwaysScrollableScrollPhysics
(),
height:
24
,
child:
Column
(
),
children:
[
for
(
var
i
in
indexAdaVariant
)
const
SizedBox
(
VariantOrder
(
height:
24
,
i:
i
,
),
indexAdaVariant:
indexAdaVariant
,
for
(
var
i
in
indexAdaVariant
)
widthRowForNote:
widthRowForNote
,
VariantOrder
(
listOrders:
listOrders
,
i:
i
,
),
indexAdaVariant:
indexAdaVariant
,
for
(
int
j
in
indexTidakAdaVariant
)
widthRowForNote:
widthRowForNote
,
Column
(
listOrders:
listOrders
,
children:
[
trigger:
trigger
,
Container
(
),
width:
double
.
infinity
,
for
(
int
j
in
indexTidakAdaVariant
)
padding:
const
EdgeInsets
.
symmetric
(
Column
(
horizontal:
paddingLeftRight
,
children:
[
vertical:
16
,
Container
(
),
width:
double
.
infinity
,
color:
backgroundWhite
,
padding:
const
EdgeInsets
.
symmetric
(
child:
Row
(
horizontal:
paddingLeftRight
,
crossAxisAlignment:
vertical:
16
,
CrossAxisAlignment
.
center
,
mainAxisAlignment:
MainAxisAlignment
.
start
,
children:
[
(
listOrders
[
j
].
imageUrl
!=
''
)
?
Image
(
width:
80
,
height:
80
,
fit:
BoxFit
.
fill
,
image:
NetworkImage
(
listOrders
[
j
].
imageUrl
),
)
:
const
Image
(
width:
80
,
height:
80
,
fit:
BoxFit
.
fill
,
image:
AssetImage
(
'assets/noimage.png'
),
),
const
SizedBox
(
width:
12
,
),
),
Column
(
color:
backgroundWhite
,
child:
Row
(
crossAxisAlignment:
crossAxisAlignment:
CrossAxisAlignment
.
start
,
CrossAxisAlignment
.
center
,
mainAxisAlignment:
mainAxisAlignment:
MainAxisAlignment
.
center
,
MainAxisAlignment
.
start
,
children:
[
children:
[
Container
(
(
listOrders
[
j
].
imageUrl
!=
''
)
width:
widthRowForNote
,
?
Image
(
child:
defaultText
(
width:
80
,
context
,
height:
80
,
listOrders
[
j
].
namaMenu
,
fit:
BoxFit
.
fill
,
maxLines:
2
,
image:
NetworkImage
(
overFlow:
TextOverflow
.
ellipsis
,
listOrders
[
j
].
imageUrl
),
style:
menuNameListViewBill
(),
),
),
const
SizedBox
(
height:
6
,
),
defaultText
(
context
,
'
${listOrders[j].totalItem}
X Rp
${formatNumber().format(listOrders[j].satuanHarga)}
'
,
style:
viewbillStyle
(
font:
12
,
fontWeight:
FontWeight
.
w300
,
),
),
const
SizedBox
(
height:
6
,
),
(
listOrders
[
j
].
note
!=
''
)
?
Container
(
width:
widthRowForNote
,
child:
defaultText
(
context
,
"Catatan:
${listOrders[j].note}
"
,
// maxLines: 2,
// overFlow:
// TextOverflow.ellipsis,
style:
viewbillStyle
(
font:
12
,
fontWeight:
FontWeight
.
w300
,
),
),
)
)
:
const
SizedBox
(),
:
const
Image
(
],
width:
80
,
)
height:
80
,
],
fit:
BoxFit
.
fill
,
),
image:
AssetImage
(
),
'assets/noimage.png'
),
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
[
j
].
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
[
j
].
totalItem
,
orderVariants:
const
[],
menuItem:
FilterMenu
(
id:
''
,
name:
''
,
price:
''
,
originalPrice:
''
,
imageUrlMedium:
''
,
imageUrlThumbnail:
''
,
isSell:
false
,
type:
1
,
categoryName:
''
,
categoryId:
''
,
description:
''
,
groupName:
''
,
groupId:
''
,
),
),
listOrders:
listOrders
,
const
SizedBox
(
from:
fromConfirmationPage
,
width:
12
,
contextFrom:
context
,
),
idMenu:
listOrders
[
j
].
id
,
Column
(
menuName:
crossAxisAlignment:
listOrders
[
j
].
namaMenu
,
CrossAxisAlignment
.
start
,
priceMemu:
listOrders
[
j
].
satuanHarga
,
imageUrl:
listOrders
[
j
].
imageUrl
,
);
},
);
},
child:
Container
(
height:
30
,
width:
98
,
decoration:
BoxDecoration
(
borderRadius:
BorderRadius
.
circular
(
21
),
color:
buttonColor
),
child:
Row
(
mainAxisAlignment:
mainAxisAlignment:
MainAxisAlignment
.
center
,
MainAxisAlignment
.
center
,
crossAxisAlignment:
CrossAxisAlignment
.
center
,
children:
[
children:
[
const
Image
(
Container
(
height:
16
,
width:
widthRowForNote
,
width:
16
,
child:
defaultText
(
image:
AssetImage
(
context
,
'assets/icons/note.png'
),
listOrders
[
j
].
namaMenu
,
maxLines:
2
,
overFlow:
TextOverflow
.
ellipsis
,
style:
menuNameListViewBill
(),
),
),
),
const
SizedBox
(
const
SizedBox
(
width:
10
,
height:
6
,
),
),
Container
(
defaultText
(
height:
16
,
context
,
child:
Center
(
'
${listOrders[j].totalItem}
X Rp
${formatNumber().format(listOrders[j].satuanHarga)}
'
,
child:
defaultText
(
style:
viewbillStyle
(
context
,
font:
12
,
(
listOrders
[
j
].
note
!=
''
)
fontWeight:
FontWeight
.
w300
,
?
'Ubah'
:
'Catatan'
,
style:
noteViewBill
(
color:
textInButton
,
),
),
),
),
)
),
const
SizedBox
(
height:
6
,
),
(
listOrders
[
j
].
note
!=
''
)
?
Container
(
width:
widthRowForNote
,
child:
defaultText
(
context
,
"Catatan:
${listOrders[j].note}
"
,
// maxLines: 2,
// overFlow:
// TextOverflow.ellipsis,
style:
viewbillStyle
(
font:
12
,
fontWeight:
FontWeight
.
w300
,
),
),
)
:
const
SizedBox
(),
],
],
)
,
)
)
,
]
,
),
),
const
Spacer
(),
),
Stack
(
Container
(
width:
double
.
infinity
,
color:
backgroundWhite
,
padding:
const
EdgeInsets
.
only
(
left:
paddingLeftRight
,
right:
paddingLeftRight
,
bottom:
10
,
),
child:
Row
(
children:
[
children:
[
Container
(
GestureDetector
(
width:
94
,
onTap:
()
{
height:
22
,
final
noteController
=
decoration:
BoxDecoration
(
TextEditingController
(
borderRadius:
text:
listOrders
[
j
].
note
);
BorderRadius
.
circular
(
30
),
FocusScopeNode
currentFocus
=
color:
backgroundColor
,
FocusScope
.
of
(
context
);
),
child:
Center
(
if
(!
currentFocus
child:
defaultText
(
.
hasPrimaryFocus
)
{
context
,
currentFocus
.
unfocus
();
listOrders
[
j
]
}
.
totalItem
showModalBottomSheet
(
.
toString
(),
backgroundColor:
style:
amountViewBillButton
(),
backgroundColor
,
isScrollControlled:
true
,
context:
context
,
builder:
(
context
)
{
return
NoteModalBottomSheet
(
noteController:
noteController
,
initialValue:
listOrders
[
j
].
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
[
j
].
id
,
menuName:
listOrders
[
j
].
namaMenu
,
priceMemu:
listOrders
[
j
]
.
satuanHarga
,
imageUrl:
listOrders
[
j
].
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
[
j
].
note
!=
''
)
?
'Ubah'
:
'Catatan'
,
style:
noteViewBill
(
color:
textInButton
,
),
),
),
)
],
),
),
),
),
),
),
Positioned
(
const
Spacer
(),
left:
0
,
Stack
(
child:
GestureDetector
(
children:
[
onTap:
()
{
Container
(
FocusScopeNode
currentFocus
=
width:
94
,
FocusScope
.
of
(
context
);
if
(!
currentFocus
.
hasPrimaryFocus
)
{
currentFocus
.
unfocus
();
}
Map
<
String
,
dynamic
>
insertData
=
{
'menu_id'
:
listOrders
[
j
].
id
,
'menu_name'
:
listOrders
[
j
].
namaMenu
,
'initvalue'
:
listOrders
[
j
].
totalItem
-
1
,
'menu_price'
:
listOrders
[
j
].
satuanHarga
,
'total_price'
:
listOrders
[
j
].
satuanHarga
,
'old_order'
:
listOrders
,
'image_url'
:
listOrders
[
j
].
imageUrl
,
'order_variant'
:
[],
'note'
:
listOrders
[
j
].
note
,
};
context
.
read
<
OrdersBloc
>()
.
insertData
(
insertData
);
},
child:
Container
(
width:
22
,
height:
22
,
height:
22
,
child:
Image
(
decoration:
BoxDecoration
(
image:
AssetImage
((
isExcelso
)
borderRadius:
?
'assets/icons/minus-gold.png'
BorderRadius
.
circular
(
30
),
:
'assets/icons/minus-blue.png'
),
color:
backgroundColor
,
),
child:
Center
(
child:
defaultText
(
context
,
listOrders
[
j
]
.
totalItem
.
toString
(),
style:
amountViewBillButton
(),
),
),
),
),
),
),
Positioned
(
),
left:
0
,
Positioned
(
child:
GestureDetector
(
right:
0
,
onTap:
()
{
child:
GestureDetector
(
FocusScopeNode
onTap:
()
{
currentFocus
=
FocusScopeNode
currentFocus
=
FocusScope
.
of
(
context
);
FocusScope
.
of
(
context
);
if
(!
currentFocus
if
(!
currentFocus
.
hasPrimaryFocus
)
{
.
hasPrimaryFocus
)
{
currentFocus
.
unfocus
();
currentFocus
.
unfocus
();
}
}
Map
<
String
,
dynamic
>
Map
<
String
,
dynamic
>
insertData
=
{
insertData
=
{
'menu_id'
:
listOrders
[
j
].
id
,
'menu_id'
:
'menu_name'
:
listOrders
[
j
].
id
,
listOrders
[
j
].
namaMenu
,
'menu_name'
:
listOrders
[
j
]
'initvalue'
:
.
namaMenu
,
listOrders
[
j
].
totalItem
+
'initvalue'
:
listOrders
[
j
]
.
totalItem
-
1
,
1
,
'menu_price'
:
'menu_price'
:
listOrders
[
j
].
satuanHarga
,
listOrders
[
j
]
'total_price'
:
.
satuanHarga
,
listOrders
[
j
].
satuanHarga
,
'total_price'
:
'old_order'
:
listOrders
,
listOrders
[
j
]
'image_url'
:
.
satuanHarga
,
listOrders
[
j
].
imageUrl
,
'old_order'
:
listOrders
,
'order_variant'
:
[],
'image_url'
:
listOrders
[
j
]
'note'
:
listOrders
[
j
].
note
,
.
imageUrl
,
};
'order_variant'
:
[],
context
'note'
:
.
read
<
OrdersBloc
>()
listOrders
[
j
].
note
,
.
insertData
(
insertData
);
};
},
context
child:
Container
(
.
read
<
OrdersBloc
>()
width:
22
,
.
insertData
(
insertData
);
height:
22
,
},
child:
Image
(
child:
Container
(
image:
AssetImage
((
isExcelso
)
width:
22
,
?
'assets/icons/plus-gold.png'
height:
22
,
:
'assets/icons/plus.png'
),
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
();
}
Map
<
String
,
dynamic
>
insertData
=
{
'menu_id'
:
listOrders
[
j
].
id
,
'menu_name'
:
listOrders
[
j
]
.
namaMenu
,
'initvalue'
:
listOrders
[
j
]
.
totalItem
+
1
,
'menu_price'
:
listOrders
[
j
]
.
satuanHarga
,
'total_price'
:
listOrders
[
j
]
.
satuanHarga
,
'old_order'
:
listOrders
,
'image_url'
:
listOrders
[
j
]
.
imageUrl
,
'order_variant'
:
[],
'note'
:
listOrders
[
j
].
note
,
};
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
(
),
width:
12
,
const
SizedBox
(
)
height:
24
,
],
)
)
,
]
,
),
),
const
SizedBox
(
// ListView.builder(
height:
24
,
// physics:
)
// const NeverScrollableScrollPhysics(), // to disable scrolling
],
// shrinkWrap: true,
),
// itemCount: listOrders.length,
// ListView.builder(
// itemBuilder: (context, i) {
// physics:
// List<String> variantCaption = [];
// const NeverScrollableScrollPhysics(), // to disable scrolling
// List<String> variantName = [];
// shrinkWrap: true,
// int totalItem;
// itemCount: listOrders.length,
// if (listOrders[i].orderDetail.isNotEmpty) {
// itemBuilder: (context, i) {
// for (int y = 0;
// List<String> variantCaption = [];
// y <
// List<String> variantName = [];
// listOrders[i]
// int totalItem;
// .orderDetail[i]
// if (listOrders[i].orderDetail.isNotEmpty) {
// .orderVariant
// for (int y = 0;
// .length;
// y <
// y++) {
// listOrders[i]
// int indexCaption = variantCaption.indexWhere(
// .orderDetail[i]
// (element) =>
// .orderVariant
// element ==
// .length;
// listOrders[i]
// y++) {
// .orderDetail[i]
// int indexCaption = variantCaption.indexWhere(
// .orderVariant[y]
// (element) =>
// .caption);
// element ==
// if (indexCaption == -1) {
// listOrders[i]
// variantCaption.add(listOrders[i]
// .orderDetail[i]
// .orderDetail[i]
// .orderVariant[y]
// .orderVariant[y]
// .caption);
// .caption);
// if (indexCaption == -1) {
// variantName.add(listOrders[i]
// variantCaption.add(listOrders[i]
// .orderDetail[i]
// .orderDetail[i]
// .orderVariant[y]
// .orderVariant[y]
// .name);
// .caption);
// } else {
// variantName.add(listOrders[i]
// variantName[indexCaption] +=
// .orderDetail[i]
// ", ${listOrders[i].orderDetail[i].orderVariant[y].name}";
// .orderVariant[y]
// }
// .name);
// }
// } else {
// int totalItemOrderDetail = 0;
// variantName[indexCaption] +=
// for (int kk = 0;
// ", ${listOrders[i].orderDetail[i].orderVariant[y].name}";
// kk < listOrders[i].orderDetail.length;
// }
// kk++) {
// }
// totalItemOrderDetail +=
// int totalItemOrderDetail = 0;
// listOrders[i].orderDetail[kk].totalItem;
// for (int kk = 0;
// }
// kk < listOrders[i].orderDetail.length;
// totalItem = totalItemOrderDetail;
// kk++) {
// } else {
// totalItemOrderDetail +=
// totalItem = listOrders[i].totalItem;
// listOrders[i].orderDetail[kk].totalItem;
// }
// }
// return Column(
// totalItem = totalItemOrderDetail;
// children: [
// } else {
// Container(
// totalItem = listOrders[i].totalItem;
// width: double.infinity,
// }
// padding: const EdgeInsets.symmetric(
// return Column(
// horizontal: paddingLeftRight,
// children: [
// vertical: 16,
// Container(
// ),
// width: double.infinity,
// color: backgroundWhite,
// padding: const EdgeInsets.symmetric(
// child: Row(
// horizontal: paddingLeftRight,
// crossAxisAlignment:
// vertical: 16,
// CrossAxisAlignment.center,
// ),
// mainAxisAlignment:
// color: backgroundWhite,
// MainAxisAlignment.start,
// child: Row(
// children: [
// crossAxisAlignment:
// (listOrders[i].imageUrl != '')
// CrossAxisAlignment.center,
// ? Image(
// mainAxisAlignment:
// width: 80,
// MainAxisAlignment.start,
// height: 80,
// children: [
// fit: BoxFit.fill,
// (listOrders[i].imageUrl != '')
// image: NetworkImage(
// ? Image(
// listOrders[i].imageUrl),
// width: 80,
// )
// height: 80,
// : const Image(
// fit: BoxFit.fill,
// width: 80,
// image: NetworkImage(
// height: 80,
// listOrders[i].imageUrl),
// fit: BoxFit.fill,
// )
// image: AssetImage(
// : const Image(
// 'assets/noimage.png'),
// width: 80,
// ),
// height: 80,
// const SizedBox(
// fit: BoxFit.fill,
// width: 12,
// image: AssetImage(
// ),
// 'assets/noimage.png'),
// Column(
// ),
// crossAxisAlignment:
// const SizedBox(
// CrossAxisAlignment.start,
// width: 12,
// mainAxisAlignment:
// ),
// MainAxisAlignment.center,
// Column(
// children: [
// crossAxisAlignment:
// defaultText(
// CrossAxisAlignment.start,
// context,
// mainAxisAlignment:
// listOrders[i].namaMenu,
// MainAxisAlignment.center,
// maxLines: 2,
// children: [
// overFlow: TextOverflow.ellipsis,
// defaultText(
// style: menuNameListViewBill(),
// context,
// ),
// listOrders[i].namaMenu,
// const SizedBox(
// maxLines: 2,
// height: 6,
// overFlow: TextOverflow.ellipsis,
// ),
// style: menuNameListViewBill(),
// defaultText(
// ),
// context,
// const SizedBox(
// '$totalItem X Rp ${formatNumber().format(listOrders[i].satuanHarga)}',
// height: 6,
// style: viewbillStyle(
// ),
// font: 12,
// defaultText(
// fontWeight: FontWeight.w300,
// context,
// ),
// '$totalItem X Rp ${formatNumber().format(listOrders[i].satuanHarga)}',
// ),
// style: viewbillStyle(
// const SizedBox(
// font: 12,
// height: 6,
// fontWeight: FontWeight.w300,
// ),
// ),
// (listOrders[i].note != '')
// ),
// ? defaultText(
// const SizedBox(
// context,
// height: 6,
// "Catatan: ${listOrders[i].note}",
// ),
// maxLines: 2,
// (listOrders[i].note != '')
// overFlow:
// ? defaultText(
// TextOverflow.ellipsis,
// context,
// style: viewbillStyle(
// "Catatan: ${listOrders[i].note}",
// font: 12,
// maxLines: 2,
// fontWeight:
// overFlow:
// FontWeight.w300,
// TextOverflow.ellipsis,
// ),
// style: viewbillStyle(
// )
// font: 12,
// : const SizedBox(),
// fontWeight:
// // (listOrders[i]
// FontWeight.w300,
// // .orderDetail
// ),
// // .isNotEmpty)
// )
// // ? defaultText(
// : const SizedBox(),
// // context,
// // (listOrders[i]
// // 'Variant : ',
// // .orderDetail
// // maxLines: 2,
// // .isNotEmpty)
// // overFlow:
// // ? defaultText(
// // TextOverflow.ellipsis,
// // context,
// // style: viewbillStyle(
// // 'Variant : ',
// // font: 12,
// // maxLines: 2,
// // fontWeight:
// // overFlow:
// // FontWeight.w300,
// // TextOverflow.ellipsis,
// // ),
// // style: viewbillStyle(
// // )
// // font: 12,
// // : const SizedBox(),
// // fontWeight:
// if (listOrders[i]
// // FontWeight.w300,
// .orderDetail
// // ),
// .isNotEmpty)
// // )
// for (int a = 0;
// // : const SizedBox(),
// a < variantCaption.length;
// if (listOrders[i]
// a++)
// .orderDetail
// if (variantCaption[a] != '')
// .isNotEmpty)
// // defaultText(
// for (int a = 0;
// // context,
// a < variantCaption.length;
// // listOrders[i]
// a++)
// // .orderDetail[0]
// if (variantCaption[a] != '')
// // .orderVariant[a]
// // defaultText(
// // .name,
// // context,
// // maxLines: 2,
// // listOrders[i]
// // overFlow:
// // .orderDetail[0]
// // TextOverflow.ellipsis,
// // .orderVariant[a]
// // style: viewbillStyle(
// // .name,
// // font: 12,
// // maxLines: 2,
// // fontWeight:
// // overFlow:
// // FontWeight.w300,
// // TextOverflow.ellipsis,
// // ),
// // style: viewbillStyle(
// // ),
// // font: 12,
// Row(
// // fontWeight:
// children: [
// // FontWeight.w300,
// defaultText(
// // ),
// context,
// // ),
// "${variantCaption[a]} : ",
// Row(
// maxLines: 2,
// children: [
// overFlow: TextOverflow
// defaultText(
// .ellipsis,
// context,
// style: viewbillStyle(
// "${variantCaption[a]} : ",
// font: 12,
// maxLines: 2,
// fontWeight:
// overFlow: TextOverflow
// FontWeight.w300,
// .ellipsis,
// ),
// style: viewbillStyle(
// ),
// font: 12,
// defaultText(
// fontWeight:
// context,
// FontWeight.w300,
// variantName[a],
// ),
// maxLines: 2,
// ),
// overFlow: TextOverflow
// defaultText(
// .ellipsis,
// context,
// style: viewbillStyle(
// variantName[a],
// font: 12,
// maxLines: 2,
// fontWeight:
// overFlow: TextOverflow
// FontWeight.w300,
// .ellipsis,
// ),
// style: viewbillStyle(
// ),
// font: 12,
// ],
// fontWeight:
// )
// FontWeight.w300,
// ],
// ),
// )
// ),
// ],
// ],
// ),
// )
// ),
// ],
// const SizedBox(
// )
// height: 24,
// ],
// )
// ),
// ],
// ),
// );
// const SizedBox(
// },
// height: 24,
// ),
// )
const
AddMoreOrder
()
// ],
],
// );
),
// },
),
// ),
)
const
AddMoreOrder
()
],
),
Positioned
(
bottom:
0
,
child:
Container
(
decoration:
const
BoxDecoration
(
borderRadius:
BorderRadius
.
only
(
topLeft:
Radius
.
circular
(
16
),
topRight:
Radius
.
circular
(
16
),
),
color:
backgroundWhite
,
boxShadow:
[
BoxShadow
(
color:
Colors
.
grey
,
blurRadius:
10.0
,
)
],
],
),
),
padding:
const
EdgeInsets
.
all
(
paddingLeftRight
),
width:
widthScreen
,
child:
GestureDetector
(
onTap:
()
{
String
username
=
getCustomerName
();
if
(
username
!=
''
)
{
checkOut
(
context
,
listOrders
,
username
);
}
else
{
modalInputName
(
context
,
nameController
,
listOrders
);
}
},
child:
ButtonComponent
(
buttonColor:
buttonColor
,
teksButton:
'Pesan - Rp
${formatNumber().format(totalHarga)}
'
),
),
),
),
)
)
],
],
),
),
Positioned
(
);
bottom:
0
,
},
child:
Container
(
decoration:
const
BoxDecoration
(
borderRadius:
BorderRadius
.
only
(
topLeft:
Radius
.
circular
(
16
),
topRight:
Radius
.
circular
(
16
),
),
color:
backgroundWhite
,
boxShadow:
[
BoxShadow
(
color:
Colors
.
grey
,
blurRadius:
10.0
,
)
],
),
padding:
const
EdgeInsets
.
all
(
paddingLeftRight
),
width:
widthScreen
,
child:
GestureDetector
(
onTap:
()
{
String
username
=
getCustomerName
();
if
(
username
!=
''
)
{
checkOut
(
context
,
listOrders
,
username
);
}
else
{
modalInputName
(
context
,
nameController
,
listOrders
);
}
},
child:
ButtonComponent
(
buttonColor:
buttonColor
,
teksButton:
'Pesan - Rp
${formatNumber().format(totalHarga)}
'
),
),
),
)
],
),
);
);
},
},
);
);
...
@@ -691,18 +716,20 @@ class CoreConfirm extends StatelessWidget {
...
@@ -691,18 +716,20 @@ class CoreConfirm extends StatelessWidget {
}
}
class
VariantOrder
extends
StatefulWidget
{
class
VariantOrder
extends
StatefulWidget
{
VariantOrder
({
const
VariantOrder
({
Key
?
key
,
Key
?
key
,
required
this
.
i
,
required
this
.
i
,
required
this
.
indexAdaVariant
,
required
this
.
indexAdaVariant
,
required
this
.
widthRowForNote
,
required
this
.
widthRowForNote
,
required
this
.
listOrders
,
required
this
.
listOrders
,
required
this
.
trigger
,
})
:
super
(
key:
key
);
})
:
super
(
key:
key
);
var
i
;
final
String
i
;
final
List
indexAdaVariant
;
final
List
indexAdaVariant
;
final
double
widthRowForNote
;
final
double
widthRowForNote
;
final
List
<
Orders
>
listOrders
;
final
List
<
Orders
>
listOrders
;
final
bool
trigger
;
@override
@override
State
<
VariantOrder
>
createState
()
=>
_VariantOrderState
();
State
<
VariantOrder
>
createState
()
=>
_VariantOrderState
();
...
@@ -1021,7 +1048,10 @@ class _VariantOrderState extends State<VariantOrder> {
...
@@ -1021,7 +1048,10 @@ class _VariantOrderState extends State<VariantOrder> {
'single_order_detail'
:
orderDetailNow
,
'single_order_detail'
:
orderDetailNow
,
};
};
context
.
read
<
OrdersBloc
>().
insertData
(
insertData
);
context
.
read
<
OrdersBloc
>().
insertData
(
insertData
);
setState
(()
{});
context
.
read
<
TriggerRefreshInConfirmationPage
>()
.
trigger
(!
widget
.
trigger
);
// setState(() {});
},
},
child:
Container
(
child:
Container
(
width:
22
,
width:
22
,
...
@@ -1070,7 +1100,10 @@ class _VariantOrderState extends State<VariantOrder> {
...
@@ -1070,7 +1100,10 @@ class _VariantOrderState extends State<VariantOrder> {
'single_order_detail'
:
orderDetailNow
,
'single_order_detail'
:
orderDetailNow
,
};
};
context
.
read
<
OrdersBloc
>().
insertData
(
insertData
);
context
.
read
<
OrdersBloc
>().
insertData
(
insertData
);
setState
(()
{});
context
.
read
<
TriggerRefreshInConfirmationPage
>()
.
trigger
(!
widget
.
trigger
);
// setState(() {});
},
},
child:
Container
(
child:
Container
(
width:
22
,
width:
22
,
...
...
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