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
36e599eb
Unverified
Commit
36e599eb
authored
Dec 11, 2019
by
Alexandre Ardhuin
Committed by
GitHub
Dec 11, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
implicit-casts:false in flutter_localizations (#45241)
parent
01953a10
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
79 additions
and
44 deletions
+79
-44
analysis_options.yaml
packages/flutter_localizations/analysis_options.yaml
+12
-0
date_localizations.dart
...utter_localizations/lib/src/utils/date_localizations.dart
+25
-23
date_picker_test.dart
...flutter_localizations/test/material/date_picker_test.dart
+4
-4
date_time_test.dart
...s/flutter_localizations/test/material/date_time_test.dart
+6
-3
time_picker_test.dart
...flutter_localizations/test/material/time_picker_test.dart
+32
-14
No files found.
packages/flutter_localizations/analysis_options.yaml
0 → 100644
View file @
36e599eb
# Override the parent analysis_options until all the repo has implicit-casts: false
include
:
../analysis_options.yaml
analyzer
:
strong-mode
:
implicit-casts
:
false
implicit-dynamic
:
false
linter
:
rules
:
avoid_as
:
false
packages/flutter_localizations/lib/src/utils/date_localizations.dart
View file @
36e599eb
...
...
@@ -21,7 +21,9 @@ void loadDateIntlDataIfNotLoaded() {
// This can only happen if a locale with a stripped scriptCode has already
// been initialzed. This should be removed when scriptCode stripping is removed.
final
Set
<
String
>
initializedLocales
=
<
String
>{};
date_localizations
.
dateSymbols
.
forEach
((
String
locale
,
dynamic
data
)
{
date_localizations
.
dateSymbols
.
cast
<
String
,
Map
<
String
,
dynamic
>>()
.
forEach
((
String
locale
,
Map
<
String
,
dynamic
>
data
)
{
// Strip scriptCode from the locale, as we do not distinguish between scripts
// for dates.
final
List
<
String
>
codes
=
locale
.
split
(
'_'
);
...
...
packages/flutter_localizations/test/material/date_picker_test.dart
View file @
36e599eb
...
...
@@ -53,10 +53,10 @@ void main() {
for
(
Locale
locale
in
testLocales
.
keys
)
{
testWidgets
(
'shows dates for
$locale
'
,
(
WidgetTester
tester
)
async
{
final
List
<
String
>
expectedDaysOfWeek
=
testLocales
[
locale
][
'expectedDaysOfWeek'
];
final
List
<
String
>
expectedDaysOfMonth
=
testLocales
[
locale
][
'expectedDaysOfMonth'
];
final
String
expectedMonthYearHeader
=
testLocales
[
locale
][
'expectedMonthYearHeader'
];
final
TextDirection
textDirection
=
testLocales
[
locale
][
'textDirection'
];
final
List
<
String
>
expectedDaysOfWeek
=
testLocales
[
locale
][
'expectedDaysOfWeek'
]
as
List
<
String
>
;
final
List
<
String
>
expectedDaysOfMonth
=
testLocales
[
locale
][
'expectedDaysOfMonth'
]
as
List
<
String
>
;
final
String
expectedMonthYearHeader
=
testLocales
[
locale
][
'expectedMonthYearHeader'
]
as
String
;
final
TextDirection
textDirection
=
testLocales
[
locale
][
'textDirection'
]
as
TextDirection
;
final
DateTime
baseDate
=
DateTime
(
2017
,
9
,
27
);
await
_pumpBoilerplate
(
tester
,
DayPicker
(
...
...
packages/flutter_localizations/test/material/date_time_test.dart
View file @
36e599eb
...
...
@@ -11,12 +11,14 @@ import 'package:flutter_test/flutter_test.dart';
void
main
(
)
{
group
(
GlobalMaterialLocalizations
,
()
{
test
(
'uses exact locale when exists'
,
()
async
{
final
GlobalMaterialLocalizations
localizations
=
await
GlobalMaterialLocalizations
.
delegate
.
load
(
const
Locale
(
'pt'
,
'PT'
));
final
GlobalMaterialLocalizations
localizations
=
await
GlobalMaterialLocalizations
.
delegate
.
load
(
const
Locale
(
'pt'
,
'PT'
))
as
GlobalMaterialLocalizations
;
expect
(
localizations
.
formatDecimal
(
10000
),
'10
\
u00A0000'
);
});
test
(
'falls back to language code when exact locale is missing'
,
()
async
{
final
GlobalMaterialLocalizations
localizations
=
await
GlobalMaterialLocalizations
.
delegate
.
load
(
const
Locale
(
'pt'
,
'XX'
));
final
GlobalMaterialLocalizations
localizations
=
await
GlobalMaterialLocalizations
.
delegate
.
load
(
const
Locale
(
'pt'
,
'XX'
))
as
GlobalMaterialLocalizations
;
expect
(
localizations
.
formatDecimal
(
10000
),
'10.000'
);
});
...
...
@@ -67,7 +69,8 @@ void main() {
group
(
'formatMinute'
,
()
{
test
(
'formats English'
,
()
async
{
final
GlobalMaterialLocalizations
localizations
=
await
GlobalMaterialLocalizations
.
delegate
.
load
(
const
Locale
(
'en'
,
'US'
));
final
GlobalMaterialLocalizations
localizations
=
await
GlobalMaterialLocalizations
.
delegate
.
load
(
const
Locale
(
'en'
,
'US'
))
as
GlobalMaterialLocalizations
;
expect
(
localizations
.
formatMinute
(
const
TimeOfDay
(
hour:
1
,
minute:
32
)),
'32'
);
});
});
...
...
packages/flutter_localizations/test/material/time_picker_test.dart
View file @
36e599eb
...
...
@@ -72,7 +72,7 @@ void main() {
final
Offset
center
=
await
startPicker
(
tester
,
(
TimeOfDay
time
)
{
},
locale:
locale
);
final
List
<
String
>
actual
=
<
String
>[];
tester
.
element
(
find
.
byType
(
CustomMultiChildLayout
)).
visitChildren
((
Element
child
)
{
final
LayoutId
layout
=
child
.
widget
;
final
LayoutId
layout
=
child
.
widget
as
LayoutId
;
final
String
fragmentType
=
'
${layout.child.runtimeType}
'
;
final
dynamic
widget
=
layout
.
child
;
if
(
fragmentType
==
'_MinuteControl'
)
{
...
...
@@ -174,12 +174,18 @@ void main() {
final
CustomPaint
dialPaint
=
tester
.
widget
(
find
.
byKey
(
const
ValueKey
<
String
>(
'time-picker-dial'
)));
final
dynamic
dialPainter
=
dialPaint
.
painter
;
final
List
<
dynamic
>
primaryOuterLabels
=
dialPainter
.
primaryOuterLabels
;
expect
(
primaryOuterLabels
.
map
<
String
>((
dynamic
tp
)
=>
tp
.
painter
.
text
.
text
),
labels12To11
);
final
List
<
dynamic
>
primaryOuterLabels
=
dialPainter
.
primaryOuterLabels
as
List
<
dynamic
>;
expect
(
primaryOuterLabels
.
map
<
String
>((
dynamic
tp
)
=>
((
tp
.
painter
as
TextPainter
).
text
as
TextSpan
).
text
),
labels12To11
,
);
expect
(
dialPainter
.
primaryInnerLabels
,
null
);
final
List
<
dynamic
>
secondaryOuterLabels
=
dialPainter
.
secondaryOuterLabels
;
expect
(
secondaryOuterLabels
.
map
<
String
>((
dynamic
tp
)
=>
tp
.
painter
.
text
.
text
),
labels12To11
);
final
List
<
dynamic
>
secondaryOuterLabels
=
dialPainter
.
secondaryOuterLabels
as
List
<
dynamic
>;
expect
(
secondaryOuterLabels
.
map
<
String
>((
dynamic
tp
)
=>
((
tp
.
painter
as
TextPainter
).
text
as
TextSpan
).
text
),
labels12To11
,
);
expect
(
dialPainter
.
secondaryInnerLabels
,
null
);
});
...
...
@@ -188,14 +194,26 @@ void main() {
final
CustomPaint
dialPaint
=
tester
.
widget
(
find
.
byKey
(
const
ValueKey
<
String
>(
'time-picker-dial'
)));
final
dynamic
dialPainter
=
dialPaint
.
painter
;
final
List
<
dynamic
>
primaryOuterLabels
=
dialPainter
.
primaryOuterLabels
;
expect
(
primaryOuterLabels
.
map
<
String
>((
dynamic
tp
)
=>
tp
.
painter
.
text
.
text
),
labels00To23
);
final
List
<
dynamic
>
primaryInnerLabels
=
dialPainter
.
primaryInnerLabels
;
expect
(
primaryInnerLabels
.
map
<
String
>((
dynamic
tp
)
=>
tp
.
painter
.
text
.
text
),
labels12To11TwoDigit
);
final
List
<
dynamic
>
secondaryOuterLabels
=
dialPainter
.
secondaryOuterLabels
;
expect
(
secondaryOuterLabels
.
map
<
String
>((
dynamic
tp
)
=>
tp
.
painter
.
text
.
text
),
labels00To23
);
final
List
<
dynamic
>
secondaryInnerLabels
=
dialPainter
.
secondaryInnerLabels
;
expect
(
secondaryInnerLabels
.
map
<
String
>((
dynamic
tp
)
=>
tp
.
painter
.
text
.
text
),
labels12To11TwoDigit
);
final
List
<
dynamic
>
primaryOuterLabels
=
dialPainter
.
primaryOuterLabels
as
List
<
dynamic
>;
expect
(
primaryOuterLabels
.
map
<
String
>((
dynamic
tp
)
=>
((
tp
.
painter
as
TextPainter
).
text
as
TextSpan
).
text
),
labels00To23
,
);
final
List
<
dynamic
>
primaryInnerLabels
=
dialPainter
.
primaryInnerLabels
as
List
<
dynamic
>;
expect
(
primaryInnerLabels
.
map
<
String
>((
dynamic
tp
)
=>
((
tp
.
painter
as
TextPainter
).
text
as
TextSpan
).
text
),
labels12To11TwoDigit
,
);
final
List
<
dynamic
>
secondaryOuterLabels
=
dialPainter
.
secondaryOuterLabels
as
List
<
dynamic
>;
expect
(
secondaryOuterLabels
.
map
<
String
>((
dynamic
tp
)
=>
((
tp
.
painter
as
TextPainter
).
text
as
TextSpan
).
text
),
labels00To23
,
);
final
List
<
dynamic
>
secondaryInnerLabels
=
dialPainter
.
secondaryInnerLabels
as
List
<
dynamic
>;
expect
(
secondaryInnerLabels
.
map
<
String
>((
dynamic
tp
)
=>
((
tp
.
painter
as
TextPainter
).
text
as
TextSpan
).
text
),
labels12To11TwoDigit
,
);
});
}
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