Files
rasadyar_application/packages/chicken/lib/presentation/widget/app_bar.dart
2025-07-09 14:54:28 +03:30

97 lines
2.6 KiB
Dart

import 'package:flutter/material.dart';
import 'package:rasadyar_chicken/presentation/widget/base_page/logic.dart';
import 'package:rasadyar_chicken/presentation/widget/search/logic.dart';
import 'package:rasadyar_core/core.dart';
RAppBar chickenAppBar({
bool hasBack = true,
bool hasFilter = true,
bool hasSearch = true,
bool isBase = false,
VoidCallback? onBackPressed,
GestureTapCallback? onFilterTap,
GestureTapCallback? onSearchTap,
}) {
return RAppBar(
hasBack: isBase == true ? false : 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,
),
],
),
additionalActions: [
if (!isBase && hasSearch) searchWidget(onSearchTap),
SizedBox(width: 8),
if (!isBase && hasFilter) filterWidget(onFilterTap),
SizedBox(width: 8),
],
);
}
GestureDetector filterWidget(GestureTapCallback? onFilterTap) {
return GestureDetector(
onTap: onFilterTap,
child: Stack(
alignment: Alignment.topRight,
children: [
Assets.vec.filterOutlineSvg.svg(
width: 20,
height: 20,
colorFilter: const ColorFilter.mode(Colors.white, BlendMode.srcIn),
),
Obx(() {
final controller = Get.find<BaseLogic>();
return Visibility(
visible: controller.isFilterSelected.value,
child: Container(
width: 8,
height: 8,
decoration: const BoxDecoration(
color: Colors.red,
shape: BoxShape.circle,
),
),
);
}),
],
),
);
}
GestureDetector searchWidget(GestureTapCallback? onSearchTap) {
return GestureDetector(
onTap: onSearchTap,
child: Stack(
alignment: Alignment.topRight,
children: [
Assets.vec.searchSvg.svg(
width: 24,
height: 24,
colorFilter: const ColorFilter.mode(Colors.white, BlendMode.srcIn),
),
Obx(() {
final controller = Get.find<SearchLogic>();
return Visibility(
visible: controller.searchValue.value!=null,
child: Container(
width: 8,
height: 8,
decoration: const BoxDecoration(
color: Colors.red,
shape: BoxShape.circle,
),
),
);
}),
],
),
);
}