fix : Appbar chicken
This commit is contained in:
@@ -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/inventory/inventory_model.dart';
|
||||||
import 'package:rasadyar_chicken/data/models/response/kill_house_distribution_info/kill_house_distribution_info.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/routes/routes.dart';
|
||||||
|
import 'package:rasadyar_chicken/presentation/widget/app_bar.dart';
|
||||||
import 'package:rasadyar_core/core.dart';
|
import 'package:rasadyar_core/core.dart';
|
||||||
|
|
||||||
import 'logic.dart';
|
import 'logic.dart';
|
||||||
@@ -14,15 +15,11 @@ class HomePage extends GetView<HomeLogic> {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
backgroundColor: AppColor.bgLight,
|
backgroundColor: AppColor.bgLight,
|
||||||
appBar: RAppBar(
|
appBar: chickenAppBar(
|
||||||
title: 'رصدطیور',
|
|
||||||
iconTitle: Assets.vec.chickenSvg.path,
|
|
||||||
titleTextStyle: AppFonts.yekan16Bold.copyWith(color: Colors.white),
|
|
||||||
centerTitle: true,
|
|
||||||
hasBack: false,
|
hasBack: false,
|
||||||
leading: Row(
|
hasFilter: false,
|
||||||
children: [Text('مباشر', style: AppFonts.yekan16Bold.copyWith(color: Colors.white))],
|
hasSearch: false
|
||||||
),
|
|
||||||
),
|
),
|
||||||
body: Column(
|
body: Column(
|
||||||
spacing: 8,
|
spacing: 8,
|
||||||
|
|||||||
57
packages/chicken/lib/presentation/widget/app_bar.dart
Normal file
57
packages/chicken/lib/presentation/widget/app_bar.dart
Normal 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),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -1,4 +1,3 @@
|
|||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:rasadyar_core/core.dart';
|
import 'package:rasadyar_core/core.dart';
|
||||||
|
|
||||||
@@ -18,7 +17,7 @@ class RAppBar extends StatelessWidget implements PreferredSizeWidget {
|
|||||||
|
|
||||||
const RAppBar({
|
const RAppBar({
|
||||||
super.key,
|
super.key,
|
||||||
this.title,
|
this.title,
|
||||||
this.iconTitle,
|
this.iconTitle,
|
||||||
this.backgroundColor = AppColor.blueNormal,
|
this.backgroundColor = AppColor.blueNormal,
|
||||||
this.iconColor = Colors.white,
|
this.iconColor = Colors.white,
|
||||||
@@ -41,29 +40,33 @@ class RAppBar extends StatelessWidget implements PreferredSizeWidget {
|
|||||||
excludeHeaderSemantics: true,
|
excludeHeaderSemantics: true,
|
||||||
scrolledUnderElevation: 0,
|
scrolledUnderElevation: 0,
|
||||||
centerTitle: centerTitle,
|
centerTitle: centerTitle,
|
||||||
|
|
||||||
titleTextStyle: titleTextStyle ?? AppFonts.yekan16.copyWith(color: Colors.white),
|
titleTextStyle: titleTextStyle ?? AppFonts.yekan16.copyWith(color: Colors.white),
|
||||||
title:title != null ? Row(
|
title: title != null
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
? Row(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
mainAxisSize: MainAxisSize.min,
|
||||||
Text(title!),
|
children: [
|
||||||
if (iconTitle != null) ...{const SizedBox(width: 8)},
|
Text(title!),
|
||||||
if (iconTitle != null) ...{SvgGenImage.vec(iconTitle!).svg(width: 24, height: 24)},
|
if (iconTitle != null) ...{const SizedBox(width: 8)},
|
||||||
],
|
if (iconTitle != null) ...{SvgGenImage.vec(iconTitle!).svg(width: 24, height: 24)},
|
||||||
): null,
|
],
|
||||||
|
)
|
||||||
|
: null,
|
||||||
leadingWidth: leadingWidth?.toDouble(),
|
leadingWidth: leadingWidth?.toDouble(),
|
||||||
leading: leading != null ? Padding(padding: const EdgeInsets.only(right: 6), child: leading) : null,
|
leading: leading != null ? Padding(padding: const EdgeInsets.only(right: 6), child: leading) : null,
|
||||||
titleSpacing: 8,
|
titleSpacing: 8,
|
||||||
actions: [
|
actions: [
|
||||||
if (additionalActions != null) ...additionalActions!,
|
if (additionalActions != null) ...additionalActions!,
|
||||||
if (hasBack) ...{
|
if (hasBack) ...{
|
||||||
Padding(
|
GestureDetector(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 8),
|
onTap: onBackPressed ?? () => Get.back(),
|
||||||
child: IconButton(
|
child: Padding(
|
||||||
onPressed: onBackPressed ?? () => Get.back(),
|
padding: const EdgeInsets.fromLTRB(10, 0, 2, 0),
|
||||||
icon: const Icon(CupertinoIcons.chevron_back),
|
child: Assets.vec.arrowLeftSvg.svg(
|
||||||
color: iconColor,
|
width: 24.w,
|
||||||
|
height: 24.h,
|
||||||
|
colorFilter: ColorFilter.mode(iconColor ?? Colors.white, BlendMode.srcIn),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user