import 'package:flutter/material.dart'; import 'package:sport/widgets/misc.dart'; Future showActionDialog(BuildContext context, Map 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: [ 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, )), )), ) ]), )), ); }); }