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