首页topWidget第一行

main
zhuce 2024-02-22 18:04:03 +08:00
parent 3dd1e7b36f
commit 3e6a3c7883
2 changed files with 63 additions and 2 deletions

View File

@ -10,6 +10,8 @@ class HomePage extends StatefulWidget {
}
class _HomePageState extends State<HomePage> {
bool enabled = false;
@override
Widget build(BuildContext context) {
const AMapWidget map = AMapWidget(
@ -18,9 +20,64 @@ class _HomePageState extends State<HomePage> {
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("订单")
],
)
],
)
],
)
],
),
);

View File

@ -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