feat : new app bar

This commit is contained in:
2025-08-05 08:04:04 +03:30
parent 2c10800ce7
commit 7b8cfb5ae9
2 changed files with 81 additions and 5 deletions

View File

@@ -11,7 +11,7 @@ class RAppBar extends StatelessWidget implements PreferredSizeWidget {
final TextStyle? titleTextStyle;
final VoidCallback? onBackPressed;
final List<Widget>? additionalActions;
final int? leadingWidth;
final double? leadingWidth;
final Widget? leading;
final PreferredSizeWidget? bottom;
@@ -80,3 +80,78 @@ class RAppBar extends StatelessWidget implements PreferredSizeWidget {
@override
Size get preferredSize => const Size.fromHeight(kToolbarHeight);
}
class RAppBar2 extends StatelessWidget implements PreferredSizeWidget {
final String? title;
final String? iconTitle;
final Color backgroundColor;
final Color iconColor;
final bool hasBack;
final bool centerTitle;
final TextStyle? titleTextStyle;
final VoidCallback? onBackPressed;
final List<Widget>? additionalActions;
final double? leadingWidth;
final Widget? leading;
final PreferredSizeWidget? bottom;
const RAppBar2({
super.key,
this.title,
this.iconTitle,
this.backgroundColor = AppColor.blueNormal,
this.iconColor = Colors.white,
this.titleTextStyle,
this.onBackPressed,
this.additionalActions,
this.leading,
this.hasBack = true,
this.centerTitle = false,
this.leadingWidth,
this.bottom,
});
@override
Widget build(BuildContext context) {
return AppBar(
automaticallyImplyLeading: false,
backgroundColor: backgroundColor,
elevation: 0,
excludeHeaderSemantics: true,
scrolledUnderElevation: 0,
centerTitle: centerTitle,
titleTextStyle: titleTextStyle ?? AppFonts.yekan16.copyWith(color: Colors.white),
title: Row(
children: [
if (leading != null) ...{
Padding(padding: const EdgeInsets.only(right: 6), child: leading),
},
if (title != null) ...[Text(title!), if (iconTitle != null) const SizedBox(width: 8)],
if (iconTitle != null) ...{const SizedBox(width: 8)},
if (iconTitle != null) ...{SvgGenImage.vec(iconTitle!).svg(width: 24, height: 24)},
],
),
titleSpacing: 8,
actions: [
if (additionalActions != null) ...additionalActions!,
if (hasBack) ...{
GestureDetector(
onTap: onBackPressed ?? () => Get.back(),
child: Padding(
padding: const EdgeInsets.fromLTRB(10, 0, 2, 0),
child: Assets.vec.arrowLeftSvg.svg(
width: 24.w,
height: 24.h,
colorFilter: ColorFilter.mode(iconColor ?? Colors.white, BlendMode.srcIn),
),
),
),
},
],
bottom: bottom,
);
}
@override
Size get preferredSize => const Size.fromHeight(kToolbarHeight);
}

View File

@@ -2,7 +2,7 @@ import 'package:flutter/material.dart';
import 'package:rasadyar_core/core.dart';
import 'package:rasadyar_livestock/presentation/widgets/base_page/logic.dart';
RAppBar liveStockAppBar({
RAppBar2 liveStockAppBar({
bool hasBack = true,
bool hasFilter = true,
bool hasSearch = true,
@@ -10,16 +10,17 @@ RAppBar liveStockAppBar({
VoidCallback? onBackPressed,
GestureTapCallback? onFilterTap,
GestureTapCallback? onSearchTap,
String? title,
}) {
return RAppBar(
return RAppBar2(
hasBack: isBase == true ? false : hasBack,
onBackPressed: onBackPressed,
leadingWidth: 155,
leadingWidth: 180.w,
leading: Row(
mainAxisSize: MainAxisSize.min,
spacing: 6,
children: [
Text('رصددام', style: AppFonts.yekan16Bold.copyWith(color: Colors.white)),
Text(title ?? 'رصددام', style: AppFonts.yekan16Bold.copyWith(color: Colors.white)),
Assets.vec.appBarInspectionSvg.svg(width: 24, height: 24),
],
),