mirror of
https://github.com/git-touch/git-touch
synced 2024-12-16 18:28:51 +01:00
feat: adapter picker for material theme
This commit is contained in:
parent
cb8a8799ab
commit
fb4c12d1a5
@ -190,12 +190,12 @@ class ThemeModel with ChangeNotifier {
|
|||||||
|
|
||||||
static Timer _debounce;
|
static Timer _debounce;
|
||||||
|
|
||||||
Future<T> showPicker<T>(
|
showPicker<T>(
|
||||||
BuildContext context, {
|
BuildContext context, {
|
||||||
@required T initialValue,
|
@required T initialValue,
|
||||||
@required List<PickerItem<T>> items,
|
@required List<PickerItem<T>> items,
|
||||||
@required Function(T item) onChange,
|
@required Function(T item) onChange,
|
||||||
}) {
|
}) async {
|
||||||
switch (theme) {
|
switch (theme) {
|
||||||
case AppThemeMap.cupertino:
|
case AppThemeMap.cupertino:
|
||||||
return showCupertinoModalPopup<T>(
|
return showCupertinoModalPopup<T>(
|
||||||
@ -220,12 +220,18 @@ class ThemeModel with ChangeNotifier {
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
default:
|
default:
|
||||||
return showModalBottomSheet<T>(
|
final value = await showMenu<T>(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (context) {
|
initialValue: initialValue,
|
||||||
return null; // TODO:
|
items: items
|
||||||
},
|
.map((item) =>
|
||||||
|
PopupMenuItem(value: item.value, child: Text(item.text)))
|
||||||
|
.toList(),
|
||||||
|
position: RelativeRect.fill,
|
||||||
);
|
);
|
||||||
|
if (value != null) {
|
||||||
|
onChange(value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user