custom_app_bar.dart 473 B

123456789101112131415161718192021
  1. import 'package:flutter/material.dart';
  2. class CustomAppBar extends PreferredSize {
  3. final Widget child;
  4. final double height;
  5. const CustomAppBar(this.child, {Key key, this.height = kToolbarHeight})
  6. : super(key: key);
  7. @override
  8. Size get preferredSize => Size.fromHeight(height);
  9. @override
  10. Widget build(BuildContext context) {
  11. return Container(
  12. height: preferredSize.height,
  13. alignment: Alignment.center,
  14. child: child,
  15. );
  16. }
  17. }