12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- import 'package:flutter/material.dart';
- import 'package:vitalapp/consts/styles.dart';
- /// 功能入口按钮
- class FunctionButton extends StatelessWidget {
- final String label;
- final Widget icon;
- final VoidCallback? onTap;
- const FunctionButton({
- super.key,
- required this.label,
- required this.icon,
- this.onTap,
- });
- @override
- Widget build(BuildContext context) {
- final borderRadius = GlobalStyles.borderRadius;
- return Container(
- decoration: BoxDecoration(
- color: Colors.white,
- border: Border.all(
- width: 1,
- color: Colors.grey.shade300,
- ),
- // boxShadow: [
- // BoxShadow(
- // color: Colors.grey.shade300, // 阴影颜色
- // spreadRadius: 2, // 阴影扩展半径
- // blurRadius: 2, // 阴影模糊半径
- // offset: const Offset(-1.6, 1.8), // 阴影偏移量,负值表示向左偏移
- // ),
- // ],
- borderRadius: borderRadius,
- ),
- child: Material(
- color: Colors.white,
- shape: RoundedRectangleBorder(borderRadius: borderRadius),
- child: InkWell(
- borderRadius: borderRadius,
- onTap: onTap,
- child: Container(
- padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8)
- .copyWith(top: 16),
- child: Column(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- Row(
- mainAxisAlignment: MainAxisAlignment.start,
- children: [
- const SizedBox(width: 32),
- icon,
- ],
- ),
- Row(
- mainAxisAlignment: MainAxisAlignment.end,
- children: [
- Text(
- label,
- style: TextStyle(
- color: Colors.grey.shade700,
- fontSize: 24,
- fontWeight: FontWeight.bold,
- ),
- ),
- const SizedBox(width: 12),
- ],
- ),
- ],
- ),
- ),
- ),
- ),
- );
- }
- }
|