fix : Appbar chicken

This commit is contained in:
2025-06-30 09:11:33 +03:30
parent 898f870b54
commit 48f050a122
3 changed files with 83 additions and 26 deletions

View File

@@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
import 'package:rasadyar_chicken/data/models/response/inventory/inventory_model.dart';
import 'package:rasadyar_chicken/data/models/response/kill_house_distribution_info/kill_house_distribution_info.dart';
import 'package:rasadyar_chicken/presentation/routes/routes.dart';
import 'package:rasadyar_chicken/presentation/widget/app_bar.dart';
import 'package:rasadyar_core/core.dart';
import 'logic.dart';
@@ -14,15 +15,11 @@ class HomePage extends GetView<HomeLogic> {
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: AppColor.bgLight,
appBar: RAppBar(
title: 'رصدطیور',
iconTitle: Assets.vec.chickenSvg.path,
titleTextStyle: AppFonts.yekan16Bold.copyWith(color: Colors.white),
centerTitle: true,
appBar: chickenAppBar(
hasBack: false,
leading: Row(
children: [Text('مباشر', style: AppFonts.yekan16Bold.copyWith(color: Colors.white))],
),
hasFilter: false,
hasSearch: false
),
body: Column(
spacing: 8,

View File

@@ -0,0 +1,57 @@
import 'package:flutter/material.dart';
import 'package:rasadyar_core/core.dart';
RAppBar chickenAppBar({
bool hasBack = true,
bool hasFilter = true,
bool hasSearch = true,
VoidCallback? onBackPressed,
GestureTapCallback? onFilterTap,
GestureTapCallback? onSearchTap,
}) {
return RAppBar(
hasBack: hasBack,
onBackPressed: onBackPressed,
leadingWidth: 155,
leading: Row(
mainAxisSize: MainAxisSize.min,
spacing: 6,
children: [
Text('رصدطیور', style: AppFonts.yekan16Bold.copyWith(color: Colors.white)),
Assets.vec.chickenSvg.svg(
width: 24,
height: 24,
colorFilter: const ColorFilter.mode(Colors.white, BlendMode.srcIn),
),
],
),
additionalActions: [
if (hasFilter) filterWidget(onFilterTap),
SizedBox(width: 8),
if (hasSearch) searchWidget(onSearchTap),
SizedBox(width: 8),
],
);
}
GestureDetector searchWidget(GestureTapCallback? onSearchTap) {
return GestureDetector(
onTap: onSearchTap,
child: Assets.vec.filterOutlineSvg.svg(
width: 20,
height: 20,
colorFilter: const ColorFilter.mode(Colors.white, BlendMode.srcIn),
),
);
}
GestureDetector filterWidget(GestureTapCallback? onFilterTap) {
return GestureDetector(
onTap: onFilterTap,
child: Assets.vec.searchSvg.svg(
width: 24,
height: 24,
colorFilter: const ColorFilter.mode(Colors.white, BlendMode.srcIn),
),
);
}

View File

@@ -1,4 +1,3 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:rasadyar_core/core.dart';
@@ -18,7 +17,7 @@ class RAppBar extends StatelessWidget implements PreferredSizeWidget {
const RAppBar({
super.key,
this.title,
this.title,
this.iconTitle,
this.backgroundColor = AppColor.blueNormal,
this.iconColor = Colors.white,
@@ -41,29 +40,33 @@ class RAppBar extends StatelessWidget implements PreferredSizeWidget {
excludeHeaderSemantics: true,
scrolledUnderElevation: 0,
centerTitle: centerTitle,
titleTextStyle: titleTextStyle ?? AppFonts.yekan16.copyWith(color: Colors.white),
title:title != null ? Row(
mainAxisAlignment: MainAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
children: [
Text(title!),
if (iconTitle != null) ...{const SizedBox(width: 8)},
if (iconTitle != null) ...{SvgGenImage.vec(iconTitle!).svg(width: 24, height: 24)},
],
): null,
title: title != null
? Row(
mainAxisAlignment: MainAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
children: [
Text(title!),
if (iconTitle != null) ...{const SizedBox(width: 8)},
if (iconTitle != null) ...{SvgGenImage.vec(iconTitle!).svg(width: 24, height: 24)},
],
)
: null,
leadingWidth: leadingWidth?.toDouble(),
leading: leading != null ? Padding(padding: const EdgeInsets.only(right: 6), child: leading) : null,
titleSpacing: 8,
actions: [
if (additionalActions != null) ...additionalActions!,
if (hasBack) ...{
Padding(
padding: const EdgeInsets.symmetric(horizontal: 8),
child: IconButton(
onPressed: onBackPressed ?? () => Get.back(),
icon: const Icon(CupertinoIcons.chevron_back),
color: iconColor,
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),
),
),
),
},