Created
October 29, 2020 13:19
-
-
Save Shtille/07df91e76c6f447c6f4b36497f84edd1 to your computer and use it in GitHub Desktop.
Custom app bar
This file contains hidden or 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
import 'package:flutter/material.dart'; | |
/// Custom appbar with custom paddings and height | |
class MyCustomAppBar extends StatelessWidget implements PreferredSizeWidget { | |
final double _height; | |
final Widget Function(BuildContext context) _builder; | |
/// Builds custom app bar with [height] and [builder]. | |
const MyCustomAppBar({ | |
Key key, | |
@required double height, | |
@required Widget Function(BuildContext context) builder, | |
}) | |
: _height = height | |
, _builder = builder | |
, super(key: key); | |
@override | |
Widget build(BuildContext context) => _builder(context); | |
@override | |
Size get preferredSize => Size.fromHeight(_height); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment