Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
C
clx-fluwx
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
openSourceLibrary
clx-fluwx
Commits
56bcb73d
提交
56bcb73d
authored
12月 14, 2020
作者:
JarvanMo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
reformat code
上级
fdafc28a
显示空白字符变更
内嵌
并排
正在显示
11 个修改的文件
包含
50 行增加
和
71 行删除
+50
-71
pay_page.dart
example/lib/pay_page.dart
+2
-1
share_image_page.dart
example/lib/share_image_page.dart
+6
-9
share_mini_program.dart
example/lib/share_mini_program.dart
+2
-4
share_music.dart
example/lib/share_music.dart
+7
-11
share_text.dart
example/lib/share_text.dart
+6
-9
share_video_page.dart
example/lib/share_video_page.dart
+7
-11
share_web_page.dart
example/lib/share_web_page.dart
+7
-11
fluwx_iml.dart
lib/src/fluwx_iml.dart
+7
-6
wechat_response.dart
lib/src/response/wechat_response.dart
+1
-2
share_models.dart
lib/src/share/share_models.dart
+3
-4
wechat_file.dart
lib/src/wechat_file.dart
+2
-3
没有找到文件。
example/lib/pay_page.dart
浏览文件 @
56bcb73d
...
...
@@ -51,7 +51,8 @@ class _PayPageState extends State<PayPage> {
Map
<
String
,
dynamic
>
result
=
json
.
decode
(
data
);
print
(
result
[
'appid'
]);
print
(
result
[
"timestamp"
]);
fluwx
.
payWithWeChat
(
fluwx
.
payWithWeChat
(
appId:
result
[
'appid'
].
toString
(),
partnerId:
result
[
'partnerid'
].
toString
(),
prepayId:
result
[
'prepayid'
].
toString
(),
...
...
example/lib/share_image_page.dart
浏览文件 @
56bcb73d
...
...
@@ -72,9 +72,8 @@ class _ShareImagePageState extends State<ShareImagePage> {
new
Radio
<
WeChatScene
>(
value:
WeChatScene
.
SESSION
,
groupValue:
scene
,
onChanged:
(
v
){
if
(
v
!=
null
)
handleRadioValueChanged
(
v
);
onChanged:
(
v
)
{
if
(
v
!=
null
)
handleRadioValueChanged
(
v
);
}),
const
Text
(
"会话"
)
],
...
...
@@ -84,9 +83,8 @@ class _ShareImagePageState extends State<ShareImagePage> {
new
Radio
<
WeChatScene
>(
value:
WeChatScene
.
TIMELINE
,
groupValue:
scene
,
onChanged:
(
v
){
if
(
v
!=
null
)
handleRadioValueChanged
(
v
);
onChanged:
(
v
)
{
if
(
v
!=
null
)
handleRadioValueChanged
(
v
);
}),
const
Text
(
"朋友圈"
)
],
...
...
@@ -96,9 +94,8 @@ class _ShareImagePageState extends State<ShareImagePage> {
new
Radio
<
WeChatScene
>(
value:
WeChatScene
.
FAVORITE
,
groupValue:
scene
,
onChanged:
(
v
){
if
(
v
!=
null
)
handleRadioValueChanged
(
v
);
onChanged:
(
v
)
{
if
(
v
!=
null
)
handleRadioValueChanged
(
v
);
}),
const
Text
(
"收藏"
)
],
...
...
example/lib/share_mini_program.dart
浏览文件 @
56bcb73d
...
...
@@ -75,8 +75,7 @@ class _ShareMiniProgramPageState extends State<ShareMiniProgramPage> {
decoration:
InputDecoration
(
labelText:
"description"
),
),
new
TextField
(
controller:
TextEditingController
(
text:
"images/logo.png"
),
controller:
TextEditingController
(
text:
"images/logo.png"
),
onChanged:
(
str
)
{
_thumbnail
=
str
;
},
...
...
@@ -95,8 +94,7 @@ class _ShareMiniProgramPageState extends State<ShareMiniProgramPage> {
title:
_title
,
path:
_path
,
description:
_description
,
thumbnail:
WeChatImage
.
network
(
_thumbnail
)
);
thumbnail:
WeChatImage
.
network
(
_thumbnail
));
shareToWeChat
(
model
);
}
}
example/lib/share_music.dart
浏览文件 @
56bcb73d
...
...
@@ -70,8 +70,7 @@ class _ShareMusicPageState extends State<ShareMusicPage> {
decoration:
InputDecoration
(
labelText:
"description"
),
),
new
TextField
(
controller:
TextEditingController
(
text:
"images/logo.png"
),
controller:
TextEditingController
(
text:
"images/logo.png"
),
onChanged:
(
str
)
{
_thumnail
=
str
;
},
...
...
@@ -85,9 +84,8 @@ class _ShareMusicPageState extends State<ShareMusicPage> {
new
Radio
<
WeChatScene
>(
value:
WeChatScene
.
SESSION
,
groupValue:
scene
,
onChanged:
(
v
){
if
(
v
!=
null
)
handleRadioValueChanged
(
v
);
onChanged:
(
v
)
{
if
(
v
!=
null
)
handleRadioValueChanged
(
v
);
}),
const
Text
(
"会话"
)
],
...
...
@@ -97,9 +95,8 @@ class _ShareMusicPageState extends State<ShareMusicPage> {
new
Radio
<
WeChatScene
>(
value:
WeChatScene
.
TIMELINE
,
groupValue:
scene
,
onChanged:
(
v
){
if
(
v
!=
null
)
handleRadioValueChanged
(
v
);
onChanged:
(
v
)
{
if
(
v
!=
null
)
handleRadioValueChanged
(
v
);
}),
const
Text
(
"朋友圈"
)
],
...
...
@@ -109,9 +106,8 @@ class _ShareMusicPageState extends State<ShareMusicPage> {
new
Radio
<
WeChatScene
>(
value:
WeChatScene
.
FAVORITE
,
groupValue:
scene
,
onChanged:
(
v
){
if
(
v
!=
null
)
handleRadioValueChanged
(
v
);
onChanged:
(
v
)
{
if
(
v
!=
null
)
handleRadioValueChanged
(
v
);
}),
const
Text
(
"收藏"
)
],
...
...
example/lib/share_text.dart
浏览文件 @
56bcb73d
...
...
@@ -48,9 +48,8 @@ class _ShareTextPageState extends State<ShareTextPage> {
new
Radio
<
WeChatScene
>(
value:
WeChatScene
.
SESSION
,
groupValue:
scene
,
onChanged:
(
v
){
if
(
v
!=
null
)
handleRadioValueChanged
(
v
);
onChanged:
(
v
)
{
if
(
v
!=
null
)
handleRadioValueChanged
(
v
);
}),
const
Text
(
"会话"
)
],
...
...
@@ -60,9 +59,8 @@ class _ShareTextPageState extends State<ShareTextPage> {
new
Radio
<
WeChatScene
>(
value:
WeChatScene
.
TIMELINE
,
groupValue:
scene
,
onChanged:
(
v
){
if
(
v
!=
null
)
handleRadioValueChanged
(
v
);
onChanged:
(
v
)
{
if
(
v
!=
null
)
handleRadioValueChanged
(
v
);
}),
const
Text
(
"朋友圈"
)
],
...
...
@@ -72,9 +70,8 @@ class _ShareTextPageState extends State<ShareTextPage> {
new
Radio
<
WeChatScene
>(
value:
WeChatScene
.
FAVORITE
,
groupValue:
scene
,
onChanged:
(
v
){
if
(
v
!=
null
)
handleRadioValueChanged
(
v
);
onChanged:
(
v
)
{
if
(
v
!=
null
)
handleRadioValueChanged
(
v
);
}),
const
Text
(
"收藏"
)
],
...
...
example/lib/share_video_page.dart
浏览文件 @
56bcb73d
...
...
@@ -69,8 +69,7 @@ class _ShareMusicPageState extends State<ShareVideoPage> {
decoration:
InputDecoration
(
labelText:
"description"
),
),
new
TextField
(
controller:
TextEditingController
(
text:
"images/logo.png"
),
controller:
TextEditingController
(
text:
"images/logo.png"
),
onChanged:
(
str
)
{
_thumnail
=
str
;
},
...
...
@@ -84,9 +83,8 @@ class _ShareMusicPageState extends State<ShareVideoPage> {
new
Radio
<
WeChatScene
>(
value:
WeChatScene
.
SESSION
,
groupValue:
scene
,
onChanged:
(
v
){
if
(
v
!=
null
)
handleRadioValueChanged
(
v
);
onChanged:
(
v
)
{
if
(
v
!=
null
)
handleRadioValueChanged
(
v
);
}),
const
Text
(
"会话"
)
],
...
...
@@ -96,9 +94,8 @@ class _ShareMusicPageState extends State<ShareVideoPage> {
new
Radio
<
WeChatScene
>(
value:
WeChatScene
.
TIMELINE
,
groupValue:
scene
,
onChanged:
(
v
){
if
(
v
!=
null
)
handleRadioValueChanged
(
v
);
onChanged:
(
v
)
{
if
(
v
!=
null
)
handleRadioValueChanged
(
v
);
}),
const
Text
(
"朋友圈"
)
],
...
...
@@ -108,9 +105,8 @@ class _ShareMusicPageState extends State<ShareVideoPage> {
new
Radio
<
WeChatScene
>(
value:
WeChatScene
.
FAVORITE
,
groupValue:
scene
,
onChanged:
(
v
){
if
(
v
!=
null
)
handleRadioValueChanged
(
v
);
onChanged:
(
v
)
{
if
(
v
!=
null
)
handleRadioValueChanged
(
v
);
}),
const
Text
(
"收藏"
)
],
...
...
example/lib/share_web_page.dart
浏览文件 @
56bcb73d
...
...
@@ -53,8 +53,7 @@ class ShareWebPagePageState extends State<ShareWebPagePage> {
decoration:
InputDecoration
(
labelText:
"thumbnail"
),
),
new
TextField
(
controller:
TextEditingController
(
text:
"images/logo.png"
),
controller:
TextEditingController
(
text:
"images/logo.png"
),
onChanged:
(
str
)
{
_thumnail
=
str
;
},
...
...
@@ -68,9 +67,8 @@ class ShareWebPagePageState extends State<ShareWebPagePage> {
new
Radio
<
WeChatScene
>(
value:
WeChatScene
.
SESSION
,
groupValue:
scene
,
onChanged:
(
v
){
if
(
v
!=
null
)
handleRadioValueChanged
(
v
);
onChanged:
(
v
)
{
if
(
v
!=
null
)
handleRadioValueChanged
(
v
);
}),
const
Text
(
"会话"
)
],
...
...
@@ -80,9 +78,8 @@ class ShareWebPagePageState extends State<ShareWebPagePage> {
new
Radio
<
WeChatScene
>(
value:
WeChatScene
.
TIMELINE
,
groupValue:
scene
,
onChanged:
(
v
){
if
(
v
!=
null
)
handleRadioValueChanged
(
v
);
onChanged:
(
v
)
{
if
(
v
!=
null
)
handleRadioValueChanged
(
v
);
}),
const
Text
(
"朋友圈"
)
],
...
...
@@ -92,9 +89,8 @@ class ShareWebPagePageState extends State<ShareWebPagePage> {
new
Radio
<
WeChatScene
>(
value:
WeChatScene
.
FAVORITE
,
groupValue:
scene
,
onChanged:
(
v
){
if
(
v
!=
null
)
handleRadioValueChanged
(
v
);
onChanged:
(
v
)
{
if
(
v
!=
null
)
handleRadioValueChanged
(
v
);
}),
const
Text
(
"收藏"
)
],
...
...
lib/src/fluwx_iml.dart
浏览文件 @
56bcb73d
...
...
@@ -88,10 +88,10 @@ Future<bool> registerWxApi(
Future
<
bool
>
shareToWeChat
(
WeChatShareBaseModel
model
)
async
{
if
(
_shareModelMethodMapper
.
containsKey
(
model
.
runtimeType
))
{
var
methodChannel
=
_shareModelMethodMapper
[
model
.
runtimeType
];
if
(
methodChannel
==
null
)
throw
ArgumentError
.
value
(
"
${model.runtimeType}
method channel not found"
);
return
await
_channel
.
invokeMethod
(
methodChannel
,
model
.
toMap
());
if
(
methodChannel
==
null
)
throw
ArgumentError
.
value
(
"
${model.runtimeType}
method channel not found"
);
return
await
_channel
.
invokeMethod
(
methodChannel
,
model
.
toMap
());
}
else
{
return
Future
.
error
(
"no method mapper found[
${model.runtimeType}
]"
);
}
...
...
@@ -104,7 +104,8 @@ Future<bool> shareToWeChat(WeChatShareBaseModel model) async {
/// Once AuthCode got, you need to request Access_Token
/// For more information please visit:
/// * https://open.weixin.qq.com/cgi-bin/showdocument?action=dir_list&t=resource/res_list&verify=1&id=open1419317851&token=
Future
<
bool
>
sendWeChatAuth
({
required
String
scope
,
String
state
=
"state"
})
async
{
Future
<
bool
>
sendWeChatAuth
(
{
required
String
scope
,
String
state
=
"state"
})
async
{
assert
(
scope
.
trim
().
isNotEmpty
);
return
await
_channel
.
invokeMethod
(
"sendAuth"
,
{
"scope"
:
scope
,
"state"
:
state
});
...
...
@@ -248,7 +249,7 @@ Future _methodHandler(MethodCall methodCall) {
///IOS only
Future
<
bool
>
authWeChatByPhoneLogin
(
{
required
String
scope
,
String
state
=
"state"
})
async
{
{
required
String
scope
,
String
state
=
"state"
})
async
{
return
await
_channel
.
invokeMethod
(
"authByPhoneLogin"
,
{
"scope"
:
scope
,
"state"
:
state
});
}
lib/src/response/wechat_response.dart
浏览文件 @
56bcb73d
...
...
@@ -55,12 +55,11 @@ class BaseWeChatResponse {
/// create response from response pool
factory
BaseWeChatResponse
.
create
(
String
name
,
Map
argument
)
{
var
result
=
_nameAndResponseMapper
[
name
];
if
(
result
==
null
)
{
if
(
result
==
null
)
{
throw
ArgumentError
(
"Can't found instance of
$name
"
);
}
return
result
(
argument
);
}
}
class
WeChatShareResponse
extends
BaseWeChatResponse
{
...
...
lib/src/share/share_models.dart
浏览文件 @
56bcb73d
...
...
@@ -52,7 +52,7 @@ class WeChatShareTextModel implements WeChatShareBaseModel {
this
.
messageExt
,
String
?
description
,
String
?
title
})
:
this
.
title
=
title
??
source
,
:
this
.
title
=
title
??
source
,
this
.
description
=
description
??
source
;
@override
...
...
@@ -101,8 +101,7 @@ class WeChatShareMiniProgramModel implements WeChatShareBaseModel {
this
.
messageAction
,
this
.
messageExt
,
this
.
compressThumbnail
=
true
})
:
assert
(
webPageUrl
.
isNotEmpty
),
:
assert
(
webPageUrl
.
isNotEmpty
),
assert
(
userName
.
isNotEmpty
),
assert
(
path
.
isNotEmpty
);
...
...
@@ -148,7 +147,7 @@ class WeChatShareImageModel implements WeChatShareBaseModel {
this
.
messageAction
,
this
.
messageExt
,
this
.
compressThumbnail
=
true
})
:
this
.
thumbnail
=
thumbnail
??
source
;
:
this
.
thumbnail
=
thumbnail
??
source
;
@override
Map
toMap
()
{
...
...
lib/src/wechat_file.dart
浏览文件 @
56bcb73d
...
...
@@ -57,7 +57,7 @@ class WeChatFile {
this
.
suffix
=
source
.
readSuffix
(
suffix
,
defaultSuffixTxt
);
WeChatFile
.
file
(
File
source
,
{
String
suffix
=
defaultSuffixTxt
})
:
this
.
source
=
source
.
path
,
:
this
.
source
=
source
.
path
,
this
.
schema
=
FileSchema
.
FILE
,
this
.
suffix
=
source
.
path
.
readSuffix
(
suffix
,
defaultSuffixTxt
);
...
...
@@ -88,8 +88,7 @@ extension _FileSuffix on String {
/// If [suffix] is blank, then try to read from url
/// if suffix in url not found, then return jpg as default.
String
readSuffix
(
String
?
suffix
,
String
defaultSuffix
)
{
if
(
suffix
!=
null
&&
suffix
.
trim
().
isNotEmpty
)
{
if
(
suffix
!=
null
&&
suffix
.
trim
().
isNotEmpty
)
{
if
(
suffix
.
startsWith
(
"."
))
{
return
suffix
;
}
else
{
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论