diff --git a/lib/pages/home/home_page.dart b/lib/pages/home/home_page.dart index 63d4799..9a9e68c 100644 --- a/lib/pages/home/home_page.dart +++ b/lib/pages/home/home_page.dart @@ -17,18 +17,28 @@ class _HomePageState extends State { @override Widget build(BuildContext context) { const AMapWidget map = AMapWidget( - ///必须正确设置的合规隐私声明,否则SDK不会工作,会造成地图白屏等问题。 privacyStatement: ConstConfig.amapPrivacyStatement, apiKey: ConstConfig.amapApiKeys, ); return Scaffold( appBar: AppBar( - title: const Text("首页"), - actions: const [Text("今日在线时长?小时")], - ), + title: const Text( + "首页", + style: TextStyle(color: Colors.white), + ), + actions: const [ + Text("今日在线时长?小时", style: TextStyle(color: Colors.white)) + ], + flexibleSpace: Container( + decoration: const BoxDecoration( + image: DecorationImage( + image: AssetImage("images/4.0x/home_top_bg.png"), + fit: BoxFit.cover)), + )), + backgroundColor: const Color(0xFFF3F3F3), body: Padding( - padding: const EdgeInsets.all(20), + padding: const EdgeInsets.all(10), child: Column( children: [buildTopWidget()], ), @@ -36,65 +46,73 @@ class _HomePageState extends State { } Widget buildTopWidget() { - return Column( - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - const Row( - children: [ - Text( - "接单中", - style: TextStyle( - fontSize: 23, - fontWeight: FontWeight.bold, - color: Colors.black), - ) - ], - ), - Row( - children: [ - Switch( - value: enabled, - onChanged: (value) => - setState(() { - enabled = value; - }), - activeColor: Colors.red, - ), - Container( - margin: const EdgeInsets.only(left: 10, right: 10), - width: 1, - height: 20, - color: Colors.grey, - ), - Column( - children: [ - enabled - ? Image.asset("images/3.0x/order_receiving_star.png") - : Image.asset("images/3.0x/order_receiving_end.png"), - const Text("订单") - ], - ) - ], - ) - ], - ), - Padding(padding:const EdgeInsets.only(top:0), child: GridView.count( - physics: const NeverScrollableScrollPhysics(), - shrinkWrap: true, - crossAxisCount: 3, - childAspectRatio: 1.5, - children: const [ - NumberBlock(title: "钱包(元)", number: "111"), - NumberBlock(title: "总订单数", number: "111"), - NumberBlock(title: "总金额(元)", number: "111"), - ImageBlock(title: "提现",imgUrl: "images/3.0x/tixian_ic.png"), - ImageBlock(title: "个人中心",imgUrl: "images/3.0x/gerenzhongxin_ic.png"), - ImageBlock(title: "设置",imgUrl: "images/3.0x/shezhi_ic.png"), - ], - ),) - ], + return Container( + padding: const EdgeInsets.all(20), + decoration: const BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.all(Radius.circular(5))), + child: Column( + mainAxisSize: MainAxisSize.min, + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + const Row( + children: [ + Text( + "接单中", + style: TextStyle( + fontSize: 23, + fontWeight: FontWeight.bold, + color: Colors.black), + ) + ], + ), + Row( + children: [ + Switch( + value: enabled, + onChanged: (value) => setState(() { + enabled = value; + }), + activeColor: Colors.red, + ), + Container( + margin: const EdgeInsets.only(left: 10, right: 10), + width: 1, + height: 20, + color: Colors.grey, + ), + Column( + children: [ + enabled + ? Image.asset("images/3.0x/order_receiving_star.png") + : Image.asset("images/3.0x/order_receiving_end.png"), + const Text("订单") + ], + ) + ], + ) + ], + ), + GridView.count( + physics: const NeverScrollableScrollPhysics(), + shrinkWrap: true, + crossAxisCount: 3, + childAspectRatio: 1.5, + children: const [ + NumberBlock(title: "钱包(元)", number: "111"), + NumberBlock(title: "总订单数", number: "111"), + NumberBlock(title: "总金额(元)", number: "111"), + ImageBlock(title: "提现", imgUrl: "images/3.0x/tixian_ic.png"), + ImageBlock( + title: "个人中心", imgUrl: "images/3.0x/gerenzhongxin_ic.png"), + ImageBlock(title: "设置", imgUrl: "images/3.0x/shezhi_ic.png"), + ], + ), + ], + ), ); } }