From 3baa33a838b2124296d1467539432646724f0c85 Mon Sep 17 00:00:00 2001 From: Moutia Benachour Date: Sun, 11 Sep 2022 17:10:44 +0100 Subject: [PATCH] fix transaction filter --- lib/providers/user_provider.dart | 2 +- lib/screens/history/history.dart | 25 +++++++++++++++---------- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/lib/providers/user_provider.dart b/lib/providers/user_provider.dart index 45d8daf..b24cbde 100644 --- a/lib/providers/user_provider.dart +++ b/lib/providers/user_provider.dart @@ -5,7 +5,7 @@ class UserProvider with ChangeNotifier { User _user = User.noUser; int _selectedTabIndex = 0; - List _categories = ["All", "Workplace", "Equipment", "Home", "Other"]; + List _categories = ["Workplace", "Equipment", "Home", "Other"]; List get categories => _categories; diff --git a/lib/screens/history/history.dart b/lib/screens/history/history.dart index b09ebcb..a187b28 100644 --- a/lib/screens/history/history.dart +++ b/lib/screens/history/history.dart @@ -57,19 +57,24 @@ class _HistoryScreenState extends State { children: [ DropdownButton( isExpanded: true, - items: Provider.of(context, listen: true) - .categories - .map((String value) { - return DropdownMenuItem( - value: value, - child: Text(value), - ); - }).toList(), + items: [ + DropdownMenuItem( + value: null, + child: Text('All'), + ), + ...Provider.of(context, listen: true) + .categories + .map((String value) { + return DropdownMenuItem( + value: value, + child: Text(value), + ); + }) + ], hint: new Text("Select Category"), value: Provider.of(context, listen: true) - .selectedCategory ?? - 'All', + .selectedCategory, onChanged: (String? newValue) { Provider.of(context, listen: false)