feat : buy page and widgets
This commit is contained in:
15
packages/chicken/lib/presentation/pages/buy/logic.dart
Normal file
15
packages/chicken/lib/presentation/pages/buy/logic.dart
Normal file
@@ -0,0 +1,15 @@
|
||||
import 'package:get/get.dart';
|
||||
|
||||
class BuyLogic extends GetxController {
|
||||
@override
|
||||
void onReady() {
|
||||
// TODO: implement onReady
|
||||
super.onReady();
|
||||
}
|
||||
|
||||
@override
|
||||
void onClose() {
|
||||
// TODO: implement onClose
|
||||
super.onClose();
|
||||
}
|
||||
}
|
||||
34
packages/chicken/lib/presentation/pages/buy/view.dart
Normal file
34
packages/chicken/lib/presentation/pages/buy/view.dart
Normal file
@@ -0,0 +1,34 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:rasadyar_chicken/presentation/widget/app_bar.dart';
|
||||
import 'package:rasadyar_chicken/presentation/widget/base_page.dart';
|
||||
import 'package:rasadyar_chicken/presentation/widget/sale_buy_card_item.dart';
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
|
||||
import 'logic.dart';
|
||||
|
||||
class BuyPage extends GetView<BuyLogic> {
|
||||
const BuyPage({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BasePage(
|
||||
routes: ['رصدطیور', 'خرید'],
|
||||
appBar: chickenAppBar(isBase: true),
|
||||
widgets: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Wrap(
|
||||
alignment: WrapAlignment.center,
|
||||
spacing: 14.w,
|
||||
children: [
|
||||
saleOrBuyItemCard(title: 'داخل استان', iconPath: Assets.vec.cubeSvg.path, onTap: () {}),
|
||||
saleOrBuyItemCard(title: 'خارج استان', iconPath: Assets.vec.truckFastSvg.path, onTap: () {}),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@ import 'package:rasadyar_chicken/data/models/response/inventory/inventory_model.
|
||||
import 'package:rasadyar_chicken/data/models/response/iran_province_city/iran_province_city_model.dart';
|
||||
import 'package:rasadyar_chicken/data/repositories/chicken_repository.dart';
|
||||
import 'package:rasadyar_chicken/data/repositories/chicken_repository_imp.dart';
|
||||
import 'package:rasadyar_chicken/presentation/pages/buy/view.dart';
|
||||
import 'package:rasadyar_chicken/presentation/pages/home/view.dart';
|
||||
import 'package:rasadyar_chicken/presentation/pages/out_of_province/view.dart';
|
||||
import 'package:rasadyar_chicken/presentation/pages/sales_in_province/view.dart';
|
||||
@@ -17,7 +18,7 @@ enum ErrorLocationType { serviceDisabled, permissionDenied, none }
|
||||
class RootLogic extends GetxController {
|
||||
RxInt currentPage = 2.obs;
|
||||
List<Widget> pages = [
|
||||
SalesInProvincePage(),
|
||||
BuyPage(),
|
||||
OutOfProvincePage(),
|
||||
HomePage(),
|
||||
Container(color: Colors.blue),
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
import 'package:rasadyar_auth/auth.dart';
|
||||
import 'package:rasadyar_chicken/presentation/pages/buy/logic.dart';
|
||||
import 'package:rasadyar_chicken/presentation/pages/buy/view.dart';
|
||||
import 'package:rasadyar_chicken/presentation/pages/buys_out_of_province/logic.dart';
|
||||
import 'package:rasadyar_chicken/presentation/pages/buys_out_of_province/view.dart';
|
||||
import 'package:rasadyar_chicken/presentation/pages/entering_the_warehouse/logic.dart';
|
||||
@@ -26,10 +28,11 @@ sealed class ChickenPages {
|
||||
middlewares: [AuthMiddleware()],
|
||||
binding: BindingsBuilder(() {
|
||||
Get.put(RootLogic());
|
||||
Get.lazyPut(()=>HomeLogic());
|
||||
Get.lazyPut(()=>SalesInProvinceLogic());
|
||||
Get.lazyPut(()=>OutOfProvinceLogic());
|
||||
Get.lazyPut(()=>SalesOutOfProvinceLogic());
|
||||
Get.lazyPut(() => HomeLogic());
|
||||
Get.lazyPut(() => BuyLogic());
|
||||
Get.lazyPut(() => SalesInProvinceLogic());
|
||||
Get.lazyPut(() => OutOfProvinceLogic());
|
||||
Get.lazyPut(() => SalesOutOfProvinceLogic());
|
||||
}),
|
||||
),
|
||||
|
||||
@@ -48,8 +51,8 @@ sealed class ChickenPages {
|
||||
page: () => EnteringTheWarehousePage(),
|
||||
middlewares: [AuthMiddleware()],
|
||||
binding: BindingsBuilder(() {
|
||||
Get.lazyPut(()=>EnteringTheWarehouseLogic());
|
||||
Get.lazyPut(()=>RootLogic());
|
||||
Get.lazyPut(() => EnteringTheWarehouseLogic());
|
||||
Get.lazyPut(() => RootLogic());
|
||||
}),
|
||||
),
|
||||
GetPage(
|
||||
@@ -57,22 +60,20 @@ sealed class ChickenPages {
|
||||
page: () => SalesInProvincePage(),
|
||||
middlewares: [AuthMiddleware()],
|
||||
binding: BindingsBuilder(() {
|
||||
Get.lazyPut(()=>SalesInProvinceLogic());
|
||||
Get.lazyPut(()=>RootLogic());
|
||||
Get.lazyPut(() => SalesInProvinceLogic());
|
||||
Get.lazyPut(() => RootLogic());
|
||||
}),
|
||||
),
|
||||
|
||||
|
||||
|
||||
GetPage(
|
||||
name: ChickenRoutes.outOfProvince,
|
||||
page: () => OutOfProvincePage(),
|
||||
middlewares: [AuthMiddleware()],
|
||||
binding: BindingsBuilder(() {
|
||||
Get.lazyPut(()=>OutOfProvinceLogic());
|
||||
Get.lazyPut(() => OutOfProvinceLogic());
|
||||
|
||||
Get.lazyPut(()=>SalesOutOfProvinceLogic());
|
||||
Get.lazyPut(()=>RootLogic());
|
||||
Get.lazyPut(() => SalesOutOfProvinceLogic());
|
||||
Get.lazyPut(() => RootLogic());
|
||||
}),
|
||||
),
|
||||
|
||||
@@ -81,8 +82,8 @@ sealed class ChickenPages {
|
||||
page: () => SalesOutOfProvincePage(),
|
||||
middlewares: [AuthMiddleware()],
|
||||
binding: BindingsBuilder(() {
|
||||
Get.lazyPut(()=>SalesOutOfProvinceLogic());
|
||||
Get.lazyPut(()=>RootLogic());
|
||||
Get.lazyPut(() => SalesOutOfProvinceLogic());
|
||||
Get.lazyPut(() => RootLogic());
|
||||
}),
|
||||
),
|
||||
|
||||
@@ -91,9 +92,11 @@ sealed class ChickenPages {
|
||||
page: () => BuysOutOfProvincePage(),
|
||||
middlewares: [AuthMiddleware()],
|
||||
binding: BindingsBuilder(() {
|
||||
Get.lazyPut(()=>BuysOutOfProvinceLogic());
|
||||
Get.lazyPut(()=>RootLogic());
|
||||
Get.lazyPut(() => BuysOutOfProvinceLogic());
|
||||
Get.lazyPut(() => RootLogic());
|
||||
}),
|
||||
),
|
||||
|
||||
|
||||
];
|
||||
}
|
||||
|
||||
@@ -2,8 +2,9 @@ sealed class ChickenRoutes {
|
||||
ChickenRoutes._();
|
||||
|
||||
static const _base = '/init';
|
||||
static const init = '$_base/init';
|
||||
static const init = '$_base/root';
|
||||
static const home = '$_base/home';
|
||||
static const buy = '$_base/buy';
|
||||
|
||||
static const enteringTheWarehouse = '$_base/enteringTheWarehouse';
|
||||
static const salesInProvince = '$_base/SalesInProvincePage';
|
||||
|
||||
@@ -5,12 +5,13 @@ RAppBar chickenAppBar({
|
||||
bool hasBack = true,
|
||||
bool hasFilter = true,
|
||||
bool hasSearch = true,
|
||||
bool isBase = false,
|
||||
VoidCallback? onBackPressed,
|
||||
GestureTapCallback? onFilterTap,
|
||||
GestureTapCallback? onSearchTap,
|
||||
}) {
|
||||
return RAppBar(
|
||||
hasBack: hasBack,
|
||||
hasBack: isBase == true ? false : hasBack,
|
||||
onBackPressed: onBackPressed,
|
||||
leadingWidth: 155,
|
||||
leading: Row(
|
||||
@@ -26,9 +27,9 @@ RAppBar chickenAppBar({
|
||||
],
|
||||
),
|
||||
additionalActions: [
|
||||
if (hasFilter) filterWidget(onFilterTap),
|
||||
if (!isBase && hasFilter) filterWidget(onFilterTap),
|
||||
SizedBox(width: 8),
|
||||
if (hasSearch) searchWidget(onSearchTap),
|
||||
if (!isBase && hasSearch) searchWidget(onSearchTap),
|
||||
SizedBox(width: 8),
|
||||
],
|
||||
);
|
||||
|
||||
20
packages/chicken/lib/presentation/widget/base_page.dart
Normal file
20
packages/chicken/lib/presentation/widget/base_page.dart
Normal file
@@ -0,0 +1,20 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:rasadyar_chicken/presentation/widget/page_route.dart';
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
|
||||
class BasePage extends StatelessWidget {
|
||||
const BasePage({super.key, required this.routes, required this.appBar, required this.widgets});
|
||||
|
||||
final List<String> routes;
|
||||
final RAppBar appBar;
|
||||
final List<Widget> widgets;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: AppColor.bgLight,
|
||||
appBar: appBar,
|
||||
body: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [buildPageRoute(routes), ...widgets]),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,9 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
|
||||
Text buildPageRoute(List<String> route) {
|
||||
return Text(route.isEmpty ? 'خانه' : route.join("/"), style: AppFonts.yekan14.copyWith(color: AppColor.bgDark));
|
||||
Widget buildPageRoute(List<String> route) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.fromLTRB(0, 4, 7, 8),
|
||||
child: Text(route.isEmpty ? 'خانه' : route.join("/"), style: AppFonts.yekan14.copyWith(color: AppColor.bgDark)),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
|
||||
Widget saleOrBuyItemCard({String? title, String? iconPath, required VoidCallback onTap}) {
|
||||
return InkWell(
|
||||
onTap: onTap,
|
||||
child: Card(
|
||||
color: Colors.white,
|
||||
shape: RoundedRectangleBorder(
|
||||
side: BorderSide(color: AppColor.blueNormal, width: 1.0.w),
|
||||
borderRadius: BorderRadius.circular(8.r),
|
||||
),
|
||||
child: Container(
|
||||
width: 160.w,
|
||||
height: 160.h,
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
if (iconPath != null)
|
||||
SvgGenImage.vec(iconPath).svg(
|
||||
width: 64.w,
|
||||
height: 64.h,
|
||||
colorFilter: const ColorFilter.mode(AppColor.blueNormal, BlendMode.srcIn),
|
||||
),
|
||||
SizedBox(height: 12.h),
|
||||
if (title != null) Text(title, style: AppFonts.yekan16Bold.copyWith(color: AppColor.blueNormal)),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -12,6 +12,7 @@ export 'package:device_info_plus/device_info_plus.dart';
|
||||
export 'package:dio/dio.dart' ;
|
||||
export 'package:pretty_dio_logger/pretty_dio_logger.dart';
|
||||
export 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
|
||||
//freezed
|
||||
export 'package:freezed_annotation/freezed_annotation.dart';
|
||||
export 'package:geolocator/geolocator.dart';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
name: rasadyar_core
|
||||
description: "A new Flutter project."
|
||||
publish_to: 'none'
|
||||
publish_to: none
|
||||
version: 1.0.0+1
|
||||
|
||||
environment:
|
||||
|
||||
Reference in New Issue
Block a user