Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/emanuel-braz/dialog_context
Show Dialog, BottomSheet, ModalBottomSheet and SnackBar without BuildContext.
https://github.com/emanuel-braz/dialog_context
Last synced: 8 days ago
JSON representation
Show Dialog, BottomSheet, ModalBottomSheet and SnackBar without BuildContext.
- Host: GitHub
- URL: https://github.com/emanuel-braz/dialog_context
- Owner: emanuel-braz
- License: bsd-3-clause
- Created: 2020-04-27T13:40:48.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-05-05T02:53:05.000Z (over 4 years ago)
- Last Synced: 2023-08-18T12:24:52.156Z (about 1 year ago)
- Language: Dart
- Size: 61.5 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
[![Pub Version](https://img.shields.io/pub/v/dialog_context?color=%2302569B&label=pub&logo=flutter)](https://pub.dev/packages/dialog_context) ![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)
### Show Dialog, BottomSheet, ModalBottomSheet and SnackBar with no need BuildContext.
To be discontinued, use the OneContext package: [one_context](https://pub.dev/packages/one_context)## https://pub.dev/packages/one_context
```dart
// example snackBar
DialogContext().showSnackBar(
snackBar: SnackBar(content: Text('My awesome snackBar!'))
);
``````dart
// example dialog
DialogContext().showDialog(
builder: (context) => AlertDialog(
title: new Text("The Title"),
content: new Text("The Body"),
)
);
``````dart
// example bottomSheet
DialogContext().showBottomSheet(
builder: (context) => Container(
alignment: Alignment.topCenter,
height: 200,
child: IconButton(
icon: Icon(Icons.arrow_drop_down),
iconSize: 50,
color: Colors.white,
onPressed: () => Navigator.pop(context)),
),
);
```## Important: Use the DialogContext().builder in MaterialApp
```dart
MaterialApp(
builder: DialogContext().builder, /// important: Use [DialogContext().builder] builder here!
home: MyHomePage(title: 'Dialogs without BuildContext'),
);
```#### Add dependency
```yaml
dependencies:
dialog_context: ^0.1.1
```