custom_app_bar.dart 540 B

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