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

rename constructor of WeChatImage

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