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
a7af0b31
Unverified
Commit
a7af0b31
authored
May 11, 2021
by
Shi-Hao Hong
Committed by
GitHub
May 11, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Expose basicLocaleListResolution in widget library (#81898)
parent
df158290
Changes
2
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
258 additions
and
128 deletions
+258
-128
app.dart
packages/flutter/lib/src/widgets/app.dart
+131
-128
app_test.dart
packages/flutter/test/widgets/app_test.dart
+127
-0
No files found.
packages/flutter/lib/src/widgets/app.dart
View file @
a7af0b31
This diff is collapsed.
Click to expand it.
packages/flutter/test/widgets/app_test.dart
View file @
a7af0b31
...
...
@@ -328,6 +328,133 @@ void main() {
);
expect
(
ScrollConfiguration
.
of
(
capturedContext
).
runtimeType
,
ScrollBehavior
);
});
test
(
'basicLocaleListResolution'
,
()
{
// Matches exactly for language code.
expect
(
basicLocaleListResolution
(
<
Locale
>[
const
Locale
(
'zh'
),
const
Locale
(
'un'
),
const
Locale
(
'en'
),
],
<
Locale
>[
const
Locale
(
'en'
),
],
),
const
Locale
(
'en'
),
);
// Matches exactly for language code and country code.
expect
(
basicLocaleListResolution
(
<
Locale
>[
const
Locale
(
'en'
),
const
Locale
(
'en'
,
'US'
),
],
<
Locale
>[
const
Locale
(
'en'
,
'US'
),
],
),
const
Locale
(
'en'
,
'US'
),
);
// Matches language+script over language+country
expect
(
basicLocaleListResolution
(
<
Locale
>[
const
Locale
.
fromSubtags
(
languageCode:
'zh'
,
scriptCode:
'Hant'
,
countryCode:
'HK'
,
),
],
<
Locale
>[
const
Locale
.
fromSubtags
(
languageCode:
'zh'
,
countryCode:
'HK'
,
),
const
Locale
.
fromSubtags
(
languageCode:
'zh'
,
scriptCode:
'Hant'
,
),
],
),
const
Locale
.
fromSubtags
(
languageCode:
'zh'
,
scriptCode:
'Hant'
,
),
);
// Matches exactly for language code, script code and country code.
expect
(
basicLocaleListResolution
(
<
Locale
>[
const
Locale
.
fromSubtags
(
languageCode:
'zh'
,
),
const
Locale
.
fromSubtags
(
languageCode:
'zh'
,
scriptCode:
'Hant'
,
countryCode:
'TW'
,
),
],
<
Locale
>[
const
Locale
.
fromSubtags
(
languageCode:
'zh'
,
scriptCode:
'Hant'
,
countryCode:
'TW'
,
),
],
),
const
Locale
.
fromSubtags
(
languageCode:
'zh'
,
scriptCode:
'Hant'
,
countryCode:
'TW'
,
),
);
// Selects for country code if the language code is not found in the
// preferred locales list.
expect
(
basicLocaleListResolution
(
<
Locale
>[
const
Locale
.
fromSubtags
(
languageCode:
'en'
,
),
const
Locale
.
fromSubtags
(
languageCode:
'ar'
,
countryCode:
'tn'
,
),
],
<
Locale
>[
const
Locale
.
fromSubtags
(
languageCode:
'fr'
,
countryCode:
'tn'
,
),
],
),
const
Locale
.
fromSubtags
(
languageCode:
'fr'
,
countryCode:
'tn'
,
),
);
// Selects first (default) locale when no match at all is found.
expect
(
basicLocaleListResolution
(
<
Locale
>[
const
Locale
(
'tn'
),
],
<
Locale
>[
const
Locale
(
'zh'
),
const
Locale
(
'un'
),
const
Locale
(
'en'
),
],
),
const
Locale
(
'zh'
),
);
});
}
typedef
SimpleRouterDelegateBuilder
=
Widget
Function
(
BuildContext
,
RouteInformation
);
...
...
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