2022-08-29 20:38:28 -06:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
|
|
|
class GradientContainer extends StatelessWidget {
|
|
|
|
const GradientContainer(this.colors, this.stops,
|
2024-02-20 13:56:39 -08:00
|
|
|
{super.key,
|
2022-08-29 20:38:28 -06:00
|
|
|
this.child,
|
|
|
|
this.width,
|
|
|
|
this.height,
|
|
|
|
this.alignment,
|
|
|
|
this.begin,
|
|
|
|
this.end,
|
|
|
|
this.blendMode,
|
2024-02-20 13:56:39 -08:00
|
|
|
this.borderRadius});
|
2022-08-29 20:38:28 -06:00
|
|
|
final List<Color> colors;
|
|
|
|
final List<double> stops;
|
|
|
|
final double? width;
|
|
|
|
final double? height;
|
|
|
|
final Widget? child;
|
|
|
|
final Alignment? begin;
|
|
|
|
final Alignment? end;
|
|
|
|
final Alignment? alignment;
|
|
|
|
final BlendMode? blendMode;
|
|
|
|
final BorderRadius? borderRadius;
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) => IgnorePointer(
|
|
|
|
child: Container(
|
|
|
|
width: width,
|
|
|
|
height: height,
|
|
|
|
alignment: alignment,
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
gradient: LinearGradient(
|
|
|
|
begin: begin ?? Alignment.centerLeft,
|
|
|
|
end: end ?? Alignment.centerRight,
|
|
|
|
colors: colors,
|
|
|
|
stops: stops,
|
|
|
|
),
|
|
|
|
backgroundBlendMode: blendMode,
|
|
|
|
borderRadius: borderRadius,
|
|
|
|
),
|
|
|
|
child: child,
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
class HzGradient extends GradientContainer {
|
2024-02-20 13:56:39 -08:00
|
|
|
const HzGradient(super.colors, super.stops,
|
|
|
|
{super.key, super.child, super.width, super.height, super.alignment, super.blendMode, super.borderRadius});
|
2022-08-29 20:38:28 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
class VtGradient extends GradientContainer {
|
2024-02-20 13:56:39 -08:00
|
|
|
const VtGradient(super.colors, super.stops,
|
|
|
|
{super.key, super.child, super.width, super.height, super.alignment, super.blendMode, super.borderRadius})
|
|
|
|
: super(begin: Alignment.topCenter, end: Alignment.bottomCenter);
|
2022-08-29 20:38:28 -06:00
|
|
|
}
|