feat : persian calendar and date picker

This commit is contained in:
2025-04-27 09:39:58 +03:30
parent c10ddaf0d5
commit b77e4e9095
10 changed files with 61 additions and 12 deletions

View File

@@ -70,7 +70,19 @@ class LocationDetailsPage extends GetView<LocationDetailsLogic> {
Expanded(
child: ROutlinedElevatedIcon(
icon: FaIcon(FontAwesomeIcons.calendar),
onPressed: () {},
onPressed:() async {
Jalali? picked = await showPersianDatePicker(
context: context,
initialDate: Jalali.now(),
firstDate: Jalali(1385, 8),
lastDate: Jalali(1450, 9),
initialEntryMode:
PersianDatePickerEntryMode.calendarOnly,
initialDatePickerMode: PersianDatePickerMode.day,
);
},
text: 'از تاریخ',
textStyle: AppFonts.yekan16.copyWith(
color: AppColor.blueNormal,
@@ -81,16 +93,17 @@ class LocationDetailsPage extends GetView<LocationDetailsLogic> {
child: ROutlinedElevatedIcon(
icon: FaIcon(FontAwesomeIcons.calendar),
onPressed: () async {
Jalali? picked = await showPersianDatePicker(
context: context,
initialDate: Jalali.now(),
firstDate: Jalali(1385, 8),
lastDate: Jalali(1450, 9),
initialEntryMode:
PersianDatePickerEntryMode.calendarOnly,
initialDatePickerMode: PersianDatePickerMode.day,
);
var label = picked?.formatFullDate();
},
text: 'تا تاریخ',
textStyle: AppFonts.yekan16.copyWith(

View File

@@ -42,15 +42,22 @@ class MyApp extends StatelessWidget {
return GetMaterialApp(
title: 'رصدیار',
theme: ThemeData(
fontFamily: 'yekan',
colorScheme: ColorScheme.fromSeed(seedColor: AppColor.blueNormal),
),
initialRoute: AppPages.initRoutes,
initialBinding: BindingsBuilder.put(() => UserService()),
getPages: AppPages.pages,
locale: Locale('fa'),
locale: const Locale("fa", "IR"),
supportedLocales: const [
Locale("fa", "IR"),
],
localizationsDelegates: [
PersianMaterialLocalizations.delegate,
PersianCupertinoLocalizations.delegate,
GlobalMaterialLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,
GlobalCupertinoLocalizations.delegate,
],
);
}

View File

@@ -1,9 +1,7 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:inspection/inspection.dart';
import 'package:rasadyar_core/core.dart';
import 'package:rasadyar_core/presentation/widget/captcha/captcha_widget.dart';
import 'logic.dart';
@@ -227,11 +225,19 @@ class AuthWithUseAndPassPage extends GetView<AuthWithUseAndPassLogic> {
SizedBox(height: 23),
RElevated(
text: 'ورود',
onPressed: () {
onPressed: () async {
Jalali? picked = await showPersianDatePicker(
context: Get.context!,
initialDate: Jalali.now(),
firstDate: Jalali(1385, 8),
lastDate: Jalali(1450, 9),
initialEntryMode: PersianDatePickerEntryMode.calendarOnly,
initialDatePickerMode: PersianDatePickerMode.year,
);
if (data.value.currentState?.validate() == true &&
controller.captchaController.validate()) {
Get.toNamed(InspectionRoutes.inspection);
}
controller.captchaController.validate()) {}
},
width: Get.width,
height: 48,

View File

@@ -6,6 +6,7 @@ export 'package:rasadyar_core/presentation/utils/utils.dart';
export 'package:rasadyar_core/presentation/widget/widget.dart';
//other packages
export 'package:flutter_localizations/flutter_localizations.dart';
export 'package:flutter_slidable/flutter_slidable.dart';
export 'package:font_awesome_flutter/font_awesome_flutter.dart';
export 'package:flutter_rating_bar/flutter_rating_bar.dart';

View File

@@ -230,6 +230,11 @@ packages:
url: "https://pub.dev"
source: hosted
version: "5.0.0"
flutter_localizations:
dependency: "direct main"
description: flutter
source: sdk
version: "0.0.0"
flutter_rating_bar:
dependency: "direct main"
description:
@@ -384,6 +389,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "4.1.2"
intl:
dependency: "direct main"
description:
name: intl
sha256: d6f56758b7d3014a48af9701c085700aac781a92a87a62b1333b46d8879661cf
url: "https://pub.dev"
source: hosted
version: "0.19.0"
io:
dependency: transitive
description:

View File

@@ -9,6 +9,9 @@ environment:
dependencies:
flutter:
sdk: flutter
flutter_localizations:
sdk: flutter
#UI
cupertino_icons: ^1.0.8
@@ -41,9 +44,10 @@ dependencies:
##Di
get_it: ^8.0.3
#other
permission_handler: ^12.0.0+1
persian_datetime_picker: ^3.1.0
intl: ^0.19.0

View File

@@ -118,6 +118,11 @@ packages:
url: "https://pub.dev"
source: hosted
version: "5.0.0"
flutter_localizations:
dependency: transitive
description: flutter
source: sdk
version: "0.0.0"
flutter_map:
dependency: transitive
description:
@@ -291,10 +296,10 @@ packages:
dependency: transitive
description:
name: intl
sha256: "3df61194eb431efc39c4ceba583b95633a403f46c9fd341e550ce0bfa50e9aa5"
sha256: d6f56758b7d3014a48af9701c085700aac781a92a87a62b1333b46d8879661cf
url: "https://pub.dev"
source: hosted
version: "0.20.2"
version: "0.19.0"
json_annotation:
dependency: transitive
description: