Skip to content

Commit cecede0

Browse files
Merge pull request #9 from definitelyme/deps-update
Upgrade `flutter_platform_widgets`
2 parents 08340f0 + fdb8f72 commit cecede0

File tree

9 files changed

+24
-164
lines changed

9 files changed

+24
-164
lines changed

lib/cupertino.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
export 'src/cupertino/cupertino.dart';
22

3-
export 'package:cupertino_list_tile/cupertino_list_tile.dart';
43
export 'package:cupertino_stepper/cupertino_stepper.dart';
54
export 'package:cupertino_progress_bar/cupertino_progress_bar.dart';

lib/enough_platform_widgets.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,4 @@ export 'src/cupertino/cupertino.dart';
44
export 'src/platform/platform.dart';
55

66
export 'package:cupertino_stepper/cupertino_stepper.dart';
7-
export 'package:cupertino_list_tile/cupertino_list_tile.dart';
87
export 'package:flutter_platform_widgets/flutter_platform_widgets.dart';

lib/platform.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
export 'src/platform/platform.dart';
22

3-
export 'package:cupertino_list_tile/cupertino_list_tile.dart';
43
export 'package:flutter_platform_widgets/flutter_platform_widgets.dart';

lib/src/platform/decorated_platform_textfield.dart

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ class DecoratedPlatformTextField extends StatelessWidget {
133133
/// If not set, select all and paste will default to be enabled. Copy and cut
134134
/// will be disabled if [obscureText] is true. If [readOnly] is true,
135135
/// paste and cut will be disabled regardless.
136-
final ToolbarOptions? toolbarOptions;
136+
final Widget Function(BuildContext, EditableTextState)? contextMenuBuilder;
137137

138138
/// {@macro flutter.widgets.editableText.showCursor}
139139
final bool? showCursor;
@@ -395,7 +395,7 @@ class DecoratedPlatformTextField extends StatelessWidget {
395395
this.textAlignVertical,
396396
this.textDirection,
397397
this.readOnly = false,
398-
this.toolbarOptions,
398+
this.contextMenuBuilder,
399399
this.showCursor,
400400
this.autofocus = false,
401401
this.obscuringCharacter = '•',
@@ -463,7 +463,7 @@ class DecoratedPlatformTextField extends StatelessWidget {
463463
textAlignVertical: textAlignVertical,
464464
textDirection: textDirection,
465465
readOnly: readOnly,
466-
toolbarOptions: toolbarOptions,
466+
contextMenuBuilder: contextMenuBuilder,
467467
showCursor: showCursor,
468468
obscuringCharacter: obscuringCharacter,
469469
smartDashesType: smartDashesType,
@@ -506,12 +506,8 @@ class DecoratedPlatformTextField extends StatelessWidget {
506506
obscureText: obscureText,
507507
onChanged: onChanged,
508508
keyboardAppearance: keyboardAppearance,
509-
placeholder: cupertinoShowLabel
510-
? decoration?.hintText
511-
: decoration?.labelText ?? decoration?.hintText,
512-
prefix: decoration?.prefix ??
513-
decoration?.prefixIcon ??
514-
(cupertinoShowLabel ? null : icon),
509+
placeholder: cupertinoShowLabel ? decoration?.hintText : decoration?.labelText ?? decoration?.hintText,
510+
prefix: decoration?.prefix ?? decoration?.prefixIcon ?? (cupertinoShowLabel ? null : icon),
515511
suffix: decoration?.suffix ?? decoration?.suffixIcon,
516512
suffixMode: cupertinoSuffixMode,
517513
clearButtonMode: OverlayVisibilityMode.editing,
@@ -525,7 +521,7 @@ class DecoratedPlatformTextField extends StatelessWidget {
525521
textAlign: textAlign,
526522
textAlignVertical: textAlignVertical,
527523
readOnly: readOnly,
528-
toolbarOptions: toolbarOptions,
524+
contextMenuBuilder: contextMenuBuilder,
529525
showCursor: showCursor,
530526
obscuringCharacter: obscuringCharacter,
531527
smartDashesType: smartDashesType,
@@ -552,9 +548,7 @@ class DecoratedPlatformTextField extends StatelessWidget {
552548
restorationId: restorationId,
553549
);
554550
final labelText = decoration?.labelText;
555-
if (cupertinoShowLabel &&
556-
cupertinoAlignLabelOnTop &&
557-
labelText != null) {
551+
if (cupertinoShowLabel && cupertinoAlignLabelOnTop && labelText != null) {
558552
if (icon != null) {
559553
content = Row(
560554
mainAxisAlignment: MainAxisAlignment.start,

lib/src/platform/dialog_helper.dart

Lines changed: 11 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,7 @@ class DialogHelper {
2929
content: Text(query),
3030
actions: [
3131
CupertinoDialogAction(
32-
child: cancelActionText != null
33-
? Text(cancelActionText)
34-
: Icon(CupertinoIcons.clear),
32+
child: cancelActionText != null ? Text(cancelActionText) : Icon(CupertinoIcons.clear),
3533
onPressed: () => Navigator.of(context).pop(false),
3634
),
3735
CupertinoDialogAction(
@@ -49,7 +47,10 @@ class DialogHelper {
4947
TextStyle? actionTextStyle;
5048
if (isDangerousAction) {
5149
actionButtonStyle = TextButton.styleFrom(
52-
backgroundColor: Colors.red, onSurface: Colors.white);
50+
backgroundColor: Colors.red,
51+
disabledForegroundColor: Colors.white,
52+
onSurface: Colors.white,
53+
);
5354
actionTextStyle = theme.textTheme.button!.copyWith(color: Colors.white);
5455
}
5556

@@ -59,9 +60,7 @@ class DialogHelper {
5960
content: Text(query),
6061
actions: [
6162
TextButton(
62-
child: cancelActionText != null
63-
? PlatformText(cancelActionText)
64-
: Icon(Icons.cancel),
63+
child: cancelActionText != null ? PlatformText(cancelActionText) : Icon(Icons.cancel),
6564
onPressed: () => Navigator.of(context).pop(false),
6665
),
6766
TextButton(
@@ -88,10 +87,7 @@ class DialogHelper {
8887
String? cancelActionText,
8988
}) {
9089
return showWidgetDialog(context, Text(text),
91-
title: title,
92-
actions: actions,
93-
okActionText: okActionText,
94-
cancelActionText: cancelActionText);
90+
title: title, actions: actions, okActionText: okActionText, cancelActionText: cancelActionText);
9591
}
9692

9793
/// Shows a dialog with the given [content].
@@ -110,21 +106,15 @@ class DialogHelper {
110106
String? cancelActionText,
111107
}) {
112108
actions ??= [
113-
if (defaultActions == DialogActions.cancel ||
114-
defaultActions == DialogActions.okAndCancel) ...{
109+
if (defaultActions == DialogActions.cancel || defaultActions == DialogActions.okAndCancel) ...{
115110
PlatformTextButton(
116-
child: cancelActionText != null
117-
? PlatformText(cancelActionText)
118-
: Icon(CommonPlatformIcons.cancel),
111+
child: cancelActionText != null ? PlatformText(cancelActionText) : Icon(CommonPlatformIcons.cancel),
119112
onPressed: () => Navigator.of(context).pop(false),
120113
),
121114
},
122-
if (defaultActions == DialogActions.ok ||
123-
defaultActions == DialogActions.okAndCancel) ...{
115+
if (defaultActions == DialogActions.ok || defaultActions == DialogActions.okAndCancel) ...{
124116
PlatformTextButton(
125-
child: okActionText != null
126-
? PlatformText(okActionText)
127-
: Icon(CommonPlatformIcons.ok),
117+
child: okActionText != null ? PlatformText(okActionText) : Icon(CommonPlatformIcons.ok),
128118
onPressed: () => Navigator.of(context).pop(true),
129119
),
130120
},

lib/src/platform/platform.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
export 'platform_info.dart';
22
export 'platform_chip.dart';
3-
export 'platform_list_tile.dart';
43
export 'platform_popup_button.dart';
54
export 'platform_stepper.dart';
65
export 'platform_toolbar.dart';

lib/src/platform/platform_dialog_action_text.dart

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,11 @@ class PlatformDialogActionText extends StatelessWidget {
3131
TextStyle? actionTextStyle;
3232
if (isDestructiveAction) {
3333
actionButtonStyle = TextButton.styleFrom(
34-
backgroundColor: Colors.red, onSurface: Colors.white);
35-
actionTextStyle =
36-
theme.textTheme.button!.copyWith(color: Colors.white);
34+
backgroundColor: Colors.red,
35+
disabledForegroundColor: Colors.white,
36+
onSurface: Colors.white,
37+
);
38+
actionTextStyle = theme.textTheme.button!.copyWith(color: Colors.white);
3739
}
3840
return TextButton(
3941
child: Text(text.toUpperCase(), style: actionTextStyle),

lib/src/platform/platform_list_tile.dart

Lines changed: 0 additions & 121 deletions
This file was deleted.

pubspec.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,11 @@ environment:
88
flutter: ">=1.17.0"
99

1010
dependencies:
11-
cupertino_list_tile: ^0.2.1
1211
cupertino_stepper: ^0.2.1
1312
cupertino_progress_bar: ^0.2.0
1413
flutter:
1514
sdk: flutter
16-
flutter_platform_widgets: ^2.0.0
15+
flutter_platform_widgets: ^3.0.0
1716

1817
dev_dependencies:
1918
flutter_test:

0 commit comments

Comments
 (0)