File tree Expand file tree Collapse file tree 5 files changed +21
-30
lines changed Expand file tree Collapse file tree 5 files changed +21
-30
lines changed Original file line number Diff line number Diff line change @@ -43,7 +43,8 @@ class OptimusAvatar extends StatelessWidget {
43
43
),
44
44
child: Center (
45
45
child: MediaQuery (
46
- data: MediaQuery .of (context).copyWith (textScaleFactor: 1.0 ),
46
+ data: MediaQuery .of (context)
47
+ .copyWith (textScaler: TextScaler .noScaling),
47
48
child: imageUrl != null
48
49
? FadeInImage .memoryNetwork (
49
50
width: _diameter,
Original file line number Diff line number Diff line change @@ -150,29 +150,24 @@ class _DropdownSelectState<T> extends State<DropdownSelect<T>> {
150
150
});
151
151
}
152
152
153
- bool _handleOnBackPressed () {
153
+ void _handleOnBackPressed (bool didPop) {
154
+ if (didPop) return ;
154
155
if (_effectiveFocusNode.hasFocus) {
155
156
_effectiveFocusNode.unfocus ();
156
-
157
- return false ;
158
- } else if (widget.embeddedSearch != null ) {
159
- final overlay = _overlayEntry;
160
- if (overlay != null ) {
161
- _removeOverlay ();
162
-
163
- return false ;
164
- }
165
157
}
166
-
167
- return true ;
158
+ final overlay = _overlayEntry;
159
+ if (overlay != null ) _removeOverlay () ;
168
160
}
169
161
162
+ bool get _canPop => ! _effectiveFocusNode.hasFocus && _overlayEntry == null ;
163
+
170
164
void _showOverlay () {
171
165
if (_overlayEntry != null ) return ;
172
166
_overlayEntry = _createOverlayEntry ().also ((it) {
173
167
Overlay .of (context, rootOverlay: widget.rootOverlay).insert (it);
174
168
widget.onDropdownShow? .call ();
175
169
});
170
+ setState (() {});
176
171
}
177
172
178
173
void _removeOverlay () {
@@ -291,8 +286,9 @@ class _DropdownSelectState<T> extends State<DropdownSelect<T>> {
291
286
isUpdating: widget.isUpdating,
292
287
);
293
288
294
- return WillPopScope (
295
- onWillPop: () async => _handleOnBackPressed (),
289
+ return PopScope (
290
+ canPop: _canPop,
291
+ onPopInvoked: _handleOnBackPressed,
296
292
child: widget.multiselect && _hasValues
297
293
? MultiSelectInputField (
298
294
values: _values ?? [],
Original file line number Diff line number Diff line change @@ -101,15 +101,11 @@ class _OverlayControllerState<T> extends State<OverlayController<T>> {
101
101
}
102
102
103
103
@override
104
- Widget build (BuildContext context) => WillPopScope (
105
- onWillPop: () async {
106
- if (widget.focusNode.hasFocus) {
107
- widget.focusNode.unfocus ();
108
-
109
- return false ;
110
- }
111
-
112
- return true ;
104
+ Widget build (BuildContext context) => PopScope (
105
+ canPop: ! widget.focusNode.hasFocus,
106
+ onPopInvoked: (bool didPop) {
107
+ if (didPop) return ;
108
+ widget.focusNode.unfocus ();
113
109
},
114
110
child: widget.child,
115
111
);
Original file line number Diff line number Diff line change 1
- import 'package:flutter/foundation.dart' ;
2
1
import 'package:flutter/widgets.dart' ;
3
2
import 'package:optimus/optimus.dart' ;
4
3
import 'package:storybook/utils.dart' ;
@@ -24,7 +23,7 @@ final Story iconStory = Story(
24
23
.map (
25
24
(c) => OptimusListTile (
26
25
title: OptimusSubsectionTitle (
27
- child: Text (describeEnum (c) .toUpperCase ()),
26
+ child: Text (c.name .toUpperCase ()),
28
27
),
29
28
prefix: OptimusIcon (
30
29
iconData: icon,
@@ -53,7 +52,7 @@ final Story supplementaryIconStory = Story(
53
52
.map (
54
53
(c) => OptimusListTile (
55
54
title: OptimusSubsectionTitle (
56
- child: Text (describeEnum (c) .toUpperCase ()),
55
+ child: Text (c.name .toUpperCase ()),
57
56
),
58
57
prefix: OptimusSupplementaryIcon (
59
58
iconData: icon,
Original file line number Diff line number Diff line change 1
- import 'package:flutter/foundation.dart' ;
2
1
import 'package:flutter/material.dart' ;
3
2
import 'package:optimus/optimus.dart' ;
4
3
import 'package:storybook/utils.dart' ;
@@ -32,7 +31,7 @@ final Story tagStory = Story(
32
31
(c) => Padding (
33
32
padding: const EdgeInsets .all (8 ),
34
33
child: OptimusTag (
35
- text: text.isEmpty ? describeEnum (c) : text,
34
+ text: text.isEmpty ? c.name : text,
36
35
leadingIcon: leadingIcon,
37
36
trailingIcon: trailingIcon,
38
37
colorOption: c,
@@ -50,7 +49,7 @@ final Story tagStory = Story(
50
49
(c) => Padding (
51
50
padding: const EdgeInsets .all (8 ),
52
51
child: OptimusCategoricalTag (
53
- text: text.isEmpty ? describeEnum (c) : text,
52
+ text: text.isEmpty ? c.name : text,
54
53
leadingIcon: leadingIcon,
55
54
trailingIcon: trailingIcon,
56
55
colorOption: c,
You can’t perform that action at this time.
0 commit comments