From 3e6a3c788347e1d2a2c662948bf27d6a00058c10 Mon Sep 17 00:00:00 2001 From: zhuce <821293938@qq.com> Date: Thu, 22 Feb 2024 18:04:03 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A6=96=E9=A1=B5topWidget=E7=AC=AC=E4=B8=80?= =?UTF-8?q?=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/pages/home/home_page.dart | 61 +++++++++++++++++++++++++++++++++-- pubspec.yaml | 4 +++ 2 files changed, 63 insertions(+), 2 deletions(-) diff --git a/lib/pages/home/home_page.dart b/lib/pages/home/home_page.dart index 224f98e..68a6a7d 100644 --- a/lib/pages/home/home_page.dart +++ b/lib/pages/home/home_page.dart @@ -10,6 +10,8 @@ class HomePage extends StatefulWidget { } class _HomePageState extends State { + bool enabled = false; + @override Widget build(BuildContext context) { const AMapWidget map = AMapWidget( @@ -18,9 +20,64 @@ class _HomePageState extends State { apiKey: ConstConfig.amapApiKeys, ); return Scaffold( - body: Column( + appBar: AppBar( + title: const Text("首页"), + actions: const [Text("今日在线时长?小时")], + ), + body: Padding( + padding: const EdgeInsets.all(20), + child: Column( + children: [buildTopWidget()], + ), + ) + ); + } + + Widget buildTopWidget() { + return Expanded( + child: Column( children: [ - Text("hello world") + 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("订单") + ], + ) + ], + ) + ], + ) ], ), ); diff --git a/pubspec.yaml b/pubspec.yaml index 2e9fb2c..75a64e1 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -63,6 +63,10 @@ flutter: # To add assets to your application, add an assets section, like this: assets: - images/ + - images/1.5x/ + - images/2.0x/ + - images/3.0x/ + - images/4.0x/ # An image asset can refer to one or more resolution-specific "variants", see # https://flutter.dev/assets-and-images/#resolution-aware