Can someone tel me how to implement modal bottom sheet with fab similar to flutter_speed_dial (https://pub.dev/packages/flutter_speed_dial). To show the bottom sheet instead of icons while fab is animated
Can someone tel me how to implement modal bottom sheet with fab similar to flutter_speed_dial (https://pub.dev/packages/flutter_speed_dial). To show the bottom sheet instead of icons while fab is animated
You can try doing it like this
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return const MaterialApp(
home: MyHomePage(),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({Key? key}) : super(key: key);
@override
_MyHomePageState createState() {
return _MyHomePageState();
}
}
class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text("Flutter Bottom Sheet"),
),
body: const Center(
child: Text("Show Bottom Sheet"),
),
floatingActionButton: FloatingActionButton(
child: const Icon(Icons.add),
onPressed: () {
_showModalBottomSheet();
},
),
);
}
_showModalBottomSheet() {
showModalBottomSheet(
context: context,
builder: (context) {
return Wrap(
children: const [
ListTile(
leading: Icon(Icons.share),
title: Text('Share'),
),
ListTile(
leading: Icon(Icons.copy),
title: Text('Copy Link'),
),
ListTile(
leading: Icon(Icons.edit),
title: Text('Edit'),
),
],
);
},
);
}
}