Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
C
clx-fluwx
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
openSourceLibrary
clx-fluwx
Commits
4c3d3ee8
提交
4c3d3ee8
authored
8月 28, 2018
作者:
nelson1110
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
pay demo
上级
48d8f948
显示空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
85 行增加
和
2 行删除
+85
-2
build.gradle
example/android/app/build.gradle
+4
-0
main.dart
example/lib/main.dart
+12
-2
pay_page.dart
example/lib/pay_page.dart
+69
-0
没有找到文件。
example/android/app/build.gradle
浏览文件 @
4c3d3ee8
...
@@ -41,6 +41,10 @@ android {
...
@@ -41,6 +41,10 @@ android {
// Signing with the debug keys for now, so `flutter run --release` works.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig
signingConfigs
.
debug
signingConfig
signingConfigs
.
debug
}
}
debug
{
signingConfig
signingConfigs
.
debug
}
}
}
signingConfigs
{
signingConfigs
{
...
...
example/lib/main.dart
浏览文件 @
4c3d3ee8
...
@@ -9,7 +9,7 @@ import 'share_music.dart';
...
@@ -9,7 +9,7 @@ import 'share_music.dart';
import
'share_web_page.dart'
;
import
'share_web_page.dart'
;
import
'share_image_page.dart'
;
import
'share_image_page.dart'
;
import
'share_text_image.dart'
;
import
'share_text_image.dart'
;
import
'pay_page.dart'
;
void
main
(
)
=>
runApp
(
new
MyApp
());
void
main
(
)
=>
runApp
(
new
MyApp
());
class
MyApp
extends
StatefulWidget
{
class
MyApp
extends
StatefulWidget
{
...
@@ -37,7 +37,9 @@ class _MyAppState extends State<MyApp> {
...
@@ -37,7 +37,9 @@ class _MyAppState extends State<MyApp> {
"shareMusic"
:
(
context
)
=>
ShareMusicPage
(),
"shareMusic"
:
(
context
)
=>
ShareMusicPage
(),
"shareVideo"
:
(
context
)
=>
ShareVideoPage
(),
"shareVideo"
:
(
context
)
=>
ShareVideoPage
(),
"sendAuth"
:
(
context
)
=>
SendAuthPage
(),
"sendAuth"
:
(
context
)
=>
SendAuthPage
(),
"shareMiniProgram"
:(
context
)
=>
ShareMiniProgramPage
()
"shareMiniProgram"
:(
context
)
=>
ShareMiniProgramPage
(),
"pay"
:(
context
)=>
PayPage
(),
},
},
home:
new
Scaffold
(
home:
new
Scaffold
(
appBar:
new
AppBar
(
appBar:
new
AppBar
(
...
@@ -110,6 +112,14 @@ class ShareSelectorPage extends StatelessWidget {
...
@@ -110,6 +112,14 @@ class ShareSelectorPage extends StatelessWidget {
},
},
child:
const
Text
(
"send auth"
)),
child:
const
Text
(
"send auth"
)),
),
),
Padding
(
padding:
const
EdgeInsets
.
all
(
8.0
),
child:
new
OutlineButton
(
onPressed:
()
{
Navigator
.
of
(
context
).
pushNamed
(
"pay"
);
},
child:
const
Text
(
"pay"
)),
),
],
],
),
),
);
);
...
...
example/lib/pay_page.dart
0 → 100644
浏览文件 @
4c3d3ee8
import
'dart:convert'
;
import
'package:flutter/material.dart'
;
import
'package:fluwx/fluwx.dart'
;
import
'dart:io'
as
H
;
class
PayPage
extends
StatefulWidget
{
@override
_PayPageState
createState
()
=>
_PayPageState
();
}
class
_PayPageState
extends
State
<
PayPage
>
{
String
_url
=
"https://wxpay.wxutil.com/pub_v2/app/app_pay.php"
;
Fluwx
_fluwx
;
String
_result
=
"无"
;
@override
void
initState
()
{
super
.
initState
();
_fluwx
=
new
Fluwx
();
_fluwx
.
response
.
listen
((
data
){
setState
(()
{
_result
=
data
.
toString
();
});
});
}
@override
Widget
build
(
BuildContext
context
)
{
return
Scaffold
(
appBar:
AppBar
(
title:
const
Text
(
"pay"
),
),
body:
Column
(
children:
<
Widget
>[
OutlineButton
(
onPressed:
()
async
{
var
h
=
H
.
HttpClient
();
h
.
badCertificateCallback
=
(
cert
,
String
host
,
int
port
){
return
true
;
};
var
request
=
await
h
.
getUrl
(
Uri
.
parse
(
_url
));
var
response
=
await
request
.
close
();
var
data
=
await
response
.
transform
(
Utf8Decoder
()).
join
();
Map
<
String
,
dynamic
>
result
=
json
.
decode
(
data
);
print
(
result
[
'appid'
]);
_fluwx
.
pay
(
WeChatPayModel
(
appId:
result
[
'appid'
].
toString
(),
partnerId:
result
[
'partnerId'
].
toString
(),
prepayId:
result
[
'prepayId'
].
toString
(),
packageValue:
result
[
'packageValue'
].
toString
(),
nonceStr:
result
[
'nonceStr'
].
toString
(),
timeStamp:
result
[
'timeStamp'
].
toString
(),
sign:
result
[
'sign'
].
toString
(),
),
);
},
child:
const
Text
(
"pay"
),
),
const
Text
(
"响应结果;"
),
Text
(
_result
)
],
),
);
}
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论