diff --git a/lib/tools/game/game_info_page.dart b/lib/tools/game/game_info_page.dart index 4f03229..392ace6 100644 --- a/lib/tools/game/game_info_page.dart +++ b/lib/tools/game/game_info_page.dart @@ -90,6 +90,7 @@ class _GameInfoPageState extends State { final b40 = size.width / 9; final w331 = size.width / 1.0876132930513; final h44 = size.width / 8.1818181818181; + final c22 = size.width / 16.363636363636; return Scaffold( backgroundColor: Color(0xFF17181A), @@ -410,7 +411,7 @@ class _GameInfoPageState extends State { alignment: Alignment.center, decoration: BoxDecoration( color: const Color(0xFF074CE7), - borderRadius: BorderRadius.all(Radius.circular(t18)), + borderRadius: BorderRadius.all(Radius.circular(c22)), ), child: const Text( "开始游戏", diff --git a/lib/tools/game/game_page.dart b/lib/tools/game/game_page.dart index 33b8b4d..2f179eb 100644 --- a/lib/tools/game/game_page.dart +++ b/lib/tools/game/game_page.dart @@ -214,7 +214,7 @@ class _GamePageState extends State { _gameItem(index, GameListBean data, context) { final size = MediaQuery.of(context).size; final w107 = size.width / 3.3644859813084; - final w75 = size.width / 6.3157894736842; + final w75 = size.width / 4.8; final h32 = size.width / 11.25; final c18 = size.width / 20; diff --git a/lib/tools/game/game_play_time_page.dart b/lib/tools/game/game_play_time_page.dart index a2c1c2c..329bdc7 100644 --- a/lib/tools/game/game_play_time_page.dart +++ b/lib/tools/game/game_play_time_page.dart @@ -52,6 +52,17 @@ class _GamePlaytimeState extends State { @override Widget build(BuildContext context) { final size = MediaQuery.of(context).size; + + final h50 = size.width / 7.2; + final s16 = size.width / 22.5; + final l14 = size.width / 25.714285714285; + final w19 = size.width / 18.947368421052; + final h26 = size.width / 13.846153846153; + final t20 = size.width / 18; + final h80 = size.width / 4.5; + final w25 = size.width / 14.4; + final w43 = size.width / 8.3720930232558; + return Scaffold( backgroundColor: const Color(0xFF17181A), body: _isInitialized @@ -59,25 +70,25 @@ class _GamePlaytimeState extends State { children: [ Container( width: size.width, - height: 50, + height: h50, margin: EdgeInsets.only(top: MediaQuery.of(context).padding.top), child: Stack( alignment: Alignment.center, children: [ Text( "游戏时长排行榜", - style: TextStyle(fontSize: 16, color: Color(0xFFD6D6D7)), + style: TextStyle(fontSize: s16, color: const Color(0xFFD6D6D7)), ), Positioned( - left: 14, + left: l14, child: GestureDetector( onTap: () { Navigator.pop(context); }, child: Image( - width: 19, - height: 26, - image: AssetImage('assets/images/btn_fanhui.png'), + width: w19, + height: h26, + image: const AssetImage('assets/images/btn_fanhui.png'), ), ), ) @@ -85,78 +96,76 @@ class _GamePlaytimeState extends State { ), ), Container( - margin: EdgeInsets.only(top: 20, left: 14, right: 14), + margin: EdgeInsets.only(top: t20, left: l14, right: l14), child: Row( children: [ - Text( + const Text( "排名", style: TextStyle(fontSize: 13, color: Color(0xFF909090)), ), Container( - margin: EdgeInsets.only(left: 13), - child: Text( + margin: const EdgeInsets.only(left: 13), + child: const Text( "用户信息", style: TextStyle(fontSize: 13, color: Color(0xFF909090)), ), ), Expanded(child: Container()), - Container( - child: Text( - "游戏时间", - style: TextStyle(fontSize: 13, color: Color(0xFF909090)), - ), + const Text( + "游戏时间", + style: TextStyle(fontSize: 13, color: Color(0xFF909090)), ), ], ), ), Expanded( child: Container( - margin: EdgeInsets.only(top: 20, left: 14, right: 14), + margin: EdgeInsets.only(top: t20, left: l14, right: l14), child: ListView.builder( padding: EdgeInsets.zero, itemCount: gamePlayTimeBean.gamePlayTimes?.length, itemBuilder: (context, index) { - return _item(index, gamePlayTimeBean.gamePlayTimes![index]); + return _item(index, gamePlayTimeBean.gamePlayTimes![index], context); }), )), Container( width: size.width, - height: 80, - padding: EdgeInsets.only(left: 14, right: 14), - color: Color(0xFF171A22), + height: h80, + padding: EdgeInsets.only(left: l14, right: l14), + color: const Color(0xFF171A22), child: Row( children: [ Container( - width: 25, - height: 25, + width: w25, + height: w25, alignment: Alignment.center, child: Text( "${gamePlayTimeBean.userGamePlayTime!.ranking}", - style: TextStyle(fontSize: 14, color: Color(0xFF909090)), + style: TextStyle(fontSize: l14, color: Color(0xFF909090)), ), ), Container( - margin: EdgeInsets.only(left: 13), + margin: const EdgeInsets.only(left: 13), child: ClipOval( child: CachedNetworkImage( - width: 43, - height: 43, + width: w43, + height: w43, imageUrl: '${gamePlayTimeBean.userGamePlayTime!.userIcon}', errorWidget: (context, url, error) => const Icon(Icons.error), ), ), ), Container( - margin: EdgeInsets.only(left: 13), + margin: const EdgeInsets.only(left: 13), child: Text( "${gamePlayTimeBean.userGamePlayTime!.userName}", - style: TextStyle(fontSize: 14, color: Color(0xFFD6D6D7)), + style: TextStyle(fontSize: l14, color: const Color(0xFFD6D6D7)), ), ), Expanded(child: Container()), Text( "${gamePlayTimeBean.userGamePlayTime!.playTime}", - style: TextStyle(fontSize: 14, color: Color(0xFFD6D6D7)), + style: TextStyle(fontSize: l14, color: const Color(0xFFD6D6D7)), ), ], ), @@ -167,18 +176,24 @@ class _GamePlaytimeState extends State { ); } - _item(index, GamePlayTimeBeans data) { + _item(index, GamePlayTimeBeans data, context) { + final size = MediaQuery.of(context).size; + final b18 = size.width / 20; + final w25 = size.width / 14.4; + final w43 = size.width / 8.3720930232558; + final s14 = size.width / 25.714285714285; + return Container( - margin: EdgeInsets.only(bottom: 18), + margin: EdgeInsets.only(bottom: b18), child: Row( children: [ index == 0 ? ClipOval( child: Container( - width: 25, - height: 25, + width: w25, + height: w25, alignment: Alignment.center, - decoration: BoxDecoration( + decoration: const BoxDecoration( gradient: LinearGradient( begin: Alignment.topCenter, end: Alignment.bottomCenter, @@ -190,17 +205,17 @@ class _GamePlaytimeState extends State { ), child: Text( "${data.ranking}", - style: TextStyle(fontSize: 14, color: Colors.white), + style: TextStyle(fontSize: s14, color: Colors.white), ), ), ) : index == 1 ? ClipOval( child: Container( - width: 25, - height: 25, + width: w25, + height: w25, alignment: Alignment.center, - decoration: BoxDecoration( + decoration: const BoxDecoration( gradient: LinearGradient( begin: Alignment.topCenter, end: Alignment.bottomCenter, @@ -212,17 +227,17 @@ class _GamePlaytimeState extends State { ), child: Text( "${data.ranking}", - style: TextStyle(fontSize: 14, color: Colors.white), + style: TextStyle(fontSize: s14, color: Colors.white), ), ), ) : index == 2 ? ClipOval( child: Container( - width: 25, - height: 25, + width: w25, + height: w25, alignment: Alignment.center, - decoration: BoxDecoration( + decoration: const BoxDecoration( gradient: LinearGradient( begin: Alignment.topCenter, end: Alignment.bottomCenter, @@ -234,41 +249,41 @@ class _GamePlaytimeState extends State { ), child: Text( "${data.ranking}", - style: TextStyle(fontSize: 14, color: Colors.white), + style: TextStyle(fontSize: s14, color: Colors.white), ), ), ) : Container( - width: 25, - height: 25, + width: w25, + height: w25, alignment: Alignment.center, child: Text( "${data.ranking}.", - style: TextStyle(fontSize: 14, color: Color(0xFF909090)), + style: TextStyle(fontSize: s14, color: Color(0xFF909090)), ), ), Container( - margin: EdgeInsets.only(left: 13), + margin: const EdgeInsets.only(left: 13), child: ClipOval( child: CachedNetworkImage( - width: 43, - height: 43, + width: w43, + height: w43, imageUrl: '${data.userIcon}', errorWidget: (context, url, error) => const Icon(Icons.error), ), ), ), Container( - margin: EdgeInsets.only(left: 13), + margin: const EdgeInsets.only(left: 13), child: Text( "${data.userName}", - style: TextStyle(fontSize: 14, color: Color(0xFFD6D6D7)), + style: TextStyle(fontSize: s14, color: Color(0xFFD6D6D7)), ), ), Expanded(child: Container()), Text( "${data.playTime}", - style: TextStyle(fontSize: 14, color: Color(0xFFD6D6D7)), + 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 60d075e..b9c80de 100644 --- a/lib/tools/home/home_ranking_page.dart +++ b/lib/tools/home/home_ranking_page.dart @@ -25,28 +25,42 @@ class _HomeRankingPageState extends State { @override Widget build(BuildContext context) { final size = MediaQuery.of(context).size; + final h250 = size.width / 1.44; + final l15 = size.width / 24; + final w99 = size.width / 3.63636363636; + final h160 = size.width / 2.25; + final h104 = size.width / 3.4615384615384; + final w20 = size.width / 18; + final w57 = size.width / 6.3157894736842; + final w75 = size.width / 4.8; + final h29 = size.width / 12.413793103448; + final c18 = size.width / 20; + final h181 = size.width / 1.988950276243; + final h126 = size.width / 2.8571428571428; + final t17 = size.width / 21.176470588235; + return Column( children: [ ///游玩时长前三游戏 Container( width: size.width, - height: 250, - margin: EdgeInsets.only(left: 15, right: 15), + height: h250, + margin: EdgeInsets.only(left: l15, right: l15), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Container( - width: 99, - height: 160, + SizedBox( + width: w99, + height: h160, child: Stack( alignment: Alignment.center, children: [ Positioned( bottom: 0, child: Container( - width: 99, - height: 104, - decoration: BoxDecoration( + width: w99, + height: h104, + decoration: const BoxDecoration( borderRadius: BorderRadius.all(Radius.circular(11)), gradient: LinearGradient( begin: Alignment.topCenter, @@ -65,10 +79,10 @@ class _HomeRankingPageState extends State { children: [ ClipOval( child: Container( - width: 20, - height: 20, + width: w20, + height: w20, alignment: Alignment.center, - decoration: BoxDecoration( + decoration: const BoxDecoration( gradient: LinearGradient( begin: Alignment.topCenter, end: Alignment.bottomCenter, @@ -78,17 +92,17 @@ class _HomeRankingPageState extends State { ], ), ), - child: Text( + child: const Text( "2", style: TextStyle(fontSize: 12, color: Colors.white), ), ), ), Container( - margin: EdgeInsets.only(top: 11), + margin: const EdgeInsets.only(top: 11), child: CachedNetworkImage( - width: 57, - height: 57, + width: w57, + height: w57, imageUrl: '${widget.rankingList[1].gameIconImage}', errorWidget: (context, url, error) => const Icon(Icons.error), ), @@ -104,15 +118,15 @@ class _HomeRankingPageState extends State { ), ), Container( - width: 75, - height: 29, + width: w75, + height: h29, alignment: Alignment.center, - margin: EdgeInsets.only(top: 9), + margin: const EdgeInsets.only(top: 9), decoration: BoxDecoration( color: Colors.white, - borderRadius: BorderRadius.all(Radius.circular(18)), + borderRadius: BorderRadius.all(Radius.circular(c18)), ), - child: Text( + child: const Text( '打开', style: TextStyle(color: Color(0xFF1282FF), fontSize: 13), ), @@ -123,17 +137,17 @@ class _HomeRankingPageState extends State { ), ), Container( - width: 99, - height: 181, + width: w99, + height: h181, child: Stack( alignment: Alignment.center, children: [ Positioned( bottom: 0, child: Container( - width: 99, - height: 126, - decoration: BoxDecoration( + width: w99, + height: h126, + decoration: const BoxDecoration( borderRadius: BorderRadius.all(Radius.circular(11)), gradient: LinearGradient( begin: Alignment.topCenter, @@ -152,10 +166,10 @@ class _HomeRankingPageState extends State { children: [ ClipOval( child: Container( - width: 20, - height: 20, + width: w20, + height: w20, alignment: Alignment.center, - decoration: BoxDecoration( + decoration: const BoxDecoration( gradient: LinearGradient( begin: Alignment.topCenter, end: Alignment.bottomCenter, @@ -165,40 +179,40 @@ class _HomeRankingPageState extends State { ], ), ), - child: Text( + child: const Text( "1", style: TextStyle(fontSize: 12, color: Colors.white), ), ), ), Container( - margin: EdgeInsets.only(top: 11), + margin: const EdgeInsets.only(top: 11), child: CachedNetworkImage( - width: 57, - height: 57, + width: w57, + height: w57, imageUrl: '${widget.rankingList[0].gameIconImage}', errorWidget: (context, url, error) => const Icon(Icons.error), ), ), Container( - width: 75, - margin: EdgeInsets.only(top: 17), + width: w75, + margin: EdgeInsets.only(top: t17), child: Text( "${widget.rankingList[0].gameName}", overflow: TextOverflow.ellipsis, - style: TextStyle(fontSize: 14, color: Colors.white), + style: const TextStyle(fontSize: 14, color: Colors.white), ), ), Container( - width: 75, - height: 29, + width: w75, + height: h29, alignment: Alignment.center, - margin: EdgeInsets.only(top: 18), + margin: EdgeInsets.only(top: c18), decoration: BoxDecoration( color: Colors.white, - borderRadius: BorderRadius.all(Radius.circular(18)), + borderRadius: BorderRadius.all(Radius.circular(c18)), ), - child: Text( + child: const Text( '打开', style: TextStyle(color: Color(0xFFF86534), fontSize: 13), ), @@ -208,18 +222,18 @@ class _HomeRankingPageState extends State { ], ), ), - Container( - width: 99, - height: 160, + SizedBox( + width: w99, + height: h160, child: Stack( alignment: Alignment.center, children: [ Positioned( bottom: 0, child: Container( - width: 99, - height: 104, - decoration: BoxDecoration( + width: w99, + height: h104, + decoration: const BoxDecoration( borderRadius: BorderRadius.all(Radius.circular(11)), gradient: LinearGradient( begin: Alignment.topCenter, @@ -238,10 +252,10 @@ class _HomeRankingPageState extends State { children: [ ClipOval( child: Container( - width: 20, - height: 20, + width: w20, + height: w20, alignment: Alignment.center, - decoration: BoxDecoration( + decoration: const BoxDecoration( gradient: LinearGradient( begin: Alignment.topCenter, end: Alignment.bottomCenter, @@ -251,40 +265,40 @@ class _HomeRankingPageState extends State { ], ), ), - child: Text( + child: const Text( "3", style: TextStyle(fontSize: 12, color: Colors.white), ), ), ), Container( - margin: EdgeInsets.only(top: 11), + margin: const EdgeInsets.only(top: 11), child: CachedNetworkImage( - width: 57, - height: 57, + width: w57, + height: w57, imageUrl: '${widget.rankingList[2].gameIconImage}', errorWidget: (context, url, error) => const Icon(Icons.error), ), ), Container( - width: 75, - margin: EdgeInsets.only(top: 8), + width: w75, + margin: const EdgeInsets.only(top: 8), child: Text( "${widget.rankingList[2].gameName}", overflow: TextOverflow.ellipsis, - style: TextStyle(fontSize: 14, color: Colors.white), + style: const TextStyle(fontSize: 14, color: Colors.white), ), ), Container( - width: 75, - height: 29, + width: w75, + height: h29, alignment: Alignment.center, - margin: EdgeInsets.only(top: 9), + margin: const EdgeInsets.only(top: 9), decoration: BoxDecoration( color: Colors.white, - borderRadius: BorderRadius.all(Radius.circular(18)), + borderRadius: BorderRadius.all(Radius.circular(c18)), ), - child: Text( + child: const Text( '打开', style: TextStyle(color: Color(0xFFF3353A), fontSize: 13), ), @@ -300,61 +314,67 @@ class _HomeRankingPageState extends State { ///游玩历史列表 Container( - margin: EdgeInsets.only(left: 15, right: 15, bottom: 20), + margin: EdgeInsets.only(left: l15, right: l15, bottom: w20), child: ListView.builder( padding: EdgeInsets.zero, itemCount: gameList.length, shrinkWrap: true, physics: NeverScrollableScrollPhysics(), itemBuilder: (BuildContext context, int index) { - return _gameItem(index, gameList[index]); + return _gameItem(index, gameList[index], context); }), ), ], ); } - _gameItem(index, HomeRankingBean data) { + _gameItem(index, HomeRankingBean data, context) { + final size = MediaQuery.of(context).size; + final h60 = size.width / 6; + final t18 = size.width / 20; + final w25 = size.width / 14.4; + final w57 = size.width / 6.3157894736842; + return Container( width: double.infinity, - height: 60, - margin: EdgeInsets.only(top: 18), + height: h60, + margin: EdgeInsets.only(top: t18), child: Row( children: [ Container( - width: 25, - height: 25, + width: w25, + height: w25, alignment: Alignment.center, child: Text( "${index + 4}.", - style: TextStyle(fontSize: 14, color: Colors.white), + style: const TextStyle(fontSize: 14, color: Colors.white), ), ), Container( - margin: EdgeInsets.only(left: 13), + margin: const EdgeInsets.only(left: 13), child: CachedNetworkImage( - width: 57, - height: 57, + width: w57, + height: w57, imageUrl: '${data.gameIconImage}', errorWidget: (context, url, error) => const Icon(Icons.error), ), ), Container( - margin: EdgeInsets.only(left: 11), + margin: const EdgeInsets.only(left: 11), child: Text( "${data.gameName}", - style: TextStyle(fontSize: 14, color: Color(0xFFD6D6D7)), + style: const TextStyle(fontSize: 14, color: Color(0xFFD6D6D7)), ), ), Expanded(child: Container()), Container( - width: 57, - height: 32, + width: w57, + height: w57, alignment: Alignment.center, - margin: EdgeInsets.only(left: 13), + margin: const EdgeInsets.only(left: 13), decoration: BoxDecoration( - color: Color(0xFF074CE7), - borderRadius: BorderRadius.all(Radius.circular(18)), + color: const Color(0xFF074CE7), + borderRadius: BorderRadius.all(Radius.circular(t18)), ), child: Text( '打开', diff --git a/lib/tools/home/home_recommend_page.dart b/lib/tools/home/home_recommend_page.dart index b8cab44..2fd0fdf 100644 --- a/lib/tools/home/home_recommend_page.dart +++ b/lib/tools/home/home_recommend_page.dart @@ -23,27 +23,42 @@ class _HomeRecommendState extends State { _recommendItem(context) { final size = MediaQuery.of(context).size; + + final l15 = size.width / 24; + final t30 = size.width / 12; + final s16 = size.width / 22.5; + final h170 = size.width / 2.1176470588235; + final t20 = size.width / 18; + final h180 = size.width / 2; + final w99 = size.width / 3.6363636363636; + final h140 = size.width / 2.5714285714285; + final h125 = size.width / 2.88; + final w57 = size.width / 6.3157894736842; + final w75 = size.width / 4.8; + final h29 = size.width / 12.413793103448; + final c18 = size.width / 20; + switch (widget.homeInfoBean.categoryType) { case "Popular": return Column( children: [ Container( alignment: Alignment.centerLeft, - margin: EdgeInsets.only(left: 15, top: 30), + margin: EdgeInsets.only(left: l15, top: t30), child: Text( "${widget.homeInfoBean.categoryName}", - style: TextStyle(color: Color(0xFFD6D6D7), fontSize: 16), + style: TextStyle(color: const Color(0xFFD6D6D7), fontSize: s16), ), ), Container( width: size.width, - height: 170, - margin: EdgeInsets.only(top: 20), + height: h170, + margin: EdgeInsets.only(top: t20), child: ListView.builder( padding: EdgeInsets.zero, itemCount: widget.homeInfoBean.epgList?.length, itemBuilder: (BuildContext context, int index) { - return _item(index, widget.homeInfoBean.epgList![index]); + return _item(index, widget.homeInfoBean.epgList![index], context); }, scrollDirection: Axis.horizontal, ), @@ -57,16 +72,16 @@ class _HomeRecommendState extends State { children: [ Container( alignment: Alignment.centerLeft, - margin: EdgeInsets.only(left: 15, top: 30), + margin: EdgeInsets.only(left: l15, top: t30), child: Text( "${widget.homeInfoBean.categoryName}", - style: TextStyle(color: Color(0xFFD6D6D7), fontSize: 16), + style: const TextStyle(color: Color(0xFFD6D6D7), fontSize: 16), ), ), Container( width: size.width, - height: 180, - margin: EdgeInsets.only(left: 15, right: 15), + height: h180, + margin: EdgeInsets.only(left: l15, right: l15), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ @@ -75,16 +90,16 @@ class _HomeRecommendState extends State { _jumpToPage(widget.homeInfoBean.epgList?[0]); }, child: SizedBox( - width: 99, - height: 140, + width: w99, + height: h140, child: Stack( alignment: Alignment.center, children: [ Positioned( bottom: 0, child: Container( - width: 99, - height: 125, + width: w99, + height: h125, decoration: const BoxDecoration( borderRadius: BorderRadius.all(Radius.circular(11)), gradient: LinearGradient( @@ -100,28 +115,28 @@ class _HomeRecommendState extends State { Column( children: [ CachedNetworkImage( - width: 57, - height: 57, + width: w57, + height: w57, imageUrl: '${widget.homeInfoBean.epgList?[0].imageUrl}', errorWidget: (context, url, error) => const Icon(Icons.error), ), Container( - margin: EdgeInsets.only(top: 9), + margin: const EdgeInsets.only(top: 9), child: Text( "${widget.homeInfoBean.epgList?[0].title}", - style: TextStyle(fontSize: 13, color: Colors.white), + style: const TextStyle(fontSize: 13, color: Colors.white), ), ), Container( - width: 75, - height: 29, - margin: EdgeInsets.only(top: 10), + width: w75, + height: h29, + margin: const EdgeInsets.only(top: 10), alignment: Alignment.center, decoration: BoxDecoration( color: Colors.white, - borderRadius: BorderRadius.all(Radius.circular(18)), + borderRadius: BorderRadius.all(Radius.circular(c18)), ), - child: Text( + child: const Text( "打开", style: TextStyle(fontSize: 13, color: Color(0xFFFA9D59)), ), @@ -137,17 +152,17 @@ class _HomeRecommendState extends State { _jumpToPage(widget.homeInfoBean.epgList?[1]); }, child: SizedBox( - width: 99, - height: 140, + width: w99, + height: h140, child: Stack( alignment: Alignment.center, children: [ Positioned( bottom: 0, child: Container( - width: 99, - height: 125, - decoration: BoxDecoration( + width: w99, + height: h125, + decoration: const BoxDecoration( borderRadius: BorderRadius.all(Radius.circular(11)), gradient: LinearGradient( begin: Alignment.topCenter, @@ -162,28 +177,28 @@ class _HomeRecommendState extends State { Column( children: [ CachedNetworkImage( - width: 57, - height: 57, + width: w57, + height: w57, imageUrl: '${widget.homeInfoBean.epgList?[1].imageUrl}', errorWidget: (context, url, error) => const Icon(Icons.error), ), Container( - margin: EdgeInsets.only(top: 9), + margin: const EdgeInsets.only(top: 9), child: Text( "${widget.homeInfoBean.epgList?[1].title}", - style: TextStyle(fontSize: 13, color: Colors.white), + style: const TextStyle(fontSize: 13, color: Colors.white), ), ), Container( - width: 75, - height: 29, - margin: EdgeInsets.only(top: 10), + width: w75, + height: h29, + margin: const EdgeInsets.only(top: 10), alignment: Alignment.center, decoration: BoxDecoration( color: Colors.white, - borderRadius: BorderRadius.all(Radius.circular(18)), + borderRadius: BorderRadius.all(Radius.circular(c18)), ), - child: Text( + child: const Text( "打开", style: TextStyle(fontSize: 13, color: Color(0xFF3CAF81)), ), @@ -199,17 +214,17 @@ class _HomeRecommendState extends State { _jumpToPage(widget.homeInfoBean.epgList?[2]); }, child: SizedBox( - width: 99, - height: 140, + width: w99, + height: h140, child: Stack( alignment: Alignment.center, children: [ Positioned( bottom: 0, child: Container( - width: 99, - height: 125, - decoration: BoxDecoration( + width: w99, + height: h125, + decoration: const BoxDecoration( borderRadius: BorderRadius.all(Radius.circular(11)), gradient: LinearGradient( begin: Alignment.topCenter, @@ -224,28 +239,28 @@ class _HomeRecommendState extends State { Column( children: [ CachedNetworkImage( - width: 57, - height: 57, + width: w57, + height: w57, imageUrl: '${widget.homeInfoBean.epgList?[2].imageUrl}', errorWidget: (context, url, error) => const Icon(Icons.error), ), Container( - margin: EdgeInsets.only(top: 9), + margin: const EdgeInsets.only(top: 9), child: Text( "${widget.homeInfoBean.epgList?[2].title}", - style: TextStyle(fontSize: 13, color: Colors.white), + style: const TextStyle(fontSize: 13, color: Colors.white), ), ), Container( - width: 75, - height: 29, - margin: EdgeInsets.only(top: 10), + width: w75, + height: h29, + margin: const EdgeInsets.only(top: 10), alignment: Alignment.center, decoration: BoxDecoration( color: Colors.white, - borderRadius: BorderRadius.all(Radius.circular(18)), + borderRadius: BorderRadius.all(Radius.circular(c18)), ), - child: Text( + child: const Text( "打开", style: TextStyle(fontSize: 13, color: Color(0xFF1383FF)), ), @@ -268,16 +283,16 @@ class _HomeRecommendState extends State { children: [ Container( alignment: Alignment.centerLeft, - margin: EdgeInsets.only(left: 15, top: 30), + margin: EdgeInsets.only(left: l15, top: t30), child: Text( "${widget.homeInfoBean.categoryName}", - style: TextStyle(color: Color(0xFFD6D6D7), fontSize: 16), + style: TextStyle(color: const Color(0xFFD6D6D7), fontSize: s16), ), ), SizedBox( width: size.width, child: Column( - children: _mustPlayItem(), + children: _mustPlayItem(context), ), ), ], @@ -288,27 +303,27 @@ class _HomeRecommendState extends State { children: [ Container( alignment: Alignment.centerLeft, - margin: EdgeInsets.only(left: 15, top: 30), + margin: EdgeInsets.only(left: l15, top: t30), child: Text( "${widget.homeInfoBean.categoryName}", - style: TextStyle(color: Color(0xFFD6D6D7), fontSize: 16), + style: TextStyle(color: const Color(0xFFD6D6D7), fontSize: s16), ), ), Container( - margin: EdgeInsets.only(top: 20, left: 15, right: 15), + margin: EdgeInsets.only(top: t20, left: l15, right: l15), child: GridView.builder( padding: EdgeInsets.zero, shrinkWrap: true, itemCount: widget.homeInfoBean.epgList!.length, - gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( + gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount( crossAxisCount: 3, // 两列 mainAxisSpacing: 18.0, crossAxisSpacing: 10.0, childAspectRatio: 0.495, ), - physics: NeverScrollableScrollPhysics(), + physics: const NeverScrollableScrollPhysics(), itemBuilder: (context, index) { - return _fightingItem(index, widget.homeInfoBean.epgList![index]); + return _fightingItem(index, widget.homeInfoBean.epgList![index], context); }), ), ], @@ -319,27 +334,27 @@ class _HomeRecommendState extends State { children: [ Container( alignment: Alignment.centerLeft, - margin: EdgeInsets.only(left: 15, top: 30), + margin: EdgeInsets.only(left: l15, top: t30), child: Text( "${widget.homeInfoBean.categoryName}", - style: TextStyle(color: Color(0xFFD6D6D7), fontSize: 16), + style: TextStyle(color: const Color(0xFFD6D6D7), fontSize: s16), ), ), Container( - margin: EdgeInsets.only(top: 20, left: 15, right: 15), + margin: EdgeInsets.only(top: t20, left: l15, right: l15), child: GridView.builder( padding: EdgeInsets.zero, shrinkWrap: true, itemCount: widget.homeInfoBean.epgList!.length, - gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( + gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount( crossAxisCount: 2, // 两列 mainAxisSpacing: 18.0, crossAxisSpacing: 10.0, childAspectRatio: 0.98125, ), - physics: NeverScrollableScrollPhysics(), + physics: const NeverScrollableScrollPhysics(), itemBuilder: (context, index) { - return _gameSeriesItem(index, widget.homeInfoBean.epgList![index]); + return _gameSeriesItem(index, widget.homeInfoBean.epgList![index], context); }), ), ], @@ -350,22 +365,22 @@ class _HomeRecommendState extends State { children: [ Container( alignment: Alignment.centerLeft, - margin: EdgeInsets.only(left: 15, top: 30), + margin: EdgeInsets.only(left: l15, top: t30), child: Text( "${widget.homeInfoBean.categoryName}", - style: TextStyle(color: Color(0xFFD6D6D7), fontSize: 16), + style: TextStyle(color: const Color(0xFFD6D6D7), fontSize: s16), ), ), Container( width: size.width, - margin: EdgeInsets.only(left: 15, right: 15), + margin: EdgeInsets.only(left: l15, right: l15), child: ListView.builder( padding: EdgeInsets.zero, shrinkWrap: true, itemCount: widget.homeInfoBean.epgList!.length, - physics: NeverScrollableScrollPhysics(), + physics: const NeverScrollableScrollPhysics(), itemBuilder: (context, index) { - return _sportsItem(index, widget.homeInfoBean.epgList![index]); + return _sportsItem(index, widget.homeInfoBean.epgList![index], context); }), ), ], @@ -377,22 +392,22 @@ class _HomeRecommendState extends State { children: [ Container( alignment: Alignment.centerLeft, - margin: EdgeInsets.only(left: 15, top: 30), + margin: EdgeInsets.only(left: l15, top: t30), child: Text( "${widget.homeInfoBean.categoryName}", - style: TextStyle(color: Color(0xFFD6D6D7), fontSize: 16), + style: TextStyle(color: const Color(0xFFD6D6D7), fontSize: s16), ), ), Container( width: size.width, - margin: EdgeInsets.only(left: 15, right: 15), + margin: EdgeInsets.only(left: l15, right: l15), child: ListView.builder( padding: EdgeInsets.zero, shrinkWrap: true, itemCount: widget.homeInfoBean.epgList!.length, - physics: NeverScrollableScrollPhysics(), + physics: const NeverScrollableScrollPhysics(), itemBuilder: (context, index) { - return _activityItem(index, widget.homeInfoBean.epgList![index]); + return _activityItem(index, widget.homeInfoBean.epgList![index], context); }), ), ], @@ -401,42 +416,49 @@ class _HomeRecommendState extends State { } } - _item(index, EpgBean data) { + _item(index, EpgBean data, context) { + final size = MediaQuery.of(context).size; + final w90 = size.width / 4; + final w75 = size.width / 4.8; + final h32 = size.width / 11.25; + final c18 = size.width / 20; + final l15 = size.width / 24; + return GestureDetector( onTap: () { _jumpToPage(data); }, child: Container( - margin: EdgeInsets.only(left: index == 0 ? 0 : 18), - padding: EdgeInsets.only(left: index == 0 ? 15 : 0), + margin: EdgeInsets.only(left: index == 0 ? 0 : c18), + padding: EdgeInsets.only(left: index == 0 ? l15 : 0), child: Column( children: [ CachedNetworkImage( - width: 90, - height: 90, + width: w90, + height: w90, imageUrl: '${data.imageUrl}', errorWidget: (context, url, error) => const Icon(Icons.error), ), Container( - margin: EdgeInsets.only(top: 11), + margin: const EdgeInsets.only(top: 11), child: Text( "${data.title}", - style: TextStyle(fontSize: 14, color: Color(0xFF909090)), + style: const TextStyle(fontSize: 14, color: Color(0xFF909090)), ), ), Container( - width: 75, - height: 32, + width: w75, + height: h32, alignment: Alignment.center, - margin: EdgeInsets.only(top: 11), - child: Text( + margin: const EdgeInsets.only(top: 11), + decoration: BoxDecoration( + color: const Color(0xFF074CE7), + borderRadius: BorderRadius.all(Radius.circular(c18)), + ), + child: const Text( "打开", style: TextStyle(fontSize: 13, color: Colors.white), ), - decoration: BoxDecoration( - color: Color(0xFF074CE7), - borderRadius: BorderRadius.all(Radius.circular(18)), - ), ), ], ), @@ -444,7 +466,24 @@ class _HomeRecommendState extends State { ); } - _mustPlayItem() { + _mustPlayItem(context) { + final size = MediaQuery.of(context).size; + final h140 = size.width / 2.5714285714285; + final t18 = size.width / 20; + final l15 = size.width / 24; + final w331 = size.width / 1.0876132930513; + final h122 = size.width / 2.9508196721311; + final l133 = size.width / 2.7067669172932; + final t34 = size.width / 10.588235294117; + final w160 = size.width / 2.25; + final s16 = size.width / 22.5; + final w133 = size.width / 2.7067669172932; + final h67 = size.width / 5.3731343283582; + final r18 = size.width / 20; + final s21 = size.width / 17.142857142857; + final w99 = size.width / 3.6363636363636; + final h125 = size.width / 2.88; + return List.generate( widget.homeInfoBean.epgList!.length, (index) => GestureDetector( @@ -452,16 +491,16 @@ class _HomeRecommendState extends State { _jumpToPage(widget.homeInfoBean.epgList![index]); }, child: Container( - height: 140, - margin: EdgeInsets.only(top: 18, left: 15, right: 15), + height: h140, + margin: EdgeInsets.only(top: t18, left: l15, right: l15), child: Stack( children: [ Positioned( bottom: 0, child: Container( - width: 331, - height: 122, - decoration: BoxDecoration( + width: w331, + height: h122, + decoration: const BoxDecoration( color: Color(0xFF202530), borderRadius: BorderRadius.all(Radius.circular(11)), ), @@ -469,42 +508,42 @@ class _HomeRecommendState extends State { alignment: Alignment.center, children: [ Positioned( - left: 133, - top: 34, + left: l133, + top: t34, child: SizedBox( - width: 160, + width: w160, child: Text( "${widget.homeInfoBean.epgList?[index].title}", overflow: TextOverflow.ellipsis, - style: TextStyle(fontSize: 16, color: Color(0xFFD6D6D7)), + style: TextStyle(fontSize: s16, color: const Color(0xFFD6D6D7)), ), )), Positioned( - left: 133, - top: 67, + left: w133, + top: h67, child: SizedBox( - width: 160, + width: w160, child: Text( "${widget.homeInfoBean.epgList?[index].subTitle}", overflow: TextOverflow.ellipsis, - style: TextStyle(fontSize: 13, color: Color(0xFFA6A6A6)), + style: const TextStyle(fontSize: 13, color: Color(0xFFA6A6A6)), ), )), Positioned( - right: 18, + right: r18, child: Text( "${widget.homeInfoBean.epgList?[index].score}", - style: TextStyle(fontSize: 21, color: Color(0xFFD6AF4A)), + style: TextStyle(fontSize: s21, color: const Color(0xFFD6AF4A)), )), ], ), )), Positioned( top: 0, - left: 18, + left: r18, child: CachedNetworkImage( - width: 99, - height: 125, + width: w99, + height: h125, imageUrl: '${widget.homeInfoBean.epgList?[index].imageUrl}', errorWidget: (context, url, error) => const Icon(Icons.error), ), @@ -516,7 +555,13 @@ class _HomeRecommendState extends State { ).toList(); } - _fightingItem(index, EpgBean data) { + _fightingItem(index, EpgBean data, context) { + final size = MediaQuery.of(context).size; + final w99 = size.width / 3.636363636363636; + final h125 = size.width / 2.88; + final w75 = size.width / 4.8; + final h32 = size.width / 11.25; + final r18 = size.width / 20; return GestureDetector( onTap: () { _jumpToPage(data); @@ -524,28 +569,28 @@ class _HomeRecommendState extends State { child: Column( children: [ CachedNetworkImage( - width: 99, - height: 125, + width: w99, + height: h125, imageUrl: '${data.imageUrl}', errorWidget: (context, url, error) => const Icon(Icons.error), ), Container( - width: 99, + width: w99, alignment: Alignment.center, - margin: EdgeInsets.only(top: 11), + margin: const EdgeInsets.only(top: 11), child: Text( '${data.title}', overflow: TextOverflow.ellipsis, - style: TextStyle(fontSize: 14, color: Color(0xFF909090)), + style: const TextStyle(fontSize: 14, color: Color(0xFF909090)), ), ), Container( - width: 75, - height: 32, - margin: EdgeInsets.only(top: 11), + width: w75, + height: h32, + margin: const EdgeInsets.only(top: 11), alignment: Alignment.center, - decoration: BoxDecoration(color: Color(0xFF074CE7), borderRadius: BorderRadius.all(Radius.circular(18))), - child: Text( + decoration: BoxDecoration(color: const Color(0xFF074CE7), borderRadius: BorderRadius.all(Radius.circular(r18))), + child: const Text( "打开", style: TextStyle(fontSize: 13, color: Colors.white), ), @@ -555,7 +600,10 @@ class _HomeRecommendState extends State { ); } - _gameSeriesItem(index, EpgBean data) { + _gameSeriesItem(index, EpgBean data, context) { + final size = MediaQuery.of(context).size; + final w157 = size.width / 2.292993630573248; + final h125 = size.width / 2.88; return GestureDetector( onTap: () { _jumpToPage(data); @@ -563,19 +611,19 @@ class _HomeRecommendState extends State { child: Column( children: [ CachedNetworkImage( - width: 157, - height: 125, + width: w157, + height: h125, imageUrl: '${data.imageUrl}', errorWidget: (context, url, error) => const Icon(Icons.error), ), Container( - width: 157, + width: w157, alignment: Alignment.center, - margin: EdgeInsets.only(top: 11), + margin: const EdgeInsets.only(top: 11), child: Text( '${data.title}', overflow: TextOverflow.ellipsis, - style: TextStyle(fontSize: 14, color: Color(0xFF909090)), + style: const TextStyle(fontSize: 14, color: Color(0xFF909090)), ), ), ], @@ -583,42 +631,51 @@ class _HomeRecommendState extends State { ); } - _sportsItem(index, EpgBean data) { + _sportsItem(index, EpgBean data, context) { + final size = MediaQuery.of(context).size; + final h70 = size.width / 5.142857142857143; + final w68 = size.width / 5.294117647058824; + final t18 = size.width / 20; + final l83 = size.width / 4.337349397590361; + final w150 = size.width / 2.4; + final w75 = size.width / 4.8; + final h32 = size.width / 11.25; + final c18 = size.width / 20; return GestureDetector( onTap: () { _jumpToPage(data); }, child: Container( - height: 70, - margin: EdgeInsets.only(top: 18), + height: h70, + margin: EdgeInsets.only(top: t18), child: Stack( alignment: Alignment.center, children: [ Positioned( left: 0, child: CachedNetworkImage( - width: 68, - height: 68, + width: w68, + height: w68, imageUrl: '${data.imageUrl}', errorWidget: (context, url, error) => const Icon(Icons.error), ), ), Positioned( top: 11, - left: 83, + left: l83, child: SizedBox( - width: 150, + width: w150, child: Text( "${data.title}", - style: TextStyle(fontSize: 14, color: Color(0xFFD6D6D7)), + style: const TextStyle(fontSize: 14, color: Color(0xFFD6D6D7)), ), ), ), Positioned( bottom: 10, - left: 83, + left: l83, child: SizedBox( - width: 150, + width: w150, child: Text( "${data.subTitle}", overflow: TextOverflow.ellipsis, @@ -629,14 +686,14 @@ class _HomeRecommendState extends State { Positioned( right: 0, child: Container( - width: 75, - height: 32, + width: w75, + height: h32, alignment: Alignment.center, decoration: BoxDecoration( - color: Color(0xFF074CE7), - borderRadius: BorderRadius.all(Radius.circular(18)), + color: const Color(0xFF074CE7), + borderRadius: BorderRadius.all(Radius.circular(c18)), ), - child: Text( + child: const Text( "打开", style: TextStyle(fontSize: 13, color: Colors.white), ), @@ -647,41 +704,49 @@ class _HomeRecommendState extends State { ); } - _activityItem(index, EpgBean data) { + _activityItem(index, EpgBean data, context) { + final size = MediaQuery.of(context).size; + final h206 = size.width / 1.747572815533981; + final t18 = size.width / 20; + final w331 = size.width / 1.08761329305136; + final h137 = size.width / 2.627737226277372; + final w313 = size.width / 1.150159744408946; + final b38 = size.width / 9.473684210526316; + final w150 = size.width / 2.4; return GestureDetector( onTap: () { _jumpToPage(data); }, child: Container( - height: 206, - margin: EdgeInsets.only(top: 18), + height: h206, + margin: EdgeInsets.only(top: t18), child: Stack( alignment: Alignment.center, children: [ Positioned( bottom: 0, child: Container( - width: 331, - height: 137, - decoration: BoxDecoration(color: Color(0xFF202530), borderRadius: BorderRadius.all(Radius.circular(11))), + width: w331, + height: h137, + decoration: const BoxDecoration(color: Color(0xFF202530), borderRadius: BorderRadius.all(Radius.circular(11))), )), Positioned( top: 0, child: CachedNetworkImage( - width: 313, - height: 137, + width: w313, + height: h137, imageUrl: '${data.imageUrl}', errorWidget: (context, url, error) => const Icon(Icons.error), ), ), Positioned( - bottom: 38, + bottom: b38, left: 10, child: SizedBox( - width: 150, + width: w150, child: Text( "${data.title}", - style: TextStyle(fontSize: 14, color: Color(0xFFD6D6D7)), + style: const TextStyle(fontSize: 14, color: Color(0xFFD6D6D7)), ), ), ), @@ -689,10 +754,10 @@ class _HomeRecommendState extends State { bottom: 10, left: 10, child: SizedBox( - width: 150, + width: w150, child: Text( "${data.subTitle}", - style: TextStyle(fontSize: 13, color: Color(0xFFA6A6A6)), + style: const TextStyle(fontSize: 13, color: Color(0xFFA6A6A6)), ), ), ), diff --git a/lib/tools/home/message/message_center_page.dart b/lib/tools/home/message/message_center_page.dart index e226c68..d96897c 100644 --- a/lib/tools/home/message/message_center_page.dart +++ b/lib/tools/home/message/message_center_page.dart @@ -49,31 +49,38 @@ class _MessageCenterPageState extends State { @override Widget build(BuildContext context) { final size = MediaQuery.of(context).size; + final h50 = size.width / 7.2; + final s16 = size.width / 22.5; + final l14 = size.width / 25.714285714285; + final w19 = size.width / 18.947368421052; + final h26 = size.width / 13.846153846153; + final t20 = size.width / 18; + return Scaffold( backgroundColor: const Color(0xFF17181A), body: Column( children: [ Container( width: size.width, - height: 50, + height: h50, margin: EdgeInsets.only(top: MediaQuery.of(context).padding.top), child: Stack( alignment: Alignment.center, children: [ Text( "消息中心", - style: TextStyle(fontSize: 16, color: Color(0xFFD6D6D7)), + style: TextStyle(fontSize: s16, color: Color(0xFFD6D6D7)), ), Positioned( - left: 14, + left: l14, child: GestureDetector( onTap: () { Navigator.pop(context); }, child: Image( - width: 19, - height: 26, - image: AssetImage('assets/images/btn_fanhui.png'), + width: w19, + height: h26, + image: const AssetImage('assets/images/btn_fanhui.png'), ), ), ) @@ -82,12 +89,12 @@ class _MessageCenterPageState extends State { ), Expanded( child: Container( - margin: EdgeInsets.only(left: 14, right: 14, bottom: 20), + margin: EdgeInsets.only(left: l14, right: l14, bottom: t20), child: ListView.builder( padding: EdgeInsets.zero, itemCount: messageList.length, itemBuilder: (context, index) { - return _item(messageList[index]); + return _item(messageList[index], context); }), )) ], @@ -95,7 +102,18 @@ class _MessageCenterPageState extends State { ); } - _item(MessageBean data) { + _item(MessageBean data, context) { + final size = MediaQuery.of(context).size; + final h73 = size.width / 4.931506849315; + final t18 = size.width / 20; + final w45 = size.width / 8; + final l64 = size.width / 5.625; + final t17 = size.width / 21.176470588235; + final s14 = size.width / 25.714285714285; + final w200 = size.width / 1.8; + final t22 = size.width / 16.363636363636; + final t47 = size.width / 7.6595744680851; + return GestureDetector( onTap: () { Navigator.push( @@ -111,56 +129,56 @@ class _MessageCenterPageState extends State { }); }, child: Container( - height: 73, - margin: EdgeInsets.only(top: 18), - decoration: BoxDecoration(color: Color(0xFF202530), borderRadius: BorderRadius.all(Radius.circular(11))), + height: h73, + margin: EdgeInsets.only(top: t18), + decoration: const BoxDecoration(color: Color(0xFF202530), borderRadius: BorderRadius.all(Radius.circular(11))), child: Stack( alignment: Alignment.center, children: [ Positioned( left: 11, child: Image( - width: 45, - height: 45, + width: w45, + height: w45, image: AssetImage('assets/images/ic_system.png'), ), ), Positioned( - left: 64, - top: 17, + left: l64, + top: t17, child: Text( "${data.title}", - style: TextStyle(fontSize: 14, color: Color(0xFFD6D6D7)), + style: TextStyle(fontSize: s14, color: Color(0xFFD6D6D7)), ), ), Positioned( - left: 64, - top: 45, + left: l64, + top: w45, child: SizedBox( - width: 200, + width: w200, child: Text( "${data.content}", overflow: TextOverflow.ellipsis, - style: TextStyle(fontSize: 11, color: Color(0xFF939394)), + style: const TextStyle(fontSize: 11, color: Color(0xFF939394)), ), ), ), Positioned( right: 11, - top: 22, + top: t22, child: Text( "${data.sendDateTime}", - style: TextStyle(fontSize: 11, color: Color(0xFF939394)), + style: const TextStyle(fontSize: 11, color: Color(0xFF939394)), ), ), Positioned( right: 11, - top: 47, + top: t47, child: !data.isRead! ? Container( width: 7, height: 7, - decoration: BoxDecoration(color: Colors.red, borderRadius: BorderRadius.all(Radius.circular(10))), + 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 ed6a622..ea8cb82 100644 --- a/lib/tools/home/message/message_details_page.dart +++ b/lib/tools/home/message/message_details_page.dart @@ -49,27 +49,34 @@ class _MessageDetailsPageState extends State { @override Widget build(BuildContext context) { final size = MediaQuery.of(context).size; + final h50 = size.width / 7.2; + final l14 = size.width / 25.714285714285; + final w19 = size.width / 18.947368421052; + final h26 = size.width / 13.846153846153; + final t20 = size.width / 18; + final t18 = size.width / 20; + return Scaffold( backgroundColor: const Color(0xFF17181A), body: Column( children: [ Container( width: size.width, - height: 50, + height: h50, margin: EdgeInsets.only(top: MediaQuery.of(context).padding.top), child: Stack( alignment: Alignment.center, children: [ Positioned( - left: 14, + left: l14, child: GestureDetector( onTap: () { Navigator.pop(context); }, child: Image( - width: 19, - height: 26, - image: AssetImage('assets/images/btn_fanhui.png'), + width: w19, + height: h26, + image: const AssetImage('assets/images/btn_fanhui.png'), ), ), ) @@ -78,26 +85,26 @@ class _MessageDetailsPageState extends State { ), Container( alignment: Alignment.centerLeft, - margin: EdgeInsets.only(left: 14, top: 20), + margin: EdgeInsets.only(left: l14, top: t20), child: Text( - "${widget.title}", - style: TextStyle(fontSize: 14, color: Color(0xFFD6D6D7)), + widget.title, + style: TextStyle(fontSize: l14, color: const Color(0xFFD6D6D7)), ), ), Container( alignment: Alignment.centerLeft, - margin: EdgeInsets.only(left: 14, top: 7), + margin: EdgeInsets.only(left: l14, top: 7), child: Text( "${messageBean.sendDateTime}", - style: TextStyle(fontSize: 9, color: Color(0xFF626262)), + style: const TextStyle(fontSize: 9, color: Color(0xFF626262)), ), ), Container( alignment: Alignment.centerLeft, - margin: EdgeInsets.only(left: 14, top: 18), + margin: EdgeInsets.only(left: l14, top: t18), child: Text( "${messageBean.content}", - style: TextStyle(fontSize: 13, color: Color(0xFF939394)), + style: const TextStyle(fontSize: 13, color: Color(0xFF939394)), ), ), ], diff --git a/lib/tools/home/my_home_page.dart b/lib/tools/home/my_home_page.dart index 358f805..2d743ef 100644 --- a/lib/tools/home/my_home_page.dart +++ b/lib/tools/home/my_home_page.dart @@ -113,9 +113,24 @@ class _MyHomePageState extends State { @override Widget build(BuildContext context) { final size = MediaQuery.of(context).size; + final h387 = size.width / 0.9302325581395; + final h88 = size.width / 4.090909090909091; + final l15 = size.width / 24; + final s21 = size.width / 17.14285714285714; + final b21 = size.width / 17.14285714285714; + final r14 = size.width / 25.71428571428571; + final h50 = size.width / 7.2; + final w166 = size.width / 2.168674698795181; + final h45 = size.width / 8; + final h40 = size.width / 9; + final c19 = size.width / 18.94736842105263; + final h36 = size.width / 10; + final w16 = size.width / 22.5; + final l25 = size.width / 14.4; + final l17 = size.width / 21.17647058823529; return Scaffold( - backgroundColor: Color(0xFF17181A), + backgroundColor: const Color(0xFF17181A), body: Stack( children: [ SingleChildScrollView( @@ -123,24 +138,22 @@ class _MyHomePageState extends State { children: [ Container( width: size.width, - height: 387, + height: h387, color: const Color(0xFFA4A4A4), child: Stack( children: [ ///banner - Container( - child: CarouselSlider( - options: CarouselOptions( - height: 387, - autoPlay: true, - viewportFraction: 1, - onPageChanged: (index, _) { - setState(() { - currentBannerIndex = index; - }); - }), - items: _bannerItem(), - ), + CarouselSlider( + options: CarouselOptions( + height: h387, + autoPlay: true, + viewportFraction: 1, + onPageChanged: (index, _) { + setState(() { + currentBannerIndex = index; + }); + }), + items: _bannerItem(h387), ), ///banner标题 @@ -148,7 +161,7 @@ class _MyHomePageState extends State { bottom: 0, child: Container( width: size.width, - height: 88, + height: h88, decoration: const BoxDecoration( gradient: LinearGradient( begin: Alignment.topCenter, @@ -162,38 +175,38 @@ class _MyHomePageState extends State { child: Stack( children: [ Positioned( - left: 15, + left: l15, top: 13, child: bannerList.isNotEmpty ? Text( "${bannerList[currentBannerIndex].title}", - style: TextStyle(color: Colors.white, fontSize: 21), + style: TextStyle(color: Colors.white, fontSize: s21), ) : Container()), Positioned( - left: 15, - bottom: 21, + left: l15, + bottom: b21, child: bannerList.isNotEmpty ? Text( "${bannerList[currentBannerIndex].subTitle}", - style: TextStyle(color: Colors.white, fontSize: 13), + style: const TextStyle(color: Colors.white, fontSize: 13), ) : Container()), ///banner指示器 Positioned( top: 9, - right: 14, + right: r14, child: Row( children: List.generate( bannerList.length, (index) => Container( width: 4, height: 4, - margin: EdgeInsets.only(left: 7), + margin: const EdgeInsets.only(left: 7), decoration: BoxDecoration( color: Color(currentBannerIndex == index ? 0xFFFFFFFF : 0x99FFFFFF), - borderRadius: BorderRadius.all(Radius.circular(10))), + borderRadius: const BorderRadius.all(Radius.circular(10))), )), )) ], @@ -206,8 +219,8 @@ class _MyHomePageState extends State { ///推荐 - 游玩历史 Container( width: size.width, - height: 50, - margin: EdgeInsets.only(left: 14, right: 14), + height: h50, + margin: EdgeInsets.only(left: r14, right: r14), child: Row( children: [ GestureDetector( @@ -217,31 +230,31 @@ class _MyHomePageState extends State { }); }, child: Container( - width: 166, - height: 45, + width: w166, + height: h45, alignment: Alignment.center, decoration: BoxDecoration( color: Color(pageIndex == 0 ? 0xFF0C0C0C : 0xFF17181A), border: Border.all(color: Color(pageIndex == 0 ? 0xFF9C9C9C : 0xFF17181A), width: 1), - borderRadius: BorderRadius.all(Radius.circular(4))), + borderRadius: const BorderRadius.all(Radius.circular(4))), child: ShaderMask( shaderCallback: (Rect bounds) { return LinearGradient( colors: pageIndex == 0 ? [ - Color(0xFF22F1F5), - Color(0xFF22F1F5), - Color(0xFF7A6EFA), - Color(0xFF7A6EFA), + const Color(0xFF22F1F5), + const Color(0xFF22F1F5), + const Color(0xFF7A6EFA), + const Color(0xFF7A6EFA), ] : [ - Color(0xFF909090), - Color(0xFF909090), + const Color(0xFF909090), + const Color(0xFF909090), ], ).createShader(bounds); }, blendMode: BlendMode.srcATop, - child: Text( + child: const Text( '推荐', style: TextStyle(fontSize: 14), ), @@ -255,31 +268,31 @@ class _MyHomePageState extends State { }); }, child: Container( - width: 166, - height: 45, + width: w166, + height: h45, alignment: Alignment.center, decoration: BoxDecoration( color: Color(pageIndex == 1 ? 0xFF0C0C0C : 0xFF17181A), border: Border.all(color: Color(pageIndex == 1 ? 0xFF9C9C9C : 0xFF17181A), width: 1), - borderRadius: BorderRadius.all(Radius.circular(4))), + borderRadius: const BorderRadius.all(Radius.circular(4))), child: ShaderMask( shaderCallback: (Rect bounds) { return LinearGradient( colors: pageIndex == 1 ? [ - Color(0xFF22F1F5), - Color(0xFF22F1F5), - Color(0xFF7A6EFA), - Color(0xFF7A6EFA), + const Color(0xFF22F1F5), + const Color(0xFF22F1F5), + const Color(0xFF7A6EFA), + const Color(0xFF7A6EFA), ] : [ - Color(0xFF909090), - Color(0xFF909090), + const Color(0xFF909090), + const Color(0xFF909090), ], ).createShader(bounds); }, blendMode: BlendMode.srcATop, - child: Text( + child: const Text( '游戏排行', style: TextStyle(fontSize: 14), ), @@ -308,7 +321,7 @@ class _MyHomePageState extends State { top: MediaQuery.of(context).padding.top, child: SizedBox( width: size.width, - height: 40, + height: h40, child: Row( crossAxisAlignment: CrossAxisAlignment.center, children: [ @@ -319,23 +332,23 @@ class _MyHomePageState extends State { Navigator.pushNamed(context, "/SearchPage"); }, child: Container( - margin: EdgeInsets.only(left: 14), + margin: const EdgeInsets.only(left: 14), child: ClipRRect( - borderRadius: BorderRadius.circular(19.0), + borderRadius: BorderRadius.circular(c19), child: BackdropFilter( filter: ImageFilter.blur( sigmaX: 5, sigmaY: 5, ), child: Container( - height: 36, + height: h36, alignment: Alignment.centerLeft, - padding: EdgeInsets.only(left: 11), - decoration: const BoxDecoration( - color: Color(0x73FFFFFF), - borderRadius: BorderRadius.all(Radius.circular(19)), + padding: const EdgeInsets.only(left: 11), + decoration: BoxDecoration( + color: const Color(0x73FFFFFF), + borderRadius: BorderRadius.all(Radius.circular(c19)), ), - child: Image(width: 16, height: 16, image: AssetImage('assets/images/ic_search.png')), + child: Image(width: w16, height: w16, image: AssetImage('assets/images/ic_search.png')), ), ), ), @@ -351,17 +364,17 @@ class _MyHomePageState extends State { }); }, child: Container( - width: 36, - height: 36, - margin: EdgeInsets.only(right: 14, left: 25), - decoration: BoxDecoration(color: Color(0x73FFFFFF), borderRadius: BorderRadius.all(Radius.circular(19))), + width: h36, + height: h36, + margin: EdgeInsets.only(right: 14, left: l25), + decoration: BoxDecoration(color: Color(0x73FFFFFF), borderRadius: BorderRadius.all(Radius.circular(c19))), child: Stack( alignment: Alignment.center, children: [ Image( - width: 17, + width: l17, height: 14, - image: AssetImage('assets/images/ic_message.png'), + image: const AssetImage('assets/images/ic_message.png'), ), Positioned( top: 8, @@ -370,7 +383,7 @@ class _MyHomePageState extends State { ? Container( width: 4, height: 4, - decoration: BoxDecoration(color: Colors.red, borderRadius: BorderRadius.all(Radius.circular(10))), + decoration: const BoxDecoration(color: Colors.red, borderRadius: BorderRadius.all(Radius.circular(10))), ) : Container()) ], @@ -385,7 +398,7 @@ class _MyHomePageState extends State { ); } - _bannerItem() { + _bannerItem(h387) { return bannerList.map((value) { return Builder(builder: (BuildContext context) { return GestureDetector( @@ -393,10 +406,10 @@ class _MyHomePageState extends State { _jumpToPage(value); }, child: SizedBox( - height: 387, + height: h387, child: CachedNetworkImage( width: MediaQuery.of(context).size.width, - height: 387, + height: h387, imageUrl: '${value.imageUrl}', errorWidget: (context, url, error) => const Icon(Icons.error), ), diff --git a/lib/tools/home/search_page.dart b/lib/tools/home/search_page.dart index 6de42e7..0330840 100644 --- a/lib/tools/home/search_page.dart +++ b/lib/tools/home/search_page.dart @@ -42,7 +42,6 @@ class _SearchPageState extends State { case "gameHotSearch": gameHotSearch = event['data']; - print("gameHotSearch == $gameHotSearch"); break; } setState(() {}); @@ -93,8 +92,17 @@ class _SearchPageState extends State { @override Widget build(BuildContext context) { final size = MediaQuery.of(context).size; + final w19 = size.width / 18.94736842105263; + final h26 = size.width / 13.84615384615385; + final h36 = size.width / 10; + final c19 = size.width / 18.94736842105263; + final w16 = size.width / 22.5; + final t18 = size.width / 20; + final w155 = size.width / 2.32258064516129; + final w57 = size.width / 6.315789473684211; + return Scaffold( - backgroundColor: Color(0xFF17181A), + backgroundColor: const Color(0xFF17181A), body: Column( children: [ Container( @@ -106,40 +114,48 @@ class _SearchPageState extends State { Navigator.pop(context); }, child: Container( - margin: EdgeInsets.symmetric(horizontal: 15), + margin: const EdgeInsets.symmetric(horizontal: 15), child: Image( - width: 19, - height: 26, - image: AssetImage('assets/images/btn_fanhui.png'), + width: w19, + height: h26, + image: const AssetImage('assets/images/btn_fanhui.png'), ), ), ), Expanded( child: Container( - height: 36, + height: h36, decoration: BoxDecoration( - color: Color(0xFF202530), - borderRadius: BorderRadius.all(Radius.circular(19)), + color: const Color(0xFF202530), + borderRadius: BorderRadius.all(Radius.circular(c19)), ), child: Row( children: [ Container( - padding: EdgeInsets.only(left: 10), - child: Image(width: 16, height: 16, image: AssetImage('assets/images/ic_search.png')), + padding: const EdgeInsets.only(left: 10), + child: Image(width: w16, height: w16, image: const AssetImage('assets/images/ic_search.png')), ), Expanded( child: Container( alignment: Alignment.center, - padding: EdgeInsets.only(left: 10, right: 10, bottom: 5), + padding: const EdgeInsets.only(left: 10, right: 10, bottom: 5), child: TextField( controller: _searchController, - style: TextStyle(fontSize: 13, color: Colors.white), - decoration: InputDecoration( + style: const TextStyle(fontSize: 13, color: Colors.white), + decoration: const InputDecoration( border: InputBorder.none, ), onChanged: _searchChanged, onSubmitted: (value) { - print("object"); + if (_searchController.text == "") { + EasyLoading.showToast("请输入内容"); + return; + } + searchHistoryList.add(_searchController.text); + saveArrayToSharedPrefs(searchHistoryList); + //搜索 + _viewModel.gameSearch(_searchController.text); + setState(() {}); }, ), ), @@ -156,11 +172,11 @@ class _SearchPageState extends State { }); }, child: Container( - padding: EdgeInsets.only(right: 10), + padding: const EdgeInsets.only(right: 10), child: Image( - width: 16, - height: 16, - image: AssetImage('assets/images/ic_clear.png'), + width: w16, + height: w16, + image: const AssetImage('assets/images/ic_clear.png'), ), ), ) @@ -181,8 +197,8 @@ class _SearchPageState extends State { setState(() {}); }, child: Container( - margin: EdgeInsets.symmetric(horizontal: 15), - child: Text( + margin: const EdgeInsets.symmetric(horizontal: 15), + child: const Text( "搜索", style: TextStyle(fontSize: 13, color: Color(0xFF626262)), ), @@ -195,37 +211,35 @@ class _SearchPageState extends State { ///搜索历史 searchList.isEmpty ? Container( - margin: EdgeInsets.only(left: 14, right: 14, top: 36), + margin: EdgeInsets.only(left: 14, right: 14, top: h36), child: Column( children: [ - Container( - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text( - "历史搜索", - style: TextStyle(fontSize: 16, color: Color(0xFFD6D6D7)), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + "历史搜索", + style: TextStyle(fontSize: w16, color: const Color(0xFFD6D6D7)), + ), + GestureDetector( + onTap: () { + searchHistoryList.clear(); + saveArrayToSharedPrefs(searchHistoryList); + setState(() {}); + }, + child: const Image( + width: 14, + height: 14, + image: AssetImage('assets/images/ic_del.png'), ), - GestureDetector( - onTap: () { - searchHistoryList.clear(); - saveArrayToSharedPrefs(searchHistoryList); - setState(() {}); - }, - child: Image( - width: 14, - height: 14, - image: AssetImage('assets/images/ic_del.png'), - ), - ), - ], - ), + ), + ], ), ///搜索历史列表 Container( width: size.width, - margin: EdgeInsets.only(top: 18), + margin: EdgeInsets.only(top: t18), child: Wrap( children: List.generate( searchHistoryList.length, @@ -237,15 +251,15 @@ class _SearchPageState extends State { isContent = false; }, child: Container( - padding: EdgeInsets.symmetric(horizontal: 13, vertical: 4), - margin: EdgeInsets.only(right: 10), - decoration: BoxDecoration( + padding: const EdgeInsets.symmetric(horizontal: 13, vertical: 4), + margin: const EdgeInsets.only(right: 10), + decoration: const BoxDecoration( color: Color(0xFF202530), borderRadius: BorderRadius.all(Radius.circular(4)), ), child: Text( searchHistoryList[index], - style: TextStyle(fontSize: 13, color: Color(0xFFB6B6B6)), + style: const TextStyle(fontSize: 13, color: Color(0xFFB6B6B6)), ), ), )), @@ -254,25 +268,25 @@ class _SearchPageState extends State { Container( alignment: Alignment.centerLeft, - margin: EdgeInsets.only(top: 36), + margin: EdgeInsets.only(top: h36), child: Text( "热门搜索", - style: TextStyle(fontSize: 16, color: Color(0xFFD6D6D7)), + style: TextStyle(fontSize: w16, color: const Color(0xFFD6D6D7)), ), ), Container( - margin: EdgeInsets.only(top: 18), + margin: EdgeInsets.only(top: t18), child: Wrap( children: List.generate( gameHotSearch.length, (index) => Container( - width: 155, - margin: EdgeInsets.only(right: 10, top: 10), + width: w155, + margin: const EdgeInsets.only(right: 10, top: 10), child: Text( "${gameHotSearch[index]}", overflow: TextOverflow.ellipsis, - style: TextStyle(fontSize: 14, color: Color(0xFF939394)), + style: const TextStyle(fontSize: 14, color: Color(0xFF939394)), ), ), ), @@ -283,12 +297,12 @@ class _SearchPageState extends State { ) : Expanded( child: Container( - margin: EdgeInsets.only(left: 14, right: 14, top: 36), + margin: EdgeInsets.only(left: 14, right: 14, top: h36), child: ListView.builder( padding: EdgeInsets.zero, itemCount: searchList.length, itemBuilder: (context, index) { - return _searchItem(searchList[index]); + return _searchItem(searchList[index], w57, t18); }), )), ], @@ -296,22 +310,22 @@ class _SearchPageState extends State { ); } - _searchItem(SearchBean data) { + _searchItem(SearchBean data, w57, t18) { return Container( - margin: EdgeInsets.only(top: 18), + margin: EdgeInsets.only(top: t18), child: Row( children: [ CachedNetworkImage( - width: 57, - height: 57, + width: w57, + height: w57, imageUrl: '${data.gameIconImage}', errorWidget: (context, url, error) => const Icon(Icons.error), ), Container( - margin: EdgeInsets.only(left: 11), + margin: const EdgeInsets.only(left: 11), child: Text( "${data.gameName}", - style: TextStyle(fontSize: 14, color: Color(0xFFD6D6D7)), + style: const TextStyle(fontSize: 14, color: Color(0xFFD6D6D7)), ), ), ], diff --git a/lib/tools/home_page.dart b/lib/tools/home_page.dart index b82d18e..ba1160c 100644 --- a/lib/tools/home_page.dart +++ b/lib/tools/home_page.dart @@ -50,6 +50,8 @@ class _HomePageState extends State with TickerProviderStateMixin { @override Widget build(BuildContext context) { + final size = MediaQuery.of(context).size; + final h74 = size.width / 4.864864864864865; return Scaffold( backgroundColor: Color(0xFF17181A), body: Stack( @@ -64,15 +66,17 @@ class _HomePageState extends State with TickerProviderStateMixin { ), bottomNavigationBar: BottomAppBar( elevation: 0, - height: 74, - color: Color(0xFF171B23), - child: bottomItem(), + height: h74, + color: const Color(0xFF171B23), + child: bottomItem(context), ), ); } ///底部导航item - bottomItem() { + bottomItem(context) { + final size = MediaQuery.of(context).size; + final w47 = size.width / 7.659574468085106; return Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, crossAxisAlignment: CrossAxisAlignment.center, @@ -85,19 +89,19 @@ class _HomePageState extends State with TickerProviderStateMixin { children: [ currentIndex == 0 ? SizedBox( - width: 47, - height: 47, + width: w47, + height: w47, child: Lottie.asset( 'assets/animation/an_home.json', repeat: false, ), ) : Container( - margin: EdgeInsets.only(top: 5), + margin: const EdgeInsets.only(top: 5), child: Image( - width: 47, - height: 47, - image: AssetImage('assets/images/ic_home.png'), + width: w47, + height: w47, + image: const AssetImage('assets/images/ic_home.png'), )) ], ), @@ -106,76 +110,70 @@ class _HomePageState extends State with TickerProviderStateMixin { onTap: () { onPageChanged(1); }, - child: Container( - child: Stack( - children: [ - currentIndex == 1 - ? SizedBox( - width: 47, - height: 47, - child: Lottie.asset( - 'assets/animation/an_game.json', - repeat: false, - ), - ) - : Container( - margin: EdgeInsets.only(top: 5), - child: Image(width: 47, height: 47, image: AssetImage('assets/images/ic_game.png')), - ) - ], - ), + child: Stack( + children: [ + currentIndex == 1 + ? SizedBox( + width: w47, + height: w47, + child: Lottie.asset( + 'assets/animation/an_game.json', + repeat: false, + ), + ) + : Container( + margin: const EdgeInsets.only(top: 5), + child: Image(width: w47, height: w47, image: const AssetImage('assets/images/ic_game.png')), + ) + ], ), ), GestureDetector( onTap: () { onPageChanged(2); }, - child: Container( - child: Stack( - children: [ - currentIndex == 2 - ? SizedBox( - width: 47, - height: 47, - child: Lottie.asset( - 'assets/animation/an_shop.json', - repeat: false, - ), - ) - : Container( - margin: EdgeInsets.only(top: 5), - child: Image(width: 47, height: 47, image: AssetImage('assets/images/ic_shop.png')), - ) - ], - ), + child: Stack( + children: [ + currentIndex == 2 + ? SizedBox( + width: w47, + height: w47, + child: Lottie.asset( + 'assets/animation/an_shop.json', + repeat: false, + ), + ) + : Container( + margin: const EdgeInsets.only(top: 5), + child: Image(width: w47, height: w47, image: const AssetImage('assets/images/ic_shop.png')), + ) + ], ), ), GestureDetector( onTap: () { onPageChanged(3); }, - child: Container( - child: Stack( - children: [ - currentIndex == 3 - ? SizedBox( - width: 47, - height: 47, - child: Lottie.asset( - 'assets/animation/an_me.json', - repeat: false, - ), - ) - : Container( - margin: EdgeInsets.only(top: 5), - child: Image( - width: 47, - height: 47, - image: AssetImage('assets/images/ic_me.png'), - ), - ) - ], - ), + child: Stack( + children: [ + currentIndex == 3 + ? SizedBox( + width: w47, + height: w47, + child: Lottie.asset( + 'assets/animation/an_me.json', + repeat: false, + ), + ) + : Container( + margin: const EdgeInsets.only(top: 5), + child: Image( + width: w47, + height: w47, + image: const AssetImage('assets/images/ic_me.png'), + ), + ) + ], ), ), ], diff --git a/lib/tools/login/login_page.dart b/lib/tools/login/login_page.dart index b6ad0b7..6b62f43 100644 --- a/lib/tools/login/login_page.dart +++ b/lib/tools/login/login_page.dart @@ -112,6 +112,22 @@ class _LoginPageState extends State { @override Widget build(BuildContext context) { final size = MediaQuery.of(context).size; + final w253 = size.width / 1.422924901185771; + final t174 = size.width / 2.068965517241379; + final l21 = size.width / 17.14285714285714; + 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; + return Scaffold( backgroundColor: Color(0xFF17181A), body: SizedBox( @@ -123,17 +139,17 @@ class _LoginPageState extends State { Positioned( top: 0, right: 0, - child: Image(width: 253, image: AssetImage('assets/images/ic_login1.png')), + child: Image(width: w253, image: const AssetImage('assets/images/ic_login1.png')), ), Positioned( - top: 174, - left: 21, - child: Image(width: 50, height: 50, image: AssetImage('assets/images/ic_login2.png')), + top: t174, + left: l21, + child: Image(width: w50, height: w50, image: const AssetImage('assets/images/ic_login2.png')), ), Positioned( - top: 187, - left: 30, - child: Text( + top: t187, + left: l30, + child: const Text( "登录/注册", style: TextStyle(fontSize: 14, color: Color(0x8AFFFFFF)), ), @@ -141,22 +157,20 @@ class _LoginPageState extends State { ///手机号 Positioned( - top: 294, + top: t294, child: Container( - width: 331, - height: 52, - padding: EdgeInsets.only(left: 20), + width: w331, + height: h52, + padding: EdgeInsets.only(left: l20), decoration: BoxDecoration( - color: Color(0xFF30343B), - borderRadius: BorderRadius.all( - Radius.circular(90), - ), - border: Border.all(color: Color(0x1AFFFFFF)), + color: const Color(0xFF30343B), + borderRadius: BorderRadius.all(Radius.circular(c90)), + border: Border.all(color: const Color(0x1AFFFFFF)), ), child: TextField( controller: _phoneController, - style: TextStyle(fontSize: 14, color: Colors.white), - decoration: InputDecoration( + style: const TextStyle(fontSize: 14, color: Colors.white), + decoration: const InputDecoration( border: InputBorder.none, hintText: '请输入您的手机号码', hintStyle: TextStyle(fontSize: 13, color: Color(0x80FFFFFF)), @@ -167,24 +181,24 @@ class _LoginPageState extends State { ///验证码 Positioned( - top: 359, + top: t359, child: Container( - width: 331, - height: 52, - padding: EdgeInsets.only(left: 20, right: 20), + width: w331, + height: h52, + padding: EdgeInsets.only(left: l20, right: l20), decoration: BoxDecoration( - color: Color(0xFF30343B), - borderRadius: BorderRadius.all(Radius.circular(90)), - border: Border.all(color: Color(0x1AFFFFFF)), + 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: Color(0xFF074CE7), - style: TextStyle(fontSize: 14, color: Colors.white), - decoration: InputDecoration( + cursorColor: const Color(0xFF074CE7), + style: const TextStyle(fontSize: 14, color: Colors.white), + decoration: const InputDecoration( border: InputBorder.none, ), ), @@ -197,7 +211,7 @@ class _LoginPageState extends State { }, child: Text( !_isCountingDown ? "获取验证码" : "$_timeLeft后重新获取", - style: TextStyle(fontSize: 13, color: Color(0xFF969798)), + style: const TextStyle(fontSize: 13, color: Color(0xFF969798)), ), ), ], @@ -206,20 +220,20 @@ class _LoginPageState extends State { ), Positioned( - top: 471, + top: t471, child: GestureDetector( onTap: () { login(); }, child: Container( - width: 331, - height: 52, + width: w331, + height: h52, alignment: Alignment.center, decoration: BoxDecoration( - color: Color(0xFF074CE7), - borderRadius: BorderRadius.all(Radius.circular(90)), + color: const Color(0xFF074CE7), + borderRadius: BorderRadius.all(Radius.circular(c90)), ), - child: Text( + child: const Text( "登录", style: TextStyle(fontSize: 14, color: Colors.white), ), @@ -228,7 +242,7 @@ class _LoginPageState extends State { ), Positioned( - bottom: 35, + bottom: b35, child: SizedBox( width: MediaQuery.of(context).size.width, child: Row( @@ -241,7 +255,7 @@ class _LoginPageState extends State { setState(() {}); }, child: Image( - width: 16, image: isCheck ? const AssetImage('assets/images/ic_ck_s.png') : const AssetImage('assets/images/ic_ck.png')), + 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), @@ -256,7 +270,7 @@ class _LoginPageState extends State { Navigator.push( context, MaterialPageRoute( - builder: (context) => AgreementPage( + builder: (context) => const AgreementPage( title: "用户协议", url: "https://shhuanmeng.com/yonghuxieyi.html", )), @@ -271,7 +285,7 @@ class _LoginPageState extends State { Navigator.push( context, MaterialPageRoute( - builder: (context) => AgreementPage( + builder: (context) => const AgreementPage( title: "隐私政策", url: "https://shhuanmeng.com/yinsixieyi.html", )), diff --git a/lib/tools/me/edit_info_page.dart b/lib/tools/me/edit_info_page.dart index 6edd510..90ec4ea 100644 --- a/lib/tools/me/edit_info_page.dart +++ b/lib/tools/me/edit_info_page.dart @@ -3,6 +3,7 @@ import 'dart:async'; import 'package:flutter/material.dart'; import 'package:flutter_easyloading/flutter_easyloading.dart'; import 'package:game/common/EventBusUtil.dart'; +import 'package:game/network/NetworkConfig.dart'; import '../../common/func.dart'; import '../../dialog/change_nickname_dialog.dart'; @@ -47,31 +48,41 @@ class _EditInfoPageState extends State { @override Widget build(BuildContext context) { final size = MediaQuery.of(context).size; + final h50 = size.width / 7.2; + final s16 = size.width / 22.5; + final l14 = size.width / 25.71428571428571; + final w19 = size.width / 18.94736842105263; + final h26 = size.width / 13.84615384615385; + final h60 = size.width / 6; + final t18 = size.width / 20; + final l15 = size.width / 24; + final l23 = size.width / 15.65217391304348; + return Scaffold( backgroundColor: const Color(0xFF17181A), body: Column( children: [ Container( width: size.width, - height: 50, + height: h50, margin: EdgeInsets.only(top: MediaQuery.of(context).padding.top), child: Stack( alignment: Alignment.center, children: [ Text( "编辑个人信息", - style: TextStyle(fontSize: 16, color: Color(0xFFD6D6D7)), + style: TextStyle(fontSize: s16, color: const Color(0xFFD6D6D7)), ), Positioned( - left: 14, + left: l14, child: GestureDetector( onTap: () { Navigator.pop(context); }, child: Image( - width: 19, - height: 26, - image: AssetImage('assets/images/btn_fanhui.png'), + width: w19, + height: h26, + image: const AssetImage('assets/images/btn_fanhui.png'), ), ), ) @@ -79,25 +90,25 @@ class _EditInfoPageState extends State { ), ), Container( - height: 60, - margin: EdgeInsets.only(top: 18, left: 15, right: 15), - decoration: BoxDecoration( + 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: 14), - child: Text( + margin: EdgeInsets.only(left: l14), + child: const Text( "头像", style: TextStyle(fontSize: 14, color: Color(0xFFD6D6D7)), ), ), Expanded(child: Container()), Container( - margin: EdgeInsets.only(right: 23), - child: Image( + margin: EdgeInsets.only(right: l23), + child: const Image( width: 4, height: 8, image: AssetImage('assets/images/ic_arrow.png'), @@ -107,25 +118,25 @@ class _EditInfoPageState extends State { ), ), Container( - height: 60, - margin: EdgeInsets.only(top: 18, left: 15, right: 15), - decoration: BoxDecoration( + 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: 14), - child: Text( + margin: EdgeInsets.only(left: l14), + child: const Text( "头像框", style: TextStyle(fontSize: 14, color: Color(0xFFD6D6D7)), ), ), Expanded(child: Container()), Container( - margin: EdgeInsets.only(right: 23), - child: Image( + margin: EdgeInsets.only(right: l23), + child: const Image( width: 4, height: 8, image: AssetImage('assets/images/ic_arrow.png'), @@ -143,25 +154,25 @@ class _EditInfoPageState extends State { )); }, child: Container( - height: 60, - margin: EdgeInsets.only(top: 18, left: 15, right: 15), - decoration: BoxDecoration( + 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: 14), - child: Text( + margin: EdgeInsets.only(left: l14), + child: const Text( "昵称", style: TextStyle(fontSize: 14, color: Color(0xFFD6D6D7)), ), ), Expanded(child: Container()), Container( - margin: EdgeInsets.only(right: 23), - child: Image( + margin: EdgeInsets.only(right: l23), + child: const Image( width: 4, height: 8, image: AssetImage('assets/images/ic_arrow.png'), @@ -172,27 +183,27 @@ class _EditInfoPageState extends State { ), ), Container( - height: 60, - margin: EdgeInsets.only(top: 18, left: 15, right: 15), - decoration: BoxDecoration( + 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: 14), - child: Text( + margin: EdgeInsets.only(left: l14), + child: const Text( "ID", style: TextStyle(fontSize: 14, color: Color(0xFFD6D6D7)), ), ), Expanded(child: Container()), Container( - margin: EdgeInsets.only(right: 23), + margin: EdgeInsets.only(right: l23), child: Text( - "12345678", - style: TextStyle(fontSize: 14, color: Color(0xFFD6D6D7)), + "${NetworkConfig.userInfoBean?.userId}", + style: const TextStyle(fontSize: 14, color: Color(0xFFD6D6D7)), ), ), ], diff --git a/lib/tools/me/feedback_page.dart b/lib/tools/me/feedback_page.dart index cb41ebc..363ebeb 100644 --- a/lib/tools/me/feedback_page.dart +++ b/lib/tools/me/feedback_page.dart @@ -49,31 +49,41 @@ class _FeedbackPageState extends State { @override Widget build(BuildContext context) { final size = MediaQuery.of(context).size; + final h50 = size.width / 7.2; + final s16 = size.width / 22.5; + final l14 = size.width / 25.71428571428571; + final w19 = size.width / 18.94736842105263; + final h26 = size.width / 13.84615384615385; + final l20 = size.width / 18; + final h45 = size.width / 8; + final t30 = size.width / 12; + final c22 = size.width / 16.36363636363636; + return Scaffold( backgroundColor: const Color(0xFF17181A), body: Column( children: [ Container( width: size.width, - height: 50, + height: h50, margin: EdgeInsets.only(top: MediaQuery.of(context).padding.top), child: Stack( alignment: Alignment.center, children: [ Text( "反馈", - style: TextStyle(fontSize: 16, color: Color(0xFFD6D6D7)), + style: TextStyle(fontSize: s16, color: const Color(0xFFD6D6D7)), ), Positioned( - left: 14, + left: l14, child: GestureDetector( onTap: () { Navigator.pop(context); }, child: Image( - width: 19, - height: 26, - image: AssetImage('assets/images/btn_fanhui.png'), + width: w19, + height: h26, + image: const AssetImage('assets/images/btn_fanhui.png'), ), ), ) @@ -82,17 +92,17 @@ class _FeedbackPageState extends State { ), Container( alignment: Alignment.centerLeft, - margin: EdgeInsets.only(left: 14), - child: Text( + margin: EdgeInsets.only(left: l14), + child: const Text( "问题描述:", style: TextStyle(fontSize: 14, color: Color(0xFFD6D6D7)), ), ), Container( alignment: Alignment.center, - margin: EdgeInsets.symmetric(horizontal: 14, vertical: 20), + margin: EdgeInsets.symmetric(horizontal: l14, vertical: l20), padding: const EdgeInsets.only(left: 9, top: 13, right: 9), - decoration: BoxDecoration( + decoration: const BoxDecoration( color: Color(0xFF111319), borderRadius: BorderRadius.all(Radius.circular(6.6)), ), @@ -100,9 +110,9 @@ class _FeedbackPageState extends State { controller: _textController, keyboardType: TextInputType.name, focusNode: _commentFocus, - decoration: InputDecoration.collapsed( + decoration: const InputDecoration.collapsed( hintText: '请输入您详细的问题或建议,以便我们提供更好的服务', - hintStyle: const TextStyle( + hintStyle: TextStyle( fontSize: 14.0, color: Color(0xFF44474F), )), @@ -116,28 +126,28 @@ class _FeedbackPageState extends State { ), Container( alignment: Alignment.centerLeft, - margin: EdgeInsets.only(left: 14), - child: Text( + margin: EdgeInsets.only(left: l14), + child: const Text( "联系方式:", style: TextStyle(fontSize: 14, color: Color(0xFFD6D6D7)), ), ), Container( width: size.width, - height: 45, + height: h45, alignment: Alignment.centerLeft, padding: const EdgeInsets.only(left: 9, bottom: 5, right: 9), - margin: EdgeInsets.symmetric(horizontal: 14, vertical: 20), - decoration: BoxDecoration( + 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: TextStyle(fontSize: 14, color: Colors.white), - decoration: InputDecoration.collapsed( + style: const TextStyle(fontSize: 14, color: Colors.white), + decoration: const InputDecoration.collapsed( hintText: '请输入您的QQ或者手机号码', - hintStyle: const TextStyle( + hintStyle: TextStyle( fontSize: 11.0, color: Color(0xFF44474F), )), @@ -153,14 +163,14 @@ class _FeedbackPageState extends State { }, child: Container( width: size.width, - height: 44, - margin: EdgeInsets.only(top: 30), + height: h45, + margin: EdgeInsets.only(top: t30), alignment: Alignment.center, decoration: BoxDecoration( - color: Color(0xFF074CE7), - borderRadius: BorderRadius.all(Radius.circular(22)), + color: const Color(0xFF074CE7), + borderRadius: BorderRadius.all(Radius.circular(c22)), ), - child: Text( + child: const Text( "提交", style: TextStyle(fontSize: 14, color: Colors.white), ), diff --git a/lib/tools/me/game_history_page.dart b/lib/tools/me/game_history_page.dart index a15d9b4..e81033e 100644 --- a/lib/tools/me/game_history_page.dart +++ b/lib/tools/me/game_history_page.dart @@ -49,30 +49,37 @@ class _GameHistoryPageState extends State { @override Widget build(BuildContext context) { final size = MediaQuery.of(context).size; + + final h50 = size.width / 7.2; + final s16 = size.width / 22.5; + final l14 = size.width / 25.71428571428571; + final w19 = size.width / 18.94736842105263; + final h26 = size.width / 13.84615384615385; + return Scaffold( backgroundColor: const Color(0xFF17181A), body: Column( children: [ Container( width: size.width, - height: 50, + height: h50, margin: EdgeInsets.only(top: MediaQuery.of(context).padding.top), child: Stack( alignment: Alignment.center, children: [ Text( "游玩历史", - style: TextStyle(fontSize: 16, color: Color(0xFFD6D6D7)), + style: TextStyle(fontSize: s16, color: Color(0xFFD6D6D7)), ), Positioned( - left: 14, + left: l14, child: GestureDetector( onTap: () { Navigator.pop(context); }, child: Image( - width: 19, - height: 26, + width: w19, + height: h26, image: AssetImage('assets/images/btn_fanhui.png'), ), ), @@ -82,12 +89,12 @@ class _GameHistoryPageState extends State { ), Expanded( child: Container( - margin: EdgeInsets.only(left: 14, right: 14), + margin: EdgeInsets.only(left: l14, right: l14), child: ListView.builder( padding: EdgeInsets.zero, itemCount: dataList.length, itemBuilder: (context, index) { - return _item(dataList[index]); + return _item(dataList[index], context); }), )), ], @@ -95,39 +102,46 @@ class _GameHistoryPageState extends State { ); } - _item(GameHistoryBean data) { + _item(GameHistoryBean data, context) { + final size = MediaQuery.of(context).size; + final h99 = size.width / 3.636363636363636; + final t18 = size.width / 20; + final l16 = size.width / 22.5; + final w50 = size.width / 7.2; + final t80 = size.width / 4.5; + return Container( - height: 99, - margin: EdgeInsets.only(top: 18), - decoration: BoxDecoration(color: Color(0xFF202530), borderRadius: BorderRadius.all(Radius.circular(11))), + height: h99, + margin: EdgeInsets.only(top: t18), + decoration: const BoxDecoration(color: Color(0xFF202530), borderRadius: BorderRadius.all(Radius.circular(11))), child: Stack( children: [ Positioned( - left: 16, - top: 16, + left: l16, + top: l16, child: Row( children: [ CachedNetworkImage( - width: 50, - height: 50, + width: w50, + height: w50, imageUrl: '${data.gameIconImage}', errorWidget: (context, url, error) => const Icon(Icons.error), ), Container( - margin: EdgeInsets.only(left: 10), + margin: const EdgeInsets.only(left: 10), child: Text( "${data.gameName}", - style: TextStyle(fontSize: 14, color: Color(0xFFD6D6D7)), + style: const TextStyle(fontSize: 14, color: Color(0xFFD6D6D7)), ), ), ], )), Positioned( - left: 16, - top: 80, + left: l16, + top: t80, child: Text( "${data.playtime}", - style: TextStyle(fontSize: 9, color: Color(0xFF9D9D9D)), + style: const TextStyle(fontSize: 9, color: Color(0xFF9D9D9D)), )) ], ), diff --git a/lib/tools/me/my_collect_page.dart b/lib/tools/me/my_collect_page.dart index 21cb2c3..76095fa 100644 --- a/lib/tools/me/my_collect_page.dart +++ b/lib/tools/me/my_collect_page.dart @@ -49,31 +49,38 @@ class _MyCollectPageState extends State { @override Widget build(BuildContext context) { final size = MediaQuery.of(context).size; + final h50 = size.width / 7.2; + final s16 = size.width / 22.5; + final l14 = size.width / 25.71428571428571; + final w19 = size.width / 18.94736842105263; + final h26 = size.width / 13.84615384615385; + final t20 = size.width / 18; + return Scaffold( backgroundColor: const Color(0xFF17181A), body: Column( children: [ Container( width: size.width, - height: 50, + height: h50, margin: EdgeInsets.only(top: MediaQuery.of(context).padding.top), child: Stack( alignment: Alignment.center, children: [ Text( "我的收藏", - style: TextStyle(fontSize: 16, color: Color(0xFFD6D6D7)), + style: TextStyle(fontSize: s16, color: Color(0xFFD6D6D7)), ), Positioned( - left: 14, + left: l14, child: GestureDetector( onTap: () { Navigator.pop(context); }, child: Image( - width: 19, - height: 26, - image: AssetImage('assets/images/btn_fanhui.png'), + width: w19, + height: h26, + image: const AssetImage('assets/images/btn_fanhui.png'), ), ), ) @@ -82,12 +89,12 @@ class _MyCollectPageState extends State { ), Expanded( child: Container( - margin: EdgeInsets.only(left: 14, right: 14, top: 20), + margin: EdgeInsets.only(left: l14, right: l14, top: t20), child: ListView.builder( padding: EdgeInsets.zero, itemCount: gameList.length, itemBuilder: (context, index) { - return _gameItem(gameList[index]); + return _gameItem(gameList[index], context); }), )) ], @@ -95,27 +102,30 @@ class _MyCollectPageState extends State { ); } - _gameItem(SearchBean data) { + _gameItem(SearchBean data, context) { + final size = MediaQuery.of(context).size; + final h76 = size.width / 4.736842105263158; + final w57 = size.width / 6.315789473684211; return Container( - height: 76, - padding: EdgeInsets.only(left: 11), - decoration: BoxDecoration( + height: h76, + padding: const EdgeInsets.only(left: 11), + decoration: const BoxDecoration( color: Color(0xFF202530), borderRadius: BorderRadius.all(Radius.circular(11)), ), child: Row( children: [ CachedNetworkImage( - width: 57, - height: 57, + width: w57, + height: w57, imageUrl: '${data.gameIconImage}', errorWidget: (context, url, error) => const Icon(Icons.error), ), Container( - margin: EdgeInsets.only(left: 11), + margin: const EdgeInsets.only(left: 11), child: Text( "${data.gameName}", - style: TextStyle(fontSize: 14, color: Color(0xFFD6D6D7)), + style: const TextStyle(fontSize: 14, color: Color(0xFFD6D6D7)), ), ), ], diff --git a/lib/tools/me/my_page.dart b/lib/tools/me/my_page.dart index 8ff66e8..6c9051e 100644 --- a/lib/tools/me/my_page.dart +++ b/lib/tools/me/my_page.dart @@ -81,6 +81,25 @@ class _MyPageState extends State { @override Widget build(BuildContext context) { final size = MediaQuery.of(context).size; + final h282 = size.width / 1.2765957446808; + final t110 = size.width / 3.2727272727272; + final l14 = size.width / 25.714285714285; + final w57 = size.width / 6.31578947368; + final l85 = size.width / 4.235294117647; + final t147 = size.width / 2.4489795918367; + final s18 = size.width / 20; + final t203 = size.width / 1.7733990147783; + final w330 = size.width / 1.090909090909; + final h79 = size.width / 4.5569620253164; + final l23 = size.width / 15.652173913043; + final t22 = size.width / 16.363636363636; + final t41 = size.width / 8.780487804878; + final s16 = size.width / 22.5; + final w37 = size.width / 9.729729729729; + final t18 = size.width / 20; + final h60 = size.width / 6; + final w20 = size.width / 18; + return _isInitialized ? Scaffold( backgroundColor: const Color(0xFF17181A), @@ -88,7 +107,7 @@ class _MyPageState extends State { child: Column( children: [ SizedBox( - height: 282, + height: h282, child: Stack( alignment: Alignment.center, children: [ @@ -97,39 +116,39 @@ class _MyPageState extends State { child: Image(width: size.width, image: AssetImage('assets/images/me_bg.png')), ), Positioned( - left: 14, - top: 110, + left: l14, + top: t110, child: ClipOval( child: CachedNetworkImage( - width: 57, - height: 57, + width: w57, + height: w57, imageUrl: '${userInfoBean.userIcon}', errorWidget: (context, url, error) => const Icon(Icons.error), )), ), Positioned( - left: 85, - top: 110, + left: l85, + top: t110, child: Text( "${userInfoBean.nickName}", - style: TextStyle(fontSize: 18, color: Colors.white), + style: TextStyle(fontSize: s18, color: Colors.white), )), Positioned( - left: 85, - top: 147, + left: l85, + top: t147, child: GestureDetector( onTap: () { Navigator.pushNamed(context, "/EditInfoPage"); }, child: Row( children: [ - Text( + const Text( "编辑个人资料", style: TextStyle(fontSize: 11, color: Color(0xFF909090)), ), Container( - margin: EdgeInsets.only(left: 4), - child: Image( + margin: const EdgeInsets.only(left: 4), + child: const Image( width: 4, height: 8, image: AssetImage('assets/images/ic_arrow.png'), @@ -139,12 +158,12 @@ class _MyPageState extends State { ), )), Positioned( - top: 203, + top: t203, child: Container( - padding: EdgeInsets.only(left: 15, right: 15), + padding: EdgeInsets.only(left: l14, right: l14), child: Container( - width: 330, - height: 79, + width: w330, + height: h79, decoration: const BoxDecoration( gradient: LinearGradient( begin: Alignment.centerLeft, @@ -160,25 +179,25 @@ class _MyPageState extends State { alignment: Alignment.center, children: [ Positioned( - left: 23, - top: 22, - child: Text( + left: l23, + top: t22, + child: const Text( "我的游戏时长", style: TextStyle(fontSize: 11, color: Color(0xFFE2F3FF)), )), Positioned( - left: 23, - top: 41, + left: l23, + top: t41, child: Text( "${userInfoBean.totalGamingTime} 分钟", - style: TextStyle(fontSize: 16, color: Colors.white), + style: TextStyle(fontSize: s16, color: Colors.white), )), Positioned( - right: 23, + right: l23, child: Image( - width: 37, - height: 37, - image: AssetImage('assets/images/ic_game_time.png'), + width: w37, + height: w37, + image: const AssetImage('assets/images/ic_game_time.png'), ), ) ], @@ -190,8 +209,8 @@ class _MyPageState extends State { ), ), Container( - margin: EdgeInsets.only(top: 18, left: 15, right: 15), - decoration: BoxDecoration( + margin: EdgeInsets.only(top: t18, left: l14, right: l14), + decoration: const BoxDecoration( color: Color(0xFF202530), borderRadius: BorderRadius.all(Radius.circular(11)), ), @@ -212,28 +231,28 @@ class _MyPageState extends State { )); }, child: SizedBox( - height: 60, + height: h60, child: Row( children: [ Container( - margin: EdgeInsets.only(left: 23), + margin: EdgeInsets.only(left: l23), child: Image( - width: 20, - height: 20, - image: AssetImage('assets/images/ic_sign.png'), + width: w20, + height: w20, + image: const AssetImage('assets/images/ic_sign.png'), ), ), Container( - margin: EdgeInsets.only(left: 14), - child: Text( + margin: EdgeInsets.only(left: l14), + child: const Text( "每日签到", style: TextStyle(fontSize: 14, color: Color(0xFFD6D6D7)), ), ), Expanded(child: Container()), Container( - margin: EdgeInsets.only(right: 23), - child: Image( + margin: EdgeInsets.only(right: l23), + child: const Image( width: 4, height: 8, image: AssetImage('assets/images/ic_arrow.png'), @@ -246,28 +265,28 @@ class _MyPageState extends State { ///任务中心 SizedBox( - height: 60, + height: h60, child: Row( children: [ Container( - margin: EdgeInsets.only(left: 23), + margin: EdgeInsets.only(left: l23), child: Image( - width: 20, - height: 20, + width: w20, + height: w20, image: AssetImage('assets/images/ic_task.png'), ), ), Container( - margin: EdgeInsets.only(left: 14), - child: Text( + margin: EdgeInsets.only(left: l14), + child: const Text( "任务中心", style: TextStyle(fontSize: 14, color: Color(0xFFD6D6D7)), ), ), Expanded(child: Container()), Container( - margin: EdgeInsets.only(right: 23), - child: Image( + margin: EdgeInsets.only(right: l23), + child: const Image( width: 4, height: 8, image: AssetImage('assets/images/ic_arrow.png'), @@ -286,36 +305,36 @@ class _MyPageState extends State { Navigator.pushNamed(context, "/GameHistoryPage"); }, child: Container( - margin: EdgeInsets.only(top: 18, left: 15, right: 15), - decoration: BoxDecoration( + 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: 60, + height: h60, child: Row( children: [ Container( - margin: EdgeInsets.only(left: 23), + margin: EdgeInsets.only(left: l23), child: Image( - width: 20, - height: 20, + width: w20, + height: w20, image: AssetImage('assets/images/ic_play_history.png'), ), ), Container( - margin: EdgeInsets.only(left: 14), - child: Text( + margin: EdgeInsets.only(left: l14), + child: const Text( "游玩历史", style: TextStyle(fontSize: 14, color: Color(0xFFD6D6D7)), ), ), Expanded(child: Container()), Container( - margin: EdgeInsets.only(right: 23), - child: Image( + margin: EdgeInsets.only(right: l23), + child: const Image( width: 4, height: 8, image: AssetImage('assets/images/ic_arrow.png'), @@ -331,36 +350,36 @@ class _MyPageState extends State { ///包月卡 Container( - margin: EdgeInsets.only(top: 18, left: 15, right: 15), - decoration: BoxDecoration( + 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: 60, + height: h60, child: Row( children: [ Container( - margin: EdgeInsets.only(left: 23), + margin: EdgeInsets.only(left: l23), child: Image( - width: 20, - height: 20, - image: AssetImage('assets/images/ic_night.png'), + width: w20, + height: w20, + image: const AssetImage('assets/images/ic_night.png'), ), ), Container( - margin: EdgeInsets.only(left: 14), - child: Text( + margin: EdgeInsets.only(left: l14), + child: const Text( "包夜卡", style: TextStyle(fontSize: 14, color: Color(0xFFD6D6D7)), ), ), Expanded(child: Container()), Container( - margin: EdgeInsets.only(right: 23), - child: Image( + margin: EdgeInsets.only(right: l23), + child: const Image( width: 4, height: 8, image: AssetImage('assets/images/ic_arrow.png'), @@ -374,7 +393,7 @@ class _MyPageState extends State { ), Container( - margin: EdgeInsets.only(top: 18, left: 15, right: 15, bottom: 20), + margin: EdgeInsets.only(top: t18, left: l14, right: l14, bottom: w20), decoration: const BoxDecoration( color: Color(0xFF202530), borderRadius: BorderRadius.all(Radius.circular(11)), @@ -388,28 +407,28 @@ class _MyPageState extends State { Navigator.pushNamed(context, "/PropertyPage"); }, child: SizedBox( - height: 60, + height: h60, child: Row( children: [ Container( - margin: EdgeInsets.only(left: 23), - child: const Image( - width: 20, - height: 20, - image: AssetImage('assets/images/ic_property.png'), + margin: EdgeInsets.only(left: l23), + child: Image( + width: w20, + height: w20, + image: const AssetImage('assets/images/ic_property.png'), ), ), Container( - margin: EdgeInsets.only(left: 14), - child: Text( + margin: EdgeInsets.only(left: l14), + child: const Text( "资产记录", style: TextStyle(fontSize: 14, color: Color(0xFFD6D6D7)), ), ), Expanded(child: Container()), Container( - margin: EdgeInsets.only(right: 23), - child: Image( + margin: EdgeInsets.only(right: l23), + child: const Image( width: 4, height: 8, image: AssetImage('assets/images/ic_arrow.png'), @@ -443,28 +462,28 @@ class _MyPageState extends State { }); }, child: SizedBox( - height: 60, + height: h60, child: Row( children: [ Container( - margin: EdgeInsets.only(left: 23), + margin: EdgeInsets.only(left: l23), child: Image( - width: 20, - height: 20, - image: AssetImage('assets/images/ic_exchange.png'), + width: w20, + height: w20, + image: const AssetImage('assets/images/ic_exchange.png'), ), ), Container( - margin: EdgeInsets.only(left: 14), - child: Text( + margin: EdgeInsets.only(left: l14), + child: const Text( "兑换码", style: TextStyle(fontSize: 14, color: Color(0xFFD6D6D7)), ), ), Expanded(child: Container()), Container( - margin: EdgeInsets.only(right: 23), - child: Image( + margin: EdgeInsets.only(right: l23), + child: const Image( width: 4, height: 8, image: AssetImage('assets/images/ic_arrow.png'), @@ -482,28 +501,28 @@ class _MyPageState extends State { Navigator.pushNamed(context, '/FeedbackPage'); }, child: SizedBox( - height: 60, + height: h60, child: Row( children: [ Container( - margin: EdgeInsets.only(left: 23), + margin: EdgeInsets.only(left: l23), child: Image( - width: 20, - height: 20, - image: AssetImage('assets/images/ic_feedback.png'), + width: w20, + height: w20, + image: const AssetImage('assets/images/ic_feedback.png'), ), ), Container( - margin: EdgeInsets.only(left: 14), - child: Text( + margin: EdgeInsets.only(left: l14), + child: const Text( "反馈", style: TextStyle(fontSize: 14, color: Color(0xFFD6D6D7)), ), ), Expanded(child: Container()), Container( - margin: EdgeInsets.only(right: 23), - child: Image( + margin: EdgeInsets.only(right: l23), + child: const Image( width: 4, height: 8, image: AssetImage('assets/images/ic_arrow.png'), @@ -521,28 +540,28 @@ class _MyPageState extends State { Navigator.pushNamed(context, "/MyCollectPage"); }, child: SizedBox( - height: 60, + height: h60, child: Row( children: [ Container( - margin: EdgeInsets.only(left: 23), + margin: EdgeInsets.only(left: l23), child: Image( - width: 20, - height: 20, - image: AssetImage('assets/images/ic_collect.png'), + width: w20, + height: w20, + image: const AssetImage('assets/images/ic_collect.png'), ), ), Container( - margin: EdgeInsets.only(left: 14), - child: Text( + margin: EdgeInsets.only(left: l14), + child: const Text( "我的收藏", style: TextStyle(fontSize: 14, color: Color(0xFFD6D6D7)), ), ), Expanded(child: Container()), Container( - margin: EdgeInsets.only(right: 23), - child: Image( + margin: EdgeInsets.only(right: l23), + child: const Image( width: 4, height: 8, image: AssetImage('assets/images/ic_arrow.png'), @@ -560,28 +579,28 @@ class _MyPageState extends State { Navigator.pushNamed(context, "/SettingPage"); }, child: SizedBox( - height: 60, + height: h60, child: Row( children: [ Container( - margin: EdgeInsets.only(left: 23), + margin: EdgeInsets.only(left: l23), child: Image( - width: 20, - height: 20, - image: AssetImage('assets/images/ic_set.png'), + width: w20, + height: w20, + image: const AssetImage('assets/images/ic_set.png'), ), ), Container( - margin: EdgeInsets.only(left: 14), - child: Text( + margin: EdgeInsets.only(left: l14), + child: const Text( "设置", style: TextStyle(fontSize: 14, color: Color(0xFFD6D6D7)), ), ), Expanded(child: Container()), Container( - margin: EdgeInsets.only(right: 23), - child: Image( + margin: EdgeInsets.only(right: l23), + child: const Image( width: 4, height: 8, 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 be4738f..dfcf828 100644 --- a/lib/tools/me/property/expenses_page.dart +++ b/lib/tools/me/property/expenses_page.dart @@ -48,31 +48,37 @@ class _ExpensesPageState extends State { @override Widget build(BuildContext context) { final size = MediaQuery.of(context).size; + final h50 = size.width / 7.2; + final s16 = size.width / 22.5; + final l14 = size.width / 25.71428571428571; + final w19 = size.width / 18.94736842105263; + final h26 = size.width / 13.84615384615385; + return Scaffold( backgroundColor: const Color(0xFF17181A), body: Column( children: [ Container( width: size.width, - height: 50, + height: h50, margin: EdgeInsets.only(top: MediaQuery.of(context).padding.top), child: Stack( alignment: Alignment.center, children: [ Text( "资产支出", - style: TextStyle(fontSize: 16, color: Color(0xFFD6D6D7)), + style: TextStyle(fontSize: s16, color: const Color(0xFFD6D6D7)), ), Positioned( - left: 14, + left: l14, child: GestureDetector( onTap: () { Navigator.pop(context); }, child: Image( - width: 19, - height: 26, - image: AssetImage('assets/images/btn_fanhui.png'), + width: w19, + height: h26, + image: const AssetImage('assets/images/btn_fanhui.png'), ), ), ) @@ -81,12 +87,12 @@ class _ExpensesPageState extends State { ), Expanded( child: Container( - margin: EdgeInsets.only(left: 14, right: 14), + margin: EdgeInsets.only(left: l14, right: l14), child: ListView.builder( padding: EdgeInsets.zero, itemCount: dataList.length, itemBuilder: (context, index) { - return _item(dataList[index]); + return _item(dataList[index], context); }), )), ], @@ -94,36 +100,43 @@ class _ExpensesPageState extends State { ); } - _item(PropertyBean data) { + _item(PropertyBean data, context) { + final size = MediaQuery.of(context).size; + final h99 = size.width / 3.636363636363636; + final t18 = size.width / 20; + final l16 = size.width / 22.5; + final t46 = size.width / 7.826086956521739; + final t73 = size.width / 4.931506849315068; + return Container( - height: 99, - margin: EdgeInsets.only(top: 18), - decoration: BoxDecoration(color: Color(0xFF202530), borderRadius: BorderRadius.all(Radius.circular(11))), + height: h99, + margin: EdgeInsets.only(top: t18), + decoration: const BoxDecoration(color: Color(0xFF202530), borderRadius: BorderRadius.all(Radius.circular(11))), child: Stack( children: [ Positioned( - left: 16, - top: 16, + left: l16, + top: l16, child: Text( "${data.title}", - style: TextStyle(fontSize: 14, color: Color(0xFFD6D6D7)), + style: const TextStyle(fontSize: 14, color: Color(0xFFD6D6D7)), )), Positioned( - left: 16, - top: 46, + left: l16, + top: t46, child: Container( - margin: EdgeInsets.only(left: 5), + margin: const EdgeInsets.only(left: 5), child: Text( "${data.consumeDetails}", - style: TextStyle(fontSize: 14, color: Color(0xFFD6D6D7)), + style: const TextStyle(fontSize: 14, color: Color(0xFFD6D6D7)), ), )), Positioned( - left: 16, - top: 73, + left: l16, + top: t73, child: Text( "${data.datePrompt}", - style: TextStyle(fontSize: 9, color: Color(0xFF9D9D9D)), + style: const TextStyle(fontSize: 9, color: Color(0xFF9D9D9D)), )) ], ), diff --git a/lib/tools/me/property/income_page.dart b/lib/tools/me/property/income_page.dart index 171f6c5..ff4b1f0 100644 --- a/lib/tools/me/property/income_page.dart +++ b/lib/tools/me/property/income_page.dart @@ -48,30 +48,36 @@ class _IncomePageState extends State { @override Widget build(BuildContext context) { final size = MediaQuery.of(context).size; + final h50 = size.width / 7.2; + final s16 = size.width / 22.5; + final l14 = size.width / 25.71428571428571; + final w19 = size.width / 18.94736842105263; + final h26 = size.width / 13.84615384615385; + return Scaffold( backgroundColor: const Color(0xFF17181A), body: Column( children: [ Container( width: size.width, - height: 50, + height: h50, margin: EdgeInsets.only(top: MediaQuery.of(context).padding.top), child: Stack( alignment: Alignment.center, children: [ Text( "资产收入", - style: TextStyle(fontSize: 16, color: Color(0xFFD6D6D7)), + style: TextStyle(fontSize: s16, color: Color(0xFFD6D6D7)), ), Positioned( - left: 14, + left: l14, child: GestureDetector( onTap: () { Navigator.pop(context); }, child: Image( - width: 19, - height: 26, + width: w19, + height: h26, image: AssetImage('assets/images/btn_fanhui.png'), ), ), @@ -81,12 +87,12 @@ class _IncomePageState extends State { ), Expanded( child: Container( - margin: EdgeInsets.only(left: 14, right: 14), + margin: EdgeInsets.only(left: l14, right: l14), child: ListView.builder( padding: EdgeInsets.zero, itemCount: dataList.length, itemBuilder: (context, index) { - return _item(dataList[index]); + return _item(dataList[index], context); }), )), ], @@ -94,36 +100,42 @@ class _IncomePageState extends State { ); } - _item(PropertyBean data) { + _item(PropertyBean data, context) { + final size = MediaQuery.of(context).size; + final h76 = size.width / 4.736842105263158; + final t18 = size.width / 20; + final l16 = size.width / 22.5; + final t46 = size.width / 7.826086956521739; + return Container( - height: 76, - margin: EdgeInsets.only(top: 18), - decoration: BoxDecoration(color: Color(0xFF202530), borderRadius: BorderRadius.all(Radius.circular(11))), + height: h76, + margin: EdgeInsets.only(top: t18), + decoration: const BoxDecoration(color: Color(0xFF202530), borderRadius: BorderRadius.all(Radius.circular(11))), child: Stack( alignment: Alignment.center, children: [ Positioned( - left: 16, - top: 16, + left: l16, + top: l16, child: Text( "${data.title}", - style: TextStyle(fontSize: 14, color: Color(0xFFD6D6D7)), + style: const TextStyle(fontSize: 14, color: Color(0xFFD6D6D7)), )), Positioned( - left: 16, - top: 46, + left: l16, + top: t46, child: Container( - margin: EdgeInsets.only(left: 5), + margin: const EdgeInsets.only(left: 5), child: Text( "${data.consumeDetails}", - style: TextStyle(fontSize: 14, color: Color(0xFFD6D6D7)), + style: const TextStyle(fontSize: 14, color: Color(0xFFD6D6D7)), ), )), Positioned( - right: 16, + right: l16, child: Text( "${data.datePrompt}", - style: TextStyle(fontSize: 9, color: Color(0xFF9D9D9D)), + style: const TextStyle(fontSize: 9, color: Color(0xFF9D9D9D)), )) ], ), diff --git a/lib/tools/me/property/property_page.dart b/lib/tools/me/property/property_page.dart index 52bd825..a50dace 100644 --- a/lib/tools/me/property/property_page.dart +++ b/lib/tools/me/property/property_page.dart @@ -1,5 +1,5 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:game/network/NetworkConfig.dart'; class PropertyPage extends StatefulWidget { const PropertyPage({super.key}); @@ -12,31 +12,47 @@ class _PropertyPageState extends State { @override Widget build(BuildContext context) { final size = MediaQuery.of(context).size; + final h50 = size.width / 7.2; + final s16 = size.width / 22.5; + final l14 = size.width / 25.71428571428571; + final w19 = size.width / 18.94736842105263; + final h26 = size.width / 13.84615384615385; + final h80 = size.width / 4.5; + final t20 = size.width / 18; + final l18 = size.width / 20; + final l16 = size.width / 22.5; + final t34 = size.width / 10.58823529411765; + final s29 = size.width / 12.41379310344828; + final h60 = size.width / 6; + final t18 = size.width / 20; + final l15 = size.width / 24; + final r23 = size.width / 15.65217391304348; + return Scaffold( backgroundColor: const Color(0xFF17181A), body: Column( children: [ Container( width: size.width, - height: 50, + height: h50, margin: EdgeInsets.only(top: MediaQuery.of(context).padding.top), child: Stack( alignment: Alignment.center, children: [ Text( "我的资产", - style: TextStyle(fontSize: 16, color: Color(0xFFD6D6D7)), + style: TextStyle(fontSize: s16, color: const Color(0xFFD6D6D7)), ), Positioned( - left: 14, + left: l14, child: GestureDetector( onTap: () { Navigator.pop(context); }, child: Image( - width: 19, - height: 26, - image: AssetImage('assets/images/btn_fanhui.png'), + width: w19, + height: h26, + image: const AssetImage('assets/images/btn_fanhui.png'), ), ), ) @@ -47,9 +63,9 @@ class _PropertyPageState extends State { ///钻石数量 Container( width: size.width, - height: 80, - margin: EdgeInsets.only(left: 14, right: 14, top: 20), - decoration: BoxDecoration( + 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, @@ -63,18 +79,18 @@ class _PropertyPageState extends State { child: Stack( children: [ Positioned( - left: 18, - top: 16, - child: Text( + left: l18, + top: l16, + child: const Text( "当前钻石数量", style: TextStyle(fontSize: 11, color: Color(0xFFE2F3FF)), )), Positioned( - left: 18, - top: 34, + left: l18, + top: t34, child: Text( - "0", - style: TextStyle(fontSize: 29, color: Colors.white), + "${NetworkConfig.userInfoBean?.diamond}", + style: TextStyle(fontSize: s29, color: Colors.white), )), ], ), @@ -86,25 +102,25 @@ class _PropertyPageState extends State { Navigator.pushNamed(context, "/IncomePage"); }, child: Container( - height: 60, - margin: EdgeInsets.only(top: 18, left: 15, right: 15), - decoration: BoxDecoration( + 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: 14), - child: Text( + margin: EdgeInsets.only(left: l14), + child: const Text( "资产收入", style: TextStyle(fontSize: 14, color: Color(0xFFD6D6D7)), ), ), Expanded(child: Container()), Container( - margin: EdgeInsets.only(right: 23), - child: Image( + margin: EdgeInsets.only(right: r23), + child: const Image( width: 4, height: 8, image: AssetImage('assets/images/ic_arrow.png'), @@ -121,25 +137,25 @@ class _PropertyPageState extends State { Navigator.pushNamed(context, "/ExpensesPage"); }, child: Container( - height: 60, - margin: EdgeInsets.only(top: 18, left: 15, right: 15), - decoration: BoxDecoration( + 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: 14), - child: Text( + margin: EdgeInsets.only(left: l14), + child: const Text( "资产支出", style: TextStyle(fontSize: 14, color: Color(0xFFD6D6D7)), ), ), Expanded(child: Container()), Container( - margin: EdgeInsets.only(right: 23), - child: Image( + margin: EdgeInsets.only(right: r23), + child: const Image( width: 4, height: 8, 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 cfe2603..e23c5a6 100644 --- a/lib/tools/me/set/about_page.dart +++ b/lib/tools/me/set/about_page.dart @@ -30,30 +30,38 @@ class _AboutPageState extends State { @override Widget build(BuildContext context) { final size = MediaQuery.of(context).size; + final h50 = size.width / 7.2; + final s16 = size.width / 22.5; + final l14 = size.width / 25.71428571428571; + final w19 = size.width / 18.94736842105263; + final h26 = size.width / 13.84615384615385; + final w57 = size.width / 6.315789473684211; + final t18 = size.width / 20; + return Scaffold( backgroundColor: const Color(0xFF17181A), body: Column( children: [ Container( width: size.width, - height: 50, + height: h50, margin: EdgeInsets.only(top: MediaQuery.of(context).padding.top), child: Stack( alignment: Alignment.center, children: [ Text( "关于我们", - style: TextStyle(fontSize: 16, color: Color(0xFFD6D6D7)), + style: TextStyle(fontSize: s16, color: Color(0xFFD6D6D7)), ), Positioned( - left: 14, + left: l14, child: GestureDetector( onTap: () { Navigator.pop(context); }, child: Image( - width: 19, - height: 26, + width: w19, + height: h26, image: AssetImage('assets/images/btn_fanhui.png'), ), ), @@ -62,10 +70,10 @@ class _AboutPageState extends State { ), ), Container( - width: 57, - height: 57, - margin: EdgeInsets.only(top: 18), - child: ClipRRect( + width: w57, + height: w57, + margin: EdgeInsets.only(top: t18), + child: const ClipRRect( borderRadius: BorderRadius.all(Radius.circular(11)), child: Image( image: AssetImage('assets/images/ic_launcher.png'), @@ -73,10 +81,10 @@ class _AboutPageState extends State { ), ), Container( - margin: EdgeInsets.only(top: 18), + margin: EdgeInsets.only(top: t18), child: Text( "当前版本:$version", - style: TextStyle(fontSize: 13, color: Color(0xFF868686)), + style: const TextStyle(fontSize: 13, color: Color(0xFF868686)), ), ), ], diff --git a/lib/tools/me/set/real_name_page.dart b/lib/tools/me/set/real_name_page.dart index 57013ea..21d93fc 100644 --- a/lib/tools/me/set/real_name_page.dart +++ b/lib/tools/me/set/real_name_page.dart @@ -67,31 +67,42 @@ class _RealNamePageState extends State { @override Widget build(BuildContext context) { final size = MediaQuery.of(context).size; + final h50 = size.width / 7.2; + final s16 = size.width / 22.5; + final l14 = size.width / 25.71428571428571; + final w19 = size.width / 18.94736842105263; + final h26 = size.width / 13.84615384615385; + final t18 = size.width / 20; + final h43 = size.width / 8.372093023255814; + final h44 = size.width / 8.181818181818182; + final t36 = size.width / 10; + final c22 = size.width / 16.36363636363636; + return Scaffold( backgroundColor: const Color(0xFF17181A), body: Column( children: [ Container( width: size.width, - height: 50, + height: h50, margin: EdgeInsets.only(top: MediaQuery.of(context).padding.top), child: Stack( alignment: Alignment.center, children: [ Text( "实名认证", - style: TextStyle(fontSize: 16, color: Color(0xFFD6D6D7)), + style: TextStyle(fontSize: s16, color: const Color(0xFFD6D6D7)), ), Positioned( - left: 14, + left: l14, child: GestureDetector( onTap: () { Navigator.pop(context); }, child: Image( - width: 19, - height: 26, - image: AssetImage('assets/images/btn_fanhui.png'), + width: w19, + height: h26, + image: const AssetImage('assets/images/btn_fanhui.png'), ), ), ) @@ -100,39 +111,39 @@ class _RealNamePageState extends State { ), Container( width: size.width, - margin: EdgeInsets.only(top: 18, left: 14, right: 14), - decoration: BoxDecoration(color: Color(0xFF202530), borderRadius: BorderRadius.all(Radius.circular(11))), + 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: 18), - child: Text( + margin: EdgeInsets.only(top: t18), + child: const Text( "请使用有效身份证信息完成认证", style: TextStyle(fontSize: 14, color: Color(0xFFD6D6D7)), ), ), Container( alignment: Alignment.centerLeft, - margin: EdgeInsets.only(left: 11, top: 18), - child: Text( + margin: EdgeInsets.only(left: 11, top: t18), + child: const Text( "姓名", style: TextStyle(fontSize: 14, color: Color(0xFFD6D6D7)), ), ), Container( - height: 43, - margin: EdgeInsets.only(left: 11, right: 11, top: 11), - padding: EdgeInsets.only(left: 11), - decoration: BoxDecoration( + 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: Color(0xFF074CE7), - style: TextStyle(fontSize: 11, color: Colors.white), - decoration: InputDecoration( + 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)), @@ -141,25 +152,25 @@ class _RealNamePageState extends State { ), Container( alignment: Alignment.centerLeft, - margin: EdgeInsets.only(left: 11, top: 18), - child: Text( + margin: EdgeInsets.only(left: 11, top: t18), + child: const Text( "身份证号码", style: TextStyle(fontSize: 14, color: Color(0xFFD6D6D7)), ), ), Container( - height: 43, - margin: EdgeInsets.only(left: 11, right: 11, top: 11, bottom: 18), - padding: EdgeInsets.only(left: 11), - decoration: BoxDecoration( + 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: Color(0xFF074CE7), - style: TextStyle(fontSize: 11, color: Colors.white), - decoration: InputDecoration( + 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)), @@ -184,16 +195,16 @@ class _RealNamePageState extends State { }, child: Container( width: size.width, - height: 44, + height: h44, alignment: Alignment.center, - margin: EdgeInsets.only(left: 14, right: 14, top: 36), + margin: EdgeInsets.only(left: l14, right: l14, top: t36), decoration: BoxDecoration( - color: Color(0xFF074CE7), - borderRadius: BorderRadius.all(Radius.circular(22)), + color: const Color(0xFF074CE7), + borderRadius: BorderRadius.all(Radius.circular(c22)), ), child: Text( btText, - style: TextStyle(fontSize: 14, color: Colors.white), + 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 aaecb59..8f0c77d 100644 --- a/lib/tools/me/set/setting_page.dart +++ b/lib/tools/me/set/setting_page.dart @@ -11,31 +11,41 @@ class _SettingPageState extends State { @override Widget build(BuildContext context) { final size = MediaQuery.of(context).size; + final h50 = size.width / 7.2; + final s16 = size.width / 22.5; + final l14 = size.width / 25.71428571428571; + final w19 = size.width / 18.94736842105263; + final h26 = size.width / 13.84615384615385; + final h60 = size.width / 6; + final t18 = size.width / 20; + final l15 = size.width / 24; + final l23 = size.width / 15.65217391304348; + return Scaffold( backgroundColor: const Color(0xFF17181A), body: Column( children: [ Container( width: size.width, - height: 50, + height: h50, margin: EdgeInsets.only(top: MediaQuery.of(context).padding.top), child: Stack( alignment: Alignment.center, children: [ Text( "设置", - style: TextStyle(fontSize: 16, color: Color(0xFFD6D6D7)), + style: TextStyle(fontSize: s16, color: const Color(0xFFD6D6D7)), ), Positioned( - left: 14, + left: l14, child: GestureDetector( onTap: () { Navigator.pop(context); }, child: Image( - width: 19, - height: 26, - image: AssetImage('assets/images/btn_fanhui.png'), + width: w19, + height: h26, + image: const AssetImage('assets/images/btn_fanhui.png'), ), ), ) @@ -49,25 +59,25 @@ class _SettingPageState extends State { // Navigator.pushNamed(context, "/ExpensesPage"); }, child: Container( - height: 60, - margin: EdgeInsets.only(top: 18, left: 15, right: 15), - decoration: BoxDecoration( + 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: 14), - child: Text( + margin: EdgeInsets.only(left: l14), + child: const Text( "用户协议", style: TextStyle(fontSize: 14, color: Color(0xFFD6D6D7)), ), ), Expanded(child: Container()), Container( - margin: EdgeInsets.only(right: 23), - child: Image( + margin: EdgeInsets.only(right: l23), + child: const Image( width: 4, height: 8, image: AssetImage('assets/images/ic_arrow.png'), @@ -84,25 +94,25 @@ class _SettingPageState extends State { // Navigator.pushNamed(context, "/ExpensesPage"); }, child: Container( - height: 60, - margin: EdgeInsets.only(top: 18, left: 15, right: 15), - decoration: BoxDecoration( + 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: 14), - child: Text( + margin: EdgeInsets.only(left: l14), + child: const Text( "隐私政策", style: TextStyle(fontSize: 14, color: Color(0xFFD6D6D7)), ), ), Expanded(child: Container()), Container( - margin: EdgeInsets.only(right: 23), - child: Image( + margin: EdgeInsets.only(right: l23), + child: const Image( width: 4, height: 8, image: AssetImage('assets/images/ic_arrow.png'), @@ -119,25 +129,25 @@ class _SettingPageState extends State { Navigator.pushNamed(context, "/RealNamePage"); }, child: Container( - height: 60, - margin: EdgeInsets.only(top: 18, left: 15, right: 15), - decoration: BoxDecoration( + 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: 14), - child: Text( + margin: EdgeInsets.only(left: l14), + child: const Text( "实名认证", style: TextStyle(fontSize: 14, color: Color(0xFFD6D6D7)), ), ), Expanded(child: Container()), Container( - margin: EdgeInsets.only(right: 23), - child: Image( + margin: EdgeInsets.only(right: l23), + child: const Image( width: 4, height: 8, image: AssetImage('assets/images/ic_arrow.png'), @@ -154,25 +164,25 @@ class _SettingPageState extends State { Navigator.pushNamed(context, "/AboutPage"); }, child: Container( - height: 60, - margin: EdgeInsets.only(top: 18, left: 15, right: 15), - decoration: BoxDecoration( + 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: 14), - child: Text( + margin: EdgeInsets.only(left: l14), + child: const Text( "关于", style: TextStyle(fontSize: 14, color: Color(0xFFD6D6D7)), ), ), Expanded(child: Container()), Container( - margin: EdgeInsets.only(right: 23), - child: Image( + margin: EdgeInsets.only(right: l23), + child: const Image( width: 4, height: 8, image: AssetImage('assets/images/ic_arrow.png'), diff --git a/lib/tools/message/message_page.dart b/lib/tools/message/message_page.dart deleted file mode 100644 index 039318d..0000000 --- a/lib/tools/message/message_page.dart +++ /dev/null @@ -1,15 +0,0 @@ -import 'package:flutter/material.dart'; - -class MessagePage extends StatefulWidget { - const MessagePage({super.key}); - - @override - State createState() => _MessagePageState(); -} - -class _MessagePageState extends State { - @override - Widget build(BuildContext context) { - return const Placeholder(); - } -} diff --git a/lib/tools/shop/shop_page.dart b/lib/tools/shop/shop_page.dart index 186af79..93c56ae 100644 --- a/lib/tools/shop/shop_page.dart +++ b/lib/tools/shop/shop_page.dart @@ -94,39 +94,53 @@ class _ShopPageState extends State { @override Widget build(BuildContext context) { final size = MediaQuery.of(context).size; + final h25 = size.width / 14.4; + final s16 = size.width / 22.5; + final l14 = size.width / 25.71428571428571; + final t36 = size.width / 10; + final l20 = size.width / 18; + final t17 = size.width / 21.17647058823529; + final l18 = size.width / 20; + final t35 = size.width / 10.28571428571429; + final s29 = size.width / 12.41379310344828; + final h140 = size.width / 2.571428571428571; + final w157 = size.width / 2.292993630573248; + final h44 = size.width / 8.181818181818182; + final c22 = size.width / 16.36363636363636; + return Scaffold( - backgroundColor: Color(0xFF17181A), + backgroundColor: const Color(0xFF17181A), body: Column( children: [ Container( width: size.width, - height: 25, + height: h25, alignment: Alignment.center, margin: EdgeInsets.only(top: MediaQuery.of(context).padding.top), child: Text( "钻石商城", - style: TextStyle(color: Color(0xFFD6D6D7), fontSize: 16), + style: TextStyle(color: const Color(0xFFD6D6D7), fontSize: s16), ), ), Container( width: size.width, - margin: const EdgeInsets.only(left: 14, right: 14, top: 36), + margin: EdgeInsets.only(left: l14, right: l14, top: t36), child: Stack( children: [ const Image(image: AssetImage('assets/images/diamond_bg.png')), Positioned( - left: 18, - top: 17, - child: Text( + left: l20, + top: t17, + child: const Text( "当前钻石数量", style: TextStyle(fontSize: 11, color: Color(0xFFE2F3FF)), )), Positioned( - left: 18, - top: 35, + left: l18, + top: t35, child: Text( "${NetworkConfig.userInfoBean!.diamond}", - style: TextStyle(fontSize: 29, color: Colors.white), + style: TextStyle(fontSize: s29, color: Colors.white), )), ], ), @@ -135,13 +149,13 @@ class _ShopPageState extends State { ///商品列表 Expanded( child: Container( - margin: EdgeInsets.only(left: 14, right: 14), + margin: EdgeInsets.only(left: l14, right: l14), child: GridView.count( crossAxisCount: 2, - crossAxisSpacing: 18, - mainAxisSpacing: 36, + crossAxisSpacing: l18, + mainAxisSpacing: t36, childAspectRatio: 0.844, - children: _goodItem(), + children: _goodItem(context), ), ), ), @@ -149,14 +163,14 @@ class _ShopPageState extends State { ///支付 Container( width: size.width, - height: 140, - color: Color(0xFF171A22), - padding: EdgeInsets.symmetric(horizontal: 14), + height: h140, + color: const Color(0xFF171A22), + padding: EdgeInsets.symmetric(horizontal: l14), child: Column( children: [ ///支付方式 Container( - margin: EdgeInsets.only(top: 20), + margin: EdgeInsets.only(top: l20), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ @@ -169,8 +183,8 @@ class _ShopPageState extends State { }); }, child: Container( - width: 157, - height: 36, + width: w157, + height: t36, alignment: Alignment.center, decoration: BoxDecoration( color: Color(payType == 0 ? 0xFF2E3443 : 0xFF20242F), @@ -179,10 +193,10 @@ class _ShopPageState extends State { child: Row( mainAxisSize: MainAxisSize.min, children: [ - Image(width: 20, height: 17, image: AssetImage('assets/images/ic_wx.png')), + Image(width: l20, height: t17, image: AssetImage('assets/images/ic_wx.png')), Container( - margin: EdgeInsets.only(left: 11), - child: Text( + margin: const EdgeInsets.only(left: 11), + child: const Text( "微信支付", style: TextStyle(fontSize: 13, color: Color(0xFFD6D6D7)), ), @@ -201,8 +215,8 @@ class _ShopPageState extends State { }); }, child: Container( - width: 157, - height: 36, + width: w157, + height: t36, alignment: Alignment.center, decoration: BoxDecoration( color: Color(payType == 1 ? 0xFF2E3443 : 0xFF20242F), @@ -211,10 +225,10 @@ class _ShopPageState extends State { child: Row( mainAxisSize: MainAxisSize.min, children: [ - Image(width: 17, height: 17, image: AssetImage('assets/images/ic_zfb.png')), + Image(width: t17, height: t17, image: AssetImage('assets/images/ic_zfb.png')), Container( - margin: EdgeInsets.only(left: 11), - child: Text( + margin: const EdgeInsets.only(left: 11), + child: const Text( "支付宝支付", style: TextStyle(fontSize: 13, color: Color(0xFFD6D6D7)), ), @@ -234,14 +248,14 @@ class _ShopPageState extends State { }, child: Container( width: size.width, - height: 44, - margin: EdgeInsets.only(top: 20), + height: h44, + margin: EdgeInsets.only(top: l20), alignment: Alignment.center, decoration: BoxDecoration( - color: Color(0xFF074CE7), - borderRadius: BorderRadius.all(Radius.circular(22)), + color: const Color(0xFF074CE7), + borderRadius: BorderRadius.all(Radius.circular(c22)), ), - child: Text( + child: const Text( "确认支付", style: TextStyle(fontSize: 14, color: Colors.white), ), @@ -255,7 +269,15 @@ class _ShopPageState extends State { ); } - _goodItem() { + _goodItem(context) { + final size = MediaQuery.of(context).size; + final w157 = size.width / 2.292993630573248; + final t78 = size.width / 4.615384615384615; + final s18 = size.width / 20; + final b25 = size.width / 14.4; + final h20 = size.width / 18; + final s16 = size.width / 22.5; + return goodList.map((value) { int index = goodList.indexOf(value); return GestureDetector( @@ -267,12 +289,12 @@ class _ShopPageState extends State { child: Stack( alignment: Alignment.center, children: [ - Image(width: 157, image: AssetImage(goodIndex == index ? 'assets/images/good_s.png' : 'assets/images/good_n.png')), + Image(width: w157, image: AssetImage(goodIndex == index ? 'assets/images/good_s.png' : 'assets/images/good_n.png')), Positioned( - top: 78, + top: t78, child: Text( "${goodList[index].productName}", - style: TextStyle(fontSize: 18, color: Colors.white), + style: TextStyle(fontSize: s18, color: Colors.white), )), // Positioned( // top: 106, @@ -281,19 +303,19 @@ class _ShopPageState extends State { // style: TextStyle(fontSize: 11, color: Color(goodIndex == index ? 0xFFE59400 : 0xFF02D5F3)), // )), Positioned( - bottom: 25, + bottom: b25, child: SizedBox( - height: 20, + height: h20, child: Row( crossAxisAlignment: CrossAxisAlignment.end, children: [ - Text( + const Text( "¥", style: TextStyle(fontSize: 11, color: Colors.white), ), Text( "${goodList[index].price}", - style: TextStyle(fontSize: 16, color: Colors.white), + style: TextStyle(fontSize: s16, color: Colors.white), ), ], ),