Skip to content

Commit 1e0f7f1

Browse files
committed
Bump up version
1 parent 447b253 commit 1e0f7f1

File tree

9 files changed

+31
-4
lines changed

9 files changed

+31
-4
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.2.1
2+
3+
- Add isDestructiveAction to showTextInputDialog and showTextAnswerDialog
4+
15
## 0.2.0
26

37
- Add showTextInputDialog

README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,17 @@ iOS | Android
3030
<img width="497" alt="n11" src="https://user-images.githubusercontent.com/1255062/77220742-5d1a0f00-6b86-11ea-9991-e1b5677eebf3.png"> | <img width="497" alt="n12" src="https://user-images.githubusercontent.com/1255062/77220743-5db2a580-6b86-11ea-9d9c-7b474a222c92.png">
3131

3232

33-
## [showTextInputDialog]()
33+
## [showTextInputDialog](https://pub.dev/documentation/adaptive_dialog/latest/adaptive_dialog/showTextInputDialog.html)
3434

3535
iOS | Android
3636
--- | ---
3737
<img width="516" alt="n1" src="https://user-images.githubusercontent.com/1255062/77243708-6b346200-6c50-11ea-9b54-252accd1df66.png"> | <img width="516" alt="n2" src="https://user-images.githubusercontent.com/1255062/77243709-6f607f80-6c50-11ea-8b71-a8932adc3dd7.png">
3838
<img width="516" alt="n3" src="https://user-images.githubusercontent.com/1255062/77243711-6ff91600-6c50-11ea-8458-56d75b958283.png"> | <img width="516" alt="n4" src="https://user-images.githubusercontent.com/1255062/77243712-7091ac80-6c50-11ea-8c08-be62e0999267.png">
3939

40-
## [showTextAnswerDialog]()
40+
## [showTextAnswerDialog](https://pub.dev/documentation/adaptive_dialog/latest/adaptive_dialog/showTextAnswerDialog.html)
41+
42+
Show text input dialog until answer is correct or cancelled.
43+
This is useful for preventing very destructive action is executed mistakenly.
4144

4245
iOS | Android
4346
--- | ---

example/lib/pages/text_input_dialog_page.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ class TextInputDialogPage extends StatelessWidget {
8787
keyword: 'Flutter',
8888
title: 'What\'s the best mobile application framework?',
8989
message: 'Input answer and press OK',
90+
isDestructiveAction: true,
9091
hintText: 'Start with "F"',
9192
retryTitle: 'Incorrect',
9293
retryMessage: 'Retry?',

example/pubspec.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ packages:
77
path: ".."
88
relative: true
99
source: path
10-
version: "0.2.0"
10+
version: "0.2.1"
1111
archive:
1212
dependency: transitive
1313
description:

lib/src/text_input_dialog/cupertino_text_input_dialog.dart

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ class CupertinoTextInputDialog extends StatefulWidget {
1010
this.message,
1111
this.okLabel,
1212
this.cancelLabel,
13+
this.isDestructiveAction = false,
1314
this.style = AdaptiveStyle.adaptive,
1415
});
1516
@override
@@ -21,6 +22,7 @@ class CupertinoTextInputDialog extends StatefulWidget {
2122
final String message;
2223
final String okLabel;
2324
final String cancelLabel;
25+
final bool isDestructiveAction;
2426
final AdaptiveStyle style;
2527
}
2628

@@ -46,6 +48,8 @@ class _CupertinoTextInputDialogState extends State<CupertinoTextInputDialog> {
4648

4749
@override
4850
Widget build(BuildContext context) {
51+
final theme = Theme.of(context);
52+
final colorScheme = theme.colorScheme;
4953
final navigator = Navigator.of(context);
5054
void pop() => navigator.pop(
5155
_textControllers.map((c) => c.text).toList(),
@@ -54,6 +58,9 @@ class _CupertinoTextInputDialogState extends State<CupertinoTextInputDialog> {
5458
final titleText = widget.title == null ? null : Text(widget.title);
5559
final okText = Text(
5660
widget.okLabel ?? MaterialLocalizations.of(context).okButtonLabel,
61+
style: TextStyle(
62+
color: widget.isDestructiveAction ? colorScheme.error : null,
63+
),
5764
);
5865
BoxDecoration borderDecoration({
5966
@required bool isTopRounded,

lib/src/text_input_dialog/material_text_input_dialog.dart

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ class MaterialTextInputDialog extends StatefulWidget {
99
this.message,
1010
this.okLabel,
1111
this.cancelLabel,
12+
this.isDestructiveAction = false,
1213
this.style = AdaptiveStyle.adaptive,
1314
});
1415
@override
@@ -20,6 +21,7 @@ class MaterialTextInputDialog extends StatefulWidget {
2021
final String message;
2122
final String okLabel;
2223
final String cancelLabel;
24+
final bool isDestructiveAction;
2325
final AdaptiveStyle style;
2426
}
2527

@@ -45,6 +47,8 @@ class _MaterialTextInputDialogState extends State<MaterialTextInputDialog> {
4547

4648
@override
4749
Widget build(BuildContext context) {
50+
final theme = Theme.of(context);
51+
final colorScheme = theme.colorScheme;
4852
final navigator = Navigator.of(context);
4953
void pop() => navigator.pop(
5054
_textControllers.map((c) => c.text).toList(),
@@ -53,6 +57,9 @@ class _MaterialTextInputDialogState extends State<MaterialTextInputDialog> {
5357
final titleText = widget.title == null ? null : Text(widget.title);
5458
final okText = Text(
5559
widget.okLabel ?? MaterialLocalizations.of(context).okButtonLabel,
60+
style: TextStyle(
61+
color: widget.isDestructiveAction ? colorScheme.error : null,
62+
),
5663
);
5764
return AlertDialog(
5865
title: titleText,

lib/src/text_input_dialog/text_answer_dialog.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Future<bool> showTextAnswerDialog({
88
String message,
99
String okLabel,
1010
String cancelLabel,
11+
bool isDestructiveAction = false,
1112
String hintText,
1213
String retryTitle,
1314
String retryMessage,
@@ -24,6 +25,7 @@ Future<bool> showTextAnswerDialog({
2425
message: message,
2526
okLabel: okLabel,
2627
cancelLabel: cancelLabel,
28+
isDestructiveAction: isDestructiveAction,
2729
style: style,
2830
);
2931
final text = texts == null ? null : texts[0];

lib/src/text_input_dialog/text_input_dialog.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ Future<List<String>> showTextInputDialog({
1212
String message,
1313
String okLabel,
1414
String cancelLabel,
15+
bool isDestructiveAction = false,
1516
AdaptiveStyle style = AdaptiveStyle.adaptive,
1617
}) {
1718
final theme = Theme.of(context);
@@ -24,6 +25,7 @@ Future<List<String>> showTextInputDialog({
2425
message: message,
2526
okLabel: okLabel,
2627
cancelLabel: cancelLabel,
28+
isDestructiveAction: isDestructiveAction,
2729
style: style,
2830
),
2931
)
@@ -35,6 +37,7 @@ Future<List<String>> showTextInputDialog({
3537
message: message,
3638
okLabel: okLabel,
3739
cancelLabel: cancelLabel,
40+
isDestructiveAction: isDestructiveAction,
3841
style: style,
3942
),
4043
);

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: adaptive_dialog
22
description: Show alert dialog or modal action sheet adaptively according to platform.
3-
version: 0.2.0
3+
version: 0.2.1
44
homepage: https://github.com/mono0926/adaptive_dialog
55
environment:
66
sdk: ">=2.6.0 <3.0.0"

0 commit comments

Comments
 (0)