Sync cart with flutter_lints v2.0.1

This commit is contained in:
Moe Poi ~ 2022-05-12 10:28:55 +07:00
parent ba02ccbb3c
commit 4851d4a40f

View file

@ -34,7 +34,7 @@ class _CartState extends State<Cart> {
}); });
} }
Future<dynamic> _getTotal = getTotal(); Future<dynamic> getTotal_ = getTotal();
return Scaffold( return Scaffold(
backgroundColor: const Color(0xff1b1c1e), backgroundColor: const Color(0xff1b1c1e),
@ -62,28 +62,28 @@ class _CartState extends State<Cart> {
if (productData != null) { if (productData != null) {
return CartBox( return CartBox(
controller: true, controller: true,
imageUrl: 'https://nekoya.moe.team/img/' + productData[0]['IMAGE'], imageUrl: "https://nekoya.moe.team/img/${productData[0]['IMAGE']}",
title: productData[0]['TITLE'], title: productData[0]['TITLE'],
quantity: data[index]["quantity"], quantity: data[index]["quantity"],
plus: () { plus: () {
addToCart(data[index]["product_id"]); addToCart(data[index]["product_id"]);
setState(() { setState(() {
_viewCart = viewCart(); _viewCart = viewCart();
_getTotal = getTotal(); getTotal_ = getTotal();
}); });
}, },
minus: () { minus: () {
removeFromCart(data[index]["product_id"], false); removeFromCart(data[index]["product_id"], false);
setState(() { setState(() {
_viewCart = viewCart(); _viewCart = viewCart();
_getTotal = getTotal(); getTotal_ = getTotal();
}); });
}, },
remove: () { remove: () {
removeFromCart(data[index]["product_id"], true); removeFromCart(data[index]["product_id"], true);
setState(() { setState(() {
_viewCart = viewCart(); _viewCart = viewCart();
_getTotal = getTotal(); getTotal_ = getTotal();
}); });
} }
); );
@ -126,7 +126,7 @@ class _CartState extends State<Cart> {
), ),
), ),
floatingActionButton: FutureBuilder<dynamic>( floatingActionButton: FutureBuilder<dynamic>(
future: _getTotal, future: getTotal_,
builder: (context, snapshot) { builder: (context, snapshot) {
if (snapshot.hasData) { if (snapshot.hasData) {
var price = snapshot.data; var price = snapshot.data;