Browse Source

推送, 分享修改

null_safety
fmk 4 years ago
parent
commit
f7f87bd4f6
  1. 8
      android/app/build.gradle
  2. 5
      android/app/src/main/AndroidManifest.xml
  3. 15
      android/app/src/main/kotlin/com/zsw/huixiang/HxApplication.kt
  4. 91
      android/app/src/main/kotlin/com/zsw/huixiang/wxapi/WXEntryActivity.kt
  5. 16
      ios/Podfile.lock
  6. 19
      ios/Runner/Info.plist
  7. 2
      lib/address/address_map_page.dart
  8. 20
      lib/address/edit_address_page.dart
  9. 1
      lib/article/hot_article_details_page.dart
  10. 2
      lib/home/huixiang_brand_page.dart
  11. 2
      lib/home/main_home_page.dart
  12. 3
      lib/home/points_mall_page.dart
  13. 1
      lib/integral/integral_detailed_page.dart
  14. 1
      lib/integral_store/integral_store_details_page.dart
  15. 11
      lib/main.dart
  16. 6
      lib/main_page.dart
  17. 1
      lib/mine/coupons_page.dart
  18. 1
      lib/mine/manage_address_page.dart
  19. 1
      lib/mine/mine_card_invalid_page.dart
  20. 3
      lib/mine/mine_page.dart
  21. 1
      lib/mine/mine_wallet_page.dart
  22. 1
      lib/mine/roll_center_page.dart
  23. 1
      lib/mine/vip_balance_page.dart
  24. 1
      lib/mine/vip_card_page.dart
  25. 1
      lib/mine/vip_detail_page.dart
  26. 1
      lib/order/exchange_history_page.dart
  27. 1
      lib/order/exchange_order_success_page.dart
  28. 1
      lib/order/order_detail_page.dart
  29. 1
      lib/order/order_history_page.dart
  30. 6
      lib/retrofit/data/store.dart
  31. 4
      lib/retrofit/retrofit_api.dart
  32. 3
      lib/setting/permission_setting_page.dart
  33. 1
      lib/setting/setting_page.dart
  34. 93
      lib/union/store_details_page.dart
  35. 31
      lib/union/union_page.dart
  36. 4
      lib/view_widget/login_tips.dart
  37. 16
      pubspec.lock
  38. 8
      pubspec.yaml

8
android/app/build.gradle

@ -29,6 +29,8 @@ apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
def mfph = [
//宿
"apk.applicationId" : "com.zsw.huixiang",
XG_ACCESS_ID : "1580005689", // ACCESS_ID
XG_ACCESS_KEY : "A1HKKUUWI7WI",
]
android {
@ -48,6 +50,11 @@ android {
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
ndk {
/// .so
abiFilters 'armeabi', 'armeabi-v7a', 'arm64-v8a'
}
manifestPlaceholders = mfph
}
@ -108,4 +115,5 @@ dependencies {
implementation "com.facebook.fresco:animated-gif:1.13.0"
implementation 'com.github.bumptech.glide:glide:4.12.0'
implementation 'com.alibaba:fastjson:1.2.54'
}

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

@ -36,6 +36,7 @@
<application
android:label="回乡"
android:name=".HxApplication"
android:icon="@mipmap/ic_launcher">
<activity
android:name=".MainActivity"
@ -59,9 +60,13 @@
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<meta-data
android:name="XG_SERVER_SUFFIX"
android:value="tpns.sh.tencent.com" />
<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"

15
android/app/src/main/kotlin/com/zsw/huixiang/HxApplication.kt

@ -0,0 +1,15 @@
package com.zsw.huixiang
import android.app.Application
class HxApplication : Application() {
override fun onCreate() {
super.onCreate()
}
}

91
android/app/src/main/kotlin/com/zsw/huixiang/wxapi/WXEntryActivity.kt

@ -0,0 +1,91 @@
package com.zsw.huixiang.wxapi
import android.app.Activity
import android.content.Intent
import android.content.pm.PackageManager
import android.os.Bundle
import com.jarvan.fluwx.handlers.FluwxResponseHandler
import com.jarvan.fluwx.handlers.FluwxRequestHandler
import com.jarvan.fluwx.handlers.WXAPiHandler
import com.tencent.mm.opensdk.modelbase.BaseReq
import com.tencent.mm.opensdk.modelbase.BaseResp
import com.tencent.mm.opensdk.openapi.IWXAPIEventHandler
import io.flutter.Log
class WXEntryActivity : Activity(), IWXAPIEventHandler {
// IWXAPI 是第三方app和微信通信的openapi接口
public override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
Log.e("wx:", "onCreate:")
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)
Log.d("fluwx","weChatAppId:" + wechatAppId)
}else {
Log.e("fluwx","can't load meta-data weChatAppId")
}
}
WXAPiHandler.wxApi?.handleIntent(intent, this)
} catch (e: Exception) {
e.printStackTrace()
startSpecifiedActivity(defaultFlutterActivityAction())
finish()
}
}
override fun onNewIntent(intent: Intent) {
super.onNewIntent(intent)
Log.e("wx:", "onNewIntent:")
setIntent(intent)
try {
WXAPiHandler.wxApi?.handleIntent(intent, this)
} catch (e: Exception) {
e.printStackTrace()
startSpecifiedActivity(defaultFlutterActivityAction())
finish()
}
}
override fun onReq(baseReq: BaseReq) {
Log.e("wx:", "onReq: ${baseReq.toString()}")
// FIXME: 可能是官方的Bug,从微信拉起APP的Intent类型不对,无法跳转回Flutter Activity
// 稳定复现场景:微信版本为7.0.5,小程序SDK为2.7.7
FluwxRequestHandler.onReq(baseReq,this)
}
// 第三方应用发送到微信的请求处理后的响应结果,会回调到该方法
override fun onResp(resp: BaseResp) {
Log.e("wx:", "onResp: ${resp.toString()}")
FluwxResponseHandler.handleResponse(resp)
finish()
}
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"
}

16
ios/Podfile.lock

@ -31,8 +31,6 @@ PODS:
- Flutter
- "permission_handler (5.1.0+2)":
- Flutter
- share (0.0.1):
- Flutter
- shared_preferences (0.0.1):
- Flutter
- sqflite (0.0.2):
@ -40,6 +38,10 @@ PODS:
- FMDB (>= 2.7.5)
- Toast (4.0.0)
- TOCropViewController (2.6.0)
- TPNS-iOS (1.3.3.0)
- tpns_flutter_plugin (1.1.2):
- Flutter
- TPNS-iOS (= 1.3.3.0)
- video_player (0.0.1):
- Flutter
- wakelock (0.0.1):
@ -59,9 +61,9 @@ DEPENDENCIES:
- package_info (from `.symlinks/plugins/package_info/ios`)
- path_provider (from `.symlinks/plugins/path_provider/ios`)
- permission_handler (from `.symlinks/plugins/permission_handler/ios`)
- share (from `.symlinks/plugins/share/ios`)
- shared_preferences (from `.symlinks/plugins/shared_preferences/ios`)
- sqflite (from `.symlinks/plugins/sqflite/ios`)
- tpns_flutter_plugin (from `.symlinks/plugins/tpns_flutter_plugin/ios`)
- video_player (from `.symlinks/plugins/video_player/ios`)
- wakelock (from `.symlinks/plugins/wakelock/ios`)
- webview_flutter (from `.symlinks/plugins/webview_flutter/ios`)
@ -74,6 +76,7 @@ SPEC REPOS:
- FMDB
- Toast
- TOCropViewController
- TPNS-iOS
- WechatOpenSDK
EXTERNAL SOURCES:
@ -97,12 +100,12 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/path_provider/ios"
permission_handler:
:path: ".symlinks/plugins/permission_handler/ios"
share:
:path: ".symlinks/plugins/share/ios"
shared_preferences:
:path: ".symlinks/plugins/shared_preferences/ios"
sqflite:
:path: ".symlinks/plugins/sqflite/ios"
tpns_flutter_plugin:
:path: ".symlinks/plugins/tpns_flutter_plugin/ios"
video_player:
:path: ".symlinks/plugins/video_player/ios"
wakelock:
@ -125,11 +128,12 @@ SPEC CHECKSUMS:
package_info: 873975fc26034f0b863a300ad47e7f1ac6c7ec62
path_provider: f96fff6166a8867510d2c25fdcc346327cc4b259
permission_handler: ccb20a9fad0ee9b1314a52b70b76b473c5f8dab0
share: 0b2c3e82132f5888bccca3351c504d0003b3b410
shared_preferences: af6bfa751691cdc24be3045c43ec037377ada40d
sqflite: 6d358c025f5b867b29ed92fc697fd34924e11904
Toast: 91b396c56ee72a5790816f40d3a94dd357abc196
TOCropViewController: 3105367e808b7d3d886a74ff59bf4804e7d3ab38
TPNS-iOS: 57a146496858ba2fb5d43e5f240feb19243b69cb
tpns_flutter_plugin: a366649c8ad71f19dfb864d3c994ed0480b69daa
video_player: 9cc823b1d9da7e8427ee591e8438bfbcde500e6e
wakelock: bfc7955c418d0db797614075aabbc58a39ab5107
webview_flutter: d2b4d6c66968ad042ad94cbb791f5b72b4678a96

19
ios/Runner/Info.plist

@ -2,10 +2,6 @@
<!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>
@ -30,6 +26,10 @@
<string>$(MARKETING_VERSION)</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleURLSchemes</key>
<array>
<string>wx3b269e795ed23e5f</string>
</array>
<key>CFBundleURLTypes</key>
<array>
<dict>
@ -49,6 +49,7 @@
<array>
<string>weixinULAPI</string>
<string>weixin</string>
<string>wechat</string>
</array>
<key>LSRequiresIPhoneOS</key>
<true/>
@ -59,12 +60,18 @@
</dict>
<key>NSAppleMusicUsageDescription</key>
<string>是否允许访问媒体</string>
<key>NSBonjourServices</key>
<array>
<string>_dartobservatory._tcp</string>
</array>
<key>NSCalendarsUsageDescription</key>
<string>是否允许访问日历</string>
<key>NSCameraUsageDescription</key>
<string>打开相机拍照</string>
<key>NSContactsUsageDescription</key>
<string>是否允许访问联系人信息</string>
<key>NSLocalNetworkUsageDescription</key>
<string></string>
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
<string>定位</string>
<key>NSLocationAlwaysUsageDescription</key>
@ -81,6 +88,10 @@
<string>打开相册</string>
<key>NSSpeechRecognitionUsageDescription</key>
<string>是否允许语音识别</string>
<key>UIBackgroundModes</key>
<array>
<string>remote-notification</string>
</array>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>

2
lib/address/address_map_page.dart

@ -315,7 +315,7 @@ class _AddressMapPage extends State<AddressMapPage> {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
address.cityInfo,
address.cityInfo ?? "",
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 16.sp,

20
lib/address/edit_address_page.dart

@ -131,15 +131,17 @@ class _EditAddressPage extends State<EditAddressPage> {
toMap() async {
Navigator.of(context).pushNamed('/router/address_map_page').then(
(value) => {
addressMap = value,
addressController.text =
"${(value as Map)['province']}${(value as Map)['city']}${(value as Map)['area']}",
if(preAddress != null) {
preAddress.province = addressMap['province'],
preAddress.city = addressMap['city'],
preAddress.area = addressMap['area'],
},
houseNumberController.text = "${(value as Map)['address']}",
if (value != null) {
addressMap = value,
addressController.text =
"${(value as Map)['province']}${(value as Map)['city']}${(value as Map)['area']}",
if(preAddress != null) {
preAddress.province = addressMap['province'],
preAddress.city = addressMap['city'],
preAddress.area = addressMap['area'],
},
houseNumberController.text = "${(value as Map)['address']}",
}
// setState(() {})
},
);

1
lib/article/hot_article_details_page.dart

@ -1,7 +1,6 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:huixiang/generated/l10n.dart';
import 'package:share/share.dart';
class HotArticleDetailsPage extends StatefulWidget {
@override

2
lib/home/huixiang_brand_page.dart

@ -16,7 +16,6 @@ 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:flutter_screenutil/flutter_screenutil.dart';
import 'package:huixiang/view_widget/loading_view.dart';
import 'package:huixiang/view_widget/store_title_tab.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'package:shared_preferences/shared_preferences.dart';
@ -81,7 +80,6 @@ class _BrandPage extends State<BrandPage>
if (event.type < 3) {
setState(() {});
}
;
});
}

2
lib/home/main_home_page.dart

@ -34,7 +34,7 @@ class _MainHomePage extends State<MainHomePage>
print("object: MainHomePage");
if (event.type < 3) {
setState(() {});
};
}
});
}

3
lib/home/points_mall_page.dart

@ -1,5 +1,4 @@
import 'dart:convert';
import 'dart:io';
import 'dart:ui';
import 'package:flutter/cupertino.dart';
@ -60,7 +59,7 @@ class _PointsMallPage extends State<PointsMallPage>
}
if (event.type == 3) {
refreshUserInfo();
};
}
});
}

1
lib/integral/integral_detailed_page.dart

@ -2,7 +2,6 @@ import 'dart:convert';
import 'package:dio/dio.dart';
import 'package:flutter/material.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/retrofit/data/base_data.dart';
import 'package:huixiang/retrofit/data/page.dart';

1
lib/integral_store/integral_store_details_page.dart

@ -3,7 +3,6 @@ import 'dart:convert';
import 'package:dio/dio.dart';
import 'package:flutter/material.dart';
import 'package:flutter_swiper/flutter_swiper.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/retrofit/data/base_data.dart';
import 'package:huixiang/retrofit/data/goods.dart';

11
lib/main.dart

@ -47,12 +47,12 @@ import 'package:huixiang/setting/permission_setting_page.dart';
import 'package:huixiang/setting/setting_page.dart';
import 'package:huixiang/setting/treaty_page.dart';
// import 'package:huixiang/ui_test.dart';
import 'package:huixiang/union/store_details_page.dart';
import 'package:huixiang/union/union_details_page.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:tpns_flutter_plugin/tpns_flutter_plugin.dart';
import 'main_page.dart';
import 'mine/manage_address_page.dart';
@ -78,6 +78,15 @@ void main() async {
runApp(MyApp(locale));
}
initSdk() async {
print("object: initsdk");
///ios startXg前需要调用此方法
XgFlutterPlugin xgFlutterPlugin = XgFlutterPlugin();
xgFlutterPlugin.configureClusterDomainName("tpns.sh.tencent.com");
///iOS的appID信息Android信息在build.gradle文件中
xgFlutterPlugin.startXg("1680005688", "IYIB3R2XRE22");
}
EventBus eventBus = EventBus(sync: true);
class MyApp extends StatelessWidget {

6
lib/main_page.dart

@ -31,6 +31,10 @@ class _MainPage extends State<MainPage> {
@override
void initState() {
super.initState();
initSdk();
_widgetOptions = <Widget>[
BrandPage(),
MainHomePage(),
@ -54,7 +58,7 @@ class _MainPage extends State<MainPage> {
eventBus.on<EventType>().listen((event) {
if (event.type < 3) {
setState(() {});
};
}
});
queryUserInfo();

1
lib/mine/coupons_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/generated/l10n.dart';
import 'package:huixiang/retrofit/data/base_data.dart';
import 'package:huixiang/retrofit/data/coupon.dart';

1
lib/mine/manage_address_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/generated/l10n.dart';
import 'package:huixiang/retrofit/data/address.dart';
import 'package:huixiang/retrofit/data/base_data.dart';

1
lib/mine/mine_card_invalid_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/generated/l10n.dart';
import 'package:huixiang/retrofit/data/base_data.dart';
import 'package:huixiang/retrofit/data/coupon.dart';

3
lib/mine/mine_page.dart

@ -12,7 +12,6 @@ import 'package:huixiang/retrofit/retrofit_api.dart';
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/loading_view.dart';
import 'package:huixiang/view_widget/login_tips.dart';
import 'package:huixiang/view_widget/mine_vip_view.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';
@ -64,7 +63,7 @@ class _MinePage extends State<MinePage> with AutomaticKeepAliveClientMixin {
}
if (event.type == 3) {
refreshUserInfo();
};
}
});
}

1
lib/mine/mine_wallet_page.dart

@ -2,7 +2,6 @@ import 'dart:convert';
import 'package:dio/dio.dart';
import 'package:flutter/material.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/retrofit/data/base_data.dart';
import 'package:huixiang/retrofit/data/page.dart';

1
lib/mine/roll_center_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/generated/l10n.dart';
import 'package:huixiang/retrofit/data/base_data.dart';
import 'package:huixiang/retrofit/data/coupon.dart';

1
lib/mine/vip_balance_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/generated/l10n.dart';
import 'package:huixiang/retrofit/data/base_data.dart';
import 'package:huixiang/retrofit/data/coupon.dart';

1
lib/mine/vip_card_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/retrofit/data/base_data.dart';
import 'package:huixiang/retrofit/data/vip_card.dart';
import 'package:huixiang/retrofit/retrofit_api.dart';

1
lib/mine/vip_detail_page.dart

@ -1,7 +1,6 @@
import 'package:barcode_widget/barcode_widget.dart';
import 'package:dio/dio.dart';
import 'package:flutter/material.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/retrofit/data/base_data.dart';
import 'package:huixiang/retrofit/data/vip_card.dart';

1
lib/order/exchange_history_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/generated/l10n.dart';
import 'package:huixiang/retrofit/data/base_data.dart';
import 'package:huixiang/retrofit/data/exchange_order.dart';

1
lib/order/exchange_order_success_page.dart

@ -2,7 +2,6 @@ import 'dart:convert';
import 'package:dio/dio.dart';
import 'package:flutter/material.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/retrofit/data/base_data.dart';
import 'package:huixiang/retrofit/data/user_info.dart';

1
lib/order/order_detail_page.dart

@ -1,6 +1,5 @@
import 'package:dio/dio.dart';
import 'package:flutter/material.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/retrofit/data/base_data.dart';
import 'package:huixiang/retrofit/data/order_info.dart';

1
lib/order/order_history_page.dart

@ -1,6 +1,5 @@
import 'package:dio/dio.dart';
import 'package:flutter/material.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/retrofit/data/base_data.dart';
import 'package:huixiang/retrofit/data/order_info.dart';

6
lib/retrofit/data/store.dart

@ -1,4 +1,5 @@
import 'package:huixiang/retrofit/data/coupon_vo.dart';
import 'package:huixiang/retrofit/data/store_type.dart';
@ -33,6 +34,7 @@ class Store {
String address;
String headName;
String headMobile;
CouponVo couponVO;
dynamic deliveryInfo;
String businessType;
StoreType posType;
@ -68,6 +70,7 @@ class Store {
..headMobile = json['headMobile'] as String
..deliveryInfo = json['deliveryInfo']
..businessType = json['businessType'] as String
..couponVO = json['couponVO'] == null ? null : CouponVo.fromJson(json['couponVO'])
..posType = json['posType'] == null
? null
: StoreType.fromJson(json['posType'] as Map<String, dynamic>);
@ -103,7 +106,10 @@ class Store {
'headMobile': this.headMobile,
'deliveryInfo': this.deliveryInfo,
'businessType': this.businessType,
'couponVO': this.couponVO.toJson(),
'posType': this.posType,
};
}

4
lib/retrofit/retrofit_api.dart

@ -60,6 +60,7 @@ abstract class ApiService {
debugPrint("code = ${response.statusCode}");
p(jsonEncode(response.data));
Map map = response.data;
if (map["code"] == 40005 || map["code"] == 40001) {
// Navigator.pushAndRemoveUntil(context, MaterialPageRoute(
// builder: (BuildContext context) {
@ -76,7 +77,8 @@ abstract class ApiService {
),
clickBgDismissTemp: false,
);
} else if (map["code"] != 0) {
} else if (map["code"] != 0 && response.request.baseUrl == baseUrl) {
///poi服务请求不需要toast
SmartDialog.showToast(map["msg"]);
}
debugPrint("======================= 响应数据结束 =======================\n");

3
lib/setting/permission_setting_page.dart

@ -6,8 +6,6 @@ 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
@ -219,6 +217,7 @@ class _PermissionSettingPage extends State<PermissionSettingPage> {
CupertinoSwitch(
value: (permissionSwitch.containsKey(permission) &&
permissionSwitch[permission]),
onChanged: (boo){},
),
],
),

1
lib/setting/setting_page.dart

@ -11,7 +11,6 @@ import 'package:huixiang/utils/min.dart';
import 'package:huixiang/view_widget/round_button.dart';
import 'package:path_provider/path_provider.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:flutter_cache_manager/flutter_cache_manager.dart';
class SettingPage extends StatefulWidget {
@override

93
lib/union/store_details_page.dart

@ -1,16 +1,14 @@
import 'package:dio/dio.dart';
import 'package:flutter/material.dart';
import 'package:flutter_html/flutter_html.dart';
import 'package:flutter_html/image_render.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:fluwx/fluwx.dart';
import 'package:huixiang/retrofit/data/activity.dart';
import 'package:huixiang/retrofit/data/article.dart';
import 'package:huixiang/retrofit/data/base_data.dart';
import 'package:huixiang/retrofit/retrofit_api.dart';
import 'package:huixiang/view_widget/custom_image.dart';
import 'package:huixiang/view_widget/my_appbar.dart';
import 'package:share/share.dart';
import 'package:shared_preferences/shared_preferences.dart';
class StoreDetailsPage extends StatefulWidget {
@ -25,27 +23,27 @@ class StoreDetailsPage extends StatefulWidget {
}
class _StoreDetailsPage extends State<StoreDetailsPage> {
ApiService apiService;
@override
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"));
queryHtml();
});
}
Activity activity;
Article article;
queryHtml() async {
BaseData baseData = await apiService.informationInfo(widget.arguments["activityId"] ?? widget.arguments["articleId"]);
BaseData baseData = await apiService.informationInfo(
widget.arguments["activityId"] ?? widget.arguments["articleId"]);
if(baseData != null && baseData.isSuccess) {
if (baseData != null && baseData.isSuccess) {
if (widget.arguments.containsKey("activityId")) {
activity = Activity.fromJson(baseData.data);
} else if (widget.arguments.containsKey("articleId")) {
@ -53,30 +51,39 @@ class _StoreDetailsPage extends State<StoreDetailsPage> {
}
setState(() {});
}
}
share2WeChat() async {
await registerWxApi(appId: "wx3b269e795ed23e5f", doOnAndroid: true, universalLink: "https://hx.lotus-wallet.com/app/");
shareToWeChat(WeChatShareWebPageModel(
"http://share-app.api.lotus-wallet.com/#/share?id=${widget.arguments["activityId"] ?? widget.arguments["articleId"]}",
scene: WeChatScene.SESSION));
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: MyAppBar(
action: Container(
margin: EdgeInsets.only(right: 15),
child: GestureDetector(
onTap: () {
Share.share('http://share-app.api.lotus-wallet.com/#/share?id=${widget.arguments["activityId"] ?? widget.arguments["articleId"]}');
},
child: Icon(
Icons.share,
size: 24,
color: Colors.black,
),
),
margin: EdgeInsets.only(right: 15),
child: GestureDetector(
onTap: () {
share2WeChat();
},
child: Icon(
Icons.share,
size: 24,
color: Colors.black,
),
),
),
background: Color(0xFFF7F7F7),
leadingColor: Colors.black,
title: activity != null ? activity.mainTitle : article != null ? article.mainTitle : "",
title: activity != null
? activity.mainTitle
: article != null
? article.mainTitle
: "",
titleSize: 18.sp,
titleColor: Colors.black,
),
@ -89,7 +96,11 @@ class _StoreDetailsPage extends State<StoreDetailsPage> {
padding: EdgeInsets.all(12),
alignment: Alignment.centerLeft,
child: Text(
activity != null ? activity.mainTitle : article != null ? article.mainTitle : "",
activity != null
? activity.mainTitle
: article != null
? article.mainTitle
: "",
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.bold,
@ -111,8 +122,9 @@ class _StoreDetailsPage extends State<StoreDetailsPage> {
),
),
onTap: () {
if(activity != null) {
Navigator.of(context).pushNamed('/router/union_detail_page',
if (activity != null) {
Navigator.of(context).pushNamed(
'/router/union_detail_page',
arguments: {"id": activity.storeId});
}
},
@ -121,7 +133,11 @@ class _StoreDetailsPage extends State<StoreDetailsPage> {
width: 10,
),
Text(
activity != null ? activity.createTime : article != null ? article.createTime : "",
activity != null
? activity.createTime
: article != null
? article.createTime
: "",
style: TextStyle(
fontWeight: FontWeight.normal,
fontSize: 12.sp,
@ -132,17 +148,20 @@ class _StoreDetailsPage extends State<StoreDetailsPage> {
),
),
Html(
data: activity != null ? activity.content : article != null ? article.content : "",
data: activity != null
? activity.content
: article != null
? article.content
: "",
customImageRenders: {
base64DataUriMatcher(): base64ImageRender(),
assetUriMatcher(): assetImageRender(),
networkSourceMatcher(extension: "svg"): svgNetworkImageRender(),
networkSourceMatcher(): networkImageRender(
loadingWidget: () {
// return Image.asset("assets/image/default_1.png",);
return Container();
}
),
networkSourceMatcher(extension: "svg"):
svgNetworkImageRender(),
networkSourceMatcher(): networkImageRender(loadingWidget: () {
// return Image.asset("assets/image/default_1.png",);
return Container();
}),
},
),
],

31
lib/union/union_page.dart

@ -72,7 +72,6 @@ class _UnionPage extends State<UnionPage>
aMapFlutterLocation.destroy();
refreshController.dispose();
}
bool isKeyBoardShow = false;
@ -142,7 +141,7 @@ class _UnionPage extends State<UnionPage>
print("object: UnionPage");
if (event.type < 3) {
setState(() {});
};
}
});
}
@ -151,7 +150,8 @@ class _UnionPage extends State<UnionPage>
onceLocation: true,
locationMode: AMapLocationMode.Hight_Accuracy,
desiredAccuracy: DesiredAccuracy.HundredMeters,
desiredLocationAccuracyAuthorizationMode: AMapLocationAccuracyAuthorizationMode.FullAndReduceAccuracy,
desiredLocationAccuracyAuthorizationMode:
AMapLocationAccuracyAuthorizationMode.FullAndReduceAccuracy,
pausesLocationUpdatesAutomatically: true,
));
@ -176,7 +176,9 @@ class _UnionPage extends State<UnionPage>
SharedPreferences.getInstance().then(
(value) => {
apiService = ApiService(Dio(),
context: context, token: value.getString('token'), showLoading: false),
context: context,
token: value.getString('token'),
showLoading: false),
if (value.containsKey("latitude") &&
value.containsKey("longitude") &&
value.containsKey("province") &&
@ -234,8 +236,7 @@ class _UnionPage extends State<UnionPage>
.toList();
buildMarker();
refreshController.refreshCompleted();
if(mounted)
setState(() {});
if (mounted) setState(() {});
} else {
refreshController.refreshFailed();
}
@ -265,8 +266,7 @@ class _UnionPage extends State<UnionPage>
icon: bitmapDescriptor,
infoWindowEnable: true,
)));
if(mounted)
setState(() {});
if (mounted) setState(() {});
}
List<Marker> markers = [];
@ -274,9 +274,6 @@ class _UnionPage extends State<UnionPage>
@override
Widget build(BuildContext context) {
super.build(context);
AMapApiKey aMapApiKeys = AMapApiKey(
androidKey: 'f39d1daa020a56f208eb2519f63e9534',
iosKey: 'feaae7986201b571cace1b83728be5bb');
return GestureDetector(
onTap: () {
FocusScope.of(context).requestFocus(FocusNode());
@ -696,7 +693,17 @@ class _UnionPage extends State<UnionPage>
),
Container(
child: Text(
S.of(context).manlijiandaijinquan(50, 25),
store.couponVO == null
? ""
: store.couponVO.bizType == 1
? S.of(context).manlijiandaijinquan(
double.tryParse(store.couponVO.fullAmount)
.toInt(),
double.tryParse(store.couponVO.discountAmount)
.toInt())
: S
.of(context)
.quanchangzhe(store.couponVO.discountPercent),
style: TextStyle(
color: Color(0xFFFF7A1A),
fontSize: 10.sp,

4
lib/view_widget/login_tips.dart

@ -1,13 +1,9 @@
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/view_widget/border_text.dart';
import 'package:huixiang/view_widget/round_button.dart';
import 'package:shared_preferences/shared_preferences.dart';
class LoginTips extends StatelessWidget {

16
pubspec.lock

@ -735,13 +735,6 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "0.26.0"
share:
dependency: "direct main"
description:
name: share
url: "https://pub.dartlang.org"
source: hosted
version: "0.6.4+5"
shared_preferences:
dependency: "direct main"
description:
@ -887,6 +880,15 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.1+3"
tpns_flutter_plugin:
dependency: "direct main"
description:
path: "."
ref: "V1.1.2"
resolved-ref: b814d62f4b82422459f786671f23dd535062d503
url: "https://github.com/TencentCloud/TPNS-Flutter-Plugin"
source: git
version: "1.1.2"
transformer_page_view:
dependency: transitive
description:

8
pubspec.yaml

@ -30,6 +30,12 @@ dependencies:
keframe: ^2.0.2 #滑动组件卡顿优化
tpns_flutter_plugin:
git:
url: https://github.com/TencentCloud/TPNS-Flutter-Plugin
ref: V1.1.2
# tpns_flutter_plugin: ^1.1.0
barcode_widget: ^2.0.1
cupertino_icons: ^1.0.2
# flutter_swiper_null_safety: ^1.0.2
@ -41,8 +47,6 @@ dependencies:
permission_handler: ^5.0.1+1
amap_flutter_map: ^1.0.0
amap_flutter_location: ^2.0.0 # Null safety
share_plus: ^2.1.4
sharesdk_plugin: ^1.3.0
# flutter_baidu_mapapi_search: ^2.0.1
# flutter_baidu_mapapi_map: ^2.0.1

Loading…
Cancel
Save