we_app_bar.dart
818 Bytes
import 'package:flutter/material.dart';
class WEAppBar extends StatelessWidget implements PreferredSizeWidget {
final String? titleText;
final bool? centerTitle;
final VoidCallback? onBack;
final Color? backgroundColor;
final PreferredSizeWidget? bottom;
const WEAppBar({
this.titleText,
this.centerTitle = true,
this.onBack,
this.backgroundColor,
this.bottom,
super.key});
@override
Widget build(BuildContext context) {
return AppBar(
centerTitle: centerTitle,
title: Text(titleText??''),
backgroundColor: backgroundColor??Theme.of(context).colorScheme.inversePrimary,
);
}
@override
// TODO: implement preferredSize
Size get preferredSize => Size.fromHeight(
kToolbarHeight + (bottom == null ? 0.0 : bottom!.preferredSize.height));
}