Showing
5 changed files
with
216 additions
and
2 deletions
| ... | @@ -42,3 +42,6 @@ appbar 관련 디자인은 추후 구현 예정 | ... | @@ -42,3 +42,6 @@ appbar 관련 디자인은 추후 구현 예정 |
| 42 | + datetime picker widget을 이용하여 시간 선택 구현 예정 | 42 | + datetime picker widget을 이용하여 시간 선택 구현 예정 |
| 43 | + 알람 설정을 위한 Android Mainfest 설정 , 사용자 권한 요구 | 43 | + 알람 설정을 위한 Android Mainfest 설정 , 사용자 권한 요구 |
| 44 | 44 | ||
| 45 | +### 2021-05-14 | ||
| 46 | ++ datetime picker 를 이용하여 알람 설정 완료 | ||
| 47 | ++ 현재 알람 페이지와 알람 수정 페이지가 같은 곳에 위치 이에 따라 보이는 데이터만 존재하고 수정 여부를 묻는 것을 만들지 고민중 | ... | ... |
This diff is collapsed. Click to expand it.
| 1 | +import 'package:flutter_datetime_picker/flutter_datetime_picker.dart'; | ||
| 2 | + | ||
| 3 | +class CustomPicker extends CommonPickerModel { | ||
| 4 | + var indexs; | ||
| 5 | + | ||
| 6 | + String digits(int value, int length) { | ||
| 7 | + return '$value'.padLeft(length, "0"); | ||
| 8 | + } | ||
| 9 | + | ||
| 10 | + CustomPicker({DateTime currentTime, LocaleType locale}) | ||
| 11 | + : super(locale: LocaleType.ko) { | ||
| 12 | + this.currentTime = currentTime ?? DateTime.now(); | ||
| 13 | + var _dayPeriod = 0; | ||
| 14 | + this.setLeftIndex(this.currentTime.hour); | ||
| 15 | + this.setMiddleIndex(this.currentTime.minute); | ||
| 16 | + this.setRightIndex(_dayPeriod); | ||
| 17 | + _fillRightList(); | ||
| 18 | + } | ||
| 19 | + | ||
| 20 | + @override | ||
| 21 | + String leftStringAtIndex(int index) { | ||
| 22 | + if (index >= 1 && index < 13) { | ||
| 23 | + return this.digits(index, 2); | ||
| 24 | + } else { | ||
| 25 | + return null; | ||
| 26 | + } | ||
| 27 | + } | ||
| 28 | + | ||
| 29 | + @override | ||
| 30 | + String middleStringAtIndex(int index) { | ||
| 31 | + if (index >= 0 && index < 60) { | ||
| 32 | + return this.digits(index, 2); | ||
| 33 | + } else { | ||
| 34 | + return null; | ||
| 35 | + } | ||
| 36 | + } | ||
| 37 | + | ||
| 38 | + @override | ||
| 39 | + String rightStringAtIndex(int index) { | ||
| 40 | + if (index == 0) { | ||
| 41 | + return 'AM'; | ||
| 42 | + } else if (index == 1) { | ||
| 43 | + return 'PM'; | ||
| 44 | + } | ||
| 45 | + return null; | ||
| 46 | + } | ||
| 47 | + | ||
| 48 | + void _fillRightList() { | ||
| 49 | + this.rightList = List.generate(2, (int index) { | ||
| 50 | + return '$index'; | ||
| 51 | + }); | ||
| 52 | + } | ||
| 53 | + | ||
| 54 | + @override | ||
| 55 | + void setRightIndex(int index) { | ||
| 56 | + super.setRightIndex(index); | ||
| 57 | + indexs = index; | ||
| 58 | + _fillRightList(); | ||
| 59 | + } | ||
| 60 | + | ||
| 61 | + @override | ||
| 62 | + String leftDivider() { | ||
| 63 | + return ":"; | ||
| 64 | + } | ||
| 65 | + | ||
| 66 | + @override | ||
| 67 | + String rightDivider() { | ||
| 68 | + return " "; | ||
| 69 | + } | ||
| 70 | + | ||
| 71 | + @override | ||
| 72 | + List<int> layoutProportions() { | ||
| 73 | + return [1, 1, 1]; | ||
| 74 | + } | ||
| 75 | + | ||
| 76 | + @override | ||
| 77 | + DateTime finalTime() { | ||
| 78 | + var leftindex; | ||
| 79 | + | ||
| 80 | + print(indexs); | ||
| 81 | + | ||
| 82 | + if (indexs == 1) { | ||
| 83 | + if(this.currentLeftIndex() == 12){ | ||
| 84 | + leftindex = 12; | ||
| 85 | + } else { | ||
| 86 | + leftindex = this.currentLeftIndex() + 12; | ||
| 87 | + } | ||
| 88 | + | ||
| 89 | + | ||
| 90 | + } else if (indexs == 0) { | ||
| 91 | + if(this.currentLeftIndex() == 12){ | ||
| 92 | + leftindex = 0; | ||
| 93 | + } else { | ||
| 94 | + leftindex = this.currentLeftIndex(); | ||
| 95 | + } | ||
| 96 | + | ||
| 97 | + | ||
| 98 | + } | ||
| 99 | + | ||
| 100 | + return currentTime.isUtc | ||
| 101 | + ? DateTime.utc(currentTime.year, currentTime.month, currentTime.day, | ||
| 102 | + leftindex, this.currentMiddleIndex(), this.currentRightIndex()) | ||
| 103 | + : DateTime(currentTime.year, currentTime.month, currentTime.day, | ||
| 104 | + leftindex, this.currentMiddleIndex(), this.currentRightIndex()); | ||
| 105 | + } | ||
| 106 | +} |
| ... | @@ -50,6 +50,20 @@ packages: | ... | @@ -50,6 +50,20 @@ packages: |
| 50 | url: "https://pub.dartlang.org" | 50 | url: "https://pub.dartlang.org" |
| 51 | source: hosted | 51 | source: hosted |
| 52 | version: "1.2.0-nullsafety.1" | 52 | version: "1.2.0-nullsafety.1" |
| 53 | + ffi: | ||
| 54 | + dependency: transitive | ||
| 55 | + description: | ||
| 56 | + name: ffi | ||
| 57 | + url: "https://pub.dartlang.org" | ||
| 58 | + source: hosted | ||
| 59 | + version: "0.1.3" | ||
| 60 | + file: | ||
| 61 | + dependency: transitive | ||
| 62 | + description: | ||
| 63 | + name: file | ||
| 64 | + url: "https://pub.dartlang.org" | ||
| 65 | + source: hosted | ||
| 66 | + version: "5.2.1" | ||
| 53 | flutter: | 67 | flutter: |
| 54 | dependency: "direct main" | 68 | dependency: "direct main" |
| 55 | description: flutter | 69 | description: flutter |
| ... | @@ -88,8 +102,13 @@ packages: | ... | @@ -88,8 +102,13 @@ packages: |
| 88 | description: flutter | 102 | description: flutter |
| 89 | source: sdk | 103 | source: sdk |
| 90 | version: "0.0.0" | 104 | version: "0.0.0" |
| 91 | - intl: | 105 | + flutter_web_plugins: |
| 92 | dependency: transitive | 106 | dependency: transitive |
| 107 | + description: flutter | ||
| 108 | + source: sdk | ||
| 109 | + version: "0.0.0" | ||
| 110 | + intl: | ||
| 111 | + dependency: "direct main" | ||
| 93 | description: | 112 | description: |
| 94 | name: intl | 113 | name: intl |
| 95 | url: "https://pub.dartlang.org" | 114 | url: "https://pub.dartlang.org" |
| ... | @@ -144,6 +163,27 @@ packages: | ... | @@ -144,6 +163,27 @@ packages: |
| 144 | url: "https://pub.dartlang.org" | 163 | url: "https://pub.dartlang.org" |
| 145 | source: hosted | 164 | source: hosted |
| 146 | version: "1.8.0-nullsafety.1" | 165 | version: "1.8.0-nullsafety.1" |
| 166 | + path_provider_linux: | ||
| 167 | + dependency: transitive | ||
| 168 | + description: | ||
| 169 | + name: path_provider_linux | ||
| 170 | + url: "https://pub.dartlang.org" | ||
| 171 | + source: hosted | ||
| 172 | + version: "0.0.1+2" | ||
| 173 | + path_provider_platform_interface: | ||
| 174 | + dependency: transitive | ||
| 175 | + description: | ||
| 176 | + name: path_provider_platform_interface | ||
| 177 | + url: "https://pub.dartlang.org" | ||
| 178 | + source: hosted | ||
| 179 | + version: "1.0.4" | ||
| 180 | + path_provider_windows: | ||
| 181 | + dependency: transitive | ||
| 182 | + description: | ||
| 183 | + name: path_provider_windows | ||
| 184 | + url: "https://pub.dartlang.org" | ||
| 185 | + source: hosted | ||
| 186 | + version: "0.0.4+3" | ||
| 147 | pedantic: | 187 | pedantic: |
| 148 | dependency: transitive | 188 | dependency: transitive |
| 149 | description: | 189 | description: |
| ... | @@ -165,6 +205,13 @@ packages: | ... | @@ -165,6 +205,13 @@ packages: |
| 165 | url: "https://pub.dartlang.org" | 205 | url: "https://pub.dartlang.org" |
| 166 | source: hosted | 206 | source: hosted |
| 167 | version: "1.0.3" | 207 | version: "1.0.3" |
| 208 | + process: | ||
| 209 | + dependency: transitive | ||
| 210 | + description: | ||
| 211 | + name: process | ||
| 212 | + url: "https://pub.dartlang.org" | ||
| 213 | + source: hosted | ||
| 214 | + version: "3.0.13" | ||
| 168 | rxdart: | 215 | rxdart: |
| 169 | dependency: "direct main" | 216 | dependency: "direct main" |
| 170 | description: | 217 | description: |
| ... | @@ -172,6 +219,48 @@ packages: | ... | @@ -172,6 +219,48 @@ packages: |
| 172 | url: "https://pub.dartlang.org" | 219 | url: "https://pub.dartlang.org" |
| 173 | source: hosted | 220 | source: hosted |
| 174 | version: "0.23.1" | 221 | version: "0.23.1" |
| 222 | + shared_preferences: | ||
| 223 | + dependency: "direct main" | ||
| 224 | + description: | ||
| 225 | + name: shared_preferences | ||
| 226 | + url: "https://pub.dartlang.org" | ||
| 227 | + source: hosted | ||
| 228 | + version: "0.5.12+4" | ||
| 229 | + shared_preferences_linux: | ||
| 230 | + dependency: transitive | ||
| 231 | + description: | ||
| 232 | + name: shared_preferences_linux | ||
| 233 | + url: "https://pub.dartlang.org" | ||
| 234 | + source: hosted | ||
| 235 | + version: "0.0.2+4" | ||
| 236 | + shared_preferences_macos: | ||
| 237 | + dependency: transitive | ||
| 238 | + description: | ||
| 239 | + name: shared_preferences_macos | ||
| 240 | + url: "https://pub.dartlang.org" | ||
| 241 | + source: hosted | ||
| 242 | + version: "0.0.1+11" | ||
| 243 | + shared_preferences_platform_interface: | ||
| 244 | + dependency: transitive | ||
| 245 | + description: | ||
| 246 | + name: shared_preferences_platform_interface | ||
| 247 | + url: "https://pub.dartlang.org" | ||
| 248 | + source: hosted | ||
| 249 | + version: "1.0.4" | ||
| 250 | + shared_preferences_web: | ||
| 251 | + dependency: transitive | ||
| 252 | + description: | ||
| 253 | + name: shared_preferences_web | ||
| 254 | + url: "https://pub.dartlang.org" | ||
| 255 | + source: hosted | ||
| 256 | + version: "0.1.2+7" | ||
| 257 | + shared_preferences_windows: | ||
| 258 | + dependency: transitive | ||
| 259 | + description: | ||
| 260 | + name: shared_preferences_windows | ||
| 261 | + url: "https://pub.dartlang.org" | ||
| 262 | + source: hosted | ||
| 263 | + version: "0.0.2+3" | ||
| 175 | sky_engine: | 264 | sky_engine: |
| 176 | dependency: transitive | 265 | dependency: transitive |
| 177 | description: flutter | 266 | description: flutter |
| ... | @@ -240,6 +329,20 @@ packages: | ... | @@ -240,6 +329,20 @@ packages: |
| 240 | url: "https://pub.dartlang.org" | 329 | url: "https://pub.dartlang.org" |
| 241 | source: hosted | 330 | source: hosted |
| 242 | version: "2.1.0-nullsafety.3" | 331 | version: "2.1.0-nullsafety.3" |
| 332 | + win32: | ||
| 333 | + dependency: transitive | ||
| 334 | + description: | ||
| 335 | + name: win32 | ||
| 336 | + url: "https://pub.dartlang.org" | ||
| 337 | + source: hosted | ||
| 338 | + version: "1.7.4+1" | ||
| 339 | + xdg_directories: | ||
| 340 | + dependency: transitive | ||
| 341 | + description: | ||
| 342 | + name: xdg_directories | ||
| 343 | + url: "https://pub.dartlang.org" | ||
| 344 | + source: hosted | ||
| 345 | + version: "0.1.2" | ||
| 243 | sdks: | 346 | sdks: |
| 244 | dart: ">=2.10.0-110 <2.11.0" | 347 | dart: ">=2.10.0-110 <2.11.0" |
| 245 | - flutter: ">=1.12.13+hotfix.5" | 348 | + flutter: ">=1.12.13+hotfix.5 <2.0.0" | ... | ... |
| ... | @@ -31,6 +31,8 @@ dependencies: | ... | @@ -31,6 +31,8 @@ dependencies: |
| 31 | rxdart: ^0.23.1 | 31 | rxdart: ^0.23.1 |
| 32 | flutter_datetime_picker: ^1.3.4 | 32 | flutter_datetime_picker: ^1.3.4 |
| 33 | timezone: ^0.6.0 | 33 | timezone: ^0.6.0 |
| 34 | + intl : ^0.16.1 | ||
| 35 | + shared_preferences: ^0.5.6+1 | ||
| 34 | 36 | ||
| 35 | dev_dependencies: | 37 | dev_dependencies: |
| 36 | flutter_test: | 38 | flutter_test: | ... | ... |
-
Please register or login to post a comment