Fakultas Ilmu Komputer UI
Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
ppl-fasilkom-ui
PPL Sosial
pilar
pilar-mobile
Commits
208594cd
Commit
208594cd
authored
Apr 04, 2021
by
Muhammad Dzikra Muzaki
Browse files
[GREEN] Add unit column
parent
73070ff6
Pipeline
#69503
passed with stages
in 9 minutes and 10 seconds
Changes
7
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
lib/Component/price_text_formatter.dart
View file @
208594cd
...
...
@@ -3,18 +3,19 @@ import 'package:intl/intl.dart';
class
PriceTextFormatter
extends
StatelessWidget
{
final
NumberFormat
formatter
=
NumberFormat
.
currency
(
decimalDigits:
0
,
symbol:
'Rp'
);
NumberFormat
.
currency
(
decimalDigits:
0
,
symbol:
'Rp
'
);
final
String
price
;
final
String
unit
;
final
TextStyle
style
;
final
Key
keyText
;
PriceTextFormatter
({
Key
key
,
@required
this
.
price
,
this
.
style
,
this
.
keyText
})
PriceTextFormatter
({
Key
key
,
@required
this
.
price
,
this
.
unit
,
this
.
style
,
this
.
keyText
})
:
assert
(
price
!=
null
),
super
(
key:
key
);
@override
Widget
build
(
BuildContext
context
)
{
return
Text
(
formatter
.
format
(
double
.
parse
(
price
)),
unit
!=
null
?
formatter
.
format
(
double
.
parse
(
price
))
+
' / '
+
unit
:
formatter
.
format
(
double
.
parse
(
price
)),
key:
keyText
,
overflow:
TextOverflow
.
ellipsis
,
maxLines:
1
,
...
...
lib/Pages/Cart/cart.dart
View file @
208594cd
...
...
@@ -195,6 +195,7 @@ class _CartDescription extends StatelessWidget {
),
PriceTextFormatter
(
price:
'
${cartItem.product.price}
'
,
unit:
'
${cartItem.product.unit}
'
,
),
],
),
...
...
@@ -248,7 +249,7 @@ class _CartDescription extends StatelessWidget {
fontSize:
15
),
children:
<
TextSpan
>[
TextSpan
(
text:
'
${cartItem.quantity}
'
,
text:
'
${cartItem.quantity}
${cartItem.product.unit}
'
,
style:
TextStyle
(
color:
Theme
.
of
(
context
).
primaryColor
,
fontSize:
16
,
...
...
@@ -373,6 +374,7 @@ class _ModalCartItem extends StatelessWidget {
children:
<
Widget
>[
PriceTextFormatter
(
price:
cartItem
.
product
.
price
,
unit:
cartItem
.
product
.
unit
,
style:
TextStyle
(
color:
Theme
.
of
(
context
)
.
primaryColor
,
...
...
@@ -380,7 +382,7 @@ class _ModalCartItem extends StatelessWidget {
),
Text
(
'Stok: '
'
${cartItem.product.stock}
'
,
'
${cartItem.product.stock}
${cartItem.product.unit}
'
,
style:
const
TextStyle
(
fontSize:
17
),
)
],
...
...
lib/Pages/Product/component/list_product_grid.dart
View file @
208594cd
...
...
@@ -156,6 +156,7 @@ class ProductGrid extends StatelessWidget {
),
PriceTextFormatter
(
price:
_product
.
price
,
unit:
_product
.
unit
,
),
],
),
...
...
lib/Pages/Product/component/product_item_list.dart
View file @
208594cd
...
...
@@ -90,13 +90,14 @@ class _ProductDescription extends StatelessWidget {
children:
<
Widget
>[
PriceTextFormatter
(
price:
'
${product.price}
'
,
unit:
'
${product.unit}
'
,
style:
const
TextStyle
(
fontSize:
15
,
color:
Colors
.
black87
,
),
),
Text
(
'Stock:
${product.stock}
'
,
'Stock:
${product.stock}
${product.unit}
'
,
style:
const
TextStyle
(
fontSize:
15
,
color:
Colors
.
black54
,
...
...
lib/Pages/Product/detail_product.dart
View file @
208594cd
...
...
@@ -98,13 +98,14 @@ class _BodyDetailProduct extends StatelessWidget {
children:
<
Widget
>[
PriceTextFormatter
(
price:
product
.
price
,
unit:
product
.
unit
,
style:
TextStyle
(
color:
Theme
.
of
(
context
)
.
primaryColor
,
fontSize:
20
),
),
Text
(
'Stok:
${product.stock}
'
,
'Stok:
${product.stock}
${product.unit}
'
,
style:
const
TextStyle
(
fontSize:
17
),
)
...
...
lib/Pages/Product/model/product/product.dart
View file @
208594cd
...
...
@@ -14,6 +14,7 @@ class Product extends Equatable {
final
String
subcategoryName
;
final
String
description
;
final
String
price
;
final
String
unit
;
@JsonKey
(
nullable:
true
)
final
int
stock
;
...
...
@@ -31,7 +32,8 @@ class Product extends Equatable {
this
.
description
,
this
.
price
,
this
.
stock
,
this
.
image
});
this
.
image
,
this
.
unit
});
factory
Product
.
fromJson
(
Map
<
String
,
dynamic
>
json
)
=>
_$ProductFromJson
(
json
);
...
...
@@ -49,5 +51,6 @@ class Product extends Equatable {
price
,
stock
,
image
,
unit
,
];
}
lib/Pages/Product/model/product/product.g.dart
View file @
208594cd
...
...
@@ -18,6 +18,7 @@ Product _$ProductFromJson(Map<String, dynamic> json) {
price:
json
[
'price'
]
as
String
,
stock:
json
[
'stock'
]
as
int
,
image:
json
[
'image'
]
as
String
,
unit:
json
[
'unit'
]
as
String
,
);
}
...
...
@@ -32,4 +33,5 @@ Map<String, dynamic> _$ProductToJson(Product instance) => <String, dynamic>{
'price'
:
instance
.
price
,
'stock'
:
instance
.
stock
,
'image'
:
instance
.
image
,
'unit'
:
instance
.
unit
,
};
Write
Preview
Supports
Markdown
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