Skip to content

Instantly share code, notes, and snippets.

@Shtille
Created October 29, 2020 13:19
Show Gist options
  • Save Shtille/07df91e76c6f447c6f4b36497f84edd1 to your computer and use it in GitHub Desktop.
Save Shtille/07df91e76c6f447c6f4b36497f84edd1 to your computer and use it in GitHub Desktop.
Custom app bar
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