reusable_bottom_sheet 0.0.2+1
reusable_bottom_sheet: ^0.0.2+1 copied to clipboard
A reusable Flutter package to easily create customizable bottom sheets with options to display a title, subtitle, child widgets, and a drag handle. It supports features like custom height, background [...]
import 'package:flutter/material.dart';
import 'package:reusable_bottom_sheet/reusable_bottom_sheet.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Reusable Bottom Sheet Example',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: const BottomSheetExampleScreen(),
);
}
}
class BottomSheetExampleScreen extends StatelessWidget {
const BottomSheetExampleScreen({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Reusable Bottom Sheet Demo'),
),
body: Center(
child: ElevatedButton(
onPressed: () {
showOptionBottomSheet(
context: context,
title: 'Options',
supTitle: 'Choose one',
options: [
const OptionEntity(
icon: Icons.camera_alt,
title: 'Camera',
),
const OptionEntity(
icon: Icons.photo,
title: 'Gallery',
),
const OptionEntity(
icon: Icons.share,
title: 'Share',
),
],
onTap: () {
Navigator.pop(context);
},
);
},
child: const Text('Show Bottom Sheet'),
),
),
);
}
}