Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
C
clx-fluwx
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
openSourceLibrary
clx-fluwx
Commits
c44e9e51
提交
c44e9e51
authored
8月 27, 2018
作者:
JarvanMo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
demo:share miniprogram
上级
2b794413
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
160 行增加
和
27 行删除
+160
-27
main.dart
example/lib/main.dart
+45
-27
share_mini_program.dart
example/lib/share_mini_program.dart
+115
-0
没有找到文件。
example/lib/main.dart
浏览文件 @
c44e9e51
...
@@ -3,6 +3,7 @@ import 'dart:async';
...
@@ -3,6 +3,7 @@ import 'dart:async';
import
'package:fluwx/fluwx.dart'
;
import
'package:fluwx/fluwx.dart'
;
import
'package:fluwx_example/send_auth.dart'
;
import
'package:fluwx_example/send_auth.dart'
;
import
'package:fluwx_example/share_mini_program.dart'
;
import
'package:fluwx_example/share_video_page.dart'
;
import
'package:fluwx_example/share_video_page.dart'
;
import
'share_music.dart'
;
import
'share_music.dart'
;
import
'share_web_page.dart'
;
import
'share_web_page.dart'
;
...
@@ -31,11 +32,12 @@ class _MyAppState extends State<MyApp> {
...
@@ -31,11 +32,12 @@ class _MyAppState extends State<MyApp> {
return
new
MaterialApp
(
return
new
MaterialApp
(
routes:
<
String
,
WidgetBuilder
>{
routes:
<
String
,
WidgetBuilder
>{
"shareText"
:
(
context
)
=>
ShareTextPage
(),
"shareText"
:
(
context
)
=>
ShareTextPage
(),
"shareImage"
:(
context
)
=>
ShareImagePage
(),
"shareImage"
:
(
context
)
=>
ShareImagePage
(),
"shareWebPage"
:(
context
)
=>
ShareWebPagePage
(),
"shareWebPage"
:
(
context
)
=>
ShareWebPagePage
(),
"shareMusic"
:(
context
)
=>
ShareMusicPage
(),
"shareMusic"
:
(
context
)
=>
ShareMusicPage
(),
"shareVideo"
:(
context
)
=>
ShareVideoPage
(),
"shareVideo"
:
(
context
)
=>
ShareVideoPage
(),
"sendAuth"
:(
context
)
=>
SendAuthPage
(),
"sendAuth"
:
(
context
)
=>
SendAuthPage
(),
"shareMiniProgram"
:(
context
)
=>
ShareMiniProgramPage
()
},
},
home:
new
Scaffold
(
home:
new
Scaffold
(
appBar:
new
AppBar
(
appBar:
new
AppBar
(
...
@@ -54,43 +56,59 @@ class ShareSelectorPage extends StatelessWidget {
...
@@ -54,43 +56,59 @@ class ShareSelectorPage extends StatelessWidget {
children:
<
Widget
>[
children:
<
Widget
>[
Padding
(
Padding
(
padding:
const
EdgeInsets
.
all
(
8.0
),
padding:
const
EdgeInsets
.
all
(
8.0
),
child:
new
OutlineButton
(
onPressed:
()
{
child:
new
OutlineButton
(
Navigator
.
of
(
context
).
pushNamed
(
"shareText"
);
onPressed:
()
{
},
child:
const
Text
(
"share text"
)),
Navigator
.
of
(
context
).
pushNamed
(
"shareText"
);
},
child:
const
Text
(
"share text"
)),
),
),
Padding
(
Padding
(
padding:
const
EdgeInsets
.
all
(
8.0
),
padding:
const
EdgeInsets
.
all
(
8.0
),
child:
new
OutlineButton
(
onPressed:
()
{
child:
new
OutlineButton
(
Navigator
.
of
(
context
).
pushNamed
(
"shareImage"
);
onPressed:
()
{
},
child:
const
Text
(
"share image"
)),
Navigator
.
of
(
context
).
pushNamed
(
"shareImage"
);
},
child:
const
Text
(
"share image"
)),
),
),
Padding
(
Padding
(
padding:
const
EdgeInsets
.
all
(
8.0
),
padding:
const
EdgeInsets
.
all
(
8.0
),
child:
new
OutlineButton
(
onPressed:
()
{
child:
new
OutlineButton
(
Navigator
.
of
(
context
).
pushNamed
(
"shareWebPage"
);
onPressed:
()
{
Navigator
.
of
(
context
).
pushNamed
(
"shareWebPage"
);
},
child:
const
Text
(
"share webpage"
)),
},
child:
const
Text
(
"share webpage"
)),
),
),
Padding
(
Padding
(
padding:
const
EdgeInsets
.
all
(
8.0
),
padding:
const
EdgeInsets
.
all
(
8.0
),
child:
new
OutlineButton
(
onPressed:
()
{
child:
new
OutlineButton
(
Navigator
.
of
(
context
).
pushNamed
(
"shareMusic"
);
onPressed:
()
{
Navigator
.
of
(
context
).
pushNamed
(
"shareMusic"
);
},
child:
const
Text
(
"share music"
)),
},
child:
const
Text
(
"share music"
)),
),
),
Padding
(
Padding
(
padding:
const
EdgeInsets
.
all
(
8.0
),
padding:
const
EdgeInsets
.
all
(
8.0
),
child:
new
OutlineButton
(
onPressed:
()
{
child:
new
OutlineButton
(
Navigator
.
of
(
context
).
pushNamed
(
"shareVideo"
);
onPressed:
()
{
Navigator
.
of
(
context
).
pushNamed
(
"shareVideo"
);
},
child:
const
Text
(
"share video"
)),
},
child:
const
Text
(
"share video"
)),
),
),
Padding
(
Padding
(
padding:
const
EdgeInsets
.
all
(
8.0
),
padding:
const
EdgeInsets
.
all
(
8.0
),
child:
new
OutlineButton
(
onPressed:
()
{
child:
new
OutlineButton
(
Navigator
.
of
(
context
).
pushNamed
(
"sendAuth"
);
onPressed:
()
{
Navigator
.
of
(
context
).
pushNamed
(
"shareMiniProgram"
);
},
child:
const
Text
(
"send auth"
)),
},
child:
const
Text
(
"share mini program"
)),
),
Padding
(
padding:
const
EdgeInsets
.
all
(
8.0
),
child:
new
OutlineButton
(
onPressed:
()
{
Navigator
.
of
(
context
).
pushNamed
(
"sendAuth"
);
},
child:
const
Text
(
"send auth"
)),
),
),
],
],
),
),
...
...
example/lib/share_mini_program.dart
0 → 100644
浏览文件 @
c44e9e51
import
'package:flutter/material.dart'
;
import
'package:fluwx/fluwx.dart'
;
class
ShareMiniProgramPage
extends
StatefulWidget
{
@override
_ShareMiniProgramPageState
createState
()
=>
_ShareMiniProgramPageState
();
}
class
_ShareMiniProgramPageState
extends
State
<
ShareMiniProgramPage
>
{
Fluwx
fluwx
;
WeChatScene
scene
=
WeChatScene
.
SESSION
;
String
_webPageUr
=
"http://www.qq.com"
;
String
_thumbnail
=
"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"
;
String
_title
=
"Fluwx"
;
String
_userName
=
"gh_d43f693ca31f"
;
String
_path
=
"/pages/media"
;
String
_description
=
"Fluwx"
;
@override
void
initState
()
{
super
.
initState
();
fluwx
=
new
Fluwx
();
}
@override
Widget
build
(
BuildContext
context
)
{
new
Scaffold
(
appBar:
AppBar
(
title:
const
Text
(
"ShareMiniProgram"
),
actions:
<
Widget
>[
IconButton
(
icon:
Icon
(
Icons
.
share
,
color:
Colors
.
white
,),
onPressed:
_share
)
],
),
body:
Padding
(
padding:
const
EdgeInsets
.
all
(
8.0
),
child:
new
Column
(
children:
<
Widget
>[
new
TextField
(
controller:
TextEditingController
(
text:
"http://www.qq.com"
),
onChanged:
(
str
){
_webPageUr
=
str
;
},
decoration:
InputDecoration
(
labelText:
"web page url"
),
),
new
TextField
(
controller:
TextEditingController
(
text:
"gh_d43f693ca31f"
),
onChanged:
(
str
){
_userName
=
str
;
},
decoration:
InputDecoration
(
labelText:
"user name"
),
),
new
TextField
(
controller:
TextEditingController
(
text:
"/pages/media"
),
onChanged:
(
str
){
_path
=
str
;
},
decoration:
InputDecoration
(
labelText:
"user name"
),
),
new
TextField
(
controller:
TextEditingController
(
text:
"Fluwx"
),
onChanged:
(
str
){
_title
=
str
;
},
decoration:
InputDecoration
(
labelText:
"title"
),
),
new
TextField
(
controller:
TextEditingController
(
text:
"Fluwx"
),
onChanged:
(
str
){
_description
=
str
;
},
decoration:
InputDecoration
(
labelText:
"description"
),
),
new
TextField
(
controller:
TextEditingController
(
text:
"assets://images/logo.png"
),
onChanged:
(
str
){
_thumbnail
=
str
;
},
decoration:
InputDecoration
(
labelText:
"thumbnail"
),
),
],
),
),
);
}
void
_share
()
{
var
model
=
new
WeChatShareMiniProgramModel
(
webPageUrl:
_webPageUr
,
miniProgramType:
WeChatShareMiniProgramModel
.
MINI_PROGRAM_TYPE_RELEASE
,
userName:
_userName
,
title:
_title
,
description:
_description
,
thumbnail:
_thumbnail
);
fluwx
.
share
(
model
);
}
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论