Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.

Commit 329f86a

Browse files
Make a few values non-nullable in cupertino (#119478)
1 parent 18c7f8a commit 329f86a

File tree

2 files changed

+12
-17
lines changed

2 files changed

+12
-17
lines changed

packages/flutter/lib/src/cupertino/route.dart

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1010,14 +1010,12 @@ class CupertinoModalPopupRoute<T> extends PopupRoute<T> {
10101010
this.barrierLabel = 'Dismiss',
10111011
this.barrierColor = kCupertinoModalBarrierColor,
10121012
bool barrierDismissible = true,
1013-
bool? semanticsDismissible,
1013+
bool semanticsDismissible = false,
10141014
super.filter,
10151015
super.settings,
10161016
this.anchorPoint,
1017-
}) {
1018-
_barrierDismissible = barrierDismissible;
1019-
_semanticsDismissible = semanticsDismissible;
1020-
}
1017+
}) : _barrierDismissible = barrierDismissible,
1018+
_semanticsDismissible = semanticsDismissible;
10211019

10221020
/// A builder that builds the widget tree for the [CupertinoModalPopupRoute].
10231021
///
@@ -1029,9 +1027,9 @@ class CupertinoModalPopupRoute<T> extends PopupRoute<T> {
10291027
/// widget needs to update dynamically.
10301028
final WidgetBuilder builder;
10311029

1032-
bool? _barrierDismissible;
1030+
final bool _barrierDismissible;
10331031

1034-
bool? _semanticsDismissible;
1032+
final bool _semanticsDismissible;
10351033

10361034
@override
10371035
final String barrierLabel;
@@ -1040,10 +1038,10 @@ class CupertinoModalPopupRoute<T> extends PopupRoute<T> {
10401038
final Color? barrierColor;
10411039

10421040
@override
1043-
bool get barrierDismissible => _barrierDismissible ?? true;
1041+
bool get barrierDismissible => _barrierDismissible;
10441042

10451043
@override
1046-
bool get semanticsDismissible => _semanticsDismissible ?? false;
1044+
bool get semanticsDismissible => _semanticsDismissible;
10471045

10481046
@override
10491047
Duration get transitionDuration => _kModalPopupTransitionDuration;
@@ -1167,7 +1165,7 @@ Future<T?> showCupertinoModalPopup<T>({
11671165
Color barrierColor = kCupertinoModalBarrierColor,
11681166
bool barrierDismissible = true,
11691167
bool useRootNavigator = true,
1170-
bool? semanticsDismissible,
1168+
bool semanticsDismissible = false,
11711169
RouteSettings? routeSettings,
11721170
Offset? anchorPoint,
11731171
}) {

packages/flutter/lib/src/cupertino/tab_view.dart

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -175,13 +175,13 @@ class _CupertinoTabViewState extends State<CupertinoTabView> {
175175

176176
Route<dynamic>? _onGenerateRoute(RouteSettings settings) {
177177
final String? name = settings.name;
178-
WidgetBuilder? routeBuilder;
178+
final WidgetBuilder? routeBuilder;
179179
String? title;
180180
if (name == Navigator.defaultRouteName && widget.builder != null) {
181181
routeBuilder = widget.builder;
182182
title = widget.defaultTitle;
183-
} else if (widget.routes != null) {
184-
routeBuilder = widget.routes![name];
183+
} else {
184+
routeBuilder = widget.routes?[name];
185185
}
186186
if (routeBuilder != null) {
187187
return CupertinoPageRoute<dynamic>(
@@ -190,10 +190,7 @@ class _CupertinoTabViewState extends State<CupertinoTabView> {
190190
settings: settings,
191191
);
192192
}
193-
if (widget.onGenerateRoute != null) {
194-
return widget.onGenerateRoute!(settings);
195-
}
196-
return null;
193+
return widget.onGenerateRoute?.call(settings);
197194
}
198195

199196
Route<dynamic>? _onUnknownRoute(RouteSettings settings) {

0 commit comments

Comments
 (0)