パッケージ、リポジトリ、アプリカテゴリを検索

GitHub リポジトリmono0926/adaptive_dialog

adaptive_dialog

プラットフォームに応じてアラートダイアログまたはモーダルアクションシートを適切に表示します。

adaptive_dialog のプロジェクト画像
スター
384
フォーク
72
最終プッシュ(UTC)
2026/09/18
プロジェクト状態
公開中

元の README

以下は英語原文のスナップショットです。最新版は GitHub をご覧ください。

adaptive_dialog

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

Web Demo: https://mono0926.com/adaptive_dialog/

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

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.

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
        ),
      ),
    );
  }
}

macOS style and Web / WASM compatibility

AdaptiveStyle.macOS utilizes macos_ui widgets on native macOS. On Web platforms (both JavaScript and WASM), macos_ui is excluded to ensure Web and WASM compatibility, and dialogs configured with macOS style automatically fall back to Cupertino (iOS-style) dialogs.

mono — Masayuki Ono GitHub avatar
GitHub 作者

mono — Masayuki Ono ↗

Software Engineer (Flutter/Dart, Firebase/GCP, iOS/Swift, TypeScript)

FreelanceTokyo, Japan公式サイト ↗
言語DartC++CMakeHTMLRubySwiftCKotlinShellObjective-C

カテゴリー

このリポジトリが公開するパッケージ

使用している依存関係

依存関係一覧 9 件

プロジェクトに合うリポジトリを選ぶには?

用途で絞り込み、開発状況を比較し、採用前に元のリポジトリで要件を確認しましょう。

  1. 名前・作者・説明で検索し、技術トピックで絞り込みます。
  2. スター、フォーク、最近のプッシュを比較します。スターは関心の目安であり、品質の保証ではありません。
  3. 利用前に GitHub で README、ライセンス、Issues を確認します。

情報源と管理

“A repository is the most basic element of GitHub.”

GitHub Docs — About repositories ↗