
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:twong/config/style.dart';

class DAppBar extends StatelessWidget implements PreferredSizeWidget {
  final String title;
  final bool autoLeading;
  final List<Widget> actions;
  final PreferredSizeWidget bottom;
  DAppBar(this.title, { this.autoLeading = true, this.actions, this.bottom });

  @override
  Widget build(BuildContext context) {
    return PreferredSize(
      preferredSize: preferredSize,
      child: AppBar(
        centerTitle: true,
        automaticallyImplyLeading: autoLeading,
        title: Text(title, style: DText.appBar),
        backgroundColor: DColors.Main,
        actions: actions,
        bottom: bottom,
      ),
    );
  }

  Size get preferredSize => DStyle.appBarWithBottom(bottom);
}