Skip to content

Commit

Permalink
Merge pull request #472 from MewsSystems/update-flutter
Browse files Browse the repository at this point in the history
ci: Bump Flutter to 3.16.0
  • Loading branch information
ookami-kb authored Nov 28, 2023
2 parents dfe8a6d + 5348fd9 commit a471309
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 31 deletions.
2 changes: 1 addition & 1 deletion .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ runs:
- name: Set up Flutter
uses: subosito/flutter-action@ea686d7c56499339ad176e9f19c516ff6cf05a31
with:
flutter-version: 3.13.9
flutter-version: 3.16.0
cache: true

- name: Set up environment paths
Expand Down
3 changes: 2 additions & 1 deletion optimus/lib/src/avatar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ class OptimusAvatar extends StatelessWidget {
),
child: Center(
child: MediaQuery(
data: MediaQuery.of(context).copyWith(textScaleFactor: 1.0),
data: MediaQuery.of(context)
.copyWith(textScaler: TextScaler.noScaling),
child: imageUrl != null
? FadeInImage.memoryNetwork(
width: _diameter,
Expand Down
24 changes: 10 additions & 14 deletions optimus/lib/src/dropdown/dropdown_select.dart
Original file line number Diff line number Diff line change
Expand Up @@ -150,29 +150,24 @@ class _DropdownSelectState<T> extends State<DropdownSelect<T>> {
});
}

bool _handleOnBackPressed() {
void _handleOnBackPressed(bool didPop) {
if (didPop) return;
if (_effectiveFocusNode.hasFocus) {
_effectiveFocusNode.unfocus();

return false;
} else if (widget.embeddedSearch != null) {
final overlay = _overlayEntry;
if (overlay != null) {
_removeOverlay();

return false;
}
}

return true;
final overlay = _overlayEntry;
if (overlay != null) _removeOverlay();
}

bool get _canPop => !_effectiveFocusNode.hasFocus && _overlayEntry == null;

void _showOverlay() {
if (_overlayEntry != null) return;
_overlayEntry = _createOverlayEntry().also((it) {
Overlay.of(context, rootOverlay: widget.rootOverlay).insert(it);
widget.onDropdownShow?.call();
});
setState(() {});
}

void _removeOverlay() {
Expand Down Expand Up @@ -291,8 +286,9 @@ class _DropdownSelectState<T> extends State<DropdownSelect<T>> {
isUpdating: widget.isUpdating,
);

return WillPopScope(
onWillPop: () async => _handleOnBackPressed(),
return PopScope(
canPop: _canPop,
onPopInvoked: _handleOnBackPressed,
child: widget.multiselect && _hasValues
? MultiSelectInputField(
values: _values ?? [],
Expand Down
14 changes: 5 additions & 9 deletions optimus/lib/src/overlay_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -101,15 +101,11 @@ class _OverlayControllerState<T> extends State<OverlayController<T>> {
}

@override
Widget build(BuildContext context) => WillPopScope(
onWillPop: () async {
if (widget.focusNode.hasFocus) {
widget.focusNode.unfocus();

return false;
}

return true;
Widget build(BuildContext context) => PopScope(
canPop: !widget.focusNode.hasFocus,
onPopInvoked: (bool didPop) {
if (didPop) return;
widget.focusNode.unfocus();
},
child: widget.child,
);
Expand Down
5 changes: 2 additions & 3 deletions storybook/lib/stories/icon/icon.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import 'package:flutter/foundation.dart';
import 'package:flutter/widgets.dart';
import 'package:optimus/optimus.dart';
import 'package:storybook/utils.dart';
Expand All @@ -24,7 +23,7 @@ final Story iconStory = Story(
.map(
(c) => OptimusListTile(
title: OptimusSubsectionTitle(
child: Text(describeEnum(c).toUpperCase()),
child: Text(c.name.toUpperCase()),
),
prefix: OptimusIcon(
iconData: icon,
Expand Down Expand Up @@ -53,7 +52,7 @@ final Story supplementaryIconStory = Story(
.map(
(c) => OptimusListTile(
title: OptimusSubsectionTitle(
child: Text(describeEnum(c).toUpperCase()),
child: Text(c.name.toUpperCase()),
),
prefix: OptimusSupplementaryIcon(
iconData: icon,
Expand Down
5 changes: 2 additions & 3 deletions storybook/lib/stories/tags.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:optimus/optimus.dart';
import 'package:storybook/utils.dart';
Expand Down Expand Up @@ -32,7 +31,7 @@ final Story tagStory = Story(
(c) => Padding(
padding: const EdgeInsets.all(8),
child: OptimusTag(
text: text.isEmpty ? describeEnum(c) : text,
text: text.isEmpty ? c.name : text,
leadingIcon: leadingIcon,
trailingIcon: trailingIcon,
colorOption: c,
Expand All @@ -50,7 +49,7 @@ final Story tagStory = Story(
(c) => Padding(
padding: const EdgeInsets.all(8),
child: OptimusCategoricalTag(
text: text.isEmpty ? describeEnum(c) : text,
text: text.isEmpty ? c.name : text,
leadingIcon: leadingIcon,
trailingIcon: trailingIcon,
colorOption: c,
Expand Down

0 comments on commit a471309

Please sign in to comment.