Last active
July 24, 2021 10:24
-
-
Save Turskyi/0e6e5514c38948a51821f759dd5998c9 to your computer and use it in GitHub Desktop.
Background Flutter widget with linear gradient
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class BackgroundWidget extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return LayoutBuilder( | |
builder: (BuildContext context, BoxConstraints constraints) { | |
return Align( | |
alignment: AlignmentDirectional.topCenter, | |
child: Container( | |
width: constraints.maxWidth, | |
height: constraints.maxHeight, | |
decoration: BoxDecoration( | |
gradient: LinearGradient( | |
colors: [ | |
Color(0xFF045E9A), | |
AppConfigs.of(context).colors.vividCyan, | |
], | |
begin: const FractionalOffset(0.0, 0.0), | |
end: const FractionalOffset(1.0, 1.0), | |
), | |
), | |
child: SvgPicture.asset( | |
"${Constants.ASSETS_IMAGES}pic_background.svg", | |
fit: BoxFit.cover, | |
), | |
), | |
); | |
}, | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment