Skip to content

Instantly share code, notes, and snippets.

@djad442
Created November 18, 2020 12:30
Show Gist options
  • Save djad442/0bbe13d1b4cd40b3a8b917ccee892201 to your computer and use it in GitHub Desktop.
Save djad442/0bbe13d1b4cd40b3a8b917ccee892201 to your computer and use it in GitHub Desktop.
Flutter Gradient App Bar
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