/*
 * @Author       : WuWei
 * @LastEditors: wuwei
 * @Date         : 2023-03-28 14:18:05
 * @LastEditTime: 2023-12-27 15:51:43
 * @Description  : 颜色渐变卡片
 */

///使用方法:
///  GradientCard(
///    child:【子组件】,
///    // 传入具体渐变颜色
///    gradient: LinearGradient(
///      colors: [Color(0xff73C3FF), Color(0xff1E9BF9)],
///      begin: Alignment.centerLeft,
///      end: Alignment.centerRight,
///    ),
///   // 阴影颜色
///   boxShadow: [
///       BoxShadow(
///         offset: Offset(0, 2.pt),
///         color: Color(0x08000000),
///         blurRadius: 10.pt,
///         spreadRadius: 2.5.pt,
///       ),
///     ],
/// )

import 'package:flutter/material.dart';

class GradientCard extends StatelessWidget {
  final Widget child;
  final Gradient gradient;
  final margin;
  final List<BoxShadow>? boxshadow;
  final double? elevation;
  final Border? border;

  GradientCard({
    required this.child,
    required this.gradient,
    this.margin,
    this.boxshadow,
    this.elevation,
    this.border,
  });

  @override
  Widget build(BuildContext context) {
    return Container(
      margin: margin,
      child: Card(
        elevation: boxshadow != null ? 0 : elevation ?? 2,
        shape: RoundedRectangleBorder(
          borderRadius: BorderRadius.circular(12.0),
        ),
        child: Container(
          decoration: BoxDecoration(
            gradient: gradient,
            borderRadius: BorderRadius.circular(12.0),
            boxShadow: boxshadow ?? [],
            border: border,
          ),
          child: child,
        ),
      ),
    );
  }
}
