提交 3555761d authored 作者: JarvanMo's avatar JarvanMo

rename constructor of WeChatImage

上级 64126edd
...@@ -54,7 +54,7 @@ class _ShareImagePageState extends State<ShareImagePage> { ...@@ -54,7 +54,7 @@ class _ShareImagePageState extends State<ShareImagePage> {
text: text:
"https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1534614311230&di=b17a892b366b5d002f52abcce7c4eea0&imgtype=0&src=http%3A%2F%2Fimg.mp.sohu.com%2Fupload%2F20170516%2F51296b2673704ae2992d0a28c244274c_th.png"), "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1534614311230&di=b17a892b366b5d002f52abcce7c4eea0&imgtype=0&src=http%3A%2F%2Fimg.mp.sohu.com%2Fupload%2F20170516%2F51296b2673704ae2992d0a28c244274c_th.png"),
onChanged: (value) { onChanged: (value) {
source = WeChatImage.fromNetwork(value); source = WeChatImage.network(value);
}, },
keyboardType: TextInputType.multiline, keyboardType: TextInputType.multiline,
), ),
...@@ -62,7 +62,7 @@ class _ShareImagePageState extends State<ShareImagePage> { ...@@ -62,7 +62,7 @@ class _ShareImagePageState extends State<ShareImagePage> {
decoration: InputDecoration(labelText: "缩略地址"), decoration: InputDecoration(labelText: "缩略地址"),
controller: TextEditingController(text: "//images/logo.png"), controller: TextEditingController(text: "//images/logo.png"),
onChanged: (value) { onChanged: (value) {
thumbnail = WeChatImage.fromAsset(value); thumbnail = WeChatImage.asset(value);
}, },
), ),
new Row( new Row(
......
...@@ -95,7 +95,7 @@ class _ShareMiniProgramPageState extends State<ShareMiniProgramPage> { ...@@ -95,7 +95,7 @@ class _ShareMiniProgramPageState extends State<ShareMiniProgramPage> {
title: _title, title: _title,
path: _path, path: _path,
description: _description, description: _description,
thumbnail: WeChatImage.fromNetwork(_thumbnail) thumbnail: WeChatImage.network(_thumbnail)
); );
shareToWeChat(model); shareToWeChat(model);
} }
......
...@@ -122,7 +122,7 @@ class _ShareMusicPageState extends State<ShareMusicPage> { ...@@ -122,7 +122,7 @@ class _ShareMusicPageState extends State<ShareMusicPage> {
musicUrl: _musicUrl, musicUrl: _musicUrl,
scene: scene, scene: scene,
musicLowBandUrl: _musicLowBandUrl, musicLowBandUrl: _musicLowBandUrl,
thumbnail: WeChatImage.fromNetwork(_thumnail)); thumbnail: WeChatImage.network(_thumnail));
shareToWeChat(model); shareToWeChat(model);
} }
......
...@@ -118,7 +118,7 @@ class _ShareMusicPageState extends State<ShareVideoPage> { ...@@ -118,7 +118,7 @@ class _ShareMusicPageState extends State<ShareVideoPage> {
var model = new WeChatShareVideoModel( var model = new WeChatShareVideoModel(
videoUrl: _videoUrl, videoUrl: _videoUrl,
videoLowBandUrl: _videoLowBandUrl, videoLowBandUrl: _videoLowBandUrl,
thumbnail: WeChatImage.fromNetwork(_thumnail), thumbnail: WeChatImage.network(_thumnail),
description: _description, description: _description,
scene: this.scene, scene: this.scene,
title: _title); title: _title);
......
...@@ -102,7 +102,7 @@ class ShareWebPagePageState extends State<ShareWebPagePage> { ...@@ -102,7 +102,7 @@ class ShareWebPagePageState extends State<ShareWebPagePage> {
var model = WeChatShareWebPageModel( var model = WeChatShareWebPageModel(
_url, _url,
title: _title, title: _title,
thumbnail: WeChatImage.fromNetwork(_thumnail), thumbnail: WeChatImage.network(_thumnail),
scene: scene, scene: scene,
); );
shareToWeChat(model); shareToWeChat(model);
......
...@@ -25,25 +25,25 @@ class WeChatImage { ...@@ -25,25 +25,25 @@ class WeChatImage {
final ImageSchema schema; final ImageSchema schema;
final String suffix; final String suffix;
WeChatImage.fromNetwork(String source, {String suffix}) WeChatImage.network(String source, {String suffix})
: assert(source != null && source.startsWith("http")), : assert(source != null && source.startsWith("http")),
this.source = source, this.source = source,
this.schema = ImageSchema.NETWORK, this.schema = ImageSchema.NETWORK,
this.suffix = source.readSuffix(suffix); this.suffix = source.readSuffix(suffix);
WeChatImage.fromAsset(String source, {String suffix}) WeChatImage.asset(String source, {String suffix})
: assert(source != null && source.trim().isNotEmpty), : assert(source != null && source.trim().isNotEmpty),
this.source = source, this.source = source,
this.schema = ImageSchema.ASSET, this.schema = ImageSchema.ASSET,
this.suffix = source.readSuffix(suffix); this.suffix = source.readSuffix(suffix);
WeChatImage.fromFile(File source, {String suffix = ".jpeg"}) WeChatImage.file(File source, {String suffix = ".jpeg"})
: assert(source != null), : assert(source != null),
this.source = source.path, this.source = source.path,
this.schema = ImageSchema.FILE, this.schema = ImageSchema.FILE,
this.suffix = source.path.readSuffix(suffix); this.suffix = source.path.readSuffix(suffix);
WeChatImage.fromBinary(Uint8List source, {String suffix = ".jpeg"}) WeChatImage.binary(Uint8List source, {String suffix = ".jpeg"})
: assert(source != null), : assert(source != null),
assert(suffix != null && suffix.trim().isNotEmpty), assert(suffix != null && suffix.trim().isNotEmpty),
this.source = source, this.source = source,
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论