custom_app_bar.dart 485 B

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