starwork_flutter/lib/common/widgets/custom_app_bar_widget.dart

51 lines
1.3 KiB
Dart

import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
class CustomAppBarWidget extends StatelessWidget implements PreferredSizeWidget {
final String title;
final List<Widget>? actions;
final VoidCallback? onBack;
final Color? backgroundColor;
const CustomAppBarWidget({
Key? key,
required this.title,
this.actions,
this.onBack,
this.backgroundColor,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return AppBar(
backgroundColor: backgroundColor ?? Colors.white,
elevation: 0,
surfaceTintColor: Colors.transparent,
shadowColor: Colors.transparent,
scrolledUnderElevation: 0,
leading: IconButton(
icon: const Icon(Icons.arrow_back_ios_new_rounded),
onPressed: onBack ?? () {
Navigator.of(context).pop();
},
),
title: Row(
children: [
Text(
title.tr,
style: TextStyle(
fontSize: 18.sp,
fontWeight: FontWeight.w500,
color: Colors.black87,
),
),
],
),
actions: actions,
);
}
@override
Size get preferredSize => const Size.fromHeight(kToolbarHeight);
}