import 'package:flutter/material.dart'; import '../core/app_colors.dart'; /// 渐变边框按钮(白色底+彩色渐变边框) class GradientBorderButton extends StatelessWidget { final String text; final IconData? icon; final VoidCallback? onTap; final double height; final bool isSuccess; const GradientBorderButton({ super.key, required this.text, this.icon, this.onTap, this.height = 52, this.isSuccess = false, }); @override Widget build(BuildContext context) { return Container( height: height, decoration: BoxDecoration( gradient: isSuccess ? AppColors.successButtonGradient : AppColors.buttonGradient, borderRadius: BorderRadius.circular(14), boxShadow: AppColors.buttonShadow, ), child: Material( color: Colors.transparent, child: InkWell( onTap: onTap, borderRadius: BorderRadius.circular(14), child: Row( mainAxisAlignment: MainAxisAlignment.center, children: [ if (icon != null) ...[ Icon(icon, size: 22, color: AppColors.textOnGradient), const SizedBox(width: 8), ], Text( text, style: const TextStyle( fontSize: 17, fontWeight: FontWeight.w600, color: AppColors.textOnGradient, ), ), ], ), ), ), ); } } /// 卡片内的小操作按钮 class CardActionButton extends StatelessWidget { final String label; final IconData icon; final VoidCallback? onTap; final Color? iconColor; const CardActionButton({ super.key, required this.label, required this.icon, this.onTap, this.iconColor, }); @override Widget build(BuildContext context) { return InkWell( onTap: onTap, borderRadius: BorderRadius.circular(12), child: Container( padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 10), decoration: BoxDecoration( color: AppColors.backgroundSecondary, borderRadius: BorderRadius.circular(12), border: Border.all(color: AppColors.borderLight), ), child: Row( mainAxisSize: MainAxisSize.min, children: [ Icon(icon, size: 18, color: iconColor ?? AppColors.iconColor), const SizedBox(width: 6), Text( label, style: TextStyle( fontSize: 14, fontWeight: FontWeight.w500, color: AppColors.textPrimary, ), ), ], ), ), ); } } /// 功能区小图标容器 class IconBox extends StatelessWidget { final IconData icon; final double size; final Color? backgroundColor; final Color? iconColor; const IconBox({ super.key, required this.icon, this.size = 44, this.backgroundColor, this.iconColor, }); @override Widget build(BuildContext context) { return Container( width: size, height: size, decoration: BoxDecoration( color: backgroundColor ?? AppColors.iconBackground, borderRadius: BorderRadius.circular(size / 3), ), child: Icon( icon, size: size * 0.55, color: iconColor ?? AppColors.iconColor, ), ); } }