mirror of
https://github.com/git-touch/git-touch
synced 2025-02-26 16:27:50 +01:00
refactor: action sheet for material
This commit is contained in:
parent
a513dfb7c6
commit
ddf7f73d36
lib
@ -27,7 +27,7 @@ class TabScaffold extends StatelessWidget {
|
|||||||
switch (Provider.of<ThemeModel>(context).theme) {
|
switch (Provider.of<ThemeModel>(context).theme) {
|
||||||
case AppThemeType.cupertino:
|
case AppThemeType.cupertino:
|
||||||
return DefaultTextStyle(
|
return DefaultTextStyle(
|
||||||
style: TextStyle(fontSize: 16),
|
style: TextStyle(fontSize: 14),
|
||||||
child: CupertinoSegmentedControl(
|
child: CupertinoSegmentedControl(
|
||||||
groupValue: activeTab,
|
groupValue: activeTab,
|
||||||
onValueChanged: onTabSwitch,
|
onValueChanged: onTabSwitch,
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
|
import 'package:git_touch/utils/utils.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
import 'package:git_touch/models/theme.dart';
|
import 'package:git_touch/models/theme.dart';
|
||||||
|
|
||||||
@ -62,16 +63,31 @@ class ActionButton extends StatelessWidget {
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
default:
|
default:
|
||||||
return PopupMenuButton<int>(
|
return IconButton(
|
||||||
icon: Icon(iconData),
|
icon: Icon(iconData),
|
||||||
onSelected: _onSelected,
|
onPressed: () async {
|
||||||
itemBuilder: (BuildContext context) {
|
await showModalBottomSheet(
|
||||||
return actions.asMap().entries.map((entry) {
|
context: context,
|
||||||
return PopupMenuItem(
|
builder: (_) {
|
||||||
value: entry.key,
|
return Column(
|
||||||
child: Text(entry.value.text),
|
children: join(
|
||||||
);
|
PopupMenuDivider(height: 1),
|
||||||
}).toList();
|
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(),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user