Skip to content

Commit

Permalink
docs: Added DartDoc.
Browse files Browse the repository at this point in the history
  • Loading branch information
mathrunet committed Dec 19, 2022
1 parent 97d00ad commit 04f45cc
Show file tree
Hide file tree
Showing 27 changed files with 1,418 additions and 79 deletions.
83 changes: 83 additions & 0 deletions packages/katana_ui/lib/modal/modal.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,54 @@
part of katana_ui;

/// Provides easy modal functionality.
///
/// Displays a message modal that allows only one action with [alert].
///
/// Displays a message modal with two possible actions at [confirm].
///
/// 簡単なモーダルの機能を提供します。
///
/// [alert]でアクションを1つだけ可能なメッセージモーダルを表示します。
///
/// [confirm]でアクションを2つ実行可能なメッセージモーダルを表示します。
class Modal {
const Modal._();

/// Displays a message modal with only one possible action.
///
/// [context] to pass the currently available [BuildContext].
///
/// Describe the message title in [title] and the message content in [text].
///
/// The text of the action button is described in [submitText], and the processing when the action is executed is described in [onSubmit].
///
/// Specify the background color with [backgroundColor] and the text color with [color].
///
/// If [disableBackKey] is set to `true`, it is possible to disable the back button on Android devices.
///
/// If [popOnPress] is `true`, the modal is automatically closed when the action is executed.
///
/// If [willShowRepetition] is set to `true`, the modal is automatically redisplayed if [onSubmit] aborts the process with an [Exception].
///
/// It is possible to wait with `await` until the modal closes.
///
/// アクションを1つだけ可能なメッセージモーダルを表示します。
///
/// [context]で現在利用可能な[BuildContext]を渡します。
///
/// [title]でメッセージのタイトル[text]でメッセージの内容を記述します。
///
/// [submitText]でアクションボタンのテキスト、[onSubmit]にアクションを実行する際の処理を記述します。
///
/// [backgroundColor]で背景色、[color]でテキストカラーを指定します。
///
/// [disableBackKey]`true`にした場合、Android端末での戻るボタンを無効化することが可能です。
///
/// [popOnPress]`true`の場合は、アクションを実行した際、モーダルを自動で閉じます。
///
/// [willShowRepetition]`true`にした場合、[onSubmit][Exception]で処理を中断した場合、自動でモーダルを再表示します。
///
/// モーダルが閉じるまで`await`で待つことが可能です。
static Future<void> alert(
BuildContext context, {
required String submitText,
Expand Down Expand Up @@ -64,6 +110,43 @@ class Modal {
} while (willShowRepetition && !clicked);
}

/// Displays a message modal that can perform two actions.
///
/// [context] to pass the currently available [BuildContext].
///
/// Describe the message title in [title] and the message content in [text].
///
/// In the [submitText] field, enter the text of the confirmed action button, and in the [onSubmit] field, enter the processing to be performed when the confirmed action is executed.
///
/// The text of the cancel action button is described in [cancelText], and the processing when the cancel action is executed is described in [onCancel].
///
/// Specify the background color with [backgroundColor] and the text color with [color].
///
/// If [popOnPress] is `true`, the modal is automatically closed when the action is executed.
///
/// If [willShowRepetition] is set to `true`, the modal is automatically redisplayed if [onSubmit] aborts the process with an [Exception].
///
/// Returns `true` if the modal's confirm button is pressed, or `false` if it is canceled.
///
/// アクションを2つ実行可能なメッセージモーダルを表示します。
///
/// [context]で現在利用可能な[BuildContext]を渡します。
///
/// [title]でメッセージのタイトル[text]でメッセージの内容を記述します。
///
/// [submitText]で確定アクションボタンのテキスト、[onSubmit]に確定アクションを実行する際の処理を記述します。
///
/// [cancelText]でキャンセルアクションボタンのテキスト、[onCancel]にキャンセルアクションを実行する際の処理を記述します。
///
/// [backgroundColor]で背景色、[color]でテキストカラーを指定します。
///
/// [popOnPress]`true`の場合は、アクションを実行した際、モーダルを自動で閉じます。
///
/// [willShowRepetition]`true`にした場合、[onSubmit][Exception]で処理を中断した場合、自動でモーダルを再表示します。
///
/// モーダルが閉じるまで`await`で待つことが可能です。
///
/// モーダルの確定ボタンが押された場合`true`、キャンセルされた場合は`false`が返されます。
static Future<bool> confirm(
BuildContext context, {
Color? backgroundColor,
Expand Down
10 changes: 5 additions & 5 deletions packages/masamune/example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -335,14 +335,14 @@ packages:
name: katana_auth
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.2"
version: "1.1.3"
katana_form:
dependency: transitive
description:
name: katana_form
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.6"
version: "1.2.7"
katana_indicator:
dependency: transitive
description:
Expand Down Expand Up @@ -384,7 +384,7 @@ packages:
name: katana_model
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.13"
version: "1.3.15"
katana_router:
dependency: transitive
description:
Expand Down Expand Up @@ -419,14 +419,14 @@ packages:
name: katana_theme
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.6"
version: "1.2.7"
katana_theme_annotation:
dependency: transitive
description:
name: katana_theme_annotation
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.4"
version: "1.2.5"
katana_ui:
dependency: transitive
description:
Expand Down
Loading

0 comments on commit 04f45cc

Please sign in to comment.