save before experiment, broken
This commit is contained in:
parent
1b207c1ce6
commit
2e0802ac73
3 changed files with 103 additions and 37 deletions
|
@ -13,7 +13,7 @@ class Category {
|
|||
});
|
||||
}
|
||||
|
||||
Future<List<Category>> getCategories() async {
|
||||
Future<List<Category>> getCategories() async { // confusing name
|
||||
const url = "https://dev.peartrade.org/api/search/category";
|
||||
var token;
|
||||
|
||||
|
|
35
lib/common/widgets/future_dropdownmenu.dart
Normal file
35
lib/common/widgets/future_dropdownmenu.dart
Normal file
|
@ -0,0 +1,35 @@
|
|||
import 'package:flutter/material.dart';
|
||||
|
||||
class DropDownMenu extends StatefulWidget {
|
||||
|
||||
final List<DropdownMenuItem> items;
|
||||
final Function onChanged;
|
||||
final String value;
|
||||
|
||||
DropDownMenu({
|
||||
this.items,
|
||||
this.onChanged,
|
||||
this.value,
|
||||
});
|
||||
|
||||
@override
|
||||
_DropDownMenuState createState() => _DropDownMenuState(items: this.items, onNewValue: this.onChanged, value: this.value);
|
||||
}
|
||||
|
||||
class _DropDownMenuState extends State<DropDownMenu> {
|
||||
|
||||
final List<DropdownMenuItem> items;
|
||||
final Function onNewValue;
|
||||
final String value;
|
||||
|
||||
_DropDownMenuState({
|
||||
this.items,
|
||||
this.onNewValue,
|
||||
this.value
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return new DropdownButton(value: this.value, items: this.items, onChanged: (newValue) => onNewValue(newValue),);
|
||||
}
|
||||
}
|
Reference in a new issue