custom_app_bar.dart 467 B

1234567891011121314151617181920
  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}) : super(key: key);
  6. @override
  7. Size get preferredSize => Size.fromHeight(height);
  8. @override
  9. Widget build(BuildContext context) {
  10. return Container(
  11. height: preferredSize.height,
  12. alignment: Alignment.center,
  13. child: child,
  14. );
  15. }
  16. }