From c586d5f18c6985c2ea236606408b1a1012719e7a Mon Sep 17 00:00:00 2001 From: fff Date: Wed, 27 Mar 2024 10:13:18 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=90=8E=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- android/app/build.gradle | 59 +++- android/app/src/main/AndroidManifest.xml | 25 +- android/gradle.properties | 1 + android/settings.gradle | 20 +- android/tmpmob/assets/ShareSDK.xml | 7 + lib/home/guide_page.dart | 352 ++++++++++++---------- lib/home/home_page.dart | 8 +- lib/home/home_view/welfare_core.dart | 2 +- lib/login/new_login_page.dart | 362 ++++++++++++----------- lib/main_page.dart | 54 ++++ lib/setting/about_page.dart | 298 +++++++++---------- lib/setting/treaty_page.dart | 34 +-- lib/view_widget/round_button.dart | 2 + pubspec.lock | 6 +- pubspec.yaml | 2 +- 15 files changed, 698 insertions(+), 534 deletions(-) create mode 100644 android/tmpmob/assets/ShareSDK.xml diff --git a/android/app/build.gradle b/android/app/build.gradle index 6bc9ee54..263b2f05 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -2,7 +2,7 @@ plugins { id "com.android.application" id "kotlin-android" id "dev.flutter.flutter-gradle-plugin" -// id 'com.huawei.agconnect' + id 'com.mob.sdk' } def localProperties = new Properties() @@ -98,4 +98,59 @@ flutter { source '../..' } -dependencies {} +dependencies { +// classpath 'com.mob.sdk:MobSDK:+' +} + +MobSDK { + appKey "m33ee7650da86a" + appSecret "876f2eaebfd2a88c89d5fc294397838c" + spEdition "fp" + + ShareSDK { + + devInfo { + Wechat { + id 4 + sortId 4 + appId "wx3b269e795ed23e5f" + appSecret "64020361b8ec4c99936c0e3999a9f249" + userName "gh_afb25ac019c9" + path "pages/index/index.html?id=1" + withShareTicket true + miniprogramType 0 + bypassApproval false + enable true + } + WechatMoments { + id 3 + sortId 3 + appId "wx3b269e795ed23e5f" + appSecret "64020361b8ec4c99936c0e3999a9f249" + bypassApproval false + enable true + } + Facebook { + id 8 + sortId 8 + appKey "523308712059457" + appSecret "d3a1b6377100871799d8973fbe84794a" + callbackUri "https://mob.com" + shareByAppClient true + enable true + } + Line { + id 2 + sortId 2 +// appKey "1656257249" +// appSecret "7f160c9686672a50b5952364a8553f99" + appKey "1656257047" + appSecret "fd93cb8f12b285b80c7c67bdee8bd091" + callbackUri "https://mob.com" + callbackscheme "huixiang" + shareByAppClient true + enable true + } + } + } +} diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 5a9fc3f2..b7250129 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -51,11 +51,11 @@ android:name="io.flutter.embedding.android.NormalTheme" android:resource="@style/NormalTheme" /> + android:name="io.flutter.app.android.SplashScreenUntilFirstFrame" + android:value="true" /> + android:name="io.flutter.embedding.android.SplashScreenDrawable" + android:resource="@drawable/launch_background"/> @@ -71,8 +71,8 @@ + android:name="XG_SERVER_SUFFIX" + android:value="tpns.sh.tencent.com" /> @@ -81,16 +81,15 @@ android:value="2" /> - + android:name="com.yalantis.ucrop.UCropActivity" + android:screenOrientation="portrait"/> + android:name="dcloud_appkey" + android:value="" /> + android:name="com.amap.api.v2.apikey" + android:value="f39d1daa020a56f208eb2519f63e9534"/> diff --git a/android/gradle.properties b/android/gradle.properties index 598d13fe..0aab6ea9 100644 --- a/android/gradle.properties +++ b/android/gradle.properties @@ -1,3 +1,4 @@ org.gradle.jvmargs=-Xmx4G android.useAndroidX=true android.enableJetifier=true +MobSDK.spEdition=IZNAO \ No newline at end of file diff --git a/android/settings.gradle b/android/settings.gradle index 1d6d19b7..6fefc05f 100644 --- a/android/settings.gradle +++ b/android/settings.gradle @@ -11,9 +11,22 @@ pluginManagement { includeBuild("${settings.ext.flutterSdkPath}/packages/flutter_tools/gradle") repositories { - google() - mavenCentral() - gradlePluginPortal() +// google() +// mavenCentral() +// gradlePluginPortal() + maven { + url 'https://maven.aliyun.com/repository/google' + } + maven { + url 'https://maven.aliyun.com/repository/jcenter' + } + maven { url "https://www.jitpack.io" } + maven { url 'https://repo1.maven.org/maven2/' } + maven { url 'https://developer.huawei.com/repo/' } + maven { + url "http://mvn.mob.com/android" + allowInsecureProtocol = true + } } } @@ -21,6 +34,7 @@ plugins { id "dev.flutter.flutter-plugin-loader" version "1.0.0" id "com.android.application" version "7.3.0" apply false id "org.jetbrains.kotlin.android" version "1.7.10" apply false + id "com.mob.sdk" version "+" apply false } include ":app" diff --git a/android/tmpmob/assets/ShareSDK.xml b/android/tmpmob/assets/ShareSDK.xml new file mode 100644 index 00000000..56807284 --- /dev/null +++ b/android/tmpmob/assets/ShareSDK.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/lib/home/guide_page.dart b/lib/home/guide_page.dart index f4e12e44..3f723b5a 100644 --- a/lib/home/guide_page.dart +++ b/lib/home/guide_page.dart @@ -1,8 +1,10 @@ import 'dart:io'; +import 'package:flutter/cupertino.dart'; import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; import 'package:huixiang/generated/l10n.dart'; +import 'package:huixiang/utils/constant.dart'; import 'package:huixiang/utils/font_weight.dart'; import 'package:huixiang/view_widget/border_text.dart'; import 'package:huixiang/view_widget/round_button.dart'; @@ -18,12 +20,10 @@ class GuidePage extends StatefulWidget { } class _GuidePage extends State { - @override void initState() { - super.initState(); - if(Platform.isAndroid) - isLogin(); + super.initState(); + if (Platform.isAndroid) isLogin(); } isLogin() async { @@ -123,8 +123,10 @@ class _GuidePage extends State { children: [ Text( "●", - style: - TextStyle(fontSize: 8.sp, color: Colors.black), + style: TextStyle( + fontSize: 8.sp, + color: Colors.black, + ), ), SizedBox( width: 10.w, @@ -132,7 +134,9 @@ class _GuidePage extends State { Text( "●", style: TextStyle( - fontSize: 8.sp, color: Color(0xffB2B2B2)), + fontSize: 8.sp, + color: Color(0xffB2B2B2), + ), ), SizedBox( width: 10.w, @@ -140,7 +144,9 @@ class _GuidePage extends State { Text( "●", style: TextStyle( - fontSize: 8.sp, color: Color(0xffB2B2B2)), + fontSize: 8.sp, + color: Color(0xffB2B2B2), + ), ), SizedBox( height: 108.h, @@ -197,7 +203,8 @@ class _GuidePage extends State { fontSize: 16.sp, height: 1.5.h, fontWeight: MyFontWeight.medium, - color: Color(0XFF727272)), + color: Color(0XFF727272), + ), ), ), ], @@ -211,15 +218,19 @@ class _GuidePage extends State { Text( "●", style: TextStyle( - fontSize: 8.sp, color: Color(0xffB2B2B2)), + fontSize: 8.sp, + color: Color(0xffB2B2B2), + ), ), SizedBox( width: 10.w, ), Text( "●", - style: - TextStyle(fontSize: 8.sp, color: Colors.black), + style: TextStyle( + fontSize: 8.sp, + color: Colors.black, + ), ), SizedBox( width: 10.w, @@ -227,7 +238,9 @@ class _GuidePage extends State { Text( "●", style: TextStyle( - fontSize: 8.sp, color: Color(0xffB2B2B2)), + fontSize: 8.sp, + color: Color(0xffB2B2B2), + ), ), SizedBox( height: 108.h, @@ -245,7 +258,9 @@ class _GuidePage extends State { color: Colors.white, child: Center( child: Container( - margin: EdgeInsets.only(top: 120.h, left: 19.w, right: 19.w), + margin: EdgeInsets.only( + top: 120.h, left: 19.w, right: 19.w, + ), child: Stack( children: [ Column( @@ -284,7 +299,8 @@ class _GuidePage extends State { fontSize: 16.sp, height: 1.5.h, fontWeight: MyFontWeight.medium, - color: Color(0XFF727272)), + color: Color(0XFF727272), + ), ), ), ], @@ -298,7 +314,9 @@ class _GuidePage extends State { Text( "●", style: TextStyle( - fontSize: 8.sp, color: Color(0xffB2B2B2)), + fontSize: 8.sp, + color: Color(0xffB2B2B2), + ), ), SizedBox( width: 10.w, @@ -306,15 +324,19 @@ class _GuidePage extends State { Text( "●", style: TextStyle( - fontSize: 8.sp, color: Color(0xffB2B2B2)), + fontSize: 8.sp, + color: Color(0xffB2B2B2), + ), ), SizedBox( width: 10.w, ), Text( "●", - style: - TextStyle(fontSize: 8.sp, color: Colors.black), + style: TextStyle( + fontSize: 8.sp, + color: Colors.black, + ), ), SizedBox( height: 108.h, @@ -342,7 +364,9 @@ class _GuidePage extends State { fit: BoxFit.fill, ), SizedBox( - height: MediaQuery.of(context).size.width >= 650 ? 20.h :66.h, + height: MediaQuery.of(context).size.width >= 650 + ? 20.h + : 66.h, ), Container( alignment: Alignment.center, @@ -352,11 +376,14 @@ class _GuidePage extends State { style: TextStyle( fontSize: 24.sp, fontWeight: MyFontWeight.semi_bold, - color: Color(0XFF32A060)), + color: Color(0XFF32A060), + ), ), ), SizedBox( - height: MediaQuery.of(context).size.width >= 650 ? 15.h :23.h, + height: MediaQuery.of(context).size.width >= 650 + ? 15.h + : 23.h, ), Padding( padding: EdgeInsets.only(left: 52.w, right: 52.w), @@ -367,7 +394,8 @@ class _GuidePage extends State { fontSize: 16.sp, height: 1.5.h, fontWeight: MyFontWeight.medium, - color: Color(0XFF727272)), + color: Color(0XFF727272), + ), ), ), ], @@ -381,7 +409,8 @@ class _GuidePage extends State { child: Container( height: 50.h, margin: EdgeInsets.only( - left: 71.w, right: 71.w, bottom: 55.h), + left: 71.w, right: 71.w, bottom: 55.h, + ), alignment: Alignment.center, child: BorderText( padding: EdgeInsets.all(5), @@ -400,165 +429,164 @@ class _GuidePage extends State { ), ), ), - ) + ), ], ), ); } - showAlertDialog() { //显示对话框 showDialog( context: context, builder: (BuildContext context) { - return WillPopScope( - onWillPop: () async => false, - child:SimpleDialog( - titlePadding: EdgeInsets.all(10), - backgroundColor: Colors.transparent, - elevation: 0, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(6), - ), - children: [ - Stack( - alignment: Alignment.bottomCenter, - children: [ - Container( - alignment: Alignment.center, - width: double.infinity, - height: 325.h, - padding: EdgeInsets.only(left: 16.w, right: 16.w), - decoration: new BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(8), - ), - child: Column( - children: [ - Padding( - padding: EdgeInsets.only(top: 24.h, bottom: 10.h), - child: Text( - S.of(context).xieyitanchuang, - style: TextStyle( - color: Color(0xff4D4D4D), - fontSize: 18.sp, - fontWeight: FontWeight.bold, - ), - ), - ), - Text.rich( - TextSpan(children: [ - TextSpan( - text: S.of(context).yinsizhengce1, - style: TextStyle( - fontWeight: MyFontWeight.medium, - fontSize: 14.sp, - height: 1.3.h, - color: Color(0xff727272), - ), - ), - TextSpan( - text: S.of(context).yinsixieyi, - style: TextStyle( - fontWeight: MyFontWeight.medium, - fontSize: 14.sp, - color: Color(0xff32A060)), - recognizer: TapGestureRecognizer() - ..onTap = () { - Navigator.of(context) - .popAndPushNamed('/router/treaty_page'); - }, - ), - ]), - ), - SizedBox( - height: 10.h, - ), - Text( - S.of(context).yinsizhengce2, - style: TextStyle( - color: Color(0xff727272), - fontSize: 14.sp, - height: 1.3.h, - fontWeight: MyFontWeight.medium, - ), - ), - SizedBox( - height: 16.h, - ), - ], - ), + return PopScope( + canPop: true, + onPopInvoked: (isPop) {}, + child: SimpleDialog( + titlePadding: EdgeInsets.all(10), + backgroundColor: Colors.transparent, + elevation: 0, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(6), + ), + children: [ + Container( + alignment: Alignment.center, + width: double.infinity, + height: 325.h, + padding: EdgeInsets.only(left: 16.w, right: 16.w), + decoration: new BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(8), ), - Row( - mainAxisAlignment: MainAxisAlignment.center, + child: Column( children: [ - GestureDetector( - onTap: () { - Navigator.of(context).pop(); - // exit(0); - }, - child: Container( - height: 40.h, - alignment: Alignment.bottomCenter, - margin: EdgeInsets.only(bottom: 20.h), - child: BorderText( - padding: EdgeInsets.only( - top: 10.h, - bottom: 10.h, - left: 36.w, - right: 36.w, - ), - text: S.of(context).jujue, - fontSize: 12.sp, - textColor: Color(0xFF32A060), - borderColor: Color(0xFF32A060), - borderWidth: 1.w, - radius: 23, + Padding( + padding: EdgeInsets.only(top: 24.h, bottom: 10.h), + child: Text( + S.of(context).xieyitanchuang, + style: TextStyle( + color: Color(0xff4D4D4D), + fontSize: 18.sp, + fontWeight: FontWeight.bold, ), ), ), - SizedBox( - width: 21.w, - ), - Container( - height: 40.h, - margin: EdgeInsets.only(bottom: 20.h), - alignment: Alignment.bottomCenter, - child: RoundButton( - text: S.of(context).tongyibingjixu, - textColor: Colors.white, - fontSize: 12.sp, - callback: () { - SharedPreferences.getInstance().then((value) { - value.setBool("isShowPrivacyPolicy", true); - }); - SharesdkPlugin.uploadPrivacyPermissionStatus( - 1, - (success) => { - Navigator.of(context).pop(), - }, - ); - }, - padding: EdgeInsets.only( - top: 10.h, - bottom: 10.h, - left: 21.5.w, - right: 21.5.w, + Expanded( + child: SingleChildScrollView( + child: Column( + children: [ + Text.rich( + TextSpan(children: [ + TextSpan( + text: S.of(context).yinsizhengce1, + style: TextStyle( + fontWeight: MyFontWeight.medium, + fontSize: 14.sp, + height: 1.3.h, + color: Color(0xff727272), + ), + ), + TextSpan( + text: S.of(context).yinsixieyi, + style: TextStyle( + fontWeight: MyFontWeight.medium, + fontSize: 14.sp, + color: Color(0xff32A060), + ), + recognizer: TapGestureRecognizer() + ..onTap = () { + Navigator.of(context) + .popAndPushNamed('/router/treaty_page'); + }, + ), + ]), + ), + 10.d, + Text( + S.of(context).yinsizhengce2, + textAlign: TextAlign.justify, + style: TextStyle( + color: Color(0xff727272), + fontSize: 14.sp, + height: 1.3.h, + fontWeight: MyFontWeight.medium, + ), + ), + ], ), - backgroup: Color(0xff32A060), - radius: 23, ), ), - SizedBox( - height: 20.h, + 16.d, + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + GestureDetector( + onTap: () { + // Navigator.of(context).pop(); + exit(0); + }, + child: Container( + height: 40.h, + alignment: Alignment.bottomCenter, + margin: EdgeInsets.only(bottom: 20.h), + child: BorderText( + padding: EdgeInsets.only( + top: 10.h, + bottom: 10.h, + left: 24.w, + right: 24.w, + ), + text: S.of(context).jujue, + fontSize: 12.sp, + textColor: Color(0xFF32A060), + borderColor: Color(0xFF32A060), + borderWidth: 1.w, + radius: 23, + ), + ), + ), + 15.vd, + Expanded( + child: Container( + height: 40.h, + margin: EdgeInsets.only(bottom: 20.h), + alignment: Alignment.bottomCenter, + child: RoundButton( + text: S.of(context).tongyibingjixu, + textColor: Colors.white, + fontSize: 12.sp, + callback: () { + SharedPreferences.getInstance().then((value) { + value.setBool("isShowPrivacyPolicy", true); + }); + SharesdkPlugin.uploadPrivacyPermissionStatus( + 1, + (success) { + Navigator.of(context).pop(); + }, + ); + }, + padding: EdgeInsets.only( + top: 10.h, + bottom: 10.h, + left: 21.5.w, + right: 21.5.w, + ), + backgroup: Color(0xff32A060), + radius: 23, + ), + ), + ), + ], ), ], ), - ], - ) - ], - )); + ), + ], + ), + ); }, ); } diff --git a/lib/home/home_page.dart b/lib/home/home_page.dart index 57c7296a..f3fc789d 100644 --- a/lib/home/home_page.dart +++ b/lib/home/home_page.dart @@ -475,8 +475,8 @@ class HomePageState extends State with AutomaticKeepAliveClientMixin { }), ///推广图 - if(activityBannerData.length > 0) - spread(), + if (activityBannerData.length > 0) + spread(), // ///签到 // SignView(isSigned, (value) { @@ -571,7 +571,7 @@ class HomePageState extends State with AutomaticKeepAliveClientMixin { ), autoplay: true, duration: 1000, - autoplayDelay: 2000, + autoplayDelay: 3000, physics: BouncingScrollPhysics(), itemBuilder: (context, position) { return InkWell( @@ -668,7 +668,7 @@ class HomePageState extends State with AutomaticKeepAliveClientMixin { ), autoplay: true, duration: 1000, - autoplayDelay: 2000, + autoplayDelay: 2500, itemBuilder: (context, position) { return InkWell( onTap: () { diff --git a/lib/home/home_view/welfare_core.dart b/lib/home/home_view/welfare_core.dart index eec32cc0..e0b2ff09 100644 --- a/lib/home/home_view/welfare_core.dart +++ b/lib/home/home_view/welfare_core.dart @@ -71,7 +71,7 @@ class _WelfareCore extends State { }, child: Container( width: double.infinity, - height: 75.h, + height: 76.h, decoration: BoxDecoration( image: DecorationImage( fit: BoxFit.fill, diff --git a/lib/login/new_login_page.dart b/lib/login/new_login_page.dart index c6018a39..4facda62 100644 --- a/lib/login/new_login_page.dart +++ b/lib/login/new_login_page.dart @@ -12,7 +12,6 @@ import 'package:huixiang/data/channels.dart'; import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/data/base_data.dart'; import 'package:huixiang/data/examine_instance.dart'; -import 'package:huixiang/data/login_info.dart'; import 'package:huixiang/data/user_entity.dart'; import 'package:huixiang/retrofit/retrofit_api.dart'; import 'package:huixiang/utils/event_type.dart'; @@ -65,15 +64,16 @@ class _NewLoginPage extends State { isLogin(); } - queryChannels() async{ - BaseData? baseData = await apiService?.appChannels().catchError((error) { + queryChannels() async { + BaseData? baseData = + await apiService?.appChannels().catchError((error) { print(error.message); SmartDialog.showToast(AppUtils.dioErrorTypeToString(error.type), alignment: Alignment.center); }); if (baseData?.isSuccess ?? false) { channelsList = baseData!.data; - setState((){}); + setState(() {}); } else { SmartDialog.showToast("${baseData?.msg}", alignment: Alignment.center); } @@ -216,9 +216,11 @@ class _NewLoginPage extends State { "mobile": mobile, "invite": invite, "areaCode": area, - "regChannel":channelName ?? "" + "regChannel": channelName ?? "" }; - EasyLoading.show(status: S.of(context).zhengzaijiazai,maskType: EasyLoadingMaskType.black); + EasyLoading.show( + status: S.of(context).zhengzaijiazai, + maskType: EasyLoadingMaskType.black); BaseData? value = await apiService?.memberLogin(param).catchError((error) { print(error.message); SmartDialog.showToast(AppUtils.dioErrorTypeToString(error.type), @@ -227,7 +229,8 @@ class _NewLoginPage extends State { // EasyLoading.show(status: S.of(context).zhengzaijiazai); if (value?.isSuccess ?? false) { var userInfo = value!.data; - ExamineInstance.instance.isExamine = userInfo.authInfo?.account == "13800138000"; + ExamineInstance.instance.isExamine = + userInfo.authInfo?.account == "13800138000"; saveUserJson(userInfo.authInfo?.toJson()); eventBus.fire(EventType(3)); @@ -265,7 +268,8 @@ class _NewLoginPage extends State { if (sharedPreferences.containsKey('token') && sharedPreferences.getString("token") != null && sharedPreferences.getString("token") != "") { - ExamineInstance.instance.isExamine = sharedPreferences.getString("mobile") == "13800138000"; + ExamineInstance.instance.isExamine = + sharedPreferences.getString("mobile") == "13800138000"; Navigator.of(context).popAndPushNamed('/router/main_page'); } else { apiService = ApiService(Dio(), context: context); @@ -275,7 +279,6 @@ class _NewLoginPage extends State { } } - @override void dispose() { if (_timer?.isActive ?? true) { @@ -287,51 +290,52 @@ class _NewLoginPage extends State { @override Widget build(BuildContext context) { return Scaffold( - resizeToAvoidBottomInset: false, - body: GestureDetector( - behavior: HitTestBehavior.translucent, - onTap: () { - FocusScope.of(context).requestFocus(FocusNode()); - }, - child: AnimatedCrossFade( - firstChild: Container( - color: Colors.white, - child: Image.asset( - "assets/image/ic_splash_bg.webp", - fit: BoxFit.fill, + resizeToAvoidBottomInset: false, + body: GestureDetector( + behavior: HitTestBehavior.translucent, + onTap: () { + FocusScope.of(context).requestFocus(FocusNode()); + }, + child: AnimatedCrossFade( + firstChild: Container( + color: Colors.white, + child: Image.asset( + "assets/image/ic_splash_bg.webp", + fit: BoxFit.fill, + ), ), + layoutBuilder: (widgetFirst, keyFirst, widgetSecond, keySecond) { + return Stack( + clipBehavior: Clip.none, + children: [ + Positioned( + key: keySecond, + left: 0.0, + top: 0.0, + right: 0.0, + bottom: 0.0, + child: widgetSecond, + ), + Positioned( + key: keyFirst, + left: 0.0, + top: 0.0, + right: 0.0, + bottom: 0.0, + child: widgetFirst, + ), + ], + ); + }, + secondChild: substance(), + firstCurve: Curves.easeInQuart, + secondCurve: Curves.easeInQuart, + crossFadeState: isShowLogin + ? CrossFadeState.showSecond + : CrossFadeState.showFirst, + duration: Duration(milliseconds: Platform.isIOS ? 1000 : 1000), ), - layoutBuilder: (widgetFirst, keyFirst, widgetSecond, keySecond) { - return Stack( - clipBehavior: Clip.none, - children: [ - Positioned( - key: keySecond, - left: 0.0, - top: 0.0, - right: 0.0, - bottom: 0.0, - child: widgetSecond, - ), - Positioned( - key: keyFirst, - left: 0.0, - top: 0.0, - right: 0.0, - bottom: 0.0, - child: widgetFirst, - ), - ], - ); - }, - secondChild: substance(), - firstCurve: Curves.easeInQuart, - secondCurve: Curves.easeInQuart, - crossFadeState: - isShowLogin ? CrossFadeState.showSecond : CrossFadeState.showFirst, - duration: Duration(milliseconds: Platform.isIOS ? 1000 : 1000), ), - ), ); } @@ -353,9 +357,10 @@ class _NewLoginPage extends State { Container( width: double.infinity, padding: EdgeInsets.only( - left: 16.w, - top: 45.h + MediaQuery.of(context).padding.top, - right: 12.w), + left: 16.w, + top: 45.h + MediaQuery.of(context).padding.top, + right: 12.w, + ), child: Column( mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, @@ -395,24 +400,25 @@ class _NewLoginPage extends State { crossAxisAlignment: CrossAxisAlignment.center, children: [ GestureDetector( - onTap: () { - Navigator.of(context) - .pushNamed('/router/phone_address_page') - .then((value) { - if (value != null) - setState(() { - area = value as String; - }); - }); - }, - child: Text( - area, - style: TextStyle( - fontWeight: MyFontWeight.regular, - fontSize: 16.sp, - color: Color(0xFF1A1A1A), - ), - )), + onTap: () { + Navigator.of(context) + .pushNamed('/router/phone_address_page') + .then((value) { + if (value != null) + setState(() { + area = value as String; + }); + }); + }, + child: Text( + area, + style: TextStyle( + fontWeight: MyFontWeight.regular, + fontSize: 16.sp, + color: Color(0xFF1A1A1A), + ), + ), + ), Icon( Icons.keyboard_arrow_right, size: 18, @@ -421,7 +427,9 @@ class _NewLoginPage extends State { Container( height: 30.h, width: MediaQuery.of(context).size.width - 100.w, - margin: EdgeInsets.only(bottom:Platform.isIOS ? 10.h:5.h), + margin: EdgeInsets.only( + bottom: Platform.isIOS ? 10.h : 5.h, + ), child: TextField( style: TextStyle( height: 1.h, @@ -598,50 +606,59 @@ class _NewLoginPage extends State { height: 30.h, ), if (channelsList?.isOpen ?? false) - GestureDetector( - onTap: (){ - Navigator.of(context).pushNamed( - '/router/login_store_select',arguments: { - "channelsList":channelsList, - }, - ).then((value) => { - setState(() { - if (value != null) { - channelName = value as String; - } - }) - }); - }, - child:Container( - padding: EdgeInsets.only( - left: 12.w, right: 12.w, top: 16.h, bottom: 16.h - ), - margin: EdgeInsets.only(bottom:30.h), - decoration: BoxDecoration( - color: Color(0xFFF1F1F1), - borderRadius: BorderRadius.circular(4), - ), - child: Row( - children: [ - SizedBox(width: 3.w,), - Expanded( - child:Text( - channelName ?? "邀请来源(选填)", - style: TextStyle( - fontWeight: MyFontWeight.regular, - fontSize: channelName == null ? 12.sp : 13.sp, - color:channelName == null ? Color(0xFF868686) : Color(0xFF1A1A1A), + GestureDetector( + onTap: () { + Navigator.of(context).pushNamed( + '/router/login_store_select', + arguments: { + "channelsList": channelsList, + }, + ).then((value) => { + setState(() { + if (value != null) { + channelName = value as String; + } + }) + }); + }, + child: Container( + padding: EdgeInsets.only( + left: 12.w, + right: 12.w, + top: 16.h, + bottom: 16.h, + ), + margin: EdgeInsets.only(bottom: 30.h), + decoration: BoxDecoration( + color: Color(0xFFF1F1F1), + borderRadius: BorderRadius.circular(4), + ), + child: Row( + children: [ + SizedBox( + width: 3.w, ), - ), - ), - Icon( - Icons.arrow_forward_ios, - size: 16, - ), - ], + Expanded( + child: Text( + channelName ?? "邀请来源(选填)", + style: TextStyle( + fontWeight: MyFontWeight.regular, + fontSize: + channelName == null ? 12.sp : 13.sp, + color: channelName == null + ? Color(0xFF868686) + : Color(0xFF1A1A1A), + ), + ), + ), + Icon( + Icons.arrow_forward_ios, + size: 16, + ), + ], + ), ), ), - ), Row( mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.center, @@ -654,58 +671,63 @@ class _NewLoginPage extends State { }); }, checkColor: Color(0xFFFFFFFF), - fillColor: MaterialStateProperty.all(Color(0xFF32A060)), + hoverColor: Colors.white, + activeColor: Color(0xFF32A060), + focusColor: Colors.white, + overlayColor: + MaterialStateProperty.all(Colors.white), ), Expanded( - child: Text.rich( - TextSpan(children: [ - TextSpan( - text: S.of(context).privacy_policy1, - style: TextStyle( - fontSize: 11.sp, - color: Color(0xFF010101), - ), - ), + child: Text.rich( TextSpan( - // text: S.of(context).privacy_policy2, - text: "《海峡姐妹用户协议》", - recognizer: TapGestureRecognizer() - ..onTap = () { - Navigator.of(context).pushNamed( - '/router/user_service_page'); - }, - style: TextStyle( - fontSize: 11.sp, - color: Color(0xFF32A060), - ), - ), - TextSpan( - text: "、", - style: TextStyle( - fontSize: 11.sp, - color: Colors.black, - ), - ), - TextSpan( - text: S.of(context).privacy_policy3, - recognizer: tapGestureRecognizer, - style: TextStyle( - fontSize: 11.sp, - color: Color(0xFF32A060), - ), - ), - TextSpan( - text: S.of(context).privacy_policy4, - style: TextStyle( - fontSize: 11.sp, - height: 1.2, - color: Color(0xFF010101), - ), + children: [ + TextSpan( + text: S.of(context).privacy_policy1, + style: TextStyle( + fontSize: 11.sp, + color: Color(0xFF010101), + ), + ), + TextSpan( + // text: S.of(context).privacy_policy2, + text: "《海峡姐妹用户协议》", + recognizer: TapGestureRecognizer() + ..onTap = () { + Navigator.of(context).pushNamed( + '/router/user_service_page'); + }, + style: TextStyle( + fontSize: 11.sp, + color: Color(0xFF32A060), + ), + ), + TextSpan( + text: "、", + style: TextStyle( + fontSize: 11.sp, + color: Colors.black, + ), + ), + TextSpan( + text: S.of(context).privacy_policy3, + recognizer: tapGestureRecognizer, + style: TextStyle( + fontSize: 11.sp, + color: Color(0xFF32A060), + ), + ), + TextSpan( + text: S.of(context).privacy_policy4, + style: TextStyle( + fontSize: 11.sp, + height: 1.2, + color: Color(0xFF010101), + ), + ), + ], ), - ], ), ), - ), SizedBox( width: 30, ) @@ -843,9 +865,9 @@ class _NewLoginPage extends State { TextSpan( text: S.of(context).yinsixieyi, style: TextStyle( - fontWeight: MyFontWeight.medium, - fontSize: 14.sp, - color: Color(0xff32A060), + fontWeight: MyFontWeight.medium, + fontSize: 14.sp, + color: Color(0xff32A060), ), recognizer: TapGestureRecognizer() ..onTap = () { @@ -955,8 +977,7 @@ class _NewLoginPage extends State { } //滑动拼图 - loadingBlockPuzzle(BuildContext context, - {barrierDismissible = true}) { + loadingBlockPuzzle(BuildContext context, {barrierDismissible = true}) { showDialog( context: context, barrierDismissible: barrierDismissible, @@ -973,10 +994,15 @@ class _NewLoginPage extends State { ); } - sendSms(v) async{ - BaseData? baseData = await apiService?.sendVerify({"areaCode":area, "mobile": mobile, "verification": v}).catchError((onError) { + sendSms(v) async { + BaseData? baseData = await apiService?.sendVerify({ + "areaCode": area, + "mobile": mobile, + "verification": v + }).catchError((onError) { SmartDialog.showToast(AppUtils.dioErrorTypeToString(onError.type), - alignment: Alignment.center);}); + alignment: Alignment.center); + }); if (baseData?.isSuccess ?? false) { _sendCodeStatus = 1; countdown(); diff --git a/lib/main_page.dart b/lib/main_page.dart index 859361c2..825b3cea 100644 --- a/lib/main_page.dart +++ b/lib/main_page.dart @@ -31,6 +31,7 @@ import 'package:permission_handler/permission_handler.dart'; import 'package:shared_preferences/shared_preferences.dart'; import 'package:sharesdk_plugin/sharesdk_interface.dart'; import 'package:sharesdk_plugin/sharesdk_register.dart'; +import 'package:tpns_flutter_plugin/android/native_event_handler.dart'; import 'package:tpns_flutter_plugin/android/xg_android_api.dart'; import 'package:tpns_flutter_plugin/tpns_flutter_plugin.dart'; // import 'package:umeng_common_sdk/umeng_common_sdk.dart'; @@ -215,6 +216,57 @@ class _MainPage extends State with WidgetsBindingObserver { ///此处配置为iOS的appID信息,Android信息在build.gradle文件中 xgFlutterPlugin.startXg("1680005688", "IYIB3R2XRE22"); + // xgFlutterPlugin.addEventHandler( + // onReceiveMessage: (Map event) async { + // print("onReceiveMessage: ${event.toString()}"); + // return true; + // }, + // onReceiveNotificationResponse: (Map event) async { + // print("onReceiveNotificationResponse: ${event.toString()}"); + // return true; + // }, + // xgPushDidBindWithIdentifier: (Map event) async { + // print("xgPushDidBindWithIdentifier: ${event.toString()}"); + // return true; + // }, + // xgPushDidUnbindWithIdentifier: (Map event) async { + // print("xgPushDidUnbindWithIdentifier: ${event.toString()}"); + // return true; + // }, + // xgPushDidUpdatedBindedIdentifier: (Map event) async { + // print("xgPushDidUpdatedBindedIdentifier: ${event.toString()}"); + // return true; + // }, + // xgPushClickAction: (Map event) async { + // print("xgPushClickAction: ${event.toString()}"); + // return true; + // }, + // xgPushDidClearAllIdentifiers: (Map event) async { + // print("xgPushDidClearAllIdentifiers: ${event.toString()}"); + // return true; + // }, + // onRegisteredDeviceToken: (String res) async { + // print("onRegisteredDeviceToken: ${res}"); + // return true; + // }, + // onRegisteredDone: (String res) async { + // print("onRegisteredDone: ${res}"); + // return true; + // }, + // unRegistered: (String res) async { + // print("unRegistered: ${res}"); + // return true; + // }, + // xgPushNetworkConnected: (String res) async { + // print("xgPushNetworkConnected: ${res}"); + // return true; + // }, + // xgPushDidSetBadge: (String res) async { + // print("xgPushDidSetBadge: ${res}"); + // return true; + // }, + // ); + if (Platform.isAndroid) { XgAndroidApi androidApi = xgFlutterPlugin.getXgAndroidApi(); //小米 @@ -225,6 +277,8 @@ class _MainPage extends State with WidgetsBindingObserver { androidApi.regPush(); } + // ===========================TPNS==== + ShareSDKRegister shareSDKRegister = ShareSDKRegister(); shareSDKRegister.setupWechat( "wx3b269e795ed23e5f", diff --git a/lib/setting/about_page.dart b/lib/setting/about_page.dart index 6a517930..00d943bf 100644 --- a/lib/setting/about_page.dart +++ b/lib/setting/about_page.dart @@ -4,6 +4,7 @@ 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/utils/constant.dart'; import 'package:huixiang/utils/font_weight.dart'; import 'package:huixiang/view_widget/my_appbar.dart'; import 'package:package_info_plus/package_info_plus.dart'; @@ -43,10 +44,10 @@ class _AboutPage extends State { Container( decoration: new BoxDecoration( border: Border( - bottom: BorderSide( - color: Color(0xffF7F7F7), - width: 0.0, - ), + bottom: BorderSide( + color: Color(0xffF7F7F7), + width: 0.0, + ), ), color: Color(0xffF7F7F7), ), @@ -54,87 +55,92 @@ class _AboutPage extends State { alignment: Alignment.center, child: SingleChildScrollView( physics: BouncingScrollPhysics(), - child:Column( - children: [ - Image.asset( - "assets/image/icon_about_logo.webp", - width: 130, - height: 130, - ), - Padding( - padding: EdgeInsets.only(top: 32, bottom: 5), - child: Text( - S.of(context).yixinhuixiang, - style: TextStyle( - fontSize: 30, - color: Color(0xFF30415B), + child: Column( + children: [ + Image.asset( + "assets/image/icon_about_logo.webp", + width: 130, + height: 130, + ), + Padding( + padding: { + 't': 32, + 'b': 5, + 'l': 15, + 'r': 15, + }.mpOnly, + child: Text( + S.of(context).yixinhuixiang, + overflow: TextOverflow.ellipsis, + textAlign: TextAlign.center, + maxLines: 1, + style: TextStyle( + fontSize: 30, + color: Color(0xFF30415B), + ), ), ), - ), - Text( - S.of(context).guojiankangyoujishenghuo, - style: TextStyle( - fontSize: 16, + Text( + S.of(context).guojiankangyoujishenghuo, + overflow: TextOverflow.ellipsis, + textAlign: TextAlign.center, + maxLines: 1, + style: TextStyle( + fontSize: 16, fontWeight: MyFontWeight.regular, - color: Color(0xffB2B2B2), + color: Color(0xffB2B2B2), + ), ), - ), - SizedBox( - height: 20, - ), - GestureDetector( - onTap: (){ + SizedBox( + height: 20, + ), + GestureDetector( + onTap: () { // updateApp(); - }, - child:settingItem( + }, + child: settingItem( S.of(context).dangqianbanben, S.of(context).banben(version), - ) - ), - // textItem(S.of(context).tebieshengming), - if (!Platform.isAndroid) + ), + ), + // textItem(S.of(context).tebieshengming), + if (!Platform.isAndroid) + GestureDetector( + child: settingSingleItem(S.of(context).geiwopingfen), + onTap: () { + // Bridge.toAppStore().then((value) { + // if (Platform.isAndroid && value == "0") { + // SmartDialog.showToast("手机没有安装应用市场app", + // alignment: Alignment.center); + // } + // }); + }, + ), GestureDetector( - child: settingSingleItem(S.of(context).geiwopingfen), + child: settingSingleItem(S.of(context).yinsishengming), onTap: () { - // Bridge.toAppStore().then((value) { - // if (Platform.isAndroid && value == "0") { - // SmartDialog.showToast("手机没有安装应用市场app", - // alignment: Alignment.center); - // } - // }); + Navigator.of(context).pushNamed('/router/treaty_page'); }, ), - GestureDetector( - child: settingSingleItem(S.of(context).yinsishengming), - onTap: () { - Navigator.of(context).pushNamed('/router/treaty_page'); - }, - ), - GestureDetector( - child: settingSingleItem("用户协议"), - onTap: () { - Navigator.of(context).pushNamed('/router/user_service_page'); - }, - ), - GestureDetector( - child: settingSingleItem("注销账户"), - onTap: () { - Navigator.of(context).pushNamed('/router/logout_page'); - }, - ), - Padding( - padding: EdgeInsets.only(left: 20, right: 20), - child: Divider( - height: 10.0, - indent: 0.0, - color: Colors.grey, + GestureDetector( + child: settingSingleItem("用户协议"), + onTap: () { + Navigator.of(context) + .pushNamed('/router/user_service_page'); + }, ), - ), - SizedBox( - height:100, - ), - ], - ),) + GestureDetector( + child: settingSingleItem("注销账户"), + onTap: () { + Navigator.of(context).pushNamed('/router/logout_page'); + }, + ), + SizedBox( + height: 100, + ), + ], + ), + ), ), Container( margin: EdgeInsets.only(bottom: 23), @@ -178,11 +184,11 @@ class _AboutPage extends State { } updateApp() async { - String url = Platform.isIOS + Uri url = Uri.parse(Platform.isIOS ? "itms-apps://itunes.apple.com/app/id1575124838" - : "http://application.lotus-wallet.com/huixiang?release_id="; - if (await canLaunch(url)) { - await launch(url); + : "http://application.lotus-wallet.com/huixiang?release_id="); + if (await canLaunchUrl(url)) { + await launchUrl(url); } else { throw 'Could not launch $url'; } @@ -191,38 +197,29 @@ class _AboutPage extends State { Widget settingSingleItem(right) { return Container( margin: EdgeInsets.fromLTRB(16, 0, 16, 0), - child: Column( - children: [ - Divider( - height: 10.0, - indent: 0.0, - color: Colors.grey, - ), - Padding( - padding: EdgeInsets.only(top: 15, bottom: 15), - child: Row( - children: [ - Expanded( - child: Text( - right, - style: TextStyle( - fontSize: 16, - color: Color(0xFF353535), - fontWeight: MyFontWeight.medium, - ), - ), - ), - SizedBox( - width: 16, - ), - Icon( - Icons.keyboard_arrow_right, - size: 24, - ), - ], + child: Padding( + padding: EdgeInsets.only(top: 15, bottom: 15), + child: Row( + children: [ + Expanded( + child: Text( + right, + style: TextStyle( + fontSize: 16, + color: Color(0xFF353535), + fontWeight: MyFontWeight.medium, + ), ), - ), - ], + ), + SizedBox( + width: 16, + ), + Icon( + Icons.keyboard_arrow_right, + size: 24, + ), + ], + ), ), ); } @@ -230,40 +227,31 @@ class _AboutPage extends State { Widget settingItem(left, right) { return Container( margin: EdgeInsets.fromLTRB(16, 0, 16, 0), - child: Column( - children: [ - Divider( - height: 10.0, - indent: 0.0, - color: Colors.grey, - ), - Padding( - padding: EdgeInsets.only(top: 15, bottom: 15), - child: Row( - children: [ - Expanded( - child: Text( - left, - style: TextStyle( - fontWeight: MyFontWeight.medium, - fontSize: 16, - color: Color(0xFF353535), - ), - ), - flex: 1, - ), - Text( - right, - style: TextStyle( - fontSize: 16, - fontWeight: MyFontWeight.regular, - color: Color(0xFF727272), - ), - ), - ], + child: Padding( + padding: EdgeInsets.only(top: 15, bottom: 15), + child: Row( + children: [ + Expanded( + child: Text( + left, + style: TextStyle( + fontWeight: MyFontWeight.medium, + fontSize: 16, + color: Color(0xFF353535), + ), ), - ), - ], + flex: 1, + ), + Text( + right, + style: TextStyle( + fontSize: 16, + fontWeight: MyFontWeight.regular, + color: Color(0xFF727272), + ), + ), + ], + ), ), ); } @@ -273,26 +261,16 @@ class _AboutPage extends State { width: double.infinity, // padding: EdgeInsets.fromLTRB(20, 16, 20, 16), margin: EdgeInsets.fromLTRB(16, 0, 16, 0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Divider( - height: 10.0, - indent: 0.0, - color: Colors.grey, - ), - Padding( - padding: EdgeInsets.only(top: 15, bottom: 15), - child: Text( - text, - style: TextStyle( - fontWeight: MyFontWeight.medium, - fontSize: 16, - color: Color(0xFF353535), - ), - ), + child: Padding( + padding: EdgeInsets.only(top: 15, bottom: 15), + child: Text( + text, + style: TextStyle( + fontWeight: MyFontWeight.medium, + fontSize: 16, + color: Color(0xFF353535), ), - ], + ), ), ); } diff --git a/lib/setting/treaty_page.dart b/lib/setting/treaty_page.dart index b6bf4876..1faf1eb1 100644 --- a/lib/setting/treaty_page.dart +++ b/lib/setting/treaty_page.dart @@ -59,23 +59,23 @@ class _TreatyPage extends State { try { _webViewController = WebViewController() ..setJavaScriptMode(JavaScriptMode.unrestricted) - // ..setNavigationDelegate( - // NavigationDelegate( - // onProgress: (int progress) {}, - // onPageStarted: (String url) {}, - // onPageFinished: (String url) { - // EasyLoading.dismiss(); - // }, - // onWebResourceError: (WebResourceError error) {}, - // onNavigationRequest: (NavigationRequest request) { - // // if (request.url.startsWith('https://www.youtube.com/')) { - // // return NavigationDecision.prevent; - // // } - // return NavigationDecision.navigate; - // }, - // ), - // ) - ..loadRequest(Uri.parse("https://huixiang.lotus-wallet.com/Privacy.html")); + ..setNavigationDelegate( + NavigationDelegate( + onProgress: (int progress) {}, + onPageStarted: (String url) {}, + onPageFinished: (String url) { + EasyLoading.dismiss(); + }, + onWebResourceError: (WebResourceError error) {}, + onNavigationRequest: (NavigationRequest request) { + // if (request.url.startsWith('https://www.youtube.com/')) { + // return NavigationDecision.prevent; + // } + return NavigationDecision.navigate; + }, + ), + ) + ..loadRequest(Uri.parse("http://huixiang.lotus-wallet.com/Privacy.html")); res = WebViewWidget(controller: _webViewController!); } catch (error) { res = Text("加载失败"); diff --git a/lib/view_widget/round_button.dart b/lib/view_widget/round_button.dart index d9fccfe0..e1e0e8c5 100644 --- a/lib/view_widget/round_button.dart +++ b/lib/view_widget/round_button.dart @@ -51,6 +51,7 @@ class RoundButton extends StatelessWidget { Widget buildText() { Widget textWidget = Text( text ?? "", + overflow: TextOverflow.ellipsis, style: TextStyle( color: textColor, fontSize: fontSize, @@ -71,6 +72,7 @@ class RoundButton extends StatelessWidget { } else { return Row( mainAxisSize: MainAxisSize.min, + mainAxisAlignment: MainAxisAlignment.center, children: [ textWidget, ], diff --git a/pubspec.lock b/pubspec.lock index b6d74f72..08614829 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -1342,11 +1342,11 @@ packages: dependency: "direct main" description: path: "." - ref: "V1.1.6" - resolved-ref: a7e45d151171f9ec4b56bc97a720f545aa4a8722 + ref: "V1.2.8" + resolved-ref: "74309ee04cada555cb4eaa22da06a0b9d0bb86e4" url: "https://github.com/TencentCloud/TPNS-Flutter-Plugin" source: git - version: "1.1.6" + version: "1.2.8" tuple: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 6480ccc6..363bc2e8 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -44,7 +44,7 @@ dependencies: tpns_flutter_plugin: git: url: https://github.com/TencentCloud/TPNS-Flutter-Plugin - ref: V1.1.6 + ref: V1.2.8 umeng_common_sdk: ^1.2.7 like_button: ^2.0.5