2025-06-18 11:28:37 +08:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
|
|
|
|
|
class GradientBackground extends StatelessWidget {
|
|
|
|
|
final Widget child;
|
2025-08-12 13:36:42 +08:00
|
|
|
final List<Color> colors;
|
|
|
|
|
final BorderRadius? borderRadius;
|
2025-06-18 11:28:37 +08:00
|
|
|
|
2025-08-12 13:36:42 +08:00
|
|
|
const GradientBackground(
|
|
|
|
|
{super.key,
|
|
|
|
|
required this.child,
|
|
|
|
|
required this.colors,
|
|
|
|
|
this.borderRadius});
|
2025-06-18 11:28:37 +08:00
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
return Container(
|
2025-08-12 13:36:42 +08:00
|
|
|
decoration: BoxDecoration(
|
2025-06-18 11:28:37 +08:00
|
|
|
gradient: LinearGradient(
|
2025-08-12 13:36:42 +08:00
|
|
|
begin: Alignment.topLeft,
|
|
|
|
|
end: Alignment.bottomRight,
|
|
|
|
|
colors: colors,
|
2025-06-18 11:28:37 +08:00
|
|
|
),
|
2025-08-12 13:36:42 +08:00
|
|
|
borderRadius: borderRadius,
|
2025-06-18 11:28:37 +08:00
|
|
|
),
|
|
|
|
|
child: child,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|