Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
C
clx-fluwx
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
openSourceLibrary
clx-fluwx
Commits
23d8a8d5
提交
23d8a8d5
authored
8月 28, 2018
作者:
JarvanMo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
reformat code
上级
7f65cd47
隐藏空白字符变更
内嵌
并排
正在显示
41 个修改的文件
包含
407 行增加
和
451 行删除
+407
-451
launch.json
.vscode/launch.json
+12
-11
AndroidManifest.xml
android/src/main/AndroidManifest.xml
+3
-3
BuildConfig.java
android/src/main/gen/com/jarvan/fluwx/BuildConfig.java
+2
-1
AppRegister.java
android/src/main/kotlin/com/jarvan/fluwx/AppRegister.java
+0
-1
FluwxPlugin.kt
android/src/main/kotlin/com/jarvan/fluwx/FluwxPlugin.kt
+3
-4
WeChatPluginMethods.java
...kotlin/com/jarvan/fluwx/constant/WeChatPluginMethods.java
+1
-1
FluwxAuthHandler.kt
.../main/kotlin/com/jarvan/fluwx/handler/FluwxAuthHandler.kt
+1
-1
FluwxPayHandler.kt
...c/main/kotlin/com/jarvan/fluwx/handler/FluwxPayHandler.kt
+7
-7
FluwxResponseHandler.kt
...n/kotlin/com/jarvan/fluwx/handler/FluwxResponseHandler.kt
+4
-5
WXAPiHandler.kt
.../src/main/kotlin/com/jarvan/fluwx/handler/WXAPiHandler.kt
+2
-2
ShareImageUtil.java
...rc/main/kotlin/com/jarvan/fluwx/utils/ShareImageUtil.java
+0
-2
ThumbnailCompressUtil.java
.../kotlin/com/jarvan/fluwx/utils/ThumbnailCompressUtil.java
+0
-1
Util.java
android/src/main/kotlin/com/jarvan/fluwx/utils/Util.java
+9
-10
WeChatThumbnailUtil.java
...in/kotlin/com/jarvan/fluwx/utils/WeChatThumbnailUtil.java
+0
-2
FluwxWXEntryActivity.kt
...ain/kotlin/com/jarvan/fluwx/wxapi/FluwxWXEntryActivity.kt
+1
-2
styles.xml
android/src/main/res/values/styles.xml
+1
-0
launch.json
example/.vscode/launch.json
+12
-11
AndroidManifest.xml
example/android/app/src/main/AndroidManifest.xml
+9
-9
BuildConfig.java
...app/src/main/gen/com/jarvan/fluwxexample/BuildConfig.java
+2
-1
MainActivity.kt
...p/src/main/kotlin/com/jarvan/fluwxexample/MainActivity.kt
+5
-5
WXEntryActivity.java
...kotlin/net/sourceforge/simcpux/wxapi/WXEntryActivity.java
+2
-2
launch_background.xml
...e/android/app/src/main/res/drawable/launch_background.xml
+1
-2
styles.xml
example/android/app/src/main/res/values/styles.xml
+1
-0
Contents.json
...s/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json
+80
-80
Contents.json
...Runner/Assets.xcassets/LaunchImage.imageset/Contents.json
+13
-13
main.dart
example/lib/main.dart
+9
-8
pay_page.dart
example/lib/pay_page.dart
+27
-29
send_auth.dart
example/lib/send_auth.dart
+9
-7
share_image_page.dart
example/lib/share_image_page.dart
+1
-1
share_mini_program.dart
example/lib/share_mini_program.dart
+33
-45
share_music.dart
example/lib/share_music.dart
+36
-42
share_text_image.dart
example/lib/share_text_image.dart
+20
-20
share_video_page.dart
example/lib/share_video_page.dart
+35
-42
share_web_page.dart
example/lib/share_web_page.dart
+25
-29
widget_test.dart
example/test/widget_test.dart
+0
-3
settings.json
ios/.vscode/settings.json
+2
-1
fluwx.dart
lib/fluwx.dart
+3
-3
fluwx_class.dart
lib/src/fluwx_class.dart
+9
-7
wechat_pay_model.dart
lib/src/models/wechat_pay_model.dart
+21
-18
wechat_send_auth_model.dart
lib/src/models/wechat_send_auth_model.dart
+5
-16
wechat_scene.dart
lib/src/wechat_scene.dart
+1
-4
没有找到文件。
.vscode/launch.json
浏览文件 @
23d8a8d5
{
{
//
使用
IntelliSense
了解相关属性。
//
使用
IntelliSense
了解相关属性。
//
悬停以查看现有属性的描述。
//
悬停以查看现有属性的描述。
//
欲了解更多信息,请访问
:
https
:
//go.microsoft.com/fwlink/?linkid=
830387
//
欲了解更多信息,请访问
:
https
:
//go.microsoft.com/fwlink/?linkid=
830387
"version"
:
"0.2.0"
,
"version"
:
"0.2.0"
,
"configurations"
:
[
"configurations"
:
[
{
{
"name"
:
"Flutter"
,
"name"
:
"Flutter"
,
"request"
:
"launch"
,
"request"
:
"launch"
,
"type"
:
"dart"
"type"
:
"dart"
}
}
]
]
}
}
\ No newline at end of file
android/src/main/AndroidManifest.xml
浏览文件 @
23d8a8d5
<manifest
xmlns:android=
"http://schemas.android.com/apk/res/android"
<manifest
package=
"com.jarvan.fluwx"
>
package=
"com.jarvan.fluwx"
>
<application>
<application>
</application>
</application>
</manifest>
</manifest>
android/src/main/gen/com/jarvan/fluwx/BuildConfig.java
浏览文件 @
23d8a8d5
...
@@ -4,5 +4,5 @@ package com.jarvan.fluwx;
...
@@ -4,5 +4,5 @@ package com.jarvan.fluwx;
/* This stub is only used by the IDE. It is NOT the BuildConfig class actually packed into the APK */
/* This stub is only used by the IDE. It is NOT the BuildConfig class actually packed into the APK */
public
final
class
BuildConfig
{
public
final
class
BuildConfig
{
public
final
static
boolean
DEBUG
=
Boolean
.
parseBoolean
(
null
);
public
final
static
boolean
DEBUG
=
Boolean
.
parseBoolean
(
null
);
}
}
\ No newline at end of file
android/src/main/kotlin/com/jarvan/fluwx/AppRegister.java
浏览文件 @
23d8a8d5
...
@@ -4,7 +4,6 @@ import android.content.BroadcastReceiver;
...
@@ -4,7 +4,6 @@ import android.content.BroadcastReceiver;
import
android.content.Context
;
import
android.content.Context
;
import
android.content.Intent
;
import
android.content.Intent
;
import
com.jarvan.fluwx.constant.WechatPluginKeys
;
import
com.tencent.mm.opensdk.openapi.IWXAPI
;
import
com.tencent.mm.opensdk.openapi.IWXAPI
;
import
com.tencent.mm.opensdk.openapi.WXAPIFactory
;
import
com.tencent.mm.opensdk.openapi.WXAPIFactory
;
...
...
android/src/main/kotlin/com/jarvan/fluwx/FluwxPlugin.kt
浏览文件 @
23d8a8d5
...
@@ -35,7 +35,7 @@ class FluwxPlugin(private var registrar: Registrar) : MethodCallHandler {
...
@@ -35,7 +35,7 @@ class FluwxPlugin(private var registrar: Registrar) : MethodCallHandler {
return
return
}
}
if
(
call
.
method
==
IS_WE_CHAT_INSTALLED
)
{
if
(
call
.
method
==
IS_WE_CHAT_INSTALLED
)
{
WXAPiHandler
.
checkWeChatInstallation
(
result
)
WXAPiHandler
.
checkWeChatInstallation
(
result
)
return
return
}
}
...
@@ -45,8 +45,8 @@ class FluwxPlugin(private var registrar: Registrar) : MethodCallHandler {
...
@@ -45,8 +45,8 @@ class FluwxPlugin(private var registrar: Registrar) : MethodCallHandler {
return
return
}
}
if
(
call
.
method
==
WeChatPluginMethods
.
PAY
)
{
if
(
call
.
method
==
WeChatPluginMethods
.
PAY
)
{
FluwxPayHandler
.
pay
(
call
,
result
)
FluwxPayHandler
.
pay
(
call
,
result
)
return
return
}
}
...
@@ -57,6 +57,5 @@ class FluwxPlugin(private var registrar: Registrar) : MethodCallHandler {
...
@@ -57,6 +57,5 @@ class FluwxPlugin(private var registrar: Registrar) : MethodCallHandler {
}
}
}
}
}
}
android/src/main/kotlin/com/jarvan/fluwx/constant/WeChatPluginMethods.java
浏览文件 @
23d8a8d5
...
@@ -10,7 +10,7 @@ public class WeChatPluginMethods {
...
@@ -10,7 +10,7 @@ public class WeChatPluginMethods {
public
static
final
String
UNREGISTER_APP
=
"unregisterApp"
;
public
static
final
String
UNREGISTER_APP
=
"unregisterApp"
;
public
static
final
String
WE_CHAT_SHARE_RESPONSE
=
"onShareResponse"
;
public
static
final
String
WE_CHAT_SHARE_RESPONSE
=
"onShareResponse"
;
public
static
final
String
IS_WE_CHAT_INSTALLED
=
"isWeChatInstalled"
;
public
static
final
String
IS_WE_CHAT_INSTALLED
=
"isWeChatInstalled"
;
public
static
final
String
SHARE_TEXT
=
"shareText"
;
public
static
final
String
SHARE_TEXT
=
"shareText"
;
public
static
final
String
SHARE_IMAGE
=
"shareImage"
;
public
static
final
String
SHARE_IMAGE
=
"shareImage"
;
...
...
android/src/main/kotlin/com/jarvan/fluwx/handler/FluwxAuthHandler.kt
浏览文件 @
23d8a8d5
...
@@ -12,7 +12,7 @@ internal object FluwxAuthHandler {
...
@@ -12,7 +12,7 @@ internal object FluwxAuthHandler {
req
.
scope
=
call
.
argument
(
"scope"
)
req
.
scope
=
call
.
argument
(
"scope"
)
req
.
state
=
call
.
argument
(
"state"
)
req
.
state
=
call
.
argument
(
"state"
)
val
openId
=
call
.
argument
<
String
?>(
"openId"
)
val
openId
=
call
.
argument
<
String
?>(
"openId"
)
if
(!
openId
.
isNullOrBlank
())
{
if
(!
openId
.
isNullOrBlank
())
{
req
.
openId
=
call
.
argument
(
"openId"
)
req
.
openId
=
call
.
argument
(
"openId"
)
}
}
...
...
android/src/main/kotlin/com/jarvan/fluwx/handler/FluwxPayHandler.kt
浏览文件 @
23d8a8d5
...
@@ -15,19 +15,19 @@ object FluwxPayHandler {
...
@@ -15,19 +15,19 @@ object FluwxPayHandler {
if
(
WXAPiHandler
.
wxApi
==
null
)
{
if
(
WXAPiHandler
.
wxApi
==
null
)
{
result
.
error
(
CallResult
.
RESULT_API_NULL
,
"please config wxapi first"
,
null
)
result
.
error
(
CallResult
.
RESULT_API_NULL
,
"please config wxapi first"
,
null
)
return
return
}
else
{
}
else
{
// 将该app注册到微信
// 将该app注册到微信
val
request
=
PayReq
()
val
request
=
PayReq
()
request
.
appId
=
call
.
argument
(
"appId"
)
request
.
appId
=
call
.
argument
(
"appId"
)
request
.
partnerId
=
call
.
argument
(
"partnerId"
)
request
.
partnerId
=
call
.
argument
(
"partnerId"
)
request
.
prepayId
=
call
.
argument
(
"prepayId"
)
request
.
prepayId
=
call
.
argument
(
"prepayId"
)
request
.
packageValue
=
call
.
argument
(
"packageValue"
)
request
.
packageValue
=
call
.
argument
(
"packageValue"
)
request
.
nonceStr
=
call
.
argument
(
"nonceStr"
)
request
.
nonceStr
=
call
.
argument
(
"nonceStr"
)
request
.
timeStamp
=
call
.
argument
(
"timeStamp"
)
request
.
timeStamp
=
call
.
argument
(
"timeStamp"
)
request
.
sign
=
call
.
argument
(
"sign"
)
request
.
sign
=
call
.
argument
(
"sign"
)
request
.
signType
=
call
.
argument
(
"signType"
)
request
.
signType
=
call
.
argument
(
"signType"
)
request
.
extData
=
call
.
argument
(
"extData"
)
request
.
extData
=
call
.
argument
(
"extData"
)
val
done
=
WXAPiHandler
.
wxApi
!!
.
sendReq
(
request
)
val
done
=
WXAPiHandler
.
wxApi
!!
.
sendReq
(
request
)
result
.
success
(
result
.
success
(
mapOf
(
mapOf
(
...
...
android/src/main/kotlin/com/jarvan/fluwx/handler/FluwxResponseHandler.kt
浏览文件 @
23d8a8d5
...
@@ -15,7 +15,7 @@ object FluwxResponseHandler {
...
@@ -15,7 +15,7 @@ object FluwxResponseHandler {
private
const
val
errStr
=
"errStr"
private
const
val
errStr
=
"errStr"
private
const
val
errCode
=
"errCode"
private
const
val
errCode
=
"errCode"
private
const
val
openId
=
"openId"
private
const
val
openId
=
"openId"
private
const
val
type
=
"type"
private
const
val
type
=
"type"
fun
setMethodChannel
(
channel
:
MethodChannel
)
{
fun
setMethodChannel
(
channel
:
MethodChannel
)
{
...
@@ -23,13 +23,12 @@ object FluwxResponseHandler {
...
@@ -23,13 +23,12 @@ object FluwxResponseHandler {
}
}
fun
handleResponse
(
response
:
BaseResp
)
{
fun
handleResponse
(
response
:
BaseResp
)
{
if
(
response
is
SendAuth
.
Resp
)
{
if
(
response
is
SendAuth
.
Resp
)
{
handleAuthResponse
(
response
)
handleAuthResponse
(
response
)
}
else
if
(
response
is
SendMessageToWX
.
Resp
)
{
}
else
if
(
response
is
SendMessageToWX
.
Resp
)
{
handleSendMessageResp
(
response
)
handleSendMessageResp
(
response
)
}
else
if
(
response
is
PayResp
)
{
}
else
if
(
response
is
PayResp
)
{
handlePayResp
(
response
)
handlePayResp
(
response
)
}
}
}
}
...
@@ -64,7 +63,7 @@ object FluwxResponseHandler {
...
@@ -64,7 +63,7 @@ object FluwxResponseHandler {
}
}
private
fun
handleAuthResponse
(
response
:
SendAuth
.
Resp
)
{
private
fun
handleAuthResponse
(
response
:
SendAuth
.
Resp
)
{
val
result
=
mapOf
(
val
result
=
mapOf
(
WechatPluginKeys
.
PLATFORM
to
WechatPluginKeys
.
ANDROID
,
WechatPluginKeys
.
PLATFORM
to
WechatPluginKeys
.
ANDROID
,
errCode
to
response
.
errCode
,
errCode
to
response
.
errCode
,
...
...
android/src/main/kotlin/com/jarvan/fluwx/handler/WXAPiHandler.kt
浏览文件 @
23d8a8d5
...
@@ -48,11 +48,11 @@ object WXAPiHandler {
...
@@ -48,11 +48,11 @@ object WXAPiHandler {
))
))
}
}
fun
checkWeChatInstallation
(
result
:
MethodChannel
.
Result
){
fun
checkWeChatInstallation
(
result
:
MethodChannel
.
Result
)
{
if
(
wxApi
==
null
)
{
if
(
wxApi
==
null
)
{
result
.
error
(
CallResult
.
RESULT_API_NULL
,
"please config wxapi first"
,
null
)
result
.
error
(
CallResult
.
RESULT_API_NULL
,
"please config wxapi first"
,
null
)
return
return
}
else
{
}
else
{
result
.
success
(
wxApi
!!
.
isWXAppInstalled
)
result
.
success
(
wxApi
!!
.
isWXAppInstalled
)
}
}
...
...
android/src/main/kotlin/com/jarvan/fluwx/utils/ShareImageUtil.java
浏览文件 @
23d8a8d5
...
@@ -7,7 +7,6 @@ import android.graphics.BitmapFactory;
...
@@ -7,7 +7,6 @@ import android.graphics.BitmapFactory;
import
com.jarvan.fluwx.constant.WeChatPluginImageSchema
;
import
com.jarvan.fluwx.constant.WeChatPluginImageSchema
;
import
com.jarvan.fluwx.constant.WechatPluginKeys
;
import
com.jarvan.fluwx.constant.WechatPluginKeys
;
import
java.io.File
;
import
java.io.File
;
import
java.io.FileOutputStream
;
import
java.io.FileOutputStream
;
import
java.io.IOException
;
import
java.io.IOException
;
...
@@ -23,7 +22,6 @@ import okhttp3.ResponseBody;
...
@@ -23,7 +22,6 @@ import okhttp3.ResponseBody;
import
okio.BufferedSink
;
import
okio.BufferedSink
;
import
okio.Okio
;
import
okio.Okio
;
import
okio.Source
;
import
okio.Source
;
import
top.zibin.luban.Luban
;
public
class
ShareImageUtil
{
public
class
ShareImageUtil
{
...
...
android/src/main/kotlin/com/jarvan/fluwx/utils/ThumbnailCompressUtil.java
浏览文件 @
23d8a8d5
...
@@ -2,7 +2,6 @@ package com.jarvan.fluwx.utils;
...
@@ -2,7 +2,6 @@ package com.jarvan.fluwx.utils;
import
android.graphics.Bitmap
;
import
android.graphics.Bitmap
;
import
android.graphics.BitmapFactory
;
import
android.graphics.BitmapFactory
;
import
android.os.Build
;
import
android.util.Log
;
import
android.util.Log
;
import
java.io.ByteArrayOutputStream
;
import
java.io.ByteArrayOutputStream
;
...
...
android/src/main/kotlin/com/jarvan/fluwx/utils/Util.java
浏览文件 @
23d8a8d5
package
com
.
jarvan
.
fluwx
.
utils
;
package
com
.
jarvan
.
fluwx
.
utils
;
import
android.graphics.Bitmap
;
import
android.graphics.Bitmap.CompressFormat
;
import
android.graphics.BitmapFactory
;
import
android.graphics.Canvas
;
import
android.graphics.Rect
;
import
android.util.Log
;
import
junit.framework.Assert
;
import
java.io.ByteArrayOutputStream
;
import
java.io.ByteArrayOutputStream
;
import
java.io.File
;
import
java.io.File
;
import
java.io.IOException
;
import
java.io.IOException
;
...
@@ -9,16 +18,6 @@ import java.net.HttpURLConnection;
...
@@ -9,16 +18,6 @@ import java.net.HttpURLConnection;
import
java.net.MalformedURLException
;
import
java.net.MalformedURLException
;
import
java.net.URL
;
import
java.net.URL
;
import
java.net.URLConnection
;
import
java.net.URLConnection
;
import
java.security.MessageDigest
;
import
junit.framework.Assert
;
import
android.graphics.Bitmap
;
import
android.graphics.BitmapFactory
;
import
android.graphics.Bitmap.CompressFormat
;
import
android.graphics.Canvas
;
import
android.graphics.Rect
;
import
android.util.Log
;
class
Util
{
class
Util
{
...
...
android/src/main/kotlin/com/jarvan/fluwx/utils/WeChatThumbnailUtil.java
浏览文件 @
23d8a8d5
...
@@ -3,8 +3,6 @@ package com.jarvan.fluwx.utils;
...
@@ -3,8 +3,6 @@ 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
;
import
com.jarvan.fluwx.constant.WechatPluginKeys
;
import
com.jarvan.fluwx.constant.WechatPluginKeys
;
...
...
android/src/main/kotlin/com/jarvan/fluwx/wxapi/FluwxWXEntryActivity.kt
浏览文件 @
23d8a8d5
...
@@ -11,8 +11,7 @@ import com.tencent.mm.opensdk.modelbase.BaseResp
...
@@ -11,8 +11,7 @@ import com.tencent.mm.opensdk.modelbase.BaseResp
import
com.tencent.mm.opensdk.openapi.IWXAPIEventHandler
import
com.tencent.mm.opensdk.openapi.IWXAPIEventHandler
open
class
FluwxWXEntryActivity
:
Activity
(),
IWXAPIEventHandler
{
open
class
FluwxWXEntryActivity
:
Activity
(),
IWXAPIEventHandler
{
// IWXAPI 是第三方app和微信通信的openapi接口
// IWXAPI 是第三方app和微信通信的openapi接口
...
...
android/src/main/res/values/styles.xml
浏览文件 @
23d8a8d5
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<resources>
<resources>
<style
name=
"DisablePreviewTheme"
parent=
"@android:style/Theme.Light.NoTitleBar"
>
<style
name=
"DisablePreviewTheme"
parent=
"@android:style/Theme.Light.NoTitleBar"
>
<item
name=
"android:windowIsTranslucent"
>
false
</item>
<item
name=
"android:windowIsTranslucent"
>
false
</item>
<item
name=
"android:windowDisablePreview"
>
true
</item>
<item
name=
"android:windowDisablePreview"
>
true
</item>
...
...
example/.vscode/launch.json
浏览文件 @
23d8a8d5
{
{
//
使用
IntelliSense
了解相关属性。
//
使用
IntelliSense
了解相关属性。
//
悬停以查看现有属性的描述。
//
悬停以查看现有属性的描述。
//
欲了解更多信息,请访问
:
https
:
//go.microsoft.com/fwlink/?linkid=
830387
//
欲了解更多信息,请访问
:
https
:
//go.microsoft.com/fwlink/?linkid=
830387
"version"
:
"0.2.0"
,
"version"
:
"0.2.0"
,
"configurations"
:
[
"configurations"
:
[
{
{
"name"
:
"Flutter"
,
"name"
:
"Flutter"
,
"request"
:
"launch"
,
"request"
:
"launch"
,
"type"
:
"dart"
"type"
:
"dart"
}
}
]
]
}
}
\ No newline at end of file
example/android/app/src/main/AndroidManifest.xml
浏览文件 @
23d8a8d5
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
flutter needs it to communicate with the running application
flutter needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
to allow setting breakpoints, to provide hot reload, etc.
-->
-->
<uses-permission
android:name=
"android.permission.INTERNET"
/>
<uses-permission
android:name=
"android.permission.INTERNET"
/>
<!-- io.flutter.app.FlutterApplication is an android.app.Application that
<!-- io.flutter.app.FlutterApplication is an android.app.Application that
calls FlutterMain.startInitialization(this); in its onCreate method.
calls FlutterMain.startInitialization(this); in its onCreate method.
...
@@ -31,8 +31,8 @@
...
@@ -31,8 +31,8 @@
android:name=
"io.flutter.app.android.SplashScreenUntilFirstFrame"
android:name=
"io.flutter.app.android.SplashScreenUntilFirstFrame"
android:value=
"true"
/>
android:value=
"true"
/>
<intent-filter>
<intent-filter>
<action
android:name=
"android.intent.action.MAIN"
/>
<action
android:name=
"android.intent.action.MAIN"
/>
<category
android:name=
"android.intent.category.LAUNCHER"
/>
<category
android:name=
"android.intent.category.LAUNCHER"
/>
</intent-filter>
</intent-filter>
</activity>
</activity>
<activity
<activity
...
@@ -42,9 +42,9 @@
...
@@ -42,9 +42,9 @@
android:launchMode=
"singleTop"
>
android:launchMode=
"singleTop"
>
<intent-filter>
<intent-filter>
<action
android:name=
"android.intent.action.VIEW"
/>
<action
android:name=
"android.intent.action.VIEW"
/>
<category
android:name=
"android.intent.category.DEFAULT"
/>
<category
android:name=
"android.intent.category.DEFAULT"
/>
<data
android:scheme=
"sdksample"
/>
<data
android:scheme=
"sdksample"
/>
</intent-filter>
</intent-filter>
</activity>
</activity>
<activity
<activity
...
@@ -54,9 +54,9 @@
...
@@ -54,9 +54,9 @@
android:launchMode=
"singleTop"
>
android:launchMode=
"singleTop"
>
<intent-filter>
<intent-filter>
<action
android:name=
"android.intent.action.VIEW"
/>
<action
android:name=
"android.intent.action.VIEW"
/>
<category
android:name=
"android.intent.category.DEFAULT"
/>
<category
android:name=
"android.intent.category.DEFAULT"
/>
<data
android:scheme=
"sdksample"
/>
<data
android:scheme=
"sdksample"
/>
</intent-filter>
</intent-filter>
</activity>
</activity>
</application>
</application>
...
...
example/android/app/src/main/gen/com/jarvan/fluwxexample/BuildConfig.java
浏览文件 @
23d8a8d5
...
@@ -4,5 +4,5 @@ package com.jarvan.fluwxexample;
...
@@ -4,5 +4,5 @@ package com.jarvan.fluwxexample;
/* This stub is only used by the IDE. It is NOT the BuildConfig class actually packed into the APK */
/* This stub is only used by the IDE. It is NOT the BuildConfig class actually packed into the APK */
public
final
class
BuildConfig
{
public
final
class
BuildConfig
{
public
final
static
boolean
DEBUG
=
Boolean
.
parseBoolean
(
null
);
public
final
static
boolean
DEBUG
=
Boolean
.
parseBoolean
(
null
);
}
}
\ No newline at end of file
example/android/app/src/main/kotlin/com/jarvan/fluwxexample/MainActivity.kt
浏览文件 @
23d8a8d5
...
@@ -7,9 +7,9 @@ import net.sourceforge.simcpux.wxapi.WXPayEntryActivity
...
@@ -7,9 +7,9 @@ import net.sourceforge.simcpux.wxapi.WXPayEntryActivity
import
io.flutter.app.FlutterActivity
import
io.flutter.app.FlutterActivity
import
io.flutter.plugins.GeneratedPluginRegistrant
import
io.flutter.plugins.GeneratedPluginRegistrant
class
MainActivity
():
FlutterActivity
()
{
class
MainActivity
()
:
FlutterActivity
()
{
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
super
.
onCreate
(
savedInstanceState
)
super
.
onCreate
(
savedInstanceState
)
GeneratedPluginRegistrant
.
registerWith
(
this
)
GeneratedPluginRegistrant
.
registerWith
(
this
)
}
}
}
}
example/android/app/src/main/kotlin/net/sourceforge/simcpux/wxapi/WXEntryActivity.java
浏览文件 @
23d8a8d5
...
@@ -3,8 +3,7 @@ package net.sourceforge.simcpux.wxapi;
...
@@ -3,8 +3,7 @@ package net.sourceforge.simcpux.wxapi;
import
com.jarvan.fluwx.wxapi.FluwxWXEntryActivity
;
import
com.jarvan.fluwx.wxapi.FluwxWXEntryActivity
;
public
class
WXEntryActivity
extends
FluwxWXEntryActivity
{
public
class
WXEntryActivity
extends
FluwxWXEntryActivity
{
}
}
\ No newline at end of file
example/android/app/src/main/res/drawable/launch_background.xml
浏览文件 @
23d8a8d5
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<!-- Modify this file to customize your launch splash screen -->
<!-- Modify this file to customize your launch splash screen -->
<layer-list
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<layer-list
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<item
android:drawable=
"@android:color/white"
/>
<item
android:drawable=
"@android:color/white"
/>
...
...
example/android/app/src/main/res/values/styles.xml
浏览文件 @
23d8a8d5
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<resources>
<resources>
<style
name=
"LaunchTheme"
parent=
"@android:style/Theme.Black.NoTitleBar"
>
<style
name=
"LaunchTheme"
parent=
"@android:style/Theme.Black.NoTitleBar"
>
<!-- Show a splash screen on the activity. Automatically removed when
<!-- Show a splash screen on the activity. Automatically removed when
Flutter draws its first frame -->
Flutter draws its first frame -->
...
...
example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json
浏览文件 @
23d8a8d5
{
{
"images"
:
[
"images"
:
[
{
{
"size"
:
"20x20"
,
"size"
:
"20x20"
,
"idiom"
:
"iphone"
,
"idiom"
:
"iphone"
,
"filename"
:
"Icon-App-20x20@2x.png"
,
"filename"
:
"Icon-App-20x20@2x.png"
,
"scale"
:
"2x"
"scale"
:
"2x"
},
},
{
{
"size"
:
"20x20"
,
"size"
:
"20x20"
,
"idiom"
:
"iphone"
,
"idiom"
:
"iphone"
,
"filename"
:
"Icon-App-20x20@3x.png"
,
"filename"
:
"Icon-App-20x20@3x.png"
,
"scale"
:
"3x"
"scale"
:
"3x"
},
},
{
{
"size"
:
"29x29"
,
"size"
:
"29x29"
,
"idiom"
:
"iphone"
,
"idiom"
:
"iphone"
,
"filename"
:
"Icon-App-29x29@1x.png"
,
"filename"
:
"Icon-App-29x29@1x.png"
,
"scale"
:
"1x"
"scale"
:
"1x"
},
},
{
{
"size"
:
"29x29"
,
"size"
:
"29x29"
,
"idiom"
:
"iphone"
,
"idiom"
:
"iphone"
,
"filename"
:
"Icon-App-29x29@2x.png"
,
"filename"
:
"Icon-App-29x29@2x.png"
,
"scale"
:
"2x"
"scale"
:
"2x"
},
},
{
{
"size"
:
"29x29"
,
"size"
:
"29x29"
,
"idiom"
:
"iphone"
,
"idiom"
:
"iphone"
,
"filename"
:
"Icon-App-29x29@3x.png"
,
"filename"
:
"Icon-App-29x29@3x.png"
,
"scale"
:
"3x"
"scale"
:
"3x"
},
},
{
{
"size"
:
"40x40"
,
"size"
:
"40x40"
,
"idiom"
:
"iphone"
,
"idiom"
:
"iphone"
,
"filename"
:
"Icon-App-40x40@2x.png"
,
"filename"
:
"Icon-App-40x40@2x.png"
,
"scale"
:
"2x"
"scale"
:
"2x"
},
},
{
{
"size"
:
"40x40"
,
"size"
:
"40x40"
,
"idiom"
:
"iphone"
,
"idiom"
:
"iphone"
,
"filename"
:
"Icon-App-40x40@3x.png"
,
"filename"
:
"Icon-App-40x40@3x.png"
,
"scale"
:
"3x"
"scale"
:
"3x"
},
},
{
{
"size"
:
"60x60"
,
"size"
:
"60x60"
,
"idiom"
:
"iphone"
,
"idiom"
:
"iphone"
,
"filename"
:
"Icon-App-60x60@2x.png"
,
"filename"
:
"Icon-App-60x60@2x.png"
,
"scale"
:
"2x"
"scale"
:
"2x"
},
},
{
{
"size"
:
"60x60"
,
"size"
:
"60x60"
,
"idiom"
:
"iphone"
,
"idiom"
:
"iphone"
,
"filename"
:
"Icon-App-60x60@3x.png"
,
"filename"
:
"Icon-App-60x60@3x.png"
,
"scale"
:
"3x"
"scale"
:
"3x"
},
},
{
{
"size"
:
"20x20"
,
"size"
:
"20x20"
,
"idiom"
:
"ipad"
,
"idiom"
:
"ipad"
,
"filename"
:
"Icon-App-20x20@1x.png"
,
"filename"
:
"Icon-App-20x20@1x.png"
,
"scale"
:
"1x"
"scale"
:
"1x"
},
},
{
{
"size"
:
"20x20"
,
"size"
:
"20x20"
,
"idiom"
:
"ipad"
,
"idiom"
:
"ipad"
,
"filename"
:
"Icon-App-20x20@2x.png"
,
"filename"
:
"Icon-App-20x20@2x.png"
,
"scale"
:
"2x"
"scale"
:
"2x"
},
},
{
{
"size"
:
"29x29"
,
"size"
:
"29x29"
,
"idiom"
:
"ipad"
,
"idiom"
:
"ipad"
,
"filename"
:
"Icon-App-29x29@1x.png"
,
"filename"
:
"Icon-App-29x29@1x.png"
,
"scale"
:
"1x"
"scale"
:
"1x"
},
},
{
{
"size"
:
"29x29"
,
"size"
:
"29x29"
,
"idiom"
:
"ipad"
,
"idiom"
:
"ipad"
,
"filename"
:
"Icon-App-29x29@2x.png"
,
"filename"
:
"Icon-App-29x29@2x.png"
,
"scale"
:
"2x"
"scale"
:
"2x"
},
},
{
{
"size"
:
"40x40"
,
"size"
:
"40x40"
,
"idiom"
:
"ipad"
,
"idiom"
:
"ipad"
,
"filename"
:
"Icon-App-40x40@1x.png"
,
"filename"
:
"Icon-App-40x40@1x.png"
,
"scale"
:
"1x"
"scale"
:
"1x"
},
},
{
{
"size"
:
"40x40"
,
"size"
:
"40x40"
,
"idiom"
:
"ipad"
,
"idiom"
:
"ipad"
,
"filename"
:
"Icon-App-40x40@2x.png"
,
"filename"
:
"Icon-App-40x40@2x.png"
,
"scale"
:
"2x"
"scale"
:
"2x"
},
},
{
{
"size"
:
"76x76"
,
"size"
:
"76x76"
,
"idiom"
:
"ipad"
,
"idiom"
:
"ipad"
,
"filename"
:
"Icon-App-76x76@1x.png"
,
"filename"
:
"Icon-App-76x76@1x.png"
,
"scale"
:
"1x"
"scale"
:
"1x"
},
},
{
{
"size"
:
"76x76"
,
"size"
:
"76x76"
,
"idiom"
:
"ipad"
,
"idiom"
:
"ipad"
,
"filename"
:
"Icon-App-76x76@2x.png"
,
"filename"
:
"Icon-App-76x76@2x.png"
,
"scale"
:
"2x"
"scale"
:
"2x"
},
},
{
{
"size"
:
"83.5x83.5"
,
"size"
:
"83.5x83.5"
,
"idiom"
:
"ipad"
,
"idiom"
:
"ipad"
,
"filename"
:
"Icon-App-83.5x83.5@2x.png"
,
"filename"
:
"Icon-App-83.5x83.5@2x.png"
,
"scale"
:
"2x"
"scale"
:
"2x"
},
},
{
{
"size"
:
"1024x1024"
,
"size"
:
"1024x1024"
,
"idiom"
:
"ios-marketing"
,
"idiom"
:
"ios-marketing"
,
"filename"
:
"Icon-App-1024x1024@1x.png"
,
"filename"
:
"Icon-App-1024x1024@1x.png"
,
"scale"
:
"1x"
"scale"
:
"1x"
}
}
],
],
"info"
:
{
"info"
:
{
"version"
:
1
,
"version"
:
1
,
"author"
:
"xcode"
"author"
:
"xcode"
}
}
}
}
example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json
浏览文件 @
23d8a8d5
{
{
"images"
:
[
"images"
:
[
{
{
"idiom"
:
"universal"
,
"idiom"
:
"universal"
,
"filename"
:
"LaunchImage.png"
,
"filename"
:
"LaunchImage.png"
,
"scale"
:
"1x"
"scale"
:
"1x"
},
},
{
{
"idiom"
:
"universal"
,
"idiom"
:
"universal"
,
"filename"
:
"LaunchImage@2x.png"
,
"filename"
:
"LaunchImage@2x.png"
,
"scale"
:
"2x"
"scale"
:
"2x"
},
},
{
{
"idiom"
:
"universal"
,
"idiom"
:
"universal"
,
"filename"
:
"LaunchImage@3x.png"
,
"filename"
:
"LaunchImage@3x.png"
,
"scale"
:
"3x"
"scale"
:
"3x"
}
}
],
],
"info"
:
{
"info"
:
{
"version"
:
1
,
"version"
:
1
,
"author"
:
"xcode"
"author"
:
"xcode"
}
}
}
}
example/lib/main.dart
浏览文件 @
23d8a8d5
import
'package:flutter/material.dart'
;
import
'dart:async'
;
import
'dart:async'
;
import
'package:flutter/material.dart'
;
import
'package:fluwx/fluwx.dart'
;
import
'package:fluwx/fluwx.dart'
;
import
'pay_page.dart'
;
import
'send_auth.dart'
;
import
'send_auth.dart'
;
import
'share_image_page.dart'
;
import
'share_mini_program.dart'
;
import
'share_mini_program.dart'
;
import
'share_video_page.dart'
;
import
'share_music.dart'
;
import
'share_music.dart'
;
import
'share_web_page.dart'
;
import
'share_image_page.dart'
;
import
'share_text_image.dart'
;
import
'share_text_image.dart'
;
import
'pay_page.dart'
;
import
'share_video_page.dart'
;
import
'share_web_page.dart'
;
void
main
(
)
=>
runApp
(
new
MyApp
());
void
main
(
)
=>
runApp
(
new
MyApp
());
class
MyApp
extends
StatefulWidget
{
class
MyApp
extends
StatefulWidget
{
...
@@ -37,9 +39,8 @@ class _MyAppState extends State<MyApp> {
...
@@ -37,9 +39,8 @@ 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
(),
"pay"
:
(
context
)
=>
PayPage
(),
},
},
home:
new
Scaffold
(
home:
new
Scaffold
(
appBar:
new
AppBar
(
appBar:
new
AppBar
(
...
...
example/lib/pay_page.dart
浏览文件 @
23d8a8d5
import
'dart:convert'
;
import
'dart:convert'
;
import
'dart:io'
as
H
;
import
'package:flutter/material.dart'
;
import
'package:flutter/material.dart'
;
import
'package:fluwx/fluwx.dart'
;
import
'package:fluwx/fluwx.dart'
;
import
'dart:io'
as
H
;
class
PayPage
extends
StatefulWidget
{
class
PayPage
extends
StatefulWidget
{
@override
@override
_PayPageState
createState
()
=>
_PayPageState
();
_PayPageState
createState
()
=>
_PayPageState
();
}
}
class
_PayPageState
extends
State
<
PayPage
>
{
class
_PayPageState
extends
State
<
PayPage
>
{
String
_url
=
"https://wxpay.wxutil.com/pub_v2/app/app_pay.php"
;
String
_url
=
"https://wxpay.wxutil.com/pub_v2/app/app_pay.php"
;
Fluwx
_fluwx
;
Fluwx
_fluwx
;
String
_result
=
"无"
;
String
_result
=
"无"
;
@override
@override
void
initState
()
{
void
initState
()
{
super
.
initState
();
super
.
initState
();
_fluwx
=
new
Fluwx
();
_fluwx
=
new
Fluwx
();
_fluwx
.
response
.
listen
((
data
){
_fluwx
.
response
.
listen
((
data
)
{
setState
(()
{
setState
(()
{
_result
=
data
.
toString
();
_result
=
data
.
toString
();
});
});
...
@@ -36,28 +33,29 @@ class _PayPageState extends State<PayPage> {
...
@@ -36,28 +33,29 @@ class _PayPageState extends State<PayPage> {
),
),
body:
Column
(
body:
Column
(
children:
<
Widget
>[
children:
<
Widget
>[
OutlineButton
(
onPressed:
()
async
{
OutlineButton
(
var
h
=
H
.
HttpClient
();
onPressed:
()
async
{
h
.
badCertificateCallback
=
(
cert
,
String
host
,
int
port
){
var
h
=
H
.
HttpClient
();
return
true
;
h
.
badCertificateCallback
=
(
cert
,
String
host
,
int
port
)
{
};
return
true
;
var
request
=
await
h
.
getUrl
(
Uri
.
parse
(
_url
));
};
var
response
=
await
request
.
close
();
var
request
=
await
h
.
getUrl
(
Uri
.
parse
(
_url
));
var
data
=
await
response
.
transform
(
Utf8Decoder
()).
join
();
var
response
=
await
request
.
close
();
Map
<
String
,
dynamic
>
result
=
json
.
decode
(
data
);
var
data
=
await
response
.
transform
(
Utf8Decoder
()).
join
();
print
(
result
[
'appid'
]);
Map
<
String
,
dynamic
>
result
=
json
.
decode
(
data
);
_fluwx
.
pay
(
print
(
result
[
'appid'
]);
WeChatPayModel
(
_fluwx
.
pay
(
appId:
result
[
'appid'
].
toString
(),
WeChatPayModel
(
partnerId:
result
[
'partnerid'
].
toString
(),
appId:
result
[
'appid'
].
toString
(),
prepayId:
result
[
'prepayid'
].
toString
(),
partnerId:
result
[
'partnerid'
].
toString
(),
packageValue:
result
[
'package'
].
toString
(),
prepayId:
result
[
'prepayid'
].
toString
(),
nonceStr:
result
[
'noncestr'
].
toString
(),
packageValue:
result
[
'package'
].
toString
(),
timeStamp:
result
[
'timestamp'
].
toString
(),
nonceStr:
result
[
'noncestr'
].
toString
(),
sign:
result
[
'sign'
].
toString
(),
timeStamp:
result
[
'timestamp'
].
toString
(),
),
sign:
result
[
'sign'
].
toString
(),
);
),
},
);
},
child:
const
Text
(
"pay"
),
child:
const
Text
(
"pay"
),
),
),
const
Text
(
"响应结果;"
),
const
Text
(
"响应结果;"
),
...
...
example/lib/send_auth.dart
浏览文件 @
23d8a8d5
...
@@ -7,14 +7,14 @@ class SendAuthPage extends StatefulWidget {
...
@@ -7,14 +7,14 @@ class SendAuthPage extends StatefulWidget {
}
}
class
_SendAuthPageState
extends
State
<
SendAuthPage
>
{
class
_SendAuthPageState
extends
State
<
SendAuthPage
>
{
Fluwx
_fluwx
;
Fluwx
_fluwx
;
String
_result
=
"无"
;
String
_result
=
"无"
;
@override
@override
void
initState
()
{
void
initState
()
{
super
.
initState
();
super
.
initState
();
_fluwx
=
new
Fluwx
();
_fluwx
=
new
Fluwx
();
_fluwx
.
response
.
listen
((
data
){
_fluwx
.
response
.
listen
((
data
)
{
setState
(()
{
setState
(()
{
_result
=
data
.
toString
();
_result
=
data
.
toString
();
});
});
...
@@ -29,10 +29,12 @@ class _SendAuthPageState extends State<SendAuthPage> {
...
@@ -29,10 +29,12 @@ class _SendAuthPageState extends State<SendAuthPage> {
),
),
body:
Column
(
body:
Column
(
children:
<
Widget
>[
children:
<
Widget
>[
OutlineButton
(
onPressed:
(){
OutlineButton
(
_fluwx
.
sendAuth
(
new
WeChatSendAuthModel
(
scope:
"snsapi_userinfo"
,
state:
"wechat_sdk_demo_test"
));
onPressed:
()
{
},
_fluwx
.
sendAuth
(
new
WeChatSendAuthModel
(
child:
const
Text
(
"send auth"
),
scope:
"snsapi_userinfo"
,
state:
"wechat_sdk_demo_test"
));
},
child:
const
Text
(
"send auth"
),
),
),
const
Text
(
"响应结果;"
),
const
Text
(
"响应结果;"
),
Text
(
_result
)
Text
(
_result
)
...
...
example/lib/share_image_page.dart
浏览文件 @
23d8a8d5
...
@@ -18,6 +18,7 @@ class _ShareImagePageState extends State<ShareImagePage> {
...
@@ -18,6 +18,7 @@ class _ShareImagePageState extends State<ShareImagePage> {
super
.
initState
();
super
.
initState
();
fluwx
=
new
Fluwx
();
fluwx
=
new
Fluwx
();
}
}
@override
@override
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
return
new
Scaffold
(
return
new
Scaffold
(
...
@@ -45,7 +46,6 @@ class _ShareImagePageState extends State<ShareImagePage> {
...
@@ -45,7 +46,6 @@ class _ShareImagePageState extends State<ShareImagePage> {
_imagePath
=
value
;
_imagePath
=
value
;
},
},
keyboardType:
TextInputType
.
multiline
,
keyboardType:
TextInputType
.
multiline
,
),
),
TextField
(
TextField
(
decoration:
InputDecoration
(
labelText:
"缩略地址"
),
decoration:
InputDecoration
(
labelText:
"缩略地址"
),
...
...
example/lib/share_mini_program.dart
浏览文件 @
23d8a8d5
...
@@ -7,16 +7,15 @@ class ShareMiniProgramPage extends StatefulWidget {
...
@@ -7,16 +7,15 @@ class ShareMiniProgramPage extends StatefulWidget {
}
}
class
_ShareMiniProgramPageState
extends
State
<
ShareMiniProgramPage
>
{
class
_ShareMiniProgramPageState
extends
State
<
ShareMiniProgramPage
>
{
Fluwx
fluwx
;
Fluwx
fluwx
;
WeChatScene
scene
=
WeChatScene
.
SESSION
;
WeChatScene
scene
=
WeChatScene
.
SESSION
;
String
_webPageUrl
=
"http://www.qq.com"
;
String
_webPageUrl
=
"http://www.qq.com"
;
String
_thumbnail
=
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"
;
"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
_title
=
"Fluwx"
;
String
_userName
=
"gh_d43f693ca31f"
;
String
_userName
=
"gh_d43f693ca31f"
;
String
_path
=
"/pages/media"
;
String
_path
=
"/pages/media"
;
String
_description
=
"Fluwx"
;
String
_description
=
"Fluwx"
;
@override
@override
void
initState
()
{
void
initState
()
{
...
@@ -24,74 +23,66 @@ class _ShareMiniProgramPageState extends State<ShareMiniProgramPage> {
...
@@ -24,74 +23,66 @@ class _ShareMiniProgramPageState extends State<ShareMiniProgramPage> {
fluwx
=
new
Fluwx
();
fluwx
=
new
Fluwx
();
}
}
@override
@override
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
return
new
Scaffold
(
return
new
Scaffold
(
appBar:
AppBar
(
appBar:
AppBar
(
title:
const
Text
(
"ShareMiniProgram"
),
title:
const
Text
(
"ShareMiniProgram"
),
actions:
<
Widget
>[
actions:
<
Widget
>[
IconButton
(
icon:
Icon
(
Icons
.
share
,
color:
Colors
.
white
,),
onPressed:
_share
)
IconButton
(
icon:
Icon
(
Icons
.
share
,
color:
Colors
.
white
,
),
onPressed:
_share
)
],
],
),
),
body:
Padding
(
body:
Padding
(
padding:
const
EdgeInsets
.
all
(
8.0
),
padding:
const
EdgeInsets
.
all
(
8.0
),
child:
new
ListView
(
child:
new
ListView
(
children:
<
Widget
>[
children:
<
Widget
>[
new
TextField
(
new
TextField
(
controller:
TextEditingController
(
text:
"http://www.qq.com"
),
controller:
TextEditingController
(
text:
"http://www.qq.com"
),
onChanged:
(
str
){
onChanged:
(
str
)
{
_webPageUrl
=
str
;
_webPageUrl
=
str
;
},
},
decoration:
InputDecoration
(
decoration:
InputDecoration
(
labelText:
"web page url"
),
labelText:
"web page url"
),
),
),
new
TextField
(
new
TextField
(
controller:
TextEditingController
(
text:
"gh_d43f693ca31f"
),
controller:
TextEditingController
(
text:
"gh_d43f693ca31f"
),
onChanged:
(
str
){
onChanged:
(
str
)
{
_userName
=
str
;
_userName
=
str
;
},
},
decoration:
InputDecoration
(
decoration:
InputDecoration
(
labelText:
"user name"
),
labelText:
"user name"
),
),
),
new
TextField
(
new
TextField
(
controller:
TextEditingController
(
text:
"/pages/media"
),
controller:
TextEditingController
(
text:
"/pages/media"
),
onChanged:
(
str
){
onChanged:
(
str
)
{
_path
=
str
;
_path
=
str
;
},
},
decoration:
InputDecoration
(
decoration:
InputDecoration
(
labelText:
"user name"
),
labelText:
"user name"
),
),
),
new
TextField
(
new
TextField
(
controller:
TextEditingController
(
text:
"Fluwx"
),
controller:
TextEditingController
(
text:
"Fluwx"
),
onChanged:
(
str
){
onChanged:
(
str
)
{
_title
=
str
;
_title
=
str
;
},
},
decoration:
InputDecoration
(
decoration:
InputDecoration
(
labelText:
"title"
),
labelText:
"title"
),
),
),
new
TextField
(
new
TextField
(
controller:
TextEditingController
(
text:
"Fluwx"
),
controller:
TextEditingController
(
text:
"Fluwx"
),
onChanged:
(
str
){
onChanged:
(
str
)
{
_description
=
str
;
_description
=
str
;
},
},
decoration:
InputDecoration
(
decoration:
InputDecoration
(
labelText:
"description"
),
labelText:
"description"
),
),
),
new
TextField
(
new
TextField
(
controller:
TextEditingController
(
text:
"assets://images/logo.png"
),
controller:
onChanged:
(
str
){
TextEditingController
(
text:
"assets://images/logo.png"
),
onChanged:
(
str
)
{
_thumbnail
=
str
;
_thumbnail
=
str
;
},
},
decoration:
InputDecoration
(
decoration:
InputDecoration
(
labelText:
"thumbnail"
),
labelText:
"thumbnail"
),
),
),
],
],
),
),
...
@@ -100,16 +91,13 @@ class _ShareMiniProgramPageState extends State<ShareMiniProgramPage> {
...
@@ -100,16 +91,13 @@ class _ShareMiniProgramPageState extends State<ShareMiniProgramPage> {
}
}
void
_share
()
{
void
_share
()
{
var
model
=
new
WeChatShareMiniProgramModel
(
var
model
=
new
WeChatShareMiniProgramModel
(
webPageUrl:
_webPageUrl
,
webPageUrl:
_webPageUrl
,
miniProgramType:
WeChatShareMiniProgramModel
.
MINI_PROGRAM_TYPE_RELEASE
,
miniProgramType:
WeChatShareMiniProgramModel
.
MINI_PROGRAM_TYPE_RELEASE
,
userName:
_userName
,
userName:
_userName
,
title:
_title
,
title:
_title
,
description:
_description
,
description:
_description
,
thumbnail:
_thumbnail
thumbnail:
_thumbnail
);
);
fluwx
.
share
(
model
);
fluwx
.
share
(
model
);
}
}
}
}
example/lib/share_music.dart
浏览文件 @
23d8a8d5
import
'package:flutter/material.dart'
;
import
'package:flutter/material.dart'
;
import
'package:fluwx/fluwx.dart'
;
import
'package:fluwx/fluwx.dart'
;
...
@@ -9,11 +8,12 @@ class ShareMusicPage extends StatefulWidget {
...
@@ -9,11 +8,12 @@ class ShareMusicPage extends StatefulWidget {
class
_ShareMusicPageState
extends
State
<
ShareMusicPage
>
{
class
_ShareMusicPageState
extends
State
<
ShareMusicPage
>
{
Fluwx
fluwx
;
Fluwx
fluwx
;
String
_musicUrl
=
"http://staff2.ustc.edu.cn/~wdw/softdown/index.asp/0042515_05.ANDY.mp3"
;
String
_musicUrl
=
String
_musicLowBandUrl
=
"http://www.qq.com"
;
"http://staff2.ustc.edu.cn/~wdw/softdown/index.asp/0042515_05.ANDY.mp3"
;
String
_musicLowBandUrl
=
"http://www.qq.com"
;
String
_title
=
"Beyond"
;
String
_title
=
"Beyond"
;
String
_description
=
"A Popular Rock Band From China"
;
String
_description
=
"A Popular Rock Band From China"
;
String
_thumnail
=
"assets://images/logo.png"
;
String
_thumnail
=
"assets://images/logo.png"
;
WeChatScene
scene
=
WeChatScene
.
SESSION
;
WeChatScene
scene
=
WeChatScene
.
SESSION
;
@override
@override
...
@@ -28,58 +28,56 @@ class _ShareMusicPageState extends State<ShareMusicPage> {
...
@@ -28,58 +28,56 @@ class _ShareMusicPageState extends State<ShareMusicPage> {
appBar:
AppBar
(
appBar:
AppBar
(
title:
const
Text
(
"ShareMusicPage"
),
title:
const
Text
(
"ShareMusicPage"
),
actions:
<
Widget
>[
actions:
<
Widget
>[
IconButton
(
icon:
Icon
(
Icons
.
share
,
color:
Colors
.
white
,),
onPressed:
_share
)
IconButton
(
icon:
Icon
(
Icons
.
share
,
color:
Colors
.
white
,
),
onPressed:
_share
)
],
],
),
),
body:
Padding
(
body:
Padding
(
padding:
const
EdgeInsets
.
all
(
8.0
),
padding:
const
EdgeInsets
.
all
(
8.0
),
child:
new
Column
(
child:
new
Column
(
children:
<
Widget
>[
children:
<
Widget
>[
new
TextField
(
new
TextField
(
controller:
TextEditingController
(
text:
"http://staff2.ustc.edu.cn/~wdw/softdown/index.asp/0042515_05.ANDY.mp3"
),
controller:
TextEditingController
(
onChanged:
(
str
){
text:
"http://staff2.ustc.edu.cn/~wdw/softdown/index.asp/0042515_05.ANDY.mp3"
),
onChanged:
(
str
)
{
_musicUrl
=
str
;
_musicUrl
=
str
;
},
},
decoration:
InputDecoration
(
decoration:
InputDecoration
(
labelText:
"music url"
),
labelText:
"music url"
),
),
),
new
TextField
(
new
TextField
(
controller:
TextEditingController
(
text:
"http://www.qq.com"
),
controller:
TextEditingController
(
text:
"http://www.qq.com"
),
onChanged:
(
str
){
onChanged:
(
str
)
{
_musicLowBandUrl
=
str
;
_musicLowBandUrl
=
str
;
},
},
decoration:
InputDecoration
(
decoration:
InputDecoration
(
labelText:
"music low band url"
),
labelText:
"music low band url"
),
),
),
new
TextField
(
new
TextField
(
controller:
TextEditingController
(
text:
"Beyond"
),
controller:
TextEditingController
(
text:
"Beyond"
),
onChanged:
(
str
){
onChanged:
(
str
)
{
_title
=
str
;
_title
=
str
;
},
},
decoration:
InputDecoration
(
decoration:
InputDecoration
(
labelText:
"title"
),
labelText:
"title"
),
),
),
new
TextField
(
new
TextField
(
controller:
TextEditingController
(
text:
"A Popular Rock Band From China"
),
controller:
onChanged:
(
str
){
TextEditingController
(
text:
"A Popular Rock Band From China"
),
onChanged:
(
str
)
{
_description
=
str
;
_description
=
str
;
},
},
decoration:
InputDecoration
(
decoration:
InputDecoration
(
labelText:
"description"
),
labelText:
"description"
),
),
),
new
TextField
(
new
TextField
(
controller:
TextEditingController
(
text:
"assets://images/logo.png"
),
controller:
onChanged:
(
str
){
TextEditingController
(
text:
"assets://images/logo.png"
),
onChanged:
(
str
)
{
_thumnail
=
str
;
_thumnail
=
str
;
},
},
decoration:
InputDecoration
(
decoration:
InputDecoration
(
labelText:
"thumbnail"
),
labelText:
"thumbnail"
),
),
),
new
Row
(
new
Row
(
children:
<
Widget
>[
children:
<
Widget
>[
...
@@ -89,8 +87,7 @@ class _ShareMusicPageState extends State<ShareMusicPage> {
...
@@ -89,8 +87,7 @@ class _ShareMusicPageState extends State<ShareMusicPage> {
new
Radio
<
WeChatScene
>(
new
Radio
<
WeChatScene
>(
value:
WeChatScene
.
SESSION
,
value:
WeChatScene
.
SESSION
,
groupValue:
scene
,
groupValue:
scene
,
onChanged:
handleRadioValueChanged
onChanged:
handleRadioValueChanged
),
),
const
Text
(
"会话"
)
const
Text
(
"会话"
)
],
],
),
),
...
@@ -99,8 +96,7 @@ class _ShareMusicPageState extends State<ShareMusicPage> {
...
@@ -99,8 +96,7 @@ class _ShareMusicPageState extends State<ShareMusicPage> {
new
Radio
<
WeChatScene
>(
new
Radio
<
WeChatScene
>(
value:
WeChatScene
.
TIMELINE
,
value:
WeChatScene
.
TIMELINE
,
groupValue:
scene
,
groupValue:
scene
,
onChanged:
handleRadioValueChanged
onChanged:
handleRadioValueChanged
),
),
const
Text
(
"朋友圈"
)
const
Text
(
"朋友圈"
)
],
],
),
),
...
@@ -109,8 +105,7 @@ class _ShareMusicPageState extends State<ShareMusicPage> {
...
@@ -109,8 +105,7 @@ class _ShareMusicPageState extends State<ShareMusicPage> {
new
Radio
<
WeChatScene
>(
new
Radio
<
WeChatScene
>(
value:
WeChatScene
.
FAVORITE
,
value:
WeChatScene
.
FAVORITE
,
groupValue:
scene
,
groupValue:
scene
,
onChanged:
handleRadioValueChanged
onChanged:
handleRadioValueChanged
),
),
const
Text
(
"收藏"
)
const
Text
(
"收藏"
)
],
],
)
)
...
@@ -124,18 +119,17 @@ class _ShareMusicPageState extends State<ShareMusicPage> {
...
@@ -124,18 +119,17 @@ class _ShareMusicPageState extends State<ShareMusicPage> {
void
_share
()
{
void
_share
()
{
var
model
=
WeChatShareMusicModel
(
var
model
=
WeChatShareMusicModel
(
title:
_title
,
title:
_title
,
description:
_description
,
description:
_description
,
transaction:
"music"
,
transaction:
"music"
,
musicUrl:
_musicUrl
,
musicUrl:
_musicUrl
,
musicLowBandUrl:
_musicLowBandUrl
,
musicLowBandUrl:
_musicLowBandUrl
,
thumbnail:
_thumnail
thumbnail:
_thumnail
);
);
fluwx
.
share
(
model
);
fluwx
.
share
(
model
);
}
}
void
handleRadioValueChanged
(
WeChatScene
scene
){
void
handleRadioValueChanged
(
WeChatScene
scene
)
{
setState
(()
{
setState
(()
{
this
.
scene
=
scene
;
this
.
scene
=
scene
;
});
});
...
...
example/lib/share_text_image.dart
浏览文件 @
23d8a8d5
...
@@ -10,34 +10,37 @@ class _ShareTextPageState extends State<ShareTextPage> {
...
@@ -10,34 +10,37 @@ class _ShareTextPageState extends State<ShareTextPage> {
Fluwx
fluwx
;
Fluwx
fluwx
;
String
_text
=
"share text from fluwx"
;
String
_text
=
"share text from fluwx"
;
WeChatScene
scene
=
WeChatScene
.
SESSION
;
WeChatScene
scene
=
WeChatScene
.
SESSION
;
@override
@override
void
initState
()
{
void
initState
()
{
super
.
initState
();
super
.
initState
();
fluwx
=
new
Fluwx
();
fluwx
=
new
Fluwx
();
}
}
@override
@override
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
return
new
Scaffold
(
return
new
Scaffold
(
appBar:
AppBar
(
appBar:
AppBar
(
title:
const
Text
(
"ShareText"
),
title:
const
Text
(
"ShareText"
),
actions:
<
Widget
>[
actions:
<
Widget
>[
IconButton
(
icon:
Icon
(
Icons
.
share
,
color:
Colors
.
white
,),
onPressed:
_shareText
)
IconButton
(
icon:
Icon
(
Icons
.
share
,
color:
Colors
.
white
,
),
onPressed:
_shareText
)
],
],
),
),
body:
Padding
(
body:
Padding
(
padding:
const
EdgeInsets
.
all
(
8.0
),
padding:
const
EdgeInsets
.
all
(
8.0
),
child:
new
Column
(
child:
new
Column
(
children:
<
Widget
>[
children:
<
Widget
>[
new
TextField
(
new
TextField
(
controller:
TextEditingController
(
text:
"share text from fluwx"
),
controller:
TextEditingController
(
text:
"share text from fluwx"
),
onChanged:
(
str
){
onChanged:
(
str
)
{
_text
=
str
;
_text
=
str
;
},
},
decoration:
InputDecoration
(
decoration:
InputDecoration
(
labelText:
"TextToShare"
),
labelText:
"TextToShare"
),
),
),
new
Row
(
new
Row
(
children:
<
Widget
>[
children:
<
Widget
>[
...
@@ -47,8 +50,7 @@ class _ShareTextPageState extends State<ShareTextPage> {
...
@@ -47,8 +50,7 @@ class _ShareTextPageState extends State<ShareTextPage> {
new
Radio
<
WeChatScene
>(
new
Radio
<
WeChatScene
>(
value:
WeChatScene
.
SESSION
,
value:
WeChatScene
.
SESSION
,
groupValue:
scene
,
groupValue:
scene
,
onChanged:
handleRadioValueChanged
onChanged:
handleRadioValueChanged
),
),
const
Text
(
"会话"
)
const
Text
(
"会话"
)
],
],
),
),
...
@@ -57,8 +59,7 @@ class _ShareTextPageState extends State<ShareTextPage> {
...
@@ -57,8 +59,7 @@ class _ShareTextPageState extends State<ShareTextPage> {
new
Radio
<
WeChatScene
>(
new
Radio
<
WeChatScene
>(
value:
WeChatScene
.
TIMELINE
,
value:
WeChatScene
.
TIMELINE
,
groupValue:
scene
,
groupValue:
scene
,
onChanged:
handleRadioValueChanged
onChanged:
handleRadioValueChanged
),
),
const
Text
(
"朋友圈"
)
const
Text
(
"朋友圈"
)
],
],
),
),
...
@@ -67,8 +68,7 @@ class _ShareTextPageState extends State<ShareTextPage> {
...
@@ -67,8 +68,7 @@ class _ShareTextPageState extends State<ShareTextPage> {
new
Radio
<
WeChatScene
>(
new
Radio
<
WeChatScene
>(
value:
WeChatScene
.
FAVORITE
,
value:
WeChatScene
.
FAVORITE
,
groupValue:
scene
,
groupValue:
scene
,
onChanged:
handleRadioValueChanged
onChanged:
handleRadioValueChanged
),
),
const
Text
(
"收藏"
)
const
Text
(
"收藏"
)
],
],
)
)
...
@@ -79,17 +79,17 @@ class _ShareTextPageState extends State<ShareTextPage> {
...
@@ -79,17 +79,17 @@ class _ShareTextPageState extends State<ShareTextPage> {
),
),
);
);
}
}
void
_shareText
(){
void
_shareText
()
{
fluwx
.
share
(
WeChatShareTextModel
(
fluwx
.
share
(
WeChatShareTextModel
(
text:
_text
,
text:
_text
,
transaction:
"text
${DateTime.now().millisecondsSinceEpoch}
"
,
transaction:
"text
${DateTime.now().millisecondsSinceEpoch}
"
,
scene:
scene
scene:
scene
));
));
// fluwx.sendAuth(WeChatSendAuthModel(scope: "snsapi_userinfo",state: "wechat_sdk_demo_test"));
// fluwx.sendAuth(WeChatSendAuthModel(scope: "snsapi_userinfo",state: "wechat_sdk_demo_test"));
}
}
void
handleRadioValueChanged
(
WeChatScene
scene
){
void
handleRadioValueChanged
(
WeChatScene
scene
)
{
setState
(()
{
setState
(()
{
this
.
scene
=
scene
;
this
.
scene
=
scene
;
});
});
...
...
example/lib/share_video_page.dart
浏览文件 @
23d8a8d5
import
'package:flutter/material.dart'
;
import
'package:flutter/material.dart'
;
import
'package:fluwx/fluwx.dart'
;
import
'package:fluwx/fluwx.dart'
;
...
@@ -10,10 +9,10 @@ class ShareVideoPage extends StatefulWidget {
...
@@ -10,10 +9,10 @@ class ShareVideoPage extends StatefulWidget {
class
_ShareMusicPageState
extends
State
<
ShareVideoPage
>
{
class
_ShareMusicPageState
extends
State
<
ShareVideoPage
>
{
Fluwx
fluwx
;
Fluwx
fluwx
;
String
_videoUrl
=
"http://www.qq.com"
;
String
_videoUrl
=
"http://www.qq.com"
;
String
_videoLowBandUrl
=
"http://www.qq.com"
;
String
_videoLowBandUrl
=
"http://www.qq.com"
;
String
_title
=
"Beyond"
;
String
_title
=
"Beyond"
;
String
_description
=
"A Popular Rock Band From China"
;
String
_description
=
"A Popular Rock Band From China"
;
String
_thumnail
=
"assets://images/logo.png"
;
String
_thumnail
=
"assets://images/logo.png"
;
WeChatScene
scene
=
WeChatScene
.
SESSION
;
WeChatScene
scene
=
WeChatScene
.
SESSION
;
@override
@override
...
@@ -28,58 +27,56 @@ class _ShareMusicPageState extends State<ShareVideoPage> {
...
@@ -28,58 +27,56 @@ class _ShareMusicPageState extends State<ShareVideoPage> {
appBar:
AppBar
(
appBar:
AppBar
(
title:
const
Text
(
"ShareVideoPage"
),
title:
const
Text
(
"ShareVideoPage"
),
actions:
<
Widget
>[
actions:
<
Widget
>[
IconButton
(
icon:
Icon
(
Icons
.
share
,
color:
Colors
.
white
,),
onPressed:
_share
)
IconButton
(
icon:
Icon
(
Icons
.
share
,
color:
Colors
.
white
,
),
onPressed:
_share
)
],
],
),
),
body:
Padding
(
body:
Padding
(
padding:
const
EdgeInsets
.
all
(
8.0
),
padding:
const
EdgeInsets
.
all
(
8.0
),
child:
new
Column
(
child:
new
Column
(
children:
<
Widget
>[
children:
<
Widget
>[
new
TextField
(
new
TextField
(
controller:
TextEditingController
(
text:
"http://staff2.ustc.edu.cn/~wdw/softdown/index.asp/0042515_05.ANDY.mp3"
),
controller:
TextEditingController
(
onChanged:
(
str
){
text:
"http://staff2.ustc.edu.cn/~wdw/softdown/index.asp/0042515_05.ANDY.mp3"
),
onChanged:
(
str
)
{
_videoUrl
=
str
;
_videoUrl
=
str
;
},
},
decoration:
InputDecoration
(
decoration:
InputDecoration
(
labelText:
"video url"
),
labelText:
"video url"
),
),
),
new
TextField
(
new
TextField
(
controller:
TextEditingController
(
text:
"http://www.qq.com"
),
controller:
TextEditingController
(
text:
"http://www.qq.com"
),
onChanged:
(
str
){
onChanged:
(
str
)
{
_videoLowBandUrl
=
str
;
_videoLowBandUrl
=
str
;
},
},
decoration:
InputDecoration
(
decoration:
InputDecoration
(
labelText:
"video low band url"
),
labelText:
"video low band url"
),
),
),
new
TextField
(
new
TextField
(
controller:
TextEditingController
(
text:
"Beyond"
),
controller:
TextEditingController
(
text:
"Beyond"
),
onChanged:
(
str
){
onChanged:
(
str
)
{
_title
=
str
;
_title
=
str
;
},
},
decoration:
InputDecoration
(
decoration:
InputDecoration
(
labelText:
"title"
),
labelText:
"title"
),
),
),
new
TextField
(
new
TextField
(
controller:
TextEditingController
(
text:
"A Popular Rock Band From China"
),
controller:
onChanged:
(
str
){
TextEditingController
(
text:
"A Popular Rock Band From China"
),
onChanged:
(
str
)
{
_description
=
str
;
_description
=
str
;
},
},
decoration:
InputDecoration
(
decoration:
InputDecoration
(
labelText:
"description"
),
labelText:
"description"
),
),
),
new
TextField
(
new
TextField
(
controller:
TextEditingController
(
text:
"assets://images/logo.png"
),
controller:
onChanged:
(
str
){
TextEditingController
(
text:
"assets://images/logo.png"
),
onChanged:
(
str
)
{
_thumnail
=
str
;
_thumnail
=
str
;
},
},
decoration:
InputDecoration
(
decoration:
InputDecoration
(
labelText:
"thumbnail"
),
labelText:
"thumbnail"
),
),
),
new
Row
(
new
Row
(
children:
<
Widget
>[
children:
<
Widget
>[
...
@@ -89,8 +86,7 @@ class _ShareMusicPageState extends State<ShareVideoPage> {
...
@@ -89,8 +86,7 @@ class _ShareMusicPageState extends State<ShareVideoPage> {
new
Radio
<
WeChatScene
>(
new
Radio
<
WeChatScene
>(
value:
WeChatScene
.
SESSION
,
value:
WeChatScene
.
SESSION
,
groupValue:
scene
,
groupValue:
scene
,
onChanged:
handleRadioValueChanged
onChanged:
handleRadioValueChanged
),
),
const
Text
(
"会话"
)
const
Text
(
"会话"
)
],
],
),
),
...
@@ -99,8 +95,7 @@ class _ShareMusicPageState extends State<ShareVideoPage> {
...
@@ -99,8 +95,7 @@ class _ShareMusicPageState extends State<ShareVideoPage> {
new
Radio
<
WeChatScene
>(
new
Radio
<
WeChatScene
>(
value:
WeChatScene
.
TIMELINE
,
value:
WeChatScene
.
TIMELINE
,
groupValue:
scene
,
groupValue:
scene
,
onChanged:
handleRadioValueChanged
onChanged:
handleRadioValueChanged
),
),
const
Text
(
"朋友圈"
)
const
Text
(
"朋友圈"
)
],
],
),
),
...
@@ -109,8 +104,7 @@ class _ShareMusicPageState extends State<ShareVideoPage> {
...
@@ -109,8 +104,7 @@ class _ShareMusicPageState extends State<ShareVideoPage> {
new
Radio
<
WeChatScene
>(
new
Radio
<
WeChatScene
>(
value:
WeChatScene
.
FAVORITE
,
value:
WeChatScene
.
FAVORITE
,
groupValue:
scene
,
groupValue:
scene
,
onChanged:
handleRadioValueChanged
onChanged:
handleRadioValueChanged
),
),
const
Text
(
"收藏"
)
const
Text
(
"收藏"
)
],
],
)
)
...
@@ -124,17 +118,16 @@ class _ShareMusicPageState extends State<ShareVideoPage> {
...
@@ -124,17 +118,16 @@ class _ShareMusicPageState extends State<ShareVideoPage> {
void
_share
()
{
void
_share
()
{
var
model
=
new
WeChatShareVideoModel
(
var
model
=
new
WeChatShareVideoModel
(
videoUrl:
_videoUrl
,
videoUrl:
_videoUrl
,
transaction:
"video"
,
transaction:
"video"
,
videoLowBandUrl:
_videoLowBandUrl
,
videoLowBandUrl:
_videoLowBandUrl
,
thumbnail:
_thumnail
,
thumbnail:
_thumnail
,
description:
_description
,
description:
_description
,
title:
_title
title:
_title
);
);
fluwx
.
share
(
model
);
fluwx
.
share
(
model
);
}
}
void
handleRadioValueChanged
(
WeChatScene
scene
){
void
handleRadioValueChanged
(
WeChatScene
scene
)
{
setState
(()
{
setState
(()
{
this
.
scene
=
scene
;
this
.
scene
=
scene
;
});
});
...
...
example/lib/share_web_page.dart
浏览文件 @
23d8a8d5
...
@@ -12,7 +12,7 @@ class ShareWebPagePageState extends State<ShareWebPagePage> {
...
@@ -12,7 +12,7 @@ class ShareWebPagePageState extends State<ShareWebPagePage> {
Fluwx
fluwx
;
Fluwx
fluwx
;
String
_url
=
"share text from fluwx"
;
String
_url
=
"share text from fluwx"
;
String
_title
=
"Fluwx"
;
String
_title
=
"Fluwx"
;
String
_thumnail
=
"assets://images/logo.png"
;
String
_thumnail
=
"assets://images/logo.png"
;
WeChatScene
scene
=
WeChatScene
.
SESSION
;
WeChatScene
scene
=
WeChatScene
.
SESSION
;
@override
@override
...
@@ -27,40 +27,40 @@ class ShareWebPagePageState extends State<ShareWebPagePage> {
...
@@ -27,40 +27,40 @@ class ShareWebPagePageState extends State<ShareWebPagePage> {
appBar:
AppBar
(
appBar:
AppBar
(
title:
const
Text
(
"ShareWebPage"
),
title:
const
Text
(
"ShareWebPage"
),
actions:
<
Widget
>[
actions:
<
Widget
>[
IconButton
(
icon:
Icon
(
Icons
.
share
,
color:
Colors
.
white
,),
onPressed:
_share
)
IconButton
(
icon:
Icon
(
Icons
.
share
,
color:
Colors
.
white
,
),
onPressed:
_share
)
],
],
),
),
body:
Padding
(
body:
Padding
(
padding:
const
EdgeInsets
.
all
(
8.0
),
padding:
const
EdgeInsets
.
all
(
8.0
),
child:
new
Column
(
child:
new
Column
(
children:
<
Widget
>[
children:
<
Widget
>[
new
TextField
(
new
TextField
(
controller:
TextEditingController
(
text:
"https://github.com/JarvanMo/fluwx"
),
controller:
TextEditingController
(
onChanged:
(
str
){
text:
"https://github.com/JarvanMo/fluwx"
),
onChanged:
(
str
)
{
_url
=
str
;
_url
=
str
;
},
},
decoration:
InputDecoration
(
decoration:
InputDecoration
(
labelText:
"web page"
),
labelText:
"web page"
),
),
),
new
TextField
(
new
TextField
(
controller:
TextEditingController
(
text:
"Fluwx"
),
controller:
TextEditingController
(
text:
"Fluwx"
),
onChanged:
(
str
){
onChanged:
(
str
)
{
_title
=
str
;
_title
=
str
;
},
},
decoration:
InputDecoration
(
decoration:
InputDecoration
(
labelText:
"thumbnail"
),
labelText:
"thumbnail"
),
),
),
new
TextField
(
new
TextField
(
controller:
TextEditingController
(
text:
"assets://images/logo.png"
),
controller:
onChanged:
(
str
){
TextEditingController
(
text:
"assets://images/logo.png"
),
onChanged:
(
str
)
{
_thumnail
=
str
;
_thumnail
=
str
;
},
},
decoration:
InputDecoration
(
decoration:
InputDecoration
(
labelText:
"thumbnail"
),
labelText:
"thumbnail"
),
),
),
new
Row
(
new
Row
(
children:
<
Widget
>[
children:
<
Widget
>[
...
@@ -70,8 +70,7 @@ class ShareWebPagePageState extends State<ShareWebPagePage> {
...
@@ -70,8 +70,7 @@ class ShareWebPagePageState extends State<ShareWebPagePage> {
new
Radio
<
WeChatScene
>(
new
Radio
<
WeChatScene
>(
value:
WeChatScene
.
SESSION
,
value:
WeChatScene
.
SESSION
,
groupValue:
scene
,
groupValue:
scene
,
onChanged:
handleRadioValueChanged
onChanged:
handleRadioValueChanged
),
),
const
Text
(
"会话"
)
const
Text
(
"会话"
)
],
],
),
),
...
@@ -80,8 +79,7 @@ class ShareWebPagePageState extends State<ShareWebPagePage> {
...
@@ -80,8 +79,7 @@ class ShareWebPagePageState extends State<ShareWebPagePage> {
new
Radio
<
WeChatScene
>(
new
Radio
<
WeChatScene
>(
value:
WeChatScene
.
TIMELINE
,
value:
WeChatScene
.
TIMELINE
,
groupValue:
scene
,
groupValue:
scene
,
onChanged:
handleRadioValueChanged
onChanged:
handleRadioValueChanged
),
),
const
Text
(
"朋友圈"
)
const
Text
(
"朋友圈"
)
],
],
),
),
...
@@ -90,8 +88,7 @@ class ShareWebPagePageState extends State<ShareWebPagePage> {
...
@@ -90,8 +88,7 @@ class ShareWebPagePageState extends State<ShareWebPagePage> {
new
Radio
<
WeChatScene
>(
new
Radio
<
WeChatScene
>(
value:
WeChatScene
.
FAVORITE
,
value:
WeChatScene
.
FAVORITE
,
groupValue:
scene
,
groupValue:
scene
,
onChanged:
handleRadioValueChanged
onChanged:
handleRadioValueChanged
),
),
const
Text
(
"收藏"
)
const
Text
(
"收藏"
)
],
],
)
)
...
@@ -104,17 +101,16 @@ class ShareWebPagePageState extends State<ShareWebPagePage> {
...
@@ -104,17 +101,16 @@ class ShareWebPagePageState extends State<ShareWebPagePage> {
}
}
void
_share
()
{
void
_share
()
{
var
model
=
WeChatShareWebPageModel
(
var
model
=
WeChatShareWebPageModel
(
webPage:
_url
,
webPage:
_url
,
title:
_title
,
title:
_title
,
thumbnail:
_thumnail
,
thumbnail:
_thumnail
,
scene
:
scene
,
scene:
scene
,
transaction:
"hh"
transaction:
"hh"
);
);
fluwx
.
share
(
model
);
fluwx
.
share
(
model
);
}
}
void
handleRadioValueChanged
(
WeChatScene
scene
){
void
handleRadioValueChanged
(
WeChatScene
scene
)
{
setState
(()
{
setState
(()
{
this
.
scene
=
scene
;
this
.
scene
=
scene
;
});
});
...
...
example/test/widget_test.dart
浏览文件 @
23d8a8d5
...
@@ -4,9 +4,6 @@
...
@@ -4,9 +4,6 @@
// find child widgets in the widget tree, read text, and verify that the values of widget properties
// find child widgets in the widget tree, read text, and verify that the values of widget properties
// are correct.
// are correct.
import
'package:flutter/material.dart'
;
void
main
(
)
{
void
main
(
)
{
// testWidgets('Verify Platform version', (WidgetTester tester) async {
// testWidgets('Verify Platform version', (WidgetTester tester) async {
// // Build our app and trigger a frame.
// // Build our app and trigger a frame.
...
...
ios/.vscode/settings.json
浏览文件 @
23d8a8d5
{
{
"editor.quickSuggestions"
:
false
"editor.quickSuggestions"
:
false
}
}
\ No newline at end of file
lib/fluwx.dart
浏览文件 @
23d8a8d5
...
@@ -6,9 +6,9 @@ library fluwx;
...
@@ -6,9 +6,9 @@ library fluwx;
export
'src/fluwx_class.dart'
;
export
'src/fluwx_class.dart'
;
export
'src/models/flutter_register_model.dart'
;
export
'src/models/flutter_register_model.dart'
;
export
'src/models/wechat_pay_model.dart'
;
export
'src/models/wechat_response.dart'
;
export
'src/models/wechat_send_auth_model.dart'
;
export
'src/models/wechat_share_models.dart'
;
export
'src/models/wechat_share_models.dart'
;
export
'src/wechat_reponse.dart'
;
export
'src/wechat_reponse.dart'
;
export
'src/wechat_scene.dart'
;
export
'src/wechat_scene.dart'
;
export
'src/models/wechat_pay_model.dart'
;
export
'src/models/wechat_send_auth_model.dart'
;
export
'src/models/wechat_response.dart'
;
lib/src/fluwx_class.dart
浏览文件 @
23d8a8d5
...
@@ -3,10 +3,10 @@ import 'dart:async';
...
@@ -3,10 +3,10 @@ import 'dart:async';
import
'package:flutter/services.dart'
;
import
'package:flutter/services.dart'
;
import
'models/flutter_register_model.dart'
;
import
'models/flutter_register_model.dart'
;
import
'models/wechat_share_models.dart'
;
import
'models/wechat_send_auth_model.dart'
;
import
'models/wechat_pay_model.dart'
;
import
'models/wechat_pay_model.dart'
;
import
'models/wechat_response.dart'
;
import
'models/wechat_response.dart'
;
import
'models/wechat_send_auth_model.dart'
;
import
'models/wechat_share_models.dart'
;
StreamController
<
WeChatResponse
>
_responseController
=
StreamController
<
WeChatResponse
>
_responseController
=
new
StreamController
.
broadcast
();
new
StreamController
.
broadcast
();
...
@@ -16,11 +16,14 @@ final MethodChannel _channel = const MethodChannel('com.jarvanmo/fluwx')
...
@@ -16,11 +16,14 @@ final MethodChannel _channel = const MethodChannel('com.jarvanmo/fluwx')
Future
<
dynamic
>
_handler
(
MethodCall
methodCall
)
{
Future
<
dynamic
>
_handler
(
MethodCall
methodCall
)
{
if
(
"onShareResponse"
==
methodCall
.
method
)
{
if
(
"onShareResponse"
==
methodCall
.
method
)
{
_responseController
.
add
(
WeChatResponse
(
methodCall
.
arguments
,
ResponseType
.
SHARE
));
_responseController
.
add
(
WeChatResponse
(
methodCall
.
arguments
,
ResponseType
.
SHARE
));
}
else
if
(
"onAuthResponse"
==
methodCall
.
method
)
{
}
else
if
(
"onAuthResponse"
==
methodCall
.
method
)
{
_responseController
.
add
(
WeChatResponse
(
methodCall
.
arguments
,
ResponseType
.
AUTH
));
_responseController
.
add
(
WeChatResponse
(
methodCall
.
arguments
,
ResponseType
.
AUTH
));
}
else
if
(
"onPayResponse"
==
methodCall
.
method
)
{
}
else
if
(
"onPayResponse"
==
methodCall
.
method
)
{
_responseController
.
add
(
WeChatResponse
(
methodCall
.
arguments
,
ResponseType
.
PAYMENT
));
_responseController
.
add
(
WeChatResponse
(
methodCall
.
arguments
,
ResponseType
.
PAYMENT
));
}
}
return
Future
.
value
(
true
);
return
Future
.
value
(
true
);
...
@@ -44,7 +47,7 @@ class Fluwx {
...
@@ -44,7 +47,7 @@ class Fluwx {
}
}
///we don't need the response any longer.
///we don't need the response any longer.
static
void
dispose
(){
static
void
dispose
()
{
_responseController
.
close
();
_responseController
.
close
();
}
}
...
@@ -52,7 +55,6 @@ class Fluwx {
...
@@ -52,7 +55,6 @@ class Fluwx {
// return await _channel.invokeMethod("unregisterApp", model.toMap());
// return await _channel.invokeMethod("unregisterApp", model.toMap());
// }
// }
///the [model] can not be null
///the [model] can not be null
///see [WeChatShareWebPageModel]
///see [WeChatShareWebPageModel]
/// [WeChatShareTextModel]
/// [WeChatShareTextModel]
...
...
lib/src/models/wechat_pay_model.dart
浏览文件 @
23d8a8d5
import
'package:flutter/foundation.dart'
;
import
'package:flutter/foundation.dart'
;
class
WeChatPayModel
{
class
WeChatPayModel
{
final
appId
;
final
appId
;
final
partnerId
;
final
partnerId
;
final
prepayId
;
final
prepayId
;
...
@@ -11,24 +11,28 @@ class WeChatPayModel{
...
@@ -11,24 +11,28 @@ class WeChatPayModel{
final
signType
;
final
signType
;
final
extData
;
final
extData
;
WeChatPayModel
(
WeChatPayModel
({
@required
this
.
appId
,
@required
this
.
partnerId
,
@required
this
.
prepayId
,
{
@required
this
.
appId
,
@required
this
.
packageValue
,
@required
this
.
nonceStr
,
@required
this
.
timeStamp
,
@required
this
.
sign
,
@required
this
.
partnerId
,
this
.
signType
,
this
.
extData
});
@required
this
.
prepayId
,
@required
this
.
packageValue
,
@required
this
.
nonceStr
,
@required
this
.
timeStamp
,
@required
this
.
sign
,
this
.
signType
,
this
.
extData
});
Map
toMap
()
{
Map
toMap
()
{
return
{
return
{
"appId"
:
appId
,
"appId"
:
appId
,
"partnerId"
:
partnerId
,
"partnerId"
:
partnerId
,
"prepayId"
:
prepayId
,
"prepayId"
:
prepayId
,
"packageValue"
:
packageValue
,
"packageValue"
:
packageValue
,
"nonceStr"
:
nonceStr
,
"nonceStr"
:
nonceStr
,
"timeStamp"
:
timeStamp
,
"timeStamp"
:
timeStamp
,
"sign"
:
sign
,
"sign"
:
sign
,
"signType"
:
signType
,
"signType"
:
signType
,
"extData"
:
extData
,
"extData"
:
extData
,
};
};
}
}
}
}
\ No newline at end of file
lib/src/models/wechat_send_auth_model.dart
浏览文件 @
23d8a8d5
import
'package:flutter/foundation.dart'
;
import
'package:flutter/foundation.dart'
;
class
WeChatSendAuthModel
{
class
WeChatSendAuthModel
{
final
String
scope
;
final
String
scope
;
final
String
state
;
final
String
state
;
final
String
openId
;
final
String
openId
;
WeChatSendAuthModel
({
WeChatSendAuthModel
({
@required
this
.
scope
,
this
.
state
,
this
.
openId
})
@required
this
.
scope
,
:
assert
(
scope
!=
null
&&
scope
.
trim
().
isNotEmpty
);
this
.
state
,
this
.
openId
})
:
assert
(
scope
!=
null
&&
scope
.
trim
()
.
isNotEmpty
);
Map
toMap
()
{
Map
toMap
()
{
return
{
return
{
"scope"
:
scope
,
"state"
:
state
,
"openId"
:
openId
};
"scope"
:
scope
,
"state"
:
state
,
"openId"
:
openId
};
}
}
}
}
\ No newline at end of file
lib/src/wechat_scene.dart
浏览文件 @
23d8a8d5
///[WeChatScene.SESSION]会话
///[WeChatScene.SESSION]会话
///[WeChatScene.TIMELINE]朋友圈
///[WeChatScene.TIMELINE]朋友圈
///[WeChatScene.FAVORITE]收藏
///[WeChatScene.FAVORITE]收藏
enum
WeChatScene
{
enum
WeChatScene
{
SESSION
,
TIMELINE
,
FAVORITE
}
SESSION
,
TIMELINE
,
FAVORITE
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论