123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- import 'package:flutter/material.dart';
- import 'package:sport/widgets/misc.dart';
- Future showActionDialog(BuildContext context, Map<String, Function> actions) {
- return showModalBottomSheet(
- context: context,
- isScrollControlled: true,
- shape: RoundedRectangleBorder(borderRadius: BorderRadius.vertical(top: Radius.circular(10))),
- builder: (BuildContext context) {
- final Decoration decoration = BoxDecoration(
- border: Border(
- bottom: Divider.createBorderSide(context),
- ),
- );
- return SingleChildScrollView(
- child: Padding(
- padding: const EdgeInsets.all(12.0),
- child: SafeArea(
- child: Column(children: <Widget>[
- Column(
- children: actions.keys
- .map(
- (key) => DecoratedBox(
- position: DecorationPosition.foreground,
- decoration: decoration,
- child: InkWell(
- onTap: () {
- actions[key].call();
- Navigator.pop(context);
- },
- child: Container(
- width: double.infinity,
- height: 50.0,
- child: Center(
- child: Text(
- "$key",
- style: Theme.of(context).textTheme.subtitle1,
- strutStyle: fixedLine,
- )),
- ))),
- )
- .toList(),
- ),
- Padding(
- padding: const EdgeInsets.only(top: 16.0, bottom: 10.0),
- child: InkWell(
- onTap: () => Navigator.maybePop(context),
- child: Container(
- height: 44.0,
- decoration: BoxDecoration(shape: BoxShape.rectangle, borderRadius: BorderRadius.all(Radius.circular(50)), color: Color(0xfff1f1f1)),
- child: Center(
- child: Text(
- "取消",
- style: Theme.of(context).textTheme.subtitle1,
- strutStyle: fixedLine,
- )),
- )),
- )
- ]),
- )),
- );
- });
- }
|