Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: #1126 More appealing empty history screen #1212

Merged
merged 6 commits into from
Mar 16, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import 'package:smooth_app/database/dao_product.dart';
import 'package:smooth_app/database/dao_product_list.dart';
import 'package:smooth_app/database/local_database.dart';
import 'package:smooth_app/database/product_query.dart';
import 'package:smooth_app/generic_lib/design_constants.dart';
import 'package:smooth_app/generic_lib/loading_dialog.dart';
import 'package:smooth_app/pages/personalized_ranking_page.dart';
import 'package:smooth_app/pages/product/common/product_list_item_simple.dart';
Expand All @@ -32,6 +33,7 @@ class _ProductListPageState extends State<ProductListPage> {
Widget build(BuildContext context) {
final LocalDatabase localDatabase = context.watch<LocalDatabase>();
final DaoProductList daoProductList = DaoProductList(localDatabase);
final ThemeData themeData = Theme.of(context);
final ColorScheme colorScheme = Theme.of(context).colorScheme;
final AppLocalizations appLocalizations = AppLocalizations.of(context)!;
if (first) {
Expand Down Expand Up @@ -123,9 +125,30 @@ class _ProductListPageState extends State<ProductListPage> {
),
),
body: products.isEmpty
? Center(
child: Text(appLocalizations.no_prodcut_in_list,
style: Theme.of(context).textTheme.subtitle1),
? Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Icon(
Icons.find_in_page_rounded,
color: colorScheme.primary,
size: VERY_LARGE_SPACE * 10,
semanticLabel: 'History not available',
),
Text(
'Start scanning !', // TODO(bhattabhi013): localization
style: themeData.textTheme.headlineLarge
?.apply(color: colorScheme.onBackground),
),
Padding(
padding: const EdgeInsets.all(VERY_LARGE_SPACE),
child: Text(
'Product you scan in will appear here and you can check detailed information about them', // TODO(bhattabhi013): localization
style: TextStyle(
color: colorScheme.onBackground,
),
),
)
],
)
: ListView.builder(
itemCount: products.length,
Expand Down