autosos_flutter/lib/pages/home/home_page.dart

97 lines
2.8 KiB
Dart
Raw Normal View History

2024-02-18 22:12:08 +08:00
import 'package:amap_flutter_map/amap_flutter_map.dart';
import 'package:autosos_flutter/const_config.dart';
2024-02-22 18:31:34 +08:00
import 'package:autosos_flutter/pages/home/widgets/number_block.dart';
2024-02-18 22:12:08 +08:00
import 'package:flutter/material.dart';
class HomePage extends StatefulWidget {
const HomePage({super.key});
@override
State<HomePage> createState() => _HomePageState();
}
class _HomePageState extends State<HomePage> {
2024-02-22 18:04:03 +08:00
bool enabled = false;
2024-02-18 22:12:08 +08:00
@override
Widget build(BuildContext context) {
const AMapWidget map = AMapWidget(
2024-02-22 18:31:34 +08:00
2024-02-18 22:12:08 +08:00
///必须正确设置的合规隐私声明否则SDK不会工作会造成地图白屏等问题。
privacyStatement: ConstConfig.amapPrivacyStatement,
apiKey: ConstConfig.amapApiKeys,
);
return Scaffold(
2024-02-22 18:31:34 +08:00
appBar: AppBar(
title: const Text("首页"),
actions: const [Text("今日在线时长?小时")],
2024-02-22 18:04:03 +08:00
),
2024-02-22 18:31:34 +08:00
body: Padding(
padding: const EdgeInsets.all(20),
child: Column(
children: [buildTopWidget()],
),
));
2024-02-22 18:04:03 +08:00
}
Widget buildTopWidget() {
2024-02-22 18:31:34 +08:00
return ListView(
shrinkWrap: true,
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:20), child: GridView.count(
shrinkWrap: true,
crossAxisCount: 3,
childAspectRatio: 1.0,
children: const [
NumberBlock(title: "钱包(元)", number: "111"),
NumberBlock(title: "总订单数", number: "111"),
NumberBlock(title: "总金额(元)", number: "111"),
],
),)
],
2024-02-18 22:12:08 +08:00
);
}
}