有办法让三个container里的 icon和 text 对齐?
GridView(
gridDelegate:
const SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 3,
childAspectRatio: 0.75,
crossAxisSpacing: 10,
mainAxisSpacing: 5,
),
shrinkWrap: true,
children: [
_buildDashboardCard(
context,
color: const Color(0xFF93C572),
title: "tenancies".tr(),
value: 1,
icon: Assets.images.tenancyExpiring.image(height: 30),
),
_buildDashboardCard(
context,
color: const Color(0xFF96DED1),
title: "currentOccupancyRate".tr(),
value:"30.77%",
icon: Assets.images.occupancy.image(height: 20),
),
...
],
),
Widget _buildDashboardCard(BuildContext context,
{required Color color,
required String title,
required String value,
required Widget icon}) {
return Container(
decoration:
BoxDecoration(borderRadius: BorderRadius.circular(15), color: color),
child: Padding(
padding: const EdgeInsets.all(20),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
title,
textAlign: TextAlign.center,
),
const SizedBox(height: 10),
const Spacer(),
Text(
value,
style: Theme.of(context).textTheme.titleLarge,
),
const Spacer(),
Align(
alignment: Alignment.bottomRight,
child: icon,
),
],
),
),
);
}