-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
31 changed files
with
451 additions
and
146 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,70 @@ | ||
# Miscellaneous | ||
*.class | ||
*.log | ||
*.pyc | ||
*.swp | ||
.DS_Store | ||
.atom/ | ||
.buildlog/ | ||
.history | ||
.svn/ | ||
|
||
# IntelliJ related | ||
*.iml | ||
*.ipr | ||
*.iws | ||
.idea/ | ||
|
||
.DS_Store | ||
.dart_tool/ | ||
# Visual Studio Code related | ||
.vscode/ | ||
|
||
# Flutter/Dart/Pub related | ||
**/doc/api/ | ||
.dart_tool/ | ||
.flutter-plugins | ||
.packages | ||
.pub-cache/ | ||
.pub/ | ||
|
||
build/ | ||
ios/.generated/ | ||
ios/Flutter/Generated.xcconfig | ||
ios/Runner/GeneratedPluginRegistrant.* | ||
|
||
# Android related | ||
**/android/**/gradle-wrapper.jar | ||
**/android/.gradle | ||
**/android/captures/ | ||
**/android/gradlew | ||
**/android/gradlew.bat | ||
**/android/local.properties | ||
**/android/**/GeneratedPluginRegistrant.java | ||
|
||
# iOS/XCode related | ||
**/ios/**/*.mode1v3 | ||
**/ios/**/*.mode2v3 | ||
**/ios/**/*.moved-aside | ||
**/ios/**/*.pbxuser | ||
**/ios/**/*.perspectivev3 | ||
**/ios/**/*sync/ | ||
**/ios/**/.sconsign.dblite | ||
**/ios/**/.tags* | ||
**/ios/**/.vagrant/ | ||
**/ios/**/DerivedData/ | ||
**/ios/**/Icon? | ||
**/ios/**/Pods/ | ||
**/ios/**/.symlinks/ | ||
**/ios/**/profile | ||
**/ios/**/xcuserdata | ||
**/ios/.generated/ | ||
**/ios/Flutter/App.framework | ||
**/ios/Flutter/Flutter.framework | ||
**/ios/Flutter/Generated.xcconfig | ||
**/ios/Flutter/app.flx | ||
**/ios/Flutter/app.zip | ||
**/ios/Flutter/flutter_assets/ | ||
**/ios/ServiceDefinitions.json | ||
**/ios/Runner/GeneratedPluginRegistrant.* | ||
|
||
# Exceptions to above rules. | ||
!**/ios/**/default.mode1v3 | ||
!**/ios/**/default.mode2v3 | ||
!**/ios/**/default.pbxuser | ||
!**/ios/**/default.perspectivev3 | ||
!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,65 +1,69 @@ | ||
## 0.1 | ||
## [0.1] | ||
|
||
- Initial version | ||
|
||
## 0.2.0 | ||
## [0.2.0] | ||
|
||
- CHANGED constructor type | ||
|
||
## 0.2.1 | ||
## [0.2.1] | ||
|
||
- CHANGED static methods | ||
- CHANGED monthLength to getter | ||
|
||
## 0.3.0 | ||
## [0.3.0] | ||
|
||
- ADDED fromDate constructor | ||
|
||
## 0.3.1 | ||
## [0.3.1] | ||
|
||
- ADDED toDateTime | ||
- CHANGED fromDate name to fromDateTime | ||
- ADDED now factory | ||
|
||
## 0.4.0 | ||
## [0.4.0] | ||
|
||
- ADDED Date as super interface | ||
|
||
## 0.4.1 | ||
## [0.4.1] | ||
|
||
- ADDED weekDay | ||
|
||
## 0.4.2 | ||
## [0.4.2] | ||
|
||
- ADDED more test cases | ||
- Refactored code and docs | ||
|
||
# 0.4.3 | ||
# [0.4.3] | ||
|
||
- CHANGED internal package structure | ||
|
||
# 0.5.0 | ||
# [0.5.0] | ||
|
||
- ADDED date formatter | ||
|
||
# 0.5.1 | ||
# [0.5.1] | ||
|
||
- ADDED Comparable to Jalali and Gregorian | ||
|
||
# 0.5.2 | ||
# [0.5.2] | ||
|
||
- ADDED comparison operators | ||
- ADDED equals and hashCode | ||
|
||
# 0.5.3 | ||
# [0.5.3] | ||
|
||
- ADDED more tests | ||
- ADDED fromJalali and fromGregorian methods | ||
|
||
# 0.5.4 | ||
# [0.5.4] | ||
|
||
- Better documentation | ||
|
||
# 0.5.5 | ||
# [0.5.5] | ||
|
||
- ADDED copy method | ||
- ADDED copy method | ||
|
||
# [0.6.0] | ||
|
||
- UPDATED project |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 0 additions & 23 deletions
23
android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,97 @@ | ||
# An Example for shamsi date package | ||
# shamsi_date example | ||
|
||
There is a complete example flutter application for shamsi_date package, | ||
which shows today in both Jalali and Georgian. | ||
Clone Github repository if you want to play with it. | ||
|
||
Here is a quick start guide for shamsi_date package: | ||
|
||
```dart | ||
import 'package:flutter/material.dart'; | ||
import 'package:shamsi_date/shamsi_date.dart'; | ||
void main() { | ||
runApp(MaterialApp( | ||
title: 'Example for shamsi_date package', | ||
home: MyHomePage(), | ||
)); | ||
} | ||
main() { | ||
// Gregorian to Jalali conversion | ||
final g1 = Gregorian(2013, 1, 10); | ||
final j1 = g1.toJalali(); | ||
print('$g1 in Gregorian is $j1 in Jalali'); | ||
// prints: 2013/1/10 in Gregorian is 1391/10/21 in Jalali | ||
// you can write Jalali.fromGregorian(g1) instead of g1.toJalali() | ||
class MyHomePage extends StatefulWidget { | ||
@override | ||
_MyHomePageState createState() => _MyHomePageState(); | ||
} | ||
// Jalali to Gregorian conversion | ||
final j2 = Jalali(1391, 10, 21); | ||
final g2 = j1.toGregorian(); | ||
print('$j2 in Jalali is $g2 in Gregorian'); | ||
// prints: 1391/10/21 in Jalali is 2013/1/10 in Gregorian | ||
// you can write Gregorian.fromJalali(j1) instead of j1.toGregorian() | ||
// check validity | ||
print('$j1 is valid? ${j1.isValid()}'); | ||
// -> true | ||
// check leap year | ||
print('1390 is leap year? ${Jalali(1390).isLeapYear()}'); | ||
// -> false | ||
// find month length | ||
print('1390/12 month length? ${Jalali(1390, 12).monthLength}'); | ||
// -> 29 | ||
// convert DateTime object to Jalali and Gregorian | ||
final dateTime = DateTime.now(); | ||
print('now is $dateTime'); | ||
print('now is ${Gregorian.fromDateTime(dateTime)} in Gregorian'); | ||
print('now is ${Jalali.fromDateTime(dateTime)} in Jalali'); | ||
// convert Jalali and Gregorian to DateTime | ||
print('$j1 as DateTime is ${j1.toDateTime()}'); | ||
print('$g1 as DateTime is ${g1.toDateTime()}'); | ||
class _MyHomePageState extends State<MyHomePage> { | ||
String _format(Date d) { | ||
// now() factory method | ||
print('now is ${Gregorian.now()} in Gregorian'); | ||
print('now is ${Jalali.now()} in Jalali'); | ||
// find weekDay | ||
print('${j1}.weekDay = ${j1.weekDay}'); // -> 6 | ||
print('${g1}.weekDay = ${g1.weekDay}'); // -> 4 | ||
// copy method | ||
print('$j1 with year = 1300 is ${j1.copy(year: 1300)}'); | ||
// prints: 1391/10/21 with year = 1300 is 1300/10/21 | ||
print('$g1 with month = 1 and day = 2 is ${g1.copy(month: 1, day: 2)}'); | ||
// prints: 2013/1/10 with month = 1 and day = 2 is 2013/1/2 | ||
// formatting examples: | ||
// example one: | ||
String format1(Date d) { | ||
final f = d.formatter; | ||
return '${f.wN} ${f.d} ${f.mN} ${f.yy}'; | ||
} | ||
@override | ||
Widget build(BuildContext context) { | ||
return Scaffold( | ||
appBar: AppBar( | ||
title: Text('Example for shamsi_date package'), | ||
), | ||
body: Center( | ||
child: Column( | ||
mainAxisAlignment: MainAxisAlignment.center, | ||
children: <Widget>[ | ||
Text(_format(Jalali.now())), | ||
Text(_format(Gregorian.now())), | ||
], | ||
), | ||
), | ||
); | ||
print(format1(j1)); | ||
// prints: پنج شنبه 21 دی 91 | ||
print(format1(g1)); | ||
// prints: Thursday 10 January 13 | ||
// example one: | ||
String format2(Date d) { | ||
final f = d.formatter; | ||
return '${f.dd}/${f.mm}/${f.yyyy}'; | ||
} | ||
print(format2(j1)); | ||
// 21/10/1391 | ||
print(format2(g1)); | ||
// prints: 10/01/2013 | ||
// comparing dates | ||
print(j1 > j2); // -> false | ||
print(j1 <= j2); // -> true | ||
print(g1 >= g2); // -> true | ||
print(g1.compareTo(g2)); // -> 0 | ||
print(g1 == g2); // -> true | ||
print(g1 != g1); // -> false | ||
} | ||
``` | ||
``` |
Oops, something went wrong.