Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
flutter
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
ExcellentOSS
flutter
Commits
286cd359
Commit
286cd359
authored
7 years ago
by
血心
Committed by
Hans Muller
7 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Fix bug for calling isEmpty on null object. (#16782)
parent
ff58db4a
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
packages/flutter_localizations/lib/src/material_localizations.dart
+1
-2
1 addition, 2 deletions
...flutter_localizations/lib/src/material_localizations.dart
packages/flutter_localizations/test/basics_test.dart
+22
-0
22 additions, 0 deletions
packages/flutter_localizations/test/basics_test.dart
with
23 additions
and
2 deletions
packages/flutter_localizations/lib/src/material_localizations.dart
+
1
−
2
View file @
286cd359
...
...
@@ -133,8 +133,7 @@ class GlobalMaterialLocalizations implements MaterialLocalizations {
intl
.
DateFormat
_yearMonthFormat
;
static
String
_computeLocaleName
(
Locale
locale
)
{
final
String
localeName
=
locale
.
countryCode
.
isEmpty
?
locale
.
languageCode
:
locale
.
toString
();
return
intl
.
Intl
.
canonicalizedLocale
(
localeName
);
return
intl
.
Intl
.
canonicalizedLocale
(
locale
.
toString
());
}
@override
...
...
This diff is collapsed.
Click to expand it.
packages/flutter_localizations/test/basics_test.dart
+
22
−
0
View file @
286cd359
...
...
@@ -47,6 +47,28 @@ void main() {
await
tester
.
pump
();
await
tester
.
pumpWidget
(
new
Container
());
});
testWidgets
(
'Locale without coutryCode'
,
(
WidgetTester
tester
)
async
{
// Regression test for https://github.com/flutter/flutter/pull/16782
await
tester
.
pumpWidget
(
new
MaterialApp
(
localizationsDelegates:
const
<
LocalizationsDelegate
<
dynamic
>>[
GlobalMaterialLocalizations
.
delegate
,
],
supportedLocales:
const
<
Locale
>[
const
Locale
(
'es'
,
'ES'
),
const
Locale
(
'zh'
),
],
home:
new
Container
(),
)
);
await
tester
.
binding
.
setLocale
(
'zh'
,
null
);
await
tester
.
pump
();
await
tester
.
binding
.
setLocale
(
'es'
,
'US'
);
await
tester
.
pump
();
});
}
/// A localizations delegate that does not contain any useful data, and is only
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment