Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mono0926/adaptive_dialog
Show alert dialog or modal action sheet adaptively according to platform.
https://github.com/mono0926/adaptive_dialog
cupertino cupertino-design cupertino-widgets flutter ios material material-design material-theme text textfield uitextfield widget
Last synced: 2 days ago
JSON representation
Show alert dialog or modal action sheet adaptively according to platform.
- Host: GitHub
- URL: https://github.com/mono0926/adaptive_dialog
- Owner: mono0926
- License: mit
- Created: 2020-03-21T02:24:27.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2024-12-19T06:27:07.000Z (about 2 months ago)
- Last Synced: 2025-01-29T02:34:42.408Z (9 days ago)
- Topics: cupertino, cupertino-design, cupertino-widgets, flutter, ios, material, material-design, material-theme, text, textfield, uitextfield, widget
- Language: Dart
- Homepage: https://pub.dev/packages/adaptive_dialog
- Size: 25.2 MB
- Stars: 363
- Watchers: 5
- Forks: 63
- Open Issues: 13
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# adaptive_dialog
Show alert dialog or modal action sheet adaptively according to platform.
Web Demo: https://mono0926.com/adaptive_dialog/
## [showOkAlertDialog](https://pub.dev/documentation/adaptive_dialog/latest/adaptive_dialog/showOkAlertDialog.html)
Convenient wrapper of [showAlertDialog](https://pub.dev/documentation/adaptive_dialog/latest/adaptive_dialog/showAlertDialog.html).
| iOS | Android |
| ------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------ |
||
|
## [showOkCancelAlertDialog](https://pub.dev/documentation/adaptive_dialog/latest/adaptive_dialog/showOkCancelAlertDialog.html)
Convenient wrapper of [showAlertDialog](https://pub.dev/documentation/adaptive_dialog/latest/adaptive_dialog/showAlertDialog.html).
| iOS | Android |
| ------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------ |
||
|
||
|
## [showConfirmationDialog](https://pub.dev/documentation/adaptive_dialog/latest/adaptive_dialog/showConfirmationDialog.html)
Show [Confirmation Dialog](https://material.io/components/dialogs#confirmation-dialog). For Cupertino, fallback to ActionSheet.
| iOS | Android |
| ------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------ |
||
|
## [showModalActionSheet](https://pub.dev/documentation/adaptive_dialog/latest/adaptive_dialog/showModalActionSheet.html)
| iOS | Android |
| ------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------- |
||
|
||
|
||
|
## [showTextInputDialog](https://pub.dev/documentation/adaptive_dialog/latest/adaptive_dialog/showTextInputDialog.html)
| iOS | Android |
| ------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------ |
||
|
||
|
## [showTextAnswerDialog](https://pub.dev/documentation/adaptive_dialog/latest/adaptive_dialog/showTextAnswerDialog.html)
Show text input dialog until answer is correct or cancelled.
This is useful for preventing very destructive action is executed mistakenly.| iOS | Android |
| ------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------ |
||
|
---
# FAQ
## How can I customize it flexibly?
This packages keeps usage and UI simple like iOS official alert dialog.
Therefore, if you need more flexibility than this package provides, I recommend that you build your own directly using standard APIs to meet your requirements without using this package.- https://github.com/mono0926/adaptive_dialog/issues/19#issuecomment-754476937
- https://github.com/mono0926/adaptive_dialog/issues/76#issuecomment-1120686982
- https://github.com/mono0926/adaptive_dialog/issues/108#issuecomment-1543068734## The getter `modalBarrierDismissLabel` was called on null
`adaptive_dialog` uses Cupertino-style widgets internally on iOS, so `GlobalCupertinoLocalizations.delegate` is required under certain conditions.
```dart
import 'package:flutter/material.dart';
import 'package:flutter_localizations/flutter_localizations.dart';class App extends StatelessWidget {
const App({Key key}) : super(key: key);@override
Widget build(BuildContext context) {
return MaterialApp(
//...
localizationsDelegates: const [
GlobalMaterialLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,
GlobalCupertinoLocalizations.delegate, // This is required
],
);
}
}
```## The input text color same with backgound when using CupertinoTextInputDialog
This fixes the problem.
```dart
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart' hide Router;class App extends StatelessWidget {
const App({Key key}) : super(key: key);@override
Widget build(BuildContext context) {
return MaterialApp(
darkTheme: ThemeData(
cupertinoOverrideTheme: const CupertinoThemeData(
textTheme: CupertinoTextThemeData(), // This is required
),
),
);
}
}
```