refactor : base page
This commit is contained in:
@@ -11,11 +11,13 @@ class ActiveHatchingPage extends GetView<ActiveHatchingLogic> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BasePage(
|
||||
return ChickenBasePage(
|
||||
hasSearch: false,
|
||||
hasFilter: false,
|
||||
routesWidget: buildContainerPageRoute(controller.routesName),
|
||||
onBackPressed: () => Get.back(id: poultryFirstKey),
|
||||
backId: poultryFirstKey,
|
||||
|
||||
//routesWidget: buildContainerPageRoute(controller.routesName),
|
||||
|
||||
child: Stack(
|
||||
children: [
|
||||
Positioned.fill(
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:rasadyar_chicken/data/models/response/poultry_farm/poultry_farm.dart';
|
||||
import 'package:rasadyar_chicken/presentation/utils/nested_keys_utils.dart';
|
||||
import 'package:rasadyar_core/presentation/widget/base_page/widgets/back_ground_widget.dart';
|
||||
import 'package:rasadyar_chicken/presentation/widget/base_page/view.dart';
|
||||
import 'package:rasadyar_chicken/presentation/widget/page_route.dart';
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
|
||||
import 'logic.dart';
|
||||
@@ -13,18 +11,13 @@ class FarmPage extends GetView<FarmLogic> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BasePage(
|
||||
return ChickenBasePage(
|
||||
hasFilter: false,
|
||||
hasSearch: false,
|
||||
isBase: true,
|
||||
routes: [],
|
||||
onBackPressed: () => Get.back(id: poultryFirstKey),
|
||||
child: Stack(
|
||||
children: [
|
||||
Positioned.fill(child: chickenBackground()),
|
||||
Positioned.fill(child: Column(children: [firstTagInformation(), farmListWidget()])),
|
||||
],
|
||||
),
|
||||
backId: poultryFirstKey,
|
||||
widgets: [firstTagInformation(), farmListWidget()],
|
||||
);
|
||||
}
|
||||
|
||||
@@ -83,7 +76,10 @@ class FarmPage extends GetView<FarmLogic> {
|
||||
Container itemListExpandedWidget(PoultryFarm item) {
|
||||
return Container(
|
||||
padding: EdgeInsets.symmetric(horizontal: 8),
|
||||
decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(8)),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: Column(
|
||||
spacing: 8,
|
||||
children: [
|
||||
@@ -132,10 +128,19 @@ class FarmPage extends GetView<FarmLogic> {
|
||||
),
|
||||
),
|
||||
|
||||
buildRow(title: 'مالک/ تلفن', value: '${item.user?.fullname} (${item.user?.mobile})'),
|
||||
buildRow(
|
||||
title: 'مالک/ تلفن',
|
||||
value: '${item.user?.fullname} (${item.user?.mobile})',
|
||||
),
|
||||
buildRow(title: 'شناسه یکتا', value: item.breedingUniqueId ?? 'N/A'),
|
||||
buildRow(title: 'کد اپیدمیولوژیک', value: item.epidemiologicalCode ?? 'N/A'),
|
||||
buildRow(title: 'کد بهداشتی', value: item.healthCertificateNumber ?? 'N/A'),
|
||||
buildRow(
|
||||
title: 'کد اپیدمیولوژیک',
|
||||
value: item.epidemiologicalCode ?? 'N/A',
|
||||
),
|
||||
buildRow(
|
||||
title: 'کد بهداشتی',
|
||||
value: item.healthCertificateNumber ?? 'N/A',
|
||||
),
|
||||
buildRow(
|
||||
title: 'دامپزشک فارم',
|
||||
value: '${item.vetFarm?.fullName} (${item.vetFarm?.mobile ?? '-'})',
|
||||
|
||||
@@ -14,16 +14,16 @@ class GenocidePage extends GetView<GenocideLogic> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BasePage(
|
||||
routesWidget: buildContainerPageRoute(controller.routesName),
|
||||
return ChickenBasePage(
|
||||
routes:controller.routesName,
|
||||
hasSearch: true,
|
||||
hasFilter: true,
|
||||
onSearchChanged: (data) {
|
||||
controller.searchedValue.value = data;
|
||||
controller.getPoultryOrderList();
|
||||
},
|
||||
backId: poultryFirstKey,
|
||||
filteringWidget: filterBottomSheet(),
|
||||
onBackPressed: () => Get.back(id: poultryFirstKey),
|
||||
child: Stack(
|
||||
fit: StackFit.expand,
|
||||
children: [
|
||||
|
||||
@@ -11,7 +11,7 @@ class BuyPage extends GetView<BuyLogic> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BasePage(
|
||||
return ChickenBasePage(
|
||||
routes: controller.routesName,
|
||||
isBase: true,
|
||||
widgets: [
|
||||
|
||||
@@ -13,9 +13,10 @@ class BuyInProvincePage extends GetView<BuyInProvinceLogic> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BasePage(
|
||||
routesWidget: ObxValue((route) => buildPageRoute(route), controller.routesName),
|
||||
onBackPressed: () => Get.back(id: 0),
|
||||
return ChickenBasePage(
|
||||
routes: controller.routesName,
|
||||
//todo
|
||||
backId:0,
|
||||
onSearchChanged: (data) => controller.setSearchValue(data),
|
||||
filteringWidget: filterBottomSheet(),
|
||||
widgets: [
|
||||
|
||||
@@ -19,9 +19,10 @@ class BuyOutOfProvincePage extends GetView<BuyOutOfProvinceLogic> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BasePage(
|
||||
return ChickenBasePage(
|
||||
routes: controller.routesName,
|
||||
onBackPressed: () => Get.back(id: 0),
|
||||
backId: 0,
|
||||
|
||||
onSearchChanged: (data) => controller.setSearchValue(data),
|
||||
filteringWidget: filterBottomSheet(),
|
||||
widgets: [
|
||||
|
||||
@@ -12,7 +12,7 @@ class SalePage extends GetView<SaleLogic> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BasePage(
|
||||
return ChickenBasePage(
|
||||
routes: controller.routesName,
|
||||
isBase: true,
|
||||
widgets: [
|
||||
|
||||
@@ -18,9 +18,10 @@ class SalesInProvincePage extends GetView<SalesInProvinceLogic> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
body: BasePage(
|
||||
routesWidget: ObxValue((route) => buildPageRoute(route), controller.routesName),
|
||||
onBackPressed: () => Get.back(id: 1),
|
||||
body: ChickenBasePage(
|
||||
|
||||
routes: controller.routesName,
|
||||
backId:1,
|
||||
onSearchChanged: (data) => controller.setSearchValue(data),
|
||||
filteringWidget: filterBottomSheet(),
|
||||
widgets: [
|
||||
|
||||
@@ -19,9 +19,9 @@ class SalesOutOfProvincePage extends GetView<SalesOutOfProvinceLogic> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BasePage(
|
||||
routesWidget: ObxValue((route) => buildPageRoute(route), controller.routesName),
|
||||
onBackPressed: () => Get.back(id: 1),
|
||||
return ChickenBasePage(
|
||||
routes: controller.routesName,
|
||||
backId: 1,
|
||||
onSearchChanged: (data) => controller.setSearchValue(data),
|
||||
filteringWidget: filterBottomSheet(),
|
||||
widgets: [
|
||||
|
||||
@@ -15,9 +15,9 @@ class SalesOutOfProvinceBuyersPage extends GetView<SalesOutOfProvinceBuyersLogic
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BasePage(
|
||||
routesWidget: ObxValue((route) => buildPageRoute(route), controller.routesName),
|
||||
onBackPressed: () => Get.back(id: 1),
|
||||
return ChickenBasePage(
|
||||
routes: controller.routesName,
|
||||
backId: 1,
|
||||
onSearchChanged: (data) => controller.setSearchValue(data),
|
||||
filteringWidget: filterBottomSheet(),
|
||||
widgets: [
|
||||
|
||||
@@ -14,7 +14,7 @@ import 'logic.dart';
|
||||
class SegmentationPage extends GetView<SegmentationLogic> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BasePage(
|
||||
return ChickenBasePage(
|
||||
routes: controller.routesName,
|
||||
onSearchChanged: (data) => controller.setSearchValue(data),
|
||||
filteringWidget: filterBottomSheet(),
|
||||
|
||||
@@ -23,6 +23,7 @@ RAppBar chickenAppBar({
|
||||
hasNews: hasNews,
|
||||
isBase: isBase,
|
||||
backId: backId,
|
||||
hasFilter: hasFilter,
|
||||
onSearchTap: onSearchTap,
|
||||
onBackTap: onBackTap,
|
||||
onNotificationTap: onNotificationTap,
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
|
||||
BackGroundWidget chickenBackground() {
|
||||
return BackGroundWidget(
|
||||
gradient: LinearGradient(
|
||||
begin: Alignment(1.00, 0.01),
|
||||
end: Alignment(0.04, 0.99),
|
||||
colors: [
|
||||
const Color(0xFFD6DCEF).withValues(alpha: .8),
|
||||
const Color(0xFFD6E6E9).withValues(alpha: .8),
|
||||
const Color(0xFFD6E4E3).withValues(alpha: .8),
|
||||
],
|
||||
),
|
||||
vecPath: Assets.vec.chickenPatternSvg.path,
|
||||
);
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:rasadyar_chicken/presentation/widget/app_bar.dart';
|
||||
import 'package:rasadyar_chicken/presentation/widget/base_page/back_ground.dart';
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
|
||||
class ChickenBasePage extends GetView<BaseLogic> {
|
||||
@@ -25,8 +26,8 @@ class ChickenBasePage extends GetView<BaseLogic> {
|
||||
this.scrollable = false,
|
||||
this.floatingActionButtonLocation,
|
||||
this.floatingActionButton,
|
||||
|
||||
this.filteringWidget,
|
||||
this.backGroundWidget,
|
||||
}) : assert(
|
||||
(routes != null) || routesWidget != null,
|
||||
'Either routes or routesWidget must be provided.',
|
||||
@@ -58,6 +59,8 @@ class ChickenBasePage extends GetView<BaseLogic> {
|
||||
final Widget? filteringWidget;
|
||||
final void Function(String?)? onSearchChanged;
|
||||
|
||||
final BackGroundWidget? backGroundWidget;
|
||||
|
||||
void _onFilterTap() {
|
||||
if (hasFilter && filteringWidget != null) {
|
||||
final currentRoute = ModalRoute.of(Get.context!);
|
||||
@@ -82,6 +85,7 @@ class ChickenBasePage extends GetView<BaseLogic> {
|
||||
scrollable: scrollable,
|
||||
floatingActionButtonLocation: floatingActionButtonLocation,
|
||||
floatingActionButton: floatingActionButton,
|
||||
backGroundWidget: backGroundWidget ?? chickenBackground(),
|
||||
appBar: chickenAppBar(
|
||||
isBase: isBase,
|
||||
hasBack: isBase ? false : hasBack,
|
||||
|
||||
Reference in New Issue
Block a user