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
bd3e91ed
Commit
bd3e91ed
authored
Oct 17, 2017
by
Hans Muller
Committed by
GitHub
Oct 17, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
AssetImage.obtainKey handles devicePixelRatio == null (#12564)
parent
9ce3ba31
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
1 deletion
+13
-1
image_resolution.dart
packages/flutter/lib/src/services/image_resolution.dart
+1
-1
asset_bundle_test.dart
packages/flutter/test/services/asset_bundle_test.dart
+12
-0
No files found.
packages/flutter/lib/src/services/image_resolution.dart
View file @
bd3e91ed
...
...
@@ -218,7 +218,7 @@ class AssetImage extends AssetBundleImageProvider {
}
String
_chooseVariant
(
String
main
,
ImageConfiguration
config
,
List
<
String
>
candidates
)
{
if
(
candidates
==
null
||
candidates
.
isEmpty
)
if
(
c
onfig
.
devicePixelRatio
==
null
||
c
andidates
==
null
||
candidates
.
isEmpty
)
return
main
;
// TODO(ianh): Consider moving this parsing logic into _manifestParser.
final
SplayTreeMap
<
double
,
String
>
mapping
=
new
SplayTreeMap
<
double
,
String
>();
...
...
packages/flutter/test/services/asset_bundle_test.dart
View file @
bd3e91ed
...
...
@@ -3,6 +3,7 @@
// found in the LICENSE file.
import
'dart:async'
;
import
'dart:convert'
;
import
'dart:typed_data'
;
import
'package:flutter/foundation.dart'
;
...
...
@@ -14,6 +15,9 @@ class TestAssetBundle extends CachingAssetBundle {
@override
Future
<
ByteData
>
load
(
String
key
)
async
{
if
(
key
==
'AssetManifest.json'
)
return
new
ByteData
.
view
(
new
Uint8List
.
fromList
(
const
Utf8Encoder
().
convert
(
'{"one": ["one"]}'
)).
buffer
);
loadCallCount
[
key
]
=
loadCallCount
[
key
]
??
0
+
1
;
if
(
key
==
'one'
)
return
new
ByteData
(
1
)..
setInt8
(
0
,
49
);
...
...
@@ -43,4 +47,12 @@ void main() {
}
expect
(
loadException
,
isFlutterError
);
});
test
(
'AssetImage.obtainKey succeeds with ImageConfiguration.empty'
,
()
async
{
// This is a regression test for https://github.com/flutter/flutter/issues/12392
final
AssetImage
assetImage
=
new
AssetImage
(
'one'
,
bundle:
new
TestAssetBundle
());
final
AssetBundleImageKey
key
=
await
assetImage
.
obtainKey
(
ImageConfiguration
.
empty
);
expect
(
key
.
name
,
'one'
);
expect
(
key
.
scale
,
1.0
);
});
}
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