1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- 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,
- ),
- borderRadius: borderRadius,
- ),
- child: Material(
- color: Colors.white,
- shape: RoundedRectangleBorder(borderRadius: borderRadius),
- child: InkWell(
- borderRadius: borderRadius,
- onTap: onTap,
- child: Container(
- padding: const EdgeInsets.symmetric(horizontal: 4, vertical: 4),
- 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: 20,
- fontWeight: FontWeight.bold,
- ),
- ),
- ],
- ),
- ],
- ),
- ),
- ),
- ),
- );
- }
- }
|