fix: padding / history auto-reload
This commit is contained in:
@@ -14,7 +14,6 @@ class ProductListView extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _ProductListViewState extends State<ProductListView> {
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
@@ -30,14 +29,16 @@ class _ProductListViewState extends State<ProductListView> {
|
||||
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text('Products'),
|
||||
actions: [
|
||||
IconButton(
|
||||
tooltip: 'Back to bar',
|
||||
onPressed: () => context.go('/bar'),
|
||||
icon: const Icon(Icons.point_of_sale),
|
||||
),
|
||||
],
|
||||
title: Row(
|
||||
children: [
|
||||
IconButton(
|
||||
onPressed: () => context.go('/bar'),
|
||||
icon: const Icon(Icons.arrow_back),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
const Text('Products'),
|
||||
],
|
||||
),
|
||||
),
|
||||
resizeToAvoidBottomInset: false,
|
||||
floatingActionButton: FloatingActionButton.extended(
|
||||
@@ -48,21 +49,15 @@ class _ProductListViewState extends State<ProductListView> {
|
||||
body: Builder(
|
||||
builder: (context) {
|
||||
if (viewModel.isLoading) {
|
||||
return const Center(
|
||||
child: CircularProgressIndicator(),
|
||||
);
|
||||
return const Center(child: CircularProgressIndicator());
|
||||
}
|
||||
|
||||
if (viewModel.errorMessage != null) {
|
||||
return Center(
|
||||
child: Text(viewModel.errorMessage!),
|
||||
);
|
||||
return Center(child: Text(viewModel.errorMessage!));
|
||||
}
|
||||
|
||||
if (viewModel.products.isEmpty) {
|
||||
return const Center(
|
||||
child: Text('No products yet.'),
|
||||
);
|
||||
return const Center(child: Text('No products yet.'));
|
||||
}
|
||||
|
||||
return ListView.separated(
|
||||
@@ -86,8 +81,7 @@ class _ProductListViewState extends State<ProductListView> {
|
||||
),
|
||||
title: Text(product.name),
|
||||
subtitle: Text(
|
||||
'${product.category} • ${product
|
||||
.formattedPrice} • Stock: ${product.stockQuantity}',
|
||||
'${product.category} • ${product.formattedPrice} • Stock: ${product.stockQuantity}',
|
||||
),
|
||||
trailing: const Icon(Icons.chevron_right),
|
||||
onTap: () => context.go('/products/${product.id}/edit'),
|
||||
@@ -99,4 +93,4 @@ class _ProductListViewState extends State<ProductListView> {
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user