28 lines
636 B
Dart
28 lines
636 B
Dart
import 'package:flutter/material.dart';
|
|
|
|
class GradientBackground extends StatelessWidget {
|
|
final Widget child;
|
|
final List<Color> colors;
|
|
final BorderRadius? borderRadius;
|
|
|
|
const GradientBackground(
|
|
{super.key,
|
|
required this.child,
|
|
required this.colors,
|
|
this.borderRadius});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Container(
|
|
decoration: BoxDecoration(
|
|
gradient: LinearGradient(
|
|
begin: Alignment.topLeft,
|
|
end: Alignment.bottomRight,
|
|
colors: colors,
|
|
),
|
|
borderRadius: borderRadius,
|
|
),
|
|
child: child,
|
|
);
|
|
}
|
|
} |