adaptive_dialog
Show alert dialog or modal action sheet adaptively according to platform.
Web Demo: https://mono0926.com/adaptive_dialog/
⚠️ Compatibility with Flutter 3.10
Due to the fact that the dependent macos_ui package has not yet been updated for compatibility with Flutter 3.10, adaptive_dialog package is affected and results in compilation errors with version 1.8.3.
Solution 1 (recommended)
In pubspec.yaml, indicate to resolve dependencies with 1.9 prerelease version:
dependencies:
adaptive_dialog: ^1.9.0-0
In this case, a version without macos_ui dependency will be temporarily used, resulting in a UI on macOS is same as iOS. Upon stable release, the UI that uses the original macos_ui will be restored.
Solution 2
In pubspec.yaml, specify the following forked version that fixed the issue:
dependency_overrides:
macos_ui:
git:
url: https://github.com/Mayb3Nots/macos_ui
ref: ef51bfe
This is pull requested at macosui/macos_ui#422 and waiting for review and merge.
showOkAlertDialog
Convenient wrapper of showAlertDialog.
iOS | Android |
---|---|
showOkCancelAlertDialog
Convenient wrapper of showAlertDialog.
iOS | Android |
---|---|
showConfirmationDialog
Show Confirmation Dialog. For Cupertino, fallback to ActionSheet.
iOS | Android |
---|---|
showModalActionSheet
iOS | Android |
---|---|
showTextInputDialog
iOS | Android |
---|---|
showTextAnswerDialog
Show text input dialog until answer is correct or cancelled. This is useful for preventing very destructive action is executed mistakenly.
iOS | Android |
---|---|
FAQ
modalBarrierDismissLabel
was called on null
The getter adaptive_dialog
uses Cupertino-style widgets internally on iOS, so GlobalCupertinoLocalizations.delegate
is required under certain conditions.
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.
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
),
),
);
}
}