zeba_academy_safe_area
A powerful Flutter utility package for handling dynamic safe areas, notch detection, status bar information, and bottom insets with simple and reusable APIs.
Build responsive Flutter applications that automatically adapt to:
- š± Notched devices
- š iPhone Dynamic Island
- š¤ Android display cutouts
- āØļø Keyboard insets
- š§ Gesture navigation areas
- š Dynamic system padding
Features
ā
Dynamic Safe Area padding
ā
Notch detection
ā
Dynamic Island detection
ā
Status bar helpers
ā
Bottom inset helpers
ā
Keyboard visibility detection
ā
Context extension utilities
ā
Reusable DynamicSafeArea widget
ā
Lightweight and dependency-free
Installation
Add this package to your pubspec.yaml:
dependencies:
zeba_academy_safe_area: ^0.0.1
Then run:
flutter pub get
Import
import 'package:zeba_academy_safe_area/zeba_academy_safe_area.dart';
Usage
Dynamic Safe Area Widget
Automatically applies device safe padding.
DynamicSafeArea(
child: Scaffold(
body: Center(
child: Text(
"Hello Safe Area",
),
),
),
);
With custom minimum padding:
DynamicSafeArea(
minimumPadding: 16,
child: YourWidget(),
);
Safe Area Helpers
Get top safe area:
double top =
SafeAreaHelper.top(context);
Get bottom safe area:
double bottom =
SafeAreaHelper.bottom(context);
Get complete padding:
EdgeInsets padding =
SafeAreaHelper.padding(context);
Check if device has safe area:
bool value =
SafeAreaHelper.hasSafeArea(context);
Notch Detection
Check device notch:
bool hasNotch =
NotchHelper.hasNotch(context);
Detect Dynamic Island:
bool dynamicIsland =
NotchHelper.hasDynamicIsland(context);
Check bottom gesture area:
bool gestureArea =
NotchHelper.hasBottomGestureArea(context);
Status Bar Helpers
Get status bar height:
double height =
StatusBarHelper.height(context);
Check status bar availability:
bool visible =
StatusBarHelper.isVisible(context);
Get navigation bar height:
double navigation =
StatusBarHelper.navigationBarHeight(context);
Bottom Insets
Keyboard height:
double keyboard =
BottomInsetHelper.keyboard(context);
Check keyboard visibility:
bool opened =
BottomInsetHelper.keyboardVisible(context);
Bottom safe padding:
double bottom =
BottomInsetHelper.safeBottom(context);
Context Extensions
The package provides simple BuildContext extensions.
Example:
double top = context.safeTop;
double bottom = context.safeBottom;
bool notch = context.hasNotch;
bool keyboard =
context.keyboardVisible;
Supported Platforms
| Platform | Supported |
|---|---|
| Android | ā |
| iOS | ā |
| Web | ā |
| Windows | ā |
| macOS | ā |
| Linux | ā |
Why use zeba_academy_safe_area?
Flutter's default SafeArea widget works well for basic layouts, but many applications need:
- Device notch information
- Status bar measurements
- Keyboard detection
- Bottom navigation handling
- Reusable responsive helpers
This package provides all these utilities in one clean API.
Example
class HomePage extends StatelessWidget {
const HomePage({
super.key,
});
@override
Widget build(BuildContext context) {
return DynamicSafeArea(
child: Scaffold(
body: Center(
child: Column(
mainAxisAlignment:
MainAxisAlignment.center,
children: [
Text(
"Top: ${context.safeTop}",
),
Text(
"Bottom: ${context.safeBottom}",
),
Text(
"Notch: ${context.hasNotch}",
),
],
),
),
),
);
}
}
Contributing
Contributions are welcome.
Steps:
- Fork the repository
- Create a feature branch
git checkout -b feature/new-feature
- Commit changes
git commit -m "Add new feature"
- Push branch
git push origin feature/new-feature
- Create a Pull Request
About Me
⨠Iām Sufyan bin Uzayr, an open-source developer passionate about building and sharing meaningful projects.
Learn more about my work:
Website: https://sufyanism.com/
LinkedIn: https://www.linkedin.com/in/sufyanism
Zeba Academy
Your all-in-one learning hub!
š Explore courses and resources in coding, technology, and development.
Zeba Academy helps developers improve practical skills through:
- Programming tutorials
- Real-world projects
- Development resources
- Hands-on learning
Visit:
Website: https://zeba.academy
Coding resources:
YouTube:
https://www.youtube.com/@zeba.academy
Instagram:
https://www.instagram.com/zeba.academy/
License
This project is licensed under the GNU General Public License v3.0 (GPL-3.0).
You are free to:
- Use this software
- Study the source code
- Modify the software
- Distribute copies
Under the GPL-3.0 license, modified versions must also be distributed under the same license.
See the full license:
https://www.gnu.org/licenses/gpl-3.0.html
Thank You
Thank you for using zeba_academy_safe_area.
If this package helps your Flutter development, consider supporting the project by sharing it with the Flutter community.