ImageBlock

main
zhuce 2024-02-22 19:22:03 +08:00
parent 8bd99d02f1
commit c9ca6ac6e3
3 changed files with 42 additions and 15 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/image_block.dart';
import 'package:autosos_flutter/pages/home/widgets/number_block.dart';
import 'package:flutter/material.dart';
@ -35,8 +36,7 @@ class _HomePageState extends State<HomePage> {
}
Widget buildTopWidget() {
return ListView(
shrinkWrap: true,
return Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
@ -80,14 +80,18 @@ class _HomePageState extends State<HomePage> {
)
],
),
Padding(padding:const EdgeInsets.only(top:20), child: GridView.count(
Padding(padding:const EdgeInsets.only(top:0), child: GridView.count(
physics: const NeverScrollableScrollPhysics(),
shrinkWrap: true,
crossAxisCount: 3,
childAspectRatio: 1.0,
childAspectRatio: 1.5,
children: const [
NumberBlock(title: "钱包(元)", number: "111"),
NumberBlock(title: "总订单数", number: "111"),
NumberBlock(title: "总金额(元)", number: "111"),
ImageBlock(title: "提现",imgUrl: "images/3.0x/tixian_ic.png"),
ImageBlock(title: "个人中心",imgUrl: "images/3.0x/gerenzhongxin_ic.png"),
ImageBlock(title: "设置",imgUrl: "images/3.0x/shezhi_ic.png"),
],
),)
],

View File

@ -0,0 +1,23 @@
import 'package:flutter/material.dart';
class ImageBlock extends StatelessWidget {
final String title;
final String imgUrl;
const ImageBlock({super.key, required this.title, required this.imgUrl});
@override
Widget build(BuildContext context) {
return Column(
mainAxisAlignment: MainAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
children: [
Image.asset(imgUrl),
Text(
title,
style: const TextStyle(fontSize: 14, color: Colors.black),
)
],
);
}
}

View File

@ -8,25 +8,25 @@ class NumberBlock extends StatelessWidget {
@override
Widget build(BuildContext context) {
return ListView(
shrinkWrap: true,
children: [
Center(
child: Text(
"$number",
return Padding(
padding: const EdgeInsets.all(0),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
children: [
Text(
number,
style: const TextStyle(
fontSize: 23,
fontWeight: FontWeight.bold,
),
),
),
Center(
child: Text(
Text(
title,
style: const TextStyle(fontSize: 12, color: Colors.grey),
),
)
],
],
),
);
}
}