upgrade-to-flutter-3 #1
|
@ -5,7 +5,7 @@ class UserProvider with ChangeNotifier {
|
|||
User _user = User.noUser;
|
||||
int _selectedTabIndex = 0;
|
||||
|
||||
List<String> _categories = ["All", "Workplace", "Equipment", "Home", "Other"];
|
||||
List<String> _categories = ["Workplace", "Equipment", "Home", "Other"];
|
||||
|
||||
List<String> get categories => _categories;
|
||||
|
||||
|
|
|
@ -57,19 +57,24 @@ class _HistoryScreenState extends State<HistoryScreen> {
|
|||
children: [
|
||||
DropdownButton<String>(
|
||||
isExpanded: true,
|
||||
items: Provider.of<UserProvider>(context, listen: true)
|
||||
.categories
|
||||
.map((String value) {
|
||||
return DropdownMenuItem<String>(
|
||||
value: value,
|
||||
child: Text(value),
|
||||
);
|
||||
}).toList(),
|
||||
items: [
|
||||
DropdownMenuItem<String>(
|
||||
value: null,
|
||||
child: Text('All'),
|
||||
),
|
||||
...Provider.of<UserProvider>(context, listen: true)
|
||||
.categories
|
||||
.map((String value) {
|
||||
return DropdownMenuItem<String>(
|
||||
value: value,
|
||||
child: Text(value),
|
||||
);
|
||||
})
|
||||
],
|
||||
hint: new Text("Select Category"),
|
||||
value: Provider.of<TransactionProvider>(context,
|
||||
listen: true)
|
||||
.selectedCategory ??
|
||||
'All',
|
||||
.selectedCategory,
|
||||
onChanged: (String? newValue) {
|
||||
Provider.of<TransactionProvider>(context,
|
||||
listen: false)
|
||||
|
|
Loading…
Reference in a new issue