upgrade-to-flutter-3 #1

Merged
motia merged 9 commits from upgrade-to-flutter-2 into master 2022-09-11 16:22:21 +00:00
2 changed files with 16 additions and 11 deletions
Showing only changes of commit 3baa33a838 - Show all commits

View file

@ -5,7 +5,7 @@ class UserProvider with ChangeNotifier {
User _user = User.noUser; User _user = User.noUser;
int _selectedTabIndex = 0; int _selectedTabIndex = 0;
List<String> _categories = ["All", "Workplace", "Equipment", "Home", "Other"]; List<String> _categories = ["Workplace", "Equipment", "Home", "Other"];
List<String> get categories => _categories; List<String> get categories => _categories;

View file

@ -57,19 +57,24 @@ class _HistoryScreenState extends State<HistoryScreen> {
children: [ children: [
DropdownButton<String>( DropdownButton<String>(
isExpanded: true, isExpanded: true,
items: Provider.of<UserProvider>(context, listen: true) items: [
.categories DropdownMenuItem<String>(
.map((String value) { value: null,
return DropdownMenuItem<String>( child: Text('All'),
value: value, ),
child: Text(value), ...Provider.of<UserProvider>(context, listen: true)
); .categories
}).toList(), .map((String value) {
return DropdownMenuItem<String>(
value: value,
child: Text(value),
);
})
],
hint: new Text("Select Category"), hint: new Text("Select Category"),
value: Provider.of<TransactionProvider>(context, value: Provider.of<TransactionProvider>(context,
listen: true) listen: true)
.selectedCategory ?? .selectedCategory,
'All',
onChanged: (String? newValue) { onChanged: (String? newValue) {
Provider.of<TransactionProvider>(context, Provider.of<TransactionProvider>(context,
listen: false) listen: false)