diff --git a/android/app/src/main/java/co/steamcloud/game/Config.java b/android/app/src/main/java/co/steamcloud/game/Config.java index 9feb0b2..a73f438 100644 --- a/android/app/src/main/java/co/steamcloud/game/Config.java +++ b/android/app/src/main/java/co/steamcloud/game/Config.java @@ -9,7 +9,11 @@ public class Config { public static String userToken = "";//用户token public static String gameId = "";//游戏id - public static String sn = ""; + public static String sn = "";//设备号 + public static String Language = "";//系统语言 + public static String Channel = "";//渠道号 + public static String Platform = "android";//平台类型 + public static String Version = "";//版本号 public static String client_sid = ""; @@ -34,6 +38,12 @@ public class Config { public static int gamePing = 0;//游戏中ping值 提供给游戏画面显示 + public static float NetworkDelay_Average = 0;//网络延迟平均值 + + public static float NetworkLoss_Rate = 0; //网络丢包率 + public static float AverageDecodSpeed = 0; //平均解码耗时 + public static float FPS_Average = 0;//fps平均值 + public static int sc_id = 0;//会话id public static int play_queue_id = 0; //队列id diff --git a/android/app/src/main/java/co/steamcloud/game/HttpUtils/HttpTool.java b/android/app/src/main/java/co/steamcloud/game/HttpUtils/HttpTool.java index 45d10b2..63cfc0e 100644 --- a/android/app/src/main/java/co/steamcloud/game/HttpUtils/HttpTool.java +++ b/android/app/src/main/java/co/steamcloud/game/HttpUtils/HttpTool.java @@ -57,6 +57,10 @@ public class HttpTool { } Request request = new Request.Builder() .header("Authorization", "Bearer " + Config.userToken) + .header("Channel", Config.Channel) + .header("Platform", Config.Platform) + .header("Version", Config.Version) + .header("Language", Config.Language) .addHeader("accept", "text/plain") .addHeader("Content-Type", "application/json-patch+json") .url(url) diff --git a/android/app/src/main/java/co/steamcloud/game/HttpUtils/OpenApiRequest.java b/android/app/src/main/java/co/steamcloud/game/HttpUtils/OpenApiRequest.java index 8236be2..fc8e2db 100644 --- a/android/app/src/main/java/co/steamcloud/game/HttpUtils/OpenApiRequest.java +++ b/android/app/src/main/java/co/steamcloud/game/HttpUtils/OpenApiRequest.java @@ -56,10 +56,11 @@ public class OpenApiRequest { * * @param mListener 监听 */ - public void exitPlayGame(final OnApiRequestListener mListener) { + public void exitPlayGame(String playGameDetails, final OnApiRequestListener mListener) { String url = Config.url + "api/PlayGame/ExitPlayGame"; final Map map = new HashMap<>(); map.put("gameId", Config.gameId); + map.put("playGameDetails", playGameDetails); map.put("sign", sign(map, Config.sign_key)); // 将HashMap转换为JSONObject JSONObject jsonObject = new JSONObject(map); diff --git a/android/app/src/main/java/co/steamcloud/game/MainActivity.java b/android/app/src/main/java/co/steamcloud/game/MainActivity.java index 8dc865e..dde9ab3 100644 --- a/android/app/src/main/java/co/steamcloud/game/MainActivity.java +++ b/android/app/src/main/java/co/steamcloud/game/MainActivity.java @@ -98,6 +98,8 @@ public class MainActivity extends FlutterActivity { Config.client_sid = call.argument("channelId"); Config.sign_key = call.argument("signKey"); Config.userToken = call.argument("userToken"); + Config.Channel = call.argument("Channel"); + Config.Version = call.argument("Version"); initSdk(Config.BsUrl, Config.client_sid, gameToken, Config.sn); Log.d(TAG, "onMethodCall: initData"); @@ -127,7 +129,9 @@ public class MainActivity extends FlutterActivity { case "getInfo": Map map = new HashMap<>(); Config.sn = AppUtil.getDeviceId(App.getInstance()); - map.put("deviceID", AppUtil.getDeviceId(App.getInstance())); + Config.Language = AppUtil.getSystemLanguage(); + map.put("deviceID", Config.sn); + map.put("Language", Config.Language); result.success(map); Log.d(TAG, "onMethodCall: getInfo"); diff --git a/android/app/src/main/java/co/steamcloud/game/PlayGameActivity.java b/android/app/src/main/java/co/steamcloud/game/PlayGameActivity.java index 1c2cb85..27fc220 100644 --- a/android/app/src/main/java/co/steamcloud/game/PlayGameActivity.java +++ b/android/app/src/main/java/co/steamcloud/game/PlayGameActivity.java @@ -2908,8 +2908,14 @@ public class PlayGameActivity extends Activity { if (ActivityCollector.activities != null && ActivityCollector.activities.size() > 0) { ActivityCollector.removeActivity(PlayGameActivity.this); } + + HashMap playGameDetailsMap = new HashMap<>(); + playGameDetailsMap.put("FPS_Average", Config.FPS_Average); + playGameDetailsMap.put("NetworkDelay_Average", Config.NetworkDelay_Average); + JSONObject jsonObject = new JSONObject(playGameDetailsMap); + //退出游戏 - openApiRequest.exitPlayGame(new OnApiRequestListener() { + openApiRequest.exitPlayGame(jsonObject.toString(), new OnApiRequestListener() { @Override public void onResponse(String data, int i, String s1) { Log.i(TAG, "exitPlayGame: data==" + data); @@ -2954,13 +2960,36 @@ public class PlayGameActivity extends Activity { } }); -// updateGameInfo(mapStatus); + updateGameInfo(mapStatus); //Log.d(TAG, "onQos: "+ reports); } catch (Exception e) { e.printStackTrace(); } } + public long count = 0; + + public void updateGameInfo(Map map) { + count++; + if (count <= 10) { + return; + } + int averageDecodSpeed = (int) Double.parseDouble(Objects.requireNonNull(map.get("DecodeMs"))); + Config.AverageDecodSpeed = getNewAverage(Config.AverageDecodSpeed, averageDecodSpeed, count - 10); + int fps_Average = (int) Double.parseDouble(Objects.requireNonNull(map.get("FrameRateOutput"))); + Config.FPS_Average = getNewAverage(Config.FPS_Average, fps_Average, count - 10); + int rtt = (int) Double.parseDouble(Objects.requireNonNull(map.get("Rtt"))); + Config.NetworkDelay_Average = getNewAverage(Config.NetworkDelay_Average, rtt, count - 10); + + } + + //刷新平均值 + public float getNewAverage(float average, float newValue, long connt) { + float newAverage = ((average * (connt - 1) + newValue) / connt); + + return newAverage; + } + @Override public void onError(int code, String msg) { Log.i(TAG, "startGame onError: " + code + "| " + msg); @@ -3046,16 +3075,28 @@ public class PlayGameActivity extends Activity { Log.d(TAG, "onResponse: code==" + code); Log.d(TAG, "onResponse: msg==" + msg); -// try { -// JSONObject jsonObject = new JSONObject(data); -// int gameConsumeDiamond = jsonObject.getInt("gameConsumeDiamond");//当前游戏消耗钻石数/每分钟 -// int userPlayGameTime = jsonObject.getInt("userPlayGameTime");//用户剩余游玩时间(分钟) -// int diamond = jsonObject.getInt("diamond");//钻石数 -// -// Log.d(TAG, "onResponse: data=" + jsonObject); -// } catch (Exception e) { -// throw new RuntimeException(e); -// } + try { + JSONObject jsonObject = new JSONObject(data); + String jsonData = jsonObject.getString("data"); + if (jsonData.equals("null")) { + Log.d(TAG, "onResponse: 心跳数据异常"); + return; + } + Log.d(TAG, "onResponse: jsonData==" + jsonData); + JSONObject heartData = new JSONObject(jsonData); + + int gameConsumeDiamond = heartData.getInt("gameConsumeDiamond");//当前游戏消耗钻石数/每分钟 + int userPlayGameTime = heartData.getInt("userPlayGameTime");//用户剩余游玩时间(分钟) + int diamond = heartData.getInt("diamond");//钻石数 + + if (userPlayGameTime <= 1) { + Toast.makeText(PlayGameActivity.this, "游玩时间不足,钻石耗尽将会自动退出游戏!", Toast.LENGTH_SHORT).show(); + } + + Log.d(TAG, "onResponse: data=" + jsonObject); + } catch (Exception e) { + throw new RuntimeException(e); + } } diff --git a/android/app/src/main/res/values/colors.xml b/android/app/src/main/res/values/colors.xml index bf6ec98..b7171fe 100644 --- a/android/app/src/main/res/values/colors.xml +++ b/android/app/src/main/res/values/colors.xml @@ -21,5 +21,7 @@ #E3E3E3 #FF7125 + #3E291C + diff --git a/lib/beans/user_info_bean.dart b/lib/beans/user_info_bean.dart index 68e2ad5..20e5e57 100644 --- a/lib/beans/user_info_bean.dart +++ b/lib/beans/user_info_bean.dart @@ -19,9 +19,10 @@ class UserInfoBean { String? userName; String? idCard; NightCardBean? nightCard; + int? userPlayGameTime; UserInfoBean(this.nickName, this.userId, this.phoneNum, this.email, this.userIcon, this.diamond, this.totalGamingTime, this.isRealName, - this.isJuveniles, this.userName, this.idCard, this.nightCard); + this.isJuveniles, this.userName, this.idCard, this.nightCard, this.userPlayGameTime); factory UserInfoBean.fromJson(Map json) => _$UserInfoBeanFromJson(json); diff --git a/lib/beans/user_info_bean.g.dart b/lib/beans/user_info_bean.g.dart index aa9536b..e61f6cf 100644 --- a/lib/beans/user_info_bean.g.dart +++ b/lib/beans/user_info_bean.g.dart @@ -18,13 +18,11 @@ UserInfoBean _$UserInfoBeanFromJson(Map json) => UserInfoBean( json['isJuveniles'] as bool?, json['userName'] as String?, json['idCard'] as String?, - json['nightCard'] == null - ? null - : NightCardBean.fromJson(json['nightCard'] as Map), + json['nightCard'] == null ? null : NightCardBean.fromJson(json['nightCard'] as Map), + (json['userPlayGameTime'] as num?)?.toInt(), ); -Map _$UserInfoBeanToJson(UserInfoBean instance) => - { +Map _$UserInfoBeanToJson(UserInfoBean instance) => { 'nickName': instance.nickName, 'userId': instance.userId, 'phoneNum': instance.phoneNum, @@ -37,4 +35,5 @@ Map _$UserInfoBeanToJson(UserInfoBean instance) => 'userName': instance.userName, 'idCard': instance.idCard, 'nightCard': instance.nightCard?.toJson(), + 'userPlayGameTime': instance.userPlayGameTime, }; diff --git a/lib/network/NetworkConfig.dart b/lib/network/NetworkConfig.dart index 50effde..764c83a 100644 --- a/lib/network/NetworkConfig.dart +++ b/lib/network/NetworkConfig.dart @@ -24,12 +24,12 @@ class NetworkConfig { static String signKey = ""; //加密key static String deviceID = ""; //设备号 static String deviceName = ""; //设备名称 - static String AppId = "1"; - static String BossId = ""; + static String Channel = ""; //渠道号 + static String Platform = ""; //设备平台名称 static String userId = ""; static String userName = ""; - static String Version = "1.0.0"; - static String Language = "en"; + static String Version = "1.0.0"; //应用版本 + static String Language = "zh"; //系统语言 static UserInfoBean? userInfoBean; //用户信息 static String orderId = ""; //订单号 static SignBean? signData; //签到 @@ -108,4 +108,6 @@ class NetworkConfig { static const String playGameQueue = "api/PlayGame/PlayGameQueue"; //游戏排队 static const String cancelQueue = "api/PlayGame/CancelQueue"; //取消排队 + + static const String exitApp = "api/Account/ExitApp"; //应用退出 } diff --git a/lib/network/RequestCenter.dart b/lib/network/RequestCenter.dart index 3b34f19..2a18736 100644 --- a/lib/network/RequestCenter.dart +++ b/lib/network/RequestCenter.dart @@ -110,7 +110,11 @@ class RequestCenter { Response response = await _dio!.post(path, data: parametersSign, options: Options( headers: { - 'Authorization': "Bearer ${NetworkConfig.token}" + 'Authorization': "Bearer ${NetworkConfig.token}", + "Channel":NetworkConfig.Channel, + "Platform":NetworkConfig.Platform, + "Version":NetworkConfig.Version, + "Language":NetworkConfig.Language, }, )); BaseEntity entity = BaseEntity.PlayfromJson(response.data); diff --git a/lib/tools/game/game_info_page.dart b/lib/tools/game/game_info_page.dart index e2e8b4b..d470f7f 100644 --- a/lib/tools/game/game_info_page.dart +++ b/lib/tools/game/game_info_page.dart @@ -102,9 +102,18 @@ class _GameInfoPageState extends State { final w331 = size.width / 1.0876132930513; final h44 = size.width / 8.1818181818181; final c22 = size.width / 16.363636363636; + final s14 = size.width / 25.714285714285; + final s13 = size.width / 27.692307692307; + final r20 = size.width / 18; + final l11 = size.width / 32.727272727272; + final l10 = size.width / 36; + final l15 = size.width / 24; + final t4 = size.width / 90; + final l5 = size.width / 72; + final l8 = size.width / 45; return Scaffold( - backgroundColor: Color(0xFF17181A), + backgroundColor: const Color(0xFF17181A), body: _isInitialized ? Stack( alignment: Alignment.center, @@ -131,7 +140,7 @@ class _GameInfoPageState extends State { }, child: Container( height: h50, - padding: const EdgeInsets.only(right: 20), + padding: EdgeInsets.only(right: r20), child: Image( width: w19, height: h26, @@ -149,7 +158,7 @@ class _GameInfoPageState extends State { _viewModel.gameCollect(widget.gameId); }, child: Container( - margin: const EdgeInsets.only(right: 14), + margin: EdgeInsets.only(right: s14), child: Image( width: w16, height: w16, @@ -160,7 +169,7 @@ class _GameInfoPageState extends State { ///分享 Container( - margin: const EdgeInsets.only(right: 14), + margin: EdgeInsets.only(right: s14), child: Image( width: w16, height: w16, @@ -187,7 +196,7 @@ class _GameInfoPageState extends State { handle: NestedScrollView.sliverOverlapAbsorberHandleFor(context), ), SliverPadding( - padding: EdgeInsets.only(top: t17, left: 14, right: 14), + padding: EdgeInsets.only(top: t17, left: s14, right: s14), sliver: SliverToBoxAdapter( child: SizedBox( width: size.width, @@ -212,11 +221,11 @@ class _GameInfoPageState extends State { ///游戏名 Positioned( - top: 11, + top: l11, left: l70, child: Text( "${gameData.gameName}", - style: TextStyle(fontSize: 14, color: Color(0xFFD6D6D7)), + style: TextStyle(fontSize: s14, color: Color(0xFFD6D6D7)), ), ), @@ -226,7 +235,7 @@ class _GameInfoPageState extends State { left: l70, child: Text( "${gameData.subtitle}", - style: TextStyle(fontSize: 13, color: Color(0xFFA6A6A6)), + style: TextStyle(fontSize: s13, color: Color(0xFFA6A6A6)), ), ), ], @@ -238,15 +247,15 @@ class _GameInfoPageState extends State { children: List.generate( gameData.gameTags!.length, (index) => Container( - margin: const EdgeInsets.only(right: 11, top: 10), - padding: const EdgeInsets.symmetric(horizontal: 15, vertical: 4), + margin: EdgeInsets.only(right: l11, top: l10), + padding: EdgeInsets.symmetric(horizontal: l15, vertical: t4), decoration: BoxDecoration( border: Border.all(color: const Color(0xFF177DA3)), borderRadius: BorderRadius.all(Radius.circular(c20)), ), child: Text( "${gameData.gameTags![index].name}", - style: const TextStyle(fontSize: 11, color: Color(0xFF939393)), + style: TextStyle(fontSize: l11, color: Color(0xFF939393)), ), ), ), @@ -259,7 +268,7 @@ class _GameInfoPageState extends State { margin: EdgeInsets.only(top: t18), child: Text( "${gameData.gameDetailsofCharges}", - style: const TextStyle(fontSize: 11, color: Color(0xFF939393)), + style: TextStyle(fontSize: l11, color: Color(0xFF939393)), ), ), @@ -273,10 +282,10 @@ class _GameInfoPageState extends State { children: [ Text( "此游戏由${gameData.gameShare}", - style: TextStyle(fontSize: 11, color: Color(0xFF747474)), + style: TextStyle(fontSize: l11, color: Color(0xFF747474)), ), Container( - margin: EdgeInsets.symmetric(horizontal: 5), + margin: EdgeInsets.symmetric(horizontal: l5), child: CachedNetworkImage( width: w16, height: w16, @@ -286,7 +295,7 @@ class _GameInfoPageState extends State { ), Text( "分享", - style: TextStyle(fontSize: 11, color: Color(0xFF747474)), + style: TextStyle(fontSize: l11, color: Color(0xFF747474)), ), ], ), @@ -307,27 +316,27 @@ class _GameInfoPageState extends State { width: size.width, height: h50, margin: EdgeInsets.only(top: t18), - decoration: const BoxDecoration( + decoration: BoxDecoration( color: Color(0xFF202530), - borderRadius: BorderRadius.all(Radius.circular(11)), + borderRadius: BorderRadius.all(Radius.circular(l11)), ), child: Row( children: [ Container( - margin: const EdgeInsets.only(left: 8), - child: const Image(width: 13, height: 13, image: AssetImage("assets/images/ic_cup.png"))), + margin: EdgeInsets.only(left: l8), + child: Image(width: s13, height: s13, image: AssetImage("assets/images/ic_cup.png"))), Container( - margin: const EdgeInsets.only(left: 8), - child: const Text( + margin: EdgeInsets.only(left: l8), + child: Text( "游戏时长排行榜", - style: TextStyle(fontSize: 13, color: Color(0xFFD6D6D7)), + style: TextStyle(fontSize: s13, color: Color(0xFFD6D6D7)), ), ), Expanded(child: Container()), Container( - margin: const EdgeInsets.only(right: 8), - child: const Image( - width: 5, + margin: EdgeInsets.only(right: l8), + child: Image( + width: l5, image: AssetImage("assets/images/ic_arrow.png"), ), ) @@ -340,14 +349,14 @@ class _GameInfoPageState extends State { Container( width: size.width, margin: EdgeInsets.only(top: t18), - child: const Text( + child: Text( "游戏简介", - style: TextStyle(fontSize: 14, color: Color(0xFFD6D6D7)), + style: TextStyle(fontSize: s14, color: Color(0xFFD6D6D7)), ), ), Container( width: size.width, - margin: const EdgeInsets.only(top: 13), + margin: EdgeInsets.only(top: s13), child: Html(data: "${gameData.gameIntroduce}"), ), @@ -355,15 +364,15 @@ class _GameInfoPageState extends State { Container( width: size.width, margin: EdgeInsets.only(top: t18), - child: const Text( + child: Text( "游戏推荐", - style: TextStyle(fontSize: 14, color: Color(0xFFD6D6D7)), + style: TextStyle(fontSize: s14, color: Color(0xFFD6D6D7)), ), ), Container( width: size.width, - height: h200, + // height: h200, margin: EdgeInsets.only(top: t18, bottom: b150), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, @@ -380,11 +389,11 @@ class _GameInfoPageState extends State { Container( alignment: Alignment.center, width: w95, - margin: const EdgeInsets.only(top: 11), + margin: EdgeInsets.only(top: l11), child: Text( "${infoRecommendList[index].gameName}", overflow: TextOverflow.ellipsis, - style: const TextStyle(color: Color(0xFF909090), fontSize: 14), + style: TextStyle(color: Color(0xFF909090), fontSize: s14), ), ), GestureDetector( @@ -395,14 +404,14 @@ class _GameInfoPageState extends State { width: w75, height: h32, alignment: Alignment.center, - margin: const EdgeInsets.only(top: 11), + margin: EdgeInsets.only(top: l11), decoration: BoxDecoration( color: const Color(0xFF074CE7), borderRadius: BorderRadius.all(Radius.circular(t18)), ), - child: const Text( + child: Text( "打开", - style: TextStyle(fontSize: 13, color: Colors.white), + style: TextStyle(fontSize: s13, color: Colors.white), ), ), ), @@ -434,9 +443,9 @@ class _GameInfoPageState extends State { color: const Color(0xFF074CE7), borderRadius: BorderRadius.all(Radius.circular(c22)), ), - child: const Text( + child: Text( "开始游戏", - style: TextStyle(fontSize: 14, color: Colors.white), + style: TextStyle(fontSize: s14, color: Colors.white), ), ), )) diff --git a/lib/tools/game/game_page.dart b/lib/tools/game/game_page.dart index 023c043..cfcd593 100644 --- a/lib/tools/game/game_page.dart +++ b/lib/tools/game/game_page.dart @@ -184,6 +184,9 @@ class _GamePageState extends State with AutomaticKeepAliveClientMixin final h35 = size.width / 10.285714285714; final t20 = size.width / 18; final w21 = size.width / 17.142857142857; + final s13 = size.width / 27.692307692307; + final h3 = size.width / 120; + final t5 = size.width / 72; return GestureDetector( behavior: HitTestBehavior.opaque, @@ -201,14 +204,14 @@ class _GamePageState extends State with AutomaticKeepAliveClientMixin children: [ Text( "${typeList[index].name}", - style: TextStyle(fontSize: 13, color: Color(currentTypeIndex == index ? 0xFFFFFFFF : 0xFF909090)), + style: TextStyle(fontSize: s13, color: Color(currentTypeIndex == index ? 0xFFFFFFFF : 0xFF909090)), ), currentTypeIndex == index ? Container( width: w21, - height: 3, + height: h3, color: Colors.white, - margin: EdgeInsets.only(top: 5), + margin: EdgeInsets.only(top: t5), ) : Container() ], @@ -223,6 +226,9 @@ class _GamePageState extends State with AutomaticKeepAliveClientMixin final w75 = size.width / 4.8; final h32 = size.width / 11.25; final c18 = size.width / 20; + final l11 = size.width / 32.727272727272; + final s14 = size.width / 25.714285714285; + final s13 = size.width / 27.692307692307; return GestureDetector( onTap: () { @@ -245,12 +251,12 @@ class _GamePageState extends State with AutomaticKeepAliveClientMixin ), Container( width: w107, - margin: const EdgeInsets.only(top: 11), + margin: EdgeInsets.only(top: l11), alignment: Alignment.center, child: Text( '${data.gameName}', overflow: TextOverflow.ellipsis, - style: const TextStyle(fontSize: 14, color: Color(0xFFD6D6D7)), + style: TextStyle(fontSize: s14, color: Color(0xFFD6D6D7)), ), ), GestureDetector( @@ -261,14 +267,14 @@ class _GamePageState extends State with AutomaticKeepAliveClientMixin width: w75, height: h32, alignment: Alignment.center, - margin: const EdgeInsets.only(top: 11), + margin: EdgeInsets.only(top: l11), decoration: BoxDecoration( color: const Color(0xFF074CE7), borderRadius: BorderRadius.all(Radius.circular(c18)), ), - child: const Text( + child: Text( "打开", - style: TextStyle(color: Colors.white, fontSize: 13), + style: TextStyle(color: Colors.white, fontSize: s13), ), ), ), diff --git a/lib/tools/game/game_play_time_page.dart b/lib/tools/game/game_play_time_page.dart index dcc899e..1e72352 100644 --- a/lib/tools/game/game_play_time_page.dart +++ b/lib/tools/game/game_play_time_page.dart @@ -66,6 +66,7 @@ class _GamePlaytimeState extends State { final h80 = size.width / 4.5; final w25 = size.width / 14.4; final w43 = size.width / 8.3720930232558; + final s13 = size.width / 27.692307692307; return Scaffold( backgroundColor: const Color(0xFF17181A), @@ -103,21 +104,21 @@ class _GamePlaytimeState extends State { margin: EdgeInsets.only(top: t20, left: l14, right: l14), child: Row( children: [ - const Text( + Text( "排名", - style: TextStyle(fontSize: 13, color: Color(0xFF909090)), + style: TextStyle(fontSize: s13, color: Color(0xFF909090)), ), Container( - margin: const EdgeInsets.only(left: 13), - child: const Text( + margin: EdgeInsets.only(left: s13), + child: Text( "用户信息", - style: TextStyle(fontSize: 13, color: Color(0xFF909090)), + style: TextStyle(fontSize: s13, color: Color(0xFF909090)), ), ), Expanded(child: Container()), - const Text( + Text( "游戏时间", - style: TextStyle(fontSize: 13, color: Color(0xFF909090)), + style: TextStyle(fontSize: s13, color: Color(0xFF909090)), ), ], ), @@ -149,7 +150,7 @@ class _GamePlaytimeState extends State { ), ), Container( - margin: const EdgeInsets.only(left: 13), + margin: EdgeInsets.only(left: s13), child: ClipOval( child: CachedNetworkImage( width: w43, @@ -160,7 +161,7 @@ class _GamePlaytimeState extends State { ), ), Container( - margin: const EdgeInsets.only(left: 13), + margin: EdgeInsets.only(left: s13), child: Text( "${gamePlayTimeBean.userGamePlayTime!.userName}", style: TextStyle(fontSize: l14, color: const Color(0xFFD6D6D7)), @@ -186,6 +187,7 @@ class _GamePlaytimeState extends State { final w25 = size.width / 14.4; final w43 = size.width / 8.3720930232558; final s14 = size.width / 25.714285714285; + final s13 = size.width / 27.692307692307; return Container( margin: EdgeInsets.only(bottom: b18), @@ -267,7 +269,7 @@ class _GamePlaytimeState extends State { ), ), Container( - margin: const EdgeInsets.only(left: 13), + margin: EdgeInsets.only(left: s13), child: ClipOval( child: CachedNetworkImage( width: w43, @@ -278,7 +280,7 @@ class _GamePlaytimeState extends State { ), ), Container( - margin: const EdgeInsets.only(left: 13), + margin: EdgeInsets.only(left: s13), child: Text( "${data.userName}", style: TextStyle(fontSize: s14, color: Color(0xFFD6D6D7)), diff --git a/lib/tools/home/home_ranking_page.dart b/lib/tools/home/home_ranking_page.dart index 985a0c4..f7ef567 100644 --- a/lib/tools/home/home_ranking_page.dart +++ b/lib/tools/home/home_ranking_page.dart @@ -45,6 +45,12 @@ class _HomeRankingPageState extends State { final h181 = size.width / 1.988950276243; final h126 = size.width / 2.8571428571428; final t17 = size.width / 21.176470588235; + final s14 = size.width / 25.714285714285; + final s13 = size.width / 27.692307692307; + final l11 = size.width / 32.727272727272; + final s12 = size.width / 30; + final t8 = size.width / 45; + final t9 = size.width / 40; return Column( children: [ @@ -78,9 +84,9 @@ class _HomeRankingPageState extends State { child: Container( width: w99, height: h104, - decoration: const BoxDecoration( - borderRadius: BorderRadius.all(Radius.circular(11)), - gradient: LinearGradient( + decoration: BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(l11)), + gradient: const LinearGradient( begin: Alignment.topCenter, end: Alignment.bottomCenter, colors: [ @@ -110,14 +116,14 @@ class _HomeRankingPageState extends State { ], ), ), - child: const Text( + child: Text( "2", - style: TextStyle(fontSize: 12, color: Colors.white), + style: TextStyle(fontSize: s12, color: Colors.white), ), ), ), Container( - margin: const EdgeInsets.only(top: 11), + margin: EdgeInsets.only(top: l11), child: CachedNetworkImage( width: w57, height: w57, @@ -126,13 +132,13 @@ class _HomeRankingPageState extends State { ), ), Container( - width: 75, - margin: EdgeInsets.only(top: 8), + width: w75, + margin: EdgeInsets.only(top: t8), alignment: Alignment.center, child: Text( "${widget.rankingList[1].gameName}", overflow: TextOverflow.ellipsis, - style: TextStyle(fontSize: 14, color: Colors.white), + style: TextStyle(fontSize: s14, color: Colors.white), ), ), GestureDetector( @@ -143,14 +149,14 @@ class _HomeRankingPageState extends State { width: w75, height: h29, alignment: Alignment.center, - margin: const EdgeInsets.only(top: 9), + margin: EdgeInsets.only(top: t9), decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.all(Radius.circular(c18)), ), - child: const Text( + child: Text( '打开', - style: TextStyle(color: Color(0xFF1282FF), fontSize: 13), + style: TextStyle(color: Color(0xFF1282FF), fontSize: s13), ), ), ), @@ -181,9 +187,9 @@ class _HomeRankingPageState extends State { child: Container( width: w99, height: h126, - decoration: const BoxDecoration( - borderRadius: BorderRadius.all(Radius.circular(11)), - gradient: LinearGradient( + decoration: BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(l11)), + gradient: const LinearGradient( begin: Alignment.topCenter, end: Alignment.bottomCenter, colors: [ @@ -213,14 +219,14 @@ class _HomeRankingPageState extends State { ], ), ), - child: const Text( + child: Text( "1", - style: TextStyle(fontSize: 12, color: Colors.white), + style: TextStyle(fontSize: s12, color: Colors.white), ), ), ), Container( - margin: const EdgeInsets.only(top: 11), + margin: EdgeInsets.only(top: l11), child: CachedNetworkImage( width: w57, height: w57, @@ -235,7 +241,7 @@ class _HomeRankingPageState extends State { child: Text( "${widget.rankingList[0].gameName}", overflow: TextOverflow.ellipsis, - style: const TextStyle(fontSize: 14, color: Colors.white), + style: TextStyle(fontSize: s14, color: Colors.white), ), ), GestureDetector( @@ -251,9 +257,9 @@ class _HomeRankingPageState extends State { color: Colors.white, borderRadius: BorderRadius.all(Radius.circular(c18)), ), - child: const Text( + child: Text( '打开', - style: TextStyle(color: Color(0xFFF86534), fontSize: 13), + style: TextStyle(color: Color(0xFFF86534), fontSize: s13), ), ), ), @@ -285,9 +291,9 @@ class _HomeRankingPageState extends State { child: Container( width: w99, height: h104, - decoration: const BoxDecoration( - borderRadius: BorderRadius.all(Radius.circular(11)), - gradient: LinearGradient( + decoration: BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(l11)), + gradient: const LinearGradient( begin: Alignment.topCenter, end: Alignment.bottomCenter, colors: [ @@ -317,14 +323,14 @@ class _HomeRankingPageState extends State { ], ), ), - child: const Text( + child: Text( "3", - style: TextStyle(fontSize: 12, color: Colors.white), + style: TextStyle(fontSize: s12, color: Colors.white), ), ), ), Container( - margin: const EdgeInsets.only(top: 11), + margin: EdgeInsets.only(top: l11), child: CachedNetworkImage( width: w57, height: w57, @@ -334,12 +340,12 @@ class _HomeRankingPageState extends State { ), Container( width: w75, - margin: const EdgeInsets.only(top: 8), + margin: EdgeInsets.only(top: t8), alignment: Alignment.center, child: Text( "${widget.rankingList[2].gameName}", overflow: TextOverflow.ellipsis, - style: const TextStyle(fontSize: 14, color: Colors.white), + style: TextStyle(fontSize: s14, color: Colors.white), ), ), GestureDetector( @@ -350,14 +356,14 @@ class _HomeRankingPageState extends State { width: w75, height: h29, alignment: Alignment.center, - margin: const EdgeInsets.only(top: 9), + margin: EdgeInsets.only(top: t9), decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.all(Radius.circular(c18)), ), - child: const Text( + child: Text( '打开', - style: TextStyle(color: Color(0xFFF3353A), fontSize: 13), + style: TextStyle(color: Color(0xFFF3353A), fontSize: s13), ), ), ), @@ -396,6 +402,9 @@ class _HomeRankingPageState extends State { final h32 = size.width / 11.25; final w75 = size.width / 4.8; final w130 = size.width / 2.7692307692307; + final s14 = size.width / 25.714285714285; + final s13 = size.width / 27.692307692307; + final l11 = size.width / 32.727272727272; return GestureDetector( onTap: () { @@ -420,11 +429,11 @@ class _HomeRankingPageState extends State { alignment: Alignment.center, child: Text( "${index + 4}.", - style: const TextStyle(fontSize: 14, color: Colors.white), + style: TextStyle(fontSize: s14, color: Colors.white), ), ), Container( - margin: const EdgeInsets.only(left: 13), + margin: EdgeInsets.only(left: s13), child: CachedNetworkImage( width: w57, height: w57, @@ -434,11 +443,11 @@ class _HomeRankingPageState extends State { ), Container( width: w130, - margin: const EdgeInsets.only(left: 11), + margin: EdgeInsets.only(left: l11), child: Text( "${data.gameName}", overflow: TextOverflow.ellipsis, - style: const TextStyle(fontSize: 14, color: Color(0xFFD6D6D7)), + style: TextStyle(fontSize: s14, color: Color(0xFFD6D6D7)), ), ), Expanded(child: Container()), @@ -450,14 +459,14 @@ class _HomeRankingPageState extends State { width: w75, height: h32, alignment: Alignment.center, - margin: const EdgeInsets.only(left: 13), + margin: EdgeInsets.only(left: s13), decoration: BoxDecoration( color: const Color(0xFF074CE7), borderRadius: BorderRadius.all(Radius.circular(t18)), ), child: Text( '打开', - style: TextStyle(color: Colors.white, fontSize: 13), + style: TextStyle(color: Colors.white, fontSize: s13), ), ), ), diff --git a/lib/tools/home/home_recommend_page.dart b/lib/tools/home/home_recommend_page.dart index 83e7efc..d0047ef 100644 --- a/lib/tools/home/home_recommend_page.dart +++ b/lib/tools/home/home_recommend_page.dart @@ -40,6 +40,11 @@ class _HomeRecommendState extends State with AutomaticKeepAli final w75 = size.width / 4.8; final h29 = size.width / 12.413793103448; final c18 = size.width / 20; + final t10 = size.width / 36; + final c11 = size.width / 32.727272727272; + final t9 = size.width / 40; + final s14 = size.width / 25.714285714285; + final s13 = size.width / 27.692307692307; switch (widget.homeInfoBean.categoryType) { case "Popular": @@ -78,14 +83,14 @@ class _HomeRecommendState extends State with AutomaticKeepAli margin: EdgeInsets.only(left: l15, top: t20), child: Text( "${widget.homeInfoBean.categoryName}", - style: const TextStyle(color: Color(0xFFD6D6D7), fontSize: 16), + style: TextStyle(color: Color(0xFFD6D6D7), fontSize: s16), ), ), Container( width: size.width, height: h160, // color: Colors.green, - margin: EdgeInsets.only(left: l15, right: l15, top: 10), + margin: EdgeInsets.only(left: l15, right: l15, top: t10), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ @@ -104,8 +109,8 @@ class _HomeRecommendState extends State with AutomaticKeepAli child: Container( width: w99, height: h125, - decoration: const BoxDecoration( - borderRadius: BorderRadius.all(Radius.circular(11)), + decoration: BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(c11)), gradient: LinearGradient( begin: Alignment.topCenter, end: Alignment.bottomCenter, @@ -125,10 +130,10 @@ class _HomeRecommendState extends State with AutomaticKeepAli errorWidget: (context, url, error) => const Icon(Icons.error), ), Container( - margin: const EdgeInsets.only(top: 9), + margin: EdgeInsets.only(top: t9), child: Text( "${widget.homeInfoBean.epgList?[0].title}", - style: const TextStyle(fontSize: 13, color: Colors.white), + style: TextStyle(fontSize: s13, color: Colors.white), ), ), GestureDetector( @@ -138,15 +143,15 @@ class _HomeRecommendState extends State with AutomaticKeepAli child: Container( width: w75, height: h29, - margin: const EdgeInsets.only(top: 10), + margin: EdgeInsets.only(top: t10), alignment: Alignment.center, decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.all(Radius.circular(c18)), ), - child: const Text( + child: Text( "打开", - style: TextStyle(fontSize: 13, color: Color(0xFFFA9D59)), + style: TextStyle(fontSize: s13, color: Color(0xFFFA9D59)), ), ), ), @@ -171,8 +176,8 @@ class _HomeRecommendState extends State with AutomaticKeepAli child: Container( width: w99, height: h125, - decoration: const BoxDecoration( - borderRadius: BorderRadius.all(Radius.circular(11)), + decoration: BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(c11)), gradient: LinearGradient( begin: Alignment.topCenter, end: Alignment.bottomCenter, @@ -192,10 +197,10 @@ class _HomeRecommendState extends State with AutomaticKeepAli errorWidget: (context, url, error) => const Icon(Icons.error), ), Container( - margin: const EdgeInsets.only(top: 9), + margin: EdgeInsets.only(top: t9), child: Text( "${widget.homeInfoBean.epgList?[1].title}", - style: const TextStyle(fontSize: 13, color: Colors.white), + style: TextStyle(fontSize: s13, color: Colors.white), ), ), GestureDetector( @@ -205,15 +210,15 @@ class _HomeRecommendState extends State with AutomaticKeepAli child: Container( width: w75, height: h29, - margin: const EdgeInsets.only(top: 10), + margin: EdgeInsets.only(top: t10), alignment: Alignment.center, decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.all(Radius.circular(c18)), ), - child: const Text( + child: Text( "打开", - style: TextStyle(fontSize: 13, color: Color(0xFF3CAF81)), + style: TextStyle(fontSize: s13, color: Color(0xFF3CAF81)), ), ), ), @@ -238,8 +243,8 @@ class _HomeRecommendState extends State with AutomaticKeepAli child: Container( width: w99, height: h125, - decoration: const BoxDecoration( - borderRadius: BorderRadius.all(Radius.circular(11)), + decoration: BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(c11)), gradient: LinearGradient( begin: Alignment.topCenter, end: Alignment.bottomCenter, @@ -259,10 +264,10 @@ class _HomeRecommendState extends State with AutomaticKeepAli errorWidget: (context, url, error) => const Icon(Icons.error), ), Container( - margin: const EdgeInsets.only(top: 9), + margin: EdgeInsets.only(top: t9), child: Text( "${widget.homeInfoBean.epgList?[2].title}", - style: const TextStyle(fontSize: 13, color: Colors.white), + style: TextStyle(fontSize: s13, color: Colors.white), ), ), GestureDetector( @@ -272,15 +277,15 @@ class _HomeRecommendState extends State with AutomaticKeepAli child: Container( width: w75, height: h29, - margin: const EdgeInsets.only(top: 10), + margin: EdgeInsets.only(top: t10), alignment: Alignment.center, decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.all(Radius.circular(c18)), ), - child: const Text( + child: Text( "打开", - style: TextStyle(fontSize: 13, color: Color(0xFF1383FF)), + style: TextStyle(fontSize: s13, color: Color(0xFF1383FF)), ), ), ), @@ -442,6 +447,9 @@ class _HomeRecommendState extends State with AutomaticKeepAli final h32 = size.width / 11.25; final c18 = size.width / 20; final l15 = size.width / 24; + final t11 = size.width / 32.727272727272; + final s14 = size.width / 25.714285714285; + final s13 = size.width / 27.692307692307; return GestureDetector( onTap: () { @@ -459,10 +467,10 @@ class _HomeRecommendState extends State with AutomaticKeepAli errorWidget: (context, url, error) => const Icon(Icons.error), ), Container( - margin: const EdgeInsets.only(top: 11), + margin: EdgeInsets.only(top: t11), child: Text( "${data.title}", - style: const TextStyle(fontSize: 14, color: Color(0xFF909090)), + style: TextStyle(fontSize: s14, color: Color(0xFF909090)), ), ), GestureDetector( @@ -473,14 +481,14 @@ class _HomeRecommendState extends State with AutomaticKeepAli width: w75, height: h32, alignment: Alignment.center, - margin: const EdgeInsets.only(top: 11), + margin: EdgeInsets.only(top: t11), decoration: BoxDecoration( color: const Color(0xFF074CE7), borderRadius: BorderRadius.all(Radius.circular(c18)), ), - child: const Text( + child: Text( "打开", - style: TextStyle(fontSize: 13, color: Colors.white), + style: TextStyle(fontSize: s13, color: Colors.white), ), ), ), @@ -507,6 +515,8 @@ class _HomeRecommendState extends State with AutomaticKeepAli final s21 = size.width / 17.142857142857; final w99 = size.width / 3.6363636363636; final h125 = size.width / 2.88; + final s13 = size.width / 27.692307692307; + final c11 = size.width / 32.727272727272; return List.generate( widget.homeInfoBean.epgList!.length, @@ -524,9 +534,9 @@ class _HomeRecommendState extends State with AutomaticKeepAli child: Container( width: w331, height: h122, - decoration: const BoxDecoration( + decoration: BoxDecoration( color: Color(0xFF202530), - borderRadius: BorderRadius.all(Radius.circular(11)), + borderRadius: BorderRadius.all(Radius.circular(c11)), ), child: Stack( alignment: Alignment.center, @@ -550,7 +560,7 @@ class _HomeRecommendState extends State with AutomaticKeepAli child: Text( "${widget.homeInfoBean.epgList?[index].subTitle}", overflow: TextOverflow.ellipsis, - style: const TextStyle(fontSize: 13, color: Color(0xFFA6A6A6)), + style: TextStyle(fontSize: s13, color: Color(0xFFA6A6A6)), ), )), Positioned( @@ -586,6 +596,10 @@ class _HomeRecommendState extends State with AutomaticKeepAli final w75 = size.width / 4.8; final h32 = size.width / 11.25; final r18 = size.width / 20; + final t11 = size.width / 32.727272727272; + final s14 = size.width / 25.714285714285; + final s13 = size.width / 27.692307692307; + return GestureDetector( onTap: () { _jumpToPage(data); @@ -601,11 +615,11 @@ class _HomeRecommendState extends State with AutomaticKeepAli Container( width: w99, alignment: Alignment.center, - margin: const EdgeInsets.only(top: 11), + margin: EdgeInsets.only(top: t11), child: Text( '${data.title}', overflow: TextOverflow.ellipsis, - style: const TextStyle(fontSize: 14, color: Color(0xFF909090)), + style: TextStyle(fontSize: s14, color: Color(0xFF909090)), ), ), GestureDetector( @@ -615,12 +629,12 @@ class _HomeRecommendState extends State with AutomaticKeepAli child: Container( width: w75, height: h32, - margin: const EdgeInsets.only(top: 11), + margin: EdgeInsets.only(top: t11), alignment: Alignment.center, decoration: BoxDecoration(color: const Color(0xFF074CE7), borderRadius: BorderRadius.all(Radius.circular(r18))), - child: const Text( + child: Text( "打开", - style: TextStyle(fontSize: 13, color: Colors.white), + style: TextStyle(fontSize: s13, color: Colors.white), ), ), ), @@ -633,6 +647,9 @@ class _HomeRecommendState extends State with AutomaticKeepAli final size = MediaQuery.of(context).size; final w157 = size.width / 2.292993630573248; final h125 = size.width / 2.88; + final t11 = size.width / 32.727272727272; + final s14 = size.width / 25.714285714285; + return GestureDetector( onTap: () { _jumpToPage(data); @@ -648,11 +665,11 @@ class _HomeRecommendState extends State with AutomaticKeepAli Container( width: w157, alignment: Alignment.center, - margin: const EdgeInsets.only(top: 11), + margin: EdgeInsets.only(top: t11), child: Text( '${data.title}', overflow: TextOverflow.ellipsis, - style: const TextStyle(fontSize: 14, color: Color(0xFF909090)), + style: TextStyle(fontSize: s14, color: Color(0xFF909090)), ), ), ], @@ -670,6 +687,10 @@ class _HomeRecommendState extends State with AutomaticKeepAli final w75 = size.width / 4.8; final h32 = size.width / 11.25; final c18 = size.width / 20; + final t11 = size.width / 32.727272727272; + final s14 = size.width / 25.714285714285; + final s13 = size.width / 27.692307692307; + return GestureDetector( onTap: () { _jumpToPage(data); @@ -690,13 +711,13 @@ class _HomeRecommendState extends State with AutomaticKeepAli ), ), Positioned( - top: 11, + top: t11, left: l83, child: SizedBox( width: w150, child: Text( "${data.title}", - style: const TextStyle(fontSize: 14, color: Color(0xFFD6D6D7)), + style: TextStyle(fontSize: s14, color: Color(0xFFD6D6D7)), ), ), ), @@ -708,7 +729,7 @@ class _HomeRecommendState extends State with AutomaticKeepAli child: Text( "${data.subTitle}", overflow: TextOverflow.ellipsis, - style: TextStyle(fontSize: 13, color: Color(0xFFA6A6A6)), + style: TextStyle(fontSize: s13, color: Color(0xFFA6A6A6)), ), ), ), @@ -726,9 +747,9 @@ class _HomeRecommendState extends State with AutomaticKeepAli color: const Color(0xFF074CE7), borderRadius: BorderRadius.all(Radius.circular(c18)), ), - child: const Text( + child: Text( "打开", - style: TextStyle(fontSize: 13, color: Colors.white), + style: TextStyle(fontSize: s13, color: Colors.white), ), ), )) @@ -747,6 +768,11 @@ class _HomeRecommendState extends State with AutomaticKeepAli final w313 = size.width / 1.150159744408946; final b38 = size.width / 9.473684210526316; final w150 = size.width / 2.4; + final t11 = size.width / 32.727272727272; + final s14 = size.width / 25.714285714285; + final s13 = size.width / 27.692307692307; + final t10 = size.width / 36; + return GestureDetector( onTap: () { _jumpToPage(data); @@ -762,7 +788,7 @@ class _HomeRecommendState extends State with AutomaticKeepAli child: Container( width: w331, height: h137, - decoration: const BoxDecoration(color: Color(0xFF202530), borderRadius: BorderRadius.all(Radius.circular(11))), + decoration: BoxDecoration(color: Color(0xFF202530), borderRadius: BorderRadius.all(Radius.circular(t11))), )), Positioned( top: 0, @@ -775,23 +801,23 @@ class _HomeRecommendState extends State with AutomaticKeepAli ), Positioned( bottom: b38, - left: 10, + left: t10, child: SizedBox( width: w150, child: Text( "${data.title}", - style: const TextStyle(fontSize: 14, color: Color(0xFFD6D6D7)), + style: TextStyle(fontSize: s14, color: Color(0xFFD6D6D7)), ), ), ), Positioned( - bottom: 10, - left: 10, + bottom: t10, + left: t10, child: SizedBox( width: w150, child: Text( "${data.subTitle}", - style: const TextStyle(fontSize: 13, color: Color(0xFFA6A6A6)), + style: TextStyle(fontSize: s13, color: Color(0xFFA6A6A6)), ), ), ), diff --git a/lib/tools/home/message/message_center_page.dart b/lib/tools/home/message/message_center_page.dart index c80787c..d456d1f 100644 --- a/lib/tools/home/message/message_center_page.dart +++ b/lib/tools/home/message/message_center_page.dart @@ -117,6 +117,9 @@ class _MessageCenterPageState extends State { final w200 = size.width / 1.8; final t22 = size.width / 16.363636363636; final t47 = size.width / 7.6595744680851; + final s13 = size.width / 27.692307692307; + final l11 = size.width / 32.727272727272; + final w7 = size.width / 51.428571428571; return GestureDetector( onTap: () { @@ -135,12 +138,12 @@ class _MessageCenterPageState extends State { child: Container( height: h73, margin: EdgeInsets.only(top: t18), - decoration: const BoxDecoration(color: Color(0xFF202530), borderRadius: BorderRadius.all(Radius.circular(11))), + decoration: BoxDecoration(color: Color(0xFF202530), borderRadius: BorderRadius.all(Radius.circular(l11))), child: Stack( alignment: Alignment.center, children: [ Positioned( - left: 11, + left: l11, child: Image( width: w45, height: w45, @@ -163,25 +166,25 @@ class _MessageCenterPageState extends State { child: Text( "${data.content}", overflow: TextOverflow.ellipsis, - style: const TextStyle(fontSize: 11, color: Color(0xFF939394)), + style: TextStyle(fontSize: l11, color: Color(0xFF939394)), ), ), ), Positioned( - right: 11, + right: l11, top: t22, child: Text( "${data.sendDateTime}", - style: const TextStyle(fontSize: 11, color: Color(0xFF939394)), + style: TextStyle(fontSize: l11, color: Color(0xFF939394)), ), ), Positioned( - right: 11, + right: l11, top: t47, child: !data.isRead! ? Container( - width: 7, - height: 7, + width: w7, + height: w7, decoration: const BoxDecoration(color: Colors.red, borderRadius: BorderRadius.all(Radius.circular(10))), ) : Container(), diff --git a/lib/tools/home/message/message_details_page.dart b/lib/tools/home/message/message_details_page.dart index 25d3bd5..43f835d 100644 --- a/lib/tools/home/message/message_details_page.dart +++ b/lib/tools/home/message/message_details_page.dart @@ -21,6 +21,7 @@ class _MessageDetailsPageState extends State { late StreamSubscription subscription; final MyHomeModel _viewModel = MyHomeModel(); late MessageBean messageBean; + bool _isInitialized = false; @override void initState() { @@ -32,6 +33,7 @@ class _MessageDetailsPageState extends State { if (code.isNotEmpty) { switch (code) { case "getUserMessageInfo": + _isInitialized = true; messageBean = event['data']; break; } @@ -60,60 +62,65 @@ class _MessageDetailsPageState extends State { final h26 = size.width / 13.846153846153; final t20 = size.width / 18; final t18 = size.width / 20; + final s13 = size.width / 27.692307692307; + final w7 = size.width / 51.428571428571; + final s9 = size.width / 40; return Scaffold( backgroundColor: const Color(0xFF17181A), - body: Column( - children: [ - Container( - width: size.width, - height: h50, - margin: EdgeInsets.only(top: MediaQuery.of(context).padding.top), - child: Stack( - alignment: Alignment.center, + body: _isInitialized + ? Column( children: [ - Positioned( - left: l14, - child: GestureDetector( - onTap: () { - Navigator.pop(context); - }, - child: Image( - width: w19, - height: h26, - image: const AssetImage('assets/images/btn_fanhui.png'), - ), + Container( + width: size.width, + height: h50, + margin: EdgeInsets.only(top: MediaQuery.of(context).padding.top), + child: Stack( + alignment: Alignment.center, + children: [ + Positioned( + left: l14, + child: GestureDetector( + onTap: () { + Navigator.pop(context); + }, + child: Image( + width: w19, + height: h26, + image: const AssetImage('assets/images/btn_fanhui.png'), + ), + ), + ) + ], ), - ) + ), + Container( + alignment: Alignment.centerLeft, + margin: EdgeInsets.only(left: l14, top: t20), + child: Text( + widget.title, + style: TextStyle(fontSize: l14, color: const Color(0xFFD6D6D7)), + ), + ), + Container( + alignment: Alignment.centerLeft, + margin: EdgeInsets.only(left: l14, top: w7), + child: Text( + "${messageBean.sendDateTime}", + style: TextStyle(fontSize: s9, color: Color(0xFF626262)), + ), + ), + Container( + alignment: Alignment.centerLeft, + margin: EdgeInsets.only(left: l14, top: t18), + child: Text( + "${messageBean.content}", + style: TextStyle(fontSize: s13, color: Color(0xFF939394)), + ), + ), ], - ), - ), - Container( - alignment: Alignment.centerLeft, - margin: EdgeInsets.only(left: l14, top: t20), - child: Text( - widget.title, - style: TextStyle(fontSize: l14, color: const Color(0xFFD6D6D7)), - ), - ), - Container( - alignment: Alignment.centerLeft, - margin: EdgeInsets.only(left: l14, top: 7), - child: Text( - "${messageBean.sendDateTime}", - style: const TextStyle(fontSize: 9, color: Color(0xFF626262)), - ), - ), - Container( - alignment: Alignment.centerLeft, - margin: EdgeInsets.only(left: l14, top: t18), - child: Text( - "${messageBean.content}", - style: const TextStyle(fontSize: 13, color: Color(0xFF939394)), - ), - ), - ], - ), + ) + : Container(), ); } } diff --git a/lib/tools/home/my_home_page.dart b/lib/tools/home/my_home_page.dart index fc85c0a..146ba51 100644 --- a/lib/tools/home/my_home_page.dart +++ b/lib/tools/home/my_home_page.dart @@ -88,6 +88,7 @@ class _MyHomePageState extends State { case "sevenSignToday": //签到 EasyLoading.showToast(event['data']); + EventBusUtil.fire(RefreshUserdata()); _viewModel.getSevenSignList(); _viewModel.getUserInfo(); break; @@ -135,6 +136,17 @@ class _MyHomePageState extends State { final w16 = size.width / 22.5; final l25 = size.width / 14.4; final l17 = size.width / 21.17647058823529; + final t13 = size.width / 27.692307692307; + final t9 = size.width / 40; + final w4 = size.width / 90; + final l7 = size.width / 51.428571428571; + final c10 = size.width / 36; + final s13 = size.width / 27.692307692307; + final s14 = size.width / 25.714285714285; + final c4 = size.width / 90; + final l11 = size.width / 32.727272727272; + final t8 = size.width / 45; + final r7 = size.width / 51.428571428571; return Scaffold( backgroundColor: const Color(0xFF17181A), @@ -183,7 +195,7 @@ class _MyHomePageState extends State { children: [ Positioned( left: l15, - top: 13, + top: t13, child: bannerList.isNotEmpty ? Text( "${bannerList[currentBannerIndex].title}", @@ -196,24 +208,24 @@ class _MyHomePageState extends State { child: bannerList.isNotEmpty ? Text( "${bannerList[currentBannerIndex].subTitle}", - style: const TextStyle(color: Colors.white, fontSize: 13), + style: TextStyle(color: Colors.white, fontSize: s13), ) : Container()), ///banner指示器 Positioned( - top: 9, + top: t9, right: r14, child: Row( children: List.generate( bannerList.length, (index) => Container( - width: 4, - height: 4, - margin: const EdgeInsets.only(left: 7), + width: w4, + height: w4, + margin: EdgeInsets.only(left: l7), decoration: BoxDecoration( color: Color(currentBannerIndex == index ? 0xFFFFFFFF : 0x99FFFFFF), - borderRadius: const BorderRadius.all(Radius.circular(10))), + borderRadius: BorderRadius.all(Radius.circular(c10))), )), )) ], @@ -261,9 +273,9 @@ class _MyHomePageState extends State { ).createShader(bounds); }, blendMode: BlendMode.srcATop, - child: const Text( + child: Text( '推荐', - style: TextStyle(fontSize: 14), + style: TextStyle(fontSize: s14), ), ), ), @@ -285,7 +297,7 @@ class _MyHomePageState extends State { decoration: BoxDecoration( color: Color(pageIndex == 1 ? 0xFF0C0C0C : 0xFF17181A), border: Border.all(color: Color(pageIndex == 1 ? 0xFF9C9C9C : 0xFF17181A), width: 1), - borderRadius: const BorderRadius.all(Radius.circular(4))), + borderRadius: BorderRadius.all(Radius.circular(c4))), child: ShaderMask( shaderCallback: (Rect bounds) { return LinearGradient( @@ -303,9 +315,9 @@ class _MyHomePageState extends State { ).createShader(bounds); }, blendMode: BlendMode.srcATop, - child: const Text( + child: Text( '游戏排行', - style: TextStyle(fontSize: 14), + style: TextStyle(fontSize: s14), ), ), ), @@ -347,7 +359,7 @@ class _MyHomePageState extends State { Navigator.pushNamed(context, "/SearchPage"); }, child: Container( - margin: const EdgeInsets.only(left: 14), + margin: EdgeInsets.only(left: s14), child: ClipRRect( borderRadius: BorderRadius.circular(c19), child: BackdropFilter( @@ -358,7 +370,7 @@ class _MyHomePageState extends State { child: Container( height: h36, alignment: Alignment.centerLeft, - padding: const EdgeInsets.only(left: 11), + padding: EdgeInsets.only(left: l11), decoration: BoxDecoration( color: const Color(0x73FFFFFF), borderRadius: BorderRadius.all(Radius.circular(c19)), @@ -392,23 +404,23 @@ class _MyHomePageState extends State { child: Container( width: h36, height: h36, - margin: EdgeInsets.only(right: 14, left: l25), + margin: EdgeInsets.only(right: s14, left: l25), decoration: BoxDecoration(color: Color(0x73FFFFFF), borderRadius: BorderRadius.all(Radius.circular(c19))), child: Stack( alignment: Alignment.center, children: [ Image( width: l17, - height: 14, + height: s14, image: const AssetImage('assets/images/ic_message.png'), ), Positioned( - top: 8, - right: 7, + top: t8, + right: r7, child: unreadNum > 0 ? Container( - width: 4, - height: 4, + width: c4, + height: c4, decoration: const BoxDecoration(color: Colors.red, borderRadius: BorderRadius.all(Radius.circular(10))), ) : Container()) diff --git a/lib/tools/home/search_page.dart b/lib/tools/home/search_page.dart index 5e15062..9986cbd 100644 --- a/lib/tools/home/search_page.dart +++ b/lib/tools/home/search_page.dart @@ -102,13 +102,21 @@ class _SearchPageState extends State { final t18 = size.width / 20; final w155 = size.width / 2.32258064516129; final w57 = size.width / 6.315789473684211; + final t10 = size.width / 36; + final l15 = size.width / 24; + final l10 = size.width / 36; + final b5 = size.width / 72; + final s14 = size.width / 25.714285714285; + final s13 = size.width / 27.692307692307; + final t4 = size.width / 90; + final l11 = size.width / 32.727272727272; return Scaffold( backgroundColor: const Color(0xFF17181A), body: Column( children: [ Container( - margin: EdgeInsets.only(top: MediaQuery.of(context).padding.top + 10), + margin: EdgeInsets.only(top: MediaQuery.of(context).padding.top + t10), child: Row( children: [ GestureDetector( @@ -116,7 +124,7 @@ class _SearchPageState extends State { Navigator.pop(context); }, child: Container( - margin: const EdgeInsets.symmetric(horizontal: 15), + margin: EdgeInsets.symmetric(horizontal: l15), child: Image( width: w19, height: h26, @@ -134,16 +142,16 @@ class _SearchPageState extends State { child: Row( children: [ Container( - padding: const EdgeInsets.only(left: 10), + padding: EdgeInsets.only(left: l10), child: Image(width: w16, height: w16, image: const AssetImage('assets/images/ic_search.png')), ), Expanded( child: Container( alignment: Alignment.center, - padding: const EdgeInsets.only(left: 10, right: 10, bottom: 5), + padding: EdgeInsets.only(left: l10, right: l10, bottom: b5), child: TextField( controller: _searchController, - style: const TextStyle(fontSize: 13, color: Colors.white), + style: TextStyle(fontSize: s13, color: Colors.white), decoration: const InputDecoration( border: InputBorder.none, ), @@ -175,7 +183,7 @@ class _SearchPageState extends State { }); }, child: Container( - padding: const EdgeInsets.only(right: 10), + padding: EdgeInsets.only(right: t10), child: Image( width: w16, height: w16, @@ -201,10 +209,10 @@ class _SearchPageState extends State { setState(() {}); }, child: Container( - margin: const EdgeInsets.symmetric(horizontal: 15), - child: const Text( + margin: EdgeInsets.symmetric(horizontal: l15), + child: Text( "搜索", - style: TextStyle(fontSize: 13, color: Color(0xFF626262)), + style: TextStyle(fontSize: s13, color: Color(0xFF626262)), ), ), ) @@ -215,7 +223,7 @@ class _SearchPageState extends State { ///搜索历史 searchList.isEmpty ? Container( - margin: EdgeInsets.only(left: 14, right: 14, top: h36), + margin: EdgeInsets.only(left: l15, right: l15, top: h36), child: Column( children: [ Row( @@ -231,9 +239,9 @@ class _SearchPageState extends State { saveArrayToSharedPrefs(searchHistoryList); setState(() {}); }, - child: const Image( - width: 14, - height: 14, + child: Image( + width: l15, + height: l15, image: AssetImage('assets/images/ic_del.png'), ), ), @@ -257,15 +265,15 @@ class _SearchPageState extends State { }, child: index != 0 ? Container( - padding: const EdgeInsets.symmetric(horizontal: 13, vertical: 4), - margin: const EdgeInsets.only(right: 10), - decoration: const BoxDecoration( + padding: EdgeInsets.symmetric(horizontal: s13, vertical: t4), + margin: EdgeInsets.only(right: l10), + decoration: BoxDecoration( color: Color(0xFF202530), - borderRadius: BorderRadius.all(Radius.circular(4)), + borderRadius: BorderRadius.all(Radius.circular(t4)), ), child: Text( searchHistoryList[index], - style: const TextStyle(fontSize: 13, color: Color(0xFFB6B6B6)), + style: TextStyle(fontSize: s13, color: Color(0xFFB6B6B6)), ), ) : Container(), @@ -288,12 +296,12 @@ class _SearchPageState extends State { children: List.generate( gameHotSearch.length, (index) => Container( - width: w155, - margin: const EdgeInsets.only(right: 10, top: 10), + width: size.width / 2 - l15 - l15, + margin: EdgeInsets.only(right: l10, top: l10), child: Text( "${gameHotSearch[index]}", overflow: TextOverflow.ellipsis, - style: const TextStyle(fontSize: 14, color: Color(0xFF939394)), + style: TextStyle(fontSize: s14, color: Color(0xFF939394)), ), ), ), @@ -304,12 +312,12 @@ class _SearchPageState extends State { ) : Expanded( child: Container( - margin: EdgeInsets.only(left: 14, right: 14, top: h36), + margin: EdgeInsets.only(left: l15, right: l15, top: h36), child: ListView.builder( padding: EdgeInsets.zero, itemCount: searchList.length, itemBuilder: (context, index) { - return _searchItem(searchList[index], w57, t18); + return _searchItem(searchList[index], w57, t18, l11, s14); }), )), ], @@ -317,7 +325,7 @@ class _SearchPageState extends State { ); } - _searchItem(SearchBean data, w57, t18) { + _searchItem(SearchBean data, w57, t18, l11, s14) { return Container( margin: EdgeInsets.only(top: t18), child: Row( @@ -329,10 +337,10 @@ class _SearchPageState extends State { errorWidget: (context, url, error) => const Icon(Icons.error), ), Container( - margin: const EdgeInsets.only(left: 11), + margin: EdgeInsets.only(left: l11), child: Text( "${data.gameName}", - style: const TextStyle(fontSize: 14, color: Color(0xFFD6D6D7)), + style: TextStyle(fontSize: s14, color: Color(0xFFD6D6D7)), ), ), ], diff --git a/lib/tools/home_model.dart b/lib/tools/home_model.dart index d25bc7a..f9a3cfd 100644 --- a/lib/tools/home_model.dart +++ b/lib/tools/home_model.dart @@ -1,6 +1,5 @@ import 'dart:async'; -import 'package:flutter_easyloading/flutter_easyloading.dart'; import 'package:shared_preferences/shared_preferences.dart'; import '../beans/config_bean.dart'; @@ -268,6 +267,26 @@ class HomeModel { }); } + ///退出游戏 + Future exitApp() async { + RequestCenter.instance.requestGet(NetworkConfig.exitApp, {}, (BaseEntity dataEntity) { + // ReconnectBean reconnectBean = ReconnectBean.fromJson(dataEntity.data); + if (dataEntity.code == 0) { + streamController.sink.add({ + 'code': "exitApp", //有数据 + 'data': 'data', + }); + } else { + streamController.sink.add({ + 'code': "-1", // + 'data': dataEntity.message, + }); + } + }, (ErrorEntity errorEntity) { + print("errorEntity==${errorEntity.message}"); + }); + } + ///用户信息 Future getUserInfo() async { RequestCenter.instance.requestGet(NetworkConfig.getUserInfo, {}, (BaseEntity dataEntity) { diff --git a/lib/tools/home_page.dart b/lib/tools/home_page.dart index 94dcb9c..d316b71 100644 --- a/lib/tools/home_page.dart +++ b/lib/tools/home_page.dart @@ -1,4 +1,5 @@ import 'dart:async'; +import 'dart:io'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; @@ -37,6 +38,7 @@ class _HomePageState extends State with TickerProviderStateMixin { int currentIndex = 0; late StreamSubscription _startGamesEvent; late StreamSubscription _tabSwitchEvent; + late StreamSubscription _refreshUserEvent; late StreamSubscription subscription; final HomeModel _viewModel = HomeModel(); @@ -45,6 +47,8 @@ class _HomePageState extends State with TickerProviderStateMixin { late ReconnectBean reconnectBean; + DateTime? _lastPressTime; + @override void initState() { // TODO: implement initState @@ -57,6 +61,18 @@ class _HomePageState extends State with TickerProviderStateMixin { Navigator.pushNamed(context, "/LoginPage"); return; } + + final DateTime now = DateTime.now(); + if (_lastPressTime != null && now.difference(_lastPressTime!) < Duration(seconds: 2)) { + // 两次点击时间间隔小于2秒,拦截第二次点击 + print('Button pressed again within 2 seconds. Ignoring the second press.'); + return; + } + // 更新最后一次点击时间 + setState(() { + _lastPressTime = now; + }); + FunctionUtil.loading(); NetworkConfig.gameId = event.gameId; print("_startGamesEvent"); @@ -75,6 +91,11 @@ class _HomePageState extends State with TickerProviderStateMixin { pageController.jumpToPage(event.index); }); + ///刷新用户信息 + _refreshUserEvent = EventBusUtil.listen((event) { + _viewModel.getUserInfo(); + }); + subscription = _viewModel.streamController.stream.listen((event) { String code = event['code']; if (code.isNotEmpty) { @@ -87,6 +108,8 @@ class _HomePageState extends State with TickerProviderStateMixin { "channelId": NetworkConfig.configBean?.channelId, "userToken": NetworkConfig.token, "signKey": NetworkConfig.signKey, + "Channel": NetworkConfig.Channel, + "Version": NetworkConfig.Version, }; ///传值初始化游戏token @@ -213,6 +236,8 @@ class _HomePageState extends State with TickerProviderStateMixin { // TODO: implement dispose _startGamesEvent.cancel(); _tabSwitchEvent.cancel(); + _timer.cancel(); + _refreshUserEvent.cancel(); subscription.cancel(); super.dispose(); } @@ -233,23 +258,25 @@ class _HomePageState extends State with TickerProviderStateMixin { Widget build(BuildContext context) { final size = MediaQuery.of(context).size; final h74 = size.width / 4.864864864864865; - return Scaffold( - backgroundColor: Color(0xFF17181A), - body: Stack( - children: [ - PageView( - controller: pageController, - // onPageChanged: onPageChanged, - children: bodyList, - physics: NeverScrollableScrollPhysics(), // 禁止滑动 - ) - ], - ), - bottomNavigationBar: BottomAppBar( - elevation: 0, - height: h74, - color: const Color(0xFF171B23), - child: bottomItem(context), + return WillPopScope( + onWillPop: doubleClickBack, + child: Scaffold( + backgroundColor: Color(0xFF17181A), + body: Stack( + children: [ + PageView( + controller: pageController, + // onPageChanged: onPageChanged, + children: bodyList, + physics: NeverScrollableScrollPhysics(), // 禁止滑动 + ) + ], + ), + bottomNavigationBar: BottomAppBar( + elevation: 0, + color: const Color(0xFF171B23), + child: bottomItem(context), + ), ), ); } @@ -360,6 +387,22 @@ class _HomePageState extends State with TickerProviderStateMixin { ], ); } + + int last = 0; + + Future doubleClickBack() async { + int now = DateTime.now().millisecondsSinceEpoch; + + if (now - last > 2500) { + last = DateTime.now().millisecondsSinceEpoch; + EasyLoading.showToast("再按一次退出"); + return Future.value(false); + } else { + _viewModel.exitApp(); + SystemNavigator.pop(); + exit(0); + } + } } // 获取原生的值 diff --git a/lib/tools/login/login_model.dart b/lib/tools/login/login_model.dart index f270a4c..6810308 100644 --- a/lib/tools/login/login_model.dart +++ b/lib/tools/login/login_model.dart @@ -33,7 +33,7 @@ class LoginModel { }); } else { streamController.sink.add({ - 'code': "error", // + 'code': "sendPhoneError", // 'data': dataEntity.message, }); } diff --git a/lib/tools/login/login_page.dart b/lib/tools/login/login_page.dart index c4c7978..9610649 100644 --- a/lib/tools/login/login_page.dart +++ b/lib/tools/login/login_page.dart @@ -28,7 +28,7 @@ class _LoginPageState extends State { Timer? _timer; //协议 - bool isCheck = false; + bool isCheck = true; @override void initState() { @@ -49,6 +49,9 @@ class _LoginPageState extends State { } Navigator.pushReplacementNamed(context, "/HomePage"); break; + case "sendPhoneError": + EasyLoading.showToast("${event['data']}"); + break; } } }); @@ -122,15 +125,17 @@ class _LoginPageState extends State { final w50 = size.width / 7.2; final t187 = size.width / 1.925133689839572; final l30 = size.width / 12; - final t294 = size.width / 1.224489795918367; final w331 = size.width / 1.08761329305136; final h52 = size.width / 6.923076923076923; final l20 = size.width / 18; final c90 = size.width / 4; - final t359 = size.width / 1.002785515320334; - final t471 = size.width / 0.7643312101910828; - final b35 = size.width / 10.28571428571429; - final w16 = size.width / 22.5; + final s14 = size.width / 25.714285714285; + final s13 = size.width / 27.692307692307; + final t87 = size.width / 4.1379310344827; + final t13 = size.width / 27.692307692307; + final t60 = size.width / 6; + final w10 = size.width / 36; + final s12 = size.width / 30; return Scaffold( backgroundColor: Color(0xFF17181A), @@ -150,163 +155,328 @@ class _LoginPageState extends State { left: l21, child: Image(width: w50, height: w50, image: const AssetImage('assets/images/ic_login2.png')), ), - Positioned( - top: t187, - left: l30, - child: const Text( - "登录/注册", - style: TextStyle(fontSize: 14, color: Color(0x8AFFFFFF)), + + SingleChildScrollView( + child: Column( + children: [ + Container( + alignment: Alignment.centerLeft, + margin: EdgeInsets.only(top: t187, left: l30), + child: Text( + "登录/注册", + style: TextStyle(fontSize: s14, color: Color(0x8AFFFFFF)), + ), + ), + + ///手机号 + Container( + width: w331, + height: h52, + margin: EdgeInsets.only(top: t87), + alignment: Alignment.center, + padding: EdgeInsets.only(left: l20), + decoration: BoxDecoration( + color: const Color(0xFF30343B), + borderRadius: BorderRadius.all(Radius.circular(c90)), + border: Border.all(color: const Color(0x1AFFFFFF)), + ), + child: TextField( + controller: _phoneController, + style: TextStyle(fontSize: s14, color: Colors.white), + keyboardType: TextInputType.number, + decoration: InputDecoration( + border: InputBorder.none, + hintText: '请输入您的手机号码', + hintStyle: TextStyle(fontSize: s13, color: Color(0x80FFFFFF)), + ), + inputFormatters: [ + LengthLimitingTextInputFormatter(11), // 设置输入长度限制 + FilteringTextInputFormatter.digitsOnly, // 只允许输入数字 + ], + ), + ), + + ///验证码 + Container( + width: w331, + height: h52, + margin: EdgeInsets.only(top: t13), + padding: EdgeInsets.only(left: l20, right: l20), + decoration: BoxDecoration( + color: const Color(0xFF30343B), + borderRadius: BorderRadius.all(Radius.circular(c90)), + border: Border.all(color: const Color(0x1AFFFFFF)), + ), + child: Row( + children: [ + Expanded( + child: TextField( + controller: _codeController, + cursorColor: const Color(0xFF074CE7), + style: TextStyle(fontSize: s14, color: Colors.white), + keyboardType: TextInputType.number, + decoration: const InputDecoration( + border: InputBorder.none, + ), + ), + ), + GestureDetector( + onTap: () { + if (!_isCountingDown) { + getCode(); + } + }, + child: Text( + !_isCountingDown ? "获取验证码" : "$_timeLeft后重新获取", + style: TextStyle(fontSize: s13, color: Color(0xFF969798)), + ), + ), + ], + ), + ), + + ///登录 + GestureDetector( + onTap: () { + login(); + }, + child: Container( + width: w331, + height: h52, + margin: EdgeInsets.only(top: t60), + alignment: Alignment.center, + decoration: BoxDecoration( + color: const Color(0xFF074CE7), + borderRadius: BorderRadius.all(Radius.circular(c90)), + ), + child: Text( + "登录", + style: TextStyle(fontSize: s14, color: Colors.white), + ), + ), + ), + + Container( + width: MediaQuery.of(context).size.width, + margin: EdgeInsets.only(top: t60, bottom: t13), + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + GestureDetector( + onTap: () { + isCheck = !isCheck; + setState(() {}); + }, + child: Container( + width: w10, + height: w10, + alignment: Alignment.center, + child: + Image(image: isCheck ? const AssetImage('assets/images/ic_ck_s.png') : const AssetImage('assets/images/ic_ck.png')), + ), + ), + Container( + margin: EdgeInsets.only(left: w10), + child: RichText( + text: TextSpan(children: [ + TextSpan(text: '我已阅读并同意', style: TextStyle(fontSize: s12, color: Color(0xFF5F5F5F))), + TextSpan( + text: '《用户协议》', + style: TextStyle(fontSize: s12, color: Color(0xFF074CE7)), + recognizer: TapGestureRecognizer() + ..onTap = () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => const AgreementPage( + title: "用户协议", + url: "https://shhuanmeng.com/yonghuxieyi.html", + )), + ); + }), + TextSpan(text: '和', style: TextStyle(fontSize: s12, color: Color(0xFF5F5F5F))), + TextSpan( + text: '《隐私政策》', + style: TextStyle(fontSize: s12, color: Color(0xFF074CE7)), + recognizer: TapGestureRecognizer() + ..onTap = () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => const AgreementPage( + title: "隐私政策", + url: "https://shhuanmeng.com/yinsixieyi.html", + )), + ); + }), + ]), + ), + ) + ], + ), + ) + ], ), ), - ///手机号 - Positioned( - top: t294, - child: Container( - width: w331, - height: h52, - padding: EdgeInsets.only(left: l20), - decoration: BoxDecoration( - color: const Color(0xFF30343B), - borderRadius: BorderRadius.all(Radius.circular(c90)), - border: Border.all(color: const Color(0x1AFFFFFF)), - ), - child: TextField( - controller: _phoneController, - style: const TextStyle(fontSize: 14, color: Colors.white), - keyboardType: TextInputType.number, - decoration: const InputDecoration( - border: InputBorder.none, - hintText: '请输入您的手机号码', - hintStyle: TextStyle(fontSize: 13, color: Color(0x80FFFFFF)), - ), - inputFormatters: [ - LengthLimitingTextInputFormatter(11), // 设置输入长度限制 - FilteringTextInputFormatter.digitsOnly, // 只允许输入数字 - ], - ), - ), - ), + // Positioned( + // top: t187, + // left: l30, + // child: Text( + // "登录/注册", + // style: TextStyle(fontSize: s14, color: Color(0x8AFFFFFF)), + // ), + // ), + + // Positioned( + // top: t294, + // child: Container( + // width: w331, + // height: h52, + // alignment: Alignment.center, + // padding: EdgeInsets.only(left: l20), + // decoration: BoxDecoration( + // color: const Color(0xFF30343B), + // borderRadius: BorderRadius.all(Radius.circular(c90)), + // border: Border.all(color: const Color(0x1AFFFFFF)), + // ), + // child: TextField( + // controller: _phoneController, + // style: TextStyle(fontSize: s14, color: Colors.white), + // keyboardType: TextInputType.number, + // decoration: InputDecoration( + // border: InputBorder.none, + // hintText: '请输入您的手机号码', + // hintStyle: TextStyle(fontSize: s13, color: Color(0x80FFFFFF)), + // ), + // inputFormatters: [ + // LengthLimitingTextInputFormatter(11), // 设置输入长度限制 + // FilteringTextInputFormatter.digitsOnly, // 只允许输入数字 + // ], + // ), + // ), + // ), ///验证码 - Positioned( - top: t359, - child: Container( - width: w331, - height: h52, - padding: EdgeInsets.only(left: l20, right: l20), - decoration: BoxDecoration( - color: const Color(0xFF30343B), - borderRadius: BorderRadius.all(Radius.circular(c90)), - border: Border.all(color: const Color(0x1AFFFFFF)), - ), - child: Row( - children: [ - Expanded( - child: TextField( - controller: _codeController, - cursorColor: const Color(0xFF074CE7), - style: const TextStyle(fontSize: 14, color: Colors.white), - keyboardType: TextInputType.number, - decoration: const InputDecoration( - border: InputBorder.none, - ), - ), - ), - GestureDetector( - onTap: () { - if (!_isCountingDown) { - getCode(); - } - }, - child: Text( - !_isCountingDown ? "获取验证码" : "$_timeLeft后重新获取", - style: const TextStyle(fontSize: 13, color: Color(0xFF969798)), - ), - ), - ], - ), - ), - ), + // Positioned( + // top: t359, + // child: Container( + // width: w331, + // height: h52, + // padding: EdgeInsets.only(left: l20, right: l20), + // decoration: BoxDecoration( + // color: const Color(0xFF30343B), + // borderRadius: BorderRadius.all(Radius.circular(c90)), + // border: Border.all(color: const Color(0x1AFFFFFF)), + // ), + // child: Row( + // children: [ + // Expanded( + // child: TextField( + // controller: _codeController, + // cursorColor: const Color(0xFF074CE7), + // style: TextStyle(fontSize: s14, color: Colors.white), + // keyboardType: TextInputType.number, + // decoration: const InputDecoration( + // border: InputBorder.none, + // ), + // ), + // ), + // GestureDetector( + // onTap: () { + // if (!_isCountingDown) { + // getCode(); + // } + // }, + // child: Text( + // !_isCountingDown ? "获取验证码" : "$_timeLeft后重新获取", + // style: TextStyle(fontSize: s13, color: Color(0xFF969798)), + // ), + // ), + // ], + // ), + // ), + // ), - Positioned( - top: t471, - child: GestureDetector( - onTap: () { - login(); - }, - child: Container( - width: w331, - height: h52, - alignment: Alignment.center, - decoration: BoxDecoration( - color: const Color(0xFF074CE7), - borderRadius: BorderRadius.all(Radius.circular(c90)), - ), - child: const Text( - "登录", - style: TextStyle(fontSize: 14, color: Colors.white), - ), - ), - ), - ), + // Positioned( + // top: t471, + // child: GestureDetector( + // onTap: () { + // login(); + // }, + // child: Container( + // width: w331, + // height: h52, + // alignment: Alignment.center, + // decoration: BoxDecoration( + // color: const Color(0xFF074CE7), + // borderRadius: BorderRadius.all(Radius.circular(c90)), + // ), + // child: const Text( + // "登录", + // style: TextStyle(fontSize: 14, color: Colors.white), + // ), + // ), + // ), + // ), - Positioned( - bottom: b35, - child: SizedBox( - width: MediaQuery.of(context).size.width, - child: Row( - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - GestureDetector( - onTap: () { - isCheck = !isCheck; - setState(() {}); - }, - child: Image( - width: w16, image: isCheck ? const AssetImage('assets/images/ic_ck_s.png') : const AssetImage('assets/images/ic_ck.png')), - ), - Container( - margin: const EdgeInsets.only(left: 10), - child: RichText( - text: TextSpan(children: [ - const TextSpan(text: '我已阅读并同意', style: TextStyle(fontSize: 12, color: Color(0xFF5F5F5F))), - TextSpan( - text: '《用户协议》', - style: const TextStyle(fontSize: 12, color: Color(0xFF074CE7)), - recognizer: TapGestureRecognizer() - ..onTap = () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => const AgreementPage( - title: "用户协议", - url: "https://shhuanmeng.com/yonghuxieyi.html", - )), - ); - }), - const TextSpan(text: '和', style: TextStyle(fontSize: 12, color: Color(0xFF5F5F5F))), - TextSpan( - text: '《隐私政策》', - style: const TextStyle(fontSize: 12, color: Color(0xFF074CE7)), - recognizer: TapGestureRecognizer() - ..onTap = () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => const AgreementPage( - title: "隐私政策", - url: "https://shhuanmeng.com/yinsixieyi.html", - )), - ); - }), - ]), - ), - ) - ], - ), - )), + // Positioned( + // bottom: b35, + // child: SizedBox( + // width: MediaQuery.of(context).size.width, + // child: Row( + // crossAxisAlignment: CrossAxisAlignment.center, + // mainAxisAlignment: MainAxisAlignment.center, + // children: [ + // GestureDetector( + // onTap: () { + // isCheck = !isCheck; + // setState(() {}); + // }, + // child: Image( + // width: w16, image: isCheck ? const AssetImage('assets/images/ic_ck_s.png') : const AssetImage('assets/images/ic_ck.png')), + // ), + // Container( + // margin: const EdgeInsets.only(left: 10), + // child: RichText( + // text: TextSpan(children: [ + // const TextSpan(text: '我已阅读并同意', style: TextStyle(fontSize: 12, color: Color(0xFF5F5F5F))), + // TextSpan( + // text: '《用户协议》', + // style: const TextStyle(fontSize: 12, color: Color(0xFF074CE7)), + // recognizer: TapGestureRecognizer() + // ..onTap = () { + // Navigator.push( + // context, + // MaterialPageRoute( + // builder: (context) => const AgreementPage( + // title: "用户协议", + // url: "https://shhuanmeng.com/yonghuxieyi.html", + // )), + // ); + // }), + // const TextSpan(text: '和', style: TextStyle(fontSize: 12, color: Color(0xFF5F5F5F))), + // TextSpan( + // text: '《隐私政策》', + // style: const TextStyle(fontSize: 12, color: Color(0xFF074CE7)), + // recognizer: TapGestureRecognizer() + // ..onTap = () { + // Navigator.push( + // context, + // MaterialPageRoute( + // builder: (context) => const AgreementPage( + // title: "隐私政策", + // url: "https://shhuanmeng.com/yinsixieyi.html", + // )), + // ); + // }), + // ]), + // ), + // ) + // ], + // ), + // )), ], ), ), diff --git a/lib/tools/me/feedback_page.dart b/lib/tools/me/feedback_page.dart index 8a993a0..923e40b 100644 --- a/lib/tools/me/feedback_page.dart +++ b/lib/tools/me/feedback_page.dart @@ -59,126 +59,135 @@ class _FeedbackPageState extends State { final h45 = size.width / 8; final t30 = size.width / 12; final c22 = size.width / 16.36363636363636; + final s14 = size.width / 25.714285714285; + final l10 = size.width / 36; + final s9 = size.width / 40; + final t13 = size.width / 27.692307692307; + final c6 = size.width / 60; + final b5 = size.width / 72; + final s11 = size.width / 32.727272727272; return Scaffold( backgroundColor: const Color(0xFF17181A), - body: Column( - children: [ - Container( - width: size.width, - height: h50, - margin: EdgeInsets.only(top: MediaQuery.of(context).padding.top), - child: Stack( - alignment: Alignment.center, - children: [ - Text( - "反馈", - style: TextStyle(fontSize: s16, color: const Color(0xFFD6D6D7)), - ), - Positioned( - left: l14, - child: GestureDetector( - onTap: () { - Navigator.pop(context); - }, - child: Image( - width: w19, - height: h26, - image: const AssetImage('assets/images/btn_fanhui.png'), - ), + body: SingleChildScrollView( + child: Column( + children: [ + Container( + width: size.width, + height: h50, + margin: EdgeInsets.only(top: MediaQuery.of(context).padding.top), + child: Stack( + alignment: Alignment.center, + children: [ + Text( + "反馈", + style: TextStyle(fontSize: s16, color: const Color(0xFFD6D6D7)), ), - ) - ], + Positioned( + left: l14, + child: GestureDetector( + onTap: () { + Navigator.pop(context); + }, + child: Image( + width: w19, + height: h26, + image: const AssetImage('assets/images/btn_fanhui.png'), + ), + ), + ) + ], + ), ), - ), - Container( - alignment: Alignment.centerLeft, - margin: EdgeInsets.only(left: l14), - child: const Text( - "问题描述:", - style: TextStyle(fontSize: 14, color: Color(0xFFD6D6D7)), + Container( + alignment: Alignment.centerLeft, + margin: EdgeInsets.only(left: l14), + child: Text( + "问题描述:", + style: TextStyle(fontSize: s14, color: Color(0xFFD6D6D7)), + ), ), - ), - Container( - alignment: Alignment.center, - margin: EdgeInsets.symmetric(horizontal: l14, vertical: l20), - padding: const EdgeInsets.only(left: 9, top: 13, right: 9), - decoration: const BoxDecoration( - color: Color(0xFF111319), - borderRadius: BorderRadius.all(Radius.circular(6.6)), + Container( + alignment: Alignment.center, + margin: EdgeInsets.symmetric(horizontal: l14, vertical: l20), + padding: EdgeInsets.only(left: s9, top: t13, right: s9), + decoration: BoxDecoration( + color: Color(0xFF111319), + borderRadius: BorderRadius.all(Radius.circular(c6)), + ), + child: TextField( + controller: _textController, + keyboardType: TextInputType.name, + focusNode: _commentFocus, + decoration: InputDecoration.collapsed( + hintText: '请输入您详细的问题或建议,以便我们提供更好的服务', + hintStyle: TextStyle( + fontSize: l14, + color: Color(0xFF44474F), + )), + textAlign: TextAlign.left, + maxLines: 6, + style: TextStyle(fontSize: l14, color: Colors.white), + // onChanged: _textFieldChanged, + autofocus: false, + maxLength: 200, + ), ), - child: TextField( - controller: _textController, - keyboardType: TextInputType.name, - focusNode: _commentFocus, - decoration: const InputDecoration.collapsed( - hintText: '请输入您详细的问题或建议,以便我们提供更好的服务', - hintStyle: TextStyle( - fontSize: 14.0, - color: Color(0xFF44474F), - )), - textAlign: TextAlign.left, - maxLines: 6, - style: const TextStyle(fontSize: 14.0, color: Colors.white), - // onChanged: _textFieldChanged, - autofocus: false, - maxLength: 200, + Container( + alignment: Alignment.centerLeft, + margin: EdgeInsets.only(left: l14), + child: Text( + "联系方式:", + style: TextStyle(fontSize: l14, color: Color(0xFFD6D6D7)), + ), ), - ), - Container( - alignment: Alignment.centerLeft, - margin: EdgeInsets.only(left: l14), - child: const Text( - "联系方式:", - style: TextStyle(fontSize: 14, color: Color(0xFFD6D6D7)), - ), - ), - Container( - width: size.width, - height: h45, - alignment: Alignment.centerLeft, - padding: const EdgeInsets.only(left: 9, bottom: 5, right: 9), - margin: EdgeInsets.symmetric(horizontal: l14, vertical: l20), - decoration: const BoxDecoration( - color: Color(0xFF111319), - borderRadius: BorderRadius.all(Radius.circular(6.6)), - ), - child: TextField( - controller: _contactController, - style: const TextStyle(fontSize: 14, color: Colors.white), - decoration: const InputDecoration.collapsed( - hintText: '请输入您的QQ或者手机号码', - hintStyle: TextStyle( - fontSize: 11.0, - color: Color(0xFF44474F), - )), - ), - ), - GestureDetector( - onTap: () { - if (_textController.text == "") { - EasyLoading.showToast("请输入反馈内容"); - return; - } - FunctionUtil.loading(); - _viewModel.sendFeedBack(_textController.text, _contactController.text); - }, - child: Container( + Container( width: size.width, height: h45, - margin: EdgeInsets.only(top: t30), - alignment: Alignment.center, + alignment: Alignment.centerLeft, + padding: EdgeInsets.only(left: s9, bottom: b5, right: s9), + margin: EdgeInsets.symmetric(horizontal: l14, vertical: l20), decoration: BoxDecoration( - color: const Color(0xFF074CE7), - borderRadius: BorderRadius.all(Radius.circular(c22)), + color: Color(0xFF111319), + borderRadius: BorderRadius.all(Radius.circular(c6)), ), - child: const Text( - "提交", - style: TextStyle(fontSize: 14, color: Colors.white), + child: TextField( + controller: _contactController, + style: TextStyle(fontSize: l14, color: Colors.white), + decoration: InputDecoration.collapsed( + hintText: '请输入您的QQ或者手机号码', + hintStyle: TextStyle( + fontSize: s11, + color: Color(0xFF44474F), + )), ), ), - ), - ], + GestureDetector( + onTap: () { + if (_textController.text == "") { + EasyLoading.showToast("请输入反馈内容"); + return; + } + FunctionUtil.loading(); + _viewModel.sendFeedBack(_textController.text, _contactController.text); + }, + child: Container( + width: size.width, + height: h45, + margin: EdgeInsets.only(top: t30, left: l14, right: l14), + alignment: Alignment.center, + decoration: BoxDecoration( + color: const Color(0xFF074CE7), + borderRadius: BorderRadius.all(Radius.circular(c22)), + ), + child: Text( + "提交", + style: TextStyle(fontSize: l14, color: Colors.white), + ), + ), + ), + ], + ), ), ); } diff --git a/lib/tools/me/game_history_page.dart b/lib/tools/me/game_history_page.dart index 9068a3f..0f14b7b 100644 --- a/lib/tools/me/game_history_page.dart +++ b/lib/tools/me/game_history_page.dart @@ -113,6 +113,9 @@ class _GameHistoryPageState extends State { final l16 = size.width / 22.5; final w50 = size.width / 7.2; final t80 = size.width / 4.5; + final s14 = size.width / 25.714285714285; + final l10 = size.width / 36; + final s9 = size.width / 40; return GestureDetector( onTap: () { @@ -143,10 +146,10 @@ class _GameHistoryPageState extends State { errorWidget: (context, url, error) => const Icon(Icons.error), ), Container( - margin: const EdgeInsets.only(left: 10), + margin: EdgeInsets.only(left: l10), child: Text( "${data.gameName}", - style: const TextStyle(fontSize: 14, color: Color(0xFFD6D6D7)), + style: TextStyle(fontSize: s14, color: Color(0xFFD6D6D7)), ), ), ], @@ -156,7 +159,7 @@ class _GameHistoryPageState extends State { top: t80, child: Text( "${data.playtime}", - style: const TextStyle(fontSize: 9, color: Color(0xFF9D9D9D)), + style: TextStyle(fontSize: s9, color: Color(0xFF9D9D9D)), )) ], ), diff --git a/lib/tools/me/my_collect_page.dart b/lib/tools/me/my_collect_page.dart index d6d5c39..507d56e 100644 --- a/lib/tools/me/my_collect_page.dart +++ b/lib/tools/me/my_collect_page.dart @@ -109,6 +109,9 @@ class _MyCollectPageState extends State { final size = MediaQuery.of(context).size; final h76 = size.width / 4.736842105263158; final w57 = size.width / 6.315789473684211; + final s14 = size.width / 25.714285714285; + final l10 = size.width / 36; + final s11 = size.width / 32.727272727272; return GestureDetector( onTap: () { Navigator.push( @@ -122,11 +125,11 @@ class _MyCollectPageState extends State { }, child: Container( height: h76, - padding: const EdgeInsets.only(left: 11), - margin: const EdgeInsets.only(top: 10), - decoration: const BoxDecoration( + padding: EdgeInsets.only(left: s11), + margin: EdgeInsets.only(top: l10), + decoration: BoxDecoration( color: Color(0xFF202530), - borderRadius: BorderRadius.all(Radius.circular(11)), + borderRadius: BorderRadius.all(Radius.circular(s11)), ), child: Row( children: [ @@ -137,10 +140,10 @@ class _MyCollectPageState extends State { errorWidget: (context, url, error) => const Icon(Icons.error), ), Container( - margin: const EdgeInsets.only(left: 11), + margin: EdgeInsets.only(left: s11), child: Text( "${data.gameName}", - style: const TextStyle(fontSize: 14, color: Color(0xFFD6D6D7)), + style: TextStyle(fontSize: s14, color: Color(0xFFD6D6D7)), ), ), ], diff --git a/lib/tools/me/my_page.dart b/lib/tools/me/my_page.dart index b9ba164..753ba57 100644 --- a/lib/tools/me/my_page.dart +++ b/lib/tools/me/my_page.dart @@ -50,6 +50,7 @@ class _MyPageState extends State with AutomaticKeepAliveClientMixin { case "useRedemptionCode": EasyLoading.dismiss(); + EventBusUtil.fire(RefreshUserdata()); Navigator.pop(exchangeContext); EasyLoading.showToast(event['data']); break; @@ -58,6 +59,7 @@ class _MyPageState extends State with AutomaticKeepAliveClientMixin { break; case "sevenSignToday": //签到 EasyLoading.showToast(event['data']); + EventBusUtil.fire(RefreshUserdata()); _viewModel.getSevenSignList(); _viewModel.getUserInfo(); break; @@ -103,6 +105,10 @@ class _MyPageState extends State with AutomaticKeepAliveClientMixin { final t18 = size.width / 20; final h60 = size.width / 6; final w20 = size.width / 18; + final l11 = size.width / 32.727272727272; + final s14 = size.width / 25.714285714285; + final l4 = size.width / 90; + final h8 = size.width / 45; return _isInitialized ? Scaffold( @@ -117,7 +123,7 @@ class _MyPageState extends State with AutomaticKeepAliveClientMixin { children: [ Positioned( top: 0, - child: Image(width: size.width, image: AssetImage('assets/images/me_bg.png')), + child: Image(width: size.width, fit: BoxFit.fill, image: AssetImage('assets/images/me_bg.png')), ), Positioned( left: l14, @@ -146,15 +152,15 @@ class _MyPageState extends State with AutomaticKeepAliveClientMixin { }, child: Row( children: [ - const Text( + Text( "编辑个人资料", - style: TextStyle(fontSize: 11, color: Color(0xFF909090)), + style: TextStyle(fontSize: l11, color: Color(0xFF909090)), ), Container( - margin: const EdgeInsets.only(left: 4), - child: const Image( - width: 4, - height: 8, + margin: EdgeInsets.only(left: l4), + child: Image( + width: l4, + height: h8, image: AssetImage('assets/images/ic_arrow.png'), ), ), @@ -168,8 +174,8 @@ class _MyPageState extends State with AutomaticKeepAliveClientMixin { child: Container( width: w330, height: h79, - decoration: const BoxDecoration( - gradient: LinearGradient( + decoration: BoxDecoration( + gradient: const LinearGradient( begin: Alignment.centerLeft, end: Alignment.centerRight, colors: [ @@ -177,7 +183,7 @@ class _MyPageState extends State with AutomaticKeepAliveClientMixin { Color(0xFF39ADFE), ], ), - borderRadius: BorderRadius.all(Radius.circular(11)), + borderRadius: BorderRadius.all(Radius.circular(l11)), ), child: Stack( alignment: Alignment.center, @@ -185,15 +191,15 @@ class _MyPageState extends State with AutomaticKeepAliveClientMixin { Positioned( left: l23, top: t22, - child: const Text( + child: Text( "我的游戏时长", - style: TextStyle(fontSize: 11, color: Color(0xFFE2F3FF)), + style: TextStyle(fontSize: l11, color: Color(0xFFE2F3FF)), )), Positioned( left: l23, top: t41, child: Text( - "${userInfoBean.totalGamingTime} 分钟", + "${userInfoBean.userPlayGameTime} 分钟", style: TextStyle(fontSize: s16, color: Colors.white), )), Positioned( @@ -214,9 +220,9 @@ class _MyPageState extends State with AutomaticKeepAliveClientMixin { ), Container( margin: EdgeInsets.only(top: t18, left: l14, right: l14), - decoration: const BoxDecoration( + decoration: BoxDecoration( color: Color(0xFF202530), - borderRadius: BorderRadius.all(Radius.circular(11)), + borderRadius: BorderRadius.all(Radius.circular(l11)), ), child: Column( children: [ @@ -229,6 +235,10 @@ class _MyPageState extends State with AutomaticKeepAliveClientMixin { SignDialog( list: NetworkConfig.signData!.list!, onTap: () { + if (NetworkConfig.signData!.isSign!) { + EasyLoading.showToast("今日已签到"); + return; + } FunctionUtil.loading(); _viewModel.sevenSignToday(); }, @@ -248,17 +258,17 @@ class _MyPageState extends State with AutomaticKeepAliveClientMixin { ), Container( margin: EdgeInsets.only(left: l14), - child: const Text( + child: Text( "每日签到", - style: TextStyle(fontSize: 14, color: Color(0xFFD6D6D7)), + style: TextStyle(fontSize: s14, color: Color(0xFFD6D6D7)), ), ), Expanded(child: Container()), Container( margin: EdgeInsets.only(right: l23), - child: const Image( - width: 4, - height: 8, + child: Image( + width: l4, + height: h8, image: AssetImage('assets/images/ic_arrow.png'), ), ), @@ -268,37 +278,37 @@ class _MyPageState extends State with AutomaticKeepAliveClientMixin { ), ///任务中心 - SizedBox( - height: h60, - child: Row( - children: [ - Container( - margin: EdgeInsets.only(left: l23), - child: Image( - width: w20, - height: w20, - image: AssetImage('assets/images/ic_task.png'), - ), - ), - Container( - margin: EdgeInsets.only(left: l14), - child: const Text( - "任务中心", - style: TextStyle(fontSize: 14, color: Color(0xFFD6D6D7)), - ), - ), - Expanded(child: Container()), - Container( - margin: EdgeInsets.only(right: l23), - child: const Image( - width: 4, - height: 8, - image: AssetImage('assets/images/ic_arrow.png'), - ), - ), - ], - ), - ), + // SizedBox( + // height: h60, + // child: Row( + // children: [ + // Container( + // margin: EdgeInsets.only(left: l23), + // child: Image( + // width: w20, + // height: w20, + // image: AssetImage('assets/images/ic_task.png'), + // ), + // ), + // Container( + // margin: EdgeInsets.only(left: l14), + // child: const Text( + // "任务中心", + // style: TextStyle(fontSize: 14, color: Color(0xFFD6D6D7)), + // ), + // ), + // Expanded(child: Container()), + // Container( + // margin: EdgeInsets.only(right: l23), + // child: const Image( + // width: 4, + // height: 8, + // image: AssetImage('assets/images/ic_arrow.png'), + // ), + // ), + // ], + // ), + // ), ], ), ), @@ -310,9 +320,9 @@ class _MyPageState extends State with AutomaticKeepAliveClientMixin { }, child: Container( margin: EdgeInsets.only(top: t18, left: l14, right: l14), - decoration: const BoxDecoration( + decoration: BoxDecoration( color: Color(0xFF202530), - borderRadius: BorderRadius.all(Radius.circular(11)), + borderRadius: BorderRadius.all(Radius.circular(l11)), ), child: Column( children: [ @@ -330,17 +340,17 @@ class _MyPageState extends State with AutomaticKeepAliveClientMixin { ), Container( margin: EdgeInsets.only(left: l14), - child: const Text( + child: Text( "游玩历史", - style: TextStyle(fontSize: 14, color: Color(0xFFD6D6D7)), + style: TextStyle(fontSize: s14, color: Color(0xFFD6D6D7)), ), ), Expanded(child: Container()), Container( margin: EdgeInsets.only(right: l23), - child: const Image( - width: 4, - height: 8, + child: Image( + width: l4, + height: h8, image: AssetImage('assets/images/ic_arrow.png'), ), ), @@ -353,48 +363,48 @@ class _MyPageState extends State with AutomaticKeepAliveClientMixin { ), ///包月卡 - Container( - margin: EdgeInsets.only(top: t18, left: l14, right: l14), - decoration: const BoxDecoration( - color: Color(0xFF202530), - borderRadius: BorderRadius.all(Radius.circular(11)), - ), - child: Column( - children: [ - SizedBox( - height: h60, - child: Row( - children: [ - Container( - margin: EdgeInsets.only(left: l23), - child: Image( - width: w20, - height: w20, - image: const AssetImage('assets/images/ic_night.png'), - ), - ), - Container( - margin: EdgeInsets.only(left: l14), - child: const Text( - "包夜卡", - style: TextStyle(fontSize: 14, color: Color(0xFFD6D6D7)), - ), - ), - Expanded(child: Container()), - Container( - margin: EdgeInsets.only(right: l23), - child: const Image( - width: 4, - height: 8, - image: AssetImage('assets/images/ic_arrow.png'), - ), - ), - ], - ), - ), - ], - ), - ), + // Container( + // margin: EdgeInsets.only(top: t18, left: l14, right: l14), + // decoration: const BoxDecoration( + // color: Color(0xFF202530), + // borderRadius: BorderRadius.all(Radius.circular(11)), + // ), + // child: Column( + // children: [ + // SizedBox( + // height: h60, + // child: Row( + // children: [ + // Container( + // margin: EdgeInsets.only(left: l23), + // child: Image( + // width: w20, + // height: w20, + // image: const AssetImage('assets/images/ic_night.png'), + // ), + // ), + // Container( + // margin: EdgeInsets.only(left: l14), + // child: const Text( + // "包夜卡", + // style: TextStyle(fontSize: 14, color: Color(0xFFD6D6D7)), + // ), + // ), + // Expanded(child: Container()), + // Container( + // margin: EdgeInsets.only(right: l23), + // child: const Image( + // width: 4, + // height: 8, + // image: AssetImage('assets/images/ic_arrow.png'), + // ), + // ), + // ], + // ), + // ), + // ], + // ), + // ), Container( margin: EdgeInsets.only(top: t18, left: l14, right: l14, bottom: w20), @@ -424,17 +434,17 @@ class _MyPageState extends State with AutomaticKeepAliveClientMixin { ), Container( margin: EdgeInsets.only(left: l14), - child: const Text( + child: Text( "资产记录", - style: TextStyle(fontSize: 14, color: Color(0xFFD6D6D7)), + style: TextStyle(fontSize: s14, color: Color(0xFFD6D6D7)), ), ), Expanded(child: Container()), Container( margin: EdgeInsets.only(right: l23), - child: const Image( - width: 4, - height: 8, + child: Image( + width: l4, + height: h8, image: AssetImage('assets/images/ic_arrow.png'), ), ), @@ -474,17 +484,17 @@ class _MyPageState extends State with AutomaticKeepAliveClientMixin { ), Container( margin: EdgeInsets.only(left: l14), - child: const Text( + child: Text( "兑换码", - style: TextStyle(fontSize: 14, color: Color(0xFFD6D6D7)), + style: TextStyle(fontSize: s14, color: Color(0xFFD6D6D7)), ), ), Expanded(child: Container()), Container( margin: EdgeInsets.only(right: l23), - child: const Image( - width: 4, - height: 8, + child: Image( + width: l4, + height: h8, image: AssetImage('assets/images/ic_arrow.png'), ), ), @@ -513,17 +523,17 @@ class _MyPageState extends State with AutomaticKeepAliveClientMixin { ), Container( margin: EdgeInsets.only(left: l14), - child: const Text( + child: Text( "反馈", - style: TextStyle(fontSize: 14, color: Color(0xFFD6D6D7)), + style: TextStyle(fontSize: s14, color: Color(0xFFD6D6D7)), ), ), Expanded(child: Container()), Container( margin: EdgeInsets.only(right: l23), - child: const Image( - width: 4, - height: 8, + child: Image( + width: l4, + height: h8, image: AssetImage('assets/images/ic_arrow.png'), ), ), @@ -552,17 +562,17 @@ class _MyPageState extends State with AutomaticKeepAliveClientMixin { ), Container( margin: EdgeInsets.only(left: l14), - child: const Text( + child: Text( "我的收藏", - style: TextStyle(fontSize: 14, color: Color(0xFFD6D6D7)), + style: TextStyle(fontSize: s14, color: Color(0xFFD6D6D7)), ), ), Expanded(child: Container()), Container( margin: EdgeInsets.only(right: l23), - child: const Image( - width: 4, - height: 8, + child: Image( + width: l4, + height: h8, image: AssetImage('assets/images/ic_arrow.png'), ), ), @@ -591,17 +601,17 @@ class _MyPageState extends State with AutomaticKeepAliveClientMixin { ), Container( margin: EdgeInsets.only(left: l14), - child: const Text( + child: Text( "设置", - style: TextStyle(fontSize: 14, color: Color(0xFFD6D6D7)), + style: TextStyle(fontSize: s14, color: Color(0xFFD6D6D7)), ), ), Expanded(child: Container()), Container( margin: EdgeInsets.only(right: l23), - child: const Image( - width: 4, - height: 8, + child: Image( + width: l4, + height: h8, image: AssetImage('assets/images/ic_arrow.png'), ), ), diff --git a/lib/tools/me/property/expenses_page.dart b/lib/tools/me/property/expenses_page.dart index 4b949e2..8c1335d 100644 --- a/lib/tools/me/property/expenses_page.dart +++ b/lib/tools/me/property/expenses_page.dart @@ -110,6 +110,9 @@ class _ExpensesPageState extends State { final l16 = size.width / 22.5; final t46 = size.width / 7.826086956521739; final t73 = size.width / 4.931506849315068; + final s14 = size.width / 25.714285714285; + final l5 = size.width / 72; + final s9 = size.width / 40; return Container( height: h99, @@ -122,16 +125,16 @@ class _ExpensesPageState extends State { top: l16, child: Text( "${data.title}", - style: const TextStyle(fontSize: 14, color: Color(0xFFD6D6D7)), + style: TextStyle(fontSize: s14, color: Color(0xFFD6D6D7)), )), Positioned( left: l16, top: t46, child: Container( - margin: const EdgeInsets.only(left: 5), + margin: EdgeInsets.only(left: l5), child: Text( "${data.consumeDetails}", - style: const TextStyle(fontSize: 14, color: Color(0xFFD6D6D7)), + style: TextStyle(fontSize: s14, color: Color(0xFFD6D6D7)), ), )), Positioned( @@ -139,7 +142,7 @@ class _ExpensesPageState extends State { top: t73, child: Text( "${data.datePrompt}", - style: const TextStyle(fontSize: 9, color: Color(0xFF9D9D9D)), + style: TextStyle(fontSize: s9, color: Color(0xFF9D9D9D)), )) ], ), diff --git a/lib/tools/me/property/income_page.dart b/lib/tools/me/property/income_page.dart index b9844e3..4d4c17e 100644 --- a/lib/tools/me/property/income_page.dart +++ b/lib/tools/me/property/income_page.dart @@ -109,6 +109,9 @@ class _IncomePageState extends State { final t18 = size.width / 20; final l16 = size.width / 22.5; final t46 = size.width / 7.826086956521739; + final s14 = size.width / 25.714285714285; + final l5 = size.width / 72; + final s9 = size.width / 40; return Container( height: h76, @@ -122,23 +125,23 @@ class _IncomePageState extends State { top: l16, child: Text( "${data.title}", - style: const TextStyle(fontSize: 14, color: Color(0xFFD6D6D7)), + style: TextStyle(fontSize: s14, color: Color(0xFFD6D6D7)), )), Positioned( left: l16, top: t46, child: Container( - margin: const EdgeInsets.only(left: 5), + margin: EdgeInsets.only(left: l5), child: Text( "${data.consumeDetails}", - style: const TextStyle(fontSize: 14, color: Color(0xFFD6D6D7)), + style: TextStyle(fontSize: s14, color: Color(0xFFD6D6D7)), ), )), Positioned( right: l16, child: Text( "${data.datePrompt}", - style: const TextStyle(fontSize: 9, color: Color(0xFF9D9D9D)), + style: TextStyle(fontSize: s9, color: Color(0xFF9D9D9D)), )) ], ), diff --git a/lib/tools/me/property/property_page.dart b/lib/tools/me/property/property_page.dart index a50dace..e01857f 100644 --- a/lib/tools/me/property/property_page.dart +++ b/lib/tools/me/property/property_page.dart @@ -27,6 +27,10 @@ class _PropertyPageState extends State { final t18 = size.width / 20; final l15 = size.width / 24; final r23 = size.width / 15.65217391304348; + final l11 = size.width / 32.727272727272; + final s14 = size.width / 25.714285714285; + final w4 = size.width / 90; + final h8 = size.width / 45; return Scaffold( backgroundColor: const Color(0xFF17181A), @@ -59,106 +63,113 @@ class _PropertyPageState extends State { ], ), ), - - ///钻石数量 - Container( - width: size.width, - height: h80, - margin: EdgeInsets.only(left: l14, right: l14, top: t20), - decoration: const BoxDecoration( - borderRadius: BorderRadius.all(Radius.circular(11)), - gradient: LinearGradient( - begin: Alignment.centerLeft, - end: Alignment.centerRight, - colors: [ - Color(0xFF0978FF), - Color(0xFF39ADFE), - ], - ), - ), - child: Stack( - children: [ - Positioned( - left: l18, - top: l16, - child: const Text( - "当前钻石数量", - style: TextStyle(fontSize: 11, color: Color(0xFFE2F3FF)), - )), - Positioned( - left: l18, - top: t34, - child: Text( - "${NetworkConfig.userInfoBean?.diamond}", - style: TextStyle(fontSize: s29, color: Colors.white), - )), - ], - ), - ), - - ///资产收入 - GestureDetector( - onTap: () { - Navigator.pushNamed(context, "/IncomePage"); - }, - child: Container( - height: h60, - margin: EdgeInsets.only(top: t18, left: l15, right: l15), - decoration: const BoxDecoration( - color: Color(0xFF202530), - borderRadius: BorderRadius.all(Radius.circular(11)), - ), - child: Row( + Expanded( + child: SingleChildScrollView( + child: Column( children: [ + ///钻石数量 Container( - margin: EdgeInsets.only(left: l14), - child: const Text( - "资产收入", - style: TextStyle(fontSize: 14, color: Color(0xFFD6D6D7)), + width: size.width, + height: h80, + margin: EdgeInsets.only(left: l14, right: l14, top: t20), + decoration: BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(l11)), + gradient: const LinearGradient( + begin: Alignment.centerLeft, + end: Alignment.centerRight, + colors: [ + Color(0xFF0978FF), + Color(0xFF39ADFE), + ], + ), + ), + child: Stack( + children: [ + Positioned( + left: l18, + top: l16, + child: Text( + "当前钻石数量", + style: TextStyle(fontSize: l11, color: Color(0xFFE2F3FF)), + )), + Positioned( + left: l18, + top: t34, + child: Text( + "${NetworkConfig.userInfoBean?.diamond}", + style: TextStyle(fontSize: s29, color: Colors.white), + )), + ], ), ), - Expanded(child: Container()), - Container( - margin: EdgeInsets.only(right: r23), - child: const Image( - width: 4, - height: 8, - image: AssetImage('assets/images/ic_arrow.png'), - ), - ), - ], - ), - ), - ), - ///资产支出 - GestureDetector( - onTap: () { - Navigator.pushNamed(context, "/ExpensesPage"); - }, - child: Container( - height: h60, - margin: EdgeInsets.only(top: t18, left: l15, right: l15), - decoration: const BoxDecoration( - color: Color(0xFF202530), - borderRadius: BorderRadius.all(Radius.circular(11)), - ), - child: Row( - children: [ - Container( - margin: EdgeInsets.only(left: l14), - child: const Text( - "资产支出", - style: TextStyle(fontSize: 14, color: Color(0xFFD6D6D7)), + ///资产收入 + GestureDetector( + onTap: () { + Navigator.pushNamed(context, "/IncomePage"); + }, + child: Container( + height: h60, + margin: EdgeInsets.only(top: t18, left: l15, right: l15), + decoration: BoxDecoration( + color: Color(0xFF202530), + borderRadius: BorderRadius.all(Radius.circular(l11)), + ), + child: Row( + children: [ + Container( + margin: EdgeInsets.only(left: l14), + child: Text( + "资产收入", + style: TextStyle(fontSize: s14, color: Color(0xFFD6D6D7)), + ), + ), + Expanded(child: Container()), + Container( + margin: EdgeInsets.only(right: r23), + child: Image( + width: w4, + height: h8, + image: AssetImage('assets/images/ic_arrow.png'), + ), + ), + ], + ), ), ), - Expanded(child: Container()), - Container( - margin: EdgeInsets.only(right: r23), - child: const Image( - width: 4, - height: 8, - image: AssetImage('assets/images/ic_arrow.png'), + + ///资产支出 + GestureDetector( + onTap: () { + Navigator.pushNamed(context, "/ExpensesPage"); + }, + child: Container( + height: h60, + margin: EdgeInsets.only(top: t18, left: l15, right: l15, bottom: t18), + decoration: const BoxDecoration( + color: Color(0xFF202530), + borderRadius: BorderRadius.all(Radius.circular(11)), + ), + child: Row( + children: [ + Container( + margin: EdgeInsets.only(left: l14), + child: Text( + "资产支出", + style: TextStyle(fontSize: s14, color: Color(0xFFD6D6D7)), + ), + ), + Expanded(child: Container()), + Container( + margin: EdgeInsets.only(right: r23), + child: Image( + width: w4, + height: h8, + image: AssetImage('assets/images/ic_arrow.png'), + ), + ), + ], + ), ), ), ], diff --git a/lib/tools/me/set/about_page.dart b/lib/tools/me/set/about_page.dart index e23c5a6..259460a 100644 --- a/lib/tools/me/set/about_page.dart +++ b/lib/tools/me/set/about_page.dart @@ -1,5 +1,6 @@ import 'package:flutter/material.dart'; -import 'package:package_info/package_info.dart'; + +import '../../../network/NetworkConfig.dart'; class AboutPage extends StatefulWidget { const AboutPage({super.key}); @@ -9,22 +10,10 @@ class AboutPage extends StatefulWidget { } class _AboutPageState extends State { - String version = ""; - @override void initState() { // TODO: implement initState super.initState(); - _initData(); - } - - void _initData() async { - PackageInfo packageInfo = await PackageInfo.fromPlatform(); - String version = packageInfo.version; - setState(() { - this.version = version; - //vInfo = Platform.isIOS ? 'iOS_$version' : 'android_$version'; - }); } @override @@ -37,6 +26,8 @@ class _AboutPageState extends State { final h26 = size.width / 13.84615384615385; final w57 = size.width / 6.315789473684211; final t18 = size.width / 20; + final t13 = size.width / 27.692307692307; + final s11 = size.width / 32.727272727272; return Scaffold( backgroundColor: const Color(0xFF17181A), @@ -73,8 +64,8 @@ class _AboutPageState extends State { width: w57, height: w57, margin: EdgeInsets.only(top: t18), - child: const ClipRRect( - borderRadius: BorderRadius.all(Radius.circular(11)), + child: ClipRRect( + borderRadius: BorderRadius.all(Radius.circular(s11)), child: Image( image: AssetImage('assets/images/ic_launcher.png'), ), @@ -83,8 +74,8 @@ class _AboutPageState extends State { Container( margin: EdgeInsets.only(top: t18), child: Text( - "当前版本:$version", - style: const TextStyle(fontSize: 13, color: Color(0xFF868686)), + "当前版本:${NetworkConfig.Version}", + style: TextStyle(fontSize: t13, color: Color(0xFF868686)), ), ), ], diff --git a/lib/tools/me/set/real_name_page.dart b/lib/tools/me/set/real_name_page.dart index 142d2bf..081d11e 100644 --- a/lib/tools/me/set/real_name_page.dart +++ b/lib/tools/me/set/real_name_page.dart @@ -78,6 +78,8 @@ class _RealNamePageState extends State { final h44 = size.width / 8.181818181818182; final t36 = size.width / 10; final c22 = size.width / 16.36363636363636; + final s14 = size.width / 25.714285714285; + final s11 = size.width / 32.727272727272; return Scaffold( backgroundColor: const Color(0xFF17181A), @@ -110,110 +112,119 @@ class _RealNamePageState extends State { ], ), ), - Container( - width: size.width, - margin: EdgeInsets.only(top: t18, left: l14, right: l14), - decoration: const BoxDecoration(color: Color(0xFF202530), borderRadius: BorderRadius.all(Radius.circular(11))), + Expanded( + child: SingleChildScrollView( child: Column( - mainAxisSize: MainAxisSize.min, children: [ Container( - margin: EdgeInsets.only(top: t18), - child: const Text( - "请使用有效身份证信息完成认证", - style: TextStyle(fontSize: 14, color: Color(0xFFD6D6D7)), + width: size.width, + margin: EdgeInsets.only(top: t18, left: l14, right: l14), + decoration: const BoxDecoration(color: Color(0xFF202530), borderRadius: BorderRadius.all(Radius.circular(11))), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Container( + margin: EdgeInsets.only(top: t18), + child: Text( + "请使用有效身份证信息完成认证", + style: TextStyle(fontSize: s14, color: Color(0xFFD6D6D7)), + ), + ), + Container( + alignment: Alignment.centerLeft, + margin: EdgeInsets.only(left: s11, top: t18), + child: Text( + "姓名", + style: TextStyle(fontSize: s14, color: Color(0xFFD6D6D7)), + ), + ), + Container( + height: h43, + margin: EdgeInsets.only(left: s11, right: s11, top: s11), + padding: EdgeInsets.only(left: s11), + alignment: Alignment.center, + decoration: BoxDecoration( + color: Color(0xFF111319), + borderRadius: BorderRadius.all(Radius.circular(s11)), + ), + child: TextField( + controller: _nameController, + cursorColor: const Color(0xFF074CE7), + style: TextStyle(fontSize: s11, color: Colors.white), + decoration: InputDecoration( + border: InputBorder.none, + hintText: '请输入姓名', + hintStyle: TextStyle(fontSize: s11, color: Color(0xFF44474F)), + ), + ), + ), + Container( + alignment: Alignment.centerLeft, + margin: EdgeInsets.only(left: s11, top: t18), + child: Text( + "身份证号码", + style: TextStyle(fontSize: s14, color: Color(0xFFD6D6D7)), + ), + ), + Container( + height: h43, + margin: EdgeInsets.only(left: s11, right: s11, top: s11, bottom: t18), + padding: EdgeInsets.only(left: s11), + alignment: Alignment.center, + decoration: BoxDecoration( + color: Color(0xFF111319), + borderRadius: BorderRadius.all(Radius.circular(s11)), + ), + child: TextField( + controller: _codeController, + cursorColor: const Color(0xFF074CE7), + style: TextStyle(fontSize: s11, color: Colors.white), + decoration: InputDecoration( + border: InputBorder.none, + hintText: '请输入身份证号', + hintStyle: TextStyle(fontSize: s11, color: Color(0xFF44474F)), + ), + ), + ), + ], ), ), - Container( - alignment: Alignment.centerLeft, - margin: EdgeInsets.only(left: 11, top: t18), - child: const Text( - "姓名", - style: TextStyle(fontSize: 14, color: Color(0xFFD6D6D7)), - ), - ), - Container( - height: h43, - margin: const EdgeInsets.only(left: 11, right: 11, top: 11), - padding: const EdgeInsets.only(left: 11), - decoration: const BoxDecoration( - color: Color(0xFF111319), - borderRadius: BorderRadius.all(Radius.circular(11)), - ), - child: TextField( - controller: _nameController, - cursorColor: const Color(0xFF074CE7), - style: const TextStyle(fontSize: 11, color: Colors.white), - decoration: const InputDecoration( - border: InputBorder.none, - hintText: '请输入姓名', - hintStyle: TextStyle(fontSize: 11, color: Color(0xFF44474F)), + GestureDetector( + onTap: () { + if (NetworkConfig.userInfoBean!.isRealName! && !NetworkConfig.userInfoBean!.isJuveniles!) { + EasyLoading.showToast("已实名,无需重新认证"); + return; + } + + if (_nameController.text == "") { + EasyLoading.showToast("请输入姓名"); + return; + } + if (_codeController.text == "") { + EasyLoading.showToast("请输入身份证号"); + return; + } + FunctionUtil.loading(); + _viewModel.realAuthentication(_nameController.text, _codeController.text); + }, + child: Container( + width: size.width, + height: h44, + alignment: Alignment.center, + margin: EdgeInsets.only(left: l14, right: l14, top: t36), + decoration: BoxDecoration( + color: const Color(0xFF074CE7), + borderRadius: BorderRadius.all(Radius.circular(c22)), ), - ), - ), - Container( - alignment: Alignment.centerLeft, - margin: EdgeInsets.only(left: 11, top: t18), - child: const Text( - "身份证号码", - style: TextStyle(fontSize: 14, color: Color(0xFFD6D6D7)), - ), - ), - Container( - height: h43, - margin: EdgeInsets.only(left: 11, right: 11, top: 11, bottom: t18), - padding: const EdgeInsets.only(left: 11), - decoration: const BoxDecoration( - color: Color(0xFF111319), - borderRadius: BorderRadius.all(Radius.circular(11)), - ), - child: TextField( - controller: _codeController, - cursorColor: const Color(0xFF074CE7), - style: const TextStyle(fontSize: 11, color: Colors.white), - decoration: const InputDecoration( - border: InputBorder.none, - hintText: '请输入身份证号', - hintStyle: TextStyle(fontSize: 11, color: Color(0xFF44474F)), + child: Text( + btText, + style: TextStyle(fontSize: s14, color: Colors.white), ), ), ), ], ), - ), - GestureDetector( - onTap: () { - if (NetworkConfig.userInfoBean!.isRealName! && !NetworkConfig.userInfoBean!.isJuveniles!) { - EasyLoading.showToast("已实名,无需重新认证"); - return; - } - - if (_nameController.text == "") { - EasyLoading.showToast("请输入姓名"); - return; - } - if (_codeController.text == "") { - EasyLoading.showToast("请输入身份证号"); - return; - } - FunctionUtil.loading(); - _viewModel.realAuthentication(_nameController.text, _codeController.text); - }, - child: Container( - width: size.width, - height: h44, - alignment: Alignment.center, - margin: EdgeInsets.only(left: l14, right: l14, top: t36), - decoration: BoxDecoration( - color: const Color(0xFF074CE7), - borderRadius: BorderRadius.all(Radius.circular(c22)), - ), - child: Text( - btText, - style: const TextStyle(fontSize: 14, color: Colors.white), - ), - ), - ), + )), ], ), ); diff --git a/lib/tools/me/set/setting_page.dart b/lib/tools/me/set/setting_page.dart index 22c6e1a..63c6d9f 100644 --- a/lib/tools/me/set/setting_page.dart +++ b/lib/tools/me/set/setting_page.dart @@ -22,6 +22,10 @@ class _SettingPageState extends State { final t18 = size.width / 20; final l15 = size.width / 24; final l23 = size.width / 15.65217391304348; + final s14 = size.width / 25.714285714285; + final s11 = size.width / 32.727272727272; + final w4 = size.width / 90; + final h8 = size.width / 45; return Scaffold( backgroundColor: const Color(0xFF17181A), @@ -54,154 +58,161 @@ class _SettingPageState extends State { ], ), ), - - ///用户协议 - GestureDetector( - onTap: () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => const AgreementPage( - title: "用户协议", - url: "https://shhuanmeng.com/yonghuxieyi.html", - )), - ); - }, - child: Container( - height: h60, - margin: EdgeInsets.only(top: t18, left: l15, right: l15), - decoration: const BoxDecoration( - color: Color(0xFF202530), - borderRadius: BorderRadius.all(Radius.circular(11)), - ), - child: Row( + Expanded( + child: SingleChildScrollView( + child: Column( children: [ - Container( - margin: EdgeInsets.only(left: l14), - child: const Text( - "用户协议", - style: TextStyle(fontSize: 14, color: Color(0xFFD6D6D7)), + ///用户协议 + GestureDetector( + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => const AgreementPage( + title: "用户协议", + url: "https://shhuanmeng.com/yonghuxieyi.html", + )), + ); + }, + child: Container( + height: h60, + margin: EdgeInsets.only(top: t18, left: l15, right: l15), + decoration: BoxDecoration( + color: Color(0xFF202530), + borderRadius: BorderRadius.all(Radius.circular(s11)), + ), + child: Row( + children: [ + Container( + margin: EdgeInsets.only(left: l14), + child: Text( + "用户协议", + style: TextStyle(fontSize: s14, color: Color(0xFFD6D6D7)), + ), + ), + Expanded(child: Container()), + Container( + margin: EdgeInsets.only(right: l23), + child: Image( + width: w4, + height: h8, + image: AssetImage('assets/images/ic_arrow.png'), + ), + ), + ], + ), ), ), - Expanded(child: Container()), - Container( - margin: EdgeInsets.only(right: l23), - child: const Image( - width: 4, - height: 8, - image: AssetImage('assets/images/ic_arrow.png'), - ), - ), - ], - ), - ), - ), - ///隐私政策 - GestureDetector( - onTap: () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => const AgreementPage( - title: "隐私政策", - url: "https://shhuanmeng.com/yinsixieyi.html", - )), - ); - }, - child: Container( - height: h60, - margin: EdgeInsets.only(top: t18, left: l15, right: l15), - decoration: const BoxDecoration( - color: Color(0xFF202530), - borderRadius: BorderRadius.all(Radius.circular(11)), - ), - child: Row( - children: [ - Container( - margin: EdgeInsets.only(left: l14), - child: const Text( - "隐私政策", - style: TextStyle(fontSize: 14, color: Color(0xFFD6D6D7)), + ///隐私政策 + GestureDetector( + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => const AgreementPage( + title: "隐私政策", + url: "https://shhuanmeng.com/yinsixieyi.html", + )), + ); + }, + child: Container( + height: h60, + margin: EdgeInsets.only(top: t18, left: l15, right: l15), + decoration: BoxDecoration( + color: Color(0xFF202530), + borderRadius: BorderRadius.all(Radius.circular(s11)), + ), + child: Row( + children: [ + Container( + margin: EdgeInsets.only(left: l14), + child: Text( + "隐私政策", + style: TextStyle(fontSize: s14, color: Color(0xFFD6D6D7)), + ), + ), + Expanded(child: Container()), + Container( + margin: EdgeInsets.only(right: l23), + child: Image( + width: w4, + height: h8, + image: AssetImage('assets/images/ic_arrow.png'), + ), + ), + ], + ), ), ), - Expanded(child: Container()), - Container( - margin: EdgeInsets.only(right: l23), - child: const Image( - width: 4, - height: 8, - image: AssetImage('assets/images/ic_arrow.png'), - ), - ), - ], - ), - ), - ), - ///实名认证 - GestureDetector( - onTap: () { - Navigator.pushNamed(context, "/RealNamePage"); - }, - child: Container( - height: h60, - margin: EdgeInsets.only(top: t18, left: l15, right: l15), - decoration: const BoxDecoration( - color: Color(0xFF202530), - borderRadius: BorderRadius.all(Radius.circular(11)), - ), - child: Row( - children: [ - Container( - margin: EdgeInsets.only(left: l14), - child: const Text( - "实名认证", - style: TextStyle(fontSize: 14, color: Color(0xFFD6D6D7)), + ///实名认证 + GestureDetector( + onTap: () { + Navigator.pushNamed(context, "/RealNamePage"); + }, + child: Container( + height: h60, + margin: EdgeInsets.only(top: t18, left: l15, right: l15), + decoration: BoxDecoration( + color: Color(0xFF202530), + borderRadius: BorderRadius.all(Radius.circular(s11)), + ), + child: Row( + children: [ + Container( + margin: EdgeInsets.only(left: l14), + child: Text( + "实名认证", + style: TextStyle(fontSize: s14, color: Color(0xFFD6D6D7)), + ), + ), + Expanded(child: Container()), + Container( + margin: EdgeInsets.only(right: l23), + child: Image( + width: w4, + height: h8, + image: AssetImage('assets/images/ic_arrow.png'), + ), + ), + ], + ), ), ), - Expanded(child: Container()), - Container( - margin: EdgeInsets.only(right: l23), - child: const Image( - width: 4, - height: 8, - image: AssetImage('assets/images/ic_arrow.png'), - ), - ), - ], - ), - ), - ), - ///关于 - GestureDetector( - onTap: () { - Navigator.pushNamed(context, "/AboutPage"); - }, - child: Container( - height: h60, - margin: EdgeInsets.only(top: t18, left: l15, right: l15), - decoration: const BoxDecoration( - color: Color(0xFF202530), - borderRadius: BorderRadius.all(Radius.circular(11)), - ), - child: Row( - children: [ - Container( - margin: EdgeInsets.only(left: l14), - child: const Text( - "关于", - style: TextStyle(fontSize: 14, color: Color(0xFFD6D6D7)), - ), - ), - Expanded(child: Container()), - Container( - margin: EdgeInsets.only(right: l23), - child: const Image( - width: 4, - height: 8, - image: AssetImage('assets/images/ic_arrow.png'), + ///关于 + GestureDetector( + onTap: () { + Navigator.pushNamed(context, "/AboutPage"); + }, + child: Container( + height: h60, + margin: EdgeInsets.only(top: t18, left: l15, right: l15), + decoration: BoxDecoration( + color: Color(0xFF202530), + borderRadius: BorderRadius.all(Radius.circular(s11)), + ), + child: Row( + children: [ + Container( + margin: EdgeInsets.only(left: l14), + child: Text( + "关于", + style: TextStyle(fontSize: s14, color: Color(0xFFD6D6D7)), + ), + ), + Expanded(child: Container()), + Container( + margin: EdgeInsets.only(right: l23), + child: Image( + width: w4, + height: h8, + image: AssetImage('assets/images/ic_arrow.png'), + ), + ), + ], + ), ), ), ], diff --git a/lib/tools/shop/shop_model.dart b/lib/tools/shop/shop_model.dart index 61ee703..85c1aa6 100644 --- a/lib/tools/shop/shop_model.dart +++ b/lib/tools/shop/shop_model.dart @@ -94,17 +94,19 @@ class ShopModel { }); } - ///用户信息 Future getUserInfo() async { RequestCenter.instance.requestGet(NetworkConfig.getUserInfo, {}, (BaseEntity dataEntity) { if (dataEntity.code == 0) { UserInfoBean userInfoBean = UserInfoBean.fromJson(dataEntity.data); NetworkConfig.userInfoBean = userInfoBean; + streamController.sink.add({ + 'code': "getUserInfo", //有数据 + 'data': "data", + }); } }, (ErrorEntity errorEntity) { print("errorEntity==${errorEntity.message}"); }); } - } diff --git a/lib/tools/shop/shop_page.dart b/lib/tools/shop/shop_page.dart index ff1586e..81f0495 100644 --- a/lib/tools/shop/shop_page.dart +++ b/lib/tools/shop/shop_page.dart @@ -24,6 +24,7 @@ class _ShopPageState extends State with AutomaticKeepAliveClientMixin late StreamSubscription subscription; final ShopModel _viewModel = ShopModel(); StreamSubscription? _paySuccess; + late StreamSubscription _refreshUserEvent; List goodList = []; @@ -43,6 +44,11 @@ class _ShopPageState extends State with AutomaticKeepAliveClientMixin _viewModel.getOrderRewardsInfo(); }); + //刷新信息 + _refreshUserEvent = EventBusUtil.listen((event) { + _viewModel.getUserInfo(); + }); + subscription = _viewModel.streamController.stream.listen((event) { String code = event['code']; if (code.isNotEmpty) { @@ -91,6 +97,8 @@ class _ShopPageState extends State with AutomaticKeepAliveClientMixin @override void dispose() { // TODO: implement dispose + _paySuccess?.cancel(); + _refreshUserEvent.cancel(); subscription.cancel(); super.dispose(); } @@ -111,6 +119,9 @@ class _ShopPageState extends State with AutomaticKeepAliveClientMixin final w157 = size.width / 2.292993630573248; final h44 = size.width / 8.181818181818182; final c22 = size.width / 16.36363636363636; + final l11 = size.width / 32.727272727272; + final s14 = size.width / 25.714285714285; + final s13 = size.width / 27.692307692307; return Scaffold( backgroundColor: const Color(0xFF17181A), @@ -128,6 +139,7 @@ class _ShopPageState extends State with AutomaticKeepAliveClientMixin ), Container( width: size.width, + alignment: Alignment.center, margin: EdgeInsets.only(left: l14, right: l14, top: t36), child: Stack( children: [ @@ -135,9 +147,9 @@ class _ShopPageState extends State with AutomaticKeepAliveClientMixin Positioned( left: l20, top: t17, - child: const Text( + child: Text( "当前钻石数量", - style: TextStyle(fontSize: 11, color: Color(0xFFE2F3FF)), + style: TextStyle(fontSize: l11, color: const Color(0xFFE2F3FF)), )), Positioned( left: l18, @@ -199,10 +211,10 @@ class _ShopPageState extends State with AutomaticKeepAliveClientMixin children: [ Image(width: l20, height: t17, image: AssetImage('assets/images/ic_wx.png')), Container( - margin: const EdgeInsets.only(left: 11), - child: const Text( + margin: EdgeInsets.only(left: l11), + child: Text( "微信支付", - style: TextStyle(fontSize: 13, color: Color(0xFFD6D6D7)), + style: TextStyle(fontSize: s13, color: Color(0xFFD6D6D7)), ), ), ], @@ -231,10 +243,10 @@ class _ShopPageState extends State with AutomaticKeepAliveClientMixin children: [ Image(width: t17, height: t17, image: AssetImage('assets/images/ic_zfb.png')), Container( - margin: const EdgeInsets.only(left: 11), - child: const Text( + margin: EdgeInsets.only(left: l11), + child: Text( "支付宝支付", - style: TextStyle(fontSize: 13, color: Color(0xFFD6D6D7)), + style: TextStyle(fontSize: s13, color: Color(0xFFD6D6D7)), ), ), ], @@ -259,9 +271,9 @@ class _ShopPageState extends State with AutomaticKeepAliveClientMixin color: const Color(0xFF074CE7), borderRadius: BorderRadius.all(Radius.circular(c22)), ), - child: const Text( + child: Text( "确认支付", - style: TextStyle(fontSize: 14, color: Colors.white), + style: TextStyle(fontSize: s14, color: Colors.white), ), ), ) diff --git a/lib/tools/start_page.dart b/lib/tools/start_page.dart index 8b1f596..aa00b30 100644 --- a/lib/tools/start_page.dart +++ b/lib/tools/start_page.dart @@ -4,6 +4,7 @@ import 'dart:io'; import 'package:device_info_plus/device_info_plus.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; +import 'package:package_info/package_info.dart'; import 'package:shared_preferences/shared_preferences.dart'; import '../common/Global.dart'; @@ -45,7 +46,23 @@ class _StartPageState extends State { } }); + _initData(); + } + + ///初始化数据 + _initData() async { getDeviceInfo(); + if (Platform.isIOS) { + NetworkConfig.Platform = "ios"; + } else if (Platform.isAndroid) { + NetworkConfig.Platform = "android"; + } + + PackageInfo packageInfo = await PackageInfo.fromPlatform(); + NetworkConfig.Version = packageInfo.version; + + ///获取app配置 + _viewModel.getAppConfig(); } ///获取设备号/名称 @@ -62,14 +79,13 @@ class _StartPageState extends State { dynamic infoData = await Global.method.invokeMethod("getInfo"); Map headersMap = Map.from(infoData); NetworkConfig.deviceID = headersMap["deviceID"]; + NetworkConfig.Language = headersMap["Language"]; //系统语言 print("deviceID==${NetworkConfig.deviceID}"); + print("Language==${NetworkConfig.Language}"); AndroidDeviceInfo androidInfo = await deviceInfo.androidInfo; NetworkConfig.deviceName = androidInfo.model; print("model==${androidInfo.model}"); } - - ///获取app配置 - _viewModel.getAppConfig(); } ///判断是否首次进入