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
f7e0f836
Unverified
Commit
f7e0f836
authored
Oct 05, 2018
by
xster
Committed by
GitHub
Oct 05, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Let MaterialApp/CupertinoApp provide default cupertino localization (#22706)
parent
3ea4b443
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
131 additions
and
88 deletions
+131
-88
app.dart
packages/flutter/lib/src/cupertino/app.dart
+13
-1
date_picker.dart
packages/flutter/lib/src/cupertino/date_picker.dart
+3
-3
dialog.dart
packages/flutter/lib/src/cupertino/dialog.dart
+1
-2
app.dart
packages/flutter/lib/src/material/app.dart
+2
-0
app_test.dart
packages/flutter/test/cupertino/app_test.dart
+22
-0
date_picker_test.dart
packages/flutter/test/cupertino/date_picker_test.dart
+67
-82
app_test.dart
packages/flutter/test/material/app_test.dart
+23
-0
No files found.
packages/flutter/lib/src/cupertino/app.dart
View file @
f7e0f836
...
@@ -8,6 +8,7 @@ import 'package:flutter/widgets.dart';
...
@@ -8,6 +8,7 @@ import 'package:flutter/widgets.dart';
import
'button.dart'
;
import
'button.dart'
;
import
'colors.dart'
;
import
'colors.dart'
;
import
'icons.dart'
;
import
'icons.dart'
;
import
'localizations.dart'
;
import
'route.dart'
;
import
'route.dart'
;
// Based on specs from https://developer.apple.com/design/resources/ for
// Based on specs from https://developer.apple.com/design/resources/ for
...
@@ -246,6 +247,17 @@ class _CupertinoAppState extends State<CupertinoApp> {
...
@@ -246,6 +247,17 @@ class _CupertinoAppState extends State<CupertinoApp> {
}
}
}
}
// Combine the default localization for Cupertino with the ones contributed
// by the localizationsDelegates parameter, if any. Only the first delegate
// of a particular LocalizationsDelegate.type is loaded so the
// localizationsDelegate parameter can be used to override
// _CupertinoLocalizationsDelegate.
Iterable
<
LocalizationsDelegate
<
dynamic
>>
get
_localizationsDelegates
sync
*
{
if
(
widget
.
localizationsDelegates
!=
null
)
yield
*
widget
.
localizationsDelegates
;
yield
DefaultCupertinoLocalizations
.
delegate
;
}
@override
@override
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
return
ScrollConfiguration
(
return
ScrollConfiguration
(
...
@@ -269,7 +281,7 @@ class _CupertinoAppState extends State<CupertinoApp> {
...
@@ -269,7 +281,7 @@ class _CupertinoAppState extends State<CupertinoApp> {
textStyle:
_kDefaultTextStyle
,
textStyle:
_kDefaultTextStyle
,
color:
widget
.
color
??
CupertinoColors
.
activeBlue
,
color:
widget
.
color
??
CupertinoColors
.
activeBlue
,
locale:
widget
.
locale
,
locale:
widget
.
locale
,
localizationsDelegates:
widget
.
localizationsDelegates
,
localizationsDelegates:
_
localizationsDelegates
,
localeResolutionCallback:
widget
.
localeResolutionCallback
,
localeResolutionCallback:
widget
.
localeResolutionCallback
,
supportedLocales:
widget
.
supportedLocales
,
supportedLocales:
widget
.
supportedLocales
,
showPerformanceOverlay:
widget
.
showPerformanceOverlay
,
showPerformanceOverlay:
widget
.
showPerformanceOverlay
,
...
...
packages/flutter/lib/src/cupertino/date_picker.dart
View file @
f7e0f836
...
@@ -397,7 +397,7 @@ class _CupertinoDatePickerDateTimeState extends State<CupertinoDatePicker> {
...
@@ -397,7 +397,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
)
??
const
DefaultCupertinoLocalizations
()
;
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
;
...
@@ -694,7 +694,7 @@ class _CupertinoDatePickerDateState extends State<CupertinoDatePicker> {
...
@@ -694,7 +694,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
)
??
const
DefaultCupertinoLocalizations
()
;
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
;
...
@@ -1033,7 +1033,7 @@ class _CupertinoTimerPickerState extends State<CupertinoTimerPicker> {
...
@@ -1033,7 +1033,7 @@ class _CupertinoTimerPickerState extends State<CupertinoTimerPicker> {
super
.
didChangeDependencies
();
super
.
didChangeDependencies
();
textDirectionFactor
=
Directionality
.
of
(
context
)
==
TextDirection
.
ltr
?
1
:
-
1
;
textDirectionFactor
=
Directionality
.
of
(
context
)
==
TextDirection
.
ltr
?
1
:
-
1
;
localizations
=
CupertinoLocalizations
.
of
(
context
)
??
const
DefaultCupertinoLocalizations
()
;
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
;
...
...
packages/flutter/lib/src/cupertino/dialog.dart
View file @
f7e0f836
...
@@ -219,8 +219,7 @@ class CupertinoAlertDialog extends StatelessWidget {
...
@@ -219,8 +219,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
);
??
const
DefaultCupertinoLocalizations
();
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
MediaQuery
(
return
MediaQuery
(
...
...
packages/flutter/lib/src/material/app.dart
View file @
f7e0f836
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// found in the LICENSE file.
import
'package:flutter/cupertino.dart'
;
import
'package:flutter/rendering.dart'
;
import
'package:flutter/rendering.dart'
;
import
'package:flutter/widgets.dart'
;
import
'package:flutter/widgets.dart'
;
...
@@ -366,6 +367,7 @@ class _MaterialAppState extends State<MaterialApp> {
...
@@ -366,6 +367,7 @@ class _MaterialAppState extends State<MaterialApp> {
if
(
widget
.
localizationsDelegates
!=
null
)
if
(
widget
.
localizationsDelegates
!=
null
)
yield
*
widget
.
localizationsDelegates
;
yield
*
widget
.
localizationsDelegates
;
yield
DefaultMaterialLocalizations
.
delegate
;
yield
DefaultMaterialLocalizations
.
delegate
;
yield
DefaultCupertinoLocalizations
.
delegate
;
}
}
@override
@override
...
...
packages/flutter/test/cupertino/app_test.dart
View file @
f7e0f836
...
@@ -40,4 +40,26 @@ void main() {
...
@@ -40,4 +40,26 @@ void main() {
expect
(
find
.
widgetWithText
(
CupertinoPageRoute
,
'foo'
),
findsNothing
);
expect
(
find
.
widgetWithText
(
CupertinoPageRoute
,
'foo'
),
findsNothing
);
expect
(
find
.
widgetWithText
(
Navigator
,
'foo'
),
findsOneWidget
);
expect
(
find
.
widgetWithText
(
Navigator
,
'foo'
),
findsOneWidget
);
});
});
testWidgets
(
'Has default cupertino localizations'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
CupertinoApp
(
home:
Builder
(
builder:
(
BuildContext
context
)
{
return
Column
(
children:
<
Widget
>[
Text
(
CupertinoLocalizations
.
of
(
context
).
selectAllButtonLabel
),
Text
(
CupertinoLocalizations
.
of
(
context
).
datePickerMediumDate
(
DateTime
(
2018
,
10
,
4
),
)),
],
);
},
),
),
);
expect
(
find
.
text
(
'Select All'
),
findsOneWidget
);
expect
(
find
.
text
(
'Thu Oct 4 '
),
findsOneWidget
);
});
}
}
packages/flutter/test/cupertino/date_picker_test.dart
View file @
f7e0f836
...
@@ -99,9 +99,8 @@ void main() {
...
@@ -99,9 +99,8 @@ void main() {
testWidgets
(
'columns are ordered correctly when text direction is ltr'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'columns are ordered correctly when text direction is ltr'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
Directionality
(
CupertinoApp
(
textDirection:
TextDirection
.
ltr
,
home:
CupertinoTimerPicker
(
child:
CupertinoTimerPicker
(
onTimerDurationChanged:
(
_
)
{},
onTimerDurationChanged:
(
_
)
{},
initialTimerDuration:
const
Duration
(
hours:
12
,
minutes:
30
,
seconds:
59
),
initialTimerDuration:
const
Duration
(
hours:
12
,
minutes:
30
,
seconds:
59
),
),
),
...
@@ -127,13 +126,15 @@ void main() {
...
@@ -127,13 +126,15 @@ void main() {
testWidgets
(
'columns are ordered correctly when text direction is rtl'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'columns are ordered correctly when text direction is rtl'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
Directionality
(
CupertinoApp
(
home:
Directionality
(
textDirection:
TextDirection
.
rtl
,
textDirection:
TextDirection
.
rtl
,
child:
CupertinoTimerPicker
(
child:
CupertinoTimerPicker
(
onTimerDurationChanged:
(
_
)
{},
onTimerDurationChanged:
(
_
)
{},
initialTimerDuration:
const
Duration
(
hours:
12
,
minutes:
30
,
seconds:
59
),
initialTimerDuration:
const
Duration
(
hours:
12
,
minutes:
30
,
seconds:
59
),
),
),
),
),
),
);
);
Offset
lastOffset
=
tester
.
getTopLeft
(
find
.
text
(
'12'
));
Offset
lastOffset
=
tester
.
getTopLeft
(
find
.
text
(
'12'
));
...
@@ -155,11 +156,10 @@ void main() {
...
@@ -155,11 +156,10 @@ void main() {
testWidgets
(
'width of picker is consistent'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'width of picker is consistent'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
SizedBox
(
CupertinoApp
(
home:
SizedBox
(
height:
400.0
,
height:
400.0
,
width:
400.0
,
width:
400.0
,
child:
Directionality
(
textDirection:
TextDirection
.
ltr
,
child:
CupertinoTimerPicker
(
child:
CupertinoTimerPicker
(
onTimerDurationChanged:
(
_
)
{},
onTimerDurationChanged:
(
_
)
{},
initialTimerDuration:
const
Duration
(
hours:
12
,
minutes:
30
,
seconds:
59
),
initialTimerDuration:
const
Duration
(
hours:
12
,
minutes:
30
,
seconds:
59
),
...
@@ -173,11 +173,10 @@ void main() {
...
@@ -173,11 +173,10 @@ void main() {
tester
.
getCenter
(
find
.
text
(
'sec'
)).
dx
-
tester
.
getCenter
(
find
.
text
(
'12'
)).
dx
;
tester
.
getCenter
(
find
.
text
(
'sec'
)).
dx
-
tester
.
getCenter
(
find
.
text
(
'12'
)).
dx
;
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
SizedBox
(
CupertinoApp
(
home:
SizedBox
(
height:
400.0
,
height:
400.0
,
width:
800.0
,
width:
800.0
,
child:
Directionality
(
textDirection:
TextDirection
.
ltr
,
child:
CupertinoTimerPicker
(
child:
CupertinoTimerPicker
(
onTimerDurationChanged:
(
_
)
{},
onTimerDurationChanged:
(
_
)
{},
initialTimerDuration:
const
Duration
(
hours:
12
,
minutes:
30
,
seconds:
59
),
initialTimerDuration:
const
Duration
(
hours:
12
,
minutes:
30
,
seconds:
59
),
...
@@ -246,11 +245,10 @@ void main() {
...
@@ -246,11 +245,10 @@ void main() {
testWidgets
(
'changing initialDateTime after first build does not do anything'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'changing initialDateTime after first build does not do anything'
,
(
WidgetTester
tester
)
async
{
DateTime
selectedDateTime
;
DateTime
selectedDateTime
;
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
SizedBox
(
CupertinoApp
(
home:
SizedBox
(
height:
400.0
,
height:
400.0
,
width:
400.0
,
width:
400.0
,
child:
Directionality
(
textDirection:
TextDirection
.
ltr
,
child:
CupertinoDatePicker
(
child:
CupertinoDatePicker
(
mode:
CupertinoDatePickerMode
.
dateAndTime
,
mode:
CupertinoDatePickerMode
.
dateAndTime
,
onDateTimeChanged:
(
DateTime
dateTime
)
=>
selectedDateTime
=
dateTime
,
onDateTimeChanged:
(
DateTime
dateTime
)
=>
selectedDateTime
=
dateTime
,
...
@@ -267,11 +265,10 @@ void main() {
...
@@ -267,11 +265,10 @@ void main() {
expect
(
selectedDateTime
,
DateTime
(
2018
,
1
,
1
,
9
,
30
));
expect
(
selectedDateTime
,
DateTime
(
2018
,
1
,
1
,
9
,
30
));
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
SizedBox
(
CupertinoApp
(
home:
SizedBox
(
height:
400.0
,
height:
400.0
,
width:
400.0
,
width:
400.0
,
child:
Directionality
(
textDirection:
TextDirection
.
ltr
,
child:
CupertinoDatePicker
(
child:
CupertinoDatePicker
(
mode:
CupertinoDatePickerMode
.
dateAndTime
,
mode:
CupertinoDatePickerMode
.
dateAndTime
,
onDateTimeChanged:
(
DateTime
dateTime
)
=>
selectedDateTime
=
dateTime
,
onDateTimeChanged:
(
DateTime
dateTime
)
=>
selectedDateTime
=
dateTime
,
...
@@ -292,11 +289,10 @@ void main() {
...
@@ -292,11 +289,10 @@ void main() {
testWidgets
(
'date picker has expected string'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'date picker has expected string'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
SizedBox
(
CupertinoApp
(
home:
SizedBox
(
height:
400.0
,
height:
400.0
,
width:
400.0
,
width:
400.0
,
child:
Directionality
(
textDirection:
TextDirection
.
ltr
,
child:
CupertinoDatePicker
(
child:
CupertinoDatePicker
(
mode:
CupertinoDatePickerMode
.
date
,
mode:
CupertinoDatePickerMode
.
date
,
onDateTimeChanged:
(
_
)
{},
onDateTimeChanged:
(
_
)
{},
...
@@ -313,11 +309,10 @@ void main() {
...
@@ -313,11 +309,10 @@ void main() {
testWidgets
(
'datetime picker has expected string'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'datetime picker has expected string'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
SizedBox
(
CupertinoApp
(
home:
SizedBox
(
height:
400.0
,
height:
400.0
,
width:
400.0
,
width:
400.0
,
child:
Directionality
(
textDirection:
TextDirection
.
ltr
,
child:
CupertinoDatePicker
(
child:
CupertinoDatePicker
(
mode:
CupertinoDatePickerMode
.
dateAndTime
,
mode:
CupertinoDatePickerMode
.
dateAndTime
,
onDateTimeChanged:
(
_
)
{},
onDateTimeChanged:
(
_
)
{},
...
@@ -335,10 +330,8 @@ void main() {
...
@@ -335,10 +330,8 @@ void main() {
testWidgets
(
'width of picker in date and time mode is consistent'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'width of picker in date and time mode is consistent'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
SizedBox
(
CupertinoApp
(
height:
400.0
,
home:
Directionality
(
width:
400.0
,
child:
Directionality
(
textDirection:
TextDirection
.
ltr
,
textDirection:
TextDirection
.
ltr
,
child:
CupertinoDatePicker
(
child:
CupertinoDatePicker
(
mode:
CupertinoDatePickerMode
.
dateAndTime
,
mode:
CupertinoDatePickerMode
.
dateAndTime
,
...
@@ -354,11 +347,10 @@ void main() {
...
@@ -354,11 +347,10 @@ void main() {
tester
.
getCenter
(
find
.
text
(
'Mon Jan 1 '
)).
dx
-
tester
.
getCenter
(
find
.
text
(
'AM'
)).
dx
;
tester
.
getCenter
(
find
.
text
(
'Mon Jan 1 '
)).
dx
-
tester
.
getCenter
(
find
.
text
(
'AM'
)).
dx
;
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
SizedBox
(
CupertinoApp
(
home:
SizedBox
(
height:
400.0
,
height:
400.0
,
width:
800.0
,
width:
800.0
,
child:
Directionality
(
textDirection:
TextDirection
.
ltr
,
child:
CupertinoDatePicker
(
child:
CupertinoDatePicker
(
mode:
CupertinoDatePickerMode
.
dateAndTime
,
mode:
CupertinoDatePickerMode
.
dateAndTime
,
onDateTimeChanged:
(
_
)
{},
onDateTimeChanged:
(
_
)
{},
...
@@ -377,11 +369,10 @@ void main() {
...
@@ -377,11 +369,10 @@ void main() {
testWidgets
(
'width of picker in date mode is consistent'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'width of picker in date mode is consistent'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
SizedBox
(
CupertinoApp
(
home:
SizedBox
(
height:
400.0
,
height:
400.0
,
width:
400.0
,
width:
400.0
,
child:
Directionality
(
textDirection:
TextDirection
.
ltr
,
child:
CupertinoDatePicker
(
child:
CupertinoDatePicker
(
mode:
CupertinoDatePickerMode
.
date
,
mode:
CupertinoDatePickerMode
.
date
,
onDateTimeChanged:
(
_
)
{},
onDateTimeChanged:
(
_
)
{},
...
@@ -396,11 +387,10 @@ void main() {
...
@@ -396,11 +387,10 @@ void main() {
tester
.
getCenter
(
find
.
text
(
'January'
)).
dx
-
tester
.
getCenter
(
find
.
text
(
'2018'
)).
dx
;
tester
.
getCenter
(
find
.
text
(
'January'
)).
dx
-
tester
.
getCenter
(
find
.
text
(
'2018'
)).
dx
;
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
SizedBox
(
CupertinoApp
(
home:
SizedBox
(
height:
400.0
,
height:
400.0
,
width:
800.0
,
width:
800.0
,
child:
Directionality
(
textDirection:
TextDirection
.
ltr
,
child:
CupertinoDatePicker
(
child:
CupertinoDatePicker
(
mode:
CupertinoDatePickerMode
.
date
,
mode:
CupertinoDatePickerMode
.
date
,
onDateTimeChanged:
(
_
)
{},
onDateTimeChanged:
(
_
)
{},
...
@@ -419,11 +409,10 @@ void main() {
...
@@ -419,11 +409,10 @@ void main() {
testWidgets
(
'width of picker in time mode is consistent'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'width of picker in time mode is consistent'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
SizedBox
(
CupertinoApp
(
home:
SizedBox
(
height:
400.0
,
height:
400.0
,
width:
400.0
,
width:
400.0
,
child:
Directionality
(
textDirection:
TextDirection
.
ltr
,
child:
CupertinoDatePicker
(
child:
CupertinoDatePicker
(
mode:
CupertinoDatePickerMode
.
time
,
mode:
CupertinoDatePickerMode
.
time
,
onDateTimeChanged:
(
_
)
{},
onDateTimeChanged:
(
_
)
{},
...
@@ -438,11 +427,10 @@ void main() {
...
@@ -438,11 +427,10 @@ void main() {
tester
.
getCenter
(
find
.
text
(
'10'
)).
dx
-
tester
.
getCenter
(
find
.
text
(
'AM'
)).
dx
;
tester
.
getCenter
(
find
.
text
(
'10'
)).
dx
-
tester
.
getCenter
(
find
.
text
(
'AM'
)).
dx
;
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
SizedBox
(
CupertinoApp
(
home:
SizedBox
(
height:
400.0
,
height:
400.0
,
width:
800.0
,
width:
800.0
,
child:
Directionality
(
textDirection:
TextDirection
.
ltr
,
child:
CupertinoDatePicker
(
child:
CupertinoDatePicker
(
mode:
CupertinoDatePickerMode
.
time
,
mode:
CupertinoDatePickerMode
.
time
,
onDateTimeChanged:
(
_
)
{},
onDateTimeChanged:
(
_
)
{},
...
@@ -462,11 +450,10 @@ void main() {
...
@@ -462,11 +450,10 @@ void main() {
testWidgets
(
'picker automatically scrolls away from invalid date on month change'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'picker automatically scrolls away from invalid date on month change'
,
(
WidgetTester
tester
)
async
{
DateTime
date
;
DateTime
date
;
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
SizedBox
(
CupertinoApp
(
home:
SizedBox
(
height:
400.0
,
height:
400.0
,
width:
400.0
,
width:
400.0
,
child:
Directionality
(
textDirection:
TextDirection
.
ltr
,
child:
CupertinoDatePicker
(
child:
CupertinoDatePicker
(
mode:
CupertinoDatePickerMode
.
date
,
mode:
CupertinoDatePickerMode
.
date
,
onDateTimeChanged:
(
DateTime
newDate
)
{
onDateTimeChanged:
(
DateTime
newDate
)
{
...
@@ -501,11 +488,10 @@ void main() {
...
@@ -501,11 +488,10 @@ void main() {
testWidgets
(
'picker automatically scrolls away from invalid date on day change'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'picker automatically scrolls away from invalid date on day change'
,
(
WidgetTester
tester
)
async
{
DateTime
date
;
DateTime
date
;
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
SizedBox
(
CupertinoApp
(
home:
SizedBox
(
height:
400.0
,
height:
400.0
,
width:
400.0
,
width:
400.0
,
child:
Directionality
(
textDirection:
TextDirection
.
ltr
,
child:
CupertinoDatePicker
(
child:
CupertinoDatePicker
(
mode:
CupertinoDatePickerMode
.
date
,
mode:
CupertinoDatePickerMode
.
date
,
onDateTimeChanged:
(
DateTime
newDate
)
{
onDateTimeChanged:
(
DateTime
newDate
)
{
...
@@ -555,11 +541,10 @@ void main() {
...
@@ -555,11 +541,10 @@ void main() {
testWidgets
(
'picker automatically scrolls the am/pm column when the hour column changes enough'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'picker automatically scrolls the am/pm column when the hour column changes enough'
,
(
WidgetTester
tester
)
async
{
DateTime
date
;
DateTime
date
;
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
SizedBox
(
CupertinoApp
(
home:
SizedBox
(
height:
400.0
,
height:
400.0
,
width:
400.0
,
width:
400.0
,
child:
Directionality
(
textDirection:
TextDirection
.
ltr
,
child:
CupertinoDatePicker
(
child:
CupertinoDatePicker
(
mode:
CupertinoDatePickerMode
.
time
,
mode:
CupertinoDatePickerMode
.
time
,
onDateTimeChanged:
(
DateTime
newDate
)
{
onDateTimeChanged:
(
DateTime
newDate
)
{
...
...
packages/flutter/test/material/app_test.dart
View file @
f7e0f836
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
// found in the LICENSE file.
// found in the LICENSE file.
import
'package:flutter_test/flutter_test.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
import
'package:flutter/cupertino.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter/material.dart'
;
class
StateMarker
extends
StatefulWidget
{
class
StateMarker
extends
StatefulWidget
{
...
@@ -412,4 +413,26 @@ void main() {
...
@@ -412,4 +413,26 @@ void main() {
));
));
expect
(
key
.
currentState
,
isInstanceOf
<
NavigatorState
>());
expect
(
key
.
currentState
,
isInstanceOf
<
NavigatorState
>());
});
});
testWidgets
(
'Has default material and cupertino localizations'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
MaterialApp
(
home:
Builder
(
builder:
(
BuildContext
context
)
{
return
Column
(
children:
<
Widget
>[
Text
(
MaterialLocalizations
.
of
(
context
).
selectAllButtonLabel
),
Text
(
CupertinoLocalizations
.
of
(
context
).
selectAllButtonLabel
),
],
);
},
),
),
);
// Default US "select all" text.
expect
(
find
.
text
(
'SELECT ALL'
),
findsOneWidget
);
// Default Cupertino US "select all" text.
expect
(
find
.
text
(
'Select All'
),
findsOneWidget
);
});
}
}
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