Fakultas Ilmu Komputer UI

Commit d83d192f authored by Tsamara Esperanti Erwin's avatar Tsamara Esperanti Erwin
Browse files

[RED] Edit error test on summary

parent bb1e56ce
Pipeline #62327 failed with stages
in 3 minutes and 52 seconds
......@@ -135,7 +135,6 @@ class _KeranjangBody extends StatelessWidget {
class _ItemBody extends StatelessWidget {
final CartItem item;
static const int int64MaxValue = 9223372036854775807;
const _ItemBody({Key key, @required this.item}) : super(key: key);
@override
Widget build(BuildContext context) {
......@@ -156,9 +155,7 @@ class _ItemBody extends StatelessWidget {
(create: (_) => CounterItem(
total: item.quantity,
minimum: 0,
maksimum: item.product.preOrder
? int64MaxValue
: item.product.stock),
maksimum: item.product.stock),
child: _CartDescription(cartItem: item)),
),
),
......@@ -201,7 +198,6 @@ class _CartDescription extends StatelessWidget {
PriceTextFormatter(
price: '${cartItem.product.price}',
),
if (cartItem.product.preOrder) const Text('Preorder')
],
),
Column(
......@@ -320,7 +316,6 @@ class _CartDescription extends StatelessWidget {
class _ModalCartItem extends StatelessWidget {
final CartItem cartItem;
static const int int64MaxValue = 9223372036854775807;
const _ModalCartItem({Key key, @required this.cartItem})
: assert(cartItem != null),
......@@ -331,9 +326,7 @@ class _ModalCartItem extends StatelessWidget {
create: (_) => CounterItem(
total: cartItem.quantity,
minimum: 0,
maksimum: cartItem.product.preOrder
? int64MaxValue
: cartItem.product.stock),
maksimum: cartItem.product.stock),
child: Builder(
builder: (BuildContext context) {
return Padding(
......@@ -385,9 +378,7 @@ class _ModalCartItem extends StatelessWidget {
fontSize: 20),
),
Text(
cartItem.product.preOrder
? 'Preorder'
: 'Stok: '
'Stok: '
'${cartItem.product.stock}',
style: const TextStyle(fontSize: 17),
)
......
......@@ -157,7 +157,6 @@ class ProductGrid extends StatelessWidget {
PriceTextFormatter(
price: _product.price,
),
if (_product.preOrder) const Text('Preorder')
],
),
),
......
......@@ -96,7 +96,7 @@ class _ProductDescription extends StatelessWidget {
),
),
Text(
product.preOrder ? 'Preorder' : 'Stock: ${product.stock}',
'Stock: ${product.stock}',
style: const TextStyle(
fontSize: 15,
color: Colors.black54,
......
......@@ -40,7 +40,6 @@ class _BodyDetailProduct extends StatelessWidget {
}) : super(key: key);
final Product product;
static const int int64MaxValue = 9223372036854775807;
@override
Widget build(BuildContext context) {
......@@ -48,7 +47,7 @@ class _BodyDetailProduct extends StatelessWidget {
create: (context) => CounterItem(
total: 1,
minimum: 1,
maksimum: product.preOrder ? int64MaxValue : product.stock),
maksimum: product.stock),
child: Builder(
builder: (BuildContext context) {
return LayoutBuilder(
......@@ -105,9 +104,7 @@ class _BodyDetailProduct extends StatelessWidget {
fontSize: 20),
),
Text(
product.preOrder
? 'Preorder'
: 'Stok: ${product.stock}',
'Stok: ${product.stock}',
style:
const TextStyle(fontSize: 17),
)
......
......@@ -18,14 +18,11 @@ class Product extends Equatable {
@JsonKey(nullable: true)
final int stock;
final bool preOrder;
@JsonKey(nullable: true)
final String image;
const Product(
{this.id,
this.preOrder,
this.name,
this.category,
this.categoryName,
......@@ -52,6 +49,5 @@ class Product extends Equatable {
price,
stock,
image,
preOrder
];
}
......@@ -9,7 +9,6 @@ part of 'product.dart';
Product _$ProductFromJson(Map<String, dynamic> json) {
return Product(
id: json['id'] as String,
preOrder: json['pre_order'] as bool,
name: json['name'] as String,
category: json['category'] as String,
categoryName: json['category_name'] as String,
......@@ -32,6 +31,5 @@ Map<String, dynamic> _$ProductToJson(Product instance) => <String, dynamic>{
'description': instance.description,
'price': instance.price,
'stock': instance.stock,
'pre_order': instance.preOrder,
'image': instance.image,
};
......@@ -622,16 +622,7 @@ class _ItemCart extends StatelessWidget {
.copyWith(
fontSize: 18, color: Theme
.of(context)
.primaryColor),
children: <TextSpan>[
if (cartItem.product.preOrder)
TextSpan(
text: ' - preorder',
style: Theme
.of(context)
.textTheme
.subtitle1)
])),
.primaryColor))),
trailing: PriceTextFormatter(
price: '${cartItem.quantity * double.parse(cartItem.product.price)}',
style: const TextStyle(
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment