fixes before build

This commit is contained in:
gitea
2026-08-31 17:03:03 +02:00
parent 756f9db356
commit 14fcb9a533
7 changed files with 112 additions and 8 deletions
+14 -5
View File
@@ -180,10 +180,16 @@ class _ProductsScreenState extends State<ProductsScreen> {
for (final item in _products ?? const <Product>[])
if (item.id == product.id) item.copyWith(favourite: next) else item,
];
if (_sort == ProductSort.favourite && !next) {
_products = [
for (final item in _products!)
if (item.id != product.id) item,
];
if (_products!.isEmpty) _editing = false;
}
});
try {
await widget.repository.setFavourite(product.id, next);
if (_sort == ProductSort.start && mounted) _load();
} catch (_) {
if (mounted) _load();
}
@@ -265,11 +271,12 @@ class _ProductsScreenState extends State<ProductsScreen> {
),
ButtonSegment(
value: ProductSort.preferred,
label: Text('Preferred'),
label: Text('Frequent'),
),
ButtonSegment(
value: ProductSort.start,
label: Text('Start'),
value: ProductSort.favourite,
icon: Icon(Icons.star),
label: Text('Star'),
),
],
selected: {_sort},
@@ -311,7 +318,9 @@ class _ProductsScreenState extends State<ProductsScreen> {
if (_products!.isEmpty) {
return Center(
child: Text(
'Confirmed receipt items will show up here.',
_sort == ProductSort.favourite
? 'Star products to keep them as favourites.'
: 'Confirmed receipt items will show up here.',
textAlign: TextAlign.center,
style: theme.textTheme.bodyLarge,
),