Compare commits

..

4 Commits

Author SHA1 Message Date
f182c80210 fix: price reduction on deletion 2024-06-25 22:51:14 +03:00
cefabd1c70 fix: img loading on changing search text 2024-06-25 22:36:18 +03:00
f1055d40a4 fix: remove spacer 2024-06-25 13:58:41 +03:00
cfe0184e3a fix: card width 2024-06-24 22:35:47 +03:00
4 changed files with 19 additions and 13 deletions

View File

@@ -27,9 +27,10 @@ class ProductCard extends StatelessWidget {
onTap: onTap, onTap: onTap,
child: ConstrainedBox( child: ConstrainedBox(
constraints: BoxConstraints( constraints: BoxConstraints(
minHeight: 160, minHeight: 160,
maxHeight: getCardHeight(context: context), maxHeight: getCardHeight(context: context),
), minWidth: 180,
maxWidth: 250),
child: Card( child: Card(
elevation: 3, elevation: 3,
color: Theme.of(context).scaffoldBackgroundColor, color: Theme.of(context).scaffoldBackgroundColor,

View File

@@ -155,6 +155,8 @@ class _BasketPageState extends State<BasketPage> {
removeItemFromCart(id); removeItemFromCart(id);
setState(() { setState(() {
cartItems.removeWhere((element) => element.id == id); cartItems.removeWhere((element) => element.id == id);
totalPrice = cartItems.fold(
0, (sum, item) => sum + item.price * item.localCount);
}); });
if (mounted) { if (mounted) {
_updateCart(); _updateCart();
@@ -311,7 +313,7 @@ class _BasketPageState extends State<BasketPage> {
), ),
), ),
), ),
_buildSpacer(), // _buildSpacer(),
Padding( Padding(
padding: const EdgeInsetsDirectional.symmetric( padding: const EdgeInsetsDirectional.symmetric(
horizontal: 10, vertical: 10), horizontal: 10, vertical: 10),
@@ -354,7 +356,7 @@ class _BasketPageState extends State<BasketPage> {
], ],
), ),
), ),
const SizedBox(width: 50), // const SizedBox(width: 50),
], ],
), ),
), ),

View File

@@ -10,7 +10,6 @@ import 'package:gymlink_module_web/pages/order_history.dart';
import 'package:gymlink_module_web/providers/cart.dart'; import 'package:gymlink_module_web/providers/cart.dart';
import 'package:gymlink_module_web/tools/items.dart'; import 'package:gymlink_module_web/tools/items.dart';
import 'package:gymlink_module_web/tools/prefs.dart'; import 'package:gymlink_module_web/tools/prefs.dart';
import 'package:gymlink_module_web/tools/relative.dart';
import 'package:gymlink_module_web/tools/routes.dart'; import 'package:gymlink_module_web/tools/routes.dart';
import 'package:gymlink_module_web/tools/text.dart'; import 'package:gymlink_module_web/tools/text.dart';
import 'package:lazy_load_scrollview/lazy_load_scrollview.dart'; import 'package:lazy_load_scrollview/lazy_load_scrollview.dart';
@@ -74,6 +73,7 @@ class _MainPageState extends State<MainPage> {
List<GymCategory> categories = []; List<GymCategory> categories = [];
GymCategory? selectedCategory; GymCategory? selectedCategory;
final ScrollController _scrollController = ScrollController(); final ScrollController _scrollController = ScrollController();
final TextEditingController _searchField = TextEditingController();
@override @override
void initState() { void initState() {
@@ -124,6 +124,9 @@ class _MainPageState extends State<MainPage> {
void _onSearch() { void _onSearch() {
final categoryId = selectedCategory == null ? '' : selectedCategory!.id; final categoryId = selectedCategory == null ? '' : selectedCategory!.id;
setState(() {
searchText = _searchField.text.trim().toLowerCase();
});
_searchItems(searchText: searchText, categoryId: categoryId); _searchItems(searchText: searchText, categoryId: categoryId);
} }
@@ -142,12 +145,13 @@ class _MainPageState extends State<MainPage> {
children: [ children: [
Expanded( Expanded(
child: TextField( child: TextField(
onChanged: (value) => setState(() { onChanged: (value) {
searchText = value.trim().toLowerCase(); searchText = value.trim().toLowerCase();
if (searchText == '') { if (searchText == '') {
_onSearch(); _onSearch();
} }
}), },
controller: _searchField,
textInputAction: TextInputAction.search, textInputAction: TextInputAction.search,
onSubmitted: (_) => _onSearch(), onSubmitted: (_) => _onSearch(),
decoration: InputDecoration( decoration: InputDecoration(
@@ -179,7 +183,7 @@ class _MainPageState extends State<MainPage> {
), ),
), ),
), ),
getSpacer(context: context, flex: 2), // getSpacer(context: context, flex: 2),
const SizedBox( const SizedBox(
width: 8, width: 8,
), ),

View File

@@ -7,7 +7,6 @@ import 'package:gymlink_module_web/components/heading.dart';
import 'package:gymlink_module_web/components/history_item_card.dart'; import 'package:gymlink_module_web/components/history_item_card.dart';
import 'package:gymlink_module_web/interfaces/items.dart'; import 'package:gymlink_module_web/interfaces/items.dart';
import 'package:gymlink_module_web/tools/history.dart'; import 'package:gymlink_module_web/tools/history.dart';
import 'package:gymlink_module_web/tools/relative.dart';
import 'package:lazy_load_scrollview/lazy_load_scrollview.dart'; import 'package:lazy_load_scrollview/lazy_load_scrollview.dart';
List<Map<String, String>> orders = [ List<Map<String, String>> orders = [
@@ -179,9 +178,9 @@ class _HistoryPageState extends State<HistoryPage> {
), ),
), ),
), ),
my_orders.isEmpty // my_orders.isEmpty
? const SizedBox.shrink() // ? const SizedBox.shrink()
: getSpacer(context: context) // : getSpacer(context: context)
], ],
), ),
), ),