Browse Source

充值, 權限。。

null_safety
fmk 4 years ago
parent
commit
b6a321e1ca
  1. 2
      android/app/build.gradle
  2. BIN
      android/app/libs/wechat-sdk-android-without-mta-6.6.5.aar
  3. 9
      android/app/src/main/AndroidManifest.xml
  4. 2
      android/app/src/main/assets/data/dcloud_control.xml
  5. 65
      android/app/src/main/kotlin/com/zsw/huixiang/wxapi/WXPayEntryActivity.kt
  6. 2
      android/build.gradle
  7. BIN
      assets/image/2x/icon_permission_storage.png
  8. BIN
      assets/image/3x/icon_permission_storage.png
  9. BIN
      assets/image/icon_permission_storage.png
  10. 10
      ios/Podfile.lock
  11. 4
      ios/Runner/Info.plist
  12. 6
      lib/generated/intl/messages_en.dart
  13. 6
      lib/generated/intl/messages_zh_CN.dart
  14. 6
      lib/generated/intl/messages_zh_TW.dart
  15. 32
      lib/generated/l10n.dart
  16. 91
      lib/home/activity_list_page.dart
  17. 120
      lib/home/home_page.dart
  18. 5
      lib/l10n/intl_en.arb
  19. 5
      lib/l10n/intl_zh_CN.arb
  20. 5
      lib/l10n/intl_zh_TW.arb
  21. 119
      lib/mine/mine_wallet_page.dart
  22. 239
      lib/mine/recharge_page.dart
  23. 5
      lib/retrofit/data/banner.dart
  24. 65
      lib/retrofit/data/wx_pay.dart
  25. 13
      lib/retrofit/retrofit_api.dart
  26. 4
      lib/retrofit/retrofit_api.g.dart
  27. 189
      lib/setting/permission_setting_page.dart
  28. 100
      lib/setting/setting_page.dart
  29. 2
      lib/union/union_details_page.dart
  30. 19
      lib/union/union_page.dart
  31. 13
      lib/view_widget/item_input_widget.dart
  32. 300
      pubspec.lock
  33. 4
      pubspec.yaml

2
android/app/build.gradle

@ -98,6 +98,8 @@ dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.tencent.mm.opensdk:wechat-sdk-android-without-mta:6.6.5'
implementation fileTree(include: ['*.aar'], dir: 'libs')
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.appcompat:appcompat:1.2.0'

BIN
android/app/libs/wechat-sdk-android-without-mta-6.6.5.aar

Binary file not shown.

9
android/app/src/main/AndroidManifest.xml

@ -60,12 +60,19 @@
</intent-filter>
</activity>
<meta-data android:name="WX_APPID" android:value="wx3b269e795ed23e5f" />
<meta-data android:name="weChatAppId" android:value="wx3b269e795ed23e5f" />
<meta-data android:name="WX_SECRET" android:value="c7e6d17959743ca40602acb402292e2b"/>
<activity
android:name="com.zsw.huixiang.wxapi.WXPayEntryActivity"
android:exported="true"
android:theme="@android:style/Theme.Translucent.NoTitleBar"
android:launchMode="singleTop" />
android:launchMode="singleTop" >
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="sdksample" />
</intent-filter>
</activity>
<activity
android:name="com.yalantis.ucrop.UCropActivity"
android:screenOrientation="portrait"

2
android/app/src/main/assets/data/dcloud_control.xml

@ -1,4 +1,4 @@
<hbuilder version="1.9.9.80110" debug="false" syncDebug ="true">
<hbuilder version="1.9.9.80110" debug="false" syncDebug ="false">
<apps>
<app appid="__UNI__ACD00DA" appver="1.0"/>
<app appid="__UNI__E60E056" appver="1.0"/>

65
android/app/src/main/kotlin/com/zsw/huixiang/wxapi/WXPayEntryActivity.kt

@ -1,29 +1,86 @@
package com.zsw.huixiang.wxapi
import android.content.Intent
import android.content.pm.PackageManager
import android.os.Bundle
import android.util.Log
import com.jarvan.fluwx.handlers.FluwxRequestHandler
import com.jarvan.fluwx.handlers.FluwxResponseHandler
import com.jarvan.fluwx.handlers.WXAPiHandler
import com.tencent.mm.opensdk.modelbase.BaseReq
import com.tencent.mm.opensdk.modelbase.BaseResp
import io.dcloud.feature.payment.weixin.AbsWXPayCallbackActivity
class WXPayEntryActivity : AbsWXPayCallbackActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
try {
if (!WXAPiHandler.wxApiRegistered) {
var appInfo = packageManager.getApplicationInfo(packageName, PackageManager.GET_META_DATA)
val wechatAppId = appInfo.metaData.getString("weChatAppId")
if (wechatAppId != null ){
WXAPiHandler.setupWxApi(wechatAppId, this)
WXAPiHandler.setCoolBool(true)
io.flutter.Log.d("fluwx", "weChatAppId:$wechatAppId")
}else {
io.flutter.Log.e("fluwx", "can't load meta-data weChatAppId")
}
}
WXAPiHandler.wxApi?.handleIntent(intent, this)
} catch (e: Exception) {
e.printStackTrace()
startSpecifiedActivity(defaultFlutterActivityAction())
finish()
}
Log.e("WXPayEntryActivity", "onCreate")
}
override fun onReq(req: BaseReq?) {
override fun onNewIntent(intent: Intent) {
super.onNewIntent(intent)
setIntent(intent)
try {
WXAPiHandler.wxApi?.handleIntent(intent, this)
} catch (e: Exception) {
e.printStackTrace()
startSpecifiedActivity(defaultFlutterActivityAction())
finish()
}
}
override fun onReq(req: BaseReq) {
super.onReq(req)
FluwxRequestHandler.onReq(req, this)
Log.e("WXPayEntryActivity", "req: $req")
}
override fun onResp(resp: BaseResp?) {
override fun onResp(resp: BaseResp) {
FluwxResponseHandler.handleResponse(resp)
super.onResp(resp)
Log.e("WXPayEntryActivity", "resp: $resp")
}
private fun startSpecifiedActivity(action: String, bundle: Bundle? = null, bundleKey: String? = null) {
Intent(action).run {
bundleKey?.let {
putExtra(bundleKey, bundle)
}
addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT)
packageManager?.let {
resolveActivity(packageManager)?.also {
startActivity(this)
finish()
}
}
}
}
private fun defaultFlutterActivityAction(): String = "$packageName.FlutterActivity"
}

2
android/build.gradle

@ -1,5 +1,5 @@
buildscript {
ext.kotlin_version = '1.3.50'
ext.kotlin_version = '1.4.10'
repositories {
maven {
url 'https://maven.aliyun.com/repository/google'

BIN
assets/image/2x/icon_permission_storage.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 618 B

BIN
assets/image/3x/icon_permission_storage.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
assets/image/icon_permission_storage.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 344 B

10
ios/Podfile.lock

@ -11,6 +11,9 @@ PODS:
- AMapLocation (2.6.8):
- AMapFoundation (~> 1.6.4)
- Flutter (1.0.0)
- fluwx (0.0.1):
- Flutter
- WechatOpenSDK (= 1.8.7.1)
- FMDB (2.7.5):
- FMDB/standard (= 2.7.5)
- FMDB/standard (2.7.5)
@ -39,11 +42,13 @@ PODS:
- Flutter
- webview_flutter (0.0.1):
- Flutter
- WechatOpenSDK (1.8.7.1)
DEPENDENCIES:
- amap_flutter_location (from `.symlinks/plugins/amap_flutter_location/ios`)
- amap_flutter_map (from `.symlinks/plugins/amap_flutter_map/ios`)
- Flutter (from `Flutter`)
- fluwx (from `.symlinks/plugins/fluwx/ios`)
- image_cropper (from `.symlinks/plugins/image_cropper/ios`)
- image_picker (from `.symlinks/plugins/image_picker/ios`)
- package_info (from `.symlinks/plugins/package_info/ios`)
@ -63,6 +68,7 @@ SPEC REPOS:
- AMapLocation
- FMDB
- TOCropViewController
- WechatOpenSDK
EXTERNAL SOURCES:
amap_flutter_location:
@ -71,6 +77,8 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/amap_flutter_map/ios"
Flutter:
:path: Flutter
fluwx:
:path: ".symlinks/plugins/fluwx/ios"
image_cropper:
:path: ".symlinks/plugins/image_cropper/ios"
image_picker:
@ -101,6 +109,7 @@ SPEC CHECKSUMS:
AMapFoundation: c7da72b42a713f1429c88af1858d623dde88934b
AMapLocation: dad27669c4ca68e395ce7532ff614b7d4d45f7b7
Flutter: 434fef37c0980e73bb6479ef766c45957d4b510c
fluwx: 07a55ed66bf3a4961e836a2a411b02dcada32902
FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a
image_cropper: f1668dd8d2cad2d357955caad15a40547856edcb
image_picker: 9c3312491f862b28d21ecd8fdf0ee14e601b3f09
@ -114,6 +123,7 @@ SPEC CHECKSUMS:
video_player: 9cc823b1d9da7e8427ee591e8438bfbcde500e6e
wakelock: bfc7955c418d0db797614075aabbc58a39ab5107
webview_flutter: d2b4d6c66968ad042ad94cbb791f5b72b4678a96
WechatOpenSDK: 6a4d1436c15b3b5fe2a0bd383f3046010186da44
PODFILE CHECKSUM: 3dec887221b0cf3fccf2bbd3f50f36c0ad0bcbeb

4
ios/Runner/Info.plist

@ -2,6 +2,10 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleURLSchemes</key>
<array>
<string>wx3b269e795ed23e5f</string>
</array>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleDisplayName</key>

6
lib/generated/intl/messages_en.dart

@ -104,6 +104,8 @@ class MessageLookup extends MessageLookupByLibrary {
"chuangjianshijian" : m2,
"chuangshirendegushi" : MessageLookupByLibrary.simpleMessage("创始人的故事"),
"code_error" : MessageLookupByLibrary.simpleMessage("验证码输入错误"),
"cunchu" : MessageLookupByLibrary.simpleMessage("存储"),
"cunchutishixinxi" : MessageLookupByLibrary.simpleMessage("为了获得照片使用、缓存等功能,推荐您在使用期间打开存储权限"),
"daifukuan" : MessageLookupByLibrary.simpleMessage("待付款"),
"daipeisong" : MessageLookupByLibrary.simpleMessage("待配送"),
"daiqucan" : MessageLookupByLibrary.simpleMessage("待取餐"),
@ -139,7 +141,6 @@ class MessageLookup extends MessageLookupByLibrary {
"duihuanlishi" : MessageLookupByLibrary.simpleMessage("兑换历史"),
"duihuanshangpinxiangqing" : MessageLookupByLibrary.simpleMessage("兑换商品详情"),
"duihuanxinxi" : MessageLookupByLibrary.simpleMessage("兑换信息"),
"faceidtishixinxi" : MessageLookupByLibrary.simpleMessage("为了更好的保护账户安全支付更便捷,推荐您在使用期间让我们使用Face ID"),
"fanhuiduihuanlishi" : MessageLookupByLibrary.simpleMessage("返回兑换历史"),
"fankui" : MessageLookupByLibrary.simpleMessage("反馈"),
"fantizhongwen" : MessageLookupByLibrary.simpleMessage("繁体中文"),
@ -267,7 +268,7 @@ class MessageLookup extends MessageLookupByLibrary {
"qianwanghuixiangmendianduihuanhexiao" : MessageLookupByLibrary.simpleMessage("前往一心回乡旗下任意门店对工作人员出示商品兑换码,核实无误后,可领取对应商品"),
"qinglihuancun" : MessageLookupByLibrary.simpleMessage("清理缓存"),
"qingshurubeizhuyaoqiu" : MessageLookupByLibrary.simpleMessage("请输入备注要求"),
"qingshuruchongzhijine" : MessageLookupByLibrary.simpleMessage("输入充值金额(元)"),
"qingshuruchongzhijine" : MessageLookupByLibrary.simpleMessage("输入充值金额"),
"qingshurushoujihao" : MessageLookupByLibrary.simpleMessage("请输入手机号"),
"qingshuruyanzhengma" : MessageLookupByLibrary.simpleMessage("请输入验证码"),
"qingshuruzhifumima" : MessageLookupByLibrary.simpleMessage("请输入支付密码"),
@ -405,6 +406,7 @@ class MessageLookup extends MessageLookupByLibrary {
"yishiming" : MessageLookupByLibrary.simpleMessage("已实名"),
"yishixiao" : MessageLookupByLibrary.simpleMessage("已失效"),
"yishiyong" : MessageLookupByLibrary.simpleMessage("已使用"),
"yishouquan" : MessageLookupByLibrary.simpleMessage("已授权"),
"yisongda" : MessageLookupByLibrary.simpleMessage("已送达"),
"yituikuan" : MessageLookupByLibrary.simpleMessage("已退款"),
"yiwancheng" : MessageLookupByLibrary.simpleMessage(" 已完成 "),

6
lib/generated/intl/messages_zh_CN.dart

@ -104,6 +104,8 @@ class MessageLookup extends MessageLookupByLibrary {
"chuangjianshijian" : m2,
"chuangshirendegushi" : MessageLookupByLibrary.simpleMessage("创始人的故事"),
"code_error" : MessageLookupByLibrary.simpleMessage("验证码输入错误"),
"cunchu" : MessageLookupByLibrary.simpleMessage("存储"),
"cunchutishixinxi" : MessageLookupByLibrary.simpleMessage("为了获得照片使用、缓存等功能,推荐您在使用期间打开存储权限"),
"daifukuan" : MessageLookupByLibrary.simpleMessage("待付款"),
"daipeisong" : MessageLookupByLibrary.simpleMessage("待配送"),
"daiqucan" : MessageLookupByLibrary.simpleMessage("待取餐"),
@ -139,7 +141,6 @@ class MessageLookup extends MessageLookupByLibrary {
"duihuanlishi" : MessageLookupByLibrary.simpleMessage("兑换历史"),
"duihuanshangpinxiangqing" : MessageLookupByLibrary.simpleMessage("兑换商品详情"),
"duihuanxinxi" : MessageLookupByLibrary.simpleMessage("兑换信息"),
"faceidtishixinxi" : MessageLookupByLibrary.simpleMessage("为了更好的保护账户安全支付更便捷,推荐您在使用期间让我们使用Face ID"),
"fanhuiduihuanlishi" : MessageLookupByLibrary.simpleMessage("返回兑换历史"),
"fankui" : MessageLookupByLibrary.simpleMessage("反馈"),
"fantizhongwen" : MessageLookupByLibrary.simpleMessage("繁体中文"),
@ -266,7 +267,7 @@ class MessageLookup extends MessageLookupByLibrary {
"qianwanghuixiangmendianduihuanhexiao" : MessageLookupByLibrary.simpleMessage("前往一心回乡旗下任意门店对工作人员出示商品兑换码,核实无误后,可领取对应商品"),
"qinglihuancun" : MessageLookupByLibrary.simpleMessage("清理缓存"),
"qingshurubeizhuyaoqiu" : MessageLookupByLibrary.simpleMessage("请输入备注要求"),
"qingshuruchongzhijine" : MessageLookupByLibrary.simpleMessage("输入充值金额(元)"),
"qingshuruchongzhijine" : MessageLookupByLibrary.simpleMessage("输入充值金额"),
"qingshurushoujihao" : MessageLookupByLibrary.simpleMessage("请输入手机号"),
"qingshuruyanzhengma" : MessageLookupByLibrary.simpleMessage("请输入验证码"),
"qingshuruzhifumima" : MessageLookupByLibrary.simpleMessage("请输入支付密码"),
@ -404,6 +405,7 @@ class MessageLookup extends MessageLookupByLibrary {
"yishiming" : MessageLookupByLibrary.simpleMessage("已实名"),
"yishixiao" : MessageLookupByLibrary.simpleMessage("已失效"),
"yishiyong" : MessageLookupByLibrary.simpleMessage("已使用"),
"yishouquan" : MessageLookupByLibrary.simpleMessage("已授权"),
"yisongda" : MessageLookupByLibrary.simpleMessage("已送达"),
"yituikuan" : MessageLookupByLibrary.simpleMessage("已退款"),
"yiwancheng" : MessageLookupByLibrary.simpleMessage(" 已完成 "),

6
lib/generated/intl/messages_zh_TW.dart

@ -104,6 +104,8 @@ class MessageLookup extends MessageLookupByLibrary {
"chuangjianshijian" : m2,
"chuangshirendegushi" : MessageLookupByLibrary.simpleMessage("創始人的故事"),
"code_error" : MessageLookupByLibrary.simpleMessage("驗證碼輸入錯誤"),
"cunchu" : MessageLookupByLibrary.simpleMessage("存儲"),
"cunchutishixinxi" : MessageLookupByLibrary.simpleMessage("為了獲得照片使用、緩存等功能,推薦您使用期間打開存儲權限"),
"daifukuan" : MessageLookupByLibrary.simpleMessage("待付款"),
"daipeisong" : MessageLookupByLibrary.simpleMessage("待配送"),
"daiqucan" : MessageLookupByLibrary.simpleMessage("待取餐"),
@ -139,7 +141,6 @@ class MessageLookup extends MessageLookupByLibrary {
"duihuanlishi" : MessageLookupByLibrary.simpleMessage("兌換歷史"),
"duihuanshangpinxiangqing" : MessageLookupByLibrary.simpleMessage("兑换商品详情"),
"duihuanxinxi" : MessageLookupByLibrary.simpleMessage("兑换信息"),
"faceidtishixinxi" : MessageLookupByLibrary.simpleMessage("為了更好的保護帳戶安全支付更便捷,推薦您在使用期間讓我們使用Face ID "),
"fanhuiduihuanlishi" : MessageLookupByLibrary.simpleMessage("返回兌換歷史"),
"fankui" : MessageLookupByLibrary.simpleMessage("反饋"),
"fantizhongwen" : MessageLookupByLibrary.simpleMessage("繁体中文"),
@ -266,7 +267,7 @@ class MessageLookup extends MessageLookupByLibrary {
"qianwanghuixiangmendianduihuanhexiao" : MessageLookupByLibrary.simpleMessage("前往一心回乡旗下任意门店对工作人员出示商品兑换码,核实无误后,可领取对应商品"),
"qinglihuancun" : MessageLookupByLibrary.simpleMessage("清理緩存"),
"qingshurubeizhuyaoqiu" : MessageLookupByLibrary.simpleMessage("請輸入備注要求"),
"qingshuruchongzhijine" : MessageLookupByLibrary.simpleMessage("輸入充值金額(元)"),
"qingshuruchongzhijine" : MessageLookupByLibrary.simpleMessage("輸入充值金額"),
"qingshurushoujihao" : MessageLookupByLibrary.simpleMessage("請輸入手機號碼"),
"qingshuruyanzhengma" : MessageLookupByLibrary.simpleMessage("請輸入驗證碼"),
"qingshuruzhifumima" : MessageLookupByLibrary.simpleMessage("請輸入支付密碼"),
@ -404,6 +405,7 @@ class MessageLookup extends MessageLookupByLibrary {
"yishiming" : MessageLookupByLibrary.simpleMessage("已实名"),
"yishixiao" : MessageLookupByLibrary.simpleMessage("已失效"),
"yishiyong" : MessageLookupByLibrary.simpleMessage("已使用"),
"yishouquan" : MessageLookupByLibrary.simpleMessage("已授權"),
"yisongda" : MessageLookupByLibrary.simpleMessage("已送達"),
"yituikuan" : MessageLookupByLibrary.simpleMessage("已退款"),
"yiwancheng" : MessageLookupByLibrary.simpleMessage(" 已完成 "),

32
lib/generated/l10n.dart

@ -1165,11 +1165,21 @@ class S {
);
}
/// `便使使Face ID`
String get faceidtishixinxi {
/// `使使`
String get cunchutishixinxi {
return Intl.message(
'为了更好的保护账户安全支付更便捷,推荐您在使用期间让我们使用Face ID',
name: 'faceidtishixinxi',
'为了获得照片使用、缓存等功能,推荐您在使用期间打开存储权限',
name: 'cunchutishixinxi',
desc: '',
args: [],
);
}
/// ``
String get cunchu {
return Intl.message(
'存储',
name: 'cunchu',
desc: '',
args: [],
);
@ -2195,10 +2205,10 @@ class S {
);
}
/// `()`
/// ``
String get qingshuruchongzhijine {
return Intl.message(
'输入充值金额(元)',
'输入充值金额',
name: 'qingshuruchongzhijine',
desc: '',
args: [],
@ -3705,6 +3715,16 @@ class S {
);
}
/// ``
String get yishouquan {
return Intl.message(
'已授权',
name: 'yishouquan',
desc: '',
args: [],
);
}
/// `使`
String get privacy_policy4 {
return Intl.message(

91
lib/home/activity_list_page.dart

@ -1,7 +1,6 @@
import 'package:dio/dio.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:huixiang/main.dart';
import 'package:huixiang/retrofit/data/activity.dart';
import 'package:huixiang/retrofit/data/base_data.dart';
@ -11,6 +10,8 @@ import 'package:huixiang/utils/event_type.dart';
import 'package:huixiang/view_widget/classic_header.dart';
import 'package:huixiang/view_widget/custom_image.dart';
import 'package:huixiang/view_widget/my_footer.dart';
import 'package:keframe/frame_separate_widget.dart';
import 'package:keframe/size_cache_widget.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
@ -30,7 +31,8 @@ class _ActivityListPage extends State<ActivityListPage>
void initState() {
super.initState();
SharedPreferences.getInstance().then((value) => {
apiService = ApiService(Dio(), context: context, token: value.getString('token')),
apiService = ApiService(Dio(),
context: context, token: value.getString('token')),
queryActivity(),
});
@ -74,36 +76,60 @@ class _ActivityListPage extends State<ActivityListPage>
Widget build(BuildContext context) {
super.build(context);
return Container(
child: SmartRefresher(
controller: _refreshController,
enablePullDown: true,
enablePullUp: false,
header: MyHeader(),
physics: BouncingScrollPhysics(),
footer: CustomFooter(
builder: (context, mode) {
return MyFooter(mode);
},
),
onRefresh: queryActivity,
child: ListView.builder(
itemCount: activityList == null ? 0 : activityList.length,
itemBuilder: (context, position) {
return InkWell(
onTap: () {
Navigator.of(context)
.pushNamed('/router/store_detail_page', arguments: {
"html": activityList[position].content,
"title": activityList[position].mainTitle,
"time": activityList[position].createTime,
"storeId": activityList[position].storeId,
"author": activityList[position].storeName
});
child: SizeCacheWidget(
child: SmartRefresher(
controller: _refreshController,
enablePullDown: true,
enablePullUp: false,
header: MyHeader(),
physics: BouncingScrollPhysics(),
footer: CustomFooter(
builder: (context, mode) {
return MyFooter(mode);
},
child: activityItem(activityList[position]),
);
},
),
),
onRefresh: queryActivity,
child: ListView.builder(
itemCount: activityList == null ? 0 : activityList.length,
physics: NeverScrollableScrollPhysics(),
itemBuilder: (context, position) {
return InkWell(
onTap: () {
Navigator.of(context)
.pushNamed('/router/store_detail_page', arguments: {
"html": activityList[position].content,
"title": activityList[position].mainTitle,
"time": activityList[position].createTime,
"storeId": activityList[position].storeId,
"author": activityList[position].storeName
});
},
child: FrameSeparateWidget(
child: activityItem(activityList[position]),
placeHolder: AspectRatio(
aspectRatio: 1.34,
child: Container(
margin: EdgeInsets.only(
left: 16.w, right: 16.w, top: 8.h, bottom: 8.h),
decoration: BoxDecoration(
color: Colors.white,
boxShadow: [
BoxShadow(
color: Colors.black.withAlpha(12),
offset: Offset(0, 3),
blurRadius: 14,
spreadRadius: 0,
)
],
borderRadius: BorderRadius.circular(8),
),
),
),
),
);
},
),
),
),
);
}
@ -139,7 +165,8 @@ class _ActivityListPage extends State<ActivityListPage>
fadeSrc: "assets/image/default_2_1.png",
),
Container(
padding: EdgeInsets.only(left: 16.w, right: 16.w, top: 8.h, bottom: 12.h),
padding: EdgeInsets.only(
left: 16.w, right: 16.w, top: 8.h, bottom: 12.h),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
crossAxisAlignment: CrossAxisAlignment.start,

120
lib/home/home_page.dart

@ -158,66 +158,68 @@ class _HomePage extends State<HomePage> with AutomaticKeepAliveClientMixin {
header: MyHeader(),
physics: BouncingScrollPhysics(),
onRefresh: queryHome,
child: ListView(
child: SingleChildScrollView(
physics: NeverScrollableScrollPhysics(),
children: [
banner(),
ItemTitle(
text: S.of(context).jinrihuiyuanrenwu,
imgPath: "assets/image/icon_today_task.png",
moreText: S.of(context).renwuzhongxin,
onTap: () {
SharedPreferences.getInstance().then((value) {
if (value.getString('token') == null) {
loginTips();
} else {
Navigator.of(context).pushNamed('/router/integral_page');
}
});
},
),
InkWell(
onTap: () {
SharedPreferences.getInstance().then((value) {
if (value.getString('token') == null) {
loginTips();
} else {
Navigator.of(context).pushNamed('/router/integral_page');
}
});
},
child: signIn(),
),
ItemTitle(
text: S.of(context).remenwenzhangshipin,
imgPath: "assets/image/icon_today_video.png",
moreText: S.of(context).chakangengduo,
onTap: () {
Navigator.of(context).pushNamed('/router/hot_article_page');
},
),
hotList(),
ItemTitle(
text: S.of(context).chuangshirendegushi,
imgPath: "assets/image/icon_founder.png",
),
GestureDetector(
onTap: () {
Navigator.of(context).pushNamed('/router/founder_story_page');
},
child: founderStore(),
),
ItemTitle(
text: S.of(context).pinpaijieshao,
imgPath: "assets/image/icon_brand_introduction.png",
),
brands(),
ItemTitle(
text: S.of(context).jifenshangcheng,
imgPath: "assets/image/icon_points_mall.png",
),
integralStore(),
],
child: Column(
children: [
banner(),
ItemTitle(
text: S.of(context).jinrihuiyuanrenwu,
imgPath: "assets/image/icon_today_task.png",
moreText: S.of(context).renwuzhongxin,
onTap: () {
SharedPreferences.getInstance().then((value) {
if (value.getString('token') == null) {
loginTips();
} else {
Navigator.of(context).pushNamed('/router/integral_page');
}
});
},
),
InkWell(
onTap: () {
SharedPreferences.getInstance().then((value) {
if (value.getString('token') == null) {
loginTips();
} else {
Navigator.of(context).pushNamed('/router/integral_page');
}
});
},
child: signIn(),
),
ItemTitle(
text: S.of(context).remenwenzhangshipin,
imgPath: "assets/image/icon_today_video.png",
moreText: S.of(context).chakangengduo,
onTap: () {
Navigator.of(context).pushNamed('/router/hot_article_page');
},
),
hotList(),
ItemTitle(
text: S.of(context).chuangshirendegushi,
imgPath: "assets/image/icon_founder.png",
),
GestureDetector(
onTap: () {
Navigator.of(context).pushNamed('/router/founder_story_page');
},
child: founderStore(),
),
ItemTitle(
text: S.of(context).pinpaijieshao,
imgPath: "assets/image/icon_brand_introduction.png",
),
brands(),
ItemTitle(
text: S.of(context).jifenshangcheng,
imgPath: "assets/image/icon_points_mall.png",
),
integralStore(),
],
),
),
),
);

5
lib/l10n/intl_en.arb

@ -112,7 +112,8 @@
"weizhitishixinxi": "为了向您推荐附近的门店信息,推荐您在使用HISAPP时让我们使用位置信息",
"tongzhitishixinxi": "为了您可以及时收到我们的活动信息,推荐您在使用HISAPP时打开通知的接收",
"xiangjitishixinxi": "为了您可以在使用过程中进行分享,希望您使用HISAPP时让我们使用相机功能",
"faceidtishixinxi": "为了更好的保护账户安全支付更便捷,推荐您在使用期间让我们使用Face ID",
"cunchutishixinxi": "为了获得照片使用、缓存等功能,推荐您在使用期间打开存储权限",
"cunchu": "存储",
"wodejifenzhi": "我的积分值",
"mingxi": "明细",
"qiandaolingjifen": "签到领积分",
@ -383,6 +384,8 @@
"qudenglu": "去登录",
"weidenglu": "未登录",
"youkedenglu": "游客登录",
"yishouquan": "已授权",
"qingshuruchongzhijine": "请输入充值金额",

5
lib/l10n/intl_zh_CN.arb

@ -112,7 +112,8 @@
"weizhitishixinxi": "为了向您推荐附近的门店信息,推荐您在使用HISAPP时让我们使用位置信息",
"tongzhitishixinxi": "为了您可以及时收到我们的活动信息,推荐您在使用HISAPP时打开通知的接收",
"xiangjitishixinxi": "为了您可以在使用过程中进行分享,希望您使用HISAPP时让我们使用相机功能",
"faceidtishixinxi": "为了更好的保护账户安全支付更便捷,推荐您在使用期间让我们使用Face ID",
"cunchutishixinxi": "为了获得照片使用、缓存等功能,推荐您在使用期间打开存储权限",
"cunchu": "存储",
"wodejifenzhi": "我的积分值",
"mingxi": "明细",
"qiandaolingjifen": "签到领积分",
@ -384,6 +385,8 @@
"qudenglu": "去登录",
"weidenglu": "未登录",
"youkedenglu": "游客登录",
"yishouquan": "已授权",
"qingshuruchongzhijine": "请输入充值金额",

5
lib/l10n/intl_zh_TW.arb

@ -115,7 +115,8 @@
"weizhitishixinxi": "為了向您推薦附近的門店資訊,推薦您在使用HISAPP時讓我們使用位置資訊",
"tongzhitishixinxi": "為了您可以及時收到我們的活動資訊,推薦您在使用HISAPP時打開通知的接收 ",
"xiangjitishixinxi": "為了您可以在使用過程中進行分享,希望您使用HISAPP時讓我們使用相機功能 ",
"faceidtishixinxi": "為了更好的保護帳戶安全支付更便捷,推薦您在使用期間讓我們使用Face ID ",
"cunchutishixinxi": "為了獲得照片使用、緩存等功能,推薦您使用期間打開存儲權限",
"cunchu": "存儲",
"wodejifenzhi": "我的積分值",
"wodehuiyuandengji": "我的會員等級",
"mingxi": "明細",
@ -376,6 +377,8 @@
"qudenglu": "去登錄",
"weidenglu": "未登錄",
"youkedenglu": "遊客登錄",
"yishouquan": "已授權",
"qingshuruchongzhijine": "請輸入充值金額",
"privacy_policy4": "并使用本機號碼登錄"

119
lib/mine/mine_wallet_page.dart

@ -42,7 +42,7 @@ class _MineWalletPage extends State<MineWalletPage> {
SharedPreferences sharedPreferences = await SharedPreferences.getInstance();
userInfo =
UserInfo.fromJson(jsonDecode(sharedPreferences.getString('user')));
mBalance = double.tryParse(userInfo.money).toInt();
mBalance = double.tryParse(userInfo.money);
if (mounted) setState(() {});
String token = sharedPreferences.getString("token");
@ -59,9 +59,8 @@ class _MineWalletPage extends State<MineWalletPage> {
BaseData baseData = await apiService.queryInfo();
if (baseData != null && baseData.isSuccess) {
userInfo = UserInfo.fromJson(baseData.data);
mBalance = double.tryParse(userInfo.money).toInt();
if (mounted)
setState(() {});
mBalance = double.tryParse(userInfo.money);
if (mounted) setState(() {});
}
}
@ -211,11 +210,11 @@ class _MineWalletPage extends State<MineWalletPage> {
// ],
// ),
Container(
margin: EdgeInsets.only(top: 14),
margin: EdgeInsets.only(top: 14.h),
child: ListView.builder(
itemCount: userBills != null ? userBills.length : 0,
shrinkWrap: true,
padding: EdgeInsets.only(bottom: 20),
padding: EdgeInsets.only(bottom: 20.h),
physics: NeverScrollableScrollPhysics(),
itemBuilder: (context, position) {
return historyItem(userBills[position], position);
@ -228,23 +227,23 @@ class _MineWalletPage extends State<MineWalletPage> {
Widget historyItem(UserBill userBill, position) {
return Container(
margin: EdgeInsets.only(top: 10, bottom: 10),
margin: EdgeInsets.only(top: 10.h, bottom: 10.h),
child: Row(
children: [
Image.asset(
userBill.pm == 0
? "assets/image/icon_wallet_withdrawal.png"
: "assets/image/icon_wallet_recharge.png",
width: 34,
height: 34,
width: 34.w,
height: 34.h,
),
SizedBox(
width: 12,
width: 12.w,
),
Expanded(
flex: 1,
child: Container(
height: 34,
height: 34.h,
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
crossAxisAlignment: CrossAxisAlignment.start,
@ -253,7 +252,7 @@ class _MineWalletPage extends State<MineWalletPage> {
userBill.name,
style: TextStyle(
color: Colors.black,
fontSize: 12,
fontSize: 12.sp,
),
),
Text(
@ -277,7 +276,8 @@ class _MineWalletPage extends State<MineWalletPage> {
? "-${userBill.number}"
: "+${userBill.number}",
style: TextStyle(
color: Colors.black,
color: Color(0xFF20662A),
fontWeight: FontWeight.bold,
fontSize: 12.sp,
),
),
@ -299,43 +299,53 @@ class _MineWalletPage extends State<MineWalletPage> {
Widget balance() {
return Container(
width: double.infinity,
margin: EdgeInsets.fromLTRB(16, 16, 16, 8),
padding: EdgeInsets.fromLTRB(24, 24, 24, 24),
margin: EdgeInsets.fromLTRB(16.w, 16.h, 16.w, 8.h),
padding: EdgeInsets.fromLTRB(24.w, 24.h, 24.w, 24.h),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.all(Radius.circular(8)),
boxShadow: [
BoxShadow(
color: Colors.black.withAlpha(12),
offset: Offset(0, 3),
blurRadius: 14,
spreadRadius: 0)
]),
color: Colors.white,
borderRadius: BorderRadius.all(Radius.circular(8)),
boxShadow: [
BoxShadow(
color: Colors.black.withAlpha(12),
offset: Offset(0, 3),
blurRadius: 14,
spreadRadius: 0,
)
],
),
child: Column(
children: [
Text(
S.of(context).zhanghuyue,
style: TextStyle(
fontWeight: FontWeight.bold,
color: Color(0xFF353535),
fontSize: 16),
fontWeight: FontWeight.bold,
color: Color(0xFF353535),
fontSize: 16.sp,
),
),
SizedBox(
height: 16.h,
),
Text(
"$mBalance",
style: TextStyle(
fontWeight: FontWeight.bold,
color: Color(0xFF353535),
fontSize: 60),
fontWeight: FontWeight.w500,
color: Color(0xFF353535),
fontSize: 50.sp,
),
),
SizedBox(
height: 4.h,
),
Text(
S.of(context).keyongyue,
style: TextStyle(
color: Color(0xFF20662A),
fontSize: 16,
fontSize: 16.sp,
),
),
SizedBox(
height: 24,
height: 24.h,
),
InkWell(
onTap: () {
@ -350,8 +360,8 @@ class _MineWalletPage extends State<MineWalletPage> {
textColor: Colors.white,
radius: 15,
backgroup: Color(0xFF20662A),
fontSize: 12,
padding: EdgeInsets.fromLTRB(12, 4, 12, 4),
fontSize: 12.sp,
padding: EdgeInsets.fromLTRB(12.w, 4.h, 12.w, 4.h),
),
),
],
@ -368,17 +378,18 @@ class _MineWalletPage extends State<MineWalletPage> {
Navigator.of(context).pushNamed('/router/recharge_page');
},
child: Container(
margin: EdgeInsets.fromLTRB(16, 16, 16, 16),
padding: EdgeInsets.fromLTRB(0, 7, 0, 7),
margin: EdgeInsets.fromLTRB(16.w, 16.h, 16.w, 16.h),
padding: EdgeInsets.fromLTRB(0, 7.h, 0, 7.h),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.all(Radius.circular(8)),
borderRadius: BorderRadius.circular(8),
boxShadow: [
BoxShadow(
color: Colors.black.withAlpha(12),
offset: Offset(0, 3),
blurRadius: 14,
spreadRadius: 0)
color: Colors.black.withAlpha(12),
offset: Offset(0, 3),
blurRadius: 14,
spreadRadius: 0,
)
]),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
@ -386,15 +397,16 @@ class _MineWalletPage extends State<MineWalletPage> {
children: [
Image.asset(
"assets/image/icon_wallet_recharge.png",
width: 40,
height: 40,
width: 40.w,
height: 40.h,
),
Text(
S.of(context).chongzhi,
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 16,
color: Colors.black),
fontWeight: FontWeight.bold,
fontSize: 16.sp,
color: Colors.black,
),
)
],
),
@ -404,8 +416,8 @@ class _MineWalletPage extends State<MineWalletPage> {
),
Expanded(
child: Container(
margin: EdgeInsets.fromLTRB(16, 16, 16, 16),
padding: EdgeInsets.fromLTRB(0, 7, 0, 7),
margin: EdgeInsets.fromLTRB(16.w, 16.h, 16.w, 16.h),
padding: EdgeInsets.fromLTRB(0, 7.h, 0, 7.h),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.all(Radius.circular(8)),
@ -422,15 +434,16 @@ class _MineWalletPage extends State<MineWalletPage> {
children: [
Image.asset(
"assets/image/icon_wallet_withdrawal.png",
width: 40,
height: 40,
width: 40.w,
height: 40.w,
),
Text(
S.of(context).tixian,
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 16,
color: Colors.black),
fontWeight: FontWeight.bold,
fontSize: 16.sp,
color: Colors.black,
),
)
],
),

239
lib/mine/recharge_page.dart

@ -1,11 +1,19 @@
import 'package:dio/dio.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:fluwx/fluwx.dart';
import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/retrofit/data/base_data.dart';
import 'package:huixiang/retrofit/data/wx_pay.dart';
import 'package:huixiang/retrofit/retrofit_api.dart';
import 'package:huixiang/utils/min.dart';
import 'package:huixiang/view_widget/item_input_widget.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:huixiang/view_widget/round_button.dart';
import 'package:shared_preferences/shared_preferences.dart';
class RechargePage extends StatefulWidget {
@override
State<StatefulWidget> createState() {
return _RechargePage();
@ -13,10 +21,22 @@ class RechargePage extends StatefulWidget {
}
class _RechargePage extends State<RechargePage> {
TextEditingController controller;
ApiService apiService;
TextEditingController controller = TextEditingController();
Color color = Colors.black;
@override
void initState() {
super.initState();
SharedPreferences.getInstance().then((value) {
apiService = ApiService(Dio(),
context: context, token: value.getString("token"), pay: true);
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
@ -26,7 +46,7 @@ class _RechargePage extends State<RechargePage> {
style: TextStyle(
color: Colors.black,
fontWeight: FontWeight.bold,
fontSize: 18,
fontSize: 18.sp,
),
),
centerTitle: false,
@ -38,7 +58,7 @@ class _RechargePage extends State<RechargePage> {
},
child: Container(
alignment: Alignment.centerRight,
margin: EdgeInsets.only(left: 10),
margin: EdgeInsets.only(left: 10.w),
padding: EdgeInsets.all(6),
child: Icon(
Icons.arrow_back_ios,
@ -48,7 +68,7 @@ class _RechargePage extends State<RechargePage> {
),
),
titleSpacing: 2,
leadingWidth: 56,
leadingWidth: 56.w,
),
body: SingleChildScrollView(
physics: BouncingScrollPhysics(),
@ -67,9 +87,13 @@ class _RechargePage extends State<RechargePage> {
errorTextColor: Color(0xFF32A060),
radius: 8,
style: TextStyle(
fontWeight: FontWeight.bold, fontSize: 30.sp, color: color),
inputLimit: 16,
fontWeight: FontWeight.bold,
fontSize: 30.sp,
color: color,
),
inputLimit: 12,
textInputType: TextInputType.number,
textInputFormatter: FilteringTextInputFormatter.digitsOnly,
onChanged: (value) {
if (value != null &&
value != "" &&
@ -83,10 +107,18 @@ class _RechargePage extends State<RechargePage> {
),
Container(
width: double.infinity,
margin:
EdgeInsets.only(left: 20, right: 20, top: 12, bottom: 4),
padding:
EdgeInsets.only(left: 20, right: 16, top: 20, bottom: 20),
margin: EdgeInsets.only(
left: 20.w,
right: 20.w,
top: 12.h,
bottom: 4.h,
),
padding: EdgeInsets.only(
left: 20.w,
right: 16.w,
top: 20.h,
bottom: 20.h,
),
decoration: BoxDecoration(
boxShadow: [
BoxShadow(
@ -105,73 +137,94 @@ class _RechargePage extends State<RechargePage> {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: EdgeInsets.only(bottom: 16),
padding: EdgeInsets.only(bottom: 16.h),
child: Text(
S.of(context).zhifufangshi,
style: TextStyle(
fontSize: 16,
fontSize: 16.sp,
color: color,
fontWeight: FontWeight.bold,
),
),
),
Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Image.asset("assets/image/icon_alipay.png"),
Expanded(
flex: 1,
child: Padding(
padding: EdgeInsets.only(left: 8, bottom: 20),
child: Text(S.of(context).zhifubao,
GestureDetector(
onTap: () {
setState(() {
checkIndex = 0;
});
},
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Image.asset("assets/image/icon_alipay.png"),
Expanded(
flex: 1,
child: Padding(
padding: EdgeInsets.only(left: 8.w, bottom: 20.h),
child: Text(
S.of(context).zhifubao,
style: TextStyle(
fontSize: 14,
fontSize: 14.sp,
color: Color(0xff353535),
)),
),
),
),
),
),
checkView(0),
],
checkView(0),
],
),
),
Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Image.asset("assets/image/icon_we_chat.png"),
Expanded(
flex: 1,
child: Padding(
padding: EdgeInsets.only(left: 8),
child: Text(S.of(context).weixinzhifu,
style: TextStyle(
fontSize: 14,
color: Color(0xff353535),
)),
GestureDetector(
onTap: () {
setState(() {
checkIndex = 1;
});
},
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Image.asset("assets/image/icon_we_chat.png"),
Expanded(
flex: 1,
child: Padding(
padding: EdgeInsets.only(left: 8.w),
child: Text(S.of(context).weixinzhifu,
style: TextStyle(
fontSize: 14.sp,
color: Color(0xff353535),
)),
),
),
),
checkView(1),
],
)
checkView(1),
],
),
),
],
),
),
Container(
margin: EdgeInsets.only(left: 20, right: 20, top: 26),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
RoundButton(
width: double.infinity,
height: 46,
text:S.of(context).querenchongzhi,
textColor: Colors.white,
fontSize: 14,
backgroup: Color(0xff32A060),
fontWeight: FontWeight.bold,
),
],
InkWell(
onTap: () {
recharge();
},
child: Container(
margin: EdgeInsets.only(left: 20.w, right: 20.w, top: 26.h),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
RoundButton(
width: double.infinity,
height: 46.h,
text: S.of(context).querenchongzhi,
textColor: Colors.white,
fontSize: 14.sp,
backgroup: Color(0xff32A060),
fontWeight: FontWeight.bold,
),
],
),
),
),
],
@ -180,25 +233,55 @@ class _RechargePage extends State<RechargePage> {
),
);
}
var checkIndex = 0;
Widget checkView(var index) {
return GestureDetector(
onTap: () {
setState(() {
checkIndex = index;
});
},
child: Container(
padding: EdgeInsets.only(right: 16),
alignment: Alignment.center,
child: Image.asset(
checkIndex != index
? "assets/image/icon_radio_unselected.png"
: "assets/image/icon_radio_selected.png",
width: 15,
height: 15,
)),
return Container(
padding: EdgeInsets.only(right: 16.w),
alignment: Alignment.center,
child: Image.asset(
checkIndex != index
? "assets/image/icon_radio_unselected.png"
: "assets/image/icon_radio_selected.png",
width: 15.w,
height: 15.h,
),
);
}
recharge() async {
String money = controller.text;
if (money == null || money == "") {
SmartDialog.showToast(S.of(context).qingshuruchongzhijine);
return;
}
int amount = int.tryParse(money);
if (checkIndex == 1) {
if (!(await Min.isInitialize())) {
// app的充值支付使用同一个WXPayEntryActivity回调
// getPackage空指针
//
await Min.initialize();
}
BaseData baseData =
await apiService.recharge({"amount": amount, "rechargeType": 2});
if (baseData != null && baseData.isSuccess) {
WxPay wxPay = WxPay.fromJson(baseData.data);
await registerWxApi(appId: wxPay.appId, doOnAndroid: true, universalLink: "https://hx.lotus-wallet.com/app/");
payWithWeChat(
appId: wxPay.appId,
partnerId: wxPay.partnerId,
prepayId: wxPay.prepayId,
packageValue: wxPay.packageValue,
nonceStr: wxPay.nonceStr,
timeStamp: int.tryParse(wxPay.timeStamp),
sign: wxPay.sign);
weChatResponseEventHandler.listen((event) async {
print("payCallback: ${event.errCode}");
});
}
}
}
}

5
lib/retrofit/data/banner.dart

@ -2,6 +2,7 @@
class BannerData {
String content;
String createTime;
String contentType;
String createUser;
String id;
String imgUrl;
@ -12,11 +13,12 @@ class BannerData {
String updateTime;
String updateUser;
BannerData({this.content, this.createTime, this.createUser, this.id, this.imgUrl, this.isDelete, this.storeId, this.tenantCode, this.type, this.updateTime, this.updateUser});
BannerData({this.content, this.createTime, this.contentType, this.createUser, this.id, this.imgUrl, this.isDelete, this.storeId, this.tenantCode, this.type, this.updateTime, this.updateUser});
factory BannerData.fromJson(Map<String, dynamic> json) => BannerData(
content: json['content'] as String,
createTime: json['createTime'] as String,
contentType: json['contentType'] as String,
createUser: json['createUser'] as String,
id: json['id'] as String,
imgUrl: json['imgUrl'] as String,
@ -31,6 +33,7 @@ class BannerData {
Map<String, dynamic> toJson() => <String, dynamic>{
'content': this.content,
'createTime': this.createTime,
'contentType': this.contentType,
'createUser': this.createUser,
'id': this.id,
'imgUrl': this.imgUrl,

65
lib/retrofit/data/wx_pay.dart

@ -0,0 +1,65 @@
/// appId : ""
/// nonceStr : ""
/// packageValue : ""
/// partnerId : ""
/// prepayId : ""
/// sign : ""
/// timeStamp : ""
class WxPay {
String _appId;
String _nonceStr;
String _packageValue;
String _partnerId;
String _prepayId;
String _sign;
String _timeStamp;
String get appId => _appId;
String get nonceStr => _nonceStr;
String get packageValue => _packageValue;
String get partnerId => _partnerId;
String get prepayId => _prepayId;
String get sign => _sign;
String get timeStamp => _timeStamp;
WxPay({
String appId,
String nonceStr,
String packageValue,
String partnerId,
String prepayId,
String sign,
String timeStamp}){
_appId = appId;
_nonceStr = nonceStr;
_packageValue = packageValue;
_partnerId = partnerId;
_prepayId = prepayId;
_sign = sign;
_timeStamp = timeStamp;
}
WxPay.fromJson(dynamic json) {
_appId = json["appId"];
_nonceStr = json["nonceStr"];
_packageValue = json["packageValue"];
_partnerId = json["partnerId"];
_prepayId = json["prepayId"];
_sign = json["sign"];
_timeStamp = json["timeStamp"];
}
Map<String, dynamic> toJson() {
var map = <String, dynamic>{};
map["appId"] = _appId;
map["nonceStr"] = _nonceStr;
map["packageValue"] = _packageValue;
map["partnerId"] = _partnerId;
map["prepayId"] = _prepayId;
map["sign"] = _sign;
map["timeStamp"] = _timeStamp;
return map;
}
}

13
lib/retrofit/retrofit_api.dart

@ -7,9 +7,7 @@ import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/login/login_page.dart';
import 'package:huixiang/retrofit/data/base_data.dart';
import 'package:huixiang/view_widget/loading_view.dart';
import 'package:huixiang/view_widget/login_tips.dart';
import 'package:retrofit/retrofit.dart';
import 'package:shared_preferences/shared_preferences.dart';
@ -17,8 +15,8 @@ import 'package:shared_preferences/shared_preferences.dart';
part 'retrofit_api.g.dart';
const base_url = "http://platform.test.api.lotus-wallet.com/app/";
const baseUrl = "http://platform.test.api.lotus-wallet.com/app/";
// const baseUrl = "http://192.168.10.236:8766/app/";
// const baseUrl = "http://platform.test.api.lotus-wallet.com/app/";
const baseUrl = "http://192.168.10.236:8766/app/";
// const baseUrl = "http://192.168.10.129:8766/app/";
@RestApi(baseUrl: baseUrl)
@ -28,9 +26,12 @@ abstract class ApiService {
{String baseUrl,
BuildContext context,
String token,
bool showLoading = true}) {
bool showLoading = true, bool pay = false}) {
Map<String, dynamic> headers =
(token == null || token == "") ? {} : {'token': "Bearer $token"};
if (pay) {
headers["Environment"] = "app";
}
dio.options = BaseOptions(
connectTimeout: 60000,
receiveTimeout: 60000,
@ -165,7 +166,7 @@ abstract class ApiService {
Future<BaseData> signIn();
///
@POST("/member/recharge")
@POST("/wallet/recharge")
Future<BaseData> recharge(@Body() Map<String, dynamic> param);
///

4
lib/retrofit/retrofit_api.g.dart

@ -9,7 +9,7 @@ part of 'retrofit_api.dart';
class _ApiService implements ApiService {
_ApiService(this._dio, {this.baseUrl}) {
ArgumentError.checkNotNull(_dio, '_dio');
baseUrl ??= 'http://platform.test.api.lotus-wallet.com/app/';
baseUrl ??= 'http://192.168.10.236:8766/app/';
}
final Dio _dio;
@ -221,7 +221,7 @@ class _ApiService implements ApiService {
final queryParameters = <String, dynamic>{};
final _data = <String, dynamic>{};
_data.addAll(param ?? <String, dynamic>{});
final _result = await _dio.request<Map<String, dynamic>>('/member/recharge',
final _result = await _dio.request<Map<String, dynamic>>('/wallet/recharge',
queryParameters: queryParameters,
options: RequestOptions(
method: 'POST',

189
lib/setting/permission_setting_page.dart

@ -1,5 +1,13 @@
import 'dart:io';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:huixiang/generated/l10n.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:huixiang/view_widget/request_permission.dart';
import 'package:permission_handler/permission_handler.dart';
import 'package:permission_handler/permission_handler.dart';
import 'package:permission_handler/permission_handler.dart';
class PermissionSettingPage extends StatefulWidget {
@override
@ -9,6 +17,50 @@ class PermissionSettingPage extends StatefulWidget {
}
class _PermissionSettingPage extends State<PermissionSettingPage> {
@override
void initState() {
super.initState();
queryPermission();
}
List<String> title = [
S.current.dingwei,
S.current.tongzhi,
S.current.xiangji,
S.current.cunchu,
];
List<String> icons = [
"assets/image/icon_permission_location.png",
"assets/image/icon_permission_notices.png",
"assets/image/icon_permission_camera.png",
"assets/image/icon_permission_storage.png",
];
List<String> contents = [
S.current.weizhitishixinxi,
S.current.tongzhitishixinxi,
S.current.xiangjitishixinxi,
S.current.cunchutishixinxi,
];
Map<Permission, bool> permissionSwitch = {};
List<Permission> permissions = [
Permission.location,
Permission.notification,
Permission.camera,
Permission.storage,
];
queryPermission() async {
await permissions.forEach((element) async {
if (await element.isGranted) {
permissionSwitch[element] = true;
}
});
setState(() {});
}
@override
Widget build(BuildContext context) {
return Scaffold(
@ -29,7 +81,7 @@ class _PermissionSettingPage extends State<PermissionSettingPage> {
},
child: Container(
alignment: Alignment.centerRight,
margin: EdgeInsets.only(left: 10),
margin: EdgeInsets.only(left: 10.w),
padding: EdgeInsets.all(6),
child: Icon(
Icons.arrow_back_ios,
@ -38,53 +90,88 @@ class _PermissionSettingPage extends State<PermissionSettingPage> {
),
),
),
titleSpacing: 2,
leadingWidth: 56,
titleSpacing: 2.w,
leadingWidth: 56.w,
),
body: Container(
child: ListView.builder(
itemCount: 4,
itemCount: permissions.length,
itemBuilder: (context, position) {
return buildPermissionItem(
title[position], icons[position], contents[position]);
return InkWell(
onTap: () {
openPermission(permissions[position]);
},
child: buildPermissionItem(title[position], icons[position],
contents[position], permissions[position]),
);
}),
),
);
}
List<String> title = [
S.current.dingwei,
S.current.tongzhi,
S.current.xiangji,
"Face ID",
];
List<String> icons = [
"assets/image/icon_permission_location.png",
"assets/image/icon_permission_notices.png",
"assets/image/icon_permission_camera.png",
"assets/image/icon_permission_face_id.png",
];
List<String> contents = [
S.current.weizhitishixinxi,
S.current.tongzhitishixinxi,
S.current.xiangjitishixinxi,
S.current.faceidtishixinxi,
];
openPermission(Permission permission) async {
if ((permissionSwitch.containsKey(permission) &&
permissionSwitch[permission])) {
openAppSettings();
return;
}
if(await permission.isPermanentlyDenied) {
requestDialog();
} else if (await permission.isUndetermined) {
await permission.request();
queryPermission();
} else {
if (Platform.isIOS) {
//
requestDialog();
} else {
if (permission == Permission.notification) {
requestDialog();
} else {
await permission.request();
queryPermission();
}
}
}
}
Widget buildPermissionItem(title, icon, content) {
requestDialog() {
showCupertinoDialog(
context: context,
builder: (context) {
return RequestPermission(
"assets/image/icon_permission_location_bg.png",
S.of(context).nindingweiquanxianweiyunxu,
S.of(context).weilexiangnintuijianfujindemendianxinxi,
S.of(context).kaiqiquanxian,
(result) async {
if (result) {
await openAppSettings();
queryPermission();
}
},
heightRatioWithWidth: 0.84,
);
});
}
Widget buildPermissionItem(
title, icon, content, Permission permission) {
return Container(
margin: EdgeInsets.fromLTRB(16, 8, 16, 8),
padding: EdgeInsets.fromLTRB(20, 16, 20, 16),
margin: EdgeInsets.fromLTRB(16.w, 8.h, 16.w, 8.h),
padding: EdgeInsets.fromLTRB(20.w, 16.h, 20.w, 16.h),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.all(Radius.circular(8)),
boxShadow: [
BoxShadow(
color: Colors.black.withAlpha(12),
offset: Offset(0, 3),
blurRadius: 14,
spreadRadius: 0)
]),
color: Colors.white,
borderRadius: BorderRadius.circular(8),
boxShadow: [
BoxShadow(
color: Colors.black.withAlpha(12),
offset: Offset(0, 3),
blurRadius: 14,
spreadRadius: 0,
)
],
),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
@ -98,7 +185,7 @@ class _PermissionSettingPage extends State<PermissionSettingPage> {
title,
style: TextStyle(
color: Colors.black,
fontSize: 16,
fontSize: 16.sp,
fontWeight: FontWeight.bold),
),
SizedBox(
@ -106,13 +193,13 @@ class _PermissionSettingPage extends State<PermissionSettingPage> {
),
Image.asset(
icon,
width: 22,
height: 22,
width: 22.w,
height: 22.h,
)
],
),
SizedBox(
height: 8,
height: 8.h,
),
Text(
content,
@ -120,30 +207,18 @@ class _PermissionSettingPage extends State<PermissionSettingPage> {
maxLines: 2,
style: TextStyle(
color: Color(0xFF353535),
fontSize: 12,
fontSize: 12.sp,
),
),
],
),
),
SizedBox(
width: 32,
width: 32.w,
),
Row(
children: [
Text(
S.of(context).weikaiqi,
style: TextStyle(
color: Color(0xFF32A060),
fontSize: 12,
),
),
Icon(
Icons.keyboard_arrow_right,
size: 16,
color: Color(0xFF32A060),
)
],
CupertinoSwitch(
value: (permissionSwitch.containsKey(permission) &&
permissionSwitch[permission]),
),
],
),

100
lib/setting/setting_page.dart

@ -146,8 +146,7 @@ class _SettingPage extends State<SettingPage> {
: S.of(context).fantizhongwen),
),
GestureDetector(
child:
settingItem(S.of(context).quanxian, S.of(context).weikaiqi),
child: settingSingleItem(S.of(context).quanxian),
onTap: () {
Navigator.of(context).pushNamed('/router/permission_setting');
},
@ -346,101 +345,4 @@ class _SettingPage extends State<SettingPage> {
);
}
List<String> title = [
S.current.dingwei,
S.current.tongzhi,
S.current.xiangji,
"Face ID",
];
List<String> icons = [
"assets/image/icon_permission_location.png",
"assets/image/icon_permission_notices.png",
"assets/image/icon_permission_camera.png",
"assets/image/icon_permission_face_id.png",
];
List<String> contents = [
S.current.weizhitishixinxi,
S.current.tongzhitishixinxi,
S.current.xiangjitishixinxi,
S.current.faceidtishixinxi,
];
Widget buildPermissionItem(title, icon, content) {
return Container(
margin: EdgeInsets.fromLTRB(16, 8, 16, 8),
padding: EdgeInsets.fromLTRB(20, 16, 20, 16),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.all(Radius.circular(8)),
boxShadow: [
BoxShadow(
color: Colors.black.withAlpha(12),
offset: Offset(0, 3),
blurRadius: 14,
spreadRadius: 0)
]),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Expanded(
child: Column(
children: [
Row(
children: [
Text(
title,
style: TextStyle(
color: Colors.black,
fontSize: 16,
fontWeight: FontWeight.bold),
),
SizedBox(
width: 8,
),
Image.asset(
icon,
width: 22,
height: 22,
)
],
),
SizedBox(
height: 8,
),
Text(
content,
overflow: TextOverflow.ellipsis,
maxLines: 2,
style: TextStyle(
color: Color(0xFF353535),
fontSize: 12,
),
),
],
),
),
SizedBox(
width: 32,
),
Row(
children: [
Text(
S.of(context).weikaiqi,
style: TextStyle(
color: Color(0xFF32A060),
fontSize: 12,
),
),
Icon(
Icons.keyboard_arrow_right,
size: 16,
color: Color(0xFF32A060),
)
],
),
],
),
);
}
}

2
lib/union/union_details_page.dart

@ -956,7 +956,7 @@ class _UnionDetailsPage extends State<UnionDetailsPage> {
"tenantCode": storeInfo.tenantCode,
if (latitude != null && longitude != null)
"position": "$latitude,$longitude",
"baseURL": "https://pos-test.api.lotus-wallet.com/app/",
"baseURL": "http://192.168.10.236:8765/app/",
"uid": userId,
"userInfo": {
"nickname": nickname,

19
lib/union/union_page.dart

@ -70,9 +70,12 @@ class _UnionPage extends State<UnionPage>
WidgetsBinding.instance.removeObserver(this);
aMapFlutterLocation.stopLocation();
aMapFlutterLocation.destroy();
refreshController.dispose();
}
bool iskeyboardShow = false;
bool isKeyBoardShow = false;
@override
void didChangeMetrics() {
@ -81,13 +84,13 @@ class _UnionPage extends State<UnionPage>
setState(() {
print("object: ${MediaQuery.of(context).viewInsets.bottom}");
if (MediaQuery.of(context).viewInsets.bottom == 0) {
if (iskeyboardShow) {
iskeyboardShow = false;
if (isKeyBoardShow) {
isKeyBoardShow = false;
//
FocusScope.of(context).requestFocus(FocusNode());
}
} else {
iskeyboardShow = true;
isKeyBoardShow = true;
}
});
});
@ -231,7 +234,8 @@ class _UnionPage extends State<UnionPage>
.toList();
buildMarker();
refreshController.refreshCompleted();
setState(() {});
if(mounted)
setState(() {});
} else {
refreshController.refreshFailed();
}
@ -261,7 +265,8 @@ class _UnionPage extends State<UnionPage>
icon: bitmapDescriptor,
infoWindowEnable: true,
)));
setState(() {});
if(mounted)
setState(() {});
}
List<Marker> markers = [];
@ -354,7 +359,7 @@ class _UnionPage extends State<UnionPage>
MediaQuery.of(context).padding.top,
child: SmartRefresher(
controller: refreshController,
enablePullUp: true,
enablePullUp: false,
enablePullDown: true,
physics: BouncingScrollPhysics(),
header: MyHeader(),

13
lib/view_widget/item_input_widget.dart

@ -30,6 +30,7 @@ class ItemInputWidget extends StatelessWidget {
final double radius;
final EdgeInsets padding;
final TextInputType textInputType;
final TextInputFormatter textInputFormatter;
ItemInputWidget(
this.title, {
@ -51,6 +52,7 @@ class ItemInputWidget extends StatelessWidget {
const EdgeInsets.only(left: 20, right: 21, top: 16, bottom: 4),
this.btnText,
this.inputType = 0,
this.textInputFormatter,
this.isShowBtn = false,
});
@ -140,9 +142,10 @@ class ItemInputWidget extends StatelessWidget {
enabledBorder: inputBorder,
hintText: hintText,
contentPadding: EdgeInsets.only(
top: 12,
bottom: 12,
left: inputType == 1 ? 22 : 0),
top: 12,
bottom: 12,
left: inputType == 1 ? 22 : 0,
),
hintStyle: TextStyle(
fontSize: 10,
color: Color(0xFFA29E9E),
@ -150,10 +153,12 @@ class ItemInputWidget extends StatelessWidget {
),
textInputAction: TextInputAction.next,
inputFormatters: [
LengthLimitingTextInputFormatter(inputLimit)
LengthLimitingTextInputFormatter(inputLimit),
textInputFormatter
],
cursorColor: Colors.grey,
maxLines: 1,
minLines: 1,
),
),
],

300
pubspec.lock

File diff suppressed because it is too large Load Diff

4
pubspec.yaml

@ -26,7 +26,9 @@ dependencies:
sdk: flutter
flutter_localizations:
sdk: flutter
# fluwx: ^3.5.0
fluwx: ^3.5.0
keframe: ^2.0.2 #滑动组件卡顿优化
barcode_widget: ^2.0.1
cupertino_icons: ^1.0.2

Loading…
Cancel
Save