sc-android-app/lib/widgets/common_app_bar.dart

30 lines
954 B
Dart

import 'package:flutter/material.dart';
class CommonAppBar extends StatelessWidget implements PreferredSizeWidget {
final Widget title;
final List<Widget>? actions;
final PreferredSizeWidget? bottom;
const CommonAppBar({super.key, required this.title, this.actions, required Color backgroundColor, required int elevation, this.bottom});
@override
Widget build(BuildContext context) {
return AppBar(
centerTitle: true,
leading: Builder(builder: (context) {
return IconButton(
onPressed: () => Scaffold.of(context).openDrawer(),
icon: const Icon(Icons.menu),
color: Colors.white);
}),
backgroundColor: Colors.transparent,
bottom: bottom,
title: title,
toolbarHeight: kToolbarHeight+20,
actions: actions);
}
@override
Size get preferredSize => Size.fromHeight(kToolbarHeight + (bottom?.preferredSize.height ?? 0));
}