Adaptive dialog - Show alert dialog or modal action sheet adaptively according to platform.

Overview

adaptive_dialog

Show alert dialog or modal action sheet adaptively according to platform.


showOkAlertDialog

Convenient wrapper of showAlertDialog.

iOS Android
n1 n2

showOkCancelAlertDialog

Convenient wrapper of showAlertDialog.

iOS Android
n3 n4
n5 n6

showConfirmationDialog

Show Confirmation Dialog. For Cupertino, fallback to ActionSheet.

iOS Android
n3 n5

showModalActionSheet

iOS Android
n7 n8
n9 n10
n11 n12

showTextInputDialog

iOS Android
n1 n2
n3 n4

showTextAnswerDialog

Show text input dialog until answer is correct or cancelled. This is useful for preventing very destructive action is executed mistakenly.

iOS Android
n5 n6

FAQ

The getter modalBarrierDismissLabel was called on null

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
        ),
      ),
    );
  }
}
Comments
  • Cannot build example on any flutter channel

    Cannot build example on any flutter channel

    Your sdk requirement of >=2.12.0-0 prevents this from being built on the stable channel of flutter, and on the beta channel and below, the following error arises upon trying to build and run the example flutter app.

    /C:/Software/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_svg-0.18.1/lib/src/picture_provider.dart:50:59: Error: No named parameter with the name 'nullOk'.
            context != null ? Localizations.localeOf(context, nullOk: true) : null,
                                                              ^^^^^^
    /C:/Software/flutter/packages/flutter/lib/src/widgets/localizations.dart:413:17: Context: Found this candidate, but the arguments don't match.
      static Locale localeOf(BuildContext context) {
                    ^^^^^^^^
    
    
    FAILURE: Build failed with an exception.
    
    * Where:
    Script 'C:\Software\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 991
    
    * What went wrong:
    Execution failed for task ':app:compileFlutterBuildDebug'.
    > Process 'command 'C:\Software\flutter\bin\flutter.bat'' finished with non-zero exit value 1
    
    * Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
    
    * Get more help at https://help.gradle.org
    
    BUILD FAILED in 14s
    Exception: Gradle task assembleDebug failed with exit code 1
    
    opened by CicadaCinema 4
  • please help

    please help

    i have showTextInputDialog()

    but where i can past functions on OK and CANCEL buttons?

    for example i expect some like this:

    showTextInputDialog( onPressOKButton(){ doSomeThing } onPressCANCELButton(){ doSomeThing } )

    How i can handle tap on OK and CANCEL buttons???

    opened by Hopheylalal 4
  • Option to change the directionality of text and text-direction-sensitive render objects

    Option to change the directionality of text and text-direction-sensitive render objects

    In my app, I need to change the text direction of the title and the content in the dialog but I could not because there is no argument provided for text direction.

    Expected Behaviour The dialog should have support for text direction by making Directionality the root child of the dialog.

    showModal(
          context: context,
          useRootNavigator: useRootNavigator,
          configuration: FadeScaleTransitionConfiguration(
            barrierDismissible: barrierDismissible,
          ),
          builder: (context) => Directionality(
            textDirection: TextDirection.rtl,
            child: WillPopScope(
              onWillPop: onWillPop,
              child: AlertDialog(
                title: titleText,
                content: messageText,
                actions: actions.convertToMaterialDialogActions(
                  onPressed: pop,
                  destructiveColor: colorScheme.error,
                  fullyCapitalized: fullyCapitalizedForMaterial,
                ),
                actionsOverflowDirection: actionsOverflowDirection,
                scrollable: true,
              ),
            ),
          ),
        );
    
    opened by Aanu1995 3
  • Add support for macOS dialogs

    Add support for macOS dialogs

    • [x] #67
    • [x] #68

    Description

    We deploy our app to Android, iOS, Web and macOS. It would be great to have the option to display on macOS the dialog with native design:

    | Big Sur | Catalina | | - | - | |image| image |

    https://github.com/GroovinChip/macos_ui#dialogs

    ☂️ umbrella 
    opened by nilsreichardt 3
  • The input text color same with backgound when use CupertinoTextInputDialog

    The input text color same with backgound when use CupertinoTextInputDialog

    I found a issue that when I switch to dark mode. The DialogTextField text color still black. We cannot see. the text because the color is same with background.

    Is there any way to set DialogTextField text color?

    opened by dodatw 3
  • showConfirmationDialog height

    showConfirmationDialog height

    Hi, Is there any way while using showConfirmationDialog to have a more "responsive" height? The widget works well when the list is long enough to be scrollable, and I am aware of contentMaxHeight which I am using currently, but it's not ideal.

    Maybe you could add an option to pass to the widget's ListView a shrinkWrap value, so one could set it to true.

    Thanks!

    opened by xJon 3
  • Nested Navigators

    Nested Navigators

    Hi! I have a tabbed setup that use nested Navigators. It seems that the dialogs are displayed using the root navigator, because when the void pop(T key) => Navigator.of(context).pop(key); is executed in showAlertDialog<T> after pressing any dialog's action button, the tab's page is popped but the dialog stays on the screen.

    I was able to successfully fix the issue by forcing to pop using root navigator, so that the dialog is actually removed off the screen after pressing an action button: void pop(T key) => Navigator.of(context, rootNavigator: true).pop(key);

    Would you be so kind to extend your API to support this scenario? Thank you in advance, I love your work.

    bug enhancement 
    opened by cek-cek 3
  • Option to add custom fields or widgets in dialog

    Option to add custom fields or widgets in dialog

    https://images.squarespace-cdn.com/content/v1/5cfdee013dbb080001afc0ff/1600237264823-BOX7W8U7X1MBJDPEGMFU/Prompt+to+allow+precise+location+in+iOS+14?format=2500w

    So far it seems it is just limited to predefined set of widgets to use dialogs. For example it seems is not possible to add something like in image above or just adding some other fields like my own pin code field. I hoped that builder(context, child): would allow to do this thing, but it seems like it's not currently available.

    opened by ebelevics 2
  • Possible to give showTextInputDialog default text?

    Possible to give showTextInputDialog default text?

    Is it possible to give showTextInputDialog some default text that could then be edited? This would be different from hintText that would disappear once the user starts typing.

    opened by mark8044 2
  • iOS dark mode text input is invisible

    iOS dark mode text input is invisible

    Hello, I really love your package and use it in my app FluffyChat but I have seen that on iOS in dark mode the text is not visible in the showTextInputDialog().

    Screenshot

    opened by krillefear 2
  • is it possible to show dialog without build context

    is it possible to show dialog without build context

    HI, i am looking forward to showing a dialog from inside a Getx Controller when a push notification been received, i don't have a context in this situation is it possible show dialog without context

    opened by mohadel92 2
  • Add `showGeneralAdaptiveDialog` ?

    Add `showGeneralAdaptiveDialog` ?

    Functions that can be implemented in desired fine-grained layouts for each platform.

    • [ ] Add notes to the FAQ
      • [ ] adaptive_dialog is intended to allow easy common display of dialogs that conform to native standard designs
      • [ ] If customization beyond this is desired, the user should implement their own or use the showGeneralAdaptiveDialog function.
    opened by mono0926 0
  • Controller for the DialogTextField

    Controller for the DialogTextField

    I noticed that for the "showTextInputDialog", there is no controller for the DialogTextField that can be used to fetch the data from the inputs.

    opened by ari-borlaza 0
Releases(1.8.0)
  • 1.8.0(Aug 4, 2022)

    What's Changed

    • Support textCapitalization in DialogTextField by @838 in https://github.com/mono0926/adaptive_dialog/pull/91

    New Contributors

    • @838 made their first contribution in https://github.com/mono0926/adaptive_dialog/pull/91

    Full Changelog: https://github.com/mono0926/adaptive_dialog/compare/1.7.0...1.8.0

    Source code(tar.gz)
    Source code(zip)
  • 1.7.0(Jul 28, 2022)

    What's Changed

    • Update dependencies for non-nullable bindings. by @ishangavidusha in https://github.com/mono0926/adaptive_dialog/pull/79
    • Fix supported platforms by @mono0926 in https://github.com/mono0926/adaptive_dialog/pull/83
    • feat: expose route settings on all apis by @junaid1460 in https://github.com/mono0926/adaptive_dialog/pull/88
    • Added maxLength to fields by @lcsvcn in https://github.com/mono0926/adaptive_dialog/pull/84

    New Contributors

    • @ishangavidusha made their first contribution in https://github.com/mono0926/adaptive_dialog/pull/79
    • @junaid1460 made their first contribution in https://github.com/mono0926/adaptive_dialog/pull/88
    • @lcsvcn made their first contribution in https://github.com/mono0926/adaptive_dialog/pull/84

    Full Changelog: https://github.com/mono0926/adaptive_dialog/compare/1.6.4...1.7.0

    Source code(tar.gz)
    Source code(zip)
  • 1.6.4(Jun 6, 2022)

    What's Changed

    • Use accentColor for macOS by using dynamic_color
    • Update min SDK version to 2.17.0

    Full Changelog: https://github.com/mono0926/adaptive_dialog/compare/1.6.3...1.6.4

    Source code(tar.gz)
    Source code(zip)
  • 1.6.3(May 27, 2022)

    What's Changed

    • Bump macos_ui from 0.16.0 to 1.2.0 by @dependabot in https://github.com/mono0926/adaptive_dialog/pull/77

    Full Changelog: https://github.com/mono0926/adaptive_dialog/compare/1.6.1...1.6.3

    Source code(tar.gz)
    Source code(zip)
  • 1.6.1(Apr 28, 2022)

    What's Changed

    • Add pubspec.lock to .gitignore by @nilsreichardt in https://github.com/mono0926/adaptive_dialog/pull/71
    • 73 support dragging text input dialog for macos by @mono0926 in https://github.com/mono0926/adaptive_dialog/pull/75

    New Contributors

    • @nilsreichardt made their first contribution in https://github.com/mono0926/adaptive_dialog/pull/71

    Full Changelog: https://github.com/mono0926/adaptive_dialog/compare/1.6.0...1.6.1

    Source code(tar.gz)
    Source code(zip)
  • 1.6.0(Apr 28, 2022)

    What's Changed

    • 67 support for macos style alert dialog by @mono0926 in https://github.com/mono0926/adaptive_dialog/pull/69
    • 68 support for macos style text input dialog by @mono0926 in https://github.com/mono0926/adaptive_dialog/pull/70

    Full Changelog: https://github.com/mono0926/adaptive_dialog/compare/1.5.1...1.6.0

    Source code(tar.gz)
    Source code(zip)
  • 1.5.1(Apr 28, 2022)

    What's Changed

    • Bump pedantic_mono from 1.17.0 to 1.18.0 by @dependabot in https://github.com/mono0926/adaptive_dialog/pull/64
    • Add autocorrect to DialogTextField by @mono0926 in https://github.com/mono0926/adaptive_dialog/pull/66

    New Contributors

    • @dependabot made their first contribution in https://github.com/mono0926/adaptive_dialog/pull/64

    Full Changelog: https://github.com/mono0926/adaptive_dialog/compare/1.5.0...1.5.1

    Source code(tar.gz)
    Source code(zip)
  • 1.5.0(Mar 28, 2022)

    What's Changed

    • Add builder parameter by @mono0926 in https://github.com/mono0926/adaptive_dialog/pull/60

    Full Changelog: https://github.com/mono0926/adaptive_dialog/compare/1.4.0...1.5.0

    Source code(tar.gz)
    Source code(zip)
  • 1.4.0(Mar 28, 2022)

    What's Changed

    • add ignore keyword sensitive option for showTextAnswerDialog by @Ted-chiptech in https://github.com/mono0926/adaptive_dialog/pull/49

    New Contributors

    • @Ted-chiptech made their first contribution in https://github.com/mono0926/adaptive_dialog/pull/49

    Full Changelog: https://github.com/mono0926/adaptive_dialog/compare/1.0.0...1.4.0

    Source code(tar.gz)
    Source code(zip)
Owner
Masayuki Ono (mono)
Software Engineer (Flutter/Dart, Firebase/GCP, iOS/Swift, TypeScript)
Masayuki Ono (mono)
A action bottom sheet that adapts to the platform (Android/iOS).

Adaptive action sheet A action bottom sheet that adapts to the platform (Android/iOS). iOS Android Getting Started Add the package to your pubspec.yam

Daniel Ioannou 26 Sep 26, 2022
An Adaptive Navigation Bar in flutter. Navbar changes according to the screen size.

Adaptive NavBar (adaptive_navbar) Table of contents General info Setup Conclusion Useful Resources Meet the developer General info adaptive_navbar is

Mouli Bheemaneti 3 Oct 17, 2022
Show beautiful bottom sheet as confirmation dialog quickly and easily.

sweetsheet Show beautiful bottom sheet as confirmation dialog quickly and easily. nice warning success danger and since version 0.2.0 , it is fully cu

Ayao Corneille ALLOGBALO 80 Sep 27, 2022
A wrapper on top of alert dialog provided by flutter.

material_dialog A wrapper on top of alert dialog provided by flutter. Demo Use this package as a library 1. Depend on it Add this to your package's pu

Zubair Rehman 28 Aug 8, 2022
Animated dialog box - A pure dart package for showing animated alert box.

animated_dialog_box A pure dart package for showing animated alert box. Getting Started https://github.com/Shubham-Narkhede/animated_dialog_box/blob/m

Shubham-Narkhede 10 Jul 24, 2022
A platform-adaptive search for Flutter

Flutter Platform Search Flutter platform search is an abstract implementation of the Flutter search delegate. It is a time saving way to implement a p

QuickBird Studios 32 Dec 31, 2022
Flutter package to get keyboard height. Can be used to display a sticker/emoji modal with correct height.

flutter_persistent_keyboard_height Flutter package to get keyboard height. The height is persisted during app sessions and keyboard states (you can us

Arshak Aghakaryan 13 Oct 17, 2022
A simple modal progress HUD (heads-up display, or progress indicator) for flutter

modal_progress_hud A simple widget wrapper to enable modal progress HUD (a modal progress indicator, HUD = Heads Up Display) Inspired by this article.

Maurice McCabe 157 Nov 22, 2022
A Very Flexible Widget that can Implement Material Sheets on all Directions, both modal and persistent, and consequently a Material Navigation Drawer

Flutter_MaterialSheetAndNavigationDrawer If this project helped you reduce developement time or you just want to help me continue making useful tools

Bryan Cancel 30 Dec 4, 2021
Flutter modal bottom route - A flutter route animation

flutter_modal_bottom_route This is a flutter route animation demo. See Chinouo J

null 4 Aug 19, 2022
Pokedex-Flutter - Pokedex demonstrates modern Flutter development with GetX, Hive, Flow, Adaptive/Responsive Design

Pokedex-Flutter Pokedex demonstrates modern Flutter development with GetX, Hive,

Khoujani 3 Aug 17, 2022
Another breakpoint framework. Aims to simplify as much as possible building adaptive layouts.

Another breakpoint framework. Aims to simplify as much as possible building adaptive layouts. Features Really simple implementation Works with and wit

null 3 Sep 26, 2022
This package will help you to manage the overlays in your projects. Show a dialog, notification, window, or a panel easily

This package will help you to manage the overlays in your projects. Show a dialog, notification, window, or a panel easily. or use one of the helping widgets like AutoComplete, Expander(Dropdown).

Schaban Bochi 25 Dec 4, 2022
Show a draggable floating chat icon button and show messages on screens

Show a draggable floating chat icon button and show messages on screens Features A widget for displaying a chat icon (or custom widget) on top of a ba

CU Apps 4 May 5, 2022
Flutter Dropdown Alert help to notify to user when success, warning or error like push notification

flutter_dropdown_alert A dropdown alert package for flutter Dropdown alert will help to notify to user when you call api success, error or something l

Tuan Van Le 12 Dec 17, 2022
Status Alert for Flutter

Status Alert for Flutter

Yako 125 Jan 8, 2023
This example uses a ScrollView, JSON Rest API, Navigation, Alert Pop Up, Progress Indicator, Globals, Images in a shared asset folder, and 100% Shared Code

This example uses a ScrollView, JSON Rest API, Navigation, Alert Pop Up, Progress Indicator, Globals, Images in a shared asset folder, and 100% Shared Code. Now with the ability to login with FaceID, TouchID, and Fingerprint Reader on Android.

Rody Davis 672 Jan 6, 2023
A flutter UI package provides a cell widget that has leading and trailing swipe action menu.

Language: English |中文简体 flutter_swipe_action_cell A package that can give you a cell that can be swiped ,effect is like iOS native If you like this pa

WenJingRui 261 Jan 7, 2023
GitHub Action that uses the Dart Package Analyzer to compute the Pub score of Dart/Flutter packages

Dart/Flutter package analyzer This action uses the pana (Package ANAlysis) package to compute the score that your Dart or Flutter package will have on

Axel Ogereau-Peltier 45 Dec 29, 2022