feat : package chicken and added to app

This commit is contained in:
MrM
2025-06-03 23:26:38 +03:30
parent 880ef4c175
commit 5d5956c7f2
18 changed files with 383 additions and 3 deletions

View File

@@ -25,7 +25,7 @@ class AuthService extends GetxService {
everAll([accessRes, refAccessRes], (_) { everAll([accessRes, refAccessRes], (_) {
if (accessRes.value && refAccessRes.value) { if (accessRes.value && refAccessRes.value) {
var targetPage = getTargetPage(tokenService.appModule.value); var targetPage = getTargetPage(tokenService.appModule.value);
Get.offAndToNamed(targetPage); Get.offAllNamed(targetPage);
} }
}); });
} }

View File

@@ -4,6 +4,8 @@ import 'package:rasadyar_app/presentation/pages/system_design/system_design.dart
import 'package:rasadyar_auth/auth.dart'; import 'package:rasadyar_auth/auth.dart';
import 'package:rasadyar_auth/data/models/local/user_local/user_local_model.dart'; import 'package:rasadyar_auth/data/models/local/user_local/user_local_model.dart';
import 'package:rasadyar_auth/presentation/routes/pages.dart'; import 'package:rasadyar_auth/presentation/routes/pages.dart';
import 'package:rasadyar_chicken/chicken.dart';
import 'package:rasadyar_chicken/presentation/routes/pages.dart';
import 'package:rasadyar_core/core.dart'; import 'package:rasadyar_core/core.dart';
import 'package:rasadyar_inspection/inspection.dart'; import 'package:rasadyar_inspection/inspection.dart';
import 'package:rasadyar_livestock/presentation/routes/app_pages.dart'; import 'package:rasadyar_livestock/presentation/routes/app_pages.dart';
@@ -27,6 +29,7 @@ sealed class AppPages {
...InspectionPages.pages, ...InspectionPages.pages,
...AuthPages.pages, ...AuthPages.pages,
...LiveStockPages.pages, ...LiveStockPages.pages,
...ChickenPages.pages,
]; ];
} }
@@ -37,7 +40,9 @@ String getTargetPage(Module? value) {
return InspectionRoutes.inspection; return InspectionRoutes.inspection;
case Module.liveStocks: case Module.liveStocks:
return LiveStockRoutes.init; return LiveStockRoutes.init;
case Module.chicken:
return ChickenRoutes.init;
default: default:
return InspectionRoutes.inspection; return ChickenRoutes.init;
} }
} }

11
lib/res/assets_res.dart Normal file
View File

@@ -0,0 +1,11 @@
// Generated file. Do not edit.
// This file is generated by the iFlutter
// ignore_for_file: constant_identifier_names
// ignore_for_file: lines_longer_than_80_chars
class AssetsRes {
AssetsRes._();
static const String PROJECT_NAME = 'rasadyar_app';
static const String PROJECT_VERSION = '1.2.0+2';
}

12
lib/res/font_res.dart Normal file
View File

@@ -0,0 +1,12 @@
// Generated file. Do not edit.
// This file is generated by the iFlutter
// ignore_for_file: constant_identifier_names
// ignore_for_file: lines_longer_than_80_chars
class FontRes {
FontRes._();
static const String PROJECT_NAME = 'rasadyar_app';
static const String PROJECT_VERSION = '1.2.0+2';
static const String IRANYEKANREGULARFANUM = 'iranyekanregularfanum';
}

7
packages/chicken/.gitignore vendored Normal file
View File

@@ -0,0 +1,7 @@
# https://dart.dev/guides/libraries/private-files
# Created by `dart pub`
.dart_tool/
# Avoid committing pubspec.lock for library packages; see
# https://dart.dev/guides/libraries/private-files#pubspeclock.
pubspec.lock

View File

@@ -0,0 +1,3 @@
## 1.0.0
- Initial version.

View File

@@ -0,0 +1,39 @@
<!--
This README describes the package. If you publish this package to pub.dev,
this README's contents appear on the landing page for your package.
For information about how to write a good package README, see the guide for
[writing package pages](https://dart.dev/tools/pub/writing-package-pages).
For general information about developing packages, see the Dart guide for
[creating packages](https://dart.dev/guides/libraries/create-packages)
and the Flutter guide for
[developing packages and plugins](https://flutter.dev/to/develop-packages).
-->
TODO: Put a short description of the package here that helps potential users
know whether this package might be useful for them.
## Features
TODO: List what your package can do. Maybe include images, gifs, or videos.
## Getting started
TODO: List prerequisites and provide or point to information on how to
start using the package.
## Usage
TODO: Include short and useful examples for package users. Add longer examples
to `/example` folder.
```dart
const like = 'sample';
```
## Additional information
TODO: Tell users more about the package: where to find more information, how to
contribute to the package, how to file issues, what response they can expect
from the package authors, and more.

View File

@@ -0,0 +1,30 @@
# This file configures the static analysis results for your project (errors,
# warnings, and lints).
#
# This enables the 'recommended' set of lints from `package:lints`.
# This set helps identify many issues that may lead to problems when running
# or consuming Dart code, and enforces writing Dart using a single, idiomatic
# style and format.
#
# If you want a smaller set of lints you can change this to specify
# 'package:lints/core.yaml'. These are just the most critical lints
# (the recommended set includes the core lints).
# The core lints are also what is used by pub.dev for scoring packages.
include: package:lints/recommended.yaml
# Uncomment the following section to specify additional rules.
# linter:
# rules:
# - camel_case_types
# analyzer:
# exclude:
# - path/to/excluded/files/**
# For more information about the core and recommended set of lints, see
# https://dart.dev/go/core-lints
# For additional information about configuring this file, see
# https://dart.dev/guides/language/analysis-options

View File

@@ -0,0 +1,9 @@
/// Support for doing something awesome.
///
/// More dartdocs go here.
library;
export 'presentation/routes/pages.dart';
export 'presentation/routes/routes.dart';
export 'presentation/pages/root/view.dart';
export 'presentation/pages/root/logic.dart';

View File

@@ -0,0 +1,33 @@
import 'package:flutter/material.dart';
import 'package:rasadyar_core/core.dart';
enum ErrorLocationType { serviceDisabled, permissionDenied, none }
class RootLogic extends GetxController {
RxInt currentIndex = 0.obs;
List<Widget> pages = [
Container(color: Colors.deepOrange,),
Container(color: Colors.amberAccent,),
Container(color: Colors.black,),
];
RxList<ErrorLocationType> errorLocationType = RxList();
@override
void onReady() {
super.onReady();
}
void changePage(int index) {
currentIndex.value = index;
}
@override
void onClose() {
// TODO: implement onClose
super.onClose();
}
}

View File

@@ -0,0 +1,82 @@
import 'package:flutter/material.dart';
import 'package:rasadyar_core/core.dart';
import 'logic.dart';
class RootPage extends GetView<RootLogic> {
const RootPage({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
body: Stack(
children: [
ObxValue(
(currentIndex) => IndexedStack(
index: currentIndex.value,
children: controller.pages,
),
controller.currentIndex,
),
],
),
bottomNavigationBar: WaveBottomNavigation(
items: [
WaveBottomNavigationItem(title: 'خانه', icon: Assets.vec.mapSvg.svg(
width: 32,
height: 32,
colorFilter: ColorFilter.mode(Colors.white, BlendMode.srcIn),
)),
WaveBottomNavigationItem(
title: 'عملیات',
icon: Assets.vec.userSvg.svg(
width: 32,
height: 32,
colorFilter: ColorFilter.mode(Colors.white, BlendMode.srcIn),
),
),
WaveBottomNavigationItem(
title: 'افزودن',
icon: Assets.vec.addSvg.svg(
width: 32,
height: 32,
colorFilter: ColorFilter.mode(Colors.white, BlendMode.srcIn),
),
),
WaveBottomNavigationItem(
title: 'آمار',
icon: Assets.vec.diagramSvg.svg(width: 32,height: 32,colorFilter: ColorFilter.mode(Colors.white, BlendMode.srcIn),),
),
WaveBottomNavigationItem(
title: 'تماس',
icon: Assets.vec.callSvg.svg(
width: 32,
height: 32,
colorFilter: ColorFilter.mode(Colors.white, BlendMode.srcIn),
),
),
WaveBottomNavigationItem(
title: 'مکان ',
icon: Assets.vec.gpsSvg.svg(
width: 32,
height: 32,
colorFilter: ColorFilter.mode(Colors.white, BlendMode.srcIn),
),
),
WaveBottomNavigationItem(
title: 'تاریخ',
icon: Assets.vec.calendarSvg.svg(
width: 32,
height: 32,
colorFilter: ColorFilter.mode(Colors.white, BlendMode.srcIn),
),
),
],
onPageChanged: (index) {
controller.changePage(index);
},
),
);
}
}

View File

@@ -0,0 +1,23 @@
import 'package:chicken/presentation/pages/root/view.dart';
import 'package:chicken/presentation/routes/routes.dart';
import 'package:rasadyar_auth/auth.dart';
import 'package:rasadyar_core/core.dart';
sealed class ChickenPages {
ChickenPages._();
static final pages = [
GetPage(
name: ChickenRoutes.init,
page: () => RootPage(),
middlewares: [AuthMiddleware()],
binding: BindingsBuilder(() {
}),
),
];
}

View File

@@ -0,0 +1,6 @@
sealed class ChickenRoutes {
ChickenRoutes._();
static const init = '/chicken/init';
}

View File

@@ -0,0 +1,59 @@
import 'package:flutter/material.dart';
class AnimatedClusterMarker extends StatefulWidget {
final int count;
const AnimatedClusterMarker({super.key, required this.count});
@override
State<AnimatedClusterMarker> createState() => _AnimatedClusterMarkerState();
}
class _AnimatedClusterMarkerState extends State<AnimatedClusterMarker>
with SingleTickerProviderStateMixin {
late AnimationController _controller;
@override
void initState() {
super.initState();
_controller = AnimationController(
vsync: this,
duration: const Duration(milliseconds: 300),
)..forward(); // start animation
}
@override
void dispose() {
_controller.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return ScaleTransition(
scale: CurvedAnimation(parent: _controller, curve: Curves.easeOutBack),
child: Opacity(
opacity: _controller.value,
child: Container(
width: 40,
height: 40,
alignment: Alignment.center,
decoration: BoxDecoration(
color: Colors.blueAccent,
shape: BoxShape.circle,
border: Border.all(color: Colors.white, width: 2),
),
child: Text(
widget.count.toString(),
style: const TextStyle(
color: Colors.white,
fontWeight: FontWeight.bold,
),
),
),
),
);
}
}

View File

@@ -0,0 +1,34 @@
name: rasadyar_chicken
description: A starting point for Dart libraries or applications.
version: 1.0.0
# repository: https://github.com/my_org/my_repo
environment:
sdk: ^3.8.1
dependencies:
flutter:
sdk: flutter
rasadyar_core:
path: ../core
rasadyar_auth:
path: ../auth
##code generation
freezed_annotation: ^3.0.0
json_annotation: ^4.9.0
dev_dependencies:
flutter_test:
sdk: flutter
flutter_lints: ^5.0.0
lints: ^5.0.0
test: ^1.24.0
##code generation
build_runner: ^2.4.15
hive_ce_generator: ^1.9.1
freezed: ^3.0.6
json_serializable: ^6.9.4
##test
mocktail: ^1.0.4
get_test: ^4.0.1

View File

@@ -0,0 +1,16 @@
import 'package:chicken/chicken.dart';
import 'package:test/test.dart';
void main() {
group('A group of tests', () {
final awesome = Awesome();
setUp(() {
// Additional setup goes here.
});
test('First Test', () {
expect(awesome.isAwesome, isTrue);
});
});
}

View File

@@ -980,6 +980,13 @@ packages:
relative: true relative: true
source: path source: path
version: "0.0.1" version: "0.0.1"
rasadyar_chicken:
dependency: "direct main"
description:
path: "packages/chicken"
relative: true
source: path
version: "1.0.0"
rasadyar_core: rasadyar_core:
dependency: "direct main" dependency: "direct main"
description: description:

View File

@@ -27,6 +27,10 @@ dependencies:
rasadyar_livestock: rasadyar_livestock:
path: ./packages/livestock path: ./packages/livestock
rasadyar_chicken:
path: ./packages/chicken
##code generation ##code generation