Fix: category colors and count elements
This commit is contained in:
@@ -46,7 +46,7 @@ android {
|
||||
// You can update the following values to match your application needs.
|
||||
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
|
||||
minSdkVersion 21
|
||||
targetSdkVersion flutter.targetSdkVersion
|
||||
targetSdkVersion 34
|
||||
versionCode flutterVersionCode.toInteger()
|
||||
versionName flutterVersionName
|
||||
}
|
||||
|
||||
@@ -109,13 +109,16 @@ class _BasketPageState extends State<BasketPage> {
|
||||
}
|
||||
|
||||
void addItem(String id) async {
|
||||
setState(() {
|
||||
final item =
|
||||
cartItems.firstWhere((element) => element.id == id, orElse: () {
|
||||
final cartItem = gymCart.firstWhere((element) => element.id == id);
|
||||
cartItem.localCount = 0;
|
||||
return cartItem;
|
||||
});
|
||||
if (item.localCount + 1 > item.count) {
|
||||
return;
|
||||
}
|
||||
setState(() {
|
||||
item.localCount++;
|
||||
cartItems[cartItems.indexOf(item)].localCount = item.localCount;
|
||||
totalPrice =
|
||||
|
||||
@@ -269,13 +269,19 @@ class _DetailPageState extends State<DetailPage> {
|
||||
item!.images[0].url,
|
||||
height: 400,
|
||||
),
|
||||
Padding(
|
||||
Center(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 10),
|
||||
child: Center(
|
||||
child: Text(categoryName != null
|
||||
? 'Категория: ${categoryName == "" ? "Без категории" : categoryName}'
|
||||
child: Chip(
|
||||
label: Text(categoryName != null
|
||||
? (categoryName == ""
|
||||
? "Без категории"
|
||||
: categoryName!)
|
||||
: ''),
|
||||
)),
|
||||
backgroundColor: Colors.white,
|
||||
),
|
||||
),
|
||||
),
|
||||
Center(
|
||||
child: MarkdownBody(
|
||||
data: '### Отстаток: _${item!.count}_',
|
||||
|
||||
@@ -8,7 +8,6 @@ import 'package:gymlink_module_web/pages/basket.dart';
|
||||
import 'package:gymlink_module_web/pages/detail.dart';
|
||||
import 'package:gymlink_module_web/pages/order_history.dart';
|
||||
import 'package:gymlink_module_web/providers/cart.dart';
|
||||
import 'package:gymlink_module_web/providers/main.dart';
|
||||
import 'package:gymlink_module_web/tools/items.dart';
|
||||
import 'package:gymlink_module_web/tools/prefs.dart';
|
||||
import 'package:gymlink_module_web/tools/relative.dart';
|
||||
@@ -148,6 +147,8 @@ class _MainPageState extends State<MainPage> {
|
||||
_onSearch();
|
||||
}
|
||||
}),
|
||||
textInputAction: TextInputAction.search,
|
||||
onSubmitted: (_) => _onSearch(),
|
||||
decoration: InputDecoration(
|
||||
hintText: 'Поиск',
|
||||
border: OutlineInputBorder(
|
||||
@@ -231,12 +232,8 @@ class _MainPageState extends State<MainPage> {
|
||||
horizontal: 10, vertical: 10),
|
||||
child: Chip(
|
||||
label: Text(category.name),
|
||||
//FIXME: проблема с цветом
|
||||
backgroundColor: selectedCategory == category
|
||||
? context
|
||||
.read<GymLinkProvider>()
|
||||
.theme
|
||||
.primaryColorLight
|
||||
? Theme.of(context).primaryColor
|
||||
: Colors.white,
|
||||
labelStyle: TextStyle(
|
||||
color: selectedCategory == category
|
||||
|
||||
Reference in New Issue
Block a user