1
0
Fork 0
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
thesis_shop/lib/screens/product_list/cart_button.dart

24 lines
822 B

import 'package:flutter/material.dart';
import 'package:flutter_redux/flutter_redux.dart';
import 'package:thesis_shop/benchmark_counter.dart';
import 'package:thesis_shop/redux/state.dart';
import 'package:thesis_shop/route_key.dart';
class CartButton extends StatelessWidget {
const CartButton() : super(key: const Key('cart_button'));
@override
Widget build(BuildContext context) {
return StoreConnector<AppState, int>(
converter: (store) => store.state.cart.length,
builder: (context, itemCount) {
BenchmarkCounters.cartButton++;
return ElevatedButton.icon(
onPressed: () => Navigator.of(context).pushRouteKey(RouteKey.cart),
icon: const Icon(Icons.shopping_basket),
label: Text('Warenkorb ($itemCount Produkte)'),
);
},
);
}
}