app_bar.dart 820 B

1234567891011121314151617181920212223242526272829
  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. final PreferredSizeWidget bottom;
  9. DAppBar(this.title, { this.autoLeading = true, this.actions, this.bottom });
  10. @override
  11. Widget build(BuildContext context) {
  12. return PreferredSize(
  13. preferredSize: preferredSize,
  14. child: AppBar(
  15. centerTitle: true,
  16. automaticallyImplyLeading: autoLeading,
  17. title: Text(title, style: DText.appBar),
  18. backgroundColor: DColors.Main,
  19. actions: actions,
  20. bottom: bottom,
  21. ),
  22. );
  23. }
  24. Size get preferredSize => DStyle.appBarWithBottom(bottom);
  25. }