flutter_cupertino_bottom_sheet
2.0.1, released 2 years ago by softmaestri.com
Cupertino-style bottom sheet that works from any context without a Scaffold, using a screenshot of the screen.
What it does
It captures the current screen as a RawImage and displays it as a bottom sheet, allowing swipe or button dismissal. The sheet can be opened from anywhere by using a global navigator key or a direct route push.
AI-written summary of version 2.0.1, based on the package's README and metadata. Report an inaccuracy
Use it when
- Need a Cupertino bottom sheet that can be shown from any part of the app without a Scaffold
- Want a quick, minimal setup for a modal sheet
- Need to avoid passing a BuildContext to open the sheet
Skip it when
- Need complex custom animations that depend on the underlying widget tree
- Require high-performance rendering for very large screens
- Need to avoid the overhead of taking a screenshot
Strengths
- No Scaffold required, works from any context
- Simple API, just wrap MaterialApp once
- Supports custom app bars and swipe settings
Weaknesses
- Screenshot approach can be heavy on large screens
- Limited to the visual snapshot of the current screen
- Not suitable for highly dynamic content that changes after the sheet opens
Setup
- Kind
- Flutter widgets
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 1
Wrap your MaterialApp with CupertinoBottomSheetRepaintBoundary and optionally set cupertinoBottomSheetNavigatorKey.
```dart
import 'package:flutter_cupertino_bottom_sheet/flutter_cupertino_bottom_sheet.dart';
void main() => runApp(const MyApp());
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return CupertinoBottomSheetRepaintBoundary(
child: MaterialApp(
navigatorKey: cupertinoBottomSheetNavigatorKey,
home: Scaffold(
appBar: AppBar(title: const Text('Demo')),
body: Center(
child: ElevatedButton(
onPressed: () => openCupertinoBottomSheet(
builder: (_) => const Text('Hello'),
),
child: const Text('Show Sheet'),
),
),
),
),
);
}
}
```Alternatives
Packages that do the same job and could replace flutter_cupertino_bottom_sheet.
- modal_bottom_sheet
Provides a more feature‑rich modal bottom sheet with built‑in animations and customization options.
50Compare
Works with
Packages commonly used together with flutter_cupertino_bottom_sheet: ones it builds on, ones built on it, and its own family.