custom_app_bar.dart 499 B

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