Added: Some TODOs
This commit is contained in:
@@ -251,6 +251,10 @@ class _MainPageState extends State<MainPage> {
|
|||||||
foregroundColor: Colors.white,
|
foregroundColor: Colors.white,
|
||||||
child: const Icon(Icons.shopping_cart_outlined)),
|
child: const Icon(Icons.shopping_cart_outlined)),
|
||||||
),
|
),
|
||||||
|
/**
|
||||||
|
* Загадочная штука, надо переделать
|
||||||
|
* TODO: По идее надо через провайдер сделать, но не пойму как это сделать
|
||||||
|
*/
|
||||||
cartLength > 0
|
cartLength > 0
|
||||||
? Positioned(
|
? Positioned(
|
||||||
right: -3,
|
right: -3,
|
||||||
|
|||||||
20
lib/providers/cart.dart
Normal file
20
lib/providers/cart.dart
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:gymlink_module_web/tools/prefs.dart';
|
||||||
|
|
||||||
|
//TODO: Возможно нужно дорабатывать
|
||||||
|
class CartProvider extends ChangeNotifier {
|
||||||
|
int _cartLength = 0;
|
||||||
|
|
||||||
|
int get cartLength => _cartLength;
|
||||||
|
|
||||||
|
CartProvider() {
|
||||||
|
updateCartLength();
|
||||||
|
}
|
||||||
|
|
||||||
|
void updateCartLength() {
|
||||||
|
getCart().then((value) {
|
||||||
|
_cartLength = value.length;
|
||||||
|
notifyListeners();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user