とりあえずCupertinoActionSheetを使うコードを書く。
import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; void main() => runApp(MaterialApp(home:MyApp(),),); class MyApp extends StatefulWidget { @override _MyAppState createState() => _MyAppState(); } class _MyAppState extends State<MyApp> { String str="スタート"; @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text("CASheet sample"), actions: [ TextButton( child: Text("log out"), onPressed: () async { String thing=str; thing = await showCupertinoModalPopup( context: context, builder: (context) => CupertinoActionSheet( title:Text("CupertinoActionSheetのサンプル",style:TextStyle(fontSize:20.0,),), message:Text("何たらかんたら"), actions: [ CupertinoActionSheetAction( onPressed: (){Navigator.of(context).pop("good");}, child: Text('Good'), isDefaultAction: true, ), CupertinoActionSheetAction( onPressed: (){Navigator.of(context).pop("bad");}, child: Text('Bad'), isDestructiveAction: true, ), ], cancelButton: CupertinoActionSheetAction( onPressed: (){Navigator.of(context).pop(thing);}, child: Text('Cancel'), ), ), ); setState((){ str=thing; }); }, ) ], ), body:Center(child:Text(str,style:TextStyle(fontSize:50.0,),),), ); } }
関連として
https://api.flutter.dev/flutter/material/showModalBottomSheet.html
にサンプルコード有り。使い方はCupertinoActionSheetと大体同じ。