fixes before build
This commit is contained in:
@@ -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,
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user