refactor: action sheet for material

This commit is contained in:
Rongjian Zhang 2019-09-27 21:39:36 +08:00
parent a513dfb7c6
commit ddf7f73d36
2 changed files with 26 additions and 10 deletions

View File

@ -27,7 +27,7 @@ class TabScaffold extends StatelessWidget {
switch (Provider.of<ThemeModel>(context).theme) {
case AppThemeType.cupertino:
return DefaultTextStyle(
style: TextStyle(fontSize: 16),
style: TextStyle(fontSize: 14),
child: CupertinoSegmentedControl(
groupValue: activeTab,
onValueChanged: onTabSwitch,

View File

@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';
import 'package:git_touch/utils/utils.dart';
import 'package:provider/provider.dart';
import 'package:git_touch/models/theme.dart';
@ -62,16 +63,31 @@ class ActionButton extends StatelessWidget {
},
);
default:
return PopupMenuButton<int>(
return IconButton(
icon: Icon(iconData),
onSelected: _onSelected,
itemBuilder: (BuildContext context) {
return actions.asMap().entries.map((entry) {
return PopupMenuItem(
value: entry.key,
child: Text(entry.value.text),
);
}).toList();
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(),
),
);
},
);
},
);
}