1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- 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.center,
- children: [
- icon,
- ],
- ),
- Row(
- mainAxisAlignment: MainAxisAlignment.center,
- children: [
- Text(
- label,
- style: TextStyle(
- color: Colors.grey.shade700,
- fontSize: 24,
- fontWeight: FontWeight.bold,
- ),
- ),
- ],
- ),
- ],
- ),
- ),
- ),
- ),
- );
- }
- }
|