Skip to content

Instantly share code, notes, and snippets.

@dylansalim3
Created September 7, 2020 08:19
Show Gist options
  • Save dylansalim3/ecc578e4a4e71f532401c84bed790577 to your computer and use it in GitHub Desktop.
Save dylansalim3/ecc578e4a4e71f532401c84bed790577 to your computer and use it in GitHub Desktop.
Custom App Bar Flutter
class CustomAppBar extends PreferredSize {
final Widget child;
final double height;
CustomAppBar({@required this.child, this.height = kToolbarHeight});
@override
Size get preferredSize => Size.fromHeight(height);
@override
Widget build(BuildContext context) {
return
Container(
height: preferredSize.height,
alignment: Alignment.center,
child: child,
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment