Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
6cb6eef6
Unverified
Commit
6cb6eef6
authored
Oct 23, 2020
by
Michael Goderbauer
Committed by
GitHub
Oct 23, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make Material/CupertinoLocalizations non-nullable (#68807)
parent
ce3ce20b
Changes
46
Hide whitespace changes
Inline
Side-by-side
Showing
46 changed files
with
245 additions
and
122 deletions
+245
-122
bottom_tab_bar.dart
packages/flutter/lib/src/cupertino/bottom_tab_bar.dart
+2
-9
date_picker.dart
packages/flutter/lib/src/cupertino/date_picker.dart
+3
-3
debug.dart
packages/flutter/lib/src/cupertino/debug.dart
+46
-0
dialog.dart
packages/flutter/lib/src/cupertino/dialog.dart
+1
-1
localizations.dart
packages/flutter/lib/src/cupertino/localizations.dart
+8
-4
route.dart
packages/flutter/lib/src/cupertino/route.dart
+1
-1
text_selection.dart
packages/flutter/lib/src/cupertino/text_selection.dart
+5
-5
about.dart
packages/flutter/lib/src/material/about.dart
+6
-6
app_bar.dart
packages/flutter/lib/src/material/app_bar.dart
+2
-2
back_button.dart
packages/flutter/lib/src/material/back_button.dart
+2
-2
bottom_navigation_bar.dart
packages/flutter/lib/src/material/bottom_navigation_bar.dart
+1
-1
bottom_sheet.dart
packages/flutter/lib/src/material/bottom_sheet.dart
+2
-2
chip.dart
packages/flutter/lib/src/material/chip.dart
+1
-1
dialog.dart
packages/flutter/lib/src/material/dialog.dart
+3
-4
drawer.dart
packages/flutter/lib/src/material/drawer.dart
+2
-3
dropdown.dart
packages/flutter/lib/src/material/dropdown.dart
+2
-2
expand_icon.dart
packages/flutter/lib/src/material/expand_icon.dart
+1
-1
expansion_panel.dart
packages/flutter/lib/src/material/expansion_panel.dart
+1
-1
material_localizations.dart
...ages/flutter/lib/src/material/material_localizations.dart
+8
-5
navigation_rail.dart
packages/flutter/lib/src/material/navigation_rail.dart
+1
-1
paginated_data_table.dart
packages/flutter/lib/src/material/paginated_data_table.dart
+1
-1
calendar_date_picker.dart
...lutter/lib/src/material/pickers/calendar_date_picker.dart
+4
-4
calendar_date_range_picker.dart
.../lib/src/material/pickers/calendar_date_range_picker.dart
+3
-3
date_picker_deprecated.dart
...tter/lib/src/material/pickers/date_picker_deprecated.dart
+1
-1
date_picker_dialog.dart
.../flutter/lib/src/material/pickers/date_picker_dialog.dart
+1
-1
date_range_picker_dialog.dart
...er/lib/src/material/pickers/date_range_picker_dialog.dart
+4
-4
input_date_picker.dart
...s/flutter/lib/src/material/pickers/input_date_picker.dart
+5
-5
input_date_range_picker.dart
...ter/lib/src/material/pickers/input_date_range_picker.dart
+6
-6
popup_menu.dart
packages/flutter/lib/src/material/popup_menu.dart
+5
-7
refresh_indicator.dart
packages/flutter/lib/src/material/refresh_indicator.dart
+1
-1
reorderable_list.dart
packages/flutter/lib/src/material/reorderable_list.dart
+1
-1
search.dart
packages/flutter/lib/src/material/search.dart
+1
-1
stepper.dart
packages/flutter/lib/src/material/stepper.dart
+1
-1
tabs.dart
packages/flutter/lib/src/material/tabs.dart
+1
-1
text_field.dart
packages/flutter/lib/src/material/text_field.dart
+1
-1
text_selection.dart
packages/flutter/lib/src/material/text_selection.dart
+1
-1
theme.dart
packages/flutter/lib/src/material/theme.dart
+1
-1
time.dart
packages/flutter/lib/src/material/time.dart
+1
-1
time_picker.dart
packages/flutter/lib/src/material/time_picker.dart
+20
-20
user_accounts_drawer_header.dart
...flutter/lib/src/material/user_accounts_drawer_header.dart
+2
-2
app_test.dart
packages/flutter/test/cupertino/app_test.dart
+2
-2
debug_test.dart
packages/flutter/test/cupertino/debug_test.dart
+33
-0
localizations_test.dart
packages/flutter/test/cupertino/localizations_test.dart
+24
-0
app_test.dart
packages/flutter/test/material/app_test.dart
+2
-2
localizations_test.dart
packages/flutter/test/material/localizations_test.dart
+24
-0
time_picker_test.dart
packages/flutter/test/material/time_picker_test.dart
+1
-1
No files found.
packages/flutter/lib/src/cupertino/bottom_tab_bar.dart
View file @
6cb6eef6
...
...
@@ -209,14 +209,7 @@ class CupertinoTabBar extends StatelessWidget implements PreferredSizeWidget {
List
<
Widget
>
_buildTabItems
(
BuildContext
context
)
{
final
List
<
Widget
>
result
=
<
Widget
>[];
final
CupertinoLocalizations
?
localizations
=
CupertinoLocalizations
.
of
(
context
);
assert
(
localizations
!=
null
,
'CupertinoTabBar requires a Localizations parent in order to provide an '
'appropriate Semantics hint for tab indexing. A CupertinoApp will '
'provide the DefaultCupertinoLocalizations, or you can instantiate your '
'own Localizations.'
);
final
CupertinoLocalizations
localizations
=
CupertinoLocalizations
.
of
(
context
);
for
(
int
index
=
0
;
index
<
items
.
length
;
index
+=
1
)
{
final
bool
active
=
index
==
currentIndex
;
...
...
@@ -226,7 +219,7 @@ class CupertinoTabBar extends StatelessWidget implements PreferredSizeWidget {
Expanded
(
child:
Semantics
(
selected:
active
,
hint:
localizations
!
.
tabSemanticsLabel
(
hint:
localizations
.
tabSemanticsLabel
(
tabIndex:
index
+
1
,
tabCount:
items
.
length
,
),
...
...
packages/flutter/lib/src/cupertino/date_picker.dart
View file @
6cb6eef6
...
...
@@ -623,7 +623,7 @@ class _CupertinoDatePickerDateTimeState extends State<CupertinoDatePicker> {
super
.
didChangeDependencies
();
textDirectionFactor
=
Directionality
.
of
(
context
)
==
TextDirection
.
ltr
?
1
:
-
1
;
localizations
=
CupertinoLocalizations
.
of
(
context
)
!
;
localizations
=
CupertinoLocalizations
.
of
(
context
);
alignCenterLeft
=
textDirectionFactor
==
1
?
Alignment
.
centerLeft
:
Alignment
.
centerRight
;
alignCenterRight
=
textDirectionFactor
==
1
?
Alignment
.
centerRight
:
Alignment
.
centerLeft
;
...
...
@@ -1113,7 +1113,7 @@ class _CupertinoDatePickerDateState extends State<CupertinoDatePicker> {
super
.
didChangeDependencies
();
textDirectionFactor
=
Directionality
.
of
(
context
)
==
TextDirection
.
ltr
?
1
:
-
1
;
localizations
=
CupertinoLocalizations
.
of
(
context
)
!
;
localizations
=
CupertinoLocalizations
.
of
(
context
);
alignCenterLeft
=
textDirectionFactor
==
1
?
Alignment
.
centerLeft
:
Alignment
.
centerRight
;
alignCenterRight
=
textDirectionFactor
==
1
?
Alignment
.
centerRight
:
Alignment
.
centerLeft
;
...
...
@@ -1621,7 +1621,7 @@ class _CupertinoTimerPickerState extends State<CupertinoTimerPicker> {
super
.
didChangeDependencies
();
textDirection
=
Directionality
.
of
(
context
)!;
localizations
=
CupertinoLocalizations
.
of
(
context
)
!
;
localizations
=
CupertinoLocalizations
.
of
(
context
);
_measureLabelMetrics
();
}
...
...
packages/flutter/lib/src/cupertino/debug.dart
0 → 100644
View file @
6cb6eef6
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import
'package:flutter/foundation.dart'
;
import
'package:flutter/widgets.dart'
;
import
'localizations.dart'
;
/// Asserts that the given context has a [Localizations] ancestor that contains
/// a [CupertinoLocalizations] delegate.
///
/// To call this function, use the following pattern, typically in the
/// relevant Widget's build method:
///
/// ```dart
/// assert(debugCheckHasCupertinoLocalizations(context));
/// ```
///
/// Does nothing if asserts are disabled. Always returns true.
bool
debugCheckHasCupertinoLocalizations
(
BuildContext
context
)
{
assert
(()
{
if
(
Localizations
.
of
<
CupertinoLocalizations
>(
context
,
CupertinoLocalizations
)
==
null
)
{
throw
FlutterError
.
fromParts
(<
DiagnosticsNode
>[
ErrorSummary
(
'No CupertinoLocalizations found.'
),
ErrorDescription
(
'
${context.widget.runtimeType}
widgets require CupertinoLocalizations '
'to be provided by a Localizations widget ancestor.'
),
ErrorDescription
(
'The cupertino library uses Localizations to generate messages, '
'labels, and abbreviations.'
),
ErrorHint
(
'To introduce a CupertinoLocalizations, either use a '
'CupertinoApp at the root of your application to include them '
'automatically, or add a Localization widget with a '
'CupertinoLocalizations delegate.'
),
...
context
.
describeMissingAncestor
(
expectedAncestorType:
CupertinoLocalizations
)
]);
}
return
true
;
}());
return
true
;
}
packages/flutter/lib/src/cupertino/dialog.dart
View file @
6cb6eef6
...
...
@@ -226,7 +226,7 @@ class CupertinoAlertDialog extends StatelessWidget {
@override
Widget
build
(
BuildContext
context
)
{
final
CupertinoLocalizations
localizations
=
CupertinoLocalizations
.
of
(
context
)
!
;
final
CupertinoLocalizations
localizations
=
CupertinoLocalizations
.
of
(
context
);
final
bool
isInAccessibilityMode
=
_isInAccessibilityMode
(
context
);
final
double
textScaleFactor
=
MediaQuery
.
of
(
context
)!.
textScaleFactor
;
return
CupertinoUserInterfaceLevel
(
...
...
packages/flutter/lib/src/cupertino/localizations.dart
View file @
6cb6eef6
...
...
@@ -5,7 +5,7 @@
import
'package:flutter/foundation.dart'
;
import
'package:flutter/widgets.dart'
;
import
'd
ate_picker
.dart'
;
import
'd
ebug
.dart'
;
/// Determines the order of the columns inside [CupertinoDatePicker] in
/// time and date time mode.
...
...
@@ -242,8 +242,11 @@ abstract class CupertinoLocalizations {
/// The `CupertinoLocalizations` from the closest [Localizations] instance
/// that encloses the given context.
///
/// If no [CupertinoLocalizations] are available in the given `context`, this
/// method throws an exception.
///
/// This method is just a convenient shorthand for:
/// `Localizations.of<CupertinoLocalizations>(context, CupertinoLocalizations)`.
/// `Localizations.of<CupertinoLocalizations>(context, CupertinoLocalizations)
!
`.
///
/// References to the localized resources defined by this class are typically
/// written in terms of this method. For example:
...
...
@@ -251,8 +254,9 @@ abstract class CupertinoLocalizations {
/// ```dart
/// CupertinoLocalizations.of(context).anteMeridiemAbbreviation;
/// ```
static
CupertinoLocalizations
?
of
(
BuildContext
context
)
{
return
Localizations
.
of
<
CupertinoLocalizations
>(
context
,
CupertinoLocalizations
);
static
CupertinoLocalizations
of
(
BuildContext
context
)
{
debugCheckHasCupertinoLocalizations
(
context
);
return
Localizations
.
of
<
CupertinoLocalizations
>(
context
,
CupertinoLocalizations
)!;
}
}
...
...
packages/flutter/lib/src/cupertino/route.dart
View file @
6cb6eef6
...
...
@@ -1146,7 +1146,7 @@ Future<T?> showCupertinoDialog<T>({
return
showGeneralDialog
(
context:
context
,
barrierDismissible:
barrierDismissible
,
barrierLabel:
CupertinoLocalizations
.
of
(
context
)
!
.
modalBarrierDismissLabel
,
barrierLabel:
CupertinoLocalizations
.
of
(
context
).
modalBarrierDismissLabel
,
barrierColor:
CupertinoDynamicColor
.
resolve
(
_kModalBarrierColor
,
context
)!,
// This transition duration was eyeballed comparing with iOS
transitionDuration:
const
Duration
(
milliseconds:
250
),
...
...
packages/flutter/lib/src/cupertino/text_selection.dart
View file @
6cb6eef6
...
...
@@ -152,7 +152,7 @@ class _CupertinoTextSelectionToolbarWrapperState extends State<_CupertinoTextSel
}
final
List
<
Widget
>
items
=
<
Widget
>[];
final
CupertinoLocalizations
?
localizations
=
CupertinoLocalizations
.
of
(
context
);
final
CupertinoLocalizations
localizations
=
CupertinoLocalizations
.
of
(
context
);
final
EdgeInsets
arrowPadding
=
widget
.
isArrowPointingDown
?
EdgeInsets
.
only
(
bottom:
_kToolbarArrowSize
.
height
)
:
EdgeInsets
.
only
(
top:
_kToolbarArrowSize
.
height
);
...
...
@@ -183,17 +183,17 @@ class _CupertinoTextSelectionToolbarWrapperState extends State<_CupertinoTextSel
}
if
(
widget
.
handleCut
!=
null
)
{
addToolbarButton
(
localizations
!
.
cutButtonLabel
,
widget
.
handleCut
!);
addToolbarButton
(
localizations
.
cutButtonLabel
,
widget
.
handleCut
!);
}
if
(
widget
.
handleCopy
!=
null
)
{
addToolbarButton
(
localizations
!
.
copyButtonLabel
,
widget
.
handleCopy
!);
addToolbarButton
(
localizations
.
copyButtonLabel
,
widget
.
handleCopy
!);
}
if
(
widget
.
handlePaste
!=
null
&&
_clipboardStatus
.
value
==
ClipboardStatus
.
pasteable
)
{
addToolbarButton
(
localizations
!
.
pasteButtonLabel
,
widget
.
handlePaste
!);
addToolbarButton
(
localizations
.
pasteButtonLabel
,
widget
.
handlePaste
!);
}
if
(
widget
.
handleSelectAll
!=
null
)
{
addToolbarButton
(
localizations
!
.
selectAllButtonLabel
,
widget
.
handleSelectAll
!);
addToolbarButton
(
localizations
.
selectAllButtonLabel
,
widget
.
handleSelectAll
!);
}
return
CupertinoTextSelectionToolbar
.
_
(
...
...
packages/flutter/lib/src/material/about.dart
View file @
6cb6eef6
...
...
@@ -201,7 +201,7 @@ class AboutListTile extends StatelessWidget {
assert
(
debugCheckHasMaterialLocalizations
(
context
));
return
ListTile
(
leading:
icon
,
title:
child
??
Text
(
MaterialLocalizations
.
of
(
context
)
!
.
aboutListTileTitle
(
title:
child
??
Text
(
MaterialLocalizations
.
of
(
context
).
aboutListTileTitle
(
applicationName
??
_defaultApplicationName
(
context
),
)),
dense:
dense
,
...
...
@@ -405,7 +405,7 @@ class AboutDialog extends StatelessWidget {
),
actions:
<
Widget
>[
TextButton
(
child:
Text
(
MaterialLocalizations
.
of
(
context
)
!
.
viewLicensesButtonLabel
),
child:
Text
(
MaterialLocalizations
.
of
(
context
).
viewLicensesButtonLabel
),
onPressed:
()
{
showLicensePage
(
context:
context
,
...
...
@@ -417,7 +417,7 @@ class AboutDialog extends StatelessWidget {
},
),
TextButton
(
child:
Text
(
MaterialLocalizations
.
of
(
context
)
!
.
closeButtonLabel
),
child:
Text
(
MaterialLocalizations
.
of
(
context
).
closeButtonLabel
),
onPressed:
()
{
Navigator
.
pop
(
context
);
},
...
...
@@ -493,7 +493,7 @@ class _LicensePageState extends State<LicensePage> {
Widget
build
(
BuildContext
context
)
{
return
_MasterDetailFlow
(
detailPageFABlessGutterWidth:
_getGutterSize
(
context
),
title:
Text
(
MaterialLocalizations
.
of
(
context
)
!
.
licensesPageTitle
),
title:
Text
(
MaterialLocalizations
.
of
(
context
).
licensesPageTitle
),
detailPageBuilder:
_packageLicensePage
,
masterViewBuilder:
_packagesView
,
);
...
...
@@ -720,7 +720,7 @@ class _PackageListTile extends StatelessWidget {
color:
isSelected
?
Theme
.
of
(
context
)!.
highlightColor
:
Theme
.
of
(
context
)!.
cardColor
,
child:
ListTile
(
title:
Text
(
packageName
),
subtitle:
Text
(
MaterialLocalizations
.
of
(
context
)
!
.
licensesPackageDetailText
(
numberLicenses
)),
subtitle:
Text
(
MaterialLocalizations
.
of
(
context
).
licensesPackageDetailText
(
numberLicenses
)),
selected:
isSelected
,
onTap:
onTap
,
),
...
...
@@ -890,7 +890,7 @@ class _PackageLicensePageState extends State<_PackageLicensePage> {
@override
Widget
build
(
BuildContext
context
)
{
assert
(
debugCheckHasMaterialLocalizations
(
context
));
final
MaterialLocalizations
localizations
=
MaterialLocalizations
.
of
(
context
)
!
;
final
MaterialLocalizations
localizations
=
MaterialLocalizations
.
of
(
context
);
final
ThemeData
?
theme
=
Theme
.
of
(
context
);
final
String
title
=
widget
.
packageName
;
final
String
subtitle
=
localizations
.
licensesPackageDetailText
(
widget
.
licenseEntries
.
length
);
...
...
packages/flutter/lib/src/material/app_bar.dart
View file @
6cb6eef6
...
...
@@ -543,7 +543,7 @@ class _AppBarState extends State<AppBar> {
leading
=
IconButton
(
icon:
const
Icon
(
Icons
.
menu
),
onPressed:
_handleDrawerButton
,
tooltip:
MaterialLocalizations
.
of
(
context
)
!
.
openAppDrawerTooltip
,
tooltip:
MaterialLocalizations
.
of
(
context
).
openAppDrawerTooltip
,
);
}
else
{
if
(!
hasEndDrawer
&&
canPop
)
...
...
@@ -616,7 +616,7 @@ class _AppBarState extends State<AppBar> {
actions
=
IconButton
(
icon:
const
Icon
(
Icons
.
menu
),
onPressed:
_handleDrawerButtonEnd
,
tooltip:
MaterialLocalizations
.
of
(
context
)
!
.
openAppDrawerTooltip
,
tooltip:
MaterialLocalizations
.
of
(
context
).
openAppDrawerTooltip
,
);
}
...
...
packages/flutter/lib/src/material/back_button.dart
View file @
6cb6eef6
...
...
@@ -98,7 +98,7 @@ class BackButton extends StatelessWidget {
return
IconButton
(
icon:
const
BackButtonIcon
(),
color:
color
,
tooltip:
MaterialLocalizations
.
of
(
context
)
!
.
backButtonTooltip
,
tooltip:
MaterialLocalizations
.
of
(
context
).
backButtonTooltip
,
onPressed:
()
{
if
(
onPressed
!=
null
)
{
onPressed
!();
...
...
@@ -152,7 +152,7 @@ class CloseButton extends StatelessWidget {
return
IconButton
(
icon:
const
Icon
(
Icons
.
close
),
color:
color
,
tooltip:
MaterialLocalizations
.
of
(
context
)
!
.
closeButtonTooltip
,
tooltip:
MaterialLocalizations
.
of
(
context
).
closeButtonTooltip
,
onPressed:
()
{
if
(
onPressed
!=
null
)
{
onPressed
!();
...
...
packages/flutter/lib/src/material/bottom_navigation_bar.dart
View file @
6cb6eef6
...
...
@@ -823,7 +823,7 @@ class _BottomNavigationBarState extends State<BottomNavigationBar> with TickerPr
}
List
<
Widget
>
_createTiles
()
{
final
MaterialLocalizations
localizations
=
MaterialLocalizations
.
of
(
context
)
!
;
final
MaterialLocalizations
localizations
=
MaterialLocalizations
.
of
(
context
);
assert
(
localizations
!=
null
);
final
ThemeData
themeData
=
Theme
.
of
(
context
)!;
...
...
packages/flutter/lib/src/material/bottom_sheet.dart
View file @
6cb6eef6
...
...
@@ -370,7 +370,7 @@ class _ModalBottomSheetState<T> extends State<_ModalBottomSheet<T>> {
assert
(
debugCheckHasMediaQuery
(
context
));
assert
(
debugCheckHasMaterialLocalizations
(
context
));
final
MediaQueryData
?
mediaQuery
=
MediaQuery
.
of
(
context
);
final
MaterialLocalizations
localizations
=
MaterialLocalizations
.
of
(
context
)
!
;
final
MaterialLocalizations
localizations
=
MaterialLocalizations
.
of
(
context
);
final
String
routeLabel
=
_getRouteLabel
(
localizations
);
return
AnimatedBuilder
(
...
...
@@ -671,7 +671,7 @@ Future<T?> showModalBottomSheet<T>({
builder:
builder
,
theme:
Theme
.
of
(
context
,
shadowThemeOnly:
true
),
isScrollControlled:
isScrollControlled
,
barrierLabel:
MaterialLocalizations
.
of
(
context
)
!
.
modalBarrierDismissLabel
,
barrierLabel:
MaterialLocalizations
.
of
(
context
).
modalBarrierDismissLabel
,
backgroundColor:
backgroundColor
,
elevation:
elevation
,
shape:
shape
,
...
...
packages/flutter/lib/src/material/chip.dart
View file @
6cb6eef6
...
...
@@ -1789,7 +1789,7 @@ class _RawChipState extends State<RawChip> with TickerProviderStateMixin<RawChip
container:
true
,
button:
true
,
child:
_wrapWithTooltip
(
widget
.
deleteButtonTooltipMessage
??
MaterialLocalizations
.
of
(
context
)
?
.
deleteButtonTooltip
,
widget
.
deleteButtonTooltipMessage
??
MaterialLocalizations
.
of
(
context
).
deleteButtonTooltip
,
widget
.
onDeleted
,
GestureDetector
(
key:
deleteIconKey
,
...
...
packages/flutter/lib/src/material/dialog.dart
View file @
6cb6eef6
...
...
@@ -463,7 +463,7 @@ class AlertDialog extends StatelessWidget {
case
TargetPlatform
.
fuchsia
:
case
TargetPlatform
.
linux
:
case
TargetPlatform
.
windows
:
label
??=
MaterialLocalizations
.
of
(
context
)
?
.
alertDialogLabel
;
label
??=
MaterialLocalizations
.
of
(
context
).
alertDialogLabel
;
}
// The paddingScaleFactor is used to adjust the padding of Dialog's
...
...
@@ -814,13 +814,12 @@ class SimpleDialog extends StatelessWidget {
switch
(
theme
.
platform
)
{
case
TargetPlatform
.
macOS
:
case
TargetPlatform
.
iOS
:
label
=
semanticLabel
;
break
;
case
TargetPlatform
.
android
:
case
TargetPlatform
.
fuchsia
:
case
TargetPlatform
.
linux
:
case
TargetPlatform
.
windows
:
label
=
semanticLabel
??
MaterialLocalizations
.
of
(
context
)
?
.
dialogLabel
;
label
=
semanticLabel
??
MaterialLocalizations
.
of
(
context
).
dialogLabel
;
}
}
...
...
@@ -997,7 +996,7 @@ Future<T?> showDialog<T>({
return
dialog
;
},
barrierDismissible:
barrierDismissible
,
barrierLabel:
MaterialLocalizations
.
of
(
context
)
!
.
modalBarrierDismissLabel
,
barrierLabel:
MaterialLocalizations
.
of
(
context
).
modalBarrierDismissLabel
,
barrierColor:
barrierColor
??
Colors
.
black54
,
transitionDuration:
const
Duration
(
milliseconds:
150
),
transitionBuilder:
_buildMaterialDialogTransitions
,
...
...
packages/flutter/lib/src/material/drawer.dart
View file @
6cb6eef6
...
...
@@ -180,13 +180,12 @@ class Drawer extends StatelessWidget {
switch
(
Theme
.
of
(
context
)!.
platform
)
{
case
TargetPlatform
.
iOS
:
case
TargetPlatform
.
macOS
:
label
=
semanticLabel
;
break
;
case
TargetPlatform
.
android
:
case
TargetPlatform
.
fuchsia
:
case
TargetPlatform
.
linux
:
case
TargetPlatform
.
windows
:
label
=
semanticLabel
??
MaterialLocalizations
.
of
(
context
)
?
.
drawerLabel
;
label
=
semanticLabel
??
MaterialLocalizations
.
of
(
context
).
drawerLabel
;
}
return
Semantics
(
scopesRoute:
true
,
...
...
@@ -566,7 +565,7 @@ class DrawerControllerState extends State<DrawerController> with SingleTickerPro
child:
GestureDetector
(
onTap:
close
,
child:
Semantics
(
label:
MaterialLocalizations
.
of
(
context
)
?
.
modalBarrierDismissLabel
,
label:
MaterialLocalizations
.
of
(
context
).
modalBarrierDismissLabel
,
child:
MouseRegion
(
opaque:
true
,
child:
Container
(
// The drawer's "scrim"
...
...
packages/flutter/lib/src/material/dropdown.dart
View file @
6cb6eef6
...
...
@@ -253,7 +253,7 @@ class _DropdownMenuState<T> extends State<_DropdownMenu<T>> {
// When the menu is dismissed we just fade the entire thing out
// in the first 0.25s.
assert
(
debugCheckHasMaterialLocalizations
(
context
));
final
MaterialLocalizations
localizations
=
MaterialLocalizations
.
of
(
context
)
!
;
final
MaterialLocalizations
localizations
=
MaterialLocalizations
.
of
(
context
);
final
_DropdownRoute
<
T
>
route
=
widget
.
route
;
final
List
<
Widget
>
children
=
<
Widget
>[
for
(
int
itemIndex
=
0
;
itemIndex
<
route
.
items
.
length
;
++
itemIndex
)
...
...
@@ -1216,7 +1216,7 @@ class _DropdownButtonState<T> extends State<DropdownButton<T>> with WidgetsBindi
elevation:
widget
.
elevation
,
theme:
Theme
.
of
(
context
,
shadowThemeOnly:
true
),
style:
_textStyle
!,
barrierLabel:
MaterialLocalizations
.
of
(
context
)
!
.
modalBarrierDismissLabel
,
barrierLabel:
MaterialLocalizations
.
of
(
context
).
modalBarrierDismissLabel
,
itemHeight:
widget
.
itemHeight
,
dropdownColor:
widget
.
dropdownColor
,
);
...
...
packages/flutter/lib/src/material/expand_icon.dart
View file @
6cb6eef6
...
...
@@ -167,7 +167,7 @@ class _ExpandIconState extends State<ExpandIcon> with SingleTickerProviderStateM
Widget
build
(
BuildContext
context
)
{
assert
(
debugCheckHasMaterial
(
context
));
assert
(
debugCheckHasMaterialLocalizations
(
context
));
final
MaterialLocalizations
localizations
=
MaterialLocalizations
.
of
(
context
)
!
;
final
MaterialLocalizations
localizations
=
MaterialLocalizations
.
of
(
context
);
final
String
onTapHint
=
widget
.
isExpanded
?
localizations
.
expandedIconTapHint
:
localizations
.
collapsedIconTapHint
;
return
Semantics
(
...
...
packages/flutter/lib/src/material/expansion_panel.dart
View file @
6cb6eef6
...
...
@@ -496,7 +496,7 @@ class _ExpansionPanelListState extends State<ExpansionPanelList> {
),
);
if
(!
child
.
canTapOnHeader
)
{
final
MaterialLocalizations
localizations
=
MaterialLocalizations
.
of
(
context
)
!
;
final
MaterialLocalizations
localizations
=
MaterialLocalizations
.
of
(
context
);
expandIconContainer
=
Semantics
(
label:
_isChildExpanded
(
index
)?
localizations
.
expandedIconTapHint
:
localizations
.
collapsedIconTapHint
,
container:
true
,
...
...
packages/flutter/lib/src/material/material_localizations.dart
View file @
6cb6eef6
...
...
@@ -5,8 +5,7 @@
import
'package:flutter/foundation.dart'
;
import
'package:flutter/widgets.dart'
;
import
'reorderable_list.dart'
;
import
'text_theme.dart'
;
import
'debug.dart'
;
import
'time.dart'
;
import
'typography.dart'
;
...
...
@@ -494,8 +493,11 @@ abstract class MaterialLocalizations {
/// The `MaterialLocalizations` from the closest [Localizations] instance
/// that encloses the given context.
///
/// If no [MaterialLocalizations] are available in the given `context`, this
/// method throws an exception.
///
/// This method is just a convenient shorthand for:
/// `Localizations.of<MaterialLocalizations>(context, MaterialLocalizations)`.
/// `Localizations.of<MaterialLocalizations>(context, MaterialLocalizations)
!
`.
///
/// References to the localized resources defined by this class are typically
/// written in terms of this method. For example:
...
...
@@ -503,8 +505,9 @@ abstract class MaterialLocalizations {
/// ```dart
/// tooltip: MaterialLocalizations.of(context).backButtonTooltip,
/// ```
static
MaterialLocalizations
?
of
(
BuildContext
context
)
{
return
Localizations
.
of
<
MaterialLocalizations
>(
context
,
MaterialLocalizations
);
static
MaterialLocalizations
of
(
BuildContext
context
)
{
debugCheckHasMaterialLocalizations
(
context
);
return
Localizations
.
of
<
MaterialLocalizations
>(
context
,
MaterialLocalizations
)!;
}
}
...
...
packages/flutter/lib/src/material/navigation_rail.dart
View file @
6cb6eef6
...
...
@@ -433,7 +433,7 @@ class _NavigationRailState extends State<NavigationRail> with TickerProviderStat
Widget
build
(
BuildContext
context
)
{
final
ThemeData
theme
=
Theme
.
of
(
context
)!;
final
NavigationRailThemeData
navigationRailTheme
=
NavigationRailTheme
.
of
(
context
);
final
MaterialLocalizations
localizations
=
MaterialLocalizations
.
of
(
context
)
!
;
final
MaterialLocalizations
localizations
=
MaterialLocalizations
.
of
(
context
);
final
Color
backgroundColor
=
widget
.
backgroundColor
??
navigationRailTheme
.
backgroundColor
??
theme
.
colorScheme
.
surface
;
final
double
elevation
=
widget
.
elevation
??
navigationRailTheme
.
elevation
??
0
;
...
...
packages/flutter/lib/src/material/paginated_data_table.dart
View file @
6cb6eef6
...
...
@@ -333,7 +333,7 @@ class PaginatedDataTableState extends State<PaginatedDataTable> {
// TODO(ianh): This whole build function doesn't handle RTL yet.
assert
(
debugCheckHasMaterialLocalizations
(
context
));
final
ThemeData
themeData
=
Theme
.
of
(
context
)!;
final
MaterialLocalizations
localizations
=
MaterialLocalizations
.
of
(
context
)
!
;
final
MaterialLocalizations
localizations
=
MaterialLocalizations
.
of
(
context
);
// HEADER
final
List
<
Widget
>
headerWidgets
=
<
Widget
>[];
double
startPadding
=
24.0
;
...
...
packages/flutter/lib/src/material/pickers/calendar_date_picker.dart
View file @
6cb6eef6
...
...
@@ -179,7 +179,7 @@ class _CalendarDatePickerState extends State<CalendarDatePicker> {
assert
(
debugCheckHasMaterial
(
context
));
assert
(
debugCheckHasMaterialLocalizations
(
context
));
assert
(
debugCheckHasDirectionality
(
context
));
_localizations
=
MaterialLocalizations
.
of
(
context
)
!
;
_localizations
=
MaterialLocalizations
.
of
(
context
);
_textDirection
=
Directionality
.
of
(
context
)!;
if
(!
_announcedInitialDate
)
{
_announcedInitialDate
=
true
;
...
...
@@ -380,7 +380,7 @@ class _DatePickerModeToggleButtonState extends State<_DatePickerModeToggleButton
children:
<
Widget
>[
Flexible
(
child:
Semantics
(
label:
MaterialLocalizations
.
of
(
context
)
!
.
selectYearSemanticsLabel
,
label:
MaterialLocalizations
.
of
(
context
).
selectYearSemanticsLabel
,
excludeSemantics:
true
,
button:
true
,
child:
Container
(
...
...
@@ -524,7 +524,7 @@ class _MonthPickerState extends State<_MonthPicker> {
@override
void
didChangeDependencies
()
{
super
.
didChangeDependencies
();
_localizations
=
MaterialLocalizations
.
of
(
context
)
!
;
_localizations
=
MaterialLocalizations
.
of
(
context
);
_textDirection
=
Directionality
.
of
(
context
);
}
...
...
@@ -941,7 +941,7 @@ class _DayPickerState extends State<_DayPicker> {
@override
Widget
build
(
BuildContext
context
)
{
final
ColorScheme
colorScheme
=
Theme
.
of
(
context
)!.
colorScheme
;
final
MaterialLocalizations
localizations
=
MaterialLocalizations
.
of
(
context
)
!
;
final
MaterialLocalizations
localizations
=
MaterialLocalizations
.
of
(
context
);
final
TextTheme
textTheme
=
Theme
.
of
(
context
)!.
textTheme
;
final
TextStyle
?
headerStyle
=
textTheme
.
caption
?.
apply
(
color:
colorScheme
.
onSurface
.
withOpacity
(
0.60
),
...
...
packages/flutter/lib/src/material/pickers/calendar_date_range_picker.dart
View file @
6cb6eef6
...
...
@@ -427,7 +427,7 @@ class _DayHeaders extends StatelessWidget {
final
ThemeData
themeData
=
Theme
.
of
(
context
)!;
final
ColorScheme
colorScheme
=
themeData
.
colorScheme
;
final
TextStyle
textStyle
=
themeData
.
textTheme
.
subtitle2
!.
apply
(
color:
colorScheme
.
onSurface
);
final
MaterialLocalizations
localizations
=
MaterialLocalizations
.
of
(
context
)
!
;
final
MaterialLocalizations
localizations
=
MaterialLocalizations
.
of
(
context
);
final
List
<
Widget
>
labels
=
_getDayHeaders
(
textStyle
,
localizations
);
// Add leading and trailing containers for edges of the custom grid layout.
...
...
@@ -706,7 +706,7 @@ class _MonthItemState extends State<_MonthItem> {
final
ThemeData
theme
=
Theme
.
of
(
context
)!;
final
ColorScheme
colorScheme
=
theme
.
colorScheme
;
final
TextTheme
textTheme
=
theme
.
textTheme
;
final
MaterialLocalizations
localizations
=
MaterialLocalizations
.
of
(
context
)
!
;
final
MaterialLocalizations
localizations
=
MaterialLocalizations
.
of
(
context
);
final
TextDirection
?
textDirection
=
Directionality
.
of
(
context
);
final
Color
highlightColor
=
_highlightColor
(
context
);
final
int
day
=
dayToBuild
.
day
;
...
...
@@ -818,7 +818,7 @@ class _MonthItemState extends State<_MonthItem> {
Widget
build
(
BuildContext
context
)
{
final
ThemeData
themeData
=
Theme
.
of
(
context
)!;
final
TextTheme
textTheme
=
themeData
.
textTheme
;
final
MaterialLocalizations
localizations
=
MaterialLocalizations
.
of
(
context
)
!
;
final
MaterialLocalizations
localizations
=
MaterialLocalizations
.
of
(
context
);
final
int
year
=
widget
.
displayedMonth
.
year
;
final
int
month
=
widget
.
displayedMonth
.
month
;
final
int
daysInMonth
=
utils
.
getDaysInMonth
(
year
,
month
);
...
...
packages/flutter/lib/src/material/pickers/date_picker_deprecated.dart
View file @
6cb6eef6
...
...
@@ -239,7 +239,7 @@ class DayPicker extends StatelessWidget {
@override
Widget
build
(
BuildContext
context
)
{
final
ThemeData
themeData
=
Theme
.
of
(
context
)!;
final
MaterialLocalizations
localizations
=
MaterialLocalizations
.
of
(
context
)
!
;
final
MaterialLocalizations
localizations
=
MaterialLocalizations
.
of
(
context
);
final
int
year
=
displayedMonth
.
year
;
final
int
month
=
displayedMonth
.
month
;
final
int
daysInMonth
=
getDaysInMonth
(
year
,
month
);
...
...
packages/flutter/lib/src/material/pickers/date_picker_dialog.dart
View file @
6cb6eef6
...
...
@@ -359,7 +359,7 @@ class _DatePickerDialogState extends State<_DatePickerDialog> {
Widget
build
(
BuildContext
context
)
{
final
ThemeData
theme
=
Theme
.
of
(
context
)!;
final
ColorScheme
colorScheme
=
theme
.
colorScheme
;
final
MaterialLocalizations
localizations
=
MaterialLocalizations
.
of
(
context
)
!
;
final
MaterialLocalizations
localizations
=
MaterialLocalizations
.
of
(
context
);
final
Orientation
orientation
=
MediaQuery
.
of
(
context
)!.
orientation
;
final
TextTheme
textTheme
=
theme
.
textTheme
;
// Constrain the textScaleFactor to the largest supported value to prevent
...
...
packages/flutter/lib/src/material/pickers/date_range_picker_dialog.dart
View file @
6cb6eef6
...
...
@@ -338,7 +338,7 @@ class _DateRangePickerDialogState extends State<_DateRangePickerDialog> {
final
MediaQueryData
mediaQuery
=
MediaQuery
.
of
(
context
)!;
final
Orientation
orientation
=
mediaQuery
.
orientation
;
final
double
textScaleFactor
=
math
.
min
(
mediaQuery
.
textScaleFactor
,
1.3
);
final
MaterialLocalizations
localizations
=
MaterialLocalizations
.
of
(
context
)
!
;
final
MaterialLocalizations
localizations
=
MaterialLocalizations
.
of
(
context
);
final
Widget
contents
;
final
Size
size
;
...
...
@@ -478,7 +478,7 @@ class _CalendarRangePickerDialog extends StatelessWidget {
Widget
build
(
BuildContext
context
)
{
final
ThemeData
theme
=
Theme
.
of
(
context
)!;
final
ColorScheme
colorScheme
=
theme
.
colorScheme
;
final
MaterialLocalizations
localizations
=
MaterialLocalizations
.
of
(
context
)
!
;
final
MaterialLocalizations
localizations
=
MaterialLocalizations
.
of
(
context
);
final
Orientation
orientation
=
MediaQuery
.
of
(
context
)!.
orientation
;
final
TextTheme
textTheme
=
theme
.
textTheme
;
final
Color
headerForeground
=
colorScheme
.
brightness
==
Brightness
.
light
...
...
@@ -615,7 +615,7 @@ class _InputDateRangePickerDialog extends StatelessWidget {
final
String
?
helpText
;
String
_formatDateRange
(
BuildContext
context
,
DateTime
?
start
,
DateTime
?
end
,
DateTime
now
)
{
final
MaterialLocalizations
localizations
=
MaterialLocalizations
.
of
(
context
)
!
;
final
MaterialLocalizations
localizations
=
MaterialLocalizations
.
of
(
context
);
final
String
startText
=
utils
.
formatRangeStartDate
(
localizations
,
start
,
end
);
final
String
endText
=
utils
.
formatRangeEndDate
(
localizations
,
start
,
end
,
now
);
if
(
start
==
null
||
end
==
null
)
{
...
...
@@ -632,7 +632,7 @@ class _InputDateRangePickerDialog extends StatelessWidget {
Widget
build
(
BuildContext
context
)
{
final
ThemeData
theme
=
Theme
.
of
(
context
)!;
final
ColorScheme
colorScheme
=
theme
.
colorScheme
;
final
MaterialLocalizations
localizations
=
MaterialLocalizations
.
of
(
context
)
!
;
final
MaterialLocalizations
localizations
=
MaterialLocalizations
.
of
(
context
);
final
Orientation
orientation
=
MediaQuery
.
of
(
context
)!.
orientation
;
final
TextTheme
textTheme
=
theme
.
textTheme
;
...
...
packages/flutter/lib/src/material/pickers/input_date_picker.dart
View file @
6cb6eef6
...
...
@@ -157,7 +157,7 @@ class _InputDatePickerFormFieldState extends State<InputDatePickerFormField> {
void
didChangeDependencies
()
{
super
.
didChangeDependencies
();
if
(
_selectedDate
!=
null
)
{
final
MaterialLocalizations
localizations
=
MaterialLocalizations
.
of
(
context
)
!
;
final
MaterialLocalizations
localizations
=
MaterialLocalizations
.
of
(
context
);
_inputText
=
localizations
.
formatCompactDate
(
_selectedDate
!);
TextEditingValue
textEditingValue
=
_controller
.
value
.
copyWith
(
text:
_inputText
);
// Select the new text if we are auto focused and haven't selected the text before.
...
...
@@ -173,7 +173,7 @@ class _InputDatePickerFormFieldState extends State<InputDatePickerFormField> {
}
DateTime
?
_parseDate
(
String
?
text
)
{
final
MaterialLocalizations
localizations
=
MaterialLocalizations
.
of
(
context
)
!
;
final
MaterialLocalizations
localizations
=
MaterialLocalizations
.
of
(
context
);
return
localizations
.
parseCompactDate
(
text
);
}
...
...
@@ -188,9 +188,9 @@ class _InputDatePickerFormFieldState extends State<InputDatePickerFormField> {
String
?
_validateDate
(
String
?
text
)
{
final
DateTime
?
date
=
_parseDate
(
text
);
if
(
date
==
null
)
{
return
widget
.
errorFormatText
??
MaterialLocalizations
.
of
(
context
)
!
.
invalidDateFormatLabel
;
return
widget
.
errorFormatText
??
MaterialLocalizations
.
of
(
context
).
invalidDateFormatLabel
;
}
else
if
(!
_isValidAcceptableDate
(
date
))
{
return
widget
.
errorInvalidText
??
MaterialLocalizations
.
of
(
context
)
!
.
dateOutOfRangeLabel
;
return
widget
.
errorInvalidText
??
MaterialLocalizations
.
of
(
context
).
dateOutOfRangeLabel
;
}
return
null
;
}
...
...
@@ -219,7 +219,7 @@ class _InputDatePickerFormFieldState extends State<InputDatePickerFormField> {
@override
Widget
build
(
BuildContext
context
)
{
final
MaterialLocalizations
localizations
=
MaterialLocalizations
.
of
(
context
)
!
;
final
MaterialLocalizations
localizations
=
MaterialLocalizations
.
of
(
context
);
final
InputDecorationTheme
inputTheme
=
Theme
.
of
(
context
)!.
inputDecorationTheme
;
return
TextFormField
(
decoration:
InputDecoration
(
...
...
packages/flutter/lib/src/material/pickers/input_date_range_picker.dart
View file @
6cb6eef6
...
...
@@ -141,7 +141,7 @@ class InputDateRangePickerState extends State<InputDateRangePicker> {
@override
void
didChangeDependencies
()
{
super
.
didChangeDependencies
();
final
MaterialLocalizations
localizations
=
MaterialLocalizations
.
of
(
context
)
!
;
final
MaterialLocalizations
localizations
=
MaterialLocalizations
.
of
(
context
);
if
(
_startDate
!=
null
)
{
_startInputText
=
localizations
.
formatCompactDate
(
_startDate
!);
final
bool
selectText
=
widget
.
autofocus
&&
!
_autoSelected
;
...
...
@@ -166,7 +166,7 @@ class InputDateRangePickerState extends State<InputDateRangePicker> {
final
String
?
endError
=
_validateDate
(
_endDate
);
if
(
startError
==
null
&&
endError
==
null
)
{
if
(
_startDate
!.
isAfter
(
_endDate
!))
{
startError
=
widget
.
errorInvalidRangeText
??
MaterialLocalizations
.
of
(
context
)
!
.
invalidDateRangeLabel
;
startError
=
widget
.
errorInvalidRangeText
??
MaterialLocalizations
.
of
(
context
).
invalidDateRangeLabel
;
}
}
setState
(()
{
...
...
@@ -177,15 +177,15 @@ class InputDateRangePickerState extends State<InputDateRangePicker> {
}
DateTime
?
_parseDate
(
String
?
text
)
{
final
MaterialLocalizations
localizations
=
MaterialLocalizations
.
of
(
context
)
!
;
final
MaterialLocalizations
localizations
=
MaterialLocalizations
.
of
(
context
);
return
localizations
.
parseCompactDate
(
text
);
}
String
?
_validateDate
(
DateTime
?
date
)
{
if
(
date
==
null
)
{
return
widget
.
errorFormatText
??
MaterialLocalizations
.
of
(
context
)
!
.
invalidDateFormatLabel
;
return
widget
.
errorFormatText
??
MaterialLocalizations
.
of
(
context
).
invalidDateFormatLabel
;
}
else
if
(
date
.
isBefore
(
widget
.
firstDate
)
||
date
.
isAfter
(
widget
.
lastDate
))
{
return
widget
.
errorInvalidText
??
MaterialLocalizations
.
of
(
context
)
!
.
dateOutOfRangeLabel
;
return
widget
.
errorInvalidText
??
MaterialLocalizations
.
of
(
context
).
dateOutOfRangeLabel
;
}
return
null
;
}
...
...
@@ -225,7 +225,7 @@ class InputDateRangePickerState extends State<InputDateRangePicker> {
@override
Widget
build
(
BuildContext
context
)
{
final
MaterialLocalizations
localizations
=
MaterialLocalizations
.
of
(
context
)
!
;
final
MaterialLocalizations
localizations
=
MaterialLocalizations
.
of
(
context
);
final
InputDecorationTheme
inputTheme
=
Theme
.
of
(
context
)!.
inputDecorationTheme
;
return
Row
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
...
...
packages/flutter/lib/src/material/popup_menu.dart
View file @
6cb6eef6
...
...
@@ -848,17 +848,15 @@ Future<T?> showMenu<T>({
assert
(
captureInheritedThemes
!=
null
);
assert
(
debugCheckHasMaterialLocalizations
(
context
));
String
?
label
;
switch
(
Theme
.
of
(
context
)!.
platform
)
{
case
TargetPlatform
.
iOS
:
case
TargetPlatform
.
macOS
:
label
=
semanticLabel
;
break
;
case
TargetPlatform
.
android
:
case
TargetPlatform
.
fuchsia
:
case
TargetPlatform
.
linux
:
case
TargetPlatform
.
windows
:
label
=
semanticLabel
??
MaterialLocalizations
.
of
(
context
)?
.
popupMenuLabel
;
semanticLabel
??=
MaterialLocalizations
.
of
(
context
)
.
popupMenuLabel
;
}
return
Navigator
.
of
(
context
,
rootNavigator:
useRootNavigator
)!.
push
(
_PopupMenuRoute
<
T
>(
...
...
@@ -866,10 +864,10 @@ Future<T?> showMenu<T>({
items:
items
,
initialValue:
initialValue
,
elevation:
elevation
,
semanticLabel:
l
abel
,
semanticLabel:
semanticL
abel
,
theme:
Theme
.
of
(
context
,
shadowThemeOnly:
true
),
popupMenuTheme:
PopupMenuTheme
.
of
(
context
),
barrierLabel:
MaterialLocalizations
.
of
(
context
)
!
.
modalBarrierDismissLabel
,
barrierLabel:
MaterialLocalizations
.
of
(
context
).
modalBarrierDismissLabel
,
shape:
shape
,
color:
color
,
showMenuContext:
context
,
...
...
@@ -1142,7 +1140,7 @@ class PopupMenuButtonState<T> extends State<PopupMenuButton<T>> {
if
(
widget
.
child
!=
null
)
return
Tooltip
(
message:
widget
.
tooltip
??
MaterialLocalizations
.
of
(
context
)
!
.
showMenuTooltip
,
message:
widget
.
tooltip
??
MaterialLocalizations
.
of
(
context
).
showMenuTooltip
,
child:
InkWell
(
onTap:
widget
.
enabled
?
showButtonMenu
:
null
,
canRequestFocus:
_canRequestFocus
,
...
...
@@ -1153,7 +1151,7 @@ class PopupMenuButtonState<T> extends State<PopupMenuButton<T>> {
return
IconButton
(
icon:
widget
.
icon
??
_getIcon
(
Theme
.
of
(
context
)!.
platform
),
padding:
widget
.
padding
,
tooltip:
widget
.
tooltip
??
MaterialLocalizations
.
of
(
context
)
!
.
showMenuTooltip
,
tooltip:
widget
.
tooltip
??
MaterialLocalizations
.
of
(
context
).
showMenuTooltip
,
onPressed:
widget
.
enabled
?
showButtonMenu
:
null
,
);
}
...
...
packages/flutter/lib/src/material/refresh_indicator.dart
View file @
6cb6eef6
...
...
@@ -467,7 +467,7 @@ class RefreshIndicatorState extends State<RefreshIndicator> with TickerProviderS
animation:
_positionController
,
builder:
(
BuildContext
context
,
Widget
?
child
)
{
return
RefreshProgressIndicator
(
semanticsLabel:
widget
.
semanticsLabel
??
MaterialLocalizations
.
of
(
context
)
!
.
refreshIndicatorSemanticLabel
,
semanticsLabel:
widget
.
semanticsLabel
??
MaterialLocalizations
.
of
(
context
).
refreshIndicatorSemanticLabel
,
semanticsValue:
widget
.
semanticsValue
,
value:
showIndeterminateIndicator
?
null
:
_value
.
value
,
valueColor:
_valueColor
,
...
...
packages/flutter/lib/src/material/reorderable_list.dart
View file @
6cb6eef6
...
...
@@ -402,7 +402,7 @@ class _ReorderableListContentState extends State<_ReorderableListContent> with T
// before index+2, which is after the space at index+1.
void
moveAfter
()
=>
reorder
(
index
,
index
+
2
);
final
MaterialLocalizations
localizations
=
MaterialLocalizations
.
of
(
context
)
!
;
final
MaterialLocalizations
localizations
=
MaterialLocalizations
.
of
(
context
);
// If the item can move to before its current position in the list.
if
(
index
>
0
)
{
...
...
packages/flutter/lib/src/material/search.dart
View file @
6cb6eef6
...
...
@@ -479,7 +479,7 @@ class _SearchPageState<T> extends State<_SearchPage<T>> {
assert
(
debugCheckHasMaterialLocalizations
(
context
));
final
ThemeData
theme
=
widget
.
delegate
.
appBarTheme
(
context
);
final
String
searchFieldLabel
=
widget
.
delegate
.
searchFieldLabel
??
MaterialLocalizations
.
of
(
context
)
!
.
searchFieldLabel
;
??
MaterialLocalizations
.
of
(
context
).
searchFieldLabel
;
final
TextStyle
?
searchFieldStyle
=
widget
.
delegate
.
searchFieldStyle
??
theme
.
inputDecorationTheme
.
hintStyle
;
Widget
?
body
;
...
...
packages/flutter/lib/src/material/stepper.dart
View file @
6cb6eef6
...
...
@@ -406,7 +406,7 @@ class _StepperState extends State<Stepper> with TickerProviderStateMixin {
final
ThemeData
themeData
=
Theme
.
of
(
context
)!;
final
ColorScheme
colorScheme
=
themeData
.
colorScheme
;
final
MaterialLocalizations
localizations
=
MaterialLocalizations
.
of
(
context
)
!
;
final
MaterialLocalizations
localizations
=
MaterialLocalizations
.
of
(
context
);
const
OutlinedBorder
buttonShape
=
RoundedRectangleBorder
(
borderRadius:
BorderRadius
.
all
(
Radius
.
circular
(
2
)));
const
EdgeInsets
buttonPadding
=
EdgeInsets
.
symmetric
(
horizontal:
16.0
);
...
...
packages/flutter/lib/src/material/tabs.dart
View file @
6cb6eef6
...
...
@@ -1030,7 +1030,7 @@ class _TabBarState extends State<TabBar> {
}
return
true
;
}());
final
MaterialLocalizations
localizations
=
MaterialLocalizations
.
of
(
context
)
!
;
final
MaterialLocalizations
localizations
=
MaterialLocalizations
.
of
(
context
);
if
(
_controller
!.
length
==
0
)
{
return
Container
(
height:
_kTabHeight
+
widget
.
indicatorWeight
,
...
...
packages/flutter/lib/src/material/text_field.dart
View file @
6cb6eef6
...
...
@@ -865,7 +865,7 @@ class _TextFieldState extends State<TextField> with RestorationMixin implements
bool
get
_hasError
=>
widget
.
decoration
?.
errorText
!=
null
||
_hasIntrinsicError
;
InputDecoration
_getEffectiveDecoration
()
{
final
MaterialLocalizations
localizations
=
MaterialLocalizations
.
of
(
context
)
!
;
final
MaterialLocalizations
localizations
=
MaterialLocalizations
.
of
(
context
);
final
ThemeData
themeData
=
Theme
.
of
(
context
)!;
final
InputDecoration
effectiveDecoration
=
(
widget
.
decoration
??
const
InputDecoration
())
.
applyDefaults
(
themeData
.
inputDecorationTheme
)
...
...
packages/flutter/lib/src/material/text_selection.dart
View file @
6cb6eef6
...
...
@@ -183,7 +183,7 @@ class _TextSelectionToolbarState extends State<_TextSelectionToolbar> with Ticke
return
const
SizedBox
(
width:
0.0
,
height:
0.0
);
}
final
MaterialLocalizations
localizations
=
MaterialLocalizations
.
of
(
context
)
!
;
final
MaterialLocalizations
localizations
=
MaterialLocalizations
.
of
(
context
);
final
List
<
_ItemData
>
itemDatas
=
<
_ItemData
>[
if
(
widget
.
handleCut
!=
null
)
_ItemData
(
widget
.
handleCut
!,
localizations
.
cutButtonLabel
),
...
...
packages/flutter/lib/src/material/theme.dart
View file @
6cb6eef6
...
...
@@ -132,7 +132,7 @@ class Theme extends StatelessWidget {
return
inheritedTheme
.
theme
.
data
;
}
final
MaterialLocalizations
?
localizations
=
MaterialLocalizations
.
of
(
context
);
final
MaterialLocalizations
?
localizations
=
Localizations
.
of
<
MaterialLocalizations
>(
context
,
MaterialLocalizations
);
final
ScriptCategory
category
=
localizations
?.
scriptCategory
??
ScriptCategory
.
englishLike
;
final
ThemeData
theme
=
inheritedTheme
?.
theme
.
data
??
_kFallbackTheme
;
return
ThemeData
.
localize
(
theme
,
theme
.
typography
.
geometryThemeFor
(
category
));
...
...
packages/flutter/lib/src/material/time.dart
View file @
6cb6eef6
...
...
@@ -104,7 +104,7 @@ class TimeOfDay {
String
format
(
BuildContext
context
)
{
assert
(
debugCheckHasMediaQuery
(
context
));
assert
(
debugCheckHasMaterialLocalizations
(
context
));
final
MaterialLocalizations
localizations
=
MaterialLocalizations
.
of
(
context
)
!
;
final
MaterialLocalizations
localizations
=
MaterialLocalizations
.
of
(
context
);
return
localizations
.
formatTimeOfDay
(
this
,
alwaysUse24HourFormat:
MediaQuery
.
of
(
context
)!.
alwaysUse24HourFormat
,
...
...
packages/flutter/lib/src/material/time_picker.dart
View file @
6cb6eef6
...
...
@@ -134,7 +134,7 @@ class _TimePickerHeader extends StatelessWidget {
Widget
build
(
BuildContext
context
)
{
assert
(
debugCheckHasMediaQuery
(
context
));
final
ThemeData
themeData
=
Theme
.
of
(
context
)!;
final
TimeOfDayFormat
timeOfDayFormat
=
MaterialLocalizations
.
of
(
context
)
!
.
timeOfDayFormat
(
final
TimeOfDayFormat
timeOfDayFormat
=
MaterialLocalizations
.
of
(
context
).
timeOfDayFormat
(
alwaysUse24HourFormat:
MediaQuery
.
of
(
context
)!.
alwaysUse24HourFormat
,
);
...
...
@@ -241,7 +241,7 @@ class _TimePickerHeader extends StatelessWidget {
children:
<
Widget
>[
const
SizedBox
(
height:
16.0
),
Text
(
helpText
??
MaterialLocalizations
.
of
(
context
)
!
.
timePickerDialHelpText
,
helpText
??
MaterialLocalizations
.
of
(
context
).
timePickerDialHelpText
,
style:
TimePickerTheme
.
of
(
context
).
helpTextStyle
??
themeData
.
textTheme
.
overline
,
),
controls
,
...
...
@@ -322,7 +322,7 @@ class _HourControl extends StatelessWidget {
Widget
build
(
BuildContext
context
)
{
assert
(
debugCheckHasMediaQuery
(
context
));
final
bool
alwaysUse24HourFormat
=
MediaQuery
.
of
(
context
)!.
alwaysUse24HourFormat
;
final
MaterialLocalizations
localizations
=
MaterialLocalizations
.
of
(
context
)
!
;
final
MaterialLocalizations
localizations
=
MaterialLocalizations
.
of
(
context
);
final
String
formattedHour
=
localizations
.
formatHour
(
fragmentContext
.
selectedTime
,
alwaysUse24HourFormat:
alwaysUse24HourFormat
,
...
...
@@ -432,7 +432,7 @@ class _MinuteControl extends StatelessWidget {
@override
Widget
build
(
BuildContext
context
)
{
final
MaterialLocalizations
localizations
=
MaterialLocalizations
.
of
(
context
)
!
;
final
MaterialLocalizations
localizations
=
MaterialLocalizations
.
of
(
context
);
final
String
formattedMinute
=
localizations
.
formatMinute
(
fragmentContext
.
selectedTime
);
final
TimeOfDay
nextMinute
=
fragmentContext
.
selectedTime
.
replacing
(
minute:
(
fragmentContext
.
selectedTime
.
minute
+
1
)
%
TimeOfDay
.
minutesPerHour
,
...
...
@@ -493,7 +493,7 @@ class _DayPeriodControl extends StatelessWidget {
case
TargetPlatform
.
fuchsia
:
case
TargetPlatform
.
linux
:
case
TargetPlatform
.
windows
:
_announceToAccessibility
(
context
,
MaterialLocalizations
.
of
(
context
)
!
.
anteMeridiemAbbreviation
);
_announceToAccessibility
(
context
,
MaterialLocalizations
.
of
(
context
).
anteMeridiemAbbreviation
);
break
;
case
TargetPlatform
.
iOS
:
case
TargetPlatform
.
macOS
:
...
...
@@ -511,7 +511,7 @@ class _DayPeriodControl extends StatelessWidget {
case
TargetPlatform
.
fuchsia
:
case
TargetPlatform
.
linux
:
case
TargetPlatform
.
windows
:
_announceToAccessibility
(
context
,
MaterialLocalizations
.
of
(
context
)
!
.
postMeridiemAbbreviation
);
_announceToAccessibility
(
context
,
MaterialLocalizations
.
of
(
context
).
postMeridiemAbbreviation
);
break
;
case
TargetPlatform
.
iOS
:
case
TargetPlatform
.
macOS
:
...
...
@@ -522,7 +522,7 @@ class _DayPeriodControl extends StatelessWidget {
@override
Widget
build
(
BuildContext
context
)
{
final
MaterialLocalizations
materialLocalizations
=
MaterialLocalizations
.
of
(
context
)
!
;
final
MaterialLocalizations
materialLocalizations
=
MaterialLocalizations
.
of
(
context
);
final
ColorScheme
colorScheme
=
Theme
.
of
(
context
)!.
colorScheme
;
final
TimePickerThemeData
timePickerTheme
=
TimePickerTheme
.
of
(
context
);
final
bool
isDark
=
colorScheme
.
brightness
==
Brightness
.
dark
;
...
...
@@ -941,7 +941,7 @@ class _DialState extends State<_Dial> with SingleTickerProviderStateMixin {
super
.
didChangeDependencies
();
assert
(
debugCheckHasMediaQuery
(
context
));
themeData
=
Theme
.
of
(
context
)!;
localizations
=
MaterialLocalizations
.
of
(
context
)
!
;
localizations
=
MaterialLocalizations
.
of
(
context
);
media
=
MediaQuery
.
of
(
context
)!;
}
...
...
@@ -1409,7 +1409,7 @@ class _TimePickerInputState extends State<_TimePickerInput> {
Widget
build
(
BuildContext
context
)
{
assert
(
debugCheckHasMediaQuery
(
context
));
final
MediaQueryData
media
=
MediaQuery
.
of
(
context
)!;
final
TimeOfDayFormat
timeOfDayFormat
=
MaterialLocalizations
.
of
(
context
)
!
.
timeOfDayFormat
(
alwaysUse24HourFormat:
media
.
alwaysUse24HourFormat
);
final
TimeOfDayFormat
timeOfDayFormat
=
MaterialLocalizations
.
of
(
context
).
timeOfDayFormat
(
alwaysUse24HourFormat:
media
.
alwaysUse24HourFormat
);
final
bool
use24HourDials
=
hourFormat
(
of:
timeOfDayFormat
)
!=
HourFormat
.
h
;
final
ThemeData
theme
=
Theme
.
of
(
context
)!;
final
TextStyle
hourMinuteStyle
=
TimePickerTheme
.
of
(
context
).
hourMinuteTextStyle
??
theme
.
textTheme
.
headline2
!;
...
...
@@ -1420,7 +1420,7 @@ class _TimePickerInputState extends State<_TimePickerInput> {
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
<
Widget
>[
Text
(
widget
.
helpText
??
MaterialLocalizations
.
of
(
context
)
!
.
timePickerInputHelpText
,
widget
.
helpText
??
MaterialLocalizations
.
of
(
context
).
timePickerInputHelpText
,
style:
TimePickerTheme
.
of
(
context
).
helpTextStyle
??
theme
.
textTheme
.
overline
,
),
const
SizedBox
(
height:
16.0
),
...
...
@@ -1458,7 +1458,7 @@ class _TimePickerInputState extends State<_TimePickerInput> {
if
(!
hourHasError
&&
!
minuteHasError
)
ExcludeSemantics
(
child:
Text
(
MaterialLocalizations
.
of
(
context
)
!
.
timePickerHourLabel
,
MaterialLocalizations
.
of
(
context
).
timePickerHourLabel
,
style:
theme
.
textTheme
.
caption
,
maxLines:
1
,
overflow:
TextOverflow
.
ellipsis
,
...
...
@@ -1488,7 +1488,7 @@ class _TimePickerInputState extends State<_TimePickerInput> {
if
(!
hourHasError
&&
!
minuteHasError
)
ExcludeSemantics
(
child:
Text
(
MaterialLocalizations
.
of
(
context
)
!
.
timePickerMinuteLabel
,
MaterialLocalizations
.
of
(
context
).
timePickerMinuteLabel
,
style:
theme
.
textTheme
.
caption
,
maxLines:
1
,
overflow:
TextOverflow
.
ellipsis
,
...
...
@@ -1512,7 +1512,7 @@ class _TimePickerInputState extends State<_TimePickerInput> {
),
if
(
hourHasError
||
minuteHasError
)
Text
(
MaterialLocalizations
.
of
(
context
)
!
.
invalidTimeLabel
,
MaterialLocalizations
.
of
(
context
).
invalidTimeLabel
,
style:
theme
.
textTheme
.
bodyText2
!.
copyWith
(
color:
theme
.
colorScheme
.
error
),
)
else
...
...
@@ -1548,7 +1548,7 @@ class _HourTextField extends StatelessWidget {
isHour:
true
,
autofocus:
autofocus
,
style:
style
,
semanticHintText:
MaterialLocalizations
.
of
(
context
)
!
.
timePickerHourLabel
,
semanticHintText:
MaterialLocalizations
.
of
(
context
).
timePickerHourLabel
,
validator:
validator
,
onSavedSubmitted:
onSavedSubmitted
,
onChanged:
onChanged
,
...
...
@@ -1579,7 +1579,7 @@ class _MinuteTextField extends StatelessWidget {
isHour:
false
,
autofocus:
autofocus
,
style:
style
,
semanticHintText:
MaterialLocalizations
.
of
(
context
)
!
.
timePickerMinuteLabel
,
semanticHintText:
MaterialLocalizations
.
of
(
context
).
timePickerMinuteLabel
,
validator:
validator
,
onSavedSubmitted:
onSavedSubmitted
,
);
...
...
@@ -1632,7 +1632,7 @@ class _HourMinuteTextFieldState extends State<_HourMinuteTextField> {
String
get
_formattedValue
{
final
bool
alwaysUse24HourFormat
=
MediaQuery
.
of
(
context
)!.
alwaysUse24HourFormat
;
final
MaterialLocalizations
localizations
=
MaterialLocalizations
.
of
(
context
)
!
;
final
MaterialLocalizations
localizations
=
MaterialLocalizations
.
of
(
context
);
return
!
widget
.
isHour
?
localizations
.
formatMinute
(
widget
.
selectedTime
)
:
localizations
.
formatHour
(
widget
.
selectedTime
,
alwaysUse24HourFormat:
alwaysUse24HourFormat
,
...
...
@@ -1770,7 +1770,7 @@ class _TimePickerDialogState extends State<_TimePickerDialog> {
@override
void
didChangeDependencies
()
{
super
.
didChangeDependencies
();
localizations
=
MaterialLocalizations
.
of
(
context
)
!
;
localizations
=
MaterialLocalizations
.
of
(
context
);
_announceInitialTimeOnce
();
_announceModeOnce
();
}
...
...
@@ -1855,7 +1855,7 @@ class _TimePickerDialogState extends State<_TimePickerDialog> {
return
;
final
MediaQueryData
media
=
MediaQuery
.
of
(
context
)!;
final
MaterialLocalizations
localizations
=
MaterialLocalizations
.
of
(
context
)
!
;
final
MaterialLocalizations
localizations
=
MaterialLocalizations
.
of
(
context
);
_announceToAccessibility
(
context
,
localizations
.
formatTimeOfDay
(
widget
.
initialTime
,
alwaysUse24HourFormat:
media
.
alwaysUse24HourFormat
),
...
...
@@ -1957,8 +1957,8 @@ class _TimePickerDialogState extends State<_TimePickerDialog> {
onPressed:
_handleEntryModeToggle
,
icon:
Icon
(
_entryMode
==
TimePickerEntryMode
.
dial
?
Icons
.
keyboard
:
Icons
.
access_time
),
tooltip:
_entryMode
==
TimePickerEntryMode
.
dial
?
MaterialLocalizations
.
of
(
context
)
!
.
inputTimeModeButtonLabel
:
MaterialLocalizations
.
of
(
context
)
!
.
dialModeButtonLabel
,
?
MaterialLocalizations
.
of
(
context
).
inputTimeModeButtonLabel
:
MaterialLocalizations
.
of
(
context
).
dialModeButtonLabel
,
),
Expanded
(
child:
Container
(
...
...
packages/flutter/lib/src/material/user_accounts_drawer_header.dart
View file @
6cb6eef6
...
...
@@ -134,7 +134,7 @@ class _AccountDetailsState extends State<_AccountDetails> with SingleTickerProvi
assert
(
debugCheckHasMaterialLocalizations
(
context
));
final
ThemeData
theme
=
Theme
.
of
(
context
)!;
final
MaterialLocalizations
localizations
=
MaterialLocalizations
.
of
(
context
)
!
;
final
MaterialLocalizations
localizations
=
MaterialLocalizations
.
of
(
context
);
Widget
accountDetails
=
CustomMultiChildLayout
(
delegate:
_AccountDetailsLayout
(
...
...
@@ -356,7 +356,7 @@ class _UserAccountsDrawerHeaderState extends State<UserAccountsDrawerHeader> {
assert
(
debugCheckHasMaterialLocalizations
(
context
));
return
Semantics
(
container:
true
,
label:
MaterialLocalizations
.
of
(
context
)
!
.
signedInLabel
,
label:
MaterialLocalizations
.
of
(
context
).
signedInLabel
,
child:
DrawerHeader
(
decoration:
widget
.
decoration
??
BoxDecoration
(
color:
Theme
.
of
(
context
)!.
primaryColor
,
...
...
packages/flutter/test/cupertino/app_test.dart
View file @
6cb6eef6
...
...
@@ -50,8 +50,8 @@ void main() {
builder:
(
BuildContext
context
)
{
return
Column
(
children:
<
Widget
>[
Text
(
CupertinoLocalizations
.
of
(
context
)
!
.
selectAllButtonLabel
),
Text
(
CupertinoLocalizations
.
of
(
context
)
!
.
datePickerMediumDate
(
Text
(
CupertinoLocalizations
.
of
(
context
).
selectAllButtonLabel
),
Text
(
CupertinoLocalizations
.
of
(
context
).
datePickerMediumDate
(
DateTime
(
2018
,
10
,
4
),
)),
],
...
...
packages/flutter/test/cupertino/debug_test.dart
0 → 100644
View file @
6cb6eef6
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import
'package:flutter/cupertino.dart'
;
import
'package:flutter/src/cupertino/debug.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
void
main
(
)
{
testWidgets
(
'debugCheckHasCupertinoLocalizations throws'
,
(
WidgetTester
tester
)
async
{
final
GlobalKey
noLocalizationsAvailable
=
GlobalKey
();
final
GlobalKey
localizationsAvailable
=
GlobalKey
();
await
tester
.
pumpWidget
(
Container
(
key:
noLocalizationsAvailable
,
child:
CupertinoApp
(
home:
Container
(
key:
localizationsAvailable
,
),
),
),
);
expect
(()
=>
debugCheckHasCupertinoLocalizations
(
noLocalizationsAvailable
.
currentContext
!),
throwsA
(
isAssertionError
.
having
(
(
AssertionError
e
)
=>
e
.
message
,
'message'
,
contains
(
'No CupertinoLocalizations found'
),
)));
expect
(
debugCheckHasCupertinoLocalizations
(
localizationsAvailable
.
currentContext
!),
isTrue
);
});
}
packages/flutter/test/cupertino/localizations_test.dart
View file @
6cb6eef6
...
...
@@ -32,4 +32,28 @@ void main() {
expect
(
localizations
.
modalBarrierDismissLabel
,
isNotNull
);
});
testWidgets
(
'CupertinoLocalizations.of throws'
,
(
WidgetTester
tester
)
async
{
final
GlobalKey
noLocalizationsAvailable
=
GlobalKey
();
final
GlobalKey
localizationsAvailable
=
GlobalKey
();
await
tester
.
pumpWidget
(
Container
(
key:
noLocalizationsAvailable
,
child:
CupertinoApp
(
home:
Container
(
key:
localizationsAvailable
,
),
),
),
);
expect
(()
=>
CupertinoLocalizations
.
of
(
noLocalizationsAvailable
.
currentContext
!),
throwsA
(
isAssertionError
.
having
(
(
AssertionError
e
)
=>
e
.
message
,
'message'
,
contains
(
'No CupertinoLocalizations found'
),
)));
expect
(
CupertinoLocalizations
.
of
(
localizationsAvailable
.
currentContext
!),
isA
<
CupertinoLocalizations
>());
});
}
packages/flutter/test/material/app_test.dart
View file @
6cb6eef6
...
...
@@ -500,8 +500,8 @@ void main() {
builder:
(
BuildContext
context
)
{
return
Column
(
children:
<
Widget
>[
Text
(
MaterialLocalizations
.
of
(
context
)
!
.
selectAllButtonLabel
),
Text
(
CupertinoLocalizations
.
of
(
context
)
!
.
selectAllButtonLabel
),
Text
(
MaterialLocalizations
.
of
(
context
).
selectAllButtonLabel
),
Text
(
CupertinoLocalizations
.
of
(
context
).
selectAllButtonLabel
),
],
);
},
...
...
packages/flutter/test/material/localizations_test.dart
View file @
6cb6eef6
...
...
@@ -102,4 +102,28 @@ void main() {
expect
(
localizations
.
licensesPackageDetailText
(
2
).
contains
(
r'$licensesCount'
),
isFalse
);
expect
(
localizations
.
licensesPackageDetailText
(
100
).
contains
(
r'$licensesCount'
),
isFalse
);
});
testWidgets
(
'MaterialLocalizations.of throws'
,
(
WidgetTester
tester
)
async
{
final
GlobalKey
noLocalizationsAvailable
=
GlobalKey
();
final
GlobalKey
localizationsAvailable
=
GlobalKey
();
await
tester
.
pumpWidget
(
Container
(
key:
noLocalizationsAvailable
,
child:
MaterialApp
(
home:
Container
(
key:
localizationsAvailable
,
),
),
),
);
expect
(()
=>
MaterialLocalizations
.
of
(
noLocalizationsAvailable
.
currentContext
!),
throwsA
(
isAssertionError
.
having
(
(
AssertionError
e
)
=>
e
.
message
,
'message'
,
contains
(
'No MaterialLocalizations found'
),
)));
expect
(
MaterialLocalizations
.
of
(
localizationsAvailable
.
currentContext
!),
isA
<
MaterialLocalizations
>());
});
}
packages/flutter/test/material/time_picker_test.dart
View file @
6cb6eef6
...
...
@@ -65,7 +65,7 @@ Future<Offset?> startPicker(
}
Future
<
void
>
finishPicker
(
WidgetTester
tester
)
async
{
final
MaterialLocalizations
materialLocalizations
=
MaterialLocalizations
.
of
(
tester
.
element
(
find
.
byType
(
ElevatedButton
)))
!
;
final
MaterialLocalizations
materialLocalizations
=
MaterialLocalizations
.
of
(
tester
.
element
(
find
.
byType
(
ElevatedButton
)));
await
tester
.
tap
(
find
.
text
(
materialLocalizations
.
okButtonLabel
));
await
tester
.
pumpAndSettle
(
const
Duration
(
seconds:
1
));
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment