chore: remove unused theme methods
This commit is contained in:
parent
0455d5ec59
commit
3d9e2fd5e1
|
@ -213,65 +213,53 @@ class ThemeModel with ChangeNotifier {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pushGitlab(BuildContext context, String url, {bool replace = false}) {
|
|
||||||
if (url.startsWith('/')) {
|
|
||||||
push(context, '/gitlab/$url', replace: replace);
|
|
||||||
} else {
|
|
||||||
launchUrl(url);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<bool> showConfirm(BuildContext context, Widget content) {
|
Future<bool> showConfirm(BuildContext context, Widget content) {
|
||||||
switch (theme) {
|
return showCupertinoDialog(
|
||||||
case AppThemeType.cupertino:
|
context: context,
|
||||||
default:
|
builder: (context) {
|
||||||
return showCupertinoDialog(
|
return CupertinoAlertDialog(
|
||||||
context: context,
|
title: content,
|
||||||
builder: (context) {
|
actions: <Widget>[
|
||||||
return CupertinoAlertDialog(
|
CupertinoDialogAction(
|
||||||
title: content,
|
child: const Text('cancel'),
|
||||||
actions: <Widget>[
|
isDefaultAction: true,
|
||||||
CupertinoDialogAction(
|
onPressed: () {
|
||||||
child: const Text('cancel'),
|
Navigator.pop(context, false);
|
||||||
isDefaultAction: true,
|
},
|
||||||
onPressed: () {
|
),
|
||||||
Navigator.pop(context, false);
|
CupertinoDialogAction(
|
||||||
},
|
child: const Text('OK'),
|
||||||
),
|
onPressed: () {
|
||||||
CupertinoDialogAction(
|
Navigator.pop(context, true);
|
||||||
child: const Text('OK'),
|
},
|
||||||
onPressed: () {
|
),
|
||||||
Navigator.pop(context, true);
|
],
|
||||||
},
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
);
|
||||||
// default:
|
},
|
||||||
// return showDialog(
|
);
|
||||||
// context: context,
|
// default:
|
||||||
// builder: (BuildContext context) {
|
// return showDialog(
|
||||||
// return AlertDialog(
|
// context: context,
|
||||||
// content: content,
|
// builder: (BuildContext context) {
|
||||||
// actions: <Widget>[
|
// return AlertDialog(
|
||||||
// FlatButton(
|
// content: content,
|
||||||
// child: const Text('CANCEL'),
|
// actions: <Widget>[
|
||||||
// onPressed: () {
|
// FlatButton(
|
||||||
// Navigator.pop(context, false);
|
// child: const Text('CANCEL'),
|
||||||
// },
|
// onPressed: () {
|
||||||
// ),
|
// Navigator.pop(context, false);
|
||||||
// FlatButton(
|
// },
|
||||||
// child: const Text('OK'),
|
// ),
|
||||||
// onPressed: () {
|
// FlatButton(
|
||||||
// Navigator.pop(context, true);
|
// child: const Text('OK'),
|
||||||
// },
|
// onPressed: () {
|
||||||
// )
|
// Navigator.pop(context, true);
|
||||||
// ],
|
// },
|
||||||
// );
|
// )
|
||||||
// },
|
// ],
|
||||||
// );
|
// );
|
||||||
}
|
// },
|
||||||
|
// );
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<T> showDialogOptions<T>(
|
Future<T> showDialogOptions<T>(
|
||||||
|
@ -332,69 +320,45 @@ class ThemeModel with ChangeNotifier {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
showSelector<T>({
|
|
||||||
@required BuildContext context,
|
|
||||||
@required Iterable<SelectorItem<T>> items,
|
|
||||||
@required T selected,
|
|
||||||
}) async {
|
|
||||||
switch (theme) {
|
|
||||||
case AppThemeType.cupertino:
|
|
||||||
default:
|
|
||||||
return showMenu<T>(
|
|
||||||
context: context,
|
|
||||||
initialValue: selected,
|
|
||||||
items: items
|
|
||||||
.map((item) =>
|
|
||||||
PopupMenuItem(value: item.value, child: Text(item.text)))
|
|
||||||
.toList(),
|
|
||||||
position: RelativeRect.fromLTRB(1, 10, 0, 0),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static Timer _debounce;
|
static Timer _debounce;
|
||||||
String _selectedItem;
|
String _selectedItem;
|
||||||
|
|
||||||
showPicker(BuildContext context, PickerGroupItem<String> groupItem) async {
|
showPicker(BuildContext context, PickerGroupItem<String> groupItem) async {
|
||||||
switch (theme) {
|
await showCupertinoModalPopup(
|
||||||
case AppThemeType.cupertino:
|
context: context,
|
||||||
default:
|
builder: (context) {
|
||||||
await showCupertinoModalPopup(
|
return Container(
|
||||||
context: context,
|
height: 216,
|
||||||
builder: (context) {
|
child: CupertinoPicker(
|
||||||
return Container(
|
backgroundColor: palette.background,
|
||||||
height: 216,
|
children: <Widget>[
|
||||||
child: CupertinoPicker(
|
for (var v in groupItem.items)
|
||||||
backgroundColor: palette.background,
|
Text(v.text, style: TextStyle(color: palette.text)),
|
||||||
children: <Widget>[
|
],
|
||||||
for (var v in groupItem.items)
|
itemExtent: 40,
|
||||||
Text(v.text, style: TextStyle(color: palette.text)),
|
scrollController: FixedExtentScrollController(
|
||||||
],
|
initialItem: groupItem.items
|
||||||
itemExtent: 40,
|
.toList()
|
||||||
scrollController: FixedExtentScrollController(
|
.indexWhere((v) => v.value == groupItem.value)),
|
||||||
initialItem: groupItem.items
|
onSelectedItemChanged: (index) {
|
||||||
.toList()
|
_selectedItem = groupItem.items[index].value;
|
||||||
.indexWhere((v) => v.value == groupItem.value)),
|
|
||||||
onSelectedItemChanged: (index) {
|
|
||||||
_selectedItem = groupItem.items[index].value;
|
|
||||||
|
|
||||||
if (groupItem.onChange != null) {
|
if (groupItem.onChange != null) {
|
||||||
if (_debounce?.isActive ?? false) {
|
if (_debounce?.isActive ?? false) {
|
||||||
_debounce.cancel();
|
_debounce.cancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
_debounce = Timer(const Duration(milliseconds: 500), () {
|
_debounce = Timer(const Duration(milliseconds: 500), () {
|
||||||
groupItem.onChange(_selectedItem);
|
groupItem.onChange(_selectedItem);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
);
|
||||||
if (groupItem.onClose != null) {
|
},
|
||||||
groupItem.onClose(_selectedItem);
|
);
|
||||||
}
|
if (groupItem.onClose != null) {
|
||||||
|
groupItem.onClose(_selectedItem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue