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
了解相关属性。
//
悬停以查看现有属性的描述。
//
欲了解更多信息,请访问
:
https
:
//go.microsoft.com/fwlink/?linkid=
830387
"version"
:
"0.2.0"
,
"configurations"
:
[
{
"name"
:
"Flutter"
,
"request"
:
"launch"
,
"type"
:
"dart"
}
]
//
使用
IntelliSense
了解相关属性。
//
悬停以查看现有属性的描述。
//
欲了解更多信息,请访问
:
https
:
//go.microsoft.com/fwlink/?linkid=
830387
"version"
:
"0.2.0"
,
"configurations"
:
[
{
"name"
:
"Flutter"
,
"request"
:
"launch"
,
"type"
:
"dart"
}
]
}
\ No newline at end of file
android/src/main/AndroidManifest.xml
浏览文件 @
23d8a8d5
<manifest
xmlns:android=
"http://schemas.android.com/apk/res/android"
package=
"com.jarvan.fluwx"
>
<manifest
package=
"com.jarvan.fluwx"
>
<application>
</application>
</application>
</manifest>
android/src/main/gen/com/jarvan/fluwx/BuildConfig.java
浏览文件 @
23d8a8d5
...
...
@@ -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 */
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;
import
android.content.Context
;
import
android.content.Intent
;
import
com.jarvan.fluwx.constant.WechatPluginKeys
;
import
com.tencent.mm.opensdk.openapi.IWXAPI
;
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 {
return
}
if
(
call
.
method
==
IS_WE_CHAT_INSTALLED
)
{
if
(
call
.
method
==
IS_WE_CHAT_INSTALLED
)
{
WXAPiHandler
.
checkWeChatInstallation
(
result
)
return
}
...
...
@@ -45,8 +45,8 @@ class FluwxPlugin(private var registrar: Registrar) : MethodCallHandler {
return
}
if
(
call
.
method
==
WeChatPluginMethods
.
PAY
)
{
FluwxPayHandler
.
pay
(
call
,
result
)
if
(
call
.
method
==
WeChatPluginMethods
.
PAY
)
{
FluwxPayHandler
.
pay
(
call
,
result
)
return
}
...
...
@@ -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 {
public
static
final
String
UNREGISTER_APP
=
"unregisterApp"
;
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_IMAGE
=
"shareImage"
;
...
...
android/src/main/kotlin/com/jarvan/fluwx/handler/FluwxAuthHandler.kt
浏览文件 @
23d8a8d5
...
...
@@ -12,7 +12,7 @@ internal object FluwxAuthHandler {
req
.
scope
=
call
.
argument
(
"scope"
)
req
.
state
=
call
.
argument
(
"state"
)
val
openId
=
call
.
argument
<
String
?>(
"openId"
)
if
(!
openId
.
isNullOrBlank
())
{
if
(!
openId
.
isNullOrBlank
())
{
req
.
openId
=
call
.
argument
(
"openId"
)
}
...
...
android/src/main/kotlin/com/jarvan/fluwx/handler/FluwxPayHandler.kt
浏览文件 @
23d8a8d5
...
...
@@ -15,19 +15,19 @@ object FluwxPayHandler {
if
(
WXAPiHandler
.
wxApi
==
null
)
{
result
.
error
(
CallResult
.
RESULT_API_NULL
,
"please config wxapi first"
,
null
)
return
}
else
{
}
else
{
// 将该app注册到微信
val
request
=
PayReq
()
request
.
appId
=
call
.
argument
(
"appId"
)
request
.
partnerId
=
call
.
argument
(
"partnerId"
)
request
.
prepayId
=
call
.
argument
(
"prepayId"
)
request
.
prepayId
=
call
.
argument
(
"prepayId"
)
request
.
packageValue
=
call
.
argument
(
"packageValue"
)
request
.
nonceStr
=
call
.
argument
(
"nonceStr"
)
request
.
timeStamp
=
call
.
argument
(
"timeStamp"
)
request
.
sign
=
call
.
argument
(
"sign"
)
request
.
signType
=
call
.
argument
(
"signType"
)
request
.
extData
=
call
.
argument
(
"extData"
)
request
.
nonceStr
=
call
.
argument
(
"nonceStr"
)
request
.
timeStamp
=
call
.
argument
(
"timeStamp"
)
request
.
sign
=
call
.
argument
(
"sign"
)
request
.
signType
=
call
.
argument
(
"signType"
)
request
.
extData
=
call
.
argument
(
"extData"
)
val
done
=
WXAPiHandler
.
wxApi
!!
.
sendReq
(
request
)
result
.
success
(
mapOf
(
...
...
android/src/main/kotlin/com/jarvan/fluwx/handler/FluwxResponseHandler.kt
浏览文件 @
23d8a8d5
...
...
@@ -15,7 +15,7 @@ object FluwxResponseHandler {
private
const
val
errStr
=
"errStr"
private
const
val
errCode
=
"errCode"
private
const
val
openId
=
"openId"
private
const
val
openId
=
"openId"
private
const
val
type
=
"type"
fun
setMethodChannel
(
channel
:
MethodChannel
)
{
...
...
@@ -23,13 +23,12 @@ object FluwxResponseHandler {
}
fun
handleResponse
(
response
:
BaseResp
)
{
if
(
response
is
SendAuth
.
Resp
)
{
handleAuthResponse
(
response
)
}
else
if
(
response
is
SendMessageToWX
.
Resp
)
{
}
else
if
(
response
is
SendMessageToWX
.
Resp
)
{
handleSendMessageResp
(
response
)
}
else
if
(
response
is
PayResp
)
{
}
else
if
(
response
is
PayResp
)
{
handlePayResp
(
response
)
}
}
...
...
@@ -64,7 +63,7 @@ object FluwxResponseHandler {
}
private
fun
handleAuthResponse
(
response
:
SendAuth
.
Resp
)
{
private
fun
handleAuthResponse
(
response
:
SendAuth
.
Resp
)
{
val
result
=
mapOf
(
WechatPluginKeys
.
PLATFORM
to
WechatPluginKeys
.
ANDROID
,
errCode
to
response
.
errCode
,
...
...
android/src/main/kotlin/com/jarvan/fluwx/handler/WXAPiHandler.kt
浏览文件 @
23d8a8d5
...
...
@@ -48,11 +48,11 @@ object WXAPiHandler {
))
}
fun
checkWeChatInstallation
(
result
:
MethodChannel
.
Result
){
fun
checkWeChatInstallation
(
result
:
MethodChannel
.
Result
)
{
if
(
wxApi
==
null
)
{
result
.
error
(
CallResult
.
RESULT_API_NULL
,
"please config wxapi first"
,
null
)
return
}
else
{
}
else
{
result
.
success
(
wxApi
!!
.
isWXAppInstalled
)
}
...
...
android/src/main/kotlin/com/jarvan/fluwx/utils/ShareImageUtil.java
浏览文件 @
23d8a8d5
...
...
@@ -7,7 +7,6 @@ import android.graphics.BitmapFactory;
import
com.jarvan.fluwx.constant.WeChatPluginImageSchema
;
import
com.jarvan.fluwx.constant.WechatPluginKeys
;
import
java.io.File
;
import
java.io.FileOutputStream
;
import
java.io.IOException
;
...
...
@@ -23,7 +22,6 @@ import okhttp3.ResponseBody;
import
okio.BufferedSink
;
import
okio.Okio
;
import
okio.Source
;
import
top.zibin.luban.Luban
;
public
class
ShareImageUtil
{
...
...
android/src/main/kotlin/com/jarvan/fluwx/utils/ThumbnailCompressUtil.java
浏览文件 @
23d8a8d5
...
...
@@ -2,7 +2,6 @@ package com.jarvan.fluwx.utils;
import
android.graphics.Bitmap
;
import
android.graphics.BitmapFactory
;
import
android.os.Build
;
import
android.util.Log
;
import
java.io.ByteArrayOutputStream
;
...
...
android/src/main/kotlin/com/jarvan/fluwx/utils/Util.java
浏览文件 @
23d8a8d5
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.File
;
import
java.io.IOException
;
...
...
@@ -9,16 +18,6 @@ import java.net.HttpURLConnection;
import
java.net.MalformedURLException
;
import
java.net.URL
;
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
{
...
...
android/src/main/kotlin/com/jarvan/fluwx/utils/WeChatThumbnailUtil.java
浏览文件 @
23d8a8d5
...
...
@@ -3,8 +3,6 @@ package com.jarvan.fluwx.utils;
import
android.content.res.AssetFileDescriptor
;
import
android.graphics.Bitmap
;
import
android.graphics.BitmapFactory
;
import
android.util.Log
;
import
com.jarvan.fluwx.constant.WeChatPluginImageSchema
;
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
import
com.tencent.mm.opensdk.openapi.IWXAPIEventHandler
open
class
FluwxWXEntryActivity
:
Activity
(),
IWXAPIEventHandler
{
open
class
FluwxWXEntryActivity
:
Activity
(),
IWXAPIEventHandler
{
// IWXAPI 是第三方app和微信通信的openapi接口
...
...
android/src/main/res/values/styles.xml
浏览文件 @
23d8a8d5
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style
name=
"DisablePreviewTheme"
parent=
"@android:style/Theme.Light.NoTitleBar"
>
<item
name=
"android:windowIsTranslucent"
>
false
</item>
<item
name=
"android:windowDisablePreview"
>
true
</item>
...
...
example/.vscode/launch.json
浏览文件 @
23d8a8d5
{
//
使用
IntelliSense
了解相关属性。
//
悬停以查看现有属性的描述。
//
欲了解更多信息,请访问
:
https
:
//go.microsoft.com/fwlink/?linkid=
830387
"version"
:
"0.2.0"
,
"configurations"
:
[
{
"name"
:
"Flutter"
,
"request"
:
"launch"
,
"type"
:
"dart"
}
]
//
使用
IntelliSense
了解相关属性。
//
悬停以查看现有属性的描述。
//
欲了解更多信息,请访问
:
https
:
//go.microsoft.com/fwlink/?linkid=
830387
"version"
:
"0.2.0"
,
"configurations"
:
[
{
"name"
:
"Flutter"
,
"request"
:
"launch"
,
"type"
:
"dart"
}
]
}
\ No newline at end of file
example/android/app/src/main/AndroidManifest.xml
浏览文件 @
23d8a8d5
...
...
@@ -5,7 +5,7 @@
flutter needs it to communicate with the running application
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
calls FlutterMain.startInitialization(this); in its onCreate method.
...
...
@@ -31,8 +31,8 @@
android:name=
"io.flutter.app.android.SplashScreenUntilFirstFrame"
android:value=
"true"
/>
<intent-filter>
<action
android:name=
"android.intent.action.MAIN"
/>
<category
android:name=
"android.intent.category.LAUNCHER"
/>
<action
android:name=
"android.intent.action.MAIN"
/>
<category
android:name=
"android.intent.category.LAUNCHER"
/>
</intent-filter>
</activity>
<activity
...
...
@@ -42,9 +42,9 @@
android:launchMode=
"singleTop"
>
<intent-filter>
<action
android:name=
"android.intent.action.VIEW"
/>
<category
android:name=
"android.intent.category.DEFAULT"
/>
<data
android:scheme=
"sdksample"
/>
<action
android:name=
"android.intent.action.VIEW"
/>
<category
android:name=
"android.intent.category.DEFAULT"
/>
<data
android:scheme=
"sdksample"
/>
</intent-filter>
</activity>
<activity
...
...
@@ -54,9 +54,9 @@
android:launchMode=
"singleTop"
>
<intent-filter>
<action
android:name=
"android.intent.action.VIEW"
/>
<category
android:name=
"android.intent.category.DEFAULT"
/>
<data
android:scheme=
"sdksample"
/>
<action
android:name=
"android.intent.action.VIEW"
/>
<category
android:name=
"android.intent.category.DEFAULT"
/>
<data
android:scheme=
"sdksample"
/>
</intent-filter>
</activity>
</application>
...
...
example/android/app/src/main/gen/com/jarvan/fluwxexample/BuildConfig.java
浏览文件 @
23d8a8d5
...
...
@@ -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 */
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
import
io.flutter.app.FlutterActivity
import
io.flutter.plugins.GeneratedPluginRegistrant
class
MainActivity
():
FlutterActivity
()
{
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
super
.
onCreate
(
savedInstanceState
)
GeneratedPluginRegistrant
.
registerWith
(
this
)
}
class
MainActivity
()
:
FlutterActivity
()
{
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
super
.
onCreate
(
savedInstanceState
)
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;
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"?>
<!-- Modify this file to customize your launch splash screen -->
<?xml version="1.0" encoding="utf-8"?>
<!-- Modify this file to customize your launch splash screen -->
<layer-list
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<item
android:drawable=
"@android:color/white"
/>
...
...
example/android/app/src/main/res/values/styles.xml
浏览文件 @
23d8a8d5
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style
name=
"LaunchTheme"
parent=
"@android:style/Theme.Black.NoTitleBar"
>
<!-- Show a splash screen on the activity. Automatically removed when
Flutter draws its first frame -->
...
...
example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json
浏览文件 @
23d8a8d5
{
"images"
:
[
"images"
:
[
{
"size"
:
"20x20"
,
"idiom"
:
"iphone"
,
"filename"
:
"Icon-App-20x20@2x.png"
,
"scale"
:
"2x"
"size"
:
"20x20"
,
"idiom"
:
"iphone"
,
"filename"
:
"Icon-App-20x20@2x.png"
,
"scale"
:
"2x"
},
{
"size"
:
"20x20"
,
"idiom"
:
"iphone"
,
"filename"
:
"Icon-App-20x20@3x.png"
,
"scale"
:
"3x"
"size"
:
"20x20"
,
"idiom"
:
"iphone"
,
"filename"
:
"Icon-App-20x20@3x.png"
,
"scale"
:
"3x"
},
{
"size"
:
"29x29"
,
"idiom"
:
"iphone"
,
"filename"
:
"Icon-App-29x29@1x.png"
,
"scale"
:
"1x"
"size"
:
"29x29"
,
"idiom"
:
"iphone"
,
"filename"
:
"Icon-App-29x29@1x.png"
,
"scale"
:
"1x"
},
{
"size"
:
"29x29"
,
"idiom"
:
"iphone"
,
"filename"
:
"Icon-App-29x29@2x.png"
,
"scale"
:
"2x"
"size"
:
"29x29"
,
"idiom"
:
"iphone"
,
"filename"
:
"Icon-App-29x29@2x.png"
,
"scale"
:
"2x"
},
{
"size"
:
"29x29"
,
"idiom"
:
"iphone"
,
"filename"
:
"Icon-App-29x29@3x.png"
,
"scale"
:
"3x"
"size"
:
"29x29"
,
"idiom"
:
"iphone"
,
"filename"
:
"Icon-App-29x29@3x.png"
,
"scale"
:
"3x"
},
{
"size"
:
"40x40"
,
"idiom"
:
"iphone"
,
"filename"
:
"Icon-App-40x40@2x.png"
,
"scale"
:
"2x"
"size"
:
"40x40"
,
"idiom"
:
"iphone"
,
"filename"
:
"Icon-App-40x40@2x.png"
,
"scale"
:
"2x"
},
{
"size"
:
"40x40"
,
"idiom"
:
"iphone"
,
"filename"
:
"Icon-App-40x40@3x.png"
,
"scale"
:
"3x"
"size"
:
"40x40"
,
"idiom"
:
"iphone"
,
"filename"
:
"Icon-App-40x40@3x.png"
,
"scale"
:
"3x"
},
{
"size"
:
"60x60"
,
"idiom"
:
"iphone"
,
"filename"
:
"Icon-App-60x60@2x.png"
,
"scale"
:
"2x"
"size"
:
"60x60"
,
"idiom"
:
"iphone"
,
"filename"
:
"Icon-App-60x60@2x.png"
,
"scale"
:
"2x"
},
{
"size"
:
"60x60"
,
"idiom"
:
"iphone"
,
"filename"
:
"Icon-App-60x60@3x.png"
,
"scale"
:
"3x"
"size"
:
"60x60"
,
"idiom"
:
"iphone"
,
"filename"
:
"Icon-App-60x60@3x.png"
,
"scale"
:
"3x"
},
{
"size"
:
"20x20"
,
"idiom"
:
"ipad"
,
"filename"
:
"Icon-App-20x20@1x.png"
,
"scale"
:
"1x"
"size"
:
"20x20"
,
"idiom"
:
"ipad"
,
"filename"
:
"Icon-App-20x20@1x.png"
,
"scale"
:
"1x"
},
{
"size"
:
"20x20"
,
"idiom"
:
"ipad"
,
"filename"
:
"Icon-App-20x20@2x.png"
,
"scale"
:
"2x"
"size"
:
"20x20"
,
"idiom"
:
"ipad"
,
"filename"
:
"Icon-App-20x20@2x.png"
,
"scale"
:
"2x"
},
{
"size"
:
"29x29"
,
"idiom"
:
"ipad"
,
"filename"
:
"Icon-App-29x29@1x.png"
,
"scale"
:
"1x"
"size"
:
"29x29"
,
"idiom"
:
"ipad"
,
"filename"
:
"Icon-App-29x29@1x.png"
,
"scale"
:
"1x"
},
{
"size"
:
"29x29"
,
"idiom"
:
"ipad"
,
"filename"
:
"Icon-App-29x29@2x.png"
,
"scale"
:
"2x"
"size"
:
"29x29"
,
"idiom"
:
"ipad"
,
"filename"
:
"Icon-App-29x29@2x.png"
,
"scale"
:
"2x"
},
{
"size"
:
"40x40"
,
"idiom"
:
"ipad"
,
"filename"
:
"Icon-App-40x40@1x.png"
,
"scale"
:
"1x"
"size"
:
"40x40"
,
"idiom"
:
"ipad"
,
"filename"
:
"Icon-App-40x40@1x.png"
,
"scale"
:
"1x"
},
{
"size"
:
"40x40"
,
"idiom"
:
"ipad"
,
"filename"
:
"Icon-App-40x40@2x.png"
,
"scale"
:
"2x"
"size"
:
"40x40"
,
"idiom"
:
"ipad"
,
"filename"
:
"Icon-App-40x40@2x.png"
,
"scale"
:
"2x"
},
{
"size"
:
"76x76"
,
"idiom"
:
"ipad"
,
"filename"
:
"Icon-App-76x76@1x.png"
,
"scale"
:
"1x"
"size"
:
"76x76"
,
"idiom"
:
"ipad"
,
"filename"
:
"Icon-App-76x76@1x.png"
,
"scale"
:
"1x"
},
{
"size"
:
"76x76"
,
"idiom"
:
"ipad"
,
"filename"
:
"Icon-App-76x76@2x.png"
,
"scale"
:
"2x"
"size"
:
"76x76"
,
"idiom"
:
"ipad"
,
"filename"
:
"Icon-App-76x76@2x.png"
,
"scale"
:
"2x"
},
{
"size"
:
"83.5x83.5"
,
"idiom"
:
"ipad"
,
"filename"
:
"Icon-App-83.5x83.5@2x.png"
,
"scale"
:
"2x"
"size"
:
"83.5x83.5"
,
"idiom"
:
"ipad"
,
"filename"
:
"Icon-App-83.5x83.5@2x.png"
,
"scale"
:
"2x"
},
{
"size"
:
"1024x1024"
,
"idiom"
:
"ios-marketing"
,
"filename"
:
"Icon-App-1024x1024@1x.png"
,
"scale"
:
"1x"
"size"
:
"1024x1024"
,
"idiom"
:
"ios-marketing"
,
"filename"
:
"Icon-App-1024x1024@1x.png"
,
"scale"
:
"1x"
}
],
"info"
:
{
"version"
:
1
,
"author"
:
"xcode"
"info"
:
{
"version"
:
1
,
"author"
:
"xcode"
}
}
example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json
浏览文件 @
23d8a8d5
{
"images"
:
[
"images"
:
[
{
"idiom"
:
"universal"
,
"filename"
:
"LaunchImage.png"
,
"scale"
:
"1x"
"idiom"
:
"universal"
,
"filename"
:
"LaunchImage.png"
,
"scale"
:
"1x"
},
{
"idiom"
:
"universal"
,
"filename"
:
"LaunchImage@2x.png"
,
"scale"
:
"2x"
"idiom"
:
"universal"
,
"filename"
:
"LaunchImage@2x.png"
,
"scale"
:
"2x"
},
{
"idiom"
:
"universal"
,
"filename"
:
"LaunchImage@3x.png"
,
"scale"
:
"3x"
"idiom"
:
"universal"
,
"filename"
:
"LaunchImage@3x.png"
,
"scale"
:
"3x"
}
],
"info"
:
{
"version"
:
1
,
"author"
:
"xcode"
"info"
:
{
"version"
:
1
,
"author"
:
"xcode"
}
}
example/lib/main.dart
浏览文件 @
23d8a8d5
import
'package:flutter/material.dart'
;
import
'dart:async'
;
import
'package:flutter/material.dart'
;
import
'package:fluwx/fluwx.dart'
;
import
'pay_page.dart'
;
import
'send_auth.dart'
;
import
'share_image_page.dart'
;
import
'share_mini_program.dart'
;
import
'share_video_page.dart'
;
import
'share_music.dart'
;
import
'share_web_page.dart'
;
import
'share_image_page.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
());
class
MyApp
extends
StatefulWidget
{
...
...
@@ -37,9 +39,8 @@ class _MyAppState extends State<MyApp> {
"shareMusic"
:
(
context
)
=>
ShareMusicPage
(),
"shareVideo"
:
(
context
)
=>
ShareVideoPage
(),
"sendAuth"
:
(
context
)
=>
SendAuthPage
(),
"shareMiniProgram"
:(
context
)
=>
ShareMiniProgramPage
(),
"pay"
:(
context
)=>
PayPage
(),
"shareMiniProgram"
:
(
context
)
=>
ShareMiniProgramPage
(),
"pay"
:
(
context
)
=>
PayPage
(),
},
home:
new
Scaffold
(
appBar:
new
AppBar
(
...
...
example/lib/pay_page.dart
浏览文件 @
23d8a8d5
import
'dart:convert'
;
import
'dart:io'
as
H
;
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
=
"无"
;
String
_result
=
"无"
;
@override
void
initState
()
{
super
.
initState
();
_fluwx
=
new
Fluwx
();
_fluwx
.
response
.
listen
((
data
){
_fluwx
.
response
.
listen
((
data
)
{
setState
(()
{
_result
=
data
.
toString
();
});
...
...
@@ -36,28 +33,29 @@ class _PayPageState extends State<PayPage> {
),
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
[
'package'
].
toString
(),
nonceStr:
result
[
'noncestr'
].
toString
(),
timeStamp:
result
[
'timestamp'
].
toString
(),
sign:
result
[
'sign'
].
toString
(),
),
);
},
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
[
'package'
].
toString
(),
nonceStr:
result
[
'noncestr'
].
toString
(),
timeStamp:
result
[
'timestamp'
].
toString
(),
sign:
result
[
'sign'
].
toString
(),
),
);
},
child:
const
Text
(
"pay"
),
),
const
Text
(
"响应结果;"
),
...
...
example/lib/send_auth.dart
浏览文件 @
23d8a8d5
...
...
@@ -7,14 +7,14 @@ class SendAuthPage extends StatefulWidget {
}
class
_SendAuthPageState
extends
State
<
SendAuthPage
>
{
Fluwx
_fluwx
;
String
_result
=
"无"
;
String
_result
=
"无"
;
@override
void
initState
()
{
super
.
initState
();
_fluwx
=
new
Fluwx
();
_fluwx
.
response
.
listen
((
data
){
_fluwx
.
response
.
listen
((
data
)
{
setState
(()
{
_result
=
data
.
toString
();
});
...
...
@@ -29,10 +29,12 @@ class _SendAuthPageState extends State<SendAuthPage> {
),
body:
Column
(
children:
<
Widget
>[
OutlineButton
(
onPressed:
(){
_fluwx
.
sendAuth
(
new
WeChatSendAuthModel
(
scope:
"snsapi_userinfo"
,
state:
"wechat_sdk_demo_test"
));
},
child:
const
Text
(
"send auth"
),
OutlineButton
(
onPressed:
()
{
_fluwx
.
sendAuth
(
new
WeChatSendAuthModel
(
scope:
"snsapi_userinfo"
,
state:
"wechat_sdk_demo_test"
));
},
child:
const
Text
(
"send auth"
),
),
const
Text
(
"响应结果;"
),
Text
(
_result
)
...
...
example/lib/share_image_page.dart
浏览文件 @
23d8a8d5
...
...
@@ -18,6 +18,7 @@ class _ShareImagePageState extends State<ShareImagePage> {
super
.
initState
();
fluwx
=
new
Fluwx
();
}
@override
Widget
build
(
BuildContext
context
)
{
return
new
Scaffold
(
...
...
@@ -45,7 +46,6 @@ class _ShareImagePageState extends State<ShareImagePage> {
_imagePath
=
value
;
},
keyboardType:
TextInputType
.
multiline
,
),
TextField
(
decoration:
InputDecoration
(
labelText:
"缩略地址"
),
...
...
example/lib/share_mini_program.dart
浏览文件 @
23d8a8d5
...
...
@@ -7,16 +7,15 @@ class ShareMiniProgramPage extends StatefulWidget {
}
class
_ShareMiniProgramPageState
extends
State
<
ShareMiniProgramPage
>
{
Fluwx
fluwx
;
WeChatScene
scene
=
WeChatScene
.
SESSION
;
String
_webPageUrl
=
"http://www.qq.com"
;
String
_webPageUrl
=
"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"
;
String
_title
=
"Fluwx"
;
String
_userName
=
"gh_d43f693ca31f"
;
String
_path
=
"/pages/media"
;
String
_description
=
"Fluwx"
;
@override
void
initState
()
{
...
...
@@ -24,74 +23,66 @@ class _ShareMiniProgramPageState extends State<ShareMiniProgramPage> {
fluwx
=
new
Fluwx
();
}
@override
Widget
build
(
BuildContext
context
)
{
return
new
Scaffold
(
return
new
Scaffold
(
appBar:
AppBar
(
title:
const
Text
(
"ShareMiniProgram"
),
actions:
<
Widget
>[
IconButton
(
icon:
Icon
(
Icons
.
share
,
color:
Colors
.
white
,),
onPressed:
_share
)
IconButton
(
icon:
Icon
(
Icons
.
share
,
color:
Colors
.
white
,
),
onPressed:
_share
)
],
),
body:
Padding
(
padding:
const
EdgeInsets
.
all
(
8.0
),
child:
new
ListView
(
children:
<
Widget
>[
new
TextField
(
controller:
TextEditingController
(
text:
"http://www.qq.com"
),
onChanged:
(
str
){
onChanged:
(
str
)
{
_webPageUrl
=
str
;
},
decoration:
InputDecoration
(
labelText:
"web page url"
),
decoration:
InputDecoration
(
labelText:
"web page url"
),
),
new
TextField
(
controller:
TextEditingController
(
text:
"gh_d43f693ca31f"
),
onChanged:
(
str
){
onChanged:
(
str
)
{
_userName
=
str
;
},
decoration:
InputDecoration
(
labelText:
"user name"
),
decoration:
InputDecoration
(
labelText:
"user name"
),
),
new
TextField
(
controller:
TextEditingController
(
text:
"/pages/media"
),
onChanged:
(
str
){
onChanged:
(
str
)
{
_path
=
str
;
},
decoration:
InputDecoration
(
labelText:
"user name"
),
decoration:
InputDecoration
(
labelText:
"user name"
),
),
new
TextField
(
controller:
TextEditingController
(
text:
"Fluwx"
),
onChanged:
(
str
){
onChanged:
(
str
)
{
_title
=
str
;
},
decoration:
InputDecoration
(
labelText:
"title"
),
decoration:
InputDecoration
(
labelText:
"title"
),
),
new
TextField
(
controller:
TextEditingController
(
text:
"Fluwx"
),
onChanged:
(
str
){
onChanged:
(
str
)
{
_description
=
str
;
},
decoration:
InputDecoration
(
labelText:
"description"
),
decoration:
InputDecoration
(
labelText:
"description"
),
),
new
TextField
(
controller:
TextEditingController
(
text:
"assets://images/logo.png"
),
onChanged:
(
str
){
controller:
TextEditingController
(
text:
"assets://images/logo.png"
),
onChanged:
(
str
)
{
_thumbnail
=
str
;
},
decoration:
InputDecoration
(
labelText:
"thumbnail"
),
decoration:
InputDecoration
(
labelText:
"thumbnail"
),
),
],
),
...
...
@@ -100,16 +91,13 @@ class _ShareMiniProgramPageState extends State<ShareMiniProgramPage> {
}
void
_share
()
{
var
model
=
new
WeChatShareMiniProgramModel
(
webPageUrl:
_webPageUrl
,
miniProgramType:
WeChatShareMiniProgramModel
.
MINI_PROGRAM_TYPE_RELEASE
,
userName:
_userName
,
title:
_title
,
description:
_description
,
thumbnail:
_thumbnail
);
var
model
=
new
WeChatShareMiniProgramModel
(
webPageUrl:
_webPageUrl
,
miniProgramType:
WeChatShareMiniProgramModel
.
MINI_PROGRAM_TYPE_RELEASE
,
userName:
_userName
,
title:
_title
,
description:
_description
,
thumbnail:
_thumbnail
);
fluwx
.
share
(
model
);
}
}
example/lib/share_music.dart
浏览文件 @
23d8a8d5
import
'package:flutter/material.dart'
;
import
'package:fluwx/fluwx.dart'
;
...
...
@@ -9,11 +8,12 @@ class ShareMusicPage extends StatefulWidget {
class
_ShareMusicPageState
extends
State
<
ShareMusicPage
>
{
Fluwx
fluwx
;
String
_musicUrl
=
"http://staff2.ustc.edu.cn/~wdw/softdown/index.asp/0042515_05.ANDY.mp3"
;
String
_musicLowBandUrl
=
"http://www.qq.com"
;
String
_musicUrl
=
"http://staff2.ustc.edu.cn/~wdw/softdown/index.asp/0042515_05.ANDY.mp3"
;
String
_musicLowBandUrl
=
"http://www.qq.com"
;
String
_title
=
"Beyond"
;
String
_description
=
"A Popular Rock Band From China"
;
String
_thumnail
=
"assets://images/logo.png"
;
String
_thumnail
=
"assets://images/logo.png"
;
WeChatScene
scene
=
WeChatScene
.
SESSION
;
@override
...
...
@@ -28,58 +28,56 @@ class _ShareMusicPageState extends State<ShareMusicPage> {
appBar:
AppBar
(
title:
const
Text
(
"ShareMusicPage"
),
actions:
<
Widget
>[
IconButton
(
icon:
Icon
(
Icons
.
share
,
color:
Colors
.
white
,),
onPressed:
_share
)
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://staff2.ustc.edu.cn/~wdw/softdown/index.asp/0042515_05.ANDY.mp3"
),
onChanged:
(
str
){
controller:
TextEditingController
(
text:
"http://staff2.ustc.edu.cn/~wdw/softdown/index.asp/0042515_05.ANDY.mp3"
),
onChanged:
(
str
)
{
_musicUrl
=
str
;
},
decoration:
InputDecoration
(
labelText:
"music url"
),
decoration:
InputDecoration
(
labelText:
"music url"
),
),
new
TextField
(
controller:
TextEditingController
(
text:
"http://www.qq.com"
),
onChanged:
(
str
){
onChanged:
(
str
)
{
_musicLowBandUrl
=
str
;
},
decoration:
InputDecoration
(
labelText:
"music low band url"
),
decoration:
InputDecoration
(
labelText:
"music low band url"
),
),
new
TextField
(
controller:
TextEditingController
(
text:
"Beyond"
),
onChanged:
(
str
){
onChanged:
(
str
)
{
_title
=
str
;
},
decoration:
InputDecoration
(
labelText:
"title"
),
decoration:
InputDecoration
(
labelText:
"title"
),
),
new
TextField
(
controller:
TextEditingController
(
text:
"A Popular Rock Band From China"
),
onChanged:
(
str
){
controller:
TextEditingController
(
text:
"A Popular Rock Band From China"
),
onChanged:
(
str
)
{
_description
=
str
;
},
decoration:
InputDecoration
(
labelText:
"description"
),
decoration:
InputDecoration
(
labelText:
"description"
),
),
new
TextField
(
controller:
TextEditingController
(
text:
"assets://images/logo.png"
),
onChanged:
(
str
){
controller:
TextEditingController
(
text:
"assets://images/logo.png"
),
onChanged:
(
str
)
{
_thumnail
=
str
;
},
decoration:
InputDecoration
(
labelText:
"thumbnail"
),
decoration:
InputDecoration
(
labelText:
"thumbnail"
),
),
new
Row
(
children:
<
Widget
>[
...
...
@@ -89,8 +87,7 @@ class _ShareMusicPageState extends State<ShareMusicPage> {
new
Radio
<
WeChatScene
>(
value:
WeChatScene
.
SESSION
,
groupValue:
scene
,
onChanged:
handleRadioValueChanged
),
onChanged:
handleRadioValueChanged
),
const
Text
(
"会话"
)
],
),
...
...
@@ -99,8 +96,7 @@ class _ShareMusicPageState extends State<ShareMusicPage> {
new
Radio
<
WeChatScene
>(
value:
WeChatScene
.
TIMELINE
,
groupValue:
scene
,
onChanged:
handleRadioValueChanged
),
onChanged:
handleRadioValueChanged
),
const
Text
(
"朋友圈"
)
],
),
...
...
@@ -109,8 +105,7 @@ class _ShareMusicPageState extends State<ShareMusicPage> {
new
Radio
<
WeChatScene
>(
value:
WeChatScene
.
FAVORITE
,
groupValue:
scene
,
onChanged:
handleRadioValueChanged
),
onChanged:
handleRadioValueChanged
),
const
Text
(
"收藏"
)
],
)
...
...
@@ -124,18 +119,17 @@ class _ShareMusicPageState extends State<ShareMusicPage> {
void
_share
()
{
var
model
=
WeChatShareMusicModel
(
title:
_title
,
description:
_description
,
transaction:
"music"
,
musicUrl:
_musicUrl
,
title:
_title
,
description:
_description
,
transaction:
"music"
,
musicUrl:
_musicUrl
,
musicLowBandUrl:
_musicLowBandUrl
,
thumbnail:
_thumnail
);
thumbnail:
_thumnail
);
fluwx
.
share
(
model
);
}
void
handleRadioValueChanged
(
WeChatScene
scene
){
void
handleRadioValueChanged
(
WeChatScene
scene
)
{
setState
(()
{
this
.
scene
=
scene
;
});
...
...
example/lib/share_text_image.dart
浏览文件 @
23d8a8d5
...
...
@@ -10,34 +10,37 @@ class _ShareTextPageState extends State<ShareTextPage> {
Fluwx
fluwx
;
String
_text
=
"share text from fluwx"
;
WeChatScene
scene
=
WeChatScene
.
SESSION
;
@override
void
initState
()
{
super
.
initState
();
fluwx
=
new
Fluwx
();
}
@override
Widget
build
(
BuildContext
context
)
{
return
new
Scaffold
(
appBar:
AppBar
(
title:
const
Text
(
"ShareText"
),
actions:
<
Widget
>[
IconButton
(
icon:
Icon
(
Icons
.
share
,
color:
Colors
.
white
,),
onPressed:
_shareText
)
IconButton
(
icon:
Icon
(
Icons
.
share
,
color:
Colors
.
white
,
),
onPressed:
_shareText
)
],
),
body:
Padding
(
padding:
const
EdgeInsets
.
all
(
8.0
),
child:
new
Column
(
children:
<
Widget
>[
new
TextField
(
controller:
TextEditingController
(
text:
"share text from fluwx"
),
onChanged:
(
str
){
_text
=
str
;
onChanged:
(
str
)
{
_text
=
str
;
},
decoration:
InputDecoration
(
labelText:
"TextToShare"
),
decoration:
InputDecoration
(
labelText:
"TextToShare"
),
),
new
Row
(
children:
<
Widget
>[
...
...
@@ -47,8 +50,7 @@ class _ShareTextPageState extends State<ShareTextPage> {
new
Radio
<
WeChatScene
>(
value:
WeChatScene
.
SESSION
,
groupValue:
scene
,
onChanged:
handleRadioValueChanged
),
onChanged:
handleRadioValueChanged
),
const
Text
(
"会话"
)
],
),
...
...
@@ -57,8 +59,7 @@ class _ShareTextPageState extends State<ShareTextPage> {
new
Radio
<
WeChatScene
>(
value:
WeChatScene
.
TIMELINE
,
groupValue:
scene
,
onChanged:
handleRadioValueChanged
),
onChanged:
handleRadioValueChanged
),
const
Text
(
"朋友圈"
)
],
),
...
...
@@ -67,8 +68,7 @@ class _ShareTextPageState extends State<ShareTextPage> {
new
Radio
<
WeChatScene
>(
value:
WeChatScene
.
FAVORITE
,
groupValue:
scene
,
onChanged:
handleRadioValueChanged
),
onChanged:
handleRadioValueChanged
),
const
Text
(
"收藏"
)
],
)
...
...
@@ -79,17 +79,17 @@ class _ShareTextPageState extends State<ShareTextPage> {
),
);
}
void
_shareText
(){
void
_shareText
()
{
fluwx
.
share
(
WeChatShareTextModel
(
text:
_text
,
transaction:
"text
${DateTime.now().millisecondsSinceEpoch}
"
,
scene:
scene
));
text:
_text
,
transaction:
"text
${DateTime.now().millisecondsSinceEpoch}
"
,
scene:
scene
));
// fluwx.sendAuth(WeChatSendAuthModel(scope: "snsapi_userinfo",state: "wechat_sdk_demo_test"));
}
void
handleRadioValueChanged
(
WeChatScene
scene
){
void
handleRadioValueChanged
(
WeChatScene
scene
)
{
setState
(()
{
this
.
scene
=
scene
;
});
...
...
example/lib/share_video_page.dart
浏览文件 @
23d8a8d5
import
'package:flutter/material.dart'
;
import
'package:fluwx/fluwx.dart'
;
...
...
@@ -10,10 +9,10 @@ class ShareVideoPage extends StatefulWidget {
class
_ShareMusicPageState
extends
State
<
ShareVideoPage
>
{
Fluwx
fluwx
;
String
_videoUrl
=
"http://www.qq.com"
;
String
_videoLowBandUrl
=
"http://www.qq.com"
;
String
_videoLowBandUrl
=
"http://www.qq.com"
;
String
_title
=
"Beyond"
;
String
_description
=
"A Popular Rock Band From China"
;
String
_thumnail
=
"assets://images/logo.png"
;
String
_thumnail
=
"assets://images/logo.png"
;
WeChatScene
scene
=
WeChatScene
.
SESSION
;
@override
...
...
@@ -28,58 +27,56 @@ class _ShareMusicPageState extends State<ShareVideoPage> {
appBar:
AppBar
(
title:
const
Text
(
"ShareVideoPage"
),
actions:
<
Widget
>[
IconButton
(
icon:
Icon
(
Icons
.
share
,
color:
Colors
.
white
,),
onPressed:
_share
)
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://staff2.ustc.edu.cn/~wdw/softdown/index.asp/0042515_05.ANDY.mp3"
),
onChanged:
(
str
){
controller:
TextEditingController
(
text:
"http://staff2.ustc.edu.cn/~wdw/softdown/index.asp/0042515_05.ANDY.mp3"
),
onChanged:
(
str
)
{
_videoUrl
=
str
;
},
decoration:
InputDecoration
(
labelText:
"video url"
),
decoration:
InputDecoration
(
labelText:
"video url"
),
),
new
TextField
(
controller:
TextEditingController
(
text:
"http://www.qq.com"
),
onChanged:
(
str
){
onChanged:
(
str
)
{
_videoLowBandUrl
=
str
;
},
decoration:
InputDecoration
(
labelText:
"video low band url"
),
decoration:
InputDecoration
(
labelText:
"video low band url"
),
),
new
TextField
(
controller:
TextEditingController
(
text:
"Beyond"
),
onChanged:
(
str
){
onChanged:
(
str
)
{
_title
=
str
;
},
decoration:
InputDecoration
(
labelText:
"title"
),
decoration:
InputDecoration
(
labelText:
"title"
),
),
new
TextField
(
controller:
TextEditingController
(
text:
"A Popular Rock Band From China"
),
onChanged:
(
str
){
controller:
TextEditingController
(
text:
"A Popular Rock Band From China"
),
onChanged:
(
str
)
{
_description
=
str
;
},
decoration:
InputDecoration
(
labelText:
"description"
),
decoration:
InputDecoration
(
labelText:
"description"
),
),
new
TextField
(
controller:
TextEditingController
(
text:
"assets://images/logo.png"
),
onChanged:
(
str
){
controller:
TextEditingController
(
text:
"assets://images/logo.png"
),
onChanged:
(
str
)
{
_thumnail
=
str
;
},
decoration:
InputDecoration
(
labelText:
"thumbnail"
),
decoration:
InputDecoration
(
labelText:
"thumbnail"
),
),
new
Row
(
children:
<
Widget
>[
...
...
@@ -89,8 +86,7 @@ class _ShareMusicPageState extends State<ShareVideoPage> {
new
Radio
<
WeChatScene
>(
value:
WeChatScene
.
SESSION
,
groupValue:
scene
,
onChanged:
handleRadioValueChanged
),
onChanged:
handleRadioValueChanged
),
const
Text
(
"会话"
)
],
),
...
...
@@ -99,8 +95,7 @@ class _ShareMusicPageState extends State<ShareVideoPage> {
new
Radio
<
WeChatScene
>(
value:
WeChatScene
.
TIMELINE
,
groupValue:
scene
,
onChanged:
handleRadioValueChanged
),
onChanged:
handleRadioValueChanged
),
const
Text
(
"朋友圈"
)
],
),
...
...
@@ -109,8 +104,7 @@ class _ShareMusicPageState extends State<ShareVideoPage> {
new
Radio
<
WeChatScene
>(
value:
WeChatScene
.
FAVORITE
,
groupValue:
scene
,
onChanged:
handleRadioValueChanged
),
onChanged:
handleRadioValueChanged
),
const
Text
(
"收藏"
)
],
)
...
...
@@ -124,17 +118,16 @@ class _ShareMusicPageState extends State<ShareVideoPage> {
void
_share
()
{
var
model
=
new
WeChatShareVideoModel
(
videoUrl:
_videoUrl
,
transaction:
"video"
,
videoLowBandUrl:
_videoLowBandUrl
,
thumbnail:
_thumnail
,
description:
_description
,
title:
_title
);
videoUrl:
_videoUrl
,
transaction:
"video"
,
videoLowBandUrl:
_videoLowBandUrl
,
thumbnail:
_thumnail
,
description:
_description
,
title:
_title
);
fluwx
.
share
(
model
);
}
void
handleRadioValueChanged
(
WeChatScene
scene
){
void
handleRadioValueChanged
(
WeChatScene
scene
)
{
setState
(()
{
this
.
scene
=
scene
;
});
...
...
example/lib/share_web_page.dart
浏览文件 @
23d8a8d5
...
...
@@ -12,7 +12,7 @@ class ShareWebPagePageState extends State<ShareWebPagePage> {
Fluwx
fluwx
;
String
_url
=
"share text from fluwx"
;
String
_title
=
"Fluwx"
;
String
_thumnail
=
"assets://images/logo.png"
;
String
_thumnail
=
"assets://images/logo.png"
;
WeChatScene
scene
=
WeChatScene
.
SESSION
;
@override
...
...
@@ -27,40 +27,40 @@ class ShareWebPagePageState extends State<ShareWebPagePage> {
appBar:
AppBar
(
title:
const
Text
(
"ShareWebPage"
),
actions:
<
Widget
>[
IconButton
(
icon:
Icon
(
Icons
.
share
,
color:
Colors
.
white
,),
onPressed:
_share
)
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:
"https://github.com/JarvanMo/fluwx"
),
onChanged:
(
str
){
controller:
TextEditingController
(
text:
"https://github.com/JarvanMo/fluwx"
),
onChanged:
(
str
)
{
_url
=
str
;
},
decoration:
InputDecoration
(
labelText:
"web page"
),
decoration:
InputDecoration
(
labelText:
"web page"
),
),
new
TextField
(
controller:
TextEditingController
(
text:
"Fluwx"
),
onChanged:
(
str
){
onChanged:
(
str
)
{
_title
=
str
;
},
decoration:
InputDecoration
(
labelText:
"thumbnail"
),
decoration:
InputDecoration
(
labelText:
"thumbnail"
),
),
new
TextField
(
controller:
TextEditingController
(
text:
"assets://images/logo.png"
),
onChanged:
(
str
){
controller:
TextEditingController
(
text:
"assets://images/logo.png"
),
onChanged:
(
str
)
{
_thumnail
=
str
;
},
decoration:
InputDecoration
(
labelText:
"thumbnail"
),
decoration:
InputDecoration
(
labelText:
"thumbnail"
),
),
new
Row
(
children:
<
Widget
>[
...
...
@@ -70,8 +70,7 @@ class ShareWebPagePageState extends State<ShareWebPagePage> {
new
Radio
<
WeChatScene
>(
value:
WeChatScene
.
SESSION
,
groupValue:
scene
,
onChanged:
handleRadioValueChanged
),
onChanged:
handleRadioValueChanged
),
const
Text
(
"会话"
)
],
),
...
...
@@ -80,8 +79,7 @@ class ShareWebPagePageState extends State<ShareWebPagePage> {
new
Radio
<
WeChatScene
>(
value:
WeChatScene
.
TIMELINE
,
groupValue:
scene
,
onChanged:
handleRadioValueChanged
),
onChanged:
handleRadioValueChanged
),
const
Text
(
"朋友圈"
)
],
),
...
...
@@ -90,8 +88,7 @@ class ShareWebPagePageState extends State<ShareWebPagePage> {
new
Radio
<
WeChatScene
>(
value:
WeChatScene
.
FAVORITE
,
groupValue:
scene
,
onChanged:
handleRadioValueChanged
),
onChanged:
handleRadioValueChanged
),
const
Text
(
"收藏"
)
],
)
...
...
@@ -104,17 +101,16 @@ class ShareWebPagePageState extends State<ShareWebPagePage> {
}
void
_share
()
{
var
model
=
WeChatShareWebPageModel
(
var
model
=
WeChatShareWebPageModel
(
webPage:
_url
,
title:
_title
,
thumbnail:
_thumnail
,
scene
:
scene
,
transaction:
"hh"
);
fluwx
.
share
(
model
);
scene:
scene
,
transaction:
"hh"
);
fluwx
.
share
(
model
);
}
void
handleRadioValueChanged
(
WeChatScene
scene
){
void
handleRadioValueChanged
(
WeChatScene
scene
)
{
setState
(()
{
this
.
scene
=
scene
;
});
...
...
example/test/widget_test.dart
浏览文件 @
23d8a8d5
...
...
@@ -4,9 +4,6 @@
// find child widgets in the widget tree, read text, and verify that the values of widget properties
// are correct.
import
'package:flutter/material.dart'
;
void
main
(
)
{
// testWidgets('Verify Platform version', (WidgetTester tester) async {
// // 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;
export
'src/fluwx_class.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/wechat_reponse.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';
import
'package:flutter/services.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_response.dart'
;
import
'models/wechat_send_auth_model.dart'
;
import
'models/wechat_share_models.dart'
;
StreamController
<
WeChatResponse
>
_responseController
=
new
StreamController
.
broadcast
();
...
...
@@ -16,11 +16,14 @@ final MethodChannel _channel = const MethodChannel('com.jarvanmo/fluwx')
Future
<
dynamic
>
_handler
(
MethodCall
methodCall
)
{
if
(
"onShareResponse"
==
methodCall
.
method
)
{
_responseController
.
add
(
WeChatResponse
(
methodCall
.
arguments
,
ResponseType
.
SHARE
));
_responseController
.
add
(
WeChatResponse
(
methodCall
.
arguments
,
ResponseType
.
SHARE
));
}
else
if
(
"onAuthResponse"
==
methodCall
.
method
)
{
_responseController
.
add
(
WeChatResponse
(
methodCall
.
arguments
,
ResponseType
.
AUTH
));
_responseController
.
add
(
WeChatResponse
(
methodCall
.
arguments
,
ResponseType
.
AUTH
));
}
else
if
(
"onPayResponse"
==
methodCall
.
method
)
{
_responseController
.
add
(
WeChatResponse
(
methodCall
.
arguments
,
ResponseType
.
PAYMENT
));
_responseController
.
add
(
WeChatResponse
(
methodCall
.
arguments
,
ResponseType
.
PAYMENT
));
}
return
Future
.
value
(
true
);
...
...
@@ -44,7 +47,7 @@ class Fluwx {
}
///we don't need the response any longer.
static
void
dispose
(){
static
void
dispose
()
{
_responseController
.
close
();
}
...
...
@@ -52,7 +55,6 @@ class Fluwx {
// return await _channel.invokeMethod("unregisterApp", model.toMap());
// }
///the [model] can not be null
///see [WeChatShareWebPageModel]
/// [WeChatShareTextModel]
...
...
lib/src/models/wechat_pay_model.dart
浏览文件 @
23d8a8d5
import
'package:flutter/foundation.dart'
;
class
WeChatPayModel
{
class
WeChatPayModel
{
final
appId
;
final
partnerId
;
final
prepayId
;
...
...
@@ -11,24 +11,28 @@ class WeChatPayModel{
final
signType
;
final
extData
;
WeChatPayModel
({
@required
this
.
appId
,
@required
this
.
partnerId
,
@required
this
.
prepayId
,
@required
this
.
packageValue
,
@required
this
.
nonceStr
,
@required
this
.
timeStamp
,
@required
this
.
sign
,
this
.
signType
,
this
.
extData
});
WeChatPayModel
(
{
@required
this
.
appId
,
@required
this
.
partnerId
,
@required
this
.
prepayId
,
@required
this
.
packageValue
,
@required
this
.
nonceStr
,
@required
this
.
timeStamp
,
@required
this
.
sign
,
this
.
signType
,
this
.
extData
});
Map
toMap
()
{
return
{
"appId"
:
appId
,
"partnerId"
:
partnerId
,
"prepayId"
:
prepayId
,
"packageValue"
:
packageValue
,
"nonceStr"
:
nonceStr
,
"timeStamp"
:
timeStamp
,
"sign"
:
sign
,
"signType"
:
signType
,
"extData"
:
extData
,
"appId"
:
appId
,
"partnerId"
:
partnerId
,
"prepayId"
:
prepayId
,
"packageValue"
:
packageValue
,
"nonceStr"
:
nonceStr
,
"timeStamp"
:
timeStamp
,
"sign"
:
sign
,
"signType"
:
signType
,
"extData"
:
extData
,
};
}
}
\ No newline at end of file
}
lib/src/models/wechat_send_auth_model.dart
浏览文件 @
23d8a8d5
import
'package:flutter/foundation.dart'
;
class
WeChatSendAuthModel
{
final
String
scope
;
final
String
state
;
final
String
openId
;
WeChatSendAuthModel
({
@required
this
.
scope
,
this
.
state
,
this
.
openId
})
:
assert
(
scope
!=
null
&&
scope
.
trim
()
.
isNotEmpty
);
WeChatSendAuthModel
({
@required
this
.
scope
,
this
.
state
,
this
.
openId
})
:
assert
(
scope
!=
null
&&
scope
.
trim
().
isNotEmpty
);
Map
toMap
()
{
return
{
"scope"
:
scope
,
"state"
:
state
,
"openId"
:
openId
};
return
{
"scope"
:
scope
,
"state"
:
state
,
"openId"
:
openId
};
}
}
\ No newline at end of file
}
lib/src/wechat_scene.dart
浏览文件 @
23d8a8d5
///[WeChatScene.SESSION]会话
///[WeChatScene.TIMELINE]朋友圈
///[WeChatScene.FAVORITE]收藏
enum
WeChatScene
{
SESSION
,
TIMELINE
,
FAVORITE
}
enum
WeChatScene
{
SESSION
,
TIMELINE
,
FAVORITE
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论