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
c7a0b437
Commit
c7a0b437
authored
Oct 10, 2022
by
Dio Maulana
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
s
parent
c2f92bb8
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
341 additions
and
121 deletions
+341
-121
order_bloc.dart
lib/bloc/order_bloc.dart
+1
-0
order_variant_temporary.dart
lib/bloc/order_variant_temporary.dart
+4
-0
bottom_sheet_variant_new.dart
lib/ui/home/bottom_sheet_variant_new.dart
+336
-121
No files found.
lib/bloc/order_bloc.dart
View file @
c7a0b437
...
...
@@ -33,6 +33,7 @@ class OrdersBloc extends Cubit<List<Orders>> {
listOrders
.
removeAt
(
indexListOrder
);
}
}
emit
(
listOrders
);
}
else
{
var
listOrderOld
=
json
[
'old_order'
];
// orderan lama
...
...
lib/bloc/order_variant_temporary.dart
View file @
c7a0b437
...
...
@@ -11,4 +11,8 @@ class OrderVariantTemporaryBloc extends Cubit<List<dynamic>> {
emit
(
temporaryVariant
);
}
void
clearDataVariant
()
{
emit
([]);
}
}
lib/ui/home/bottom_sheet_variant_new.dart
View file @
c7a0b437
// ignore_for_file: must_be_immutable
// ignore_for_file: must_be_immutable
, sized_box_for_whitespace
import
'package:byod/helper/widget/plus_minus_button.dart'
;
import
'package:byod/helper/widget/style.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter_bloc/flutter_bloc.dart'
;
import
'../../bloc/order_bloc.dart'
;
import
'../../bloc/order_detail_variant.dart'
;
import
'../../bloc/order_variant_temporary.dart'
;
import
'../../helper/helper.dart'
;
import
'../../helper/widget/button_modal.dart'
;
import
'../../main.dart'
;
import
'../../models/order_details.dart'
;
import
'../../models/orders.dart'
;
import
'../../models/variant_categories.dart'
;
import
'variant_cat_new.dart'
;
class
CustomizeVariantNew
extends
State
less
Widget
{
class
CustomizeVariantNew
extends
State
ful
Widget
{
CustomizeVariantNew
({
super
.
key
,
required
this
.
orders
,
...
...
@@ -19,14 +26,17 @@ class CustomizeVariantNew extends StatelessWidget {
Orders
orders
;
List
<
VariantCategories
>
variantCat
;
@override
State
<
CustomizeVariantNew
>
createState
()
=>
_CustomizeVariantNewState
();
}
class
_CustomizeVariantNewState
extends
State
<
CustomizeVariantNew
>
{
@override
Widget
build
(
BuildContext
context
)
{
void
minus
()
{}
void
plus
()
{}
double
widthScreen
=
responsiveWidthScreen
(
context
);
return
Container
(
// width: widthScreen,
height:
MediaQuery
.
of
(
context
).
size
.
height
*
0.
8
,
height:
MediaQuery
.
of
(
context
).
size
.
height
*
0.
7
,
decoration:
const
BoxDecoration
(
borderRadius:
BorderRadius
.
only
(
topLeft:
Radius
.
circular
(
19
),
...
...
@@ -34,140 +44,345 @@ class CustomizeVariantNew extends StatelessWidget {
),
color:
backgroundWhite
,
),
child:
Stack
(
children:
[
Container
(
padding:
const
EdgeInsets
.
symmetric
(
horizontal:
paddingLeftRight
),
child:
Column
(
mainAxisSize:
MainAxisSize
.
min
,
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
const
SizedBox
(
height:
8
,
),
Center
(
child:
Container
(
width:
50
,
height:
3
,
decoration:
BoxDecoration
(
borderRadius:
BorderRadius
.
circular
(
7
),
color:
disabledColor
,
child:
BlocBuilder
<
OrdersBloc
,
List
<
Orders
>>
(
builder:
(
context
,
listCurrentOrder
)
{
int
indexOrders
=
listCurrentOrder
.
indexWhere
((
value
)
=>
value
==
widget
.
orders
);
if
(
indexOrders
==
-
1
)
{
Navigator
.
pop
(
context
);
}
return
Stack
(
children:
[
Container
(
padding:
const
EdgeInsets
.
symmetric
(
horizontal:
paddingLeftRight
),
child:
Column
(
mainAxisSize:
MainAxisSize
.
min
,
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
const
SizedBox
(
height:
8
,
),
),
),
const
SizedBox
(
height:
28
,
),
defaultText
(
context
,
'Nasi Ayam Kecap + Telur'
,
maxLines:
2
,
overFlow:
TextOverflow
.
ellipsis
,
style:
textStyleVariantModal
(
font:
20
,
fontWeight:
FontWeight
.
w600
,
),
),
const
SizedBox
(
height:
12
,
),
Expanded
(
child:
ListView
.
builder
(
itemCount:
10
,
itemBuilder:
(
context
,
i
)
{
return
Column
(
children:
[
Row
(
crossAxisAlignment:
CrossAxisAlignment
.
end
,
mainAxisAlignment:
MainAxisAlignment
.
spaceBetween
,
Center
(
child:
Container
(
width:
50
,
height:
3
,
decoration:
BoxDecoration
(
borderRadius:
BorderRadius
.
circular
(
7
),
color:
disabledColor
,
),
),
),
const
SizedBox
(
height:
28
,
),
defaultText
(
context
,
widget
.
orders
.
namaMenu
,
maxLines:
2
,
overFlow:
TextOverflow
.
ellipsis
,
style:
textStyleVariantModal
(
font:
20
,
fontWeight:
FontWeight
.
w600
,
),
),
const
SizedBox
(
height:
12
,
),
Expanded
(
child:
ListView
.
builder
(
itemCount:
widget
.
orders
.
orderDetail
.
length
,
itemBuilder:
(
context
,
i
)
{
int
totalHarga
=
widget
.
orders
.
orderDetail
[
i
].
totalHarga
.
toInt
();
int
totalItem
=
widget
.
orders
.
orderDetail
[
i
].
totalItem
.
toInt
();
int
satuanHarga
=
totalHarga
~/
totalItem
;
return
Column
(
children:
[
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
Row
(
crossAxisAlignment:
CrossAxisAlignment
.
end
,
mainAxisAlignment:
MainAxisAlignment
.
spaceBetween
,
children:
[
Container
(
padding:
const
EdgeInsets
.
only
(
bottom:
8
),
child:
defaultText
(
context
,
'2 X 25,000'
,
maxLines:
1
,
overFlow:
TextOverflow
.
ellipsis
,
style:
textStyleVariantModal
(),
),
),
Column
(
mainAxisSize:
MainAxisSize
.
min
,
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
for
(
int
d
=
0
;
d
<
3
;
d
++)
defaultText
(
Container
(
padding:
const
EdgeInsets
.
only
(
bottom:
8
),
child:
defaultText
(
context
,
'Pedas ke
$d
'
,
"Rp
${formatNumber().format(widget.orders.orderDetail[i].totalHarga)}
"
,
maxLines:
1
,
overFlow:
TextOverflow
.
ellipsis
,
)
style:
textStyleVariantModal
(
fontWeight:
FontWeight
.
w600
,
),
),
),
Column
(
mainAxisSize:
MainAxisSize
.
min
,
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
for
(
int
d
=
0
;
d
<
widget
.
orders
.
orderDetail
[
i
]
.
orderVariant
.
length
;
d
++)
defaultText
(
context
,
widget
.
orders
.
orderDetail
[
i
]
.
orderVariant
[
d
].
name
,
maxLines:
1
,
overFlow:
TextOverflow
.
ellipsis
,
)
],
),
(
widget
.
orders
.
orderDetail
[
i
].
note
!=
''
)
?
Container
(
padding:
const
EdgeInsets
.
only
(
bottom:
8
,
top:
8
,
),
child:
defaultText
(
context
,
'Catatan:
${widget.orders.orderDetail[i].note}
'
,
maxLines:
3
,
overFlow:
TextOverflow
.
ellipsis
,
style:
textStyleVariantModal
(),
),
)
:
const
SizedBox
()
],
),
Container
(
padding:
const
EdgeInsets
.
only
(
bottom:
8
,
top:
8
,
),
child:
defaultText
(
context
,
'Catatan: catatan....'
,
maxLines:
3
,
overFlow:
TextOverflow
.
ellipsis
,
style:
textStyleVariantModal
(),
),
Stack
(
children:
[
Container
(
width:
94
,
height:
22
,
decoration:
BoxDecoration
(
borderRadius:
BorderRadius
.
circular
(
30
),
color:
backgroundColor
,
),
child:
Center
(
child:
defaultText
(
context
,
widget
.
orders
.
orderDetail
[
i
]
.
totalItem
.
toString
(),
style:
amountViewBillButton
(),
),
),
),
Positioned
(
left:
0
,
child:
GestureDetector
(
onTap:
()
{
OrderDetail
orderDetailNow
=
OrderDetail
(
allIdVariant:
widget
.
orders
.
orderDetail
[
i
]
.
allIdVariant
,
totalItem:
widget
.
orders
.
orderDetail
[
i
]
.
totalItem
-
1
,
totalHarga:
widget
.
orders
.
orderDetail
[
i
]
.
totalHarga
-
satuanHarga
,
note:
widget
.
orders
.
orderDetail
[
i
].
note
,
orderVariant:
widget
.
orders
.
orderDetail
[
i
]
.
orderVariant
,
);
Map
<
String
,
dynamic
>
insertData
=
{
'action'
:
'editVariant'
,
'list_orders'
:
listCurrentOrder
,
'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:
()
{
OrderDetail
orderDetailNow
=
OrderDetail
(
allIdVariant:
widget
.
orders
.
orderDetail
[
i
]
.
allIdVariant
,
totalItem:
widget
.
orders
.
orderDetail
[
i
]
.
totalItem
+
1
,
totalHarga:
widget
.
orders
.
orderDetail
[
i
]
.
totalHarga
+
satuanHarga
,
note:
widget
.
orders
.
orderDetail
[
i
].
note
,
orderVariant:
widget
.
orders
.
orderDetail
[
i
]
.
orderVariant
,
);
Map
<
String
,
dynamic
>
insertData
=
{
'action'
:
'editVariant'
,
'list_orders'
:
listCurrentOrder
,
'single_order_detail'
:
orderDetailNow
,
};
context
.
read
<
OrdersBloc
>()
.
insertData
(
insertData
);
setState
(()
{});
// context
// .read<OrderDetailVariant>()
// .orderDetail(
// orders.orderDetail[i]
// .allIdVariant,
// orders.orderDetail[i]
// .totalItem +
// 1,
// orders.orderDetail[i]
// .totalHarga +
// satuanHarga,
// orders
// .orderDetail[i].note,
// orders.orderDetail[i]
// .orderVariant,
// context,
// orders,
// listCurrentOrder);
// orders.orderDetail[i].totalItem +
// 1;
// orders.orderDetail[i].totalHarga +
// satuanHarga;
},
child:
Container
(
width:
22
,
height:
22
,
child:
Image
(
image:
AssetImage
((
isExcelso
)
?
'assets/icons/plus-gold.png'
:
'assets/icons/plus.png'
),
),
),
),
)
],
),
],
),
PlusMinusButton
(
initialValue:
1
,
minus:
minus
,
plus:
plus
,
)
const
SizedBox
(
height:
12
,
),
(
i
!=
widget
.
orders
.
orderDetail
.
length
-
1
)
?
const
Divider
(
thickness:
1
,
height:
1
,
color:
dividerGrey
,
)
:
const
SizedBox
(),
(
i
!=
widget
.
orders
.
orderDetail
.
length
-
1
)
?
const
SizedBox
(
height:
16
,
)
:
const
SizedBox
(),
(
i
==
widget
.
orders
.
orderDetail
.
length
-
1
)
?
const
SizedBox
(
height:
65
,
)
:
const
SizedBox
()
],
),
const
SizedBox
(
height:
12
,
),
const
Divider
(
thickness:
1
,
height:
1
,
color:
dividerGrey
,
),
const
SizedBox
(
height:
16
,
),
],
);
}),
)
],
),
),
Positioned
(
bottom:
0
,
child:
Container
(
padding:
const
EdgeInsets
.
symmetric
(
horizontal:
paddingLeftRight
),
height:
43
,
width:
MediaQuery
.
of
(
context
).
size
.
width
,
decoration:
BoxDecoration
(
color:
buttonColor
,
borderRadius:
BorderRadius
.
circular
(
48
),
),
child:
Center
(
child:
defaultText
(
context
,
'Tambah Variant'
,
style:
addButton
(),
);
}),
)
],
),
),
),
)
],
Positioned
(
bottom:
0
,
child:
Container
(
height:
59
,
width:
MediaQuery
.
of
(
context
).
size
.
width
,
padding:
const
EdgeInsets
.
only
(
left:
paddingLeftRight
,
right:
paddingLeftRight
,
bottom:
16
,
),
color:
backgroundWhite
,
child:
GestureDetector
(
onTap:
()
{
Navigator
.
pop
(
context
);
Navigator
.
push
(
context
,
MaterialPageRoute
(
builder:
(
_
)
=>
VariantCatNew
(
initPrice:
widget
.
orders
.
satuanHarga
,
variantCategories:
widget
.
variantCat
,
namaMenu:
widget
.
orders
.
namaMenu
,
idItem:
widget
.
orders
.
id
,
imageUrl:
widget
.
orders
.
imageUrl
,
listCurrentOrder:
listCurrentOrder
,
),
),
);
},
child:
Container
(
height:
43
,
width:
double
.
infinity
,
decoration:
BoxDecoration
(
color:
buttonColor
,
borderRadius:
BorderRadius
.
circular
(
48
),
),
child:
Center
(
child:
defaultText
(
context
,
'Tambah Variant'
,
style:
addButton
(),
),
),
),
),
),
)
],
);
},
),
);
}
...
...
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