app_bar.dart 735 B

123456789101112131415161718192021222324252627
  1. import 'package:flutter/cupertino.dart';
  2. import 'package:flutter/material.dart';
  3. import 'package:twong/config/style.dart';
  4. class DAppBar extends StatelessWidget implements PreferredSizeWidget {
  5. final String title;
  6. final bool autoLeading;
  7. final List<Widget> actions;
  8. DAppBar(this.title, { this.autoLeading = true, this.actions });
  9. @override
  10. Widget build(BuildContext context) {
  11. return PreferredSize(
  12. preferredSize: preferredSize,
  13. child: AppBar(
  14. centerTitle: true,
  15. automaticallyImplyLeading: autoLeading,
  16. title: Text(title, style: DText.appBar),
  17. backgroundColor: DColors.Main,
  18. actions: actions,
  19. ),
  20. );
  21. }
  22. Size get preferredSize => DStyle.appBarHeight;
  23. }