mirror of
https://github.com/git-touch/git-touch
synced 2025-01-31 08:04:51 +01:00
refactor: use action sheet
This commit is contained in:
parent
2ce2384578
commit
3a1877859a
@ -3,7 +3,6 @@ import 'package:flutter/material.dart';
|
||||
import 'package:git_touch/models/theme.dart';
|
||||
import 'package:git_touch/widgets/link.dart';
|
||||
import 'package:git_touch/widgets/loading.dart';
|
||||
import 'package:primer/primer.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class CommonScaffold extends StatelessWidget {
|
||||
|
@ -1,6 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:git_touch/utils/utils.dart';
|
||||
import 'package:git_touch/widgets/action_entry.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:git_touch/models/theme.dart';
|
||||
|
||||
@ -32,8 +32,9 @@ class ActionButton extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
switch (Provider.of<ThemeModel>(context).theme) {
|
||||
case AppThemeType.cupertino:
|
||||
return GestureDetector(
|
||||
child: Icon(iconData, size: 24),
|
||||
default:
|
||||
return ActionEntry(
|
||||
iconData: iconData,
|
||||
onTap: () async {
|
||||
int value = await showCupertinoModalPopup<int>(
|
||||
context: context,
|
||||
@ -62,34 +63,6 @@ class ActionButton extends StatelessWidget {
|
||||
_onSelected(value);
|
||||
},
|
||||
);
|
||||
default:
|
||||
return IconButton(
|
||||
icon: Icon(iconData),
|
||||
onPressed: () async {
|
||||
await showModalBottomSheet(
|
||||
context: context,
|
||||
builder: (_) {
|
||||
return Column(
|
||||
children: join(
|
||||
PopupMenuDivider(height: 1),
|
||||
actions.asMap().entries.map((entry) {
|
||||
return GestureDetector(
|
||||
child: PopupMenuItem(
|
||||
value: entry.key,
|
||||
child: Text(entry.value.text),
|
||||
),
|
||||
onTap: () {
|
||||
Navigator.of(context).pop();
|
||||
_onSelected(entry.key);
|
||||
},
|
||||
);
|
||||
}).toList(),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ class ActionEntry extends StatelessWidget {
|
||||
switch (Provider.of<ThemeModel>(context).theme) {
|
||||
case AppThemeType.cupertino:
|
||||
return GestureDetector(
|
||||
child: Icon(iconData),
|
||||
child: Icon(iconData, size: 22),
|
||||
onTap: onTap,
|
||||
);
|
||||
default:
|
||||
|
Loading…
x
Reference in New Issue
Block a user