feat : app bar widget
This commit is contained in:
53
packages/core/lib/presentation/widget/app_bar/r_app_bar.dart
Normal file
53
packages/core/lib/presentation/widget/app_bar/r_app_bar.dart
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
import 'package:rasadyar_core/presentation/common/app_color.dart';
|
||||||
|
import 'package:rasadyar_core/presentation/common/app_fonts.dart';
|
||||||
|
|
||||||
|
class RAppBar extends StatelessWidget implements PreferredSizeWidget {
|
||||||
|
final String title;
|
||||||
|
final Color backgroundColor;
|
||||||
|
final Color iconColor;
|
||||||
|
final TextStyle? titleTextStyle;
|
||||||
|
final VoidCallback? onBackPressed;
|
||||||
|
final List<Widget>? additionalActions;
|
||||||
|
|
||||||
|
const RAppBar({
|
||||||
|
super.key,
|
||||||
|
required this.title,
|
||||||
|
this.backgroundColor = AppColor.lightGreyLight,
|
||||||
|
this.iconColor = AppColor.blueNormal,
|
||||||
|
this.titleTextStyle,
|
||||||
|
this.onBackPressed,
|
||||||
|
this.additionalActions,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return AppBar(
|
||||||
|
automaticallyImplyLeading: false,
|
||||||
|
backgroundColor: backgroundColor,
|
||||||
|
elevation: 0,
|
||||||
|
excludeHeaderSemantics: true,
|
||||||
|
scrolledUnderElevation: 0,
|
||||||
|
titleTextStyle:
|
||||||
|
titleTextStyle ??
|
||||||
|
AppFonts.yekan16.copyWith(color: AppColor.blueNormal),
|
||||||
|
title: Text(title),
|
||||||
|
actions: [
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 8),
|
||||||
|
child: IconButton(
|
||||||
|
onPressed: onBackPressed ?? () => Get.back(),
|
||||||
|
icon: const Icon(CupertinoIcons.chevron_back),
|
||||||
|
color: iconColor,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
if (additionalActions != null) ...additionalActions!,
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Size get preferredSize => const Size.fromHeight(kToolbarHeight);
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user