55 lines
1.4 KiB
Dart
55 lines
1.4 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:get/get.dart';
|
|
import 'package:penyaluran_app/app/theme/app_theme.dart';
|
|
|
|
class CustomAppBar extends StatelessWidget implements PreferredSizeWidget {
|
|
final String title;
|
|
final bool showBackButton;
|
|
final List<Widget>? actions;
|
|
final Widget? leading;
|
|
final bool centerTitle;
|
|
final double elevation;
|
|
final Color? backgroundColor;
|
|
final Color? foregroundColor;
|
|
|
|
const CustomAppBar({
|
|
super.key,
|
|
required this.title,
|
|
this.showBackButton = false,
|
|
this.actions,
|
|
this.leading,
|
|
this.centerTitle = true,
|
|
this.elevation = 0,
|
|
this.backgroundColor,
|
|
this.foregroundColor,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return AppBar(
|
|
title: Text(
|
|
title,
|
|
style: TextStyle(
|
|
fontSize: 18,
|
|
fontWeight: FontWeight.bold,
|
|
color: foregroundColor ?? Colors.white,
|
|
),
|
|
),
|
|
centerTitle: centerTitle,
|
|
elevation: elevation,
|
|
backgroundColor: backgroundColor ?? AppTheme.primaryColor,
|
|
foregroundColor: foregroundColor ?? Colors.white,
|
|
leading: showBackButton
|
|
? IconButton(
|
|
icon: const Icon(Icons.arrow_back, color: Colors.white),
|
|
onPressed: () => Get.back(),
|
|
)
|
|
: leading,
|
|
actions: actions,
|
|
);
|
|
}
|
|
|
|
@override
|
|
Size get preferredSize => const Size.fromHeight(kToolbarHeight);
|
|
}
|