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 {
...
@@ -209,14 +209,7 @@ class CupertinoTabBar extends StatelessWidget implements PreferredSizeWidget {
List
<
Widget
>
_buildTabItems
(
BuildContext
context
)
{
List
<
Widget
>
_buildTabItems
(
BuildContext
context
)
{
final
List
<
Widget
>
result
=
<
Widget
>[];
final
List
<
Widget
>
result
=
<
Widget
>[];
final
CupertinoLocalizations
?
localizations
=
CupertinoLocalizations
.
of
(
context
);
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.'
);
for
(
int
index
=
0
;
index
<
items
.
length
;
index
+=
1
)
{
for
(
int
index
=
0
;
index
<
items
.
length
;
index
+=
1
)
{
final
bool
active
=
index
==
currentIndex
;
final
bool
active
=
index
==
currentIndex
;
...
@@ -226,7 +219,7 @@ class CupertinoTabBar extends StatelessWidget implements PreferredSizeWidget {
...
@@ -226,7 +219,7 @@ class CupertinoTabBar extends StatelessWidget implements PreferredSizeWidget {
Expanded
(
Expanded
(
child:
Semantics
(
child:
Semantics
(
selected:
active
,
selected:
active
,
hint:
localizations
!
.
tabSemanticsLabel
(
hint:
localizations
.
tabSemanticsLabel
(
tabIndex:
index
+
1
,
tabIndex:
index
+
1
,
tabCount:
items
.
length
,
tabCount:
items
.
length
,
),
),
...
...
packages/flutter/lib/src/cupertino/date_picker.dart
View file @
6cb6eef6
...
@@ -623,7 +623,7 @@ class _CupertinoDatePickerDateTimeState extends State<CupertinoDatePicker> {
...
@@ -623,7 +623,7 @@ class _CupertinoDatePickerDateTimeState extends State<CupertinoDatePicker> {
super
.
didChangeDependencies
();
super
.
didChangeDependencies
();
textDirectionFactor
=
Directionality
.
of
(
context
)
==
TextDirection
.
ltr
?
1
:
-
1
;
textDirectionFactor
=
Directionality
.
of
(
context
)
==
TextDirection
.
ltr
?
1
:
-
1
;
localizations
=
CupertinoLocalizations
.
of
(
context
)
!
;
localizations
=
CupertinoLocalizations
.
of
(
context
);
alignCenterLeft
=
textDirectionFactor
==
1
?
Alignment
.
centerLeft
:
Alignment
.
centerRight
;
alignCenterLeft
=
textDirectionFactor
==
1
?
Alignment
.
centerLeft
:
Alignment
.
centerRight
;
alignCenterRight
=
textDirectionFactor
==
1
?
Alignment
.
centerRight
:
Alignment
.
centerLeft
;
alignCenterRight
=
textDirectionFactor
==
1
?
Alignment
.
centerRight
:
Alignment
.
centerLeft
;
...
@@ -1113,7 +1113,7 @@ class _CupertinoDatePickerDateState extends State<CupertinoDatePicker> {
...
@@ -1113,7 +1113,7 @@ class _CupertinoDatePickerDateState extends State<CupertinoDatePicker> {
super
.
didChangeDependencies
();
super
.
didChangeDependencies
();
textDirectionFactor
=
Directionality
.
of
(
context
)
==
TextDirection
.
ltr
?
1
:
-
1
;
textDirectionFactor
=
Directionality
.
of
(
context
)
==
TextDirection
.
ltr
?
1
:
-
1
;
localizations
=
CupertinoLocalizations
.
of
(
context
)
!
;
localizations
=
CupertinoLocalizations
.
of
(
context
);
alignCenterLeft
=
textDirectionFactor
==
1
?
Alignment
.
centerLeft
:
Alignment
.
centerRight
;
alignCenterLeft
=
textDirectionFactor
==
1
?
Alignment
.
centerLeft
:
Alignment
.
centerRight
;
alignCenterRight
=
textDirectionFactor
==
1
?
Alignment
.
centerRight
:
Alignment
.
centerLeft
;
alignCenterRight
=
textDirectionFactor
==
1
?
Alignment
.
centerRight
:
Alignment
.
centerLeft
;
...
@@ -1621,7 +1621,7 @@ class _CupertinoTimerPickerState extends State<CupertinoTimerPicker> {
...
@@ -1621,7 +1621,7 @@ class _CupertinoTimerPickerState extends State<CupertinoTimerPicker> {
super
.
didChangeDependencies
();
super
.
didChangeDependencies
();
textDirection
=
Directionality
.
of
(
context
)!;
textDirection
=
Directionality
.
of
(
context
)!;
localizations
=
CupertinoLocalizations
.
of
(
context
)
!
;
localizations
=
CupertinoLocalizations
.
of
(
context
);
_measureLabelMetrics
();
_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 {
...
@@ -226,7 +226,7 @@ class CupertinoAlertDialog extends StatelessWidget {
@override
@override
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
final
CupertinoLocalizations
localizations
=
CupertinoLocalizations
.
of
(
context
)
!
;
final
CupertinoLocalizations
localizations
=
CupertinoLocalizations
.
of
(
context
);
final
bool
isInAccessibilityMode
=
_isInAccessibilityMode
(
context
);
final
bool
isInAccessibilityMode
=
_isInAccessibilityMode
(
context
);
final
double
textScaleFactor
=
MediaQuery
.
of
(
context
)!.
textScaleFactor
;
final
double
textScaleFactor
=
MediaQuery
.
of
(
context
)!.
textScaleFactor
;
return
CupertinoUserInterfaceLevel
(
return
CupertinoUserInterfaceLevel
(
...
...
packages/flutter/lib/src/cupertino/localizations.dart
View file @
6cb6eef6
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
import
'package:flutter/foundation.dart'
;
import
'package:flutter/foundation.dart'
;
import
'package:flutter/widgets.dart'
;
import
'package:flutter/widgets.dart'
;
import
'd
ate_picker
.dart'
;
import
'd
ebug
.dart'
;
/// Determines the order of the columns inside [CupertinoDatePicker] in
/// Determines the order of the columns inside [CupertinoDatePicker] in
/// time and date time mode.
/// time and date time mode.
...
@@ -242,8 +242,11 @@ abstract class CupertinoLocalizations {
...
@@ -242,8 +242,11 @@ abstract class CupertinoLocalizations {
/// The `CupertinoLocalizations` from the closest [Localizations] instance
/// The `CupertinoLocalizations` from the closest [Localizations] instance
/// that encloses the given context.
/// 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:
/// 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
/// References to the localized resources defined by this class are typically
/// written in terms of this method. For example:
/// written in terms of this method. For example:
...
@@ -251,8 +254,9 @@ abstract class CupertinoLocalizations {
...
@@ -251,8 +254,9 @@ abstract class CupertinoLocalizations {
/// ```dart
/// ```dart
/// CupertinoLocalizations.of(context).anteMeridiemAbbreviation;
/// CupertinoLocalizations.of(context).anteMeridiemAbbreviation;
/// ```
/// ```
static
CupertinoLocalizations
?
of
(
BuildContext
context
)
{
static
CupertinoLocalizations
of
(
BuildContext
context
)
{
return
Localizations
.
of
<
CupertinoLocalizations
>(
context
,
CupertinoLocalizations
);
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>({
...
@@ -1146,7 +1146,7 @@ Future<T?> showCupertinoDialog<T>({
return
showGeneralDialog
(
return
showGeneralDialog
(
context:
context
,
context:
context
,
barrierDismissible:
barrierDismissible
,
barrierDismissible:
barrierDismissible
,
barrierLabel:
CupertinoLocalizations
.
of
(
context
)
!
.
modalBarrierDismissLabel
,
barrierLabel:
CupertinoLocalizations
.
of
(
context
).
modalBarrierDismissLabel
,
barrierColor:
CupertinoDynamicColor
.
resolve
(
_kModalBarrierColor
,
context
)!,
barrierColor:
CupertinoDynamicColor
.
resolve
(
_kModalBarrierColor
,
context
)!,
// This transition duration was eyeballed comparing with iOS
// This transition duration was eyeballed comparing with iOS
transitionDuration:
const
Duration
(
milliseconds:
250
),
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
...
@@ -152,7 +152,7 @@ class _CupertinoTextSelectionToolbarWrapperState extends State<_CupertinoTextSel
}
}
final
List
<
Widget
>
items
=
<
Widget
>[];
final
List
<
Widget
>
items
=
<
Widget
>[];
final
CupertinoLocalizations
?
localizations
=
CupertinoLocalizations
.
of
(
context
);
final
CupertinoLocalizations
localizations
=
CupertinoLocalizations
.
of
(
context
);
final
EdgeInsets
arrowPadding
=
widget
.
isArrowPointingDown
final
EdgeInsets
arrowPadding
=
widget
.
isArrowPointingDown
?
EdgeInsets
.
only
(
bottom:
_kToolbarArrowSize
.
height
)
?
EdgeInsets
.
only
(
bottom:
_kToolbarArrowSize
.
height
)
:
EdgeInsets
.
only
(
top:
_kToolbarArrowSize
.
height
);
:
EdgeInsets
.
only
(
top:
_kToolbarArrowSize
.
height
);
...
@@ -183,17 +183,17 @@ class _CupertinoTextSelectionToolbarWrapperState extends State<_CupertinoTextSel
...
@@ -183,17 +183,17 @@ class _CupertinoTextSelectionToolbarWrapperState extends State<_CupertinoTextSel
}
}
if
(
widget
.
handleCut
!=
null
)
{
if
(
widget
.
handleCut
!=
null
)
{
addToolbarButton
(
localizations
!
.
cutButtonLabel
,
widget
.
handleCut
!);
addToolbarButton
(
localizations
.
cutButtonLabel
,
widget
.
handleCut
!);
}
}
if
(
widget
.
handleCopy
!=
null
)
{
if
(
widget
.
handleCopy
!=
null
)
{
addToolbarButton
(
localizations
!
.
copyButtonLabel
,
widget
.
handleCopy
!);
addToolbarButton
(
localizations
.
copyButtonLabel
,
widget
.
handleCopy
!);
}
}
if
(
widget
.
handlePaste
!=
null
if
(
widget
.
handlePaste
!=
null
&&
_clipboardStatus
.
value
==
ClipboardStatus
.
pasteable
)
{
&&
_clipboardStatus
.
value
==
ClipboardStatus
.
pasteable
)
{
addToolbarButton
(
localizations
!
.
pasteButtonLabel
,
widget
.
handlePaste
!);
addToolbarButton
(
localizations
.
pasteButtonLabel
,
widget
.
handlePaste
!);
}
}
if
(
widget
.
handleSelectAll
!=
null
)
{
if
(
widget
.
handleSelectAll
!=
null
)
{
addToolbarButton
(
localizations
!
.
selectAllButtonLabel
,
widget
.
handleSelectAll
!);
addToolbarButton
(
localizations
.
selectAllButtonLabel
,
widget
.
handleSelectAll
!);
}
}
return
CupertinoTextSelectionToolbar
.
_
(
return
CupertinoTextSelectionToolbar
.
_
(
...
...
packages/flutter/lib/src/material/about.dart
View file @
6cb6eef6
...
@@ -201,7 +201,7 @@ class AboutListTile extends StatelessWidget {
...
@@ -201,7 +201,7 @@ class AboutListTile extends StatelessWidget {
assert
(
debugCheckHasMaterialLocalizations
(
context
));
assert
(
debugCheckHasMaterialLocalizations
(
context
));
return
ListTile
(
return
ListTile
(
leading:
icon
,
leading:
icon
,
title:
child
??
Text
(
MaterialLocalizations
.
of
(
context
)
!
.
aboutListTileTitle
(
title:
child
??
Text
(
MaterialLocalizations
.
of
(
context
).
aboutListTileTitle
(
applicationName
??
_defaultApplicationName
(
context
),
applicationName
??
_defaultApplicationName
(
context
),
)),
)),
dense:
dense
,
dense:
dense
,
...
@@ -405,7 +405,7 @@ class AboutDialog extends StatelessWidget {
...
@@ -405,7 +405,7 @@ class AboutDialog extends StatelessWidget {
),
),
actions:
<
Widget
>[
actions:
<
Widget
>[
TextButton
(
TextButton
(
child:
Text
(
MaterialLocalizations
.
of
(
context
)
!
.
viewLicensesButtonLabel
),
child:
Text
(
MaterialLocalizations
.
of
(
context
).
viewLicensesButtonLabel
),
onPressed:
()
{
onPressed:
()
{
showLicensePage
(
showLicensePage
(
context:
context
,
context:
context
,
...
@@ -417,7 +417,7 @@ class AboutDialog extends StatelessWidget {
...
@@ -417,7 +417,7 @@ class AboutDialog extends StatelessWidget {
},
},
),
),
TextButton
(
TextButton
(
child:
Text
(
MaterialLocalizations
.
of
(
context
)
!
.
closeButtonLabel
),
child:
Text
(
MaterialLocalizations
.
of
(
context
).
closeButtonLabel
),
onPressed:
()
{
onPressed:
()
{
Navigator
.
pop
(
context
);
Navigator
.
pop
(
context
);
},
},
...
@@ -493,7 +493,7 @@ class _LicensePageState extends State<LicensePage> {
...
@@ -493,7 +493,7 @@ class _LicensePageState extends State<LicensePage> {
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
return
_MasterDetailFlow
(
return
_MasterDetailFlow
(
detailPageFABlessGutterWidth:
_getGutterSize
(
context
),
detailPageFABlessGutterWidth:
_getGutterSize
(
context
),
title:
Text
(
MaterialLocalizations
.
of
(
context
)
!
.
licensesPageTitle
),
title:
Text
(
MaterialLocalizations
.
of
(
context
).
licensesPageTitle
),
detailPageBuilder:
_packageLicensePage
,
detailPageBuilder:
_packageLicensePage
,
masterViewBuilder:
_packagesView
,
masterViewBuilder:
_packagesView
,
);
);
...
@@ -720,7 +720,7 @@ class _PackageListTile extends StatelessWidget {
...
@@ -720,7 +720,7 @@ class _PackageListTile extends StatelessWidget {
color:
isSelected
?
Theme
.
of
(
context
)!.
highlightColor
:
Theme
.
of
(
context
)!.
cardColor
,
color:
isSelected
?
Theme
.
of
(
context
)!.
highlightColor
:
Theme
.
of
(
context
)!.
cardColor
,
child:
ListTile
(
child:
ListTile
(
title:
Text
(
packageName
),
title:
Text
(
packageName
),
subtitle:
Text
(
MaterialLocalizations
.
of
(
context
)
!
.
licensesPackageDetailText
(
numberLicenses
)),
subtitle:
Text
(
MaterialLocalizations
.
of
(
context
).
licensesPackageDetailText
(
numberLicenses
)),
selected:
isSelected
,
selected:
isSelected
,
onTap:
onTap
,
onTap:
onTap
,
),
),
...
@@ -890,7 +890,7 @@ class _PackageLicensePageState extends State<_PackageLicensePage> {
...
@@ -890,7 +890,7 @@ class _PackageLicensePageState extends State<_PackageLicensePage> {
@override
@override
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
assert
(
debugCheckHasMaterialLocalizations
(
context
));
assert
(
debugCheckHasMaterialLocalizations
(
context
));
final
MaterialLocalizations
localizations
=
MaterialLocalizations
.
of
(
context
)
!
;
final
MaterialLocalizations
localizations
=
MaterialLocalizations
.
of
(
context
);
final
ThemeData
?
theme
=
Theme
.
of
(
context
);
final
ThemeData
?
theme
=
Theme
.
of
(
context
);
final
String
title
=
widget
.
packageName
;
final
String
title
=
widget
.
packageName
;
final
String
subtitle
=
localizations
.
licensesPackageDetailText
(
widget
.
licenseEntries
.
length
);
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> {
...
@@ -543,7 +543,7 @@ class _AppBarState extends State<AppBar> {
leading
=
IconButton
(
leading
=
IconButton
(
icon:
const
Icon
(
Icons
.
menu
),
icon:
const
Icon
(
Icons
.
menu
),
onPressed:
_handleDrawerButton
,
onPressed:
_handleDrawerButton
,
tooltip:
MaterialLocalizations
.
of
(
context
)
!
.
openAppDrawerTooltip
,
tooltip:
MaterialLocalizations
.
of
(
context
).
openAppDrawerTooltip
,
);
);
}
else
{
}
else
{
if
(!
hasEndDrawer
&&
canPop
)
if
(!
hasEndDrawer
&&
canPop
)
...
@@ -616,7 +616,7 @@ class _AppBarState extends State<AppBar> {
...
@@ -616,7 +616,7 @@ class _AppBarState extends State<AppBar> {
actions
=
IconButton
(
actions
=
IconButton
(
icon:
const
Icon
(
Icons
.
menu
),
icon:
const
Icon
(
Icons
.
menu
),
onPressed:
_handleDrawerButtonEnd
,
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 {
...
@@ -98,7 +98,7 @@ class BackButton extends StatelessWidget {
return
IconButton
(
return
IconButton
(
icon:
const
BackButtonIcon
(),
icon:
const
BackButtonIcon
(),
color:
color
,
color:
color
,
tooltip:
MaterialLocalizations
.
of
(
context
)
!
.
backButtonTooltip
,
tooltip:
MaterialLocalizations
.
of
(
context
).
backButtonTooltip
,
onPressed:
()
{
onPressed:
()
{
if
(
onPressed
!=
null
)
{
if
(
onPressed
!=
null
)
{
onPressed
!();
onPressed
!();
...
@@ -152,7 +152,7 @@ class CloseButton extends StatelessWidget {
...
@@ -152,7 +152,7 @@ class CloseButton extends StatelessWidget {
return
IconButton
(
return
IconButton
(
icon:
const
Icon
(
Icons
.
close
),
icon:
const
Icon
(
Icons
.
close
),
color:
color
,
color:
color
,
tooltip:
MaterialLocalizations
.
of
(
context
)
!
.
closeButtonTooltip
,
tooltip:
MaterialLocalizations
.
of
(
context
).
closeButtonTooltip
,
onPressed:
()
{
onPressed:
()
{
if
(
onPressed
!=
null
)
{
if
(
onPressed
!=
null
)
{
onPressed
!();
onPressed
!();
...
...
packages/flutter/lib/src/material/bottom_navigation_bar.dart
View file @
6cb6eef6
...
@@ -823,7 +823,7 @@ class _BottomNavigationBarState extends State<BottomNavigationBar> with TickerPr
...
@@ -823,7 +823,7 @@ class _BottomNavigationBarState extends State<BottomNavigationBar> with TickerPr
}
}
List
<
Widget
>
_createTiles
()
{
List
<
Widget
>
_createTiles
()
{
final
MaterialLocalizations
localizations
=
MaterialLocalizations
.
of
(
context
)
!
;
final
MaterialLocalizations
localizations
=
MaterialLocalizations
.
of
(
context
);
assert
(
localizations
!=
null
);
assert
(
localizations
!=
null
);
final
ThemeData
themeData
=
Theme
.
of
(
context
)!;
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>> {
...
@@ -370,7 +370,7 @@ class _ModalBottomSheetState<T> extends State<_ModalBottomSheet<T>> {
assert
(
debugCheckHasMediaQuery
(
context
));
assert
(
debugCheckHasMediaQuery
(
context
));
assert
(
debugCheckHasMaterialLocalizations
(
context
));
assert
(
debugCheckHasMaterialLocalizations
(
context
));
final
MediaQueryData
?
mediaQuery
=
MediaQuery
.
of
(
context
);
final
MediaQueryData
?
mediaQuery
=
MediaQuery
.
of
(
context
);
final
MaterialLocalizations
localizations
=
MaterialLocalizations
.
of
(
context
)
!
;
final
MaterialLocalizations
localizations
=
MaterialLocalizations
.
of
(
context
);
final
String
routeLabel
=
_getRouteLabel
(
localizations
);
final
String
routeLabel
=
_getRouteLabel
(
localizations
);
return
AnimatedBuilder
(
return
AnimatedBuilder
(
...
@@ -671,7 +671,7 @@ Future<T?> showModalBottomSheet<T>({
...
@@ -671,7 +671,7 @@ Future<T?> showModalBottomSheet<T>({
builder:
builder
,
builder:
builder
,
theme:
Theme
.
of
(
context
,
shadowThemeOnly:
true
),
theme:
Theme
.
of
(
context
,
shadowThemeOnly:
true
),
isScrollControlled:
isScrollControlled
,
isScrollControlled:
isScrollControlled
,
barrierLabel:
MaterialLocalizations
.
of
(
context
)
!
.
modalBarrierDismissLabel
,
barrierLabel:
MaterialLocalizations
.
of
(
context
).
modalBarrierDismissLabel
,
backgroundColor:
backgroundColor
,
backgroundColor:
backgroundColor
,
elevation:
elevation
,
elevation:
elevation
,
shape:
shape
,
shape:
shape
,
...
...
packages/flutter/lib/src/material/chip.dart
View file @
6cb6eef6
...
@@ -1789,7 +1789,7 @@ class _RawChipState extends State<RawChip> with TickerProviderStateMixin<RawChip
...
@@ -1789,7 +1789,7 @@ class _RawChipState extends State<RawChip> with TickerProviderStateMixin<RawChip
container:
true
,
container:
true
,
button:
true
,
button:
true
,
child:
_wrapWithTooltip
(
child:
_wrapWithTooltip
(
widget
.
deleteButtonTooltipMessage
??
MaterialLocalizations
.
of
(
context
)
?
.
deleteButtonTooltip
,
widget
.
deleteButtonTooltipMessage
??
MaterialLocalizations
.
of
(
context
).
deleteButtonTooltip
,
widget
.
onDeleted
,
widget
.
onDeleted
,
GestureDetector
(
GestureDetector
(
key:
deleteIconKey
,
key:
deleteIconKey
,
...
...
packages/flutter/lib/src/material/dialog.dart
View file @
6cb6eef6
...
@@ -463,7 +463,7 @@ class AlertDialog extends StatelessWidget {
...
@@ -463,7 +463,7 @@ class AlertDialog extends StatelessWidget {
case
TargetPlatform
.
fuchsia
:
case
TargetPlatform
.
fuchsia
:
case
TargetPlatform
.
linux
:
case
TargetPlatform
.
linux
:
case
TargetPlatform
.
windows
:
case
TargetPlatform
.
windows
:
label
??=
MaterialLocalizations
.
of
(
context
)
?
.
alertDialogLabel
;
label
??=
MaterialLocalizations
.
of
(
context
).
alertDialogLabel
;
}
}
// The paddingScaleFactor is used to adjust the padding of Dialog's
// The paddingScaleFactor is used to adjust the padding of Dialog's
...
@@ -814,13 +814,12 @@ class SimpleDialog extends StatelessWidget {
...
@@ -814,13 +814,12 @@ class SimpleDialog extends StatelessWidget {
switch
(
theme
.
platform
)
{
switch
(
theme
.
platform
)
{
case
TargetPlatform
.
macOS
:
case
TargetPlatform
.
macOS
:
case
TargetPlatform
.
iOS
:
case
TargetPlatform
.
iOS
:
label
=
semanticLabel
;
break
;
break
;
case
TargetPlatform
.
android
:
case
TargetPlatform
.
android
:
case
TargetPlatform
.
fuchsia
:
case
TargetPlatform
.
fuchsia
:
case
TargetPlatform
.
linux
:
case
TargetPlatform
.
linux
:
case
TargetPlatform
.
windows
:
case
TargetPlatform
.
windows
:
label
=
semanticLabel
??
MaterialLocalizations
.
of
(
context
)
?
.
dialogLabel
;
label
=
semanticLabel
??
MaterialLocalizations
.
of
(
context
).
dialogLabel
;
}
}
}
}
...
@@ -997,7 +996,7 @@ Future<T?> showDialog<T>({
...
@@ -997,7 +996,7 @@ Future<T?> showDialog<T>({
return
dialog
;
return
dialog
;
},
},
barrierDismissible:
barrierDismissible
,
barrierDismissible:
barrierDismissible
,
barrierLabel:
MaterialLocalizations
.
of
(
context
)
!
.
modalBarrierDismissLabel
,
barrierLabel:
MaterialLocalizations
.
of
(
context
).
modalBarrierDismissLabel
,
barrierColor:
barrierColor
??
Colors
.
black54
,
barrierColor:
barrierColor
??
Colors
.
black54
,
transitionDuration:
const
Duration
(
milliseconds:
150
),
transitionDuration:
const
Duration
(
milliseconds:
150
),
transitionBuilder:
_buildMaterialDialogTransitions
,
transitionBuilder:
_buildMaterialDialogTransitions
,
...
...
packages/flutter/lib/src/material/drawer.dart
View file @
6cb6eef6
...
@@ -180,13 +180,12 @@ class Drawer extends StatelessWidget {
...
@@ -180,13 +180,12 @@ class Drawer extends StatelessWidget {
switch
(
Theme
.
of
(
context
)!.
platform
)
{
switch
(
Theme
.
of
(
context
)!.
platform
)
{
case
TargetPlatform
.
iOS
:
case
TargetPlatform
.
iOS
:
case
TargetPlatform
.
macOS
:
case
TargetPlatform
.
macOS
:
label
=
semanticLabel
;
break
;
break
;
case
TargetPlatform
.
android
:
case
TargetPlatform
.
android
:
case
TargetPlatform
.
fuchsia
:
case
TargetPlatform
.
fuchsia
:
case
TargetPlatform
.
linux
:
case
TargetPlatform
.
linux
:
case
TargetPlatform
.
windows
:
case
TargetPlatform
.
windows
:
label
=
semanticLabel
??
MaterialLocalizations
.
of
(
context
)
?
.
drawerLabel
;
label
=
semanticLabel
??
MaterialLocalizations
.
of
(
context
).
drawerLabel
;
}
}
return
Semantics
(
return
Semantics
(
scopesRoute:
true
,
scopesRoute:
true
,
...
@@ -566,7 +565,7 @@ class DrawerControllerState extends State<DrawerController> with SingleTickerPro
...
@@ -566,7 +565,7 @@ class DrawerControllerState extends State<DrawerController> with SingleTickerPro
child:
GestureDetector
(
child:
GestureDetector
(
onTap:
close
,
onTap:
close
,
child:
Semantics
(
child:
Semantics
(
label:
MaterialLocalizations
.
of
(
context
)
?
.
modalBarrierDismissLabel
,
label:
MaterialLocalizations
.
of
(
context
).
modalBarrierDismissLabel
,
child:
MouseRegion
(
child:
MouseRegion
(
opaque:
true
,
opaque:
true
,
child:
Container
(
// The drawer's "scrim"
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>> {
...
@@ -253,7 +253,7 @@ class _DropdownMenuState<T> extends State<_DropdownMenu<T>> {
// When the menu is dismissed we just fade the entire thing out
// When the menu is dismissed we just fade the entire thing out
// in the first 0.25s.
// in the first 0.25s.
assert
(
debugCheckHasMaterialLocalizations
(
context
));
assert
(
debugCheckHasMaterialLocalizations
(
context
));
final
MaterialLocalizations
localizations
=
MaterialLocalizations
.
of
(
context
)
!
;
final
MaterialLocalizations
localizations
=
MaterialLocalizations
.
of
(
context
);
final
_DropdownRoute
<
T
>
route
=
widget
.
route
;
final
_DropdownRoute
<
T
>
route
=
widget
.
route
;
final
List
<
Widget
>
children
=
<
Widget
>[
final
List
<
Widget
>
children
=
<
Widget
>[
for
(
int
itemIndex
=
0
;
itemIndex
<
route
.
items
.
length
;
++
itemIndex
)
for
(
int
itemIndex
=
0
;
itemIndex
<
route
.
items
.
length
;
++
itemIndex
)
...
@@ -1216,7 +1216,7 @@ class _DropdownButtonState<T> extends State<DropdownButton<T>> with WidgetsBindi
...
@@ -1216,7 +1216,7 @@ class _DropdownButtonState<T> extends State<DropdownButton<T>> with WidgetsBindi
elevation:
widget
.
elevation
,
elevation:
widget
.
elevation
,
theme:
Theme
.
of
(
context
,
shadowThemeOnly:
true
),
theme:
Theme
.
of
(
context
,
shadowThemeOnly:
true
),
style:
_textStyle
!,
style:
_textStyle
!,
barrierLabel:
MaterialLocalizations
.
of
(
context
)
!
.
modalBarrierDismissLabel
,
barrierLabel:
MaterialLocalizations
.
of
(
context
).
modalBarrierDismissLabel
,
itemHeight:
widget
.
itemHeight
,
itemHeight:
widget
.
itemHeight
,
dropdownColor:
widget
.
dropdownColor
,
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
...
@@ -167,7 +167,7 @@ class _ExpandIconState extends State<ExpandIcon> with SingleTickerProviderStateM
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
assert
(
debugCheckHasMaterial
(
context
));
assert
(
debugCheckHasMaterial
(
context
));
assert
(
debugCheckHasMaterialLocalizations
(
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
;
final
String
onTapHint
=
widget
.
isExpanded
?
localizations
.
expandedIconTapHint
:
localizations
.
collapsedIconTapHint
;
return
Semantics
(
return
Semantics
(
...
...
packages/flutter/lib/src/material/expansion_panel.dart
View file @
6cb6eef6
...
@@ -496,7 +496,7 @@ class _ExpansionPanelListState extends State<ExpansionPanelList> {
...
@@ -496,7 +496,7 @@ class _ExpansionPanelListState extends State<ExpansionPanelList> {
),
),
);
);
if
(!
child
.
canTapOnHeader
)
{
if
(!
child
.
canTapOnHeader
)
{
final
MaterialLocalizations
localizations
=
MaterialLocalizations
.
of
(
context
)
!
;
final
MaterialLocalizations
localizations
=
MaterialLocalizations
.
of
(
context
);
expandIconContainer
=
Semantics
(
expandIconContainer
=
Semantics
(
label:
_isChildExpanded
(
index
)?
localizations
.
expandedIconTapHint
:
localizations
.
collapsedIconTapHint
,
label:
_isChildExpanded
(
index
)?
localizations
.
expandedIconTapHint
:
localizations
.
collapsedIconTapHint
,
container:
true
,
container:
true
,
...
...
packages/flutter/lib/src/material/material_localizations.dart
View file @
6cb6eef6
...
@@ -5,8 +5,7 @@
...
@@ -5,8 +5,7 @@
import
'package:flutter/foundation.dart'
;
import
'package:flutter/foundation.dart'
;
import
'package:flutter/widgets.dart'
;
import
'package:flutter/widgets.dart'
;
import
'reorderable_list.dart'
;
import
'debug.dart'
;
import
'text_theme.dart'
;
import
'time.dart'
;
import
'time.dart'
;
import
'typography.dart'
;
import
'typography.dart'
;
...
@@ -494,8 +493,11 @@ abstract class MaterialLocalizations {
...
@@ -494,8 +493,11 @@ abstract class MaterialLocalizations {
/// The `MaterialLocalizations` from the closest [Localizations] instance
/// The `MaterialLocalizations` from the closest [Localizations] instance
/// that encloses the given context.
/// 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:
/// 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
/// References to the localized resources defined by this class are typically
/// written in terms of this method. For example:
/// written in terms of this method. For example:
...
@@ -503,8 +505,9 @@ abstract class MaterialLocalizations {
...
@@ -503,8 +505,9 @@ abstract class MaterialLocalizations {
/// ```dart
/// ```dart
/// tooltip: MaterialLocalizations.of(context).backButtonTooltip,
/// tooltip: MaterialLocalizations.of(context).backButtonTooltip,
/// ```
/// ```
static
MaterialLocalizations
?
of
(
BuildContext
context
)
{
static
MaterialLocalizations
of
(
BuildContext
context
)
{
return
Localizations
.
of
<
MaterialLocalizations
>(
context
,
MaterialLocalizations
);
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
...
@@ -433,7 +433,7 @@ class _NavigationRailState extends State<NavigationRail> with TickerProviderStat
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
final
ThemeData
theme
=
Theme
.
of
(
context
)!;
final
ThemeData
theme
=
Theme
.
of
(
context
)!;
final
NavigationRailThemeData
navigationRailTheme
=
NavigationRailTheme
.
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
Color
backgroundColor
=
widget
.
backgroundColor
??
navigationRailTheme
.
backgroundColor
??
theme
.
colorScheme
.
surface
;
final
double
elevation
=
widget
.
elevation
??
navigationRailTheme
.
elevation
??
0
;
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> {
...
@@ -333,7 +333,7 @@ class PaginatedDataTableState extends State<PaginatedDataTable> {
// TODO(ianh): This whole build function doesn't handle RTL yet.
// TODO(ianh): This whole build function doesn't handle RTL yet.
assert
(
debugCheckHasMaterialLocalizations
(
context
));
assert
(
debugCheckHasMaterialLocalizations
(
context
));
final
ThemeData
themeData
=
Theme
.
of
(
context
)!;
final
ThemeData
themeData
=
Theme
.
of
(
context
)!;
final
MaterialLocalizations
localizations
=
MaterialLocalizations
.
of
(
context
)
!
;
final
MaterialLocalizations
localizations
=
MaterialLocalizations
.
of
(
context
);
// HEADER
// HEADER
final
List
<
Widget
>
headerWidgets
=
<
Widget
>[];
final
List
<
Widget
>
headerWidgets
=
<
Widget
>[];
double
startPadding
=
24.0
;
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> {
...
@@ -179,7 +179,7 @@ class _CalendarDatePickerState extends State<CalendarDatePicker> {
assert
(
debugCheckHasMaterial
(
context
));
assert
(
debugCheckHasMaterial
(
context
));
assert
(
debugCheckHasMaterialLocalizations
(
context
));
assert
(
debugCheckHasMaterialLocalizations
(
context
));
assert
(
debugCheckHasDirectionality
(
context
));
assert
(
debugCheckHasDirectionality
(
context
));
_localizations
=
MaterialLocalizations
.
of
(
context
)
!
;
_localizations
=
MaterialLocalizations
.
of
(
context
);
_textDirection
=
Directionality
.
of
(
context
)!;
_textDirection
=
Directionality
.
of
(
context
)!;
if
(!
_announcedInitialDate
)
{
if
(!
_announcedInitialDate
)
{
_announcedInitialDate
=
true
;
_announcedInitialDate
=
true
;
...
@@ -380,7 +380,7 @@ class _DatePickerModeToggleButtonState extends State<_DatePickerModeToggleButton
...
@@ -380,7 +380,7 @@ class _DatePickerModeToggleButtonState extends State<_DatePickerModeToggleButton
children:
<
Widget
>[
children:
<
Widget
>[
Flexible
(
Flexible
(
child:
Semantics
(
child:
Semantics
(
label:
MaterialLocalizations
.
of
(
context
)
!
.
selectYearSemanticsLabel
,
label:
MaterialLocalizations
.
of
(
context
).
selectYearSemanticsLabel
,
excludeSemantics:
true
,
excludeSemantics:
true
,
button:
true
,
button:
true
,
child:
Container
(
child:
Container
(
...
@@ -524,7 +524,7 @@ class _MonthPickerState extends State<_MonthPicker> {
...
@@ -524,7 +524,7 @@ class _MonthPickerState extends State<_MonthPicker> {
@override
@override
void
didChangeDependencies
()
{
void
didChangeDependencies
()
{
super
.
didChangeDependencies
();
super
.
didChangeDependencies
();
_localizations
=
MaterialLocalizations
.
of
(
context
)
!
;
_localizations
=
MaterialLocalizations
.
of
(
context
);
_textDirection
=
Directionality
.
of
(
context
);
_textDirection
=
Directionality
.
of
(
context
);
}
}
...
@@ -941,7 +941,7 @@ class _DayPickerState extends State<_DayPicker> {
...
@@ -941,7 +941,7 @@ class _DayPickerState extends State<_DayPicker> {
@override
@override
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
final
ColorScheme
colorScheme
=
Theme
.
of
(
context
)!.
colorScheme
;
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
TextTheme
textTheme
=
Theme
.
of
(
context
)!.
textTheme
;
final
TextStyle
?
headerStyle
=
textTheme
.
caption
?.
apply
(
final
TextStyle
?
headerStyle
=
textTheme
.
caption
?.
apply
(
color:
colorScheme
.
onSurface
.
withOpacity
(
0.60
),
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 {
...
@@ -427,7 +427,7 @@ class _DayHeaders extends StatelessWidget {
final
ThemeData
themeData
=
Theme
.
of
(
context
)!;
final
ThemeData
themeData
=
Theme
.
of
(
context
)!;
final
ColorScheme
colorScheme
=
themeData
.
colorScheme
;
final
ColorScheme
colorScheme
=
themeData
.
colorScheme
;
final
TextStyle
textStyle
=
themeData
.
textTheme
.
subtitle2
!.
apply
(
color:
colorScheme
.
onSurface
);
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
);
final
List
<
Widget
>
labels
=
_getDayHeaders
(
textStyle
,
localizations
);
// Add leading and trailing containers for edges of the custom grid layout.
// Add leading and trailing containers for edges of the custom grid layout.
...
@@ -706,7 +706,7 @@ class _MonthItemState extends State<_MonthItem> {
...
@@ -706,7 +706,7 @@ class _MonthItemState extends State<_MonthItem> {
final
ThemeData
theme
=
Theme
.
of
(
context
)!;
final
ThemeData
theme
=
Theme
.
of
(
context
)!;
final
ColorScheme
colorScheme
=
theme
.
colorScheme
;
final
ColorScheme
colorScheme
=
theme
.
colorScheme
;
final
TextTheme
textTheme
=
theme
.
textTheme
;
final
TextTheme
textTheme
=
theme
.
textTheme
;
final
MaterialLocalizations
localizations
=
MaterialLocalizations
.
of
(
context
)
!
;
final
MaterialLocalizations
localizations
=
MaterialLocalizations
.
of
(
context
);
final
TextDirection
?
textDirection
=
Directionality
.
of
(
context
);
final
TextDirection
?
textDirection
=
Directionality
.
of
(
context
);
final
Color
highlightColor
=
_highlightColor
(
context
);
final
Color
highlightColor
=
_highlightColor
(
context
);
final
int
day
=
dayToBuild
.
day
;
final
int
day
=
dayToBuild
.
day
;
...
@@ -818,7 +818,7 @@ class _MonthItemState extends State<_MonthItem> {
...
@@ -818,7 +818,7 @@ class _MonthItemState extends State<_MonthItem> {
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
final
ThemeData
themeData
=
Theme
.
of
(
context
)!;
final
ThemeData
themeData
=
Theme
.
of
(
context
)!;
final
TextTheme
textTheme
=
themeData
.
textTheme
;
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
year
=
widget
.
displayedMonth
.
year
;
final
int
month
=
widget
.
displayedMonth
.
month
;
final
int
month
=
widget
.
displayedMonth
.
month
;
final
int
daysInMonth
=
utils
.
getDaysInMonth
(
year
,
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 {
...
@@ -239,7 +239,7 @@ class DayPicker extends StatelessWidget {
@override
@override
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
final
ThemeData
themeData
=
Theme
.
of
(
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
year
=
displayedMonth
.
year
;
final
int
month
=
displayedMonth
.
month
;
final
int
month
=
displayedMonth
.
month
;
final
int
daysInMonth
=
getDaysInMonth
(
year
,
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> {
...
@@ -359,7 +359,7 @@ class _DatePickerDialogState extends State<_DatePickerDialog> {
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
final
ThemeData
theme
=
Theme
.
of
(
context
)!;
final
ThemeData
theme
=
Theme
.
of
(
context
)!;
final
ColorScheme
colorScheme
=
theme
.
colorScheme
;
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
Orientation
orientation
=
MediaQuery
.
of
(
context
)!.
orientation
;
final
TextTheme
textTheme
=
theme
.
textTheme
;
final
TextTheme
textTheme
=
theme
.
textTheme
;
// Constrain the textScaleFactor to the largest supported value to prevent
// 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> {
...
@@ -338,7 +338,7 @@ class _DateRangePickerDialogState extends State<_DateRangePickerDialog> {
final
MediaQueryData
mediaQuery
=
MediaQuery
.
of
(
context
)!;
final
MediaQueryData
mediaQuery
=
MediaQuery
.
of
(
context
)!;
final
Orientation
orientation
=
mediaQuery
.
orientation
;
final
Orientation
orientation
=
mediaQuery
.
orientation
;
final
double
textScaleFactor
=
math
.
min
(
mediaQuery
.
textScaleFactor
,
1.3
);
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
Widget
contents
;
final
Size
size
;
final
Size
size
;
...
@@ -478,7 +478,7 @@ class _CalendarRangePickerDialog extends StatelessWidget {
...
@@ -478,7 +478,7 @@ class _CalendarRangePickerDialog extends StatelessWidget {
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
final
ThemeData
theme
=
Theme
.
of
(
context
)!;
final
ThemeData
theme
=
Theme
.
of
(
context
)!;
final
ColorScheme
colorScheme
=
theme
.
colorScheme
;
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
Orientation
orientation
=
MediaQuery
.
of
(
context
)!.
orientation
;
final
TextTheme
textTheme
=
theme
.
textTheme
;
final
TextTheme
textTheme
=
theme
.
textTheme
;
final
Color
headerForeground
=
colorScheme
.
brightness
==
Brightness
.
light
final
Color
headerForeground
=
colorScheme
.
brightness
==
Brightness
.
light
...
@@ -615,7 +615,7 @@ class _InputDateRangePickerDialog extends StatelessWidget {
...
@@ -615,7 +615,7 @@ class _InputDateRangePickerDialog extends StatelessWidget {
final
String
?
helpText
;
final
String
?
helpText
;
String
_formatDateRange
(
BuildContext
context
,
DateTime
?
start
,
DateTime
?
end
,
DateTime
now
)
{
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
startText
=
utils
.
formatRangeStartDate
(
localizations
,
start
,
end
);
final
String
endText
=
utils
.
formatRangeEndDate
(
localizations
,
start
,
end
,
now
);
final
String
endText
=
utils
.
formatRangeEndDate
(
localizations
,
start
,
end
,
now
);
if
(
start
==
null
||
end
==
null
)
{
if
(
start
==
null
||
end
==
null
)
{
...
@@ -632,7 +632,7 @@ class _InputDateRangePickerDialog extends StatelessWidget {
...
@@ -632,7 +632,7 @@ class _InputDateRangePickerDialog extends StatelessWidget {
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
final
ThemeData
theme
=
Theme
.
of
(
context
)!;
final
ThemeData
theme
=
Theme
.
of
(
context
)!;
final
ColorScheme
colorScheme
=
theme
.
colorScheme
;
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
Orientation
orientation
=
MediaQuery
.
of
(
context
)!.
orientation
;
final
TextTheme
textTheme
=
theme
.
textTheme
;
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> {
...
@@ -157,7 +157,7 @@ class _InputDatePickerFormFieldState extends State<InputDatePickerFormField> {
void
didChangeDependencies
()
{
void
didChangeDependencies
()
{
super
.
didChangeDependencies
();
super
.
didChangeDependencies
();
if
(
_selectedDate
!=
null
)
{
if
(
_selectedDate
!=
null
)
{
final
MaterialLocalizations
localizations
=
MaterialLocalizations
.
of
(
context
)
!
;
final
MaterialLocalizations
localizations
=
MaterialLocalizations
.
of
(
context
);
_inputText
=
localizations
.
formatCompactDate
(
_selectedDate
!);
_inputText
=
localizations
.
formatCompactDate
(
_selectedDate
!);
TextEditingValue
textEditingValue
=
_controller
.
value
.
copyWith
(
text:
_inputText
);
TextEditingValue
textEditingValue
=
_controller
.
value
.
copyWith
(
text:
_inputText
);
// Select the new text if we are auto focused and haven't selected the text before.
// 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> {
...
@@ -173,7 +173,7 @@ class _InputDatePickerFormFieldState extends State<InputDatePickerFormField> {
}
}
DateTime
?
_parseDate
(
String
?
text
)
{
DateTime
?
_parseDate
(
String
?
text
)
{
final
MaterialLocalizations
localizations
=
MaterialLocalizations
.
of
(
context
)
!
;
final
MaterialLocalizations
localizations
=
MaterialLocalizations
.
of
(
context
);
return
localizations
.
parseCompactDate
(
text
);
return
localizations
.
parseCompactDate
(
text
);
}
}
...
@@ -188,9 +188,9 @@ class _InputDatePickerFormFieldState extends State<InputDatePickerFormField> {
...
@@ -188,9 +188,9 @@ class _InputDatePickerFormFieldState extends State<InputDatePickerFormField> {
String
?
_validateDate
(
String
?
text
)
{
String
?
_validateDate
(
String
?
text
)
{
final
DateTime
?
date
=
_parseDate
(
text
);
final
DateTime
?
date
=
_parseDate
(
text
);
if
(
date
==
null
)
{
if
(
date
==
null
)
{
return
widget
.
errorFormatText
??
MaterialLocalizations
.
of
(
context
)
!
.
invalidDateFormatLabel
;
return
widget
.
errorFormatText
??
MaterialLocalizations
.
of
(
context
).
invalidDateFormatLabel
;
}
else
if
(!
_isValidAcceptableDate
(
date
))
{
}
else
if
(!
_isValidAcceptableDate
(
date
))
{
return
widget
.
errorInvalidText
??
MaterialLocalizations
.
of
(
context
)
!
.
dateOutOfRangeLabel
;
return
widget
.
errorInvalidText
??
MaterialLocalizations
.
of
(
context
).
dateOutOfRangeLabel
;
}
}
return
null
;
return
null
;
}
}
...
@@ -219,7 +219,7 @@ class _InputDatePickerFormFieldState extends State<InputDatePickerFormField> {
...
@@ -219,7 +219,7 @@ class _InputDatePickerFormFieldState extends State<InputDatePickerFormField> {
@override
@override
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
final
MaterialLocalizations
localizations
=
MaterialLocalizations
.
of
(
context
)
!
;
final
MaterialLocalizations
localizations
=
MaterialLocalizations
.
of
(
context
);
final
InputDecorationTheme
inputTheme
=
Theme
.
of
(
context
)!.
inputDecorationTheme
;
final
InputDecorationTheme
inputTheme
=
Theme
.
of
(
context
)!.
inputDecorationTheme
;
return
TextFormField
(
return
TextFormField
(
decoration:
InputDecoration
(
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> {
...
@@ -141,7 +141,7 @@ class InputDateRangePickerState extends State<InputDateRangePicker> {
@override
@override
void
didChangeDependencies
()
{
void
didChangeDependencies
()
{
super
.
didChangeDependencies
();
super
.
didChangeDependencies
();
final
MaterialLocalizations
localizations
=
MaterialLocalizations
.
of
(
context
)
!
;
final
MaterialLocalizations
localizations
=
MaterialLocalizations
.
of
(
context
);
if
(
_startDate
!=
null
)
{
if
(
_startDate
!=
null
)
{
_startInputText
=
localizations
.
formatCompactDate
(
_startDate
!);
_startInputText
=
localizations
.
formatCompactDate
(
_startDate
!);
final
bool
selectText
=
widget
.
autofocus
&&
!
_autoSelected
;
final
bool
selectText
=
widget
.
autofocus
&&
!
_autoSelected
;
...
@@ -166,7 +166,7 @@ class InputDateRangePickerState extends State<InputDateRangePicker> {
...
@@ -166,7 +166,7 @@ class InputDateRangePickerState extends State<InputDateRangePicker> {
final
String
?
endError
=
_validateDate
(
_endDate
);
final
String
?
endError
=
_validateDate
(
_endDate
);
if
(
startError
==
null
&&
endError
==
null
)
{
if
(
startError
==
null
&&
endError
==
null
)
{
if
(
_startDate
!.
isAfter
(
_endDate
!))
{
if
(
_startDate
!.
isAfter
(
_endDate
!))
{
startError
=
widget
.
errorInvalidRangeText
??
MaterialLocalizations
.
of
(
context
)
!
.
invalidDateRangeLabel
;
startError
=
widget
.
errorInvalidRangeText
??
MaterialLocalizations
.
of
(
context
).
invalidDateRangeLabel
;
}
}
}
}
setState
(()
{
setState
(()
{
...
@@ -177,15 +177,15 @@ class InputDateRangePickerState extends State<InputDateRangePicker> {
...
@@ -177,15 +177,15 @@ class InputDateRangePickerState extends State<InputDateRangePicker> {
}
}
DateTime
?
_parseDate
(
String
?
text
)
{
DateTime
?
_parseDate
(
String
?
text
)
{
final
MaterialLocalizations
localizations
=
MaterialLocalizations
.
of
(
context
)
!
;
final
MaterialLocalizations
localizations
=
MaterialLocalizations
.
of
(
context
);
return
localizations
.
parseCompactDate
(
text
);
return
localizations
.
parseCompactDate
(
text
);
}
}
String
?
_validateDate
(
DateTime
?
date
)
{
String
?
_validateDate
(
DateTime
?
date
)
{
if
(
date
==
null
)
{
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
))
{
}
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
;
return
null
;
}
}
...
@@ -225,7 +225,7 @@ class InputDateRangePickerState extends State<InputDateRangePicker> {
...
@@ -225,7 +225,7 @@ class InputDateRangePickerState extends State<InputDateRangePicker> {
@override
@override
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
final
MaterialLocalizations
localizations
=
MaterialLocalizations
.
of
(
context
)
!
;
final
MaterialLocalizations
localizations
=
MaterialLocalizations
.
of
(
context
);
final
InputDecorationTheme
inputTheme
=
Theme
.
of
(
context
)!.
inputDecorationTheme
;
final
InputDecorationTheme
inputTheme
=
Theme
.
of
(
context
)!.
inputDecorationTheme
;
return
Row
(
return
Row
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
crossAxisAlignment:
CrossAxisAlignment
.
start
,
...
...
packages/flutter/lib/src/material/popup_menu.dart
View file @
6cb6eef6
...
@@ -848,17 +848,15 @@ Future<T?> showMenu<T>({
...
@@ -848,17 +848,15 @@ Future<T?> showMenu<T>({
assert
(
captureInheritedThemes
!=
null
);
assert
(
captureInheritedThemes
!=
null
);
assert
(
debugCheckHasMaterialLocalizations
(
context
));
assert
(
debugCheckHasMaterialLocalizations
(
context
));
String
?
label
;
switch
(
Theme
.
of
(
context
)!.
platform
)
{
switch
(
Theme
.
of
(
context
)!.
platform
)
{
case
TargetPlatform
.
iOS
:
case
TargetPlatform
.
iOS
:
case
TargetPlatform
.
macOS
:
case
TargetPlatform
.
macOS
:
label
=
semanticLabel
;
break
;
break
;
case
TargetPlatform
.
android
:
case
TargetPlatform
.
android
:
case
TargetPlatform
.
fuchsia
:
case
TargetPlatform
.
fuchsia
:
case
TargetPlatform
.
linux
:
case
TargetPlatform
.
linux
:
case
TargetPlatform
.
windows
:
case
TargetPlatform
.
windows
:
label
=
semanticLabel
??
MaterialLocalizations
.
of
(
context
)?
.
popupMenuLabel
;
semanticLabel
??=
MaterialLocalizations
.
of
(
context
)
.
popupMenuLabel
;
}
}
return
Navigator
.
of
(
context
,
rootNavigator:
useRootNavigator
)!.
push
(
_PopupMenuRoute
<
T
>(
return
Navigator
.
of
(
context
,
rootNavigator:
useRootNavigator
)!.
push
(
_PopupMenuRoute
<
T
>(
...
@@ -866,10 +864,10 @@ Future<T?> showMenu<T>({
...
@@ -866,10 +864,10 @@ Future<T?> showMenu<T>({
items:
items
,
items:
items
,
initialValue:
initialValue
,
initialValue:
initialValue
,
elevation:
elevation
,
elevation:
elevation
,
semanticLabel:
l
abel
,
semanticLabel:
semanticL
abel
,
theme:
Theme
.
of
(
context
,
shadowThemeOnly:
true
),
theme:
Theme
.
of
(
context
,
shadowThemeOnly:
true
),
popupMenuTheme:
PopupMenuTheme
.
of
(
context
),
popupMenuTheme:
PopupMenuTheme
.
of
(
context
),
barrierLabel:
MaterialLocalizations
.
of
(
context
)
!
.
modalBarrierDismissLabel
,
barrierLabel:
MaterialLocalizations
.
of
(
context
).
modalBarrierDismissLabel
,
shape:
shape
,
shape:
shape
,
color:
color
,
color:
color
,
showMenuContext:
context
,
showMenuContext:
context
,
...
@@ -1142,7 +1140,7 @@ class PopupMenuButtonState<T> extends State<PopupMenuButton<T>> {
...
@@ -1142,7 +1140,7 @@ class PopupMenuButtonState<T> extends State<PopupMenuButton<T>> {
if
(
widget
.
child
!=
null
)
if
(
widget
.
child
!=
null
)
return
Tooltip
(
return
Tooltip
(
message:
widget
.
tooltip
??
MaterialLocalizations
.
of
(
context
)
!
.
showMenuTooltip
,
message:
widget
.
tooltip
??
MaterialLocalizations
.
of
(
context
).
showMenuTooltip
,
child:
InkWell
(
child:
InkWell
(
onTap:
widget
.
enabled
?
showButtonMenu
:
null
,
onTap:
widget
.
enabled
?
showButtonMenu
:
null
,
canRequestFocus:
_canRequestFocus
,
canRequestFocus:
_canRequestFocus
,
...
@@ -1153,7 +1151,7 @@ class PopupMenuButtonState<T> extends State<PopupMenuButton<T>> {
...
@@ -1153,7 +1151,7 @@ class PopupMenuButtonState<T> extends State<PopupMenuButton<T>> {
return
IconButton
(
return
IconButton
(
icon:
widget
.
icon
??
_getIcon
(
Theme
.
of
(
context
)!.
platform
),
icon:
widget
.
icon
??
_getIcon
(
Theme
.
of
(
context
)!.
platform
),
padding:
widget
.
padding
,
padding:
widget
.
padding
,
tooltip:
widget
.
tooltip
??
MaterialLocalizations
.
of
(
context
)
!
.
showMenuTooltip
,
tooltip:
widget
.
tooltip
??
MaterialLocalizations
.
of
(
context
).
showMenuTooltip
,
onPressed:
widget
.
enabled
?
showButtonMenu
:
null
,
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
...
@@ -467,7 +467,7 @@ class RefreshIndicatorState extends State<RefreshIndicator> with TickerProviderS
animation:
_positionController
,
animation:
_positionController
,
builder:
(
BuildContext
context
,
Widget
?
child
)
{
builder:
(
BuildContext
context
,
Widget
?
child
)
{
return
RefreshProgressIndicator
(
return
RefreshProgressIndicator
(
semanticsLabel:
widget
.
semanticsLabel
??
MaterialLocalizations
.
of
(
context
)
!
.
refreshIndicatorSemanticLabel
,
semanticsLabel:
widget
.
semanticsLabel
??
MaterialLocalizations
.
of
(
context
).
refreshIndicatorSemanticLabel
,
semanticsValue:
widget
.
semanticsValue
,
semanticsValue:
widget
.
semanticsValue
,
value:
showIndeterminateIndicator
?
null
:
_value
.
value
,
value:
showIndeterminateIndicator
?
null
:
_value
.
value
,
valueColor:
_valueColor
,
valueColor:
_valueColor
,
...
...
packages/flutter/lib/src/material/reorderable_list.dart
View file @
6cb6eef6
...
@@ -402,7 +402,7 @@ class _ReorderableListContentState extends State<_ReorderableListContent> with T
...
@@ -402,7 +402,7 @@ class _ReorderableListContentState extends State<_ReorderableListContent> with T
// before index+2, which is after the space at index+1.
// before index+2, which is after the space at index+1.
void
moveAfter
()
=>
reorder
(
index
,
index
+
2
);
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 the item can move to before its current position in the list.
if
(
index
>
0
)
{
if
(
index
>
0
)
{
...
...
packages/flutter/lib/src/material/search.dart
View file @
6cb6eef6
...
@@ -479,7 +479,7 @@ class _SearchPageState<T> extends State<_SearchPage<T>> {
...
@@ -479,7 +479,7 @@ class _SearchPageState<T> extends State<_SearchPage<T>> {
assert
(
debugCheckHasMaterialLocalizations
(
context
));
assert
(
debugCheckHasMaterialLocalizations
(
context
));
final
ThemeData
theme
=
widget
.
delegate
.
appBarTheme
(
context
);
final
ThemeData
theme
=
widget
.
delegate
.
appBarTheme
(
context
);
final
String
searchFieldLabel
=
widget
.
delegate
.
searchFieldLabel
final
String
searchFieldLabel
=
widget
.
delegate
.
searchFieldLabel
??
MaterialLocalizations
.
of
(
context
)
!
.
searchFieldLabel
;
??
MaterialLocalizations
.
of
(
context
).
searchFieldLabel
;
final
TextStyle
?
searchFieldStyle
=
widget
.
delegate
.
searchFieldStyle
final
TextStyle
?
searchFieldStyle
=
widget
.
delegate
.
searchFieldStyle
??
theme
.
inputDecorationTheme
.
hintStyle
;
??
theme
.
inputDecorationTheme
.
hintStyle
;
Widget
?
body
;
Widget
?
body
;
...
...
packages/flutter/lib/src/material/stepper.dart
View file @
6cb6eef6
...
@@ -406,7 +406,7 @@ class _StepperState extends State<Stepper> with TickerProviderStateMixin {
...
@@ -406,7 +406,7 @@ class _StepperState extends State<Stepper> with TickerProviderStateMixin {
final
ThemeData
themeData
=
Theme
.
of
(
context
)!;
final
ThemeData
themeData
=
Theme
.
of
(
context
)!;
final
ColorScheme
colorScheme
=
themeData
.
colorScheme
;
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
OutlinedBorder
buttonShape
=
RoundedRectangleBorder
(
borderRadius:
BorderRadius
.
all
(
Radius
.
circular
(
2
)));
const
EdgeInsets
buttonPadding
=
EdgeInsets
.
symmetric
(
horizontal:
16.0
);
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> {
...
@@ -1030,7 +1030,7 @@ class _TabBarState extends State<TabBar> {
}
}
return
true
;
return
true
;
}());
}());
final
MaterialLocalizations
localizations
=
MaterialLocalizations
.
of
(
context
)
!
;
final
MaterialLocalizations
localizations
=
MaterialLocalizations
.
of
(
context
);
if
(
_controller
!.
length
==
0
)
{
if
(
_controller
!.
length
==
0
)
{
return
Container
(
return
Container
(
height:
_kTabHeight
+
widget
.
indicatorWeight
,
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
...
@@ -865,7 +865,7 @@ class _TextFieldState extends State<TextField> with RestorationMixin implements
bool
get
_hasError
=>
widget
.
decoration
?.
errorText
!=
null
||
_hasIntrinsicError
;
bool
get
_hasError
=>
widget
.
decoration
?.
errorText
!=
null
||
_hasIntrinsicError
;
InputDecoration
_getEffectiveDecoration
()
{
InputDecoration
_getEffectiveDecoration
()
{
final
MaterialLocalizations
localizations
=
MaterialLocalizations
.
of
(
context
)
!
;
final
MaterialLocalizations
localizations
=
MaterialLocalizations
.
of
(
context
);
final
ThemeData
themeData
=
Theme
.
of
(
context
)!;
final
ThemeData
themeData
=
Theme
.
of
(
context
)!;
final
InputDecoration
effectiveDecoration
=
(
widget
.
decoration
??
const
InputDecoration
())
final
InputDecoration
effectiveDecoration
=
(
widget
.
decoration
??
const
InputDecoration
())
.
applyDefaults
(
themeData
.
inputDecorationTheme
)
.
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
...
@@ -183,7 +183,7 @@ class _TextSelectionToolbarState extends State<_TextSelectionToolbar> with Ticke
return
const
SizedBox
(
width:
0.0
,
height:
0.0
);
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
>[
final
List
<
_ItemData
>
itemDatas
=
<
_ItemData
>[
if
(
widget
.
handleCut
!=
null
)
if
(
widget
.
handleCut
!=
null
)
_ItemData
(
widget
.
handleCut
!,
localizations
.
cutButtonLabel
),
_ItemData
(
widget
.
handleCut
!,
localizations
.
cutButtonLabel
),
...
...
packages/flutter/lib/src/material/theme.dart
View file @
6cb6eef6
...
@@ -132,7 +132,7 @@ class Theme extends StatelessWidget {
...
@@ -132,7 +132,7 @@ class Theme extends StatelessWidget {
return
inheritedTheme
.
theme
.
data
;
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
ScriptCategory
category
=
localizations
?.
scriptCategory
??
ScriptCategory
.
englishLike
;
final
ThemeData
theme
=
inheritedTheme
?.
theme
.
data
??
_kFallbackTheme
;
final
ThemeData
theme
=
inheritedTheme
?.
theme
.
data
??
_kFallbackTheme
;
return
ThemeData
.
localize
(
theme
,
theme
.
typography
.
geometryThemeFor
(
category
));
return
ThemeData
.
localize
(
theme
,
theme
.
typography
.
geometryThemeFor
(
category
));
...
...
packages/flutter/lib/src/material/time.dart
View file @
6cb6eef6
...
@@ -104,7 +104,7 @@ class TimeOfDay {
...
@@ -104,7 +104,7 @@ class TimeOfDay {
String
format
(
BuildContext
context
)
{
String
format
(
BuildContext
context
)
{
assert
(
debugCheckHasMediaQuery
(
context
));
assert
(
debugCheckHasMediaQuery
(
context
));
assert
(
debugCheckHasMaterialLocalizations
(
context
));
assert
(
debugCheckHasMaterialLocalizations
(
context
));
final
MaterialLocalizations
localizations
=
MaterialLocalizations
.
of
(
context
)
!
;
final
MaterialLocalizations
localizations
=
MaterialLocalizations
.
of
(
context
);
return
localizations
.
formatTimeOfDay
(
return
localizations
.
formatTimeOfDay
(
this
,
this
,
alwaysUse24HourFormat:
MediaQuery
.
of
(
context
)!.
alwaysUse24HourFormat
,
alwaysUse24HourFormat:
MediaQuery
.
of
(
context
)!.
alwaysUse24HourFormat
,
...
...
packages/flutter/lib/src/material/time_picker.dart
View file @
6cb6eef6
...
@@ -134,7 +134,7 @@ class _TimePickerHeader extends StatelessWidget {
...
@@ -134,7 +134,7 @@ class _TimePickerHeader extends StatelessWidget {
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
assert
(
debugCheckHasMediaQuery
(
context
));
assert
(
debugCheckHasMediaQuery
(
context
));
final
ThemeData
themeData
=
Theme
.
of
(
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
,
alwaysUse24HourFormat:
MediaQuery
.
of
(
context
)!.
alwaysUse24HourFormat
,
);
);
...
@@ -241,7 +241,7 @@ class _TimePickerHeader extends StatelessWidget {
...
@@ -241,7 +241,7 @@ class _TimePickerHeader extends StatelessWidget {
children:
<
Widget
>[
children:
<
Widget
>[
const
SizedBox
(
height:
16.0
),
const
SizedBox
(
height:
16.0
),
Text
(
Text
(
helpText
??
MaterialLocalizations
.
of
(
context
)
!
.
timePickerDialHelpText
,
helpText
??
MaterialLocalizations
.
of
(
context
).
timePickerDialHelpText
,
style:
TimePickerTheme
.
of
(
context
).
helpTextStyle
??
themeData
.
textTheme
.
overline
,
style:
TimePickerTheme
.
of
(
context
).
helpTextStyle
??
themeData
.
textTheme
.
overline
,
),
),
controls
,
controls
,
...
@@ -322,7 +322,7 @@ class _HourControl extends StatelessWidget {
...
@@ -322,7 +322,7 @@ class _HourControl extends StatelessWidget {
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
assert
(
debugCheckHasMediaQuery
(
context
));
assert
(
debugCheckHasMediaQuery
(
context
));
final
bool
alwaysUse24HourFormat
=
MediaQuery
.
of
(
context
)!.
alwaysUse24HourFormat
;
final
bool
alwaysUse24HourFormat
=
MediaQuery
.
of
(
context
)!.
alwaysUse24HourFormat
;
final
MaterialLocalizations
localizations
=
MaterialLocalizations
.
of
(
context
)
!
;
final
MaterialLocalizations
localizations
=
MaterialLocalizations
.
of
(
context
);
final
String
formattedHour
=
localizations
.
formatHour
(
final
String
formattedHour
=
localizations
.
formatHour
(
fragmentContext
.
selectedTime
,
fragmentContext
.
selectedTime
,
alwaysUse24HourFormat:
alwaysUse24HourFormat
,
alwaysUse24HourFormat:
alwaysUse24HourFormat
,
...
@@ -432,7 +432,7 @@ class _MinuteControl extends StatelessWidget {
...
@@ -432,7 +432,7 @@ class _MinuteControl extends StatelessWidget {
@override
@override
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
final
MaterialLocalizations
localizations
=
MaterialLocalizations
.
of
(
context
)
!
;
final
MaterialLocalizations
localizations
=
MaterialLocalizations
.
of
(
context
);
final
String
formattedMinute
=
localizations
.
formatMinute
(
fragmentContext
.
selectedTime
);
final
String
formattedMinute
=
localizations
.
formatMinute
(
fragmentContext
.
selectedTime
);
final
TimeOfDay
nextMinute
=
fragmentContext
.
selectedTime
.
replacing
(
final
TimeOfDay
nextMinute
=
fragmentContext
.
selectedTime
.
replacing
(
minute:
(
fragmentContext
.
selectedTime
.
minute
+
1
)
%
TimeOfDay
.
minutesPerHour
,
minute:
(
fragmentContext
.
selectedTime
.
minute
+
1
)
%
TimeOfDay
.
minutesPerHour
,
...
@@ -493,7 +493,7 @@ class _DayPeriodControl extends StatelessWidget {
...
@@ -493,7 +493,7 @@ class _DayPeriodControl extends StatelessWidget {
case
TargetPlatform
.
fuchsia
:
case
TargetPlatform
.
fuchsia
:
case
TargetPlatform
.
linux
:
case
TargetPlatform
.
linux
:
case
TargetPlatform
.
windows
:
case
TargetPlatform
.
windows
:
_announceToAccessibility
(
context
,
MaterialLocalizations
.
of
(
context
)
!
.
anteMeridiemAbbreviation
);
_announceToAccessibility
(
context
,
MaterialLocalizations
.
of
(
context
).
anteMeridiemAbbreviation
);
break
;
break
;
case
TargetPlatform
.
iOS
:
case
TargetPlatform
.
iOS
:
case
TargetPlatform
.
macOS
:
case
TargetPlatform
.
macOS
:
...
@@ -511,7 +511,7 @@ class _DayPeriodControl extends StatelessWidget {
...
@@ -511,7 +511,7 @@ class _DayPeriodControl extends StatelessWidget {
case
TargetPlatform
.
fuchsia
:
case
TargetPlatform
.
fuchsia
:
case
TargetPlatform
.
linux
:
case
TargetPlatform
.
linux
:
case
TargetPlatform
.
windows
:
case
TargetPlatform
.
windows
:
_announceToAccessibility
(
context
,
MaterialLocalizations
.
of
(
context
)
!
.
postMeridiemAbbreviation
);
_announceToAccessibility
(
context
,
MaterialLocalizations
.
of
(
context
).
postMeridiemAbbreviation
);
break
;
break
;
case
TargetPlatform
.
iOS
:
case
TargetPlatform
.
iOS
:
case
TargetPlatform
.
macOS
:
case
TargetPlatform
.
macOS
:
...
@@ -522,7 +522,7 @@ class _DayPeriodControl extends StatelessWidget {
...
@@ -522,7 +522,7 @@ class _DayPeriodControl extends StatelessWidget {
@override
@override
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
final
MaterialLocalizations
materialLocalizations
=
MaterialLocalizations
.
of
(
context
)
!
;
final
MaterialLocalizations
materialLocalizations
=
MaterialLocalizations
.
of
(
context
);
final
ColorScheme
colorScheme
=
Theme
.
of
(
context
)!.
colorScheme
;
final
ColorScheme
colorScheme
=
Theme
.
of
(
context
)!.
colorScheme
;
final
TimePickerThemeData
timePickerTheme
=
TimePickerTheme
.
of
(
context
);
final
TimePickerThemeData
timePickerTheme
=
TimePickerTheme
.
of
(
context
);
final
bool
isDark
=
colorScheme
.
brightness
==
Brightness
.
dark
;
final
bool
isDark
=
colorScheme
.
brightness
==
Brightness
.
dark
;
...
@@ -941,7 +941,7 @@ class _DialState extends State<_Dial> with SingleTickerProviderStateMixin {
...
@@ -941,7 +941,7 @@ class _DialState extends State<_Dial> with SingleTickerProviderStateMixin {
super
.
didChangeDependencies
();
super
.
didChangeDependencies
();
assert
(
debugCheckHasMediaQuery
(
context
));
assert
(
debugCheckHasMediaQuery
(
context
));
themeData
=
Theme
.
of
(
context
)!;
themeData
=
Theme
.
of
(
context
)!;
localizations
=
MaterialLocalizations
.
of
(
context
)
!
;
localizations
=
MaterialLocalizations
.
of
(
context
);
media
=
MediaQuery
.
of
(
context
)!;
media
=
MediaQuery
.
of
(
context
)!;
}
}
...
@@ -1409,7 +1409,7 @@ class _TimePickerInputState extends State<_TimePickerInput> {
...
@@ -1409,7 +1409,7 @@ class _TimePickerInputState extends State<_TimePickerInput> {
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
assert
(
debugCheckHasMediaQuery
(
context
));
assert
(
debugCheckHasMediaQuery
(
context
));
final
MediaQueryData
media
=
MediaQuery
.
of
(
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
bool
use24HourDials
=
hourFormat
(
of:
timeOfDayFormat
)
!=
HourFormat
.
h
;
final
ThemeData
theme
=
Theme
.
of
(
context
)!;
final
ThemeData
theme
=
Theme
.
of
(
context
)!;
final
TextStyle
hourMinuteStyle
=
TimePickerTheme
.
of
(
context
).
hourMinuteTextStyle
??
theme
.
textTheme
.
headline2
!;
final
TextStyle
hourMinuteStyle
=
TimePickerTheme
.
of
(
context
).
hourMinuteTextStyle
??
theme
.
textTheme
.
headline2
!;
...
@@ -1420,7 +1420,7 @@ class _TimePickerInputState extends State<_TimePickerInput> {
...
@@ -1420,7 +1420,7 @@ class _TimePickerInputState extends State<_TimePickerInput> {
crossAxisAlignment:
CrossAxisAlignment
.
start
,
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
<
Widget
>[
children:
<
Widget
>[
Text
(
Text
(
widget
.
helpText
??
MaterialLocalizations
.
of
(
context
)
!
.
timePickerInputHelpText
,
widget
.
helpText
??
MaterialLocalizations
.
of
(
context
).
timePickerInputHelpText
,
style:
TimePickerTheme
.
of
(
context
).
helpTextStyle
??
theme
.
textTheme
.
overline
,
style:
TimePickerTheme
.
of
(
context
).
helpTextStyle
??
theme
.
textTheme
.
overline
,
),
),
const
SizedBox
(
height:
16.0
),
const
SizedBox
(
height:
16.0
),
...
@@ -1458,7 +1458,7 @@ class _TimePickerInputState extends State<_TimePickerInput> {
...
@@ -1458,7 +1458,7 @@ class _TimePickerInputState extends State<_TimePickerInput> {
if
(!
hourHasError
&&
!
minuteHasError
)
if
(!
hourHasError
&&
!
minuteHasError
)
ExcludeSemantics
(
ExcludeSemantics
(
child:
Text
(
child:
Text
(
MaterialLocalizations
.
of
(
context
)
!
.
timePickerHourLabel
,
MaterialLocalizations
.
of
(
context
).
timePickerHourLabel
,
style:
theme
.
textTheme
.
caption
,
style:
theme
.
textTheme
.
caption
,
maxLines:
1
,
maxLines:
1
,
overflow:
TextOverflow
.
ellipsis
,
overflow:
TextOverflow
.
ellipsis
,
...
@@ -1488,7 +1488,7 @@ class _TimePickerInputState extends State<_TimePickerInput> {
...
@@ -1488,7 +1488,7 @@ class _TimePickerInputState extends State<_TimePickerInput> {
if
(!
hourHasError
&&
!
minuteHasError
)
if
(!
hourHasError
&&
!
minuteHasError
)
ExcludeSemantics
(
ExcludeSemantics
(
child:
Text
(
child:
Text
(
MaterialLocalizations
.
of
(
context
)
!
.
timePickerMinuteLabel
,
MaterialLocalizations
.
of
(
context
).
timePickerMinuteLabel
,
style:
theme
.
textTheme
.
caption
,
style:
theme
.
textTheme
.
caption
,
maxLines:
1
,
maxLines:
1
,
overflow:
TextOverflow
.
ellipsis
,
overflow:
TextOverflow
.
ellipsis
,
...
@@ -1512,7 +1512,7 @@ class _TimePickerInputState extends State<_TimePickerInput> {
...
@@ -1512,7 +1512,7 @@ class _TimePickerInputState extends State<_TimePickerInput> {
),
),
if
(
hourHasError
||
minuteHasError
)
if
(
hourHasError
||
minuteHasError
)
Text
(
Text
(
MaterialLocalizations
.
of
(
context
)
!
.
invalidTimeLabel
,
MaterialLocalizations
.
of
(
context
).
invalidTimeLabel
,
style:
theme
.
textTheme
.
bodyText2
!.
copyWith
(
color:
theme
.
colorScheme
.
error
),
style:
theme
.
textTheme
.
bodyText2
!.
copyWith
(
color:
theme
.
colorScheme
.
error
),
)
)
else
else
...
@@ -1548,7 +1548,7 @@ class _HourTextField extends StatelessWidget {
...
@@ -1548,7 +1548,7 @@ class _HourTextField extends StatelessWidget {
isHour:
true
,
isHour:
true
,
autofocus:
autofocus
,
autofocus:
autofocus
,
style:
style
,
style:
style
,
semanticHintText:
MaterialLocalizations
.
of
(
context
)
!
.
timePickerHourLabel
,
semanticHintText:
MaterialLocalizations
.
of
(
context
).
timePickerHourLabel
,
validator:
validator
,
validator:
validator
,
onSavedSubmitted:
onSavedSubmitted
,
onSavedSubmitted:
onSavedSubmitted
,
onChanged:
onChanged
,
onChanged:
onChanged
,
...
@@ -1579,7 +1579,7 @@ class _MinuteTextField extends StatelessWidget {
...
@@ -1579,7 +1579,7 @@ class _MinuteTextField extends StatelessWidget {
isHour:
false
,
isHour:
false
,
autofocus:
autofocus
,
autofocus:
autofocus
,
style:
style
,
style:
style
,
semanticHintText:
MaterialLocalizations
.
of
(
context
)
!
.
timePickerMinuteLabel
,
semanticHintText:
MaterialLocalizations
.
of
(
context
).
timePickerMinuteLabel
,
validator:
validator
,
validator:
validator
,
onSavedSubmitted:
onSavedSubmitted
,
onSavedSubmitted:
onSavedSubmitted
,
);
);
...
@@ -1632,7 +1632,7 @@ class _HourMinuteTextFieldState extends State<_HourMinuteTextField> {
...
@@ -1632,7 +1632,7 @@ class _HourMinuteTextFieldState extends State<_HourMinuteTextField> {
String
get
_formattedValue
{
String
get
_formattedValue
{
final
bool
alwaysUse24HourFormat
=
MediaQuery
.
of
(
context
)!.
alwaysUse24HourFormat
;
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
(
return
!
widget
.
isHour
?
localizations
.
formatMinute
(
widget
.
selectedTime
)
:
localizations
.
formatHour
(
widget
.
selectedTime
,
widget
.
selectedTime
,
alwaysUse24HourFormat:
alwaysUse24HourFormat
,
alwaysUse24HourFormat:
alwaysUse24HourFormat
,
...
@@ -1770,7 +1770,7 @@ class _TimePickerDialogState extends State<_TimePickerDialog> {
...
@@ -1770,7 +1770,7 @@ class _TimePickerDialogState extends State<_TimePickerDialog> {
@override
@override
void
didChangeDependencies
()
{
void
didChangeDependencies
()
{
super
.
didChangeDependencies
();
super
.
didChangeDependencies
();
localizations
=
MaterialLocalizations
.
of
(
context
)
!
;
localizations
=
MaterialLocalizations
.
of
(
context
);
_announceInitialTimeOnce
();
_announceInitialTimeOnce
();
_announceModeOnce
();
_announceModeOnce
();
}
}
...
@@ -1855,7 +1855,7 @@ class _TimePickerDialogState extends State<_TimePickerDialog> {
...
@@ -1855,7 +1855,7 @@ class _TimePickerDialogState extends State<_TimePickerDialog> {
return
;
return
;
final
MediaQueryData
media
=
MediaQuery
.
of
(
context
)!;
final
MediaQueryData
media
=
MediaQuery
.
of
(
context
)!;
final
MaterialLocalizations
localizations
=
MaterialLocalizations
.
of
(
context
)
!
;
final
MaterialLocalizations
localizations
=
MaterialLocalizations
.
of
(
context
);
_announceToAccessibility
(
_announceToAccessibility
(
context
,
context
,
localizations
.
formatTimeOfDay
(
widget
.
initialTime
,
alwaysUse24HourFormat:
media
.
alwaysUse24HourFormat
),
localizations
.
formatTimeOfDay
(
widget
.
initialTime
,
alwaysUse24HourFormat:
media
.
alwaysUse24HourFormat
),
...
@@ -1957,8 +1957,8 @@ class _TimePickerDialogState extends State<_TimePickerDialog> {
...
@@ -1957,8 +1957,8 @@ class _TimePickerDialogState extends State<_TimePickerDialog> {
onPressed:
_handleEntryModeToggle
,
onPressed:
_handleEntryModeToggle
,
icon:
Icon
(
_entryMode
==
TimePickerEntryMode
.
dial
?
Icons
.
keyboard
:
Icons
.
access_time
),
icon:
Icon
(
_entryMode
==
TimePickerEntryMode
.
dial
?
Icons
.
keyboard
:
Icons
.
access_time
),
tooltip:
_entryMode
==
TimePickerEntryMode
.
dial
tooltip:
_entryMode
==
TimePickerEntryMode
.
dial
?
MaterialLocalizations
.
of
(
context
)
!
.
inputTimeModeButtonLabel
?
MaterialLocalizations
.
of
(
context
).
inputTimeModeButtonLabel
:
MaterialLocalizations
.
of
(
context
)
!
.
dialModeButtonLabel
,
:
MaterialLocalizations
.
of
(
context
).
dialModeButtonLabel
,
),
),
Expanded
(
Expanded
(
child:
Container
(
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
...
@@ -134,7 +134,7 @@ class _AccountDetailsState extends State<_AccountDetails> with SingleTickerProvi
assert
(
debugCheckHasMaterialLocalizations
(
context
));
assert
(
debugCheckHasMaterialLocalizations
(
context
));
final
ThemeData
theme
=
Theme
.
of
(
context
)!;
final
ThemeData
theme
=
Theme
.
of
(
context
)!;
final
MaterialLocalizations
localizations
=
MaterialLocalizations
.
of
(
context
)
!
;
final
MaterialLocalizations
localizations
=
MaterialLocalizations
.
of
(
context
);
Widget
accountDetails
=
CustomMultiChildLayout
(
Widget
accountDetails
=
CustomMultiChildLayout
(
delegate:
_AccountDetailsLayout
(
delegate:
_AccountDetailsLayout
(
...
@@ -356,7 +356,7 @@ class _UserAccountsDrawerHeaderState extends State<UserAccountsDrawerHeader> {
...
@@ -356,7 +356,7 @@ class _UserAccountsDrawerHeaderState extends State<UserAccountsDrawerHeader> {
assert
(
debugCheckHasMaterialLocalizations
(
context
));
assert
(
debugCheckHasMaterialLocalizations
(
context
));
return
Semantics
(
return
Semantics
(
container:
true
,
container:
true
,
label:
MaterialLocalizations
.
of
(
context
)
!
.
signedInLabel
,
label:
MaterialLocalizations
.
of
(
context
).
signedInLabel
,
child:
DrawerHeader
(
child:
DrawerHeader
(
decoration:
widget
.
decoration
??
BoxDecoration
(
decoration:
widget
.
decoration
??
BoxDecoration
(
color:
Theme
.
of
(
context
)!.
primaryColor
,
color:
Theme
.
of
(
context
)!.
primaryColor
,
...
...
packages/flutter/test/cupertino/app_test.dart
View file @
6cb6eef6
...
@@ -50,8 +50,8 @@ void main() {
...
@@ -50,8 +50,8 @@ void main() {
builder:
(
BuildContext
context
)
{
builder:
(
BuildContext
context
)
{
return
Column
(
return
Column
(
children:
<
Widget
>[
children:
<
Widget
>[
Text
(
CupertinoLocalizations
.
of
(
context
)
!
.
selectAllButtonLabel
),
Text
(
CupertinoLocalizations
.
of
(
context
).
selectAllButtonLabel
),
Text
(
CupertinoLocalizations
.
of
(
context
)
!
.
datePickerMediumDate
(
Text
(
CupertinoLocalizations
.
of
(
context
).
datePickerMediumDate
(
DateTime
(
2018
,
10
,
4
),
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() {
...
@@ -32,4 +32,28 @@ void main() {
expect
(
localizations
.
modalBarrierDismissLabel
,
isNotNull
);
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() {
...
@@ -500,8 +500,8 @@ void main() {
builder:
(
BuildContext
context
)
{
builder:
(
BuildContext
context
)
{
return
Column
(
return
Column
(
children:
<
Widget
>[
children:
<
Widget
>[
Text
(
MaterialLocalizations
.
of
(
context
)
!
.
selectAllButtonLabel
),
Text
(
MaterialLocalizations
.
of
(
context
).
selectAllButtonLabel
),
Text
(
CupertinoLocalizations
.
of
(
context
)
!
.
selectAllButtonLabel
),
Text
(
CupertinoLocalizations
.
of
(
context
).
selectAllButtonLabel
),
],
],
);
);
},
},
...
...
packages/flutter/test/material/localizations_test.dart
View file @
6cb6eef6
...
@@ -102,4 +102,28 @@ void main() {
...
@@ -102,4 +102,28 @@ void main() {
expect
(
localizations
.
licensesPackageDetailText
(
2
).
contains
(
r'$licensesCount'
),
isFalse
);
expect
(
localizations
.
licensesPackageDetailText
(
2
).
contains
(
r'$licensesCount'
),
isFalse
);
expect
(
localizations
.
licensesPackageDetailText
(
100
).
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(
...
@@ -65,7 +65,7 @@ Future<Offset?> startPicker(
}
}
Future
<
void
>
finishPicker
(
WidgetTester
tester
)
async
{
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
.
tap
(
find
.
text
(
materialLocalizations
.
okButtonLabel
));
await
tester
.
pumpAndSettle
(
const
Duration
(
seconds:
1
));
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