Browse Source

Merge branch 'master' into master

刘彦博 4 years ago
parent
commit
2e8d5ceaf7
4 changed files with 151 additions and 13 deletions
  1. 1 0
      README.md
  2. 6 2
      lib/flutter_datetime_picker.dart
  3. 2 2
      lib/src/date_model.dart
  4. 142 9
      lib/src/i18n_model.dart

+ 1 - 0
README.md

@@ -34,6 +34,7 @@ you can choose date / time / date&time in multiple languages:
 - Thai(th)
 - Turkish(tr)
 - Vietnamese(vi)
+- Khmer(kh)
 
 
 and you can also custom your own picker content

+ 6 - 2
lib/flutter_datetime_picker.dart

@@ -408,8 +408,12 @@ class _DatePickerState extends State<_DatePickerComponent> {
                     rightScrollCtrl,
                     widget.pickerModel.layoutProportions()[2], (index) {
                     widget.pickerModel.setRightIndex(index);
-                    _notifyDateChanged();
-                  }, null)
+                  }, (index) {
+                    setState(() {
+                      refreshScrollOffset();
+                      _notifyDateChanged();
+                    });
+                  })
                 : null,
           ),
         ],

+ 2 - 2
lib/src/date_model.dart

@@ -457,9 +457,9 @@ class Time12hPickerModel extends CommonPickerModel {
   @override
   String rightStringAtIndex(int index) {
     if (index == 0) {
-      return "AM";
+      return  i18nObjInLocale(this.locale)["am"];
     } else if (index == 1) {
-      return "PM";
+      return i18nObjInLocale(this.locale)["pm"];
     } else {
       return null;
     }

+ 142 - 9
lib/src/i18n_model.dart

@@ -31,10 +31,47 @@ enum LocaleType {
   no,
   sq,
   sv,
+  kh,
   tw
 }
 
 final _i18nModel = {
+  'kh': {
+    'cancel': 'បោះបង់',
+    'done': 'រួចរាល់',
+    'today': 'ថ្ងៃនេះ',
+    'monthShort': [
+      'មករា',
+      'កុម្ភះ',
+      'មិនា',
+      'មេសា',
+      'ឧសភា',
+      'មិថុនា',
+      'កក្កដា',
+      'សីហា',
+      'កញ្ញា',
+      'តុលា',
+      'វិច្ឆិកា',
+      'ធ្នូ'
+    ],
+    'monthLong': [
+      'មករា',
+      'កុម្ភះ',
+      'មិនា',
+      'មេសា',
+      'ឧសភា',
+      'មិថុនា',
+      'កក្កដា',
+      'សីហា',
+      'កញ្ញា',
+      'តុលា',
+      'វិច្ឆិកា',
+      'ធ្នូ'
+    ],
+    'day': ['ច័ន្ទ', 'អង្គារ', 'ពុធ', 'ព្រហស្បតិ៍', 'សុក្រ', 'សៅរ៍', 'អាទិត្យ'],
+    'am': 'ព្រឹក',
+    'pm': 'ថ្ងៃ'
+  },
   'en': {
     'cancel': 'Cancel',
     'done': 'Done',
@@ -139,7 +176,15 @@ final _i18nModel = {
       'آبان',
       'آذر',
     ],
-    'day': ['دوشنبه', 'سه شنبه', 'چهارشنبه', 'پنج شنبه', 'جمعه', 'شنبه', 'یکشنبه'],
+    'day': [
+      'دوشنبه',
+      'سه شنبه',
+      'چهارشنبه',
+      'پنج شنبه',
+      'جمعه',
+      'شنبه',
+      'یکشنبه'
+    ],
     'am': 'صبح',
     'pm': 'عصر'
   },
@@ -148,8 +193,34 @@ final _i18nModel = {
     'cancel': '取消',
     'done': '确定',
     'today': '今天',
-    'monthShort': ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'],
-    'monthLong': ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'],
+    'monthShort': [
+      '一月',
+      '二月',
+      '三月',
+      '四月',
+      '五月',
+      '六月',
+      '七月',
+      '八月',
+      '九月',
+      '十月',
+      '十一月',
+      '十二月'
+    ],
+    'monthLong': [
+      '一月',
+      '二月',
+      '三月',
+      '四月',
+      '五月',
+      '六月',
+      '七月',
+      '八月',
+      '九月',
+      '十月',
+      '十一月',
+      '十二月'
+    ],
     'day': ['星期一', '星期二', '星期三', '星期四', '星期五', '星期六', '星期日'],
     'am': '上午',
     'pm': '下午'
@@ -466,8 +537,34 @@ final _i18nModel = {
     'cancel': '취소',
     'done': '완료',
     'today': '오늘',
-    'monthShort': ['1월', '2월', '3월', '4월', '5월', '6월', '7월', '8월', '9월', '10월', '11월', '12월'],
-    'monthLong': ['1월', '2월', '3월', '4월', '5월', '6월', '7월', '8월', '9월', '10월', '11월', '12월'],
+    'monthShort': [
+      '1월',
+      '2월',
+      '3월',
+      '4월',
+      '5월',
+      '6월',
+      '7월',
+      '8월',
+      '9월',
+      '10월',
+      '11월',
+      '12월'
+    ],
+    'monthLong': [
+      '1월',
+      '2월',
+      '3월',
+      '4월',
+      '5월',
+      '6월',
+      '7월',
+      '8월',
+      '9월',
+      '10월',
+      '11월',
+      '12월'
+    ],
     'day': ['월', '화', '수', '목', '금', '토', '일'],
     'am': '오전',
     'pm': '오후'
@@ -540,7 +637,15 @@ final _i18nModel = {
       'نوفمبر',
       'ديسمبر'
     ],
-    'day': ['الإثنين', 'الثلاثاء', 'الأربعاء', 'الخميس', 'الجمعه', 'السبت', 'الاحد'],
+    'day': [
+      'الإثنين',
+      'الثلاثاء',
+      'الأربعاء',
+      'الخميس',
+      'الجمعه',
+      'السبت',
+      'الاحد'
+    ],
     'am': 'ص',
     'pm': 'م'
   },
@@ -621,8 +726,34 @@ final _i18nModel = {
     'cancel': 'キャンセル',
     'done': '完了',
     'today': '今日',
-    'monthShort': ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'],
-    'monthLong': ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'],
+    'monthShort': [
+      '1月',
+      '2月',
+      '3月',
+      '4月',
+      '5月',
+      '6月',
+      '7月',
+      '8月',
+      '9月',
+      '10月',
+      '11月',
+      '12月'
+    ],
+    'monthLong': [
+      '1月',
+      '2月',
+      '3月',
+      '4月',
+      '5月',
+      '6月',
+      '7月',
+      '8月',
+      '9月',
+      '10月',
+      '11月',
+      '12月'
+    ],
     'day': ['月曜日', '火曜日', '水曜日', '木曜日', '金曜日', '土曜日', '日曜日'],
     'am': '午前',
     'pm': '午後'
@@ -959,7 +1090,7 @@ final _i18nModel = {
       'Setembre',
       'Octubre',
       'Novembre',
-      'Decembre'
+      'Desembre'
     ],
     'day': ['Dl', 'Dt', 'Dc', 'Dj', 'Dv', 'Ds', 'Dg'],
     'am': 'AM',
@@ -1213,6 +1344,8 @@ Map<String, dynamic> i18nObjInLocale(LocaleType type) {
       return _i18nModel['sq'];
     case LocaleType.sv:
       return _i18nModel['sv'];
+    case LocaleType.kh:
+      return _i18nModel['kh'];
     case LocaleType.tw:
       return _i18nModel['tw'];
     default: