You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
47 lines
1.2 KiB
47 lines
1.2 KiB
import 'package:flutter/material.dart';
|
|
import 'package:new_recook/constants/styles.dart';
|
|
|
|
class AnimatedHomeBackground extends StatefulWidget {
|
|
final double? height;
|
|
final Color? backgroundColor;
|
|
AnimatedHomeBackground({Key? key, this.height, this.backgroundColor})
|
|
: super(key: key);
|
|
|
|
@override
|
|
AnimatedHomeBackgroundState createState() => AnimatedHomeBackgroundState();
|
|
}
|
|
|
|
class AnimatedHomeBackgroundState extends State<AnimatedHomeBackground> {
|
|
Color? displayColor;
|
|
@override
|
|
void initState() {
|
|
super.initState();
|
|
displayColor = widget.backgroundColor;
|
|
}
|
|
|
|
changeColor(Color color) {
|
|
setState(() {
|
|
displayColor = color;
|
|
});
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return AnimatedContainer(
|
|
duration: Duration(milliseconds: 500),
|
|
height: widget.height,
|
|
width: MediaQuery.of(context).size.width,
|
|
decoration: BoxDecoration(
|
|
gradient: LinearGradient(
|
|
begin: Alignment.topCenter,
|
|
end: Alignment.bottomCenter,
|
|
colors: [
|
|
displayColor!,
|
|
displayColor!,
|
|
AppColor.frenchColor,
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
} |