NumberBlock

main
zhuce 2024-02-22 18:31:34 +08:00
parent 3e6a3c7883
commit 8bd99d02f1
2 changed files with 99 additions and 56 deletions

View File

@ -1,5 +1,6 @@
import 'package:amap_flutter_map/amap_flutter_map.dart';
import 'package:autosos_flutter/const_config.dart';
import 'package:autosos_flutter/pages/home/widgets/number_block.dart';
import 'package:flutter/material.dart';
class HomePage extends StatefulWidget {
@ -15,6 +16,7 @@ class _HomePageState extends State<HomePage> {
@override
Widget build(BuildContext context) {
const AMapWidget map = AMapWidget(
///SDK
privacyStatement: ConstConfig.amapPrivacyStatement,
apiKey: ConstConfig.amapApiKeys,
@ -29,13 +31,12 @@ class _HomePageState extends State<HomePage> {
child: Column(
children: [buildTopWidget()],
),
)
);
));
}
Widget buildTopWidget() {
return Expanded(
child: Column(
return ListView(
shrinkWrap: true,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
@ -55,7 +56,8 @@ class _HomePageState extends State<HomePage> {
children: [
Switch(
value: enabled,
onChanged: (value) => setState(() {
onChanged: (value) =>
setState(() {
enabled = value;
}),
activeColor: Colors.red,
@ -77,9 +79,18 @@ class _HomePageState extends State<HomePage> {
],
)
],
)
],
),
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"),
],
),)
],
);
}
}

View File

@ -0,0 +1,32 @@
import 'package:flutter/material.dart';
class NumberBlock extends StatelessWidget {
final String title;
final String number;
const NumberBlock({super.key, required this.title, required this.number});
@override
Widget build(BuildContext context) {
return ListView(
shrinkWrap: true,
children: [
Center(
child: Text(
"$number",
style: const TextStyle(
fontSize: 23,
fontWeight: FontWeight.bold,
),
),
),
Center(
child: Text(
title,
style: const TextStyle(fontSize: 12, color: Colors.grey),
),
)
],
);
}
}