Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
C
clx-fluwx
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
openSourceLibrary
clx-fluwx
Commits
a0ec7fc2
提交
a0ec7fc2
authored
8月 18, 2018
作者:
JarvanMo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix:can't find assets
上级
ad83a78f
显示空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
43 行增加
和
30 行删除
+43
-30
README.md
README.md
+3
-3
AssetManagerUtil.java
.../main/kotlin/com/jarvan/fluwx/utils/AssetManagerUtil.java
+7
-1
WeChatThumbnailUtil.java
...in/kotlin/com/jarvan/fluwx/utils/WeChatThumbnailUtil.java
+9
-2
logo.png
example/images/logo.png
+0
-0
main.dart
example/lib/main.dart
+22
-23
pubspec.yaml
example/pubspec.yaml
+2
-1
没有找到文件。
README.md
浏览文件 @
a0ec7fc2
...
@@ -4,9 +4,8 @@
...
@@ -4,9 +4,8 @@
## 写在前面
## 写在前面
使用Fluwx之前,强烈建议先阅读
[
微信SDK官方文档
](
https://open.weixin.qq.com/cgi-bin/showdocument?action=dir_list&t=resource/res_list&verify=1
)
,
使用Fluwx之前,强烈建议先阅读
[
微信SDK官方文档
](
https://open.weixin.qq.com/cgi-bin/showdocument?action=dir_list&t=resource/res_list&verify=1
)
,
这有助于你使用
Fluwx。Fluwx
的api字段名称基本和官方的字段名称是一致的。
这有助于你使用
```Fluwx```
。
```Fluwx```
的api字段名称基本和官方的字段名称是一致的。
## 引入
## 引入
## 初始化
## 初始化
```
dart
```
dart
...
@@ -41,7 +40,8 @@ Fluwx.unregisterApp(RegisterModel(doOnAndroid: true, doOnIOS: true));
...
@@ -41,7 +40,8 @@ Fluwx.unregisterApp(RegisterModel(doOnAndroid: true, doOnIOS: true));
title: "Fluwx",
title: "Fluwx",
thumbnail: 'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1534532387799&di=12701cc3f20c1a78a5c7524ec33b4c59&imgtype=0&src=http%3A%2F%2Fwww.cssxt.com%2Fuploadfile%2F2017%2F1208%2F20171208110834538.jpg',
thumbnail: 'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1534532387799&di=12701cc3f20c1a78a5c7524ec33b4c59&imgtype=0&src=http%3A%2F%2Fwww.cssxt.com%2Fuploadfile%2F2017%2F1208%2F20171208110834538.jpg',
)).then((result){
)).then((result){
},onError: (msg){
},
onError: (msg){
});
});
```
```
```
fluwx.share(WeChatShareModel)
```目前仅支持系统内```
WeChatShareModel
```的子类,不支持自定义。
```
fluwx.share(WeChatShareModel)
```目前仅支持系统内```
WeChatShareModel
```的子类,不支持自定义。
...
...
android/src/main/kotlin/com/jarvan/fluwx/utils/AssetManagerUtil.java
浏览文件 @
a0ec7fc2
...
@@ -2,6 +2,7 @@ package com.jarvan.fluwx.utils;
...
@@ -2,6 +2,7 @@ package com.jarvan.fluwx.utils;
import
android.content.res.AssetFileDescriptor
;
import
android.content.res.AssetFileDescriptor
;
import
android.content.res.AssetManager
;
import
android.content.res.AssetManager
;
import
android.text.TextUtils
;
import
java.io.IOException
;
import
java.io.IOException
;
...
@@ -15,7 +16,12 @@ public final class AssetManagerUtil {
...
@@ -15,7 +16,12 @@ public final class AssetManagerUtil {
public
static
AssetFileDescriptor
openAsset
(
PluginRegistry
.
Registrar
registrar
,
String
assetKey
,
String
assetPackage
)
{
public
static
AssetFileDescriptor
openAsset
(
PluginRegistry
.
Registrar
registrar
,
String
assetKey
,
String
assetPackage
)
{
AssetFileDescriptor
fd
=
null
;
AssetFileDescriptor
fd
=
null
;
AssetManager
assetManager
=
registrar
.
context
().
getAssets
();
AssetManager
assetManager
=
registrar
.
context
().
getAssets
();
String
key
=
registrar
.
lookupKeyForAsset
(
assetKey
,
assetPackage
);
String
key
;
if
(
TextUtils
.
isEmpty
(
assetPackage
))
{
key
=
registrar
.
lookupKeyForAsset
(
assetKey
);
}
else
{
key
=
registrar
.
lookupKeyForAsset
(
assetKey
,
assetPackage
);
}
try
{
try
{
fd
=
assetManager
.
openFd
(
key
);
fd
=
assetManager
.
openFd
(
key
);
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
...
...
android/src/main/kotlin/com/jarvan/fluwx/utils/WeChatThumbnailUtil.java
浏览文件 @
a0ec7fc2
...
@@ -3,6 +3,7 @@ package com.jarvan.fluwx.utils;
...
@@ -3,6 +3,7 @@ package com.jarvan.fluwx.utils;
import
android.content.res.AssetFileDescriptor
;
import
android.content.res.AssetFileDescriptor
;
import
android.graphics.Bitmap
;
import
android.graphics.Bitmap
;
import
android.graphics.BitmapFactory
;
import
android.graphics.BitmapFactory
;
import
android.util.Log
;
import
com.jarvan.fluwx.constant.WeChatPluginImageSchema
;
import
com.jarvan.fluwx.constant.WeChatPluginImageSchema
;
...
@@ -170,8 +171,14 @@ public class WeChatThumbnailUtil {
...
@@ -170,8 +171,14 @@ public class WeChatThumbnailUtil {
private
static
File
getAssetFile
(
String
thumbnail
,
PluginRegistry
.
Registrar
registrar
)
{
private
static
File
getAssetFile
(
String
thumbnail
,
PluginRegistry
.
Registrar
registrar
)
{
File
result
=
null
;
File
result
=
null
;
String
key
=
thumbnail
.
substring
(
WeChatPluginImageSchema
.
SCHEMA_ASSETS
.
length
(),
thumbnail
.
length
());
int
endIndex
=
thumbnail
.
length
();
AssetFileDescriptor
fileDescriptor
=
AssetManagerUtil
.
openAsset
(
registrar
,
key
,
getPackage
(
key
));
int
indexOfPackage
=
thumbnail
.
indexOf
(
WechatPluginKeys
.
PACKAGE
);
if
(
indexOfPackage
>
0
){
endIndex
=
indexOfPackage
;
}
String
key
=
thumbnail
.
substring
(
WeChatPluginImageSchema
.
SCHEMA_ASSETS
.
length
(),
endIndex
);
// flutter_assets/packages/flutter_gallery_assets/ali_connors.jpg?package=flutter_gallery_assets
AssetFileDescriptor
fileDescriptor
=
AssetManagerUtil
.
openAsset
(
registrar
,
key
,
getPackage
(
thumbnail
));
if
(
fileDescriptor
!=
null
)
{
if
(
fileDescriptor
!=
null
)
{
try
{
try
{
...
...
example/images/logo.png
0 → 100644
浏览文件 @
a0ec7fc2
544 Bytes
example/lib/main.dart
浏览文件 @
a0ec7fc2
...
@@ -17,7 +17,6 @@ class _MyAppState extends State<MyApp> {
...
@@ -17,7 +17,6 @@ class _MyAppState extends State<MyApp> {
// initPlatformState();
// initPlatformState();
Fluwx
.
registerApp
(
RegisterModel
(
Fluwx
.
registerApp
(
RegisterModel
(
appId:
"wxd930ea5d5a258f4f"
,
doOnAndroid:
true
,
doOnIOS:
true
));
appId:
"wxd930ea5d5a258f4f"
,
doOnAndroid:
true
,
doOnIOS:
true
));
}
}
// Platform messages are asynchronous, so we initialize in an async method.
// Platform messages are asynchronous, so we initialize in an async method.
...
@@ -34,29 +33,29 @@ class _MyAppState extends State<MyApp> {
...
@@ -34,29 +33,29 @@ class _MyAppState extends State<MyApp> {
child:
new
FlatButton
(
child:
new
FlatButton
(
onPressed:
()
{
onPressed:
()
{
var
fluwx
=
Fluwx
();
var
fluwx
=
Fluwx
();
fluwx
.
share
(
WeChatShareMiniProgramModel
(
//
fluwx.share(WeChatShareMiniProgramModel(
webPageUrl:
"http://www.qq.com"
,
//
webPageUrl: "http://www.qq.com",
miniProgramType:
//
miniProgramType:
WeChatShareMiniProgramModel
.
MINI_PROGRAM_TYPE_RELEASE
,
//
WeChatShareMiniProgramModel.MINI_PROGRAM_TYPE_RELEASE,
userName:
"gh_d43f693ca31f"
,
//
userName: "gh_d43f693ca31f",
path:
'/pages/media'
,
//
path: '/pages/media',
title:
"title"
,
//
title: "title",
description:
"des"
,
//
description: "des",
thumbnail:
//
thumbnail:
'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1534532387799&di=12701cc3f20c1a78a5c7524ec33b4c59&imgtype=0&src=http%3A%2F%2Fwww.cssxt.com%2Fuploadfile%2F2017%2F1208%2F20171208110834538.jpg'
,
//
'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1534532387799&di=12701cc3f20c1a78a5c7524ec33b4c59&imgtype=0&src=http%3A%2F%2Fwww.cssxt.com%2Fuploadfile%2F2017%2F1208%2F20171208110834538.jpg',
));
//
));
// thumbnail: 'http://b.hiphotos.baidu.com/image/h%3D300/sign=4bfc640817d5ad6eb5f962eab1c939a3/8718367adab44aedb794e128bf1c8701a08bfb20.jpg',
// thumbnail: 'http://b.hiphotos.baidu.com/image/h%3D300/sign=4bfc640817d5ad6eb5f962eab1c939a3/8718367adab44aedb794e128bf1c8701a08bfb20.jpg',
//
fluwx.share(
fluwx
.
share
(
//
WeChatShareWebPageModel(
WeChatShareWebPageModel
(
//
webPage: "https://github.com/JarvanMo/fluwx",
webPage:
"https://github.com/JarvanMo/fluwx"
,
//
title: "MyGithub",
title:
"MyGithub"
,
// thumbnail: 'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1534532387799&di=12701cc3f20c1a78a5c7524ec33b4c59&imgtype=0&src=http%3A%2F%2Fwww.cssxt.com%2Fuploadfile%2F2017%2F1208%2F20171208110834538.jpg',
thumbnail:
"assets://images/logo.png"
//
)
)
//
).then((result){
).
then
((
result
){
//
print("--$result");
print
(
"--
$result
"
);
//
},onError: (msg){
},
onError:
(
msg
){
//
print(msg);
print
(
msg
);
//
});
});
// fluwx.share(WeChatShareImageModel(image: "imagePath",thumbnail: "thumbanailPath"));
// fluwx.share(WeChatShareImageModel(image: "imagePath",thumbnail: "thumbanailPath"));
},
},
child:
new
Text
(
"share "
)),
child:
new
Text
(
"share "
)),
...
...
example/pubspec.yaml
浏览文件 @
a0ec7fc2
...
@@ -26,7 +26,8 @@ flutter:
...
@@ -26,7 +26,8 @@ flutter:
# included with your application, so that you can use the icons in
# included with your application, so that you can use the icons in
# the material Icons class.
# the material Icons class.
uses-material-design
:
true
uses-material-design
:
true
assets
:
-
images/logo.png
# To add assets to your application, add an assets section, like this:
# To add assets to your application, add an assets section, like this:
# assets:
# assets:
# - images/a_dot_burr.jpeg
# - images/a_dot_burr.jpeg
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论