Created
November 18, 2020 12:30
-
-
Save djad442/0bbe13d1b4cd40b3a8b917ccee892201 to your computer and use it in GitHub Desktop.
Flutter Gradient App Bar
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 GradientAppBar extends StatelessWidget { | |
final String title; | |
final double barHeight = 66.0; | |
GradientAppBar(this.title); | |
@override | |
Widget build(BuildContext context) { | |
final double statusBarHeight = MediaQuery.of(context).padding.top; | |
return new Container( | |
padding: new EdgeInsets.only(top: statusBarHeight), | |
height: statusBarHeight + barHeight, | |
child: new Center(child: new Text("Hello World!!!")), | |
decoration: new BoxDecoration( | |
gradient: new LinearGradient( | |
colors: [const Color(0xFF3366FF), const Color(0xFF00CCFF)], | |
begin: const FractionalOffset(0.0, 0.0), | |
end: const FractionalOffset(1, 0.0), | |
stops: [0.0, 0.9], | |
tileMode: TileMode.clamp), | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment