├── .all-contributorsrc
├── .gitignore
├── .metadata
├── CHANGELOG.md
├── CONTRIBUTING.md
├── LICENSE
├── README.md
├── analysis_options.yaml
├── example.gif
├── example
├── .gitignore
├── .metadata
├── README.md
├── analysis_options.yaml
├── android
│ ├── .gitignore
│ ├── app
│ │ ├── build.gradle
│ │ └── src
│ │ │ ├── debug
│ │ │ └── AndroidManifest.xml
│ │ │ ├── main
│ │ │ ├── AndroidManifest.xml
│ │ │ ├── kotlin
│ │ │ │ └── com
│ │ │ │ │ └── example
│ │ │ │ │ └── example
│ │ │ │ │ └── MainActivity.kt
│ │ │ └── res
│ │ │ │ ├── drawable-v21
│ │ │ │ └── launch_background.xml
│ │ │ │ ├── drawable
│ │ │ │ └── launch_background.xml
│ │ │ │ ├── mipmap-hdpi
│ │ │ │ └── ic_launcher.png
│ │ │ │ ├── mipmap-mdpi
│ │ │ │ └── ic_launcher.png
│ │ │ │ ├── mipmap-xhdpi
│ │ │ │ └── ic_launcher.png
│ │ │ │ ├── mipmap-xxhdpi
│ │ │ │ └── ic_launcher.png
│ │ │ │ ├── mipmap-xxxhdpi
│ │ │ │ └── ic_launcher.png
│ │ │ │ ├── values-night
│ │ │ │ └── styles.xml
│ │ │ │ └── values
│ │ │ │ └── styles.xml
│ │ │ └── profile
│ │ │ └── AndroidManifest.xml
│ ├── build.gradle
│ ├── gradle.properties
│ ├── gradle
│ │ └── wrapper
│ │ │ └── gradle-wrapper.properties
│ └── settings.gradle
├── ios
│ ├── .gitignore
│ ├── Flutter
│ │ ├── AppFrameworkInfo.plist
│ │ ├── Debug.xcconfig
│ │ └── Release.xcconfig
│ ├── Runner.xcodeproj
│ │ ├── project.pbxproj
│ │ ├── project.xcworkspace
│ │ │ ├── contents.xcworkspacedata
│ │ │ └── xcshareddata
│ │ │ │ ├── IDEWorkspaceChecks.plist
│ │ │ │ └── WorkspaceSettings.xcsettings
│ │ └── xcshareddata
│ │ │ └── xcschemes
│ │ │ └── Runner.xcscheme
│ ├── Runner.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ └── xcshareddata
│ │ │ ├── IDEWorkspaceChecks.plist
│ │ │ └── WorkspaceSettings.xcsettings
│ └── Runner
│ │ ├── AppDelegate.swift
│ │ ├── Assets.xcassets
│ │ ├── AppIcon.appiconset
│ │ │ ├── Contents.json
│ │ │ ├── Icon-App-1024x1024@1x.png
│ │ │ ├── Icon-App-20x20@1x.png
│ │ │ ├── Icon-App-20x20@2x.png
│ │ │ ├── Icon-App-20x20@3x.png
│ │ │ ├── Icon-App-29x29@1x.png
│ │ │ ├── Icon-App-29x29@2x.png
│ │ │ ├── Icon-App-29x29@3x.png
│ │ │ ├── Icon-App-40x40@1x.png
│ │ │ ├── Icon-App-40x40@2x.png
│ │ │ ├── Icon-App-40x40@3x.png
│ │ │ ├── Icon-App-60x60@2x.png
│ │ │ ├── Icon-App-60x60@3x.png
│ │ │ ├── Icon-App-76x76@1x.png
│ │ │ ├── Icon-App-76x76@2x.png
│ │ │ └── Icon-App-83.5x83.5@2x.png
│ │ └── LaunchImage.imageset
│ │ │ ├── Contents.json
│ │ │ ├── LaunchImage.png
│ │ │ ├── LaunchImage@2x.png
│ │ │ ├── LaunchImage@3x.png
│ │ │ └── README.md
│ │ ├── Base.lproj
│ │ ├── LaunchScreen.storyboard
│ │ └── Main.storyboard
│ │ ├── Info.plist
│ │ └── Runner-Bridging-Header.h
├── lib
│ └── main.dart
├── linux
│ ├── .gitignore
│ ├── CMakeLists.txt
│ ├── flutter
│ │ ├── CMakeLists.txt
│ │ ├── generated_plugin_registrant.cc
│ │ ├── generated_plugin_registrant.h
│ │ └── generated_plugins.cmake
│ ├── main.cc
│ ├── my_application.cc
│ └── my_application.h
├── macos
│ ├── .gitignore
│ ├── Flutter
│ │ ├── Flutter-Debug.xcconfig
│ │ ├── Flutter-Release.xcconfig
│ │ └── GeneratedPluginRegistrant.swift
│ ├── Runner.xcodeproj
│ │ ├── project.pbxproj
│ │ ├── project.xcworkspace
│ │ │ └── xcshareddata
│ │ │ │ └── IDEWorkspaceChecks.plist
│ │ └── xcshareddata
│ │ │ └── xcschemes
│ │ │ └── Runner.xcscheme
│ ├── Runner.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ └── xcshareddata
│ │ │ └── IDEWorkspaceChecks.plist
│ └── Runner
│ │ ├── AppDelegate.swift
│ │ ├── Assets.xcassets
│ │ └── AppIcon.appiconset
│ │ │ ├── Contents.json
│ │ │ ├── app_icon_1024.png
│ │ │ ├── app_icon_128.png
│ │ │ ├── app_icon_16.png
│ │ │ ├── app_icon_256.png
│ │ │ ├── app_icon_32.png
│ │ │ ├── app_icon_512.png
│ │ │ └── app_icon_64.png
│ │ ├── Base.lproj
│ │ └── MainMenu.xib
│ │ ├── Configs
│ │ ├── AppInfo.xcconfig
│ │ ├── Debug.xcconfig
│ │ ├── Release.xcconfig
│ │ └── Warnings.xcconfig
│ │ ├── DebugProfile.entitlements
│ │ ├── Info.plist
│ │ ├── MainFlutterWindow.swift
│ │ └── Release.entitlements
├── pubspec.lock
├── pubspec.yaml
├── test
│ └── widget_test.dart
├── web
│ ├── favicon.png
│ ├── icons
│ │ ├── Icon-192.png
│ │ ├── Icon-512.png
│ │ ├── Icon-maskable-192.png
│ │ └── Icon-maskable-512.png
│ ├── index.html
│ └── manifest.json
└── windows
│ ├── .gitignore
│ ├── CMakeLists.txt
│ ├── flutter
│ ├── CMakeLists.txt
│ ├── generated_plugin_registrant.cc
│ ├── generated_plugin_registrant.h
│ └── generated_plugins.cmake
│ └── runner
│ ├── CMakeLists.txt
│ ├── Runner.rc
│ ├── flutter_window.cpp
│ ├── flutter_window.h
│ ├── main.cpp
│ ├── resource.h
│ ├── resources
│ └── app_icon.ico
│ ├── runner.exe.manifest
│ ├── utils.cpp
│ ├── utils.h
│ ├── win32_window.cpp
│ └── win32_window.h
├── example_ios_style.png
├── lib
├── assets
│ ├── moon.png
│ └── sun.png
├── day_night_time_picker.dart
└── lib
│ ├── ampm.dart
│ ├── common
│ ├── action_buttons.dart
│ ├── display_value.dart
│ ├── display_wheel.dart
│ ├── filter_wrapper.dart
│ ├── wrapper_container.dart
│ └── wrapper_dialog.dart
│ ├── constants.dart
│ ├── day_night_timepicker_android.dart
│ ├── day_night_timepicker_ios.dart
│ ├── daynight_banner.dart
│ ├── daynight_timepicker.dart
│ ├── state
│ ├── state_container.dart
│ └── time.dart
│ ├── sun_moon.dart
│ └── utils.dart
├── pubspec.lock
└── pubspec.yaml
/.all-contributorsrc:
--------------------------------------------------------------------------------
1 | {
2 | "projectName": "day_night_time_picker",
3 | "projectOwner": "subhamayd2",
4 | "repoType": "github",
5 | "repoHost": "https://github.com",
6 | "files": [
7 | "README.md"
8 | ],
9 | "imageSize": 100,
10 | "commit": false,
11 | "commitConvention": "none",
12 | "badgeTemplate": "[](#contributors)",
13 | "contributors": [
14 | {
15 | "login": "subhamayd2",
16 | "name": "Subhamay Dutta",
17 | "avatar_url": "https://avatars.githubusercontent.com/u/23093995?v=4",
18 | "profile": "https://github.com/subhamayd2",
19 | "contributions": [
20 | "code",
21 | "doc"
22 | ]
23 | },
24 | {
25 | "login": "impure",
26 | "name": "Andrew Zuo",
27 | "avatar_url": "https://avatars.githubusercontent.com/u/4359114?v=4",
28 | "profile": "https://github.com/impure",
29 | "contributions": [
30 | "code"
31 | ]
32 | },
33 | {
34 | "login": "MOOUDE",
35 | "name": "Mohammad Odeh",
36 | "avatar_url": "https://avatars.githubusercontent.com/u/6555426?v=4",
37 | "profile": "https://www.linkedin.com/in/oude-mohammad/",
38 | "contributions": [
39 | "code"
40 | ]
41 | },
42 | {
43 | "login": "hashem78",
44 | "name": "Hashem Alayan",
45 | "avatar_url": "https://avatars.githubusercontent.com/u/4525797?v=4",
46 | "profile": "https://github.com/hashem78",
47 | "contributions": [
48 | "code"
49 | ]
50 | },
51 | {
52 | "login": "gohdong",
53 | "name": "gohdong",
54 | "avatar_url": "https://avatars.githubusercontent.com/u/22044475?v=4",
55 | "profile": "https://github.com/gohdong",
56 | "contributions": [
57 | "code"
58 | ]
59 | },
60 | {
61 | "login": "nohli",
62 | "name": "nohli",
63 | "avatar_url": "https://avatars.githubusercontent.com/u/43643339?v=4",
64 | "profile": "https://achim.io/",
65 | "contributions": [
66 | "code"
67 | ]
68 | },
69 | {
70 | "login": "sander102907",
71 | "name": "sander102907",
72 | "avatar_url": "https://avatars.githubusercontent.com/u/22891388?v=4",
73 | "profile": "https://github.com/sander102907",
74 | "contributions": [
75 | "code"
76 | ]
77 | },
78 | {
79 | "login": "sobimor",
80 | "name": "Sobhan Moradi",
81 | "avatar_url": "https://avatars.githubusercontent.com/u/22625638?v=4",
82 | "profile": "https://asoteam.ir",
83 | "contributions": [
84 | "design"
85 | ]
86 | },
87 | {
88 | "login": "iaskari",
89 | "name": "Omar Dahhane",
90 | "avatar_url": "https://avatars.githubusercontent.com/u/3792357?v=4",
91 | "profile": "https://github.com/iaskari",
92 | "contributions": [
93 | "code"
94 | ]
95 | },
96 | {
97 | "login": "fatihy101",
98 | "name": "Fatih Yaman",
99 | "avatar_url": "https://avatars.githubusercontent.com/u/34458068?v=4",
100 | "profile": "https://github.com/fatihy101",
101 | "contributions": [
102 | "design"
103 | ]
104 | },
105 | {
106 | "login": "awesomejerry",
107 | "name": "JerryShen",
108 | "avatar_url": "https://avatars.githubusercontent.com/u/6601073?v=4",
109 | "profile": "https://www.awesomejerry.space",
110 | "contributions": [
111 | "code"
112 | ]
113 | },
114 | {
115 | "login": "morio77",
116 | "name": "本多健也",
117 | "avatar_url": "https://avatars.githubusercontent.com/u/68191253?v=4",
118 | "profile": "https://github.com/morio77",
119 | "contributions": [
120 | "code"
121 | ]
122 | },
123 | {
124 | "login": "TheGlorySaint",
125 | "name": "Tempelritter",
126 | "avatar_url": "https://avatars.githubusercontent.com/u/21318321?v=4",
127 | "profile": "https://github.com/TheGlorySaint",
128 | "contributions": [
129 | "code",
130 | "doc"
131 | ]
132 | },
133 | {
134 | "login": "Silfalion",
135 | "name": "Silfalion",
136 | "avatar_url": "https://avatars.githubusercontent.com/u/23188369?v=4",
137 | "profile": "https://github.com/Silfalion",
138 | "contributions": [
139 | "code"
140 | ]
141 | },
142 | {
143 | "login": "guchengxi1994",
144 | "name": "Chengxi Gu",
145 | "avatar_url": "https://avatars.githubusercontent.com/u/33513462?v=4",
146 | "profile": "https://github.com/guchengxi1994",
147 | "contributions": [
148 | "code"
149 | ]
150 | },
151 | {
152 | "login": "saifb",
153 | "name": "Saif Billah",
154 | "avatar_url": "https://avatars.githubusercontent.com/u/23041420?v=4",
155 | "profile": "https://www.saifbillah.com",
156 | "contributions": [
157 | "code"
158 | ]
159 | },
160 | {
161 | "login": "markszente",
162 | "name": "Mark Szente",
163 | "avatar_url": "https://avatars.githubusercontent.com/u/29143275?v=4",
164 | "profile": "https://github.com/markszente",
165 | "contributions": [
166 | "code"
167 | ]
168 | },
169 | {
170 | "login": "rcjuancarlosuwu",
171 | "name": "Juan Carlos Ramón Condezo",
172 | "avatar_url": "https://avatars.githubusercontent.com/u/67658540?v=4",
173 | "profile": "https://linkedin.com/in/rcjuancarlosuwu",
174 | "contributions": [
175 | "design"
176 | ]
177 | },
178 | {
179 | "login": "Likenttt",
180 | "name": "Chuanyi",
181 | "avatar_url": "https://avatars.githubusercontent.com/u/26034018?v=4",
182 | "profile": "https://github.com/Likenttt",
183 | "contributions": [
184 | "doc"
185 | ]
186 | },
187 | {
188 | "login": "leonschwanitz",
189 | "name": "Leon Schwanitz",
190 | "avatar_url": "https://avatars.githubusercontent.com/u/36971798?v=4",
191 | "profile": "http://linkpop.com/leonschwanitz",
192 | "contributions": [
193 | "design"
194 | ]
195 | },
196 | {
197 | "login": "elmdecoste",
198 | "name": "Liam DeCoste",
199 | "avatar_url": "https://avatars.githubusercontent.com/u/1967150?v=4",
200 | "profile": "http://elmd.me",
201 | "contributions": [
202 | "bug"
203 | ]
204 | },
205 | {
206 | "login": "qqjjjj",
207 | "name": "qqjjjj",
208 | "avatar_url": "https://avatars.githubusercontent.com/u/67450840?v=4",
209 | "profile": "https://github.com/qqjjjj",
210 | "contributions": [
211 | "code"
212 | ]
213 | },
214 | {
215 | "login": "moshe5745",
216 | "name": "Moshe Yamini",
217 | "avatar_url": "https://avatars.githubusercontent.com/u/7037149?v=4",
218 | "profile": "https://github.com/moshe5745",
219 | "contributions": [
220 | "code"
221 | ]
222 | },
223 | {
224 | "login": "naipaka",
225 | "name": "Ryota Kobayashi",
226 | "avatar_url": "https://avatars.githubusercontent.com/u/45661924?v=4",
227 | "profile": "https://github.com/naipaka",
228 | "contributions": [
229 | "code"
230 | ]
231 | },
232 | {
233 | "login": "Emon526",
234 | "name": "Asraful Islam",
235 | "avatar_url": "https://avatars.githubusercontent.com/u/57067036?v=4",
236 | "profile": "https://github.com/Emon526",
237 | "contributions": [
238 | "code"
239 | ]
240 | }
241 | ],
242 | "contributorsPerLine": 7,
243 | "skipCi": true,
244 | "commitType": "docs"
245 | }
246 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Miscellaneous
2 | *.class
3 | *.log
4 | *.pyc
5 | *.swp
6 | .DS_Store
7 | .atom/
8 | .buildlog/
9 | .history
10 | .svn/
11 |
12 | # IntelliJ related
13 | *.iml
14 | *.ipr
15 | *.iws
16 | .idea/
17 |
18 | # The .vscode folder contains launch configuration and tasks you configure in
19 | # VS Code which you may wish to be included in version control, so this line
20 | # is commented out by default.
21 | #.vscode/
22 |
23 | # Flutter/Dart/Pub related
24 | **/doc/api/
25 | .dart_tool/
26 | .flutter-plugins
27 | .flutter-plugins-dependencies
28 | .packages
29 | .pub-cache/
30 | .pub/
31 | build/
32 |
33 | # Android related
34 | **/android/**/gradle-wrapper.jar
35 | **/android/.gradle
36 | **/android/captures/
37 | **/android/gradlew
38 | **/android/gradlew.bat
39 | **/android/local.properties
40 | **/android/**/GeneratedPluginRegistrant.java
41 |
42 | # iOS/XCode related
43 | **/ios/**/*.mode1v3
44 | **/ios/**/*.mode2v3
45 | **/ios/**/*.moved-aside
46 | **/ios/**/*.pbxuser
47 | **/ios/**/*.perspectivev3
48 | **/ios/**/*sync/
49 | **/ios/**/.sconsign.dblite
50 | **/ios/**/.tags*
51 | **/ios/**/.vagrant/
52 | **/ios/**/DerivedData/
53 | **/ios/**/Icon?
54 | **/ios/**/Pods/
55 | **/ios/**/.symlinks/
56 | **/ios/**/profile
57 | **/ios/**/xcuserdata
58 | **/ios/.generated/
59 | **/ios/Flutter/App.framework
60 | **/ios/Flutter/Flutter.framework
61 | **/ios/Flutter/Flutter.podspec
62 | **/ios/Flutter/Generated.xcconfig
63 | **/ios/Flutter/app.flx
64 | **/ios/Flutter/app.zip
65 | **/ios/Flutter/flutter_assets/
66 | **/ios/Flutter/flutter_export_environment.sh
67 | **/ios/ServiceDefinitions.json
68 | **/ios/Runner/GeneratedPluginRegistrant.*
69 |
70 | # Exceptions to above rules.
71 | !**/ios/**/default.mode1v3
72 | !**/ios/**/default.mode2v3
73 | !**/ios/**/default.pbxuser
74 | !**/ios/**/default.perspectivev3
75 | !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages
76 |
--------------------------------------------------------------------------------
/.metadata:
--------------------------------------------------------------------------------
1 | # This file tracks properties of this Flutter project.
2 | # Used by Flutter tool to assess capabilities and perform upgrades etc.
3 | #
4 | # This file should be version controlled and should not be manually edited.
5 |
6 | version:
7 | revision: 0b8abb4724aa590dd0f429683339b1e045a1594d
8 | channel: stable
9 |
10 | project_type: package
11 |
--------------------------------------------------------------------------------
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | ## [1.3.1] - 31st March 2024.
2 |
3 | - Add an option to change `am` and `pm` label
4 | - Time is now responsive and stay at center as height grows
5 | - Add an option to adjust wheel magnification
6 | - Make wheel bounce when overscrolling like native iOS scroll physics
7 | - Add an option to customize text style for `hours`, `minutes` and `seconds` labels
8 | - Add an option to change background color of [Dialog]
9 |
10 | ## [1.3.0+1] - 15th August 2023.
11 |
12 | - added `settings` prop to pass [RouteSettings] to the [PageRouteBuilder]
13 |
14 | ## [1.3.0] - 17th June 2023.
15 |
16 | - added prop to set the sunrise/sunset/dusk timing
17 | - added `showCancelButton` to display the cancel button or not
18 | - auto focus next selector bug fixed
19 | - added linting
20 |
21 | ## [1.2.0+2] - 12th March 2023.
22 |
23 | - Minor bug fix.
24 |
25 | ## [1.2.0+1] - 5th March 2023.
26 |
27 | - Minor bug fix. **IMPORTANT** for people using the `iosStyle`.
28 |
29 | ## [1.2.0] - 23nd February 2023.
30 |
31 | - _**Includes breaking changes**_
32 | - Refactored code to only have one function i.e. `createPicker`.
33 | - `createInlinePicker` is now deprecated.
34 | - Added support to `second` input as well
35 | - Renamed prop `disableAutoFocusMinuteAfterHour` to `disableAutoFocusToNextInput` to work with `second` input as well
36 |
37 | ## [1.1.6] - 22nd February 2023.
38 |
39 | - Added prop `width` and `height` for the picker
40 | - Added prop `disableAutoFocusMinuteAfterHour` to disable autofocus to minute after hour is selected
41 |
42 | ## [1.1.5] - 14th January 2023.
43 |
44 | - Fixed where toggling AM/PM was not triggering the onChange
45 |
46 | ## [1.1.4] - 26th October 2022.
47 |
48 | - Added option to hide buttons
49 | - Fixed issue where newly selected time does not update UI
50 |
51 | ## [1.1.3] - 24th August 2022.
52 |
53 | - Added prop `wheelHeight` (only for `createInlinePicker`)
54 | - Fixed typo in README
55 |
56 | ## [1.1.2] - 23th June 2022.
57 |
58 | - Added prop `cancelButtonStyle`
59 | - Added prop `buttonsSpacing`
60 |
61 | ## [1.1.1] - 14th June 2022.
62 |
63 | - Added optional `onCancel` parameter as a callback for the Cancel button
64 |
65 | ## [1.1.0] - 27th May 2022.
66 |
67 | - Added Support for Flutter 3.0
68 | - Added ButtonStyle for `createInlinePicker` and `showPicker`
69 | - Fixed an issue with the ios style picker
70 |
71 | ## [1.0.5] - 3rd January 2022.
72 |
73 | - Fixed overflow issue on smaller devices
74 | - added Bool `ltrMode = true` for ltrMode `false = rtl` on Displaying the TextDirection
75 | - fixed issue where 24HrFormat is not used with iOS Styled Picker
76 |
77 | ## [1.0.4+1] - 29th December 2021.
78 |
79 | - Fixed import
80 | - Refactored
81 |
82 | ## [1.0.4] - 28th December 2021.
83 |
84 | - Separate `TextStyle` for `ok` and `cancel` text.
85 | - Remove adding `.toUpperCase()` to `ok` and `cancel` text.
86 | - Bug fixes
87 | - Refactoring
88 |
89 | ## [1.0.3+1] - 28th July 2021.
90 |
91 | - Added `TextStyle` prop for ok/cancel button.
92 |
93 | ## [1.0.3] - 28th May 2021.
94 |
95 | - Added Thirty in the `MinuteInterval` enum.
96 |
97 | ## [1.0.2] - 3rd May 2021.
98 |
99 | - Workaround fix for `ImageFilter.blur`.
100 |
101 | ## [1.0.1+1] - 19th April 2021.
102 |
103 | - Added prop to auto focus minute picker.
104 |
105 | ## [1.0.1] - 11th March 2021.
106 |
107 | - Added prop to control Dialog padding.
108 |
109 | ## [1.0.0] - 11th March 2021.
110 |
111 | - Null safety!
112 | - Fixed text scale factor.
113 | - Fixed return data on navigator pop()
114 | - Changed FlatButton to TextButton.
115 |
116 | ## [0.5.0] - 13th February 2021.
117 |
118 | - Added option to return value for inline widget on every onValueChange.
119 | - Added option to hide sun/moon animation header.
120 | - Added `themeData` property.
121 | - Minor performance fixes.
122 | - Other bug fixes.
123 |
124 | ## [0.4.0] - 21st November 2020.
125 |
126 | - Added time picker range.
127 | - Added minute interval.
128 | - Enable/disable hour or minute.
129 | - Added option to render as inline widget.
130 | - Other bug fixes.
131 |
132 | ## [0.3.0+2] - 08th October 2020.
133 |
134 | - Update img src in readme. Yeah twice, coz I am stupid.
135 |
136 | ## [0.3.0+2] - 08th October 2020.
137 |
138 | - Update img src in readme. Yeah twice, coz I am stupid.
139 |
140 | ## [0.3.0+1] - 08th October 2020.
141 |
142 | - Update img src in readme
143 |
144 | ## [0.3.0] - 08th October 2020.
145 |
146 | - Added IOS style picker
147 |
148 | ## [0.2.1+1] - 08th October 2020.
149 |
150 | - Displacement issue fix for Sun and Moon assets
151 |
152 | ## [0.2.1] - 11th August 2020.
153 |
154 | - Added optional `unselectedColor` for options
155 |
156 | ## [0.2.0+1] - 31st July 2020.
157 |
158 | - Updated Documentation
159 |
160 | ## [0.2.0] - 31st July 2020.
161 |
162 | - Added optional callback to return data in DateTime.
163 | - Added other bunch of parameters to customize the picker
164 |
165 | ## [0.1.3+3] - 17th April 2020.
166 |
167 | - Barrier color.
168 |
169 | ## [0.1.3+2] - 16th April 2020.
170 |
171 | - Typo.
172 |
173 | ## [0.1.3+1] - 16th April 2020.
174 |
175 | - Minor patches.
176 |
177 | ## [0.1.3] - 16th April 2020.
178 |
179 | - Added more blur customization.
180 |
181 | ## [0.1.2] - 16th April 2020.
182 |
183 | - Minor optimizations.
184 |
185 | ## [0.1.1] - 3rd April 2020.
186 |
187 | - Minor changes related to example project.
188 |
189 | ## [0.1.0] - 3rd April 2020.
190 |
191 | - Initial release.
192 |
--------------------------------------------------------------------------------
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | # Contributing
2 |
3 | When contributing to this repository, please first discuss the change you wish to make via issue,
4 | email, or any other method with the owners of this repository before making a change.
5 |
6 | Please note we have a code of conduct, please follow it in all your interactions with the project.
7 |
8 | ## Pull Request Process
9 |
10 | 1. Ensure any install or build dependencies are removed before the end of the layer when doing a
11 | build.
12 | 2. Update the README.md with details of changes to the interface, this includes new environment
13 | variables, exposed ports, useful file locations and container parameters.
14 | 3. **Please use `develop` branch as target.**
15 | 4. Increase the version numbers in any examples files and the README.md to the new version that this
16 | Pull Request would represent. The versioning scheme we use is [SemVer](http://semver.org/).
17 | 5. You may merge the Pull Request in once you have the sign-off of two other developers, or if you
18 | do not have permission to do that, you may request the second reviewer to merge it for you.
19 |
20 | > ### **Contribution list**
21 | >
22 | > Please add youself to the contribution list by using the `@all-contributions` bot. See [docs][bot] for more info.
23 |
24 | ## Code of Conduct
25 |
26 | ### Our Pledge
27 |
28 | In the interest of fostering an open and welcoming environment, we as
29 | contributors and maintainers pledge to making participation in our project and
30 | our community a harassment-free experience for everyone, regardless of age, body
31 | size, disability, ethnicity, gender identity and expression, level of experience,
32 | nationality, personal appearance, race, religion, or sexual identity and
33 | orientation.
34 |
35 | ### Our Standards
36 |
37 | Examples of behavior that contributes to creating a positive environment
38 | include:
39 |
40 | - Using welcoming and inclusive language
41 | - Being respectful of differing viewpoints and experiences
42 | - Gracefully accepting constructive criticism
43 | - Focusing on what is best for the community
44 | - Showing empathy towards other community members
45 |
46 | Examples of unacceptable behavior by participants include:
47 |
48 | - The use of sexualized language or imagery and unwelcome sexual attention or
49 | advances
50 | - Trolling, insulting/derogatory comments, and personal or political attacks
51 | - Public or private harassment
52 | - Publishing others' private information, such as a physical or electronic
53 | address, without explicit permission
54 | - Other conduct which could reasonably be considered inappropriate in a
55 | professional setting
56 |
57 | ### Our Responsibilities
58 |
59 | Project maintainers are responsible for clarifying the standards of acceptable
60 | behavior and are expected to take appropriate and fair corrective action in
61 | response to any instances of unacceptable behavior.
62 |
63 | Project maintainers have the right and responsibility to remove, edit, or
64 | reject comments, commits, code, wiki edits, issues, and other contributions
65 | that are not aligned to this Code of Conduct, or to ban temporarily or
66 | permanently any contributor for other behaviors that they deem inappropriate,
67 | threatening, offensive, or harmful.
68 |
69 | ### Scope
70 |
71 | This Code of Conduct applies both within project spaces and in public spaces
72 | when an individual is representing the project or its community. Examples of
73 | representing a project or community include using an official project e-mail
74 | address, posting via an official social media account, or acting as an appointed
75 | representative at an online or offline event. Representation of a project may be
76 | further defined and clarified by project maintainers.
77 |
78 | ### Enforcement
79 |
80 | Instances of abusive, harassing, or otherwise unacceptable behavior may be
81 | reported by contacting the project team at [INSERT EMAIL ADDRESS]. All
82 | complaints will be reviewed and investigated and will result in a response that
83 | is deemed necessary and appropriate to the circumstances. The project team is
84 | obligated to maintain confidentiality with regard to the reporter of an incident.
85 | Further details of specific enforcement policies may be posted separately.
86 |
87 | Project maintainers who do not follow or enforce the Code of Conduct in good
88 | faith may face temporary or permanent repercussions as determined by other
89 | members of the project's leadership.
90 |
91 | ### Attribution
92 |
93 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
94 | available at [http://contributor-covenant.org/version/1/4][version]
95 |
96 | [bot]: https://allcontributors.org/docs/en/bot/usage
97 | [homepage]: http://contributor-covenant.org
98 | [version]: http://contributor-covenant.org/version/1/4/
99 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Apache License
2 | Version 2.0, January 2004
3 | http://www.apache.org/licenses/
4 |
5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6 |
7 | 1. Definitions.
8 |
9 | "License" shall mean the terms and conditions for use, reproduction,
10 | and distribution as defined by Sections 1 through 9 of this document.
11 |
12 | "Licensor" shall mean the copyright owner or entity authorized by
13 | the copyright owner that is granting the License.
14 |
15 | "Legal Entity" shall mean the union of the acting entity and all
16 | other entities that control, are controlled by, or are under common
17 | control with that entity. For the purposes of this definition,
18 | "control" means (i) the power, direct or indirect, to cause the
19 | direction or management of such entity, whether by contract or
20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
21 | outstanding shares, or (iii) beneficial ownership of such entity.
22 |
23 | "You" (or "Your") shall mean an individual or Legal Entity
24 | exercising permissions granted by this License.
25 |
26 | "Source" form shall mean the preferred form for making modifications,
27 | including but not limited to software source code, documentation
28 | source, and configuration files.
29 |
30 | "Object" form shall mean any form resulting from mechanical
31 | transformation or translation of a Source form, including but
32 | not limited to compiled object code, generated documentation,
33 | and conversions to other media types.
34 |
35 | "Work" shall mean the work of authorship, whether in Source or
36 | Object form, made available under the License, as indicated by a
37 | copyright notice that is included in or attached to the work
38 | (an example is provided in the Appendix below).
39 |
40 | "Derivative Works" shall mean any work, whether in Source or Object
41 | form, that is based on (or derived from) the Work and for which the
42 | editorial revisions, annotations, elaborations, or other modifications
43 | represent, as a whole, an original work of authorship. For the purposes
44 | of this License, Derivative Works shall not include works that remain
45 | separable from, or merely link (or bind by name) to the interfaces of,
46 | the Work and Derivative Works thereof.
47 |
48 | "Contribution" shall mean any work of authorship, including
49 | the original version of the Work and any modifications or additions
50 | to that Work or Derivative Works thereof, that is intentionally
51 | submitted to Licensor for inclusion in the Work by the copyright owner
52 | or by an individual or Legal Entity authorized to submit on behalf of
53 | the copyright owner. For the purposes of this definition, "submitted"
54 | means any form of electronic, verbal, or written communication sent
55 | to the Licensor or its representatives, including but not limited to
56 | communication on electronic mailing lists, source code control systems,
57 | and issue tracking systems that are managed by, or on behalf of, the
58 | Licensor for the purpose of discussing and improving the Work, but
59 | excluding communication that is conspicuously marked or otherwise
60 | designated in writing by the copyright owner as "Not a Contribution."
61 |
62 | "Contributor" shall mean Licensor and any individual or Legal Entity
63 | on behalf of whom a Contribution has been received by Licensor and
64 | subsequently incorporated within the Work.
65 |
66 | 2. Grant of Copyright License. Subject to the terms and conditions of
67 | this License, each Contributor hereby grants to You a perpetual,
68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69 | copyright license to reproduce, prepare Derivative Works of,
70 | publicly display, publicly perform, sublicense, and distribute the
71 | Work and such Derivative Works in Source or Object form.
72 |
73 | 3. Grant of Patent License. Subject to the terms and conditions of
74 | this License, each Contributor hereby grants to You a perpetual,
75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76 | (except as stated in this section) patent license to make, have made,
77 | use, offer to sell, sell, import, and otherwise transfer the Work,
78 | where such license applies only to those patent claims licensable
79 | by such Contributor that are necessarily infringed by their
80 | Contribution(s) alone or by combination of their Contribution(s)
81 | with the Work to which such Contribution(s) was submitted. If You
82 | institute patent litigation against any entity (including a
83 | cross-claim or counterclaim in a lawsuit) alleging that the Work
84 | or a Contribution incorporated within the Work constitutes direct
85 | or contributory patent infringement, then any patent licenses
86 | granted to You under this License for that Work shall terminate
87 | as of the date such litigation is filed.
88 |
89 | 4. Redistribution. You may reproduce and distribute copies of the
90 | Work or Derivative Works thereof in any medium, with or without
91 | modifications, and in Source or Object form, provided that You
92 | meet the following conditions:
93 |
94 | (a) You must give any other recipients of the Work or
95 | Derivative Works a copy of this License; and
96 |
97 | (b) You must cause any modified files to carry prominent notices
98 | stating that You changed the files; and
99 |
100 | (c) You must retain, in the Source form of any Derivative Works
101 | that You distribute, all copyright, patent, trademark, and
102 | attribution notices from the Source form of the Work,
103 | excluding those notices that do not pertain to any part of
104 | the Derivative Works; and
105 |
106 | (d) If the Work includes a "NOTICE" text file as part of its
107 | distribution, then any Derivative Works that You distribute must
108 | include a readable copy of the attribution notices contained
109 | within such NOTICE file, excluding those notices that do not
110 | pertain to any part of the Derivative Works, in at least one
111 | of the following places: within a NOTICE text file distributed
112 | as part of the Derivative Works; within the Source form or
113 | documentation, if provided along with the Derivative Works; or,
114 | within a display generated by the Derivative Works, if and
115 | wherever such third-party notices normally appear. The contents
116 | of the NOTICE file are for informational purposes only and
117 | do not modify the License. You may add Your own attribution
118 | notices within Derivative Works that You distribute, alongside
119 | or as an addendum to the NOTICE text from the Work, provided
120 | that such additional attribution notices cannot be construed
121 | as modifying the License.
122 |
123 | You may add Your own copyright statement to Your modifications and
124 | may provide additional or different license terms and conditions
125 | for use, reproduction, or distribution of Your modifications, or
126 | for any such Derivative Works as a whole, provided Your use,
127 | reproduction, and distribution of the Work otherwise complies with
128 | the conditions stated in this License.
129 |
130 | 5. Submission of Contributions. Unless You explicitly state otherwise,
131 | any Contribution intentionally submitted for inclusion in the Work
132 | by You to the Licensor shall be under the terms and conditions of
133 | this License, without any additional terms or conditions.
134 | Notwithstanding the above, nothing herein shall supersede or modify
135 | the terms of any separate license agreement you may have executed
136 | with Licensor regarding such Contributions.
137 |
138 | 6. Trademarks. This License does not grant permission to use the trade
139 | names, trademarks, service marks, or product names of the Licensor,
140 | except as required for reasonable and customary use in describing the
141 | origin of the Work and reproducing the content of the NOTICE file.
142 |
143 | 7. Disclaimer of Warranty. Unless required by applicable law or
144 | agreed to in writing, Licensor provides the Work (and each
145 | Contributor provides its Contributions) on an "AS IS" BASIS,
146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147 | implied, including, without limitation, any warranties or conditions
148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149 | PARTICULAR PURPOSE. You are solely responsible for determining the
150 | appropriateness of using or redistributing the Work and assume any
151 | risks associated with Your exercise of permissions under this License.
152 |
153 | 8. Limitation of Liability. In no event and under no legal theory,
154 | whether in tort (including negligence), contract, or otherwise,
155 | unless required by applicable law (such as deliberate and grossly
156 | negligent acts) or agreed to in writing, shall any Contributor be
157 | liable to You for damages, including any direct, indirect, special,
158 | incidental, or consequential damages of any character arising as a
159 | result of this License or out of the use or inability to use the
160 | Work (including but not limited to damages for loss of goodwill,
161 | work stoppage, computer failure or malfunction, or any and all
162 | other commercial damages or losses), even if such Contributor
163 | has been advised of the possibility of such damages.
164 |
165 | 9. Accepting Warranty or Additional Liability. While redistributing
166 | the Work or Derivative Works thereof, You may choose to offer,
167 | and charge a fee for, acceptance of support, warranty, indemnity,
168 | or other liability obligations and/or rights consistent with this
169 | License. However, in accepting such obligations, You may act only
170 | on Your own behalf and on Your sole responsibility, not on behalf
171 | of any other Contributor, and only if You agree to indemnify,
172 | defend, and hold each Contributor harmless for any liability
173 | incurred by, or claims asserted against, such Contributor by reason
174 | of your accepting any such warranty or additional liability.
175 |
176 | END OF TERMS AND CONDITIONS
177 |
178 | APPENDIX: How to apply the Apache License to your work.
179 |
180 | To apply the Apache License to your work, attach the following
181 | boilerplate notice, with the fields enclosed by brackets "[]"
182 | replaced with your own identifying information. (Don't include
183 | the brackets!) The text should be enclosed in the appropriate
184 | comment syntax for the file format. We also recommend that a
185 | file or class name and description of purpose be included on the
186 | same "printed page" as the copyright notice for easier
187 | identification within third-party archives.
188 |
189 | Copyright 2020 Subhamay Dutta
190 |
191 | Licensed under the Apache License, Version 2.0 (the "License");
192 | you may not use this file except in compliance with the License.
193 | You may obtain a copy of the License at
194 |
195 | http://www.apache.org/licenses/LICENSE-2.0
196 |
197 | Unless required by applicable law or agreed to in writing, software
198 | distributed under the License is distributed on an "AS IS" BASIS,
199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200 | See the License for the specific language governing permissions and
201 | limitations under the License.
202 |
--------------------------------------------------------------------------------
/analysis_options.yaml:
--------------------------------------------------------------------------------
1 | # This file configures the analyzer, which statically analyzes Dart code to
2 | # check for errors, warnings, and lints.
3 | #
4 | # The issues identified by the analyzer are surfaced in the UI of Dart-enabled
5 | # IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
6 | # invoked from the command line by running `flutter analyze`.
7 |
8 | # The following line activates a set of recommended lints for Flutter apps,
9 | # packages, and plugins designed to encourage good coding practices.
10 | include: package:flutter_lints/flutter.yaml
11 |
12 | linter:
13 | # The lint rules applied to this project can be customized in the
14 | # section below to disable rules from the `package:flutter_lints/flutter.yaml`
15 | # included above or to enable additional rules. A list of all available lints
16 | # and their documentation is published at
17 | # https://dart-lang.github.io/linter/lints/index.html.
18 | #
19 | # Instead of disabling a lint rule for the entire project in the
20 | # section below, it can also be suppressed for a single line of code
21 | # or a specific dart file by using the `// ignore: name_of_lint` and
22 | # `// ignore_for_file: name_of_lint` syntax on the line or in the file
23 | # producing the lint.
24 | rules:
25 | # avoid_print: false # Uncomment to disable the `avoid_print` rule
26 | prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
27 | require_trailing_commas: true
28 | # Additional information about this file can be found at
29 | # https://dart.dev/guides/language/analysis-options
30 |
--------------------------------------------------------------------------------
/example.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/subhamayd2/day_night_time_picker/7230d71fb50fd2092c11b83274f633274667d7e5/example.gif
--------------------------------------------------------------------------------
/example/.gitignore:
--------------------------------------------------------------------------------
1 | # Miscellaneous
2 | *.class
3 | *.log
4 | *.pyc
5 | *.swp
6 | .DS_Store
7 | .atom/
8 | .buildlog/
9 | .history
10 | .svn/
11 |
12 | # IntelliJ related
13 | *.iml
14 | *.ipr
15 | *.iws
16 | .idea/
17 |
18 | # The .vscode folder contains launch configuration and tasks you configure in
19 | # VS Code which you may wish to be included in version control, so this line
20 | # is commented out by default.
21 | #.vscode/
22 |
23 | # Flutter/Dart/Pub related
24 | **/doc/api/
25 | .dart_tool/
26 | .flutter-plugins
27 | .flutter-plugins-dependencies
28 | .packages
29 | .pub-cache/
30 | .pub/
31 | /build/
32 |
33 | # Web related
34 | lib/generated_plugin_registrant.dart
35 |
36 | # Exceptions to above rules.
37 | !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages
38 |
--------------------------------------------------------------------------------
/example/.metadata:
--------------------------------------------------------------------------------
1 | # This file tracks properties of this Flutter project.
2 | # Used by Flutter tool to assess capabilities and perform upgrades etc.
3 | #
4 | # This file should be version controlled.
5 |
6 | version:
7 | revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851
8 | channel: stable
9 |
10 | project_type: app
11 |
12 | # Tracks metadata for the flutter migrate command
13 | migration:
14 | platforms:
15 | - platform: root
16 | create_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851
17 | base_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851
18 | - platform: android
19 | create_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851
20 | base_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851
21 | - platform: ios
22 | create_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851
23 | base_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851
24 | - platform: linux
25 | create_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851
26 | base_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851
27 | - platform: macos
28 | create_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851
29 | base_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851
30 | - platform: web
31 | create_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851
32 | base_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851
33 | - platform: windows
34 | create_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851
35 | base_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851
36 |
37 | # User provided section
38 |
39 | # List of Local paths (relative to this file) that should be
40 | # ignored by the migrate tool.
41 | #
42 | # Files that are not part of the templates will be ignored by default.
43 | unmanaged_files:
44 | - 'lib/main.dart'
45 | - 'ios/Runner.xcodeproj/project.pbxproj'
46 |
--------------------------------------------------------------------------------
/example/README.md:
--------------------------------------------------------------------------------
1 | # `EXAMPLE` day_night_time_picker
2 |
3 | > An example project to demonstrate day_night_time_picker package.
4 |
--------------------------------------------------------------------------------
/example/analysis_options.yaml:
--------------------------------------------------------------------------------
1 | # This file configures the analyzer, which statically analyzes Dart code to
2 | # check for errors, warnings, and lints.
3 | #
4 | # The issues identified by the analyzer are surfaced in the UI of Dart-enabled
5 | # IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
6 | # invoked from the command line by running `flutter analyze`.
7 |
8 | # The following line activates a set of recommended lints for Flutter apps,
9 | # packages, and plugins designed to encourage good coding practices.
10 | include: package:flutter_lints/flutter.yaml
11 |
12 | linter:
13 | # The lint rules applied to this project can be customized in the
14 | # section below to disable rules from the `package:flutter_lints/flutter.yaml`
15 | # included above or to enable additional rules. A list of all available lints
16 | # and their documentation is published at
17 | # https://dart-lang.github.io/linter/lints/index.html.
18 | #
19 | # Instead of disabling a lint rule for the entire project in the
20 | # section below, it can also be suppressed for a single line of code
21 | # or a specific dart file by using the `// ignore: name_of_lint` and
22 | # `// ignore_for_file: name_of_lint` syntax on the line or in the file
23 | # producing the lint.
24 | rules:
25 | # avoid_print: false # Uncomment to disable the `avoid_print` rule
26 | # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
27 |
28 | # Additional information about this file can be found at
29 | # https://dart.dev/guides/language/analysis-options
30 |
--------------------------------------------------------------------------------
/example/android/.gitignore:
--------------------------------------------------------------------------------
1 | gradle-wrapper.jar
2 | /.gradle
3 | /captures/
4 | /gradlew
5 | /gradlew.bat
6 | /local.properties
7 | GeneratedPluginRegistrant.java
8 |
9 | # Remember to never publicly share your keystore.
10 | # See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app
11 | key.properties
12 | **/*.keystore
13 | **/*.jks
14 |
--------------------------------------------------------------------------------
/example/android/app/build.gradle:
--------------------------------------------------------------------------------
1 | def localProperties = new Properties()
2 | def localPropertiesFile = rootProject.file('local.properties')
3 | if (localPropertiesFile.exists()) {
4 | localPropertiesFile.withReader('UTF-8') { reader ->
5 | localProperties.load(reader)
6 | }
7 | }
8 |
9 | def flutterRoot = localProperties.getProperty('flutter.sdk')
10 | if (flutterRoot == null) {
11 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
12 | }
13 |
14 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
15 | if (flutterVersionCode == null) {
16 | flutterVersionCode = '1'
17 | }
18 |
19 | def flutterVersionName = localProperties.getProperty('flutter.versionName')
20 | if (flutterVersionName == null) {
21 | flutterVersionName = '1.0'
22 | }
23 |
24 | apply plugin: 'com.android.application'
25 | apply plugin: 'kotlin-android'
26 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
27 |
28 | android {
29 | compileSdkVersion flutter.compileSdkVersion
30 | ndkVersion flutter.ndkVersion
31 |
32 | compileOptions {
33 | sourceCompatibility JavaVersion.VERSION_1_8
34 | targetCompatibility JavaVersion.VERSION_1_8
35 | }
36 |
37 | kotlinOptions {
38 | jvmTarget = '1.8'
39 | }
40 |
41 | sourceSets {
42 | main.java.srcDirs += 'src/main/kotlin'
43 | }
44 |
45 | defaultConfig {
46 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
47 | applicationId "com.example.example"
48 | // You can update the following values to match your application needs.
49 | // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration.
50 | minSdkVersion flutter.minSdkVersion
51 | targetSdkVersion flutter.targetSdkVersion
52 | versionCode flutterVersionCode.toInteger()
53 | versionName flutterVersionName
54 | }
55 |
56 | buildTypes {
57 | release {
58 | // TODO: Add your own signing config for the release build.
59 | // Signing with the debug keys for now, so `flutter run --release` works.
60 | signingConfig signingConfigs.debug
61 | }
62 | }
63 | }
64 |
65 | flutter {
66 | source '../..'
67 | }
68 |
69 | dependencies {
70 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
71 | }
72 |
--------------------------------------------------------------------------------
/example/android/app/src/debug/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/example/android/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
7 |
15 |
19 |
23 |
24 |
25 |
26 |
27 |
28 |
30 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/example/android/app/src/main/kotlin/com/example/example/MainActivity.kt:
--------------------------------------------------------------------------------
1 | package com.example.example
2 |
3 | import io.flutter.embedding.android.FlutterActivity
4 |
5 | class MainActivity: FlutterActivity() {
6 | }
7 |
--------------------------------------------------------------------------------
/example/android/app/src/main/res/drawable-v21/launch_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
12 |
13 |
--------------------------------------------------------------------------------
/example/android/app/src/main/res/drawable/launch_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
12 |
13 |
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/subhamayd2/day_night_time_picker/7230d71fb50fd2092c11b83274f633274667d7e5/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/subhamayd2/day_night_time_picker/7230d71fb50fd2092c11b83274f633274667d7e5/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/subhamayd2/day_night_time_picker/7230d71fb50fd2092c11b83274f633274667d7e5/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/subhamayd2/day_night_time_picker/7230d71fb50fd2092c11b83274f633274667d7e5/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/subhamayd2/day_night_time_picker/7230d71fb50fd2092c11b83274f633274667d7e5/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/values-night/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
9 |
15 |
18 |
19 |
--------------------------------------------------------------------------------
/example/android/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
9 |
15 |
18 |
19 |
--------------------------------------------------------------------------------
/example/android/app/src/profile/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/example/android/build.gradle:
--------------------------------------------------------------------------------
1 | buildscript {
2 | ext.kotlin_version = '1.6.10'
3 | repositories {
4 | google()
5 | mavenCentral()
6 | }
7 |
8 | dependencies {
9 | classpath 'com.android.tools.build:gradle:7.1.2'
10 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
11 | }
12 | }
13 |
14 | allprojects {
15 | repositories {
16 | google()
17 | mavenCentral()
18 | }
19 | }
20 |
21 | rootProject.buildDir = '../build'
22 | subprojects {
23 | project.buildDir = "${rootProject.buildDir}/${project.name}"
24 | }
25 | subprojects {
26 | project.evaluationDependsOn(':app')
27 | }
28 |
29 | task clean(type: Delete) {
30 | delete rootProject.buildDir
31 | }
32 |
--------------------------------------------------------------------------------
/example/android/gradle.properties:
--------------------------------------------------------------------------------
1 | org.gradle.jvmargs=-Xmx1536M
2 | android.useAndroidX=true
3 | android.enableJetifier=true
4 |
--------------------------------------------------------------------------------
/example/android/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Fri Jun 23 08:50:38 CEST 2017
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip
7 |
--------------------------------------------------------------------------------
/example/android/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
3 | def localPropertiesFile = new File(rootProject.projectDir, "local.properties")
4 | def properties = new Properties()
5 |
6 | assert localPropertiesFile.exists()
7 | localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) }
8 |
9 | def flutterSdkPath = properties.getProperty("flutter.sdk")
10 | assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
11 | apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle"
12 |
--------------------------------------------------------------------------------
/example/ios/.gitignore:
--------------------------------------------------------------------------------
1 | **/dgph
2 | *.mode1v3
3 | *.mode2v3
4 | *.moved-aside
5 | *.pbxuser
6 | *.perspectivev3
7 | **/*sync/
8 | .sconsign.dblite
9 | .tags*
10 | **/.vagrant/
11 | **/DerivedData/
12 | Icon?
13 | **/Pods/
14 | **/.symlinks/
15 | profile
16 | xcuserdata
17 | **/.generated/
18 | Flutter/App.framework
19 | Flutter/Flutter.framework
20 | Flutter/Flutter.podspec
21 | Flutter/Generated.xcconfig
22 | Flutter/ephemeral/
23 | Flutter/app.flx
24 | Flutter/app.zip
25 | Flutter/flutter_assets/
26 | Flutter/flutter_export_environment.sh
27 | ServiceDefinitions.json
28 | Runner/GeneratedPluginRegistrant.*
29 |
30 | # Exceptions to above rules.
31 | !default.mode1v3
32 | !default.mode2v3
33 | !default.pbxuser
34 | !default.perspectivev3
35 |
--------------------------------------------------------------------------------
/example/ios/Flutter/AppFrameworkInfo.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | App
9 | CFBundleIdentifier
10 | io.flutter.flutter.app
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | App
15 | CFBundlePackageType
16 | FMWK
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1.0
23 | MinimumOSVersion
24 | 11.0
25 |
26 |
27 |
--------------------------------------------------------------------------------
/example/ios/Flutter/Debug.xcconfig:
--------------------------------------------------------------------------------
1 | #include "Generated.xcconfig"
2 |
--------------------------------------------------------------------------------
/example/ios/Flutter/Release.xcconfig:
--------------------------------------------------------------------------------
1 | #include "Generated.xcconfig"
2 |
--------------------------------------------------------------------------------
/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | PreviewsEnabled
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
37 |
38 |
39 |
40 |
41 |
42 |
52 |
54 |
60 |
61 |
62 |
63 |
69 |
71 |
77 |
78 |
79 |
80 |
82 |
83 |
86 |
87 |
88 |
--------------------------------------------------------------------------------
/example/ios/Runner.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | PreviewsEnabled
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/example/ios/Runner/AppDelegate.swift:
--------------------------------------------------------------------------------
1 | import UIKit
2 | import Flutter
3 |
4 | @UIApplicationMain
5 | @objc class AppDelegate: FlutterAppDelegate {
6 | override func application(
7 | _ application: UIApplication,
8 | didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
9 | ) -> Bool {
10 | GeneratedPluginRegistrant.register(with: self)
11 | return super.application(application, didFinishLaunchingWithOptions: launchOptions)
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "size" : "20x20",
5 | "idiom" : "iphone",
6 | "filename" : "Icon-App-20x20@2x.png",
7 | "scale" : "2x"
8 | },
9 | {
10 | "size" : "20x20",
11 | "idiom" : "iphone",
12 | "filename" : "Icon-App-20x20@3x.png",
13 | "scale" : "3x"
14 | },
15 | {
16 | "size" : "29x29",
17 | "idiom" : "iphone",
18 | "filename" : "Icon-App-29x29@1x.png",
19 | "scale" : "1x"
20 | },
21 | {
22 | "size" : "29x29",
23 | "idiom" : "iphone",
24 | "filename" : "Icon-App-29x29@2x.png",
25 | "scale" : "2x"
26 | },
27 | {
28 | "size" : "29x29",
29 | "idiom" : "iphone",
30 | "filename" : "Icon-App-29x29@3x.png",
31 | "scale" : "3x"
32 | },
33 | {
34 | "size" : "40x40",
35 | "idiom" : "iphone",
36 | "filename" : "Icon-App-40x40@2x.png",
37 | "scale" : "2x"
38 | },
39 | {
40 | "size" : "40x40",
41 | "idiom" : "iphone",
42 | "filename" : "Icon-App-40x40@3x.png",
43 | "scale" : "3x"
44 | },
45 | {
46 | "size" : "60x60",
47 | "idiom" : "iphone",
48 | "filename" : "Icon-App-60x60@2x.png",
49 | "scale" : "2x"
50 | },
51 | {
52 | "size" : "60x60",
53 | "idiom" : "iphone",
54 | "filename" : "Icon-App-60x60@3x.png",
55 | "scale" : "3x"
56 | },
57 | {
58 | "size" : "20x20",
59 | "idiom" : "ipad",
60 | "filename" : "Icon-App-20x20@1x.png",
61 | "scale" : "1x"
62 | },
63 | {
64 | "size" : "20x20",
65 | "idiom" : "ipad",
66 | "filename" : "Icon-App-20x20@2x.png",
67 | "scale" : "2x"
68 | },
69 | {
70 | "size" : "29x29",
71 | "idiom" : "ipad",
72 | "filename" : "Icon-App-29x29@1x.png",
73 | "scale" : "1x"
74 | },
75 | {
76 | "size" : "29x29",
77 | "idiom" : "ipad",
78 | "filename" : "Icon-App-29x29@2x.png",
79 | "scale" : "2x"
80 | },
81 | {
82 | "size" : "40x40",
83 | "idiom" : "ipad",
84 | "filename" : "Icon-App-40x40@1x.png",
85 | "scale" : "1x"
86 | },
87 | {
88 | "size" : "40x40",
89 | "idiom" : "ipad",
90 | "filename" : "Icon-App-40x40@2x.png",
91 | "scale" : "2x"
92 | },
93 | {
94 | "size" : "76x76",
95 | "idiom" : "ipad",
96 | "filename" : "Icon-App-76x76@1x.png",
97 | "scale" : "1x"
98 | },
99 | {
100 | "size" : "76x76",
101 | "idiom" : "ipad",
102 | "filename" : "Icon-App-76x76@2x.png",
103 | "scale" : "2x"
104 | },
105 | {
106 | "size" : "83.5x83.5",
107 | "idiom" : "ipad",
108 | "filename" : "Icon-App-83.5x83.5@2x.png",
109 | "scale" : "2x"
110 | },
111 | {
112 | "size" : "1024x1024",
113 | "idiom" : "ios-marketing",
114 | "filename" : "Icon-App-1024x1024@1x.png",
115 | "scale" : "1x"
116 | }
117 | ],
118 | "info" : {
119 | "version" : 1,
120 | "author" : "xcode"
121 | }
122 | }
123 |
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/subhamayd2/day_night_time_picker/7230d71fb50fd2092c11b83274f633274667d7e5/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/subhamayd2/day_night_time_picker/7230d71fb50fd2092c11b83274f633274667d7e5/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/subhamayd2/day_night_time_picker/7230d71fb50fd2092c11b83274f633274667d7e5/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/subhamayd2/day_night_time_picker/7230d71fb50fd2092c11b83274f633274667d7e5/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/subhamayd2/day_night_time_picker/7230d71fb50fd2092c11b83274f633274667d7e5/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/subhamayd2/day_night_time_picker/7230d71fb50fd2092c11b83274f633274667d7e5/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/subhamayd2/day_night_time_picker/7230d71fb50fd2092c11b83274f633274667d7e5/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/subhamayd2/day_night_time_picker/7230d71fb50fd2092c11b83274f633274667d7e5/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/subhamayd2/day_night_time_picker/7230d71fb50fd2092c11b83274f633274667d7e5/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/subhamayd2/day_night_time_picker/7230d71fb50fd2092c11b83274f633274667d7e5/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/subhamayd2/day_night_time_picker/7230d71fb50fd2092c11b83274f633274667d7e5/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/subhamayd2/day_night_time_picker/7230d71fb50fd2092c11b83274f633274667d7e5/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/subhamayd2/day_night_time_picker/7230d71fb50fd2092c11b83274f633274667d7e5/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/subhamayd2/day_night_time_picker/7230d71fb50fd2092c11b83274f633274667d7e5/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/subhamayd2/day_night_time_picker/7230d71fb50fd2092c11b83274f633274667d7e5/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "LaunchImage.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "filename" : "LaunchImage@2x.png",
11 | "scale" : "2x"
12 | },
13 | {
14 | "idiom" : "universal",
15 | "filename" : "LaunchImage@3x.png",
16 | "scale" : "3x"
17 | }
18 | ],
19 | "info" : {
20 | "version" : 1,
21 | "author" : "xcode"
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/subhamayd2/day_night_time_picker/7230d71fb50fd2092c11b83274f633274667d7e5/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/subhamayd2/day_night_time_picker/7230d71fb50fd2092c11b83274f633274667d7e5/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/subhamayd2/day_night_time_picker/7230d71fb50fd2092c11b83274f633274667d7e5/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md:
--------------------------------------------------------------------------------
1 | # Launch Screen Assets
2 |
3 | You can customize the launch screen with your own desired assets by replacing the image files in this directory.
4 |
5 | You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images.
--------------------------------------------------------------------------------
/example/ios/Runner/Base.lproj/LaunchScreen.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/example/ios/Runner/Base.lproj/Main.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/example/ios/Runner/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
7 | CFBundleDisplayName
8 | Example
9 | CFBundleExecutable
10 | $(EXECUTABLE_NAME)
11 | CFBundleIdentifier
12 | $(PRODUCT_BUNDLE_IDENTIFIER)
13 | CFBundleInfoDictionaryVersion
14 | 6.0
15 | CFBundleName
16 | example
17 | CFBundlePackageType
18 | APPL
19 | CFBundleShortVersionString
20 | $(FLUTTER_BUILD_NAME)
21 | CFBundleSignature
22 | ????
23 | CFBundleVersion
24 | $(FLUTTER_BUILD_NUMBER)
25 | LSRequiresIPhoneOS
26 |
27 | UILaunchStoryboardName
28 | LaunchScreen
29 | UIMainStoryboardFile
30 | Main
31 | UISupportedInterfaceOrientations
32 |
33 | UIInterfaceOrientationPortrait
34 | UIInterfaceOrientationLandscapeLeft
35 | UIInterfaceOrientationLandscapeRight
36 |
37 | UISupportedInterfaceOrientations~ipad
38 |
39 | UIInterfaceOrientationPortrait
40 | UIInterfaceOrientationPortraitUpsideDown
41 | UIInterfaceOrientationLandscapeLeft
42 | UIInterfaceOrientationLandscapeRight
43 |
44 | UIViewControllerBasedStatusBarAppearance
45 |
46 | CADisableMinimumFrameDurationOnPhone
47 |
48 | UIApplicationSupportsIndirectInputEvents
49 |
50 |
51 |
52 |
--------------------------------------------------------------------------------
/example/ios/Runner/Runner-Bridging-Header.h:
--------------------------------------------------------------------------------
1 | #import "GeneratedPluginRegistrant.h"
2 |
--------------------------------------------------------------------------------
/example/lib/main.dart:
--------------------------------------------------------------------------------
1 | import 'package:day_night_time_picker/day_night_time_picker.dart';
2 | import 'package:flutter/material.dart';
3 |
4 | void main() => runApp(const MyApp());
5 |
6 | class MyApp extends StatelessWidget {
7 | const MyApp({Key? key}) : super(key: key);
8 |
9 | @override
10 | Widget build(BuildContext context) {
11 | return MaterialApp(
12 | debugShowCheckedModeBanner: false,
13 | title: 'Time picker',
14 | theme: ThemeData(
15 | primarySwatch: Colors.blue,
16 | ),
17 | home: const Home(),
18 | );
19 | }
20 | }
21 |
22 | class Home extends StatefulWidget {
23 | const Home({Key? key}) : super(key: key);
24 |
25 | @override
26 | // ignore: library_private_types_in_public_api
27 | _HomeState createState() => _HomeState();
28 | }
29 |
30 | class _HomeState extends State {
31 | Time _time = Time(hour: 11, minute: 30, second: 20);
32 | bool iosStyle = true;
33 |
34 | void onTimeChanged(Time newTime) {
35 | setState(() {
36 | _time = newTime;
37 | });
38 | }
39 |
40 | @override
41 | Widget build(BuildContext context) {
42 | return Scaffold(
43 | body: SafeArea(
44 | child: Center(
45 | child: SingleChildScrollView(
46 | child: Column(
47 | mainAxisAlignment: MainAxisAlignment.center,
48 | children: [
49 | Text(
50 | "Popup Picker Style",
51 | style: Theme.of(context).textTheme.titleLarge,
52 | ),
53 | Text(
54 | "${_time.hour}:${_time.minute}:${_time.second} ${_time.period.name}"
55 | .toUpperCase(),
56 | textAlign: TextAlign.center,
57 | style: Theme.of(context).textTheme.displayLarge,
58 | ),
59 | const SizedBox(height: 10),
60 | TextButton(
61 | style: TextButton.styleFrom(
62 | backgroundColor: Theme.of(context).colorScheme.secondary,
63 | ),
64 | onPressed: () {
65 | Navigator.of(context).push(
66 | showPicker(
67 | showSecondSelector: true,
68 | context: context,
69 | value: _time,
70 | onChange: onTimeChanged,
71 | minuteInterval: TimePickerInterval.FIVE,
72 | // Optional onChange to receive value as DateTime
73 | onChangeDateTime: (DateTime dateTime) {
74 | // print(dateTime);
75 | debugPrint("[debug datetime]: $dateTime");
76 | },
77 | ),
78 | );
79 | },
80 | child: const Text(
81 | "Open time picker",
82 | style: TextStyle(color: Colors.white),
83 | ),
84 | ),
85 | const SizedBox(height: 10),
86 | const Divider(),
87 | const SizedBox(height: 10),
88 | Text(
89 | "Inline Picker Style",
90 | style: Theme.of(context).textTheme.titleLarge,
91 | ),
92 | SizedBox(
93 | width: 400,
94 | // Render inline widget
95 | child: showPicker(
96 | isInlinePicker: true,
97 | elevation: 1,
98 | value: _time,
99 | onChange: onTimeChanged,
100 | minuteInterval: TimePickerInterval.FIVE,
101 | iosStylePicker: iosStyle,
102 | minHour: 9,
103 | maxHour: 21,
104 | is24HrFormat: false,
105 | ),
106 | ),
107 | Text(
108 | "IOS Style",
109 | style: Theme.of(context).textTheme.bodyLarge,
110 | ),
111 | Switch(
112 | value: iosStyle,
113 | onChanged: (newVal) {
114 | setState(() {
115 | iosStyle = newVal;
116 | });
117 | },
118 | )
119 | ],
120 | ),
121 | ),
122 | ),
123 | ),
124 | );
125 | }
126 | }
127 |
--------------------------------------------------------------------------------
/example/linux/.gitignore:
--------------------------------------------------------------------------------
1 | flutter/ephemeral
2 |
--------------------------------------------------------------------------------
/example/linux/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # Project-level configuration.
2 | cmake_minimum_required(VERSION 3.10)
3 | project(runner LANGUAGES CXX)
4 |
5 | # The name of the executable created for the application. Change this to change
6 | # the on-disk name of your application.
7 | set(BINARY_NAME "example")
8 | # The unique GTK application identifier for this application. See:
9 | # https://wiki.gnome.org/HowDoI/ChooseApplicationID
10 | set(APPLICATION_ID "com.example.example")
11 |
12 | # Explicitly opt in to modern CMake behaviors to avoid warnings with recent
13 | # versions of CMake.
14 | cmake_policy(SET CMP0063 NEW)
15 |
16 | # Load bundled libraries from the lib/ directory relative to the binary.
17 | set(CMAKE_INSTALL_RPATH "$ORIGIN/lib")
18 |
19 | # Root filesystem for cross-building.
20 | if(FLUTTER_TARGET_PLATFORM_SYSROOT)
21 | set(CMAKE_SYSROOT ${FLUTTER_TARGET_PLATFORM_SYSROOT})
22 | set(CMAKE_FIND_ROOT_PATH ${CMAKE_SYSROOT})
23 | set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
24 | set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
25 | set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
26 | set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
27 | endif()
28 |
29 | # Define build configuration options.
30 | if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
31 | set(CMAKE_BUILD_TYPE "Debug" CACHE
32 | STRING "Flutter build mode" FORCE)
33 | set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
34 | "Debug" "Profile" "Release")
35 | endif()
36 |
37 | # Compilation settings that should be applied to most targets.
38 | #
39 | # Be cautious about adding new options here, as plugins use this function by
40 | # default. In most cases, you should add new options to specific targets instead
41 | # of modifying this function.
42 | function(APPLY_STANDARD_SETTINGS TARGET)
43 | target_compile_features(${TARGET} PUBLIC cxx_std_14)
44 | target_compile_options(${TARGET} PRIVATE -Wall -Werror)
45 | target_compile_options(${TARGET} PRIVATE "$<$>:-O3>")
46 | target_compile_definitions(${TARGET} PRIVATE "$<$>:NDEBUG>")
47 | endfunction()
48 |
49 | # Flutter library and tool build rules.
50 | set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter")
51 | add_subdirectory(${FLUTTER_MANAGED_DIR})
52 |
53 | # System-level dependencies.
54 | find_package(PkgConfig REQUIRED)
55 | pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0)
56 |
57 | add_definitions(-DAPPLICATION_ID="${APPLICATION_ID}")
58 |
59 | # Define the application target. To change its name, change BINARY_NAME above,
60 | # not the value here, or `flutter run` will no longer work.
61 | #
62 | # Any new source files that you add to the application should be added here.
63 | add_executable(${BINARY_NAME}
64 | "main.cc"
65 | "my_application.cc"
66 | "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc"
67 | )
68 |
69 | # Apply the standard set of build settings. This can be removed for applications
70 | # that need different build settings.
71 | apply_standard_settings(${BINARY_NAME})
72 |
73 | # Add dependency libraries. Add any application-specific dependencies here.
74 | target_link_libraries(${BINARY_NAME} PRIVATE flutter)
75 | target_link_libraries(${BINARY_NAME} PRIVATE PkgConfig::GTK)
76 |
77 | # Run the Flutter tool portions of the build. This must not be removed.
78 | add_dependencies(${BINARY_NAME} flutter_assemble)
79 |
80 | # Only the install-generated bundle's copy of the executable will launch
81 | # correctly, since the resources must in the right relative locations. To avoid
82 | # people trying to run the unbundled copy, put it in a subdirectory instead of
83 | # the default top-level location.
84 | set_target_properties(${BINARY_NAME}
85 | PROPERTIES
86 | RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/intermediates_do_not_run"
87 | )
88 |
89 | # Generated plugin build rules, which manage building the plugins and adding
90 | # them to the application.
91 | include(flutter/generated_plugins.cmake)
92 |
93 |
94 | # === Installation ===
95 | # By default, "installing" just makes a relocatable bundle in the build
96 | # directory.
97 | set(BUILD_BUNDLE_DIR "${PROJECT_BINARY_DIR}/bundle")
98 | if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
99 | set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE)
100 | endif()
101 |
102 | # Start with a clean build bundle directory every time.
103 | install(CODE "
104 | file(REMOVE_RECURSE \"${BUILD_BUNDLE_DIR}/\")
105 | " COMPONENT Runtime)
106 |
107 | set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data")
108 | set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib")
109 |
110 | install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}"
111 | COMPONENT Runtime)
112 |
113 | install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}"
114 | COMPONENT Runtime)
115 |
116 | install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
117 | COMPONENT Runtime)
118 |
119 | foreach(bundled_library ${PLUGIN_BUNDLED_LIBRARIES})
120 | install(FILES "${bundled_library}"
121 | DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
122 | COMPONENT Runtime)
123 | endforeach(bundled_library)
124 |
125 | # Fully re-copy the assets directory on each build to avoid having stale files
126 | # from a previous install.
127 | set(FLUTTER_ASSET_DIR_NAME "flutter_assets")
128 | install(CODE "
129 | file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\")
130 | " COMPONENT Runtime)
131 | install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}"
132 | DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime)
133 |
134 | # Install the AOT library on non-Debug builds only.
135 | if(NOT CMAKE_BUILD_TYPE MATCHES "Debug")
136 | install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
137 | COMPONENT Runtime)
138 | endif()
139 |
--------------------------------------------------------------------------------
/example/linux/flutter/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # This file controls Flutter-level build steps. It should not be edited.
2 | cmake_minimum_required(VERSION 3.10)
3 |
4 | set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral")
5 |
6 | # Configuration provided via flutter tool.
7 | include(${EPHEMERAL_DIR}/generated_config.cmake)
8 |
9 | # TODO: Move the rest of this into files in ephemeral. See
10 | # https://github.com/flutter/flutter/issues/57146.
11 |
12 | # Serves the same purpose as list(TRANSFORM ... PREPEND ...),
13 | # which isn't available in 3.10.
14 | function(list_prepend LIST_NAME PREFIX)
15 | set(NEW_LIST "")
16 | foreach(element ${${LIST_NAME}})
17 | list(APPEND NEW_LIST "${PREFIX}${element}")
18 | endforeach(element)
19 | set(${LIST_NAME} "${NEW_LIST}" PARENT_SCOPE)
20 | endfunction()
21 |
22 | # === Flutter Library ===
23 | # System-level dependencies.
24 | find_package(PkgConfig REQUIRED)
25 | pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0)
26 | pkg_check_modules(GLIB REQUIRED IMPORTED_TARGET glib-2.0)
27 | pkg_check_modules(GIO REQUIRED IMPORTED_TARGET gio-2.0)
28 |
29 | set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/libflutter_linux_gtk.so")
30 |
31 | # Published to parent scope for install step.
32 | set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE)
33 | set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE)
34 | set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE)
35 | set(AOT_LIBRARY "${PROJECT_DIR}/build/lib/libapp.so" PARENT_SCOPE)
36 |
37 | list(APPEND FLUTTER_LIBRARY_HEADERS
38 | "fl_basic_message_channel.h"
39 | "fl_binary_codec.h"
40 | "fl_binary_messenger.h"
41 | "fl_dart_project.h"
42 | "fl_engine.h"
43 | "fl_json_message_codec.h"
44 | "fl_json_method_codec.h"
45 | "fl_message_codec.h"
46 | "fl_method_call.h"
47 | "fl_method_channel.h"
48 | "fl_method_codec.h"
49 | "fl_method_response.h"
50 | "fl_plugin_registrar.h"
51 | "fl_plugin_registry.h"
52 | "fl_standard_message_codec.h"
53 | "fl_standard_method_codec.h"
54 | "fl_string_codec.h"
55 | "fl_value.h"
56 | "fl_view.h"
57 | "flutter_linux.h"
58 | )
59 | list_prepend(FLUTTER_LIBRARY_HEADERS "${EPHEMERAL_DIR}/flutter_linux/")
60 | add_library(flutter INTERFACE)
61 | target_include_directories(flutter INTERFACE
62 | "${EPHEMERAL_DIR}"
63 | )
64 | target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}")
65 | target_link_libraries(flutter INTERFACE
66 | PkgConfig::GTK
67 | PkgConfig::GLIB
68 | PkgConfig::GIO
69 | )
70 | add_dependencies(flutter flutter_assemble)
71 |
72 | # === Flutter tool backend ===
73 | # _phony_ is a non-existent file to force this command to run every time,
74 | # since currently there's no way to get a full input/output list from the
75 | # flutter tool.
76 | add_custom_command(
77 | OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS}
78 | ${CMAKE_CURRENT_BINARY_DIR}/_phony_
79 | COMMAND ${CMAKE_COMMAND} -E env
80 | ${FLUTTER_TOOL_ENVIRONMENT}
81 | "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.sh"
82 | ${FLUTTER_TARGET_PLATFORM} ${CMAKE_BUILD_TYPE}
83 | VERBATIM
84 | )
85 | add_custom_target(flutter_assemble DEPENDS
86 | "${FLUTTER_LIBRARY}"
87 | ${FLUTTER_LIBRARY_HEADERS}
88 | )
89 |
--------------------------------------------------------------------------------
/example/linux/flutter/generated_plugin_registrant.cc:
--------------------------------------------------------------------------------
1 | //
2 | // Generated file. Do not edit.
3 | //
4 |
5 | // clang-format off
6 |
7 | #include "generated_plugin_registrant.h"
8 |
9 |
10 | void fl_register_plugins(FlPluginRegistry* registry) {
11 | }
12 |
--------------------------------------------------------------------------------
/example/linux/flutter/generated_plugin_registrant.h:
--------------------------------------------------------------------------------
1 | //
2 | // Generated file. Do not edit.
3 | //
4 |
5 | // clang-format off
6 |
7 | #ifndef GENERATED_PLUGIN_REGISTRANT_
8 | #define GENERATED_PLUGIN_REGISTRANT_
9 |
10 | #include
11 |
12 | // Registers Flutter plugins.
13 | void fl_register_plugins(FlPluginRegistry* registry);
14 |
15 | #endif // GENERATED_PLUGIN_REGISTRANT_
16 |
--------------------------------------------------------------------------------
/example/linux/flutter/generated_plugins.cmake:
--------------------------------------------------------------------------------
1 | #
2 | # Generated file, do not edit.
3 | #
4 |
5 | list(APPEND FLUTTER_PLUGIN_LIST
6 | )
7 |
8 | list(APPEND FLUTTER_FFI_PLUGIN_LIST
9 | )
10 |
11 | set(PLUGIN_BUNDLED_LIBRARIES)
12 |
13 | foreach(plugin ${FLUTTER_PLUGIN_LIST})
14 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/linux plugins/${plugin})
15 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin)
16 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $)
17 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries})
18 | endforeach(plugin)
19 |
20 | foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST})
21 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin})
22 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries})
23 | endforeach(ffi_plugin)
24 |
--------------------------------------------------------------------------------
/example/linux/main.cc:
--------------------------------------------------------------------------------
1 | #include "my_application.h"
2 |
3 | int main(int argc, char** argv) {
4 | g_autoptr(MyApplication) app = my_application_new();
5 | return g_application_run(G_APPLICATION(app), argc, argv);
6 | }
7 |
--------------------------------------------------------------------------------
/example/linux/my_application.cc:
--------------------------------------------------------------------------------
1 | #include "my_application.h"
2 |
3 | #include
4 | #ifdef GDK_WINDOWING_X11
5 | #include
6 | #endif
7 |
8 | #include "flutter/generated_plugin_registrant.h"
9 |
10 | struct _MyApplication {
11 | GtkApplication parent_instance;
12 | char** dart_entrypoint_arguments;
13 | };
14 |
15 | G_DEFINE_TYPE(MyApplication, my_application, GTK_TYPE_APPLICATION)
16 |
17 | // Implements GApplication::activate.
18 | static void my_application_activate(GApplication* application) {
19 | MyApplication* self = MY_APPLICATION(application);
20 | GtkWindow* window =
21 | GTK_WINDOW(gtk_application_window_new(GTK_APPLICATION(application)));
22 |
23 | // Use a header bar when running in GNOME as this is the common style used
24 | // by applications and is the setup most users will be using (e.g. Ubuntu
25 | // desktop).
26 | // If running on X and not using GNOME then just use a traditional title bar
27 | // in case the window manager does more exotic layout, e.g. tiling.
28 | // If running on Wayland assume the header bar will work (may need changing
29 | // if future cases occur).
30 | gboolean use_header_bar = TRUE;
31 | #ifdef GDK_WINDOWING_X11
32 | GdkScreen* screen = gtk_window_get_screen(window);
33 | if (GDK_IS_X11_SCREEN(screen)) {
34 | const gchar* wm_name = gdk_x11_screen_get_window_manager_name(screen);
35 | if (g_strcmp0(wm_name, "GNOME Shell") != 0) {
36 | use_header_bar = FALSE;
37 | }
38 | }
39 | #endif
40 | if (use_header_bar) {
41 | GtkHeaderBar* header_bar = GTK_HEADER_BAR(gtk_header_bar_new());
42 | gtk_widget_show(GTK_WIDGET(header_bar));
43 | gtk_header_bar_set_title(header_bar, "example");
44 | gtk_header_bar_set_show_close_button(header_bar, TRUE);
45 | gtk_window_set_titlebar(window, GTK_WIDGET(header_bar));
46 | } else {
47 | gtk_window_set_title(window, "example");
48 | }
49 |
50 | gtk_window_set_default_size(window, 1280, 720);
51 | gtk_widget_show(GTK_WIDGET(window));
52 |
53 | g_autoptr(FlDartProject) project = fl_dart_project_new();
54 | fl_dart_project_set_dart_entrypoint_arguments(project, self->dart_entrypoint_arguments);
55 |
56 | FlView* view = fl_view_new(project);
57 | gtk_widget_show(GTK_WIDGET(view));
58 | gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(view));
59 |
60 | fl_register_plugins(FL_PLUGIN_REGISTRY(view));
61 |
62 | gtk_widget_grab_focus(GTK_WIDGET(view));
63 | }
64 |
65 | // Implements GApplication::local_command_line.
66 | static gboolean my_application_local_command_line(GApplication* application, gchar*** arguments, int* exit_status) {
67 | MyApplication* self = MY_APPLICATION(application);
68 | // Strip out the first argument as it is the binary name.
69 | self->dart_entrypoint_arguments = g_strdupv(*arguments + 1);
70 |
71 | g_autoptr(GError) error = nullptr;
72 | if (!g_application_register(application, nullptr, &error)) {
73 | g_warning("Failed to register: %s", error->message);
74 | *exit_status = 1;
75 | return TRUE;
76 | }
77 |
78 | g_application_activate(application);
79 | *exit_status = 0;
80 |
81 | return TRUE;
82 | }
83 |
84 | // Implements GObject::dispose.
85 | static void my_application_dispose(GObject* object) {
86 | MyApplication* self = MY_APPLICATION(object);
87 | g_clear_pointer(&self->dart_entrypoint_arguments, g_strfreev);
88 | G_OBJECT_CLASS(my_application_parent_class)->dispose(object);
89 | }
90 |
91 | static void my_application_class_init(MyApplicationClass* klass) {
92 | G_APPLICATION_CLASS(klass)->activate = my_application_activate;
93 | G_APPLICATION_CLASS(klass)->local_command_line = my_application_local_command_line;
94 | G_OBJECT_CLASS(klass)->dispose = my_application_dispose;
95 | }
96 |
97 | static void my_application_init(MyApplication* self) {}
98 |
99 | MyApplication* my_application_new() {
100 | return MY_APPLICATION(g_object_new(my_application_get_type(),
101 | "application-id", APPLICATION_ID,
102 | "flags", G_APPLICATION_NON_UNIQUE,
103 | nullptr));
104 | }
105 |
--------------------------------------------------------------------------------
/example/linux/my_application.h:
--------------------------------------------------------------------------------
1 | #ifndef FLUTTER_MY_APPLICATION_H_
2 | #define FLUTTER_MY_APPLICATION_H_
3 |
4 | #include
5 |
6 | G_DECLARE_FINAL_TYPE(MyApplication, my_application, MY, APPLICATION,
7 | GtkApplication)
8 |
9 | /**
10 | * my_application_new:
11 | *
12 | * Creates a new Flutter-based application.
13 | *
14 | * Returns: a new #MyApplication.
15 | */
16 | MyApplication* my_application_new();
17 |
18 | #endif // FLUTTER_MY_APPLICATION_H_
19 |
--------------------------------------------------------------------------------
/example/macos/.gitignore:
--------------------------------------------------------------------------------
1 | # Flutter-related
2 | **/Flutter/ephemeral/
3 | **/Pods/
4 |
5 | # Xcode-related
6 | **/dgph
7 | **/xcuserdata/
8 |
--------------------------------------------------------------------------------
/example/macos/Flutter/Flutter-Debug.xcconfig:
--------------------------------------------------------------------------------
1 | #include "ephemeral/Flutter-Generated.xcconfig"
2 |
--------------------------------------------------------------------------------
/example/macos/Flutter/Flutter-Release.xcconfig:
--------------------------------------------------------------------------------
1 | #include "ephemeral/Flutter-Generated.xcconfig"
2 |
--------------------------------------------------------------------------------
/example/macos/Flutter/GeneratedPluginRegistrant.swift:
--------------------------------------------------------------------------------
1 | //
2 | // Generated file. Do not edit.
3 | //
4 |
5 | import FlutterMacOS
6 | import Foundation
7 |
8 |
9 | func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
10 | }
11 |
--------------------------------------------------------------------------------
/example/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
37 |
38 |
39 |
40 |
41 |
42 |
52 |
54 |
60 |
61 |
62 |
63 |
69 |
71 |
77 |
78 |
79 |
80 |
82 |
83 |
86 |
87 |
88 |
--------------------------------------------------------------------------------
/example/macos/Runner.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/example/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/example/macos/Runner/AppDelegate.swift:
--------------------------------------------------------------------------------
1 | import Cocoa
2 | import FlutterMacOS
3 |
4 | @NSApplicationMain
5 | class AppDelegate: FlutterAppDelegate {
6 | override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool {
7 | return true
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "size" : "16x16",
5 | "idiom" : "mac",
6 | "filename" : "app_icon_16.png",
7 | "scale" : "1x"
8 | },
9 | {
10 | "size" : "16x16",
11 | "idiom" : "mac",
12 | "filename" : "app_icon_32.png",
13 | "scale" : "2x"
14 | },
15 | {
16 | "size" : "32x32",
17 | "idiom" : "mac",
18 | "filename" : "app_icon_32.png",
19 | "scale" : "1x"
20 | },
21 | {
22 | "size" : "32x32",
23 | "idiom" : "mac",
24 | "filename" : "app_icon_64.png",
25 | "scale" : "2x"
26 | },
27 | {
28 | "size" : "128x128",
29 | "idiom" : "mac",
30 | "filename" : "app_icon_128.png",
31 | "scale" : "1x"
32 | },
33 | {
34 | "size" : "128x128",
35 | "idiom" : "mac",
36 | "filename" : "app_icon_256.png",
37 | "scale" : "2x"
38 | },
39 | {
40 | "size" : "256x256",
41 | "idiom" : "mac",
42 | "filename" : "app_icon_256.png",
43 | "scale" : "1x"
44 | },
45 | {
46 | "size" : "256x256",
47 | "idiom" : "mac",
48 | "filename" : "app_icon_512.png",
49 | "scale" : "2x"
50 | },
51 | {
52 | "size" : "512x512",
53 | "idiom" : "mac",
54 | "filename" : "app_icon_512.png",
55 | "scale" : "1x"
56 | },
57 | {
58 | "size" : "512x512",
59 | "idiom" : "mac",
60 | "filename" : "app_icon_1024.png",
61 | "scale" : "2x"
62 | }
63 | ],
64 | "info" : {
65 | "version" : 1,
66 | "author" : "xcode"
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/subhamayd2/day_night_time_picker/7230d71fb50fd2092c11b83274f633274667d7e5/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png
--------------------------------------------------------------------------------
/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/subhamayd2/day_night_time_picker/7230d71fb50fd2092c11b83274f633274667d7e5/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png
--------------------------------------------------------------------------------
/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/subhamayd2/day_night_time_picker/7230d71fb50fd2092c11b83274f633274667d7e5/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png
--------------------------------------------------------------------------------
/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/subhamayd2/day_night_time_picker/7230d71fb50fd2092c11b83274f633274667d7e5/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png
--------------------------------------------------------------------------------
/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/subhamayd2/day_night_time_picker/7230d71fb50fd2092c11b83274f633274667d7e5/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png
--------------------------------------------------------------------------------
/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/subhamayd2/day_night_time_picker/7230d71fb50fd2092c11b83274f633274667d7e5/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png
--------------------------------------------------------------------------------
/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/subhamayd2/day_night_time_picker/7230d71fb50fd2092c11b83274f633274667d7e5/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png
--------------------------------------------------------------------------------
/example/macos/Runner/Configs/AppInfo.xcconfig:
--------------------------------------------------------------------------------
1 | // Application-level settings for the Runner target.
2 | //
3 | // This may be replaced with something auto-generated from metadata (e.g., pubspec.yaml) in the
4 | // future. If not, the values below would default to using the project name when this becomes a
5 | // 'flutter create' template.
6 |
7 | // The application's name. By default this is also the title of the Flutter window.
8 | PRODUCT_NAME = example
9 |
10 | // The application's bundle identifier
11 | PRODUCT_BUNDLE_IDENTIFIER = com.example.example
12 |
13 | // The copyright displayed in application information
14 | PRODUCT_COPYRIGHT = Copyright © 2022 com.example. All rights reserved.
15 |
--------------------------------------------------------------------------------
/example/macos/Runner/Configs/Debug.xcconfig:
--------------------------------------------------------------------------------
1 | #include "../../Flutter/Flutter-Debug.xcconfig"
2 | #include "Warnings.xcconfig"
3 |
--------------------------------------------------------------------------------
/example/macos/Runner/Configs/Release.xcconfig:
--------------------------------------------------------------------------------
1 | #include "../../Flutter/Flutter-Release.xcconfig"
2 | #include "Warnings.xcconfig"
3 |
--------------------------------------------------------------------------------
/example/macos/Runner/Configs/Warnings.xcconfig:
--------------------------------------------------------------------------------
1 | WARNING_CFLAGS = -Wall -Wconditional-uninitialized -Wnullable-to-nonnull-conversion -Wmissing-method-return-type -Woverlength-strings
2 | GCC_WARN_UNDECLARED_SELECTOR = YES
3 | CLANG_UNDEFINED_BEHAVIOR_SANITIZER_NULLABILITY = YES
4 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE
5 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES
6 | CLANG_WARN_PRAGMA_PACK = YES
7 | CLANG_WARN_STRICT_PROTOTYPES = YES
8 | CLANG_WARN_COMMA = YES
9 | GCC_WARN_STRICT_SELECTOR_MATCH = YES
10 | CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES
11 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES
12 | GCC_WARN_SHADOW = YES
13 | CLANG_WARN_UNREACHABLE_CODE = YES
14 |
--------------------------------------------------------------------------------
/example/macos/Runner/DebugProfile.entitlements:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | com.apple.security.app-sandbox
6 |
7 | com.apple.security.cs.allow-jit
8 |
9 | com.apple.security.network.server
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/example/macos/Runner/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIconFile
10 |
11 | CFBundleIdentifier
12 | $(PRODUCT_BUNDLE_IDENTIFIER)
13 | CFBundleInfoDictionaryVersion
14 | 6.0
15 | CFBundleName
16 | $(PRODUCT_NAME)
17 | CFBundlePackageType
18 | APPL
19 | CFBundleShortVersionString
20 | $(FLUTTER_BUILD_NAME)
21 | CFBundleVersion
22 | $(FLUTTER_BUILD_NUMBER)
23 | LSMinimumSystemVersion
24 | $(MACOSX_DEPLOYMENT_TARGET)
25 | NSHumanReadableCopyright
26 | $(PRODUCT_COPYRIGHT)
27 | NSMainNibFile
28 | MainMenu
29 | NSPrincipalClass
30 | NSApplication
31 |
32 |
33 |
--------------------------------------------------------------------------------
/example/macos/Runner/MainFlutterWindow.swift:
--------------------------------------------------------------------------------
1 | import Cocoa
2 | import FlutterMacOS
3 |
4 | class MainFlutterWindow: NSWindow {
5 | override func awakeFromNib() {
6 | let flutterViewController = FlutterViewController.init()
7 | let windowFrame = self.frame
8 | self.contentViewController = flutterViewController
9 | self.setFrame(windowFrame, display: true)
10 |
11 | RegisterGeneratedPlugins(registry: flutterViewController)
12 |
13 | super.awakeFromNib()
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/example/macos/Runner/Release.entitlements:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | com.apple.security.app-sandbox
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/example/pubspec.lock:
--------------------------------------------------------------------------------
1 | # Generated by pub
2 | # See https://dart.dev/tools/pub/glossary#lockfile
3 | packages:
4 | async:
5 | dependency: transitive
6 | description:
7 | name: async
8 | sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c"
9 | url: "https://pub.dev"
10 | source: hosted
11 | version: "2.11.0"
12 | boolean_selector:
13 | dependency: transitive
14 | description:
15 | name: boolean_selector
16 | sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66"
17 | url: "https://pub.dev"
18 | source: hosted
19 | version: "2.1.1"
20 | characters:
21 | dependency: transitive
22 | description:
23 | name: characters
24 | sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605"
25 | url: "https://pub.dev"
26 | source: hosted
27 | version: "1.3.0"
28 | clock:
29 | dependency: transitive
30 | description:
31 | name: clock
32 | sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf
33 | url: "https://pub.dev"
34 | source: hosted
35 | version: "1.1.1"
36 | collection:
37 | dependency: transitive
38 | description:
39 | name: collection
40 | sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a
41 | url: "https://pub.dev"
42 | source: hosted
43 | version: "1.18.0"
44 | cupertino_icons:
45 | dependency: "direct main"
46 | description:
47 | name: cupertino_icons
48 | sha256: d57953e10f9f8327ce64a508a355f0b1ec902193f66288e8cb5070e7c47eeb2d
49 | url: "https://pub.dev"
50 | source: hosted
51 | version: "1.0.6"
52 | day_night_time_picker:
53 | dependency: "direct main"
54 | description:
55 | path: ".."
56 | relative: true
57 | source: path
58 | version: "1.3.0+1"
59 | fake_async:
60 | dependency: transitive
61 | description:
62 | name: fake_async
63 | sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78"
64 | url: "https://pub.dev"
65 | source: hosted
66 | version: "1.3.1"
67 | flutter:
68 | dependency: "direct main"
69 | description: flutter
70 | source: sdk
71 | version: "0.0.0"
72 | flutter_lints:
73 | dependency: "direct dev"
74 | description:
75 | name: flutter_lints
76 | sha256: a25a15ebbdfc33ab1cd26c63a6ee519df92338a9c10f122adda92938253bef04
77 | url: "https://pub.dev"
78 | source: hosted
79 | version: "2.0.3"
80 | flutter_test:
81 | dependency: "direct dev"
82 | description: flutter
83 | source: sdk
84 | version: "0.0.0"
85 | lints:
86 | dependency: transitive
87 | description:
88 | name: lints
89 | sha256: "0a217c6c989d21039f1498c3ed9f3ed71b354e69873f13a8dfc3c9fe76f1b452"
90 | url: "https://pub.dev"
91 | source: hosted
92 | version: "2.1.1"
93 | matcher:
94 | dependency: transitive
95 | description:
96 | name: matcher
97 | sha256: "1803e76e6653768d64ed8ff2e1e67bea3ad4b923eb5c56a295c3e634bad5960e"
98 | url: "https://pub.dev"
99 | source: hosted
100 | version: "0.12.16"
101 | material_color_utilities:
102 | dependency: transitive
103 | description:
104 | name: material_color_utilities
105 | sha256: "9528f2f296073ff54cb9fee677df673ace1218163c3bc7628093e7eed5203d41"
106 | url: "https://pub.dev"
107 | source: hosted
108 | version: "0.5.0"
109 | meta:
110 | dependency: transitive
111 | description:
112 | name: meta
113 | sha256: a6e590c838b18133bb482a2745ad77c5bb7715fb0451209e1a7567d416678b8e
114 | url: "https://pub.dev"
115 | source: hosted
116 | version: "1.10.0"
117 | path:
118 | dependency: transitive
119 | description:
120 | name: path
121 | sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917"
122 | url: "https://pub.dev"
123 | source: hosted
124 | version: "1.8.3"
125 | sky_engine:
126 | dependency: transitive
127 | description: flutter
128 | source: sdk
129 | version: "0.0.99"
130 | source_span:
131 | dependency: transitive
132 | description:
133 | name: source_span
134 | sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c"
135 | url: "https://pub.dev"
136 | source: hosted
137 | version: "1.10.0"
138 | stack_trace:
139 | dependency: transitive
140 | description:
141 | name: stack_trace
142 | sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b"
143 | url: "https://pub.dev"
144 | source: hosted
145 | version: "1.11.1"
146 | stream_channel:
147 | dependency: transitive
148 | description:
149 | name: stream_channel
150 | sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7
151 | url: "https://pub.dev"
152 | source: hosted
153 | version: "2.1.2"
154 | string_scanner:
155 | dependency: transitive
156 | description:
157 | name: string_scanner
158 | sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde"
159 | url: "https://pub.dev"
160 | source: hosted
161 | version: "1.2.0"
162 | term_glyph:
163 | dependency: transitive
164 | description:
165 | name: term_glyph
166 | sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84
167 | url: "https://pub.dev"
168 | source: hosted
169 | version: "1.2.1"
170 | test_api:
171 | dependency: transitive
172 | description:
173 | name: test_api
174 | sha256: "5c2f730018264d276c20e4f1503fd1308dfbbae39ec8ee63c5236311ac06954b"
175 | url: "https://pub.dev"
176 | source: hosted
177 | version: "0.6.1"
178 | vector_math:
179 | dependency: transitive
180 | description:
181 | name: vector_math
182 | sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803"
183 | url: "https://pub.dev"
184 | source: hosted
185 | version: "2.1.4"
186 | web:
187 | dependency: transitive
188 | description:
189 | name: web
190 | sha256: afe077240a270dcfd2aafe77602b4113645af95d0ad31128cc02bce5ac5d5152
191 | url: "https://pub.dev"
192 | source: hosted
193 | version: "0.3.0"
194 | sdks:
195 | dart: ">=3.2.0-194.0.dev <4.0.0"
196 |
--------------------------------------------------------------------------------
/example/pubspec.yaml:
--------------------------------------------------------------------------------
1 | name: example
2 | description: A new Flutter project.
3 | publish_to: none
4 |
5 | # The following defines the version and build number for your application.
6 | # A version number is three numbers separated by dots, like 1.2.43
7 | # followed by an optional build number separated by a +.
8 | # Both the version and the builder number may be overridden in flutter
9 | # build by specifying --build-name and --build-number, respectively.
10 | # In Android, build-name is used as versionName while build-number used as versionCode.
11 | # Read more about Android versioning at https://developer.android.com/studio/publish/versioning
12 | # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
13 | # Read more about iOS versioning at
14 | # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
15 | version: 1.0.0+1
16 |
17 | environment:
18 | sdk: ">=2.15.0 <3.0.0"
19 |
20 | dependencies:
21 | flutter:
22 | sdk: flutter
23 |
24 | # The following adds the Cupertino Icons font to your application.
25 | # Use with the CupertinoIcons class for iOS style icons.
26 | cupertino_icons: ^1.0.4
27 | day_night_time_picker:
28 | path: ../
29 |
30 | dev_dependencies:
31 | flutter_test:
32 | sdk: flutter
33 | flutter_lints: ^2.0.1
34 |
35 | # For information on the generic Dart part of this file, see the
36 | # following page: https://dart.dev/tools/pub/pubspec
37 |
38 | # The following section is specific to Flutter.
39 | flutter:
40 | # The following line ensures that the Material Icons font is
41 | # included with your application, so that you can use the icons in
42 | # the material Icons class.
43 | uses-material-design: true
44 | # To add assets to your application, add an assets section, like this:
45 | # assets:
46 | # - images/a_dot_burr.jpeg
47 | # - images/a_dot_ham.jpeg
48 | # An image asset can refer to one or more resolution-specific "variants", see
49 | # https://flutter.dev/assets-and-images/#resolution-aware.
50 | # For details regarding adding assets from package dependencies, see
51 | # https://flutter.dev/assets-and-images/#from-packages
52 | # To add custom fonts to your application, add a fonts section here,
53 | # in this "flutter" section. Each entry in this list should have a
54 | # "family" key with the font family name, and a "fonts" key with a
55 | # list giving the asset and other descriptors for the font. For
56 | # example:
57 | # fonts:
58 | # - family: Schyler
59 | # fonts:
60 | # - asset: fonts/Schyler-Regular.ttf
61 | # - asset: fonts/Schyler-Italic.ttf
62 | # style: italic
63 | # - family: Trajan Pro
64 | # fonts:
65 | # - asset: fonts/TrajanPro.ttf
66 | # - asset: fonts/TrajanPro_Bold.ttf
67 | # weight: 700
68 | #
69 | # For details regarding fonts from package dependencies,
70 | # see https://flutter.dev/custom-fonts/#from-packages
71 |
--------------------------------------------------------------------------------
/example/test/widget_test.dart:
--------------------------------------------------------------------------------
1 | // This is a basic Flutter widget test.
2 | //
3 | // To perform an interaction with a widget in your test, use the WidgetTester
4 | // utility that Flutter provides. For example, you can send tap and scroll
5 | // gestures. You can also use WidgetTester to find child widgets in the widget
6 | // tree, read text, and verify that the values of widget properties are correct.
7 |
8 | import 'package:flutter/material.dart';
9 | import 'package:flutter_test/flutter_test.dart';
10 |
11 | // import 'package:example/main.dart';
12 |
13 | void main() {
14 | testWidgets('Counter increments smoke test', (WidgetTester tester) async {
15 | // Build our app and trigger a frame.
16 | // await tester.pumpWidget(MyApp());
17 |
18 | // Verify that our counter starts at 0.
19 | expect(find.text('0'), findsOneWidget);
20 | expect(find.text('1'), findsNothing);
21 |
22 | // Tap the '+' icon and trigger a frame.
23 | await tester.tap(find.byIcon(Icons.add));
24 | await tester.pump();
25 |
26 | // Verify that our counter has incremented.
27 | expect(find.text('0'), findsNothing);
28 | expect(find.text('1'), findsOneWidget);
29 | });
30 | }
31 |
--------------------------------------------------------------------------------
/example/web/favicon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/subhamayd2/day_night_time_picker/7230d71fb50fd2092c11b83274f633274667d7e5/example/web/favicon.png
--------------------------------------------------------------------------------
/example/web/icons/Icon-192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/subhamayd2/day_night_time_picker/7230d71fb50fd2092c11b83274f633274667d7e5/example/web/icons/Icon-192.png
--------------------------------------------------------------------------------
/example/web/icons/Icon-512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/subhamayd2/day_night_time_picker/7230d71fb50fd2092c11b83274f633274667d7e5/example/web/icons/Icon-512.png
--------------------------------------------------------------------------------
/example/web/icons/Icon-maskable-192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/subhamayd2/day_night_time_picker/7230d71fb50fd2092c11b83274f633274667d7e5/example/web/icons/Icon-maskable-192.png
--------------------------------------------------------------------------------
/example/web/icons/Icon-maskable-512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/subhamayd2/day_night_time_picker/7230d71fb50fd2092c11b83274f633274667d7e5/example/web/icons/Icon-maskable-512.png
--------------------------------------------------------------------------------
/example/web/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 | day_night_time_picker
30 |
31 |
32 |
33 |
36 |
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/example/web/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "day_night_time_picker",
3 | "short_name": "day_night_time_picker",
4 | "start_url": ".",
5 | "display": "standalone",
6 | "background_color": "#0175C2",
7 | "theme_color": "#0175C2",
8 | "description": "A new Flutter project.",
9 | "orientation": "portrait-primary",
10 | "prefer_related_applications": false,
11 | "icons": [
12 | {
13 | "src": "icons/Icon-192.png",
14 | "sizes": "192x192",
15 | "type": "image/png"
16 | },
17 | {
18 | "src": "icons/Icon-512.png",
19 | "sizes": "512x512",
20 | "type": "image/png"
21 | }
22 | ]
23 | }
--------------------------------------------------------------------------------
/example/windows/.gitignore:
--------------------------------------------------------------------------------
1 | flutter/ephemeral/
2 |
3 | # Visual Studio user-specific files.
4 | *.suo
5 | *.user
6 | *.userosscache
7 | *.sln.docstates
8 |
9 | # Visual Studio build-related files.
10 | x64/
11 | x86/
12 |
13 | # Visual Studio cache files
14 | # files ending in .cache can be ignored
15 | *.[Cc]ache
16 | # but keep track of directories ending in .cache
17 | !*.[Cc]ache/
18 |
--------------------------------------------------------------------------------
/example/windows/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # Project-level configuration.
2 | cmake_minimum_required(VERSION 3.14)
3 | project(example LANGUAGES CXX)
4 |
5 | # The name of the executable created for the application. Change this to change
6 | # the on-disk name of your application.
7 | set(BINARY_NAME "example")
8 |
9 | # Explicitly opt in to modern CMake behaviors to avoid warnings with recent
10 | # versions of CMake.
11 | cmake_policy(SET CMP0063 NEW)
12 |
13 | # Define build configuration option.
14 | get_property(IS_MULTICONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
15 | if(IS_MULTICONFIG)
16 | set(CMAKE_CONFIGURATION_TYPES "Debug;Profile;Release"
17 | CACHE STRING "" FORCE)
18 | else()
19 | if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
20 | set(CMAKE_BUILD_TYPE "Debug" CACHE
21 | STRING "Flutter build mode" FORCE)
22 | set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
23 | "Debug" "Profile" "Release")
24 | endif()
25 | endif()
26 | # Define settings for the Profile build mode.
27 | set(CMAKE_EXE_LINKER_FLAGS_PROFILE "${CMAKE_EXE_LINKER_FLAGS_RELEASE}")
28 | set(CMAKE_SHARED_LINKER_FLAGS_PROFILE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE}")
29 | set(CMAKE_C_FLAGS_PROFILE "${CMAKE_C_FLAGS_RELEASE}")
30 | set(CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_RELEASE}")
31 |
32 | # Use Unicode for all projects.
33 | add_definitions(-DUNICODE -D_UNICODE)
34 |
35 | # Compilation settings that should be applied to most targets.
36 | #
37 | # Be cautious about adding new options here, as plugins use this function by
38 | # default. In most cases, you should add new options to specific targets instead
39 | # of modifying this function.
40 | function(APPLY_STANDARD_SETTINGS TARGET)
41 | target_compile_features(${TARGET} PUBLIC cxx_std_17)
42 | target_compile_options(${TARGET} PRIVATE /W4 /WX /wd"4100")
43 | target_compile_options(${TARGET} PRIVATE /EHsc)
44 | target_compile_definitions(${TARGET} PRIVATE "_HAS_EXCEPTIONS=0")
45 | target_compile_definitions(${TARGET} PRIVATE "$<$:_DEBUG>")
46 | endfunction()
47 |
48 | # Flutter library and tool build rules.
49 | set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter")
50 | add_subdirectory(${FLUTTER_MANAGED_DIR})
51 |
52 | # Application build; see runner/CMakeLists.txt.
53 | add_subdirectory("runner")
54 |
55 | # Generated plugin build rules, which manage building the plugins and adding
56 | # them to the application.
57 | include(flutter/generated_plugins.cmake)
58 |
59 |
60 | # === Installation ===
61 | # Support files are copied into place next to the executable, so that it can
62 | # run in place. This is done instead of making a separate bundle (as on Linux)
63 | # so that building and running from within Visual Studio will work.
64 | set(BUILD_BUNDLE_DIR "$")
65 | # Make the "install" step default, as it's required to run.
66 | set(CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD 1)
67 | if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
68 | set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE)
69 | endif()
70 |
71 | set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data")
72 | set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}")
73 |
74 | install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}"
75 | COMPONENT Runtime)
76 |
77 | install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}"
78 | COMPONENT Runtime)
79 |
80 | install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
81 | COMPONENT Runtime)
82 |
83 | if(PLUGIN_BUNDLED_LIBRARIES)
84 | install(FILES "${PLUGIN_BUNDLED_LIBRARIES}"
85 | DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
86 | COMPONENT Runtime)
87 | endif()
88 |
89 | # Fully re-copy the assets directory on each build to avoid having stale files
90 | # from a previous install.
91 | set(FLUTTER_ASSET_DIR_NAME "flutter_assets")
92 | install(CODE "
93 | file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\")
94 | " COMPONENT Runtime)
95 | install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}"
96 | DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime)
97 |
98 | # Install the AOT library on non-Debug builds only.
99 | install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}"
100 | CONFIGURATIONS Profile;Release
101 | COMPONENT Runtime)
102 |
--------------------------------------------------------------------------------
/example/windows/flutter/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # This file controls Flutter-level build steps. It should not be edited.
2 | cmake_minimum_required(VERSION 3.14)
3 |
4 | set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral")
5 |
6 | # Configuration provided via flutter tool.
7 | include(${EPHEMERAL_DIR}/generated_config.cmake)
8 |
9 | # TODO: Move the rest of this into files in ephemeral. See
10 | # https://github.com/flutter/flutter/issues/57146.
11 | set(WRAPPER_ROOT "${EPHEMERAL_DIR}/cpp_client_wrapper")
12 |
13 | # === Flutter Library ===
14 | set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/flutter_windows.dll")
15 |
16 | # Published to parent scope for install step.
17 | set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE)
18 | set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE)
19 | set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE)
20 | set(AOT_LIBRARY "${PROJECT_DIR}/build/windows/app.so" PARENT_SCOPE)
21 |
22 | list(APPEND FLUTTER_LIBRARY_HEADERS
23 | "flutter_export.h"
24 | "flutter_windows.h"
25 | "flutter_messenger.h"
26 | "flutter_plugin_registrar.h"
27 | "flutter_texture_registrar.h"
28 | )
29 | list(TRANSFORM FLUTTER_LIBRARY_HEADERS PREPEND "${EPHEMERAL_DIR}/")
30 | add_library(flutter INTERFACE)
31 | target_include_directories(flutter INTERFACE
32 | "${EPHEMERAL_DIR}"
33 | )
34 | target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}.lib")
35 | add_dependencies(flutter flutter_assemble)
36 |
37 | # === Wrapper ===
38 | list(APPEND CPP_WRAPPER_SOURCES_CORE
39 | "core_implementations.cc"
40 | "standard_codec.cc"
41 | )
42 | list(TRANSFORM CPP_WRAPPER_SOURCES_CORE PREPEND "${WRAPPER_ROOT}/")
43 | list(APPEND CPP_WRAPPER_SOURCES_PLUGIN
44 | "plugin_registrar.cc"
45 | )
46 | list(TRANSFORM CPP_WRAPPER_SOURCES_PLUGIN PREPEND "${WRAPPER_ROOT}/")
47 | list(APPEND CPP_WRAPPER_SOURCES_APP
48 | "flutter_engine.cc"
49 | "flutter_view_controller.cc"
50 | )
51 | list(TRANSFORM CPP_WRAPPER_SOURCES_APP PREPEND "${WRAPPER_ROOT}/")
52 |
53 | # Wrapper sources needed for a plugin.
54 | add_library(flutter_wrapper_plugin STATIC
55 | ${CPP_WRAPPER_SOURCES_CORE}
56 | ${CPP_WRAPPER_SOURCES_PLUGIN}
57 | )
58 | apply_standard_settings(flutter_wrapper_plugin)
59 | set_target_properties(flutter_wrapper_plugin PROPERTIES
60 | POSITION_INDEPENDENT_CODE ON)
61 | set_target_properties(flutter_wrapper_plugin PROPERTIES
62 | CXX_VISIBILITY_PRESET hidden)
63 | target_link_libraries(flutter_wrapper_plugin PUBLIC flutter)
64 | target_include_directories(flutter_wrapper_plugin PUBLIC
65 | "${WRAPPER_ROOT}/include"
66 | )
67 | add_dependencies(flutter_wrapper_plugin flutter_assemble)
68 |
69 | # Wrapper sources needed for the runner.
70 | add_library(flutter_wrapper_app STATIC
71 | ${CPP_WRAPPER_SOURCES_CORE}
72 | ${CPP_WRAPPER_SOURCES_APP}
73 | )
74 | apply_standard_settings(flutter_wrapper_app)
75 | target_link_libraries(flutter_wrapper_app PUBLIC flutter)
76 | target_include_directories(flutter_wrapper_app PUBLIC
77 | "${WRAPPER_ROOT}/include"
78 | )
79 | add_dependencies(flutter_wrapper_app flutter_assemble)
80 |
81 | # === Flutter tool backend ===
82 | # _phony_ is a non-existent file to force this command to run every time,
83 | # since currently there's no way to get a full input/output list from the
84 | # flutter tool.
85 | set(PHONY_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/_phony_")
86 | set_source_files_properties("${PHONY_OUTPUT}" PROPERTIES SYMBOLIC TRUE)
87 | add_custom_command(
88 | OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS}
89 | ${CPP_WRAPPER_SOURCES_CORE} ${CPP_WRAPPER_SOURCES_PLUGIN}
90 | ${CPP_WRAPPER_SOURCES_APP}
91 | ${PHONY_OUTPUT}
92 | COMMAND ${CMAKE_COMMAND} -E env
93 | ${FLUTTER_TOOL_ENVIRONMENT}
94 | "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.bat"
95 | windows-x64 $
96 | VERBATIM
97 | )
98 | add_custom_target(flutter_assemble DEPENDS
99 | "${FLUTTER_LIBRARY}"
100 | ${FLUTTER_LIBRARY_HEADERS}
101 | ${CPP_WRAPPER_SOURCES_CORE}
102 | ${CPP_WRAPPER_SOURCES_PLUGIN}
103 | ${CPP_WRAPPER_SOURCES_APP}
104 | )
105 |
--------------------------------------------------------------------------------
/example/windows/flutter/generated_plugin_registrant.cc:
--------------------------------------------------------------------------------
1 | //
2 | // Generated file. Do not edit.
3 | //
4 |
5 | // clang-format off
6 |
7 | #include "generated_plugin_registrant.h"
8 |
9 |
10 | void RegisterPlugins(flutter::PluginRegistry* registry) {
11 | }
12 |
--------------------------------------------------------------------------------
/example/windows/flutter/generated_plugin_registrant.h:
--------------------------------------------------------------------------------
1 | //
2 | // Generated file. Do not edit.
3 | //
4 |
5 | // clang-format off
6 |
7 | #ifndef GENERATED_PLUGIN_REGISTRANT_
8 | #define GENERATED_PLUGIN_REGISTRANT_
9 |
10 | #include
11 |
12 | // Registers Flutter plugins.
13 | void RegisterPlugins(flutter::PluginRegistry* registry);
14 |
15 | #endif // GENERATED_PLUGIN_REGISTRANT_
16 |
--------------------------------------------------------------------------------
/example/windows/flutter/generated_plugins.cmake:
--------------------------------------------------------------------------------
1 | #
2 | # Generated file, do not edit.
3 | #
4 |
5 | list(APPEND FLUTTER_PLUGIN_LIST
6 | )
7 |
8 | list(APPEND FLUTTER_FFI_PLUGIN_LIST
9 | )
10 |
11 | set(PLUGIN_BUNDLED_LIBRARIES)
12 |
13 | foreach(plugin ${FLUTTER_PLUGIN_LIST})
14 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin})
15 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin)
16 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $)
17 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries})
18 | endforeach(plugin)
19 |
20 | foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST})
21 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin})
22 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries})
23 | endforeach(ffi_plugin)
24 |
--------------------------------------------------------------------------------
/example/windows/runner/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.14)
2 | project(runner LANGUAGES CXX)
3 |
4 | # Define the application target. To change its name, change BINARY_NAME in the
5 | # top-level CMakeLists.txt, not the value here, or `flutter run` will no longer
6 | # work.
7 | #
8 | # Any new source files that you add to the application should be added here.
9 | add_executable(${BINARY_NAME} WIN32
10 | "flutter_window.cpp"
11 | "main.cpp"
12 | "utils.cpp"
13 | "win32_window.cpp"
14 | "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc"
15 | "Runner.rc"
16 | "runner.exe.manifest"
17 | )
18 |
19 | # Apply the standard set of build settings. This can be removed for applications
20 | # that need different build settings.
21 | apply_standard_settings(${BINARY_NAME})
22 |
23 | # Disable Windows macros that collide with C++ standard library functions.
24 | target_compile_definitions(${BINARY_NAME} PRIVATE "NOMINMAX")
25 |
26 | # Add dependency libraries and include directories. Add any application-specific
27 | # dependencies here.
28 | target_link_libraries(${BINARY_NAME} PRIVATE flutter flutter_wrapper_app)
29 | target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}")
30 |
31 | # Run the Flutter tool portions of the build. This must not be removed.
32 | add_dependencies(${BINARY_NAME} flutter_assemble)
33 |
--------------------------------------------------------------------------------
/example/windows/runner/Runner.rc:
--------------------------------------------------------------------------------
1 | // Microsoft Visual C++ generated resource script.
2 | //
3 | #pragma code_page(65001)
4 | #include "resource.h"
5 |
6 | #define APSTUDIO_READONLY_SYMBOLS
7 | /////////////////////////////////////////////////////////////////////////////
8 | //
9 | // Generated from the TEXTINCLUDE 2 resource.
10 | //
11 | #include "winres.h"
12 |
13 | /////////////////////////////////////////////////////////////////////////////
14 | #undef APSTUDIO_READONLY_SYMBOLS
15 |
16 | /////////////////////////////////////////////////////////////////////////////
17 | // English (United States) resources
18 |
19 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
20 | LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
21 |
22 | #ifdef APSTUDIO_INVOKED
23 | /////////////////////////////////////////////////////////////////////////////
24 | //
25 | // TEXTINCLUDE
26 | //
27 |
28 | 1 TEXTINCLUDE
29 | BEGIN
30 | "resource.h\0"
31 | END
32 |
33 | 2 TEXTINCLUDE
34 | BEGIN
35 | "#include ""winres.h""\r\n"
36 | "\0"
37 | END
38 |
39 | 3 TEXTINCLUDE
40 | BEGIN
41 | "\r\n"
42 | "\0"
43 | END
44 |
45 | #endif // APSTUDIO_INVOKED
46 |
47 |
48 | /////////////////////////////////////////////////////////////////////////////
49 | //
50 | // Icon
51 | //
52 |
53 | // Icon with lowest ID value placed first to ensure application icon
54 | // remains consistent on all systems.
55 | IDI_APP_ICON ICON "resources\\app_icon.ico"
56 |
57 |
58 | /////////////////////////////////////////////////////////////////////////////
59 | //
60 | // Version
61 | //
62 |
63 | #ifdef FLUTTER_BUILD_NUMBER
64 | #define VERSION_AS_NUMBER FLUTTER_BUILD_NUMBER
65 | #else
66 | #define VERSION_AS_NUMBER 1,0,0
67 | #endif
68 |
69 | #ifdef FLUTTER_BUILD_NAME
70 | #define VERSION_AS_STRING #FLUTTER_BUILD_NAME
71 | #else
72 | #define VERSION_AS_STRING "1.0.0"
73 | #endif
74 |
75 | VS_VERSION_INFO VERSIONINFO
76 | FILEVERSION VERSION_AS_NUMBER
77 | PRODUCTVERSION VERSION_AS_NUMBER
78 | FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
79 | #ifdef _DEBUG
80 | FILEFLAGS VS_FF_DEBUG
81 | #else
82 | FILEFLAGS 0x0L
83 | #endif
84 | FILEOS VOS__WINDOWS32
85 | FILETYPE VFT_APP
86 | FILESUBTYPE 0x0L
87 | BEGIN
88 | BLOCK "StringFileInfo"
89 | BEGIN
90 | BLOCK "040904e4"
91 | BEGIN
92 | VALUE "CompanyName", "com.example" "\0"
93 | VALUE "FileDescription", "example" "\0"
94 | VALUE "FileVersion", VERSION_AS_STRING "\0"
95 | VALUE "InternalName", "example" "\0"
96 | VALUE "LegalCopyright", "Copyright (C) 2022 com.example. All rights reserved." "\0"
97 | VALUE "OriginalFilename", "example.exe" "\0"
98 | VALUE "ProductName", "example" "\0"
99 | VALUE "ProductVersion", VERSION_AS_STRING "\0"
100 | END
101 | END
102 | BLOCK "VarFileInfo"
103 | BEGIN
104 | VALUE "Translation", 0x409, 1252
105 | END
106 | END
107 |
108 | #endif // English (United States) resources
109 | /////////////////////////////////////////////////////////////////////////////
110 |
111 |
112 |
113 | #ifndef APSTUDIO_INVOKED
114 | /////////////////////////////////////////////////////////////////////////////
115 | //
116 | // Generated from the TEXTINCLUDE 3 resource.
117 | //
118 |
119 |
120 | /////////////////////////////////////////////////////////////////////////////
121 | #endif // not APSTUDIO_INVOKED
122 |
--------------------------------------------------------------------------------
/example/windows/runner/flutter_window.cpp:
--------------------------------------------------------------------------------
1 | #include "flutter_window.h"
2 |
3 | #include
4 |
5 | #include "flutter/generated_plugin_registrant.h"
6 |
7 | FlutterWindow::FlutterWindow(const flutter::DartProject& project)
8 | : project_(project) {}
9 |
10 | FlutterWindow::~FlutterWindow() {}
11 |
12 | bool FlutterWindow::OnCreate() {
13 | if (!Win32Window::OnCreate()) {
14 | return false;
15 | }
16 |
17 | RECT frame = GetClientArea();
18 |
19 | // The size here must match the window dimensions to avoid unnecessary surface
20 | // creation / destruction in the startup path.
21 | flutter_controller_ = std::make_unique(
22 | frame.right - frame.left, frame.bottom - frame.top, project_);
23 | // Ensure that basic setup of the controller was successful.
24 | if (!flutter_controller_->engine() || !flutter_controller_->view()) {
25 | return false;
26 | }
27 | RegisterPlugins(flutter_controller_->engine());
28 | SetChildContent(flutter_controller_->view()->GetNativeWindow());
29 | return true;
30 | }
31 |
32 | void FlutterWindow::OnDestroy() {
33 | if (flutter_controller_) {
34 | flutter_controller_ = nullptr;
35 | }
36 |
37 | Win32Window::OnDestroy();
38 | }
39 |
40 | LRESULT
41 | FlutterWindow::MessageHandler(HWND hwnd, UINT const message,
42 | WPARAM const wparam,
43 | LPARAM const lparam) noexcept {
44 | // Give Flutter, including plugins, an opportunity to handle window messages.
45 | if (flutter_controller_) {
46 | std::optional result =
47 | flutter_controller_->HandleTopLevelWindowProc(hwnd, message, wparam,
48 | lparam);
49 | if (result) {
50 | return *result;
51 | }
52 | }
53 |
54 | switch (message) {
55 | case WM_FONTCHANGE:
56 | flutter_controller_->engine()->ReloadSystemFonts();
57 | break;
58 | }
59 |
60 | return Win32Window::MessageHandler(hwnd, message, wparam, lparam);
61 | }
62 |
--------------------------------------------------------------------------------
/example/windows/runner/flutter_window.h:
--------------------------------------------------------------------------------
1 | #ifndef RUNNER_FLUTTER_WINDOW_H_
2 | #define RUNNER_FLUTTER_WINDOW_H_
3 |
4 | #include
5 | #include
6 |
7 | #include
8 |
9 | #include "win32_window.h"
10 |
11 | // A window that does nothing but host a Flutter view.
12 | class FlutterWindow : public Win32Window {
13 | public:
14 | // Creates a new FlutterWindow hosting a Flutter view running |project|.
15 | explicit FlutterWindow(const flutter::DartProject& project);
16 | virtual ~FlutterWindow();
17 |
18 | protected:
19 | // Win32Window:
20 | bool OnCreate() override;
21 | void OnDestroy() override;
22 | LRESULT MessageHandler(HWND window, UINT const message, WPARAM const wparam,
23 | LPARAM const lparam) noexcept override;
24 |
25 | private:
26 | // The project to run.
27 | flutter::DartProject project_;
28 |
29 | // The Flutter instance hosted by this window.
30 | std::unique_ptr flutter_controller_;
31 | };
32 |
33 | #endif // RUNNER_FLUTTER_WINDOW_H_
34 |
--------------------------------------------------------------------------------
/example/windows/runner/main.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 |
5 | #include "flutter_window.h"
6 | #include "utils.h"
7 |
8 | int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev,
9 | _In_ wchar_t *command_line, _In_ int show_command) {
10 | // Attach to console when present (e.g., 'flutter run') or create a
11 | // new console when running with a debugger.
12 | if (!::AttachConsole(ATTACH_PARENT_PROCESS) && ::IsDebuggerPresent()) {
13 | CreateAndAttachConsole();
14 | }
15 |
16 | // Initialize COM, so that it is available for use in the library and/or
17 | // plugins.
18 | ::CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED);
19 |
20 | flutter::DartProject project(L"data");
21 |
22 | std::vector command_line_arguments =
23 | GetCommandLineArguments();
24 |
25 | project.set_dart_entrypoint_arguments(std::move(command_line_arguments));
26 |
27 | FlutterWindow window(project);
28 | Win32Window::Point origin(10, 10);
29 | Win32Window::Size size(1280, 720);
30 | if (!window.CreateAndShow(L"example", origin, size)) {
31 | return EXIT_FAILURE;
32 | }
33 | window.SetQuitOnClose(true);
34 |
35 | ::MSG msg;
36 | while (::GetMessage(&msg, nullptr, 0, 0)) {
37 | ::TranslateMessage(&msg);
38 | ::DispatchMessage(&msg);
39 | }
40 |
41 | ::CoUninitialize();
42 | return EXIT_SUCCESS;
43 | }
44 |
--------------------------------------------------------------------------------
/example/windows/runner/resource.h:
--------------------------------------------------------------------------------
1 | //{{NO_DEPENDENCIES}}
2 | // Microsoft Visual C++ generated include file.
3 | // Used by Runner.rc
4 | //
5 | #define IDI_APP_ICON 101
6 |
7 | // Next default values for new objects
8 | //
9 | #ifdef APSTUDIO_INVOKED
10 | #ifndef APSTUDIO_READONLY_SYMBOLS
11 | #define _APS_NEXT_RESOURCE_VALUE 102
12 | #define _APS_NEXT_COMMAND_VALUE 40001
13 | #define _APS_NEXT_CONTROL_VALUE 1001
14 | #define _APS_NEXT_SYMED_VALUE 101
15 | #endif
16 | #endif
17 |
--------------------------------------------------------------------------------
/example/windows/runner/resources/app_icon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/subhamayd2/day_night_time_picker/7230d71fb50fd2092c11b83274f633274667d7e5/example/windows/runner/resources/app_icon.ico
--------------------------------------------------------------------------------
/example/windows/runner/runner.exe.manifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | PerMonitorV2
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/example/windows/runner/utils.cpp:
--------------------------------------------------------------------------------
1 | #include "utils.h"
2 |
3 | #include
4 | #include
5 | #include
6 | #include
7 |
8 | #include
9 |
10 | void CreateAndAttachConsole() {
11 | if (::AllocConsole()) {
12 | FILE *unused;
13 | if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
14 | _dup2(_fileno(stdout), 1);
15 | }
16 | if (freopen_s(&unused, "CONOUT$", "w", stderr)) {
17 | _dup2(_fileno(stdout), 2);
18 | }
19 | std::ios::sync_with_stdio();
20 | FlutterDesktopResyncOutputStreams();
21 | }
22 | }
23 |
24 | std::vector GetCommandLineArguments() {
25 | // Convert the UTF-16 command line arguments to UTF-8 for the Engine to use.
26 | int argc;
27 | wchar_t** argv = ::CommandLineToArgvW(::GetCommandLineW(), &argc);
28 | if (argv == nullptr) {
29 | return std::vector();
30 | }
31 |
32 | std::vector command_line_arguments;
33 |
34 | // Skip the first argument as it's the binary name.
35 | for (int i = 1; i < argc; i++) {
36 | command_line_arguments.push_back(Utf8FromUtf16(argv[i]));
37 | }
38 |
39 | ::LocalFree(argv);
40 |
41 | return command_line_arguments;
42 | }
43 |
44 | std::string Utf8FromUtf16(const wchar_t* utf16_string) {
45 | if (utf16_string == nullptr) {
46 | return std::string();
47 | }
48 | int target_length = ::WideCharToMultiByte(
49 | CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string,
50 | -1, nullptr, 0, nullptr, nullptr);
51 | std::string utf8_string;
52 | if (target_length == 0 || target_length > utf8_string.max_size()) {
53 | return utf8_string;
54 | }
55 | utf8_string.resize(target_length);
56 | int converted_length = ::WideCharToMultiByte(
57 | CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string,
58 | -1, utf8_string.data(),
59 | target_length, nullptr, nullptr);
60 | if (converted_length == 0) {
61 | return std::string();
62 | }
63 | return utf8_string;
64 | }
65 |
--------------------------------------------------------------------------------
/example/windows/runner/utils.h:
--------------------------------------------------------------------------------
1 | #ifndef RUNNER_UTILS_H_
2 | #define RUNNER_UTILS_H_
3 |
4 | #include
5 | #include
6 |
7 | // Creates a console for the process, and redirects stdout and stderr to
8 | // it for both the runner and the Flutter library.
9 | void CreateAndAttachConsole();
10 |
11 | // Takes a null-terminated wchar_t* encoded in UTF-16 and returns a std::string
12 | // encoded in UTF-8. Returns an empty std::string on failure.
13 | std::string Utf8FromUtf16(const wchar_t* utf16_string);
14 |
15 | // Gets the command line arguments passed in as a std::vector,
16 | // encoded in UTF-8. Returns an empty std::vector on failure.
17 | std::vector GetCommandLineArguments();
18 |
19 | #endif // RUNNER_UTILS_H_
20 |
--------------------------------------------------------------------------------
/example/windows/runner/win32_window.cpp:
--------------------------------------------------------------------------------
1 | #include "win32_window.h"
2 |
3 | #include
4 |
5 | #include "resource.h"
6 |
7 | namespace {
8 |
9 | constexpr const wchar_t kWindowClassName[] = L"FLUTTER_RUNNER_WIN32_WINDOW";
10 |
11 | // The number of Win32Window objects that currently exist.
12 | static int g_active_window_count = 0;
13 |
14 | using EnableNonClientDpiScaling = BOOL __stdcall(HWND hwnd);
15 |
16 | // Scale helper to convert logical scaler values to physical using passed in
17 | // scale factor
18 | int Scale(int source, double scale_factor) {
19 | return static_cast(source * scale_factor);
20 | }
21 |
22 | // Dynamically loads the |EnableNonClientDpiScaling| from the User32 module.
23 | // This API is only needed for PerMonitor V1 awareness mode.
24 | void EnableFullDpiSupportIfAvailable(HWND hwnd) {
25 | HMODULE user32_module = LoadLibraryA("User32.dll");
26 | if (!user32_module) {
27 | return;
28 | }
29 | auto enable_non_client_dpi_scaling =
30 | reinterpret_cast(
31 | GetProcAddress(user32_module, "EnableNonClientDpiScaling"));
32 | if (enable_non_client_dpi_scaling != nullptr) {
33 | enable_non_client_dpi_scaling(hwnd);
34 | FreeLibrary(user32_module);
35 | }
36 | }
37 |
38 | } // namespace
39 |
40 | // Manages the Win32Window's window class registration.
41 | class WindowClassRegistrar {
42 | public:
43 | ~WindowClassRegistrar() = default;
44 |
45 | // Returns the singleton registar instance.
46 | static WindowClassRegistrar* GetInstance() {
47 | if (!instance_) {
48 | instance_ = new WindowClassRegistrar();
49 | }
50 | return instance_;
51 | }
52 |
53 | // Returns the name of the window class, registering the class if it hasn't
54 | // previously been registered.
55 | const wchar_t* GetWindowClass();
56 |
57 | // Unregisters the window class. Should only be called if there are no
58 | // instances of the window.
59 | void UnregisterWindowClass();
60 |
61 | private:
62 | WindowClassRegistrar() = default;
63 |
64 | static WindowClassRegistrar* instance_;
65 |
66 | bool class_registered_ = false;
67 | };
68 |
69 | WindowClassRegistrar* WindowClassRegistrar::instance_ = nullptr;
70 |
71 | const wchar_t* WindowClassRegistrar::GetWindowClass() {
72 | if (!class_registered_) {
73 | WNDCLASS window_class{};
74 | window_class.hCursor = LoadCursor(nullptr, IDC_ARROW);
75 | window_class.lpszClassName = kWindowClassName;
76 | window_class.style = CS_HREDRAW | CS_VREDRAW;
77 | window_class.cbClsExtra = 0;
78 | window_class.cbWndExtra = 0;
79 | window_class.hInstance = GetModuleHandle(nullptr);
80 | window_class.hIcon =
81 | LoadIcon(window_class.hInstance, MAKEINTRESOURCE(IDI_APP_ICON));
82 | window_class.hbrBackground = 0;
83 | window_class.lpszMenuName = nullptr;
84 | window_class.lpfnWndProc = Win32Window::WndProc;
85 | RegisterClass(&window_class);
86 | class_registered_ = true;
87 | }
88 | return kWindowClassName;
89 | }
90 |
91 | void WindowClassRegistrar::UnregisterWindowClass() {
92 | UnregisterClass(kWindowClassName, nullptr);
93 | class_registered_ = false;
94 | }
95 |
96 | Win32Window::Win32Window() {
97 | ++g_active_window_count;
98 | }
99 |
100 | Win32Window::~Win32Window() {
101 | --g_active_window_count;
102 | Destroy();
103 | }
104 |
105 | bool Win32Window::CreateAndShow(const std::wstring& title,
106 | const Point& origin,
107 | const Size& size) {
108 | Destroy();
109 |
110 | const wchar_t* window_class =
111 | WindowClassRegistrar::GetInstance()->GetWindowClass();
112 |
113 | const POINT target_point = {static_cast(origin.x),
114 | static_cast(origin.y)};
115 | HMONITOR monitor = MonitorFromPoint(target_point, MONITOR_DEFAULTTONEAREST);
116 | UINT dpi = FlutterDesktopGetDpiForMonitor(monitor);
117 | double scale_factor = dpi / 96.0;
118 |
119 | HWND window = CreateWindow(
120 | window_class, title.c_str(), WS_OVERLAPPEDWINDOW | WS_VISIBLE,
121 | Scale(origin.x, scale_factor), Scale(origin.y, scale_factor),
122 | Scale(size.width, scale_factor), Scale(size.height, scale_factor),
123 | nullptr, nullptr, GetModuleHandle(nullptr), this);
124 |
125 | if (!window) {
126 | return false;
127 | }
128 |
129 | return OnCreate();
130 | }
131 |
132 | // static
133 | LRESULT CALLBACK Win32Window::WndProc(HWND const window,
134 | UINT const message,
135 | WPARAM const wparam,
136 | LPARAM const lparam) noexcept {
137 | if (message == WM_NCCREATE) {
138 | auto window_struct = reinterpret_cast(lparam);
139 | SetWindowLongPtr(window, GWLP_USERDATA,
140 | reinterpret_cast(window_struct->lpCreateParams));
141 |
142 | auto that = static_cast(window_struct->lpCreateParams);
143 | EnableFullDpiSupportIfAvailable(window);
144 | that->window_handle_ = window;
145 | } else if (Win32Window* that = GetThisFromHandle(window)) {
146 | return that->MessageHandler(window, message, wparam, lparam);
147 | }
148 |
149 | return DefWindowProc(window, message, wparam, lparam);
150 | }
151 |
152 | LRESULT
153 | Win32Window::MessageHandler(HWND hwnd,
154 | UINT const message,
155 | WPARAM const wparam,
156 | LPARAM const lparam) noexcept {
157 | switch (message) {
158 | case WM_DESTROY:
159 | window_handle_ = nullptr;
160 | Destroy();
161 | if (quit_on_close_) {
162 | PostQuitMessage(0);
163 | }
164 | return 0;
165 |
166 | case WM_DPICHANGED: {
167 | auto newRectSize = reinterpret_cast(lparam);
168 | LONG newWidth = newRectSize->right - newRectSize->left;
169 | LONG newHeight = newRectSize->bottom - newRectSize->top;
170 |
171 | SetWindowPos(hwnd, nullptr, newRectSize->left, newRectSize->top, newWidth,
172 | newHeight, SWP_NOZORDER | SWP_NOACTIVATE);
173 |
174 | return 0;
175 | }
176 | case WM_SIZE: {
177 | RECT rect = GetClientArea();
178 | if (child_content_ != nullptr) {
179 | // Size and position the child window.
180 | MoveWindow(child_content_, rect.left, rect.top, rect.right - rect.left,
181 | rect.bottom - rect.top, TRUE);
182 | }
183 | return 0;
184 | }
185 |
186 | case WM_ACTIVATE:
187 | if (child_content_ != nullptr) {
188 | SetFocus(child_content_);
189 | }
190 | return 0;
191 | }
192 |
193 | return DefWindowProc(window_handle_, message, wparam, lparam);
194 | }
195 |
196 | void Win32Window::Destroy() {
197 | OnDestroy();
198 |
199 | if (window_handle_) {
200 | DestroyWindow(window_handle_);
201 | window_handle_ = nullptr;
202 | }
203 | if (g_active_window_count == 0) {
204 | WindowClassRegistrar::GetInstance()->UnregisterWindowClass();
205 | }
206 | }
207 |
208 | Win32Window* Win32Window::GetThisFromHandle(HWND const window) noexcept {
209 | return reinterpret_cast(
210 | GetWindowLongPtr(window, GWLP_USERDATA));
211 | }
212 |
213 | void Win32Window::SetChildContent(HWND content) {
214 | child_content_ = content;
215 | SetParent(content, window_handle_);
216 | RECT frame = GetClientArea();
217 |
218 | MoveWindow(content, frame.left, frame.top, frame.right - frame.left,
219 | frame.bottom - frame.top, true);
220 |
221 | SetFocus(child_content_);
222 | }
223 |
224 | RECT Win32Window::GetClientArea() {
225 | RECT frame;
226 | GetClientRect(window_handle_, &frame);
227 | return frame;
228 | }
229 |
230 | HWND Win32Window::GetHandle() {
231 | return window_handle_;
232 | }
233 |
234 | void Win32Window::SetQuitOnClose(bool quit_on_close) {
235 | quit_on_close_ = quit_on_close;
236 | }
237 |
238 | bool Win32Window::OnCreate() {
239 | // No-op; provided for subclasses.
240 | return true;
241 | }
242 |
243 | void Win32Window::OnDestroy() {
244 | // No-op; provided for subclasses.
245 | }
246 |
--------------------------------------------------------------------------------
/example/windows/runner/win32_window.h:
--------------------------------------------------------------------------------
1 | #ifndef RUNNER_WIN32_WINDOW_H_
2 | #define RUNNER_WIN32_WINDOW_H_
3 |
4 | #include
5 |
6 | #include
7 | #include
8 | #include
9 |
10 | // A class abstraction for a high DPI-aware Win32 Window. Intended to be
11 | // inherited from by classes that wish to specialize with custom
12 | // rendering and input handling
13 | class Win32Window {
14 | public:
15 | struct Point {
16 | unsigned int x;
17 | unsigned int y;
18 | Point(unsigned int x, unsigned int y) : x(x), y(y) {}
19 | };
20 |
21 | struct Size {
22 | unsigned int width;
23 | unsigned int height;
24 | Size(unsigned int width, unsigned int height)
25 | : width(width), height(height) {}
26 | };
27 |
28 | Win32Window();
29 | virtual ~Win32Window();
30 |
31 | // Creates and shows a win32 window with |title| and position and size using
32 | // |origin| and |size|. New windows are created on the default monitor. Window
33 | // sizes are specified to the OS in physical pixels, hence to ensure a
34 | // consistent size to will treat the width height passed in to this function
35 | // as logical pixels and scale to appropriate for the default monitor. Returns
36 | // true if the window was created successfully.
37 | bool CreateAndShow(const std::wstring& title,
38 | const Point& origin,
39 | const Size& size);
40 |
41 | // Release OS resources associated with window.
42 | void Destroy();
43 |
44 | // Inserts |content| into the window tree.
45 | void SetChildContent(HWND content);
46 |
47 | // Returns the backing Window handle to enable clients to set icon and other
48 | // window properties. Returns nullptr if the window has been destroyed.
49 | HWND GetHandle();
50 |
51 | // If true, closing this window will quit the application.
52 | void SetQuitOnClose(bool quit_on_close);
53 |
54 | // Return a RECT representing the bounds of the current client area.
55 | RECT GetClientArea();
56 |
57 | protected:
58 | // Processes and route salient window messages for mouse handling,
59 | // size change and DPI. Delegates handling of these to member overloads that
60 | // inheriting classes can handle.
61 | virtual LRESULT MessageHandler(HWND window,
62 | UINT const message,
63 | WPARAM const wparam,
64 | LPARAM const lparam) noexcept;
65 |
66 | // Called when CreateAndShow is called, allowing subclass window-related
67 | // setup. Subclasses should return false if setup fails.
68 | virtual bool OnCreate();
69 |
70 | // Called when Destroy is called.
71 | virtual void OnDestroy();
72 |
73 | private:
74 | friend class WindowClassRegistrar;
75 |
76 | // OS callback called by message pump. Handles the WM_NCCREATE message which
77 | // is passed when the non-client area is being created and enables automatic
78 | // non-client DPI scaling so that the non-client area automatically
79 | // responsponds to changes in DPI. All other messages are handled by
80 | // MessageHandler.
81 | static LRESULT CALLBACK WndProc(HWND const window,
82 | UINT const message,
83 | WPARAM const wparam,
84 | LPARAM const lparam) noexcept;
85 |
86 | // Retrieves a class instance pointer for |window|
87 | static Win32Window* GetThisFromHandle(HWND const window) noexcept;
88 |
89 | bool quit_on_close_ = false;
90 |
91 | // window handle for top level window.
92 | HWND window_handle_ = nullptr;
93 |
94 | // window handle for hosted content.
95 | HWND child_content_ = nullptr;
96 | };
97 |
98 | #endif // RUNNER_WIN32_WINDOW_H_
99 |
--------------------------------------------------------------------------------
/example_ios_style.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/subhamayd2/day_night_time_picker/7230d71fb50fd2092c11b83274f633274667d7e5/example_ios_style.png
--------------------------------------------------------------------------------
/lib/assets/moon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/subhamayd2/day_night_time_picker/7230d71fb50fd2092c11b83274f633274667d7e5/lib/assets/moon.png
--------------------------------------------------------------------------------
/lib/assets/sun.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/subhamayd2/day_night_time_picker/7230d71fb50fd2092c11b83274f633274667d7e5/lib/assets/sun.png
--------------------------------------------------------------------------------
/lib/day_night_time_picker.dart:
--------------------------------------------------------------------------------
1 | library day_night_time_picker;
2 |
3 | export './lib/constants.dart';
4 | export './lib/daynight_timepicker.dart';
5 | export './lib/state/time.dart';
6 |
--------------------------------------------------------------------------------
/lib/lib/ampm.dart:
--------------------------------------------------------------------------------
1 | import 'package:day_night_time_picker/lib/state/state_container.dart';
2 | import 'package:flutter/material.dart';
3 |
4 | /// [Widget] for rendering the AM/PM button
5 | class AmPm extends StatelessWidget {
6 | /// Default [TextStyle]
7 | final _style = const TextStyle(fontSize: 20);
8 |
9 | const AmPm({Key? key}) : super(key: key);
10 |
11 | @override
12 | Widget build(BuildContext context) {
13 | var timeState = TimeModelBinding.of(context);
14 | final isAm = timeState.time.period == DayPeriod.am;
15 | const unselectedOpacity = 0.5;
16 |
17 | final shouldDisablePM = !timeState.checkIfWithinRange(DayPeriod.pm);
18 | final shouldDisableAM = !timeState.checkIfWithinRange(DayPeriod.am);
19 |
20 | if (timeState.widget.is24HrFormat) {
21 | return Container();
22 | }
23 |
24 | final accentColor =
25 | timeState.widget.accentColor ?? Theme.of(context).colorScheme.secondary;
26 | final unselectedColor = timeState.widget.unselectedColor ?? Colors.grey;
27 |
28 | return Row(
29 | mainAxisAlignment: MainAxisAlignment.center,
30 | children: [
31 | Material(
32 | color: Colors.transparent,
33 | child: InkWell(
34 | onTap: !isAm && !shouldDisableAM
35 | ? () {
36 | timeState.onAmPmChange(DayPeriod.am);
37 | }
38 | : null,
39 | child: Padding(
40 | padding: const EdgeInsets.symmetric(
41 | horizontal: 8.0,
42 | vertical: 4,
43 | ),
44 | child: Opacity(
45 | opacity: !isAm ? unselectedOpacity : 1,
46 | child: Text(
47 | timeState.widget.amLabel,
48 | style: _style.copyWith(
49 | color: isAm ? accentColor : unselectedColor,
50 | fontWeight: isAm ? FontWeight.bold : null,
51 | ),
52 | ),
53 | ),
54 | ),
55 | ),
56 | ),
57 | Material(
58 | color: Colors.transparent,
59 | child: InkWell(
60 | onTap: isAm && !shouldDisablePM
61 | ? () {
62 | timeState.onAmPmChange(DayPeriod.pm);
63 | }
64 | : null,
65 | child: Padding(
66 | padding: const EdgeInsets.symmetric(horizontal: 8.0, vertical: 2),
67 | child: Opacity(
68 | opacity: isAm ? unselectedOpacity : 1,
69 | child: Text(
70 | timeState.widget.pmLabel,
71 | style: _style.copyWith(
72 | color: !isAm ? accentColor : unselectedColor,
73 | fontWeight: !isAm ? FontWeight.bold : null,
74 | ),
75 | ),
76 | ),
77 | ),
78 | ),
79 | ),
80 | ],
81 | );
82 | }
83 | }
84 |
--------------------------------------------------------------------------------
/lib/lib/common/action_buttons.dart:
--------------------------------------------------------------------------------
1 | import 'package:day_night_time_picker/lib/state/state_container.dart';
2 | import 'package:flutter/material.dart';
3 |
4 | /// Render the [Ok] and [Cancel] buttons
5 | class ActionButtons extends StatelessWidget {
6 | const ActionButtons({Key? key}) : super(key: key);
7 |
8 | @override
9 | Widget build(BuildContext context) {
10 | final timeState = TimeModelBinding.of(context);
11 | final color =
12 | timeState.widget.accentColor ?? Theme.of(context).colorScheme.secondary;
13 | final defaultButtonStyle = TextButton.styleFrom(
14 | textStyle: TextStyle(color: color),
15 | );
16 |
17 | if (timeState.widget.isOnValueChangeMode) {
18 | return const SizedBox(
19 | height: 8,
20 | );
21 | }
22 |
23 | return IntrinsicHeight(
24 | child: Row(
25 | mainAxisAlignment: MainAxisAlignment.end,
26 | children: [
27 | if (timeState.widget.showCancelButton)
28 | TextButton(
29 | style: (timeState.widget.cancelButtonStyle ??
30 | timeState.widget.buttonStyle) ??
31 | defaultButtonStyle,
32 | onPressed: timeState.onCancel,
33 | child: Text(
34 | timeState.widget.cancelText,
35 | style: timeState.widget.cancelStyle,
36 | ),
37 | ),
38 | SizedBox(width: timeState.widget.buttonsSpacing ?? 0),
39 | TextButton(
40 | onPressed: timeState.onOk,
41 | style: timeState.widget.buttonStyle ?? defaultButtonStyle,
42 | child: Text(
43 | timeState.widget.okText,
44 | style: timeState.widget.okStyle,
45 | ),
46 | ),
47 | ],
48 | ),
49 | );
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/lib/lib/common/display_value.dart:
--------------------------------------------------------------------------------
1 | // ignore_for_file: no_leading_underscores_for_local_identifiers
2 |
3 | import 'package:day_night_time_picker/lib/state/state_container.dart';
4 | import 'package:flutter/material.dart';
5 |
6 | /// Render the [Hour] or [Minute] value for `Android` picker
7 | class DisplayValue extends StatelessWidget {
8 | /// The [value] to display
9 | final String value;
10 |
11 | /// The [onTap] handler
12 | final Null Function()? onTap;
13 |
14 | /// Whether the [value] is selected or not
15 | final bool isSelected;
16 |
17 | /// Constructor for the [Widget]
18 | const DisplayValue({
19 | Key? key,
20 | required this.value,
21 | this.onTap,
22 | this.isSelected = false,
23 | }) : super(key: key);
24 |
25 | @override
26 | Widget build(BuildContext context) {
27 | final timeState = TimeModelBinding.of(context);
28 | final _commonTimeStyles =
29 | Theme.of(context).textTheme.displayMedium!.copyWith(
30 | fontSize: 62,
31 | fontWeight: FontWeight.bold,
32 | );
33 |
34 | final color =
35 | timeState.widget.accentColor ?? Theme.of(context).colorScheme.secondary;
36 | final unselectedColor = timeState.widget.unselectedColor ?? Colors.grey;
37 |
38 | return Material(
39 | color: Colors.transparent,
40 | child: Padding(
41 | padding: const EdgeInsets.symmetric(horizontal: 3.0),
42 | child: InkWell(
43 | onTap: onTap,
44 | child: Text(
45 | value,
46 | textScaleFactor: 0.85,
47 | style: _commonTimeStyles.copyWith(
48 | color: isSelected ? color : unselectedColor,
49 | ),
50 | ),
51 | ),
52 | ),
53 | );
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/lib/lib/common/display_wheel.dart:
--------------------------------------------------------------------------------
1 | // ignore_for_file: no_leading_underscores_for_local_identifiers
2 |
3 | import 'package:day_night_time_picker/lib/state/state_container.dart';
4 | import 'package:flutter/material.dart';
5 |
6 | /// Render the [Hour] or [Minute] wheel for `IOS` picker
7 |
8 | class DisplayWheel extends StatelessWidget {
9 | /// [Controller] for the wheel
10 | final FixedExtentScrollController controller;
11 |
12 | /// The items rendered for the wheel
13 | final List items;
14 |
15 | /// The Change handler
16 | final Null Function(int value) onChange;
17 |
18 | /// Callback to render custom label
19 | final int Function(int item)? getModifiedLabel;
20 |
21 | /// Whether the wheel is selected or not
22 | final bool isSelected;
23 |
24 | /// Whether the wheel is disabled or not
25 | final bool disabled;
26 |
27 | /// Constructor for the [Widget]
28 | const DisplayWheel({
29 | Key? key,
30 | required this.controller,
31 | required this.items,
32 | required this.onChange,
33 | this.isSelected = false,
34 | this.disabled = false,
35 | this.getModifiedLabel,
36 | }) : super(key: key);
37 |
38 | @override
39 | Widget build(BuildContext context) {
40 | final timeState = TimeModelBinding.of(context);
41 | final _commonTimeStyles =
42 | Theme.of(context).textTheme.displayMedium!.copyWith(
43 | fontSize: 30,
44 | );
45 |
46 | final color =
47 | timeState.widget.accentColor ?? Theme.of(context).colorScheme.secondary;
48 | final unselectedColor = timeState.widget.unselectedColor ?? Colors.grey;
49 |
50 | return SizedBox(
51 | width: 60,
52 | child: Padding(
53 | padding: const EdgeInsets.symmetric(horizontal: 3.0),
54 | child: ListWheelScrollView.useDelegate(
55 | controller: controller,
56 | itemExtent: 36,
57 | physics: disabled
58 | ? const NeverScrollableScrollPhysics()
59 | : const FixedExtentScrollPhysics(parent: BouncingScrollPhysics()),
60 | overAndUnderCenterOpacity: disabled ? 0 : 0.25,
61 | perspective: 0.01,
62 | magnification: timeState.widget.wheelMagnification,
63 | onSelectedItemChanged: onChange,
64 | childDelegate: ListWheelChildBuilderDelegate(
65 | childCount: items.length,
66 | builder: (context, index) {
67 | final val =
68 | (getModifiedLabel?.call(items[index]!) ?? (items[index]!))
69 | .toString()
70 | .padLeft(2, '0');
71 | return Center(
72 | child: Text(
73 | val,
74 | textScaleFactor: 0.85,
75 | style: _commonTimeStyles.copyWith(
76 | color: isSelected ? color : unselectedColor,
77 | ),
78 | ),
79 | );
80 | },
81 | ),
82 | ),
83 | ),
84 | );
85 | }
86 | }
87 |
--------------------------------------------------------------------------------
/lib/lib/common/filter_wrapper.dart:
--------------------------------------------------------------------------------
1 | import 'dart:ui';
2 |
3 | import 'package:day_night_time_picker/lib/state/state_container.dart';
4 | import 'package:flutter/material.dart';
5 |
6 | /// Needed to use Backdrop filter conditionally, since `ImageFilter.blur`
7 | /// was causing an issue in [web] when both the `sigma` values are `zero`
8 | ///
9 | /// See https://github.com/flutter/flutter/issues/77258#issuecomment-822006335
10 | class FilterWrapper extends StatelessWidget {
11 | /// child of the filter in the [Widget] tree
12 | final Widget? child;
13 |
14 | /// Constructor for the [Widget]
15 | const FilterWrapper({
16 | Key? key,
17 | this.child,
18 | }) : super(key: key);
19 |
20 | @override
21 | Widget build(BuildContext context) {
22 | final timeState = TimeModelBinding.of(context);
23 | final double blurAmount = timeState.widget.blurredBackground ? 5 : 0;
24 |
25 | if (blurAmount == 0.0) {
26 | return Container(
27 | child: child,
28 | );
29 | }
30 |
31 | return BackdropFilter(
32 | filter: ImageFilter.blur(sigmaX: blurAmount, sigmaY: blurAmount),
33 | child: child,
34 | );
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/lib/lib/common/wrapper_container.dart:
--------------------------------------------------------------------------------
1 | import 'package:day_night_time_picker/lib/state/state_container.dart';
2 | import 'package:flutter/material.dart';
3 |
4 | /// Just a simple [Container] with common styling
5 | class WrapperContainer extends StatelessWidget {
6 | /// The child [Widget] to render
7 | final Widget child;
8 |
9 | /// Constructor for the [Widget]
10 | const WrapperContainer({
11 | Key? key,
12 | required this.child,
13 | }) : super(key: key);
14 |
15 | @override
16 | Widget build(BuildContext context) {
17 | var timeState = TimeModelBinding.of(context);
18 | double height = timeState.widget.height;
19 | Color backgroundColor = timeState.widget.backgroundColor;
20 | return Expanded(
21 | child: Container(
22 | height: height,
23 | color: backgroundColor,
24 | padding: timeState.widget.contentPadding,
25 | child: child,
26 | ),
27 | );
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/lib/lib/common/wrapper_dialog.dart:
--------------------------------------------------------------------------------
1 | import 'package:day_night_time_picker/lib/constants.dart';
2 | import 'package:day_night_time_picker/lib/state/state_container.dart';
3 | import 'package:flutter/material.dart';
4 |
5 | /// Just a simple [Dialog] with common styling
6 | class WrapperDialog extends StatelessWidget {
7 | /// The child [Widget] to render
8 | final Widget child;
9 |
10 | /// Constructor for the [Widget]
11 | const WrapperDialog({
12 | Key? key,
13 | required this.child,
14 | }) : super(key: key);
15 |
16 | @override
17 | Widget build(BuildContext context) {
18 | final timeState = TimeModelBinding.of(context);
19 | final borderRadius = timeState.widget.borderRadius ?? BORDER_RADIUS;
20 | final elevation = timeState.widget.elevation ?? ELEVATION;
21 | final backgroundColor = timeState.widget.backgroundColor;
22 |
23 | return Dialog(
24 | insetPadding: timeState.widget.dialogInsetPadding,
25 | backgroundColor: backgroundColor,
26 | shape: RoundedRectangleBorder(
27 | borderRadius: BorderRadius.circular(borderRadius),
28 | ),
29 | elevation: elevation,
30 | child: ClipRRect(
31 | borderRadius: BorderRadius.circular(borderRadius),
32 | child: IntrinsicHeight(
33 | child: child,
34 | ),
35 | ),
36 | );
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/lib/lib/constants.dart:
--------------------------------------------------------------------------------
1 | /// Default Border radius value in [double]
2 | // ignore_for_file: constant_identifier_names
3 |
4 | const BORDER_RADIUS = 10.0;
5 |
6 | /// Default Elevation value in [double]
7 | const ELEVATION = 12.0;
8 |
9 | /// Width of the sun/moon asset
10 | const SUN_MOON_WIDTH = 100.0;
11 |
12 | /// interval enum
13 | enum TimePickerInterval { ONE, FIVE, TEN, FIFTEEN, THIRTY }
14 |
15 | enum SelectedInput { HOUR, MINUTE, SECOND }
16 |
--------------------------------------------------------------------------------
/lib/lib/day_night_timepicker_android.dart:
--------------------------------------------------------------------------------
1 | import 'package:day_night_time_picker/day_night_time_picker.dart';
2 | import 'package:day_night_time_picker/lib/ampm.dart';
3 | import 'package:day_night_time_picker/lib/common/action_buttons.dart';
4 | import 'package:day_night_time_picker/lib/common/display_value.dart';
5 | import 'package:day_night_time_picker/lib/common/filter_wrapper.dart';
6 | import 'package:day_night_time_picker/lib/common/wrapper_container.dart';
7 | import 'package:day_night_time_picker/lib/common/wrapper_dialog.dart';
8 | import 'package:day_night_time_picker/lib/daynight_banner.dart';
9 | import 'package:day_night_time_picker/lib/state/state_container.dart';
10 | import 'package:day_night_time_picker/lib/utils.dart';
11 | import 'package:flutter/material.dart';
12 |
13 | /// Private class. [StatefulWidget] that renders the content of the picker.
14 | // ignore: must_be_immutable
15 | class DayNightTimePickerAndroid extends StatefulWidget {
16 | const DayNightTimePickerAndroid({
17 | Key? key,
18 | required this.sunrise,
19 | required this.sunset,
20 | required this.duskSpanInMinutes,
21 | }) : super(key: key);
22 | final TimeOfDay sunrise;
23 | final TimeOfDay sunset;
24 | final int duskSpanInMinutes;
25 |
26 | @override
27 | DayNightTimePickerAndroidState createState() =>
28 | DayNightTimePickerAndroidState();
29 | }
30 |
31 | /// Picker state class
32 | class DayNightTimePickerAndroidState extends State {
33 | late TimeModelBindingState timeState;
34 |
35 | @override
36 | void didChangeDependencies() {
37 | super.didChangeDependencies();
38 | timeState = TimeModelBinding.of(context);
39 | }
40 |
41 | @override
42 | Widget build(BuildContext context) {
43 | double min =
44 | getMin(timeState.widget.minMinute, timeState.widget.minuteInterval);
45 | double max =
46 | getMax(timeState.widget.maxMinute, timeState.widget.minuteInterval);
47 |
48 | int minDiff = (max - min).round();
49 | int divisions = getDivisions(minDiff, timeState.widget.minuteInterval);
50 |
51 | if (timeState.selected == SelectedInput.HOUR) {
52 | min = timeState.widget.minHour!;
53 | max = timeState.widget.maxHour!;
54 | divisions = (max - min).round();
55 | }
56 |
57 | final color =
58 | timeState.widget.accentColor ?? Theme.of(context).colorScheme.secondary;
59 |
60 | final hourValue = timeState.widget.is24HrFormat
61 | ? timeState.time.hour
62 | : timeState.time.hourOfPeriod;
63 |
64 | final ltrMode =
65 | timeState.widget.ltrMode ? TextDirection.ltr : TextDirection.rtl;
66 |
67 | final hideButtons = timeState.widget.hideButtons;
68 |
69 | Orientation currentOrientation = MediaQuery.of(context).orientation;
70 |
71 | double value = timeState.time.hour.roundToDouble();
72 | if (timeState.selected == SelectedInput.MINUTE) {
73 | value = timeState.time.minute.roundToDouble();
74 | } else if (timeState.selected == SelectedInput.SECOND) {
75 | value = timeState.time.second.roundToDouble();
76 | }
77 |
78 | return Center(
79 | child: SingleChildScrollView(
80 | physics: currentOrientation == Orientation.portrait
81 | ? const NeverScrollableScrollPhysics()
82 | : const AlwaysScrollableScrollPhysics(),
83 | child: FilterWrapper(
84 | child: WrapperDialog(
85 | child: Column(
86 | mainAxisSize: MainAxisSize.min,
87 | crossAxisAlignment: CrossAxisAlignment.stretch,
88 | children: [
89 | DayNightBanner(
90 | sunrise: widget.sunrise,
91 | sunset: widget.sunset,
92 | duskSpanInMinutes: widget.duskSpanInMinutes,
93 | ),
94 | WrapperContainer(
95 | child: Column(
96 | mainAxisSize: MainAxisSize.min,
97 | crossAxisAlignment: CrossAxisAlignment.stretch,
98 | children: [
99 | const AmPm(),
100 | const SizedBox(height: 8),
101 | const Spacer(),
102 | Row(
103 | textDirection: ltrMode,
104 | mainAxisAlignment: MainAxisAlignment.center,
105 | children: [
106 | DisplayValue(
107 | onTap: timeState.widget.disableHour!
108 | ? null
109 | : () {
110 | timeState.onSelectedInputChange(
111 | SelectedInput.HOUR,
112 | );
113 | },
114 | value: hourValue.toString().padLeft(2, '0'),
115 | isSelected:
116 | timeState.selected == SelectedInput.HOUR,
117 | ),
118 | const DisplayValue(
119 | value: ':',
120 | ),
121 | DisplayValue(
122 | onTap: timeState.widget.disableMinute!
123 | ? null
124 | : () {
125 | timeState.onSelectedInputChange(
126 | SelectedInput.MINUTE,
127 | );
128 | },
129 | value: timeState.time.minute
130 | .toString()
131 | .padLeft(2, '0'),
132 | isSelected:
133 | timeState.selected == SelectedInput.MINUTE,
134 | ),
135 | ...timeState.widget.showSecondSelector
136 | ? [
137 | const DisplayValue(
138 | value: ':',
139 | ),
140 | DisplayValue(
141 | onTap: () {
142 | timeState.onSelectedInputChange(
143 | SelectedInput.SECOND,
144 | );
145 | },
146 | value: timeState.time.second
147 | .toString()
148 | .padLeft(2, '0'),
149 | isSelected: timeState.selected ==
150 | SelectedInput.SECOND,
151 | ),
152 | ]
153 | : [],
154 | ],
155 | ),
156 | Slider(
157 | onChangeEnd: (_) => onChangedSlider(),
158 | value: value,
159 | onChanged: timeState.onTimeChange,
160 | min: min,
161 | max: max,
162 | divisions: divisions,
163 | activeColor: color,
164 | inactiveColor: color.withAlpha(55),
165 | ),
166 | const Spacer(),
167 | if (!hideButtons) const ActionButtons(),
168 | ],
169 | ),
170 | ),
171 | ],
172 | ),
173 | ),
174 | ),
175 | ),
176 | );
177 | }
178 |
179 | onChangedSlider() {
180 | if (!timeState.widget.disableAutoFocusToNextInput) {
181 | if (timeState.selected == SelectedInput.HOUR) {
182 | if (!(timeState.widget.disableMinute ?? false)) {
183 | timeState.onSelectedInputChange(SelectedInput.MINUTE);
184 | } else if (timeState.widget.showSecondSelector) {
185 | timeState.onSelectedInputChange(SelectedInput.SECOND);
186 | }
187 | } else if (timeState.selected == SelectedInput.MINUTE &&
188 | timeState.widget.showSecondSelector) {
189 | timeState.onSelectedInputChange(SelectedInput.SECOND);
190 | }
191 | }
192 | if (timeState.widget.isOnValueChangeMode) {
193 | timeState.onOk();
194 | }
195 | }
196 | }
197 |
--------------------------------------------------------------------------------
/lib/lib/daynight_banner.dart:
--------------------------------------------------------------------------------
1 | import 'dart:math';
2 |
3 | import 'package:day_night_time_picker/day_night_time_picker.dart';
4 | import 'package:day_night_time_picker/lib/constants.dart';
5 | import 'package:day_night_time_picker/lib/state/state_container.dart';
6 | import 'package:day_night_time_picker/lib/utils.dart';
7 | import 'package:flutter/material.dart';
8 |
9 | import './sun_moon.dart';
10 |
11 | /// [Widget] for rendering the box container of the sun and moon.
12 | class DayNightBanner extends StatelessWidget {
13 | final TimeOfDay sunrise;
14 | final TimeOfDay sunset;
15 | final int duskSpanInMinutes;
16 |
17 | const DayNightBanner({
18 | Key? key,
19 | required this.sunrise,
20 | required this.sunset,
21 | required this.duskSpanInMinutes,
22 | }) : super(key: key);
23 |
24 | /// Get the background color of the container, representing the time of day
25 | Color? getColor(bool isDay, bool isDusk) {
26 | if (!isDay) {
27 | return Colors.blueGrey[900];
28 | }
29 | if (isDusk) {
30 | return Colors.orange[400];
31 | }
32 | return Colors.blue[200];
33 | }
34 |
35 | @override
36 | Widget build(BuildContext context) {
37 | final timeState = TimeModelBinding.of(context);
38 | final hour = timeState.time.hour;
39 | final minute = timeState.time.minute;
40 | var duskHours = duskSpanInMinutes / 60;
41 | var duskMinutes = duskSpanInMinutes % 60;
42 |
43 | TimeOfDay currentTime = TimeOfDay(hour: hour, minute: minute);
44 | TimeOfDay duskTime = TimeOfDay(
45 | hour: sunset.hour - duskHours.toInt(),
46 | minute: sunset.minute - duskMinutes,
47 | );
48 |
49 | final isDay =
50 | timeOfDayToDouble(currentTime) >= timeOfDayToDouble(sunrise) &&
51 | timeOfDayToDouble(currentTime) <= timeOfDayToDouble(sunset);
52 | final isDusk =
53 | timeOfDayToDouble(currentTime) >= timeOfDayToDouble(duskTime) &&
54 | timeOfDayToDouble(currentTime) <= timeOfDayToDouble(sunset);
55 |
56 | if (!timeState.widget.displayHeader!) {
57 | return Container(height: 25, color: Theme.of(context).cardColor);
58 | }
59 |
60 | final displace = mapRange(timeState.time.hour * 1.0, 0, 23);
61 |
62 | return AnimatedContainer(
63 | padding: const EdgeInsets.symmetric(horizontal: 32),
64 | duration: const Duration(seconds: 1),
65 | height: 150,
66 | color: getColor(isDay, isDusk),
67 | child: LayoutBuilder(
68 | builder: (context, constraints) {
69 | final maxWidth = constraints.maxWidth.round() - SUN_MOON_WIDTH;
70 | final top = sin(pi * displace) * 1.8;
71 | final left = maxWidth * displace;
72 | return Stack(
73 | alignment: Alignment.center,
74 | children: [
75 | AnimatedPositioned(
76 | curve: Curves.ease,
77 | bottom: top * 20,
78 | left: left,
79 | duration: const Duration(milliseconds: 200),
80 | child: SunMoon(
81 | isSun: isDay,
82 | ),
83 | ),
84 | ],
85 | );
86 | },
87 | ),
88 | );
89 | }
90 | }
91 |
--------------------------------------------------------------------------------
/lib/lib/state/state_container.dart:
--------------------------------------------------------------------------------
1 | // ignore_for_file: must_be_immutable, no_leading_underscores_for_local_identifiers
2 |
3 | import 'package:day_night_time_picker/day_night_time_picker.dart';
4 | import 'package:flutter/material.dart';
5 |
6 | /// Stateful [Widget] for [InheritedWidget]
7 | class TimeModelBinding extends StatefulWidget {
8 | /// The initial time provided by the user
9 | final Time initialTime;
10 |
11 | /// **`Required`** Return the new time the user picked as [Time].
12 | final void Function(Time) onChange;
13 |
14 | /// _`Optional`_ Return the new time the user picked as [DateTime].
15 | final void Function(DateTime)? onChangeDateTime;
16 |
17 | /// Callback for the Cancel button
18 | final void Function()? onCancel;
19 |
20 | /// Show the time in TimePicker in 24 hour format.
21 | final bool is24HrFormat;
22 |
23 | /// Display the sun moon animation
24 | final bool? displayHeader;
25 |
26 | /// Accent color of the TimePicker.
27 | final Color? accentColor;
28 |
29 | /// Accent color of unselected text.
30 | final Color? unselectedColor;
31 |
32 | /// Text displayed for the Cancel button.
33 | String cancelText;
34 |
35 | /// Text displayed for the Ok button.
36 | String okText;
37 |
38 | /// Image asset used for the Sun.
39 | final Image? sunAsset;
40 |
41 | /// Image asset used for the Moon.
42 | final Image? moonAsset;
43 |
44 | /// Whether to blur the background of the [Modal].
45 | final bool blurredBackground;
46 |
47 | /// Set the background color of the [Modal].
48 | final Color backgroundColor;
49 |
50 | /// Border radius of the [Container] in [double].
51 | final double? borderRadius;
52 |
53 | /// Elevation of the [Modal] in [double].
54 | final double? elevation;
55 |
56 | /// Inset padding of the [Modal] in [EdgeInsets].
57 | final EdgeInsets? dialogInsetPadding;
58 |
59 | /// Inset padding of the content in [EdgeInsets].
60 | final EdgeInsets? contentPadding;
61 |
62 | /// Steps interval while changing [minute].
63 | final TimePickerInterval? minuteInterval;
64 |
65 | /// Steps interval while changing [secoond].
66 | final TimePickerInterval? secondInterval;
67 |
68 | /// Disable minute picker
69 | final bool? disableMinute;
70 |
71 | /// Disable hour picker
72 | final bool? disableHour;
73 |
74 | /// Selectable maximum hour
75 | final double? maxHour;
76 |
77 | /// Selectable maximum minute
78 | final double? maxMinute;
79 |
80 | /// Selectable maximum second
81 | final double? maxSecond;
82 |
83 | /// Selectable minimum hour
84 | final double? minHour;
85 |
86 | /// Selectable minimum minute
87 | final double? minMinute;
88 |
89 | /// Selectable minimum second
90 | final double? minSecond;
91 |
92 | /// Label for the `hour` text.
93 | final String? hourLabel;
94 |
95 | /// Label for the `minute` text.
96 | final String? minuteLabel;
97 |
98 | /// Label for the `second` text.
99 | final String? secondLabel;
100 |
101 | /// Label for the 'am' text.
102 | final String amLabel;
103 |
104 | /// Label for the 'pm' text.
105 | final String pmLabel;
106 |
107 | /// Text style for the 'hours', 'minutes', and 'seconds'
108 | final TextStyle? hmsStyle;
109 |
110 | /// Whether the widget is displayed as a popup or inline
111 | final bool isInlineWidget;
112 |
113 | /// Whether to hide okText, cancelText and return value on every onValueChange.
114 | final bool isOnValueChangeMode;
115 |
116 | /// Whether or not the minute picker is auto focus/selected.
117 | final bool focusMinutePicker;
118 |
119 | /// Whether to display the time from left to right or right to left.(Standard: left to right)
120 | final bool ltrMode;
121 |
122 | /// Ok button's text style [TextStyle]
123 | TextStyle okStyle;
124 |
125 | /// Cancel button's text style [TextStyle]
126 | TextStyle cancelStyle;
127 |
128 | /// [ButtonStyle] is used for the [showPicker] methods
129 | /// If `cancelButtonStyle` is not provided, it applies to the ok and cancel buttons
130 | ButtonStyle? buttonStyle;
131 |
132 | /// [ButtonStyle] is used for the [showPicker] methods
133 | ButtonStyle? cancelButtonStyle;
134 |
135 | /// Spacing between ok and cancel buttons
136 | double? buttonsSpacing;
137 |
138 | /// The child [Widget] to render
139 | final Widget child;
140 |
141 | /// The height of the Wheel section
142 | double wheelHeight;
143 |
144 | /// The magnification of the Wheel section
145 | double wheelMagnification;
146 |
147 | /// Whether to hide the buttons (ok and cancel). Defaults to `false`.
148 | bool hideButtons;
149 |
150 | /// Whether to disable the auto focus to minute after hour is selected.
151 | bool disableAutoFocusToNextInput;
152 |
153 | /// Fixed width of the Picker container.
154 | double width;
155 |
156 | /// Fixed height of the Picker container.
157 | double height;
158 |
159 | /// Whether to use the second selector as well.
160 | bool showSecondSelector;
161 |
162 | /// Whether to have the Cancel Button Widget.
163 | bool showCancelButton;
164 |
165 | /// Sunrise time.
166 | TimeOfDay? sunrise;
167 |
168 | /// Sunset time.
169 | TimeOfDay? sunset;
170 |
171 | /// Dusk span of time in minutes.
172 | int? duskSpanInMinutes;
173 |
174 | /// Constructor for the [Widget]
175 | TimeModelBinding({
176 | Key? key,
177 | required this.initialTime,
178 | required this.child,
179 | required this.onChange,
180 | this.onChangeDateTime,
181 | this.onCancel,
182 | this.is24HrFormat = false,
183 | this.displayHeader,
184 | this.accentColor,
185 | this.ltrMode = true,
186 | this.unselectedColor,
187 | this.cancelText = 'cancel',
188 | this.okText = 'ok',
189 | this.isOnValueChangeMode = false,
190 | this.sunAsset,
191 | this.moonAsset,
192 | this.blurredBackground = false,
193 | Color? backgroundColor,
194 | this.borderRadius,
195 | this.elevation,
196 | this.dialogInsetPadding,
197 | this.contentPadding,
198 | this.minuteInterval,
199 | this.secondInterval,
200 | this.disableMinute,
201 | this.disableHour,
202 | this.maxHour,
203 | this.maxMinute,
204 | this.maxSecond,
205 | this.minHour,
206 | this.minMinute,
207 | this.minSecond,
208 | this.hourLabel,
209 | this.minuteLabel,
210 | this.secondLabel,
211 | this.amLabel = 'am',
212 | this.pmLabel = 'pm',
213 | this.isInlineWidget = false,
214 | this.focusMinutePicker = false,
215 | this.okStyle = const TextStyle(fontWeight: FontWeight.bold),
216 | this.cancelStyle = const TextStyle(fontWeight: FontWeight.bold),
217 | this.hmsStyle,
218 | this.buttonStyle,
219 | this.cancelButtonStyle,
220 | this.buttonsSpacing,
221 | double? wheelHeight,
222 | double? wheelMagnification,
223 | this.hideButtons = false,
224 | this.disableAutoFocusToNextInput = false,
225 | this.width = 0,
226 | double? height,
227 | this.showSecondSelector = false,
228 | this.showCancelButton = true,
229 | this.sunrise,
230 | this.sunset,
231 | this.duskSpanInMinutes,
232 | }) : height = height ?? 260,
233 | wheelHeight = wheelHeight ?? 100,
234 | wheelMagnification = wheelMagnification ?? 1.0,
235 | backgroundColor = backgroundColor ?? Colors.white,
236 | super(key: key);
237 |
238 | @override
239 | TimeModelBindingState createState() => TimeModelBindingState();
240 |
241 | /// Get the [InheritedWidget]'s state in the tree
242 | static TimeModelBindingState of(BuildContext context) {
243 | final _ModelBindingScope scope =
244 | context.dependOnInheritedWidgetOfExactType<_ModelBindingScope>()!;
245 | return scope.modelBindingState;
246 | }
247 | }
248 |
249 | /// The [InheritedWidget] wrapped with [State]
250 | class _ModelBindingScope extends InheritedWidget {
251 | /// The State
252 | final TimeModelBindingState modelBindingState;
253 |
254 | /// Constructor for the [InheritedWidget]
255 | const _ModelBindingScope({
256 | Key? key,
257 | required this.modelBindingState,
258 | required Widget child,
259 | }) : super(key: key, child: child);
260 |
261 | /// Update notifier for the [InheritedWidget]
262 | @override
263 | bool updateShouldNotify(_ModelBindingScope oldWidget) => true;
264 | }
265 |
266 | /// [InheritedWidget] State class
267 | class TimeModelBindingState extends State {
268 | /// initial time
269 | late Time time = widget.initialTime;
270 |
271 | /// Whether the hour is currently being selected/changed
272 | SelectedInput selected = SelectedInput.HOUR;
273 |
274 | /// The last [DayPeriod] value
275 | DayPeriod lastPeriod = DayPeriod.am;
276 |
277 | @override
278 | void initState() {
279 | SelectedInput _selected = SelectedInput.HOUR;
280 |
281 | if (widget.focusMinutePicker || widget.disableHour!) {
282 | _selected = SelectedInput.MINUTE;
283 | }
284 |
285 | setState(() {
286 | selected = _selected;
287 | });
288 | super.initState();
289 | }
290 |
291 | /// Whether the [DayPeriod] changed or not
292 | bool didPeriodChange() {
293 | return lastPeriod != time.period;
294 | }
295 |
296 | /// Change handler for [DayPeriod]
297 | void onAmPmChange(DayPeriod e) {
298 | setState(() {
299 | lastPeriod = time.period;
300 | time = time.setPeriod(e);
301 | });
302 |
303 | // If the mode is `onValueChange` then we need to alert
304 | // the listeners that the value changed
305 | if (widget.isOnValueChangeMode) {
306 | onOk();
307 | }
308 | }
309 |
310 | /// Change handler for picker
311 | onTimeChange(double value) {
312 | if (selected == SelectedInput.HOUR) {
313 | onHourChange(value);
314 | } else if (selected == SelectedInput.MINUTE) {
315 | onMinuteChange(value);
316 | } else {
317 | onSecondChange(value);
318 | }
319 | }
320 |
321 | /// Change handler for the `hour`
322 | void onHourChange(double value) {
323 | setState(() {
324 | time = time.replacing(hour: value.round());
325 | });
326 | }
327 |
328 | /// Change handler for the `minute`
329 | void onMinuteChange(double value) {
330 | setState(() {
331 | time = time.replacing(minute: value.ceil());
332 | });
333 | }
334 |
335 | /// Change handler for the `second`
336 | void onSecondChange(double value) {
337 | setState(() {
338 | time = time.replacing(second: value.ceil());
339 | });
340 | }
341 |
342 | /// Change handler for `hourIsSelected`
343 | void onSelectedInputChange(SelectedInput newValue) {
344 | setState(() {
345 | selected = newValue;
346 | });
347 | }
348 |
349 | /// [onChange] handler. Return [TimeOfDay]
350 | onOk() {
351 | widget.onChange(time);
352 | if (widget.onChangeDateTime != null) {
353 | final now = DateTime.now();
354 | final dateTime =
355 | DateTime(now.year, now.month, now.day, time.hour, time.minute);
356 | widget.onChangeDateTime!(dateTime);
357 | }
358 | onCancel(result: time);
359 | }
360 |
361 | /// Handler to close the picker
362 | onCancel({var result}) {
363 | if (widget.onCancel != null) {
364 | widget.onCancel!();
365 | return;
366 | }
367 |
368 | if (!widget.isInlineWidget) {
369 | Navigator.of(context).pop(result);
370 | }
371 | }
372 |
373 | /// Check if time is within range.
374 | /// Used to disable `AM/PM`.
375 | /// Example: if user provided [minHour] as `9` and [maxHour] as `21`,
376 | /// then the user should only be able to toggle `AM/PM` for `9am` and `9pm`
377 | bool checkIfWithinRange(DayPeriod other) {
378 | final tempTime = Time(
379 | hour: time.hour,
380 | minute: time.minute,
381 | second: time.second,
382 | ).setPeriod(other);
383 | final expectedHour = tempTime.hour;
384 | return widget.minHour! <= expectedHour && expectedHour <= widget.maxHour!;
385 | }
386 |
387 | @override
388 | Widget build(BuildContext context) {
389 | return _ModelBindingScope(
390 | modelBindingState: this,
391 | child: widget.child,
392 | );
393 | }
394 | }
395 |
--------------------------------------------------------------------------------
/lib/lib/state/time.dart:
--------------------------------------------------------------------------------
1 | // ignore_for_file: non_constant_identifier_names, must_be_immutable
2 |
3 | import 'package:flutter/material.dart';
4 |
5 | /// Model wrapper class [Time] for [TimeOfDay]
6 | class Time extends TimeOfDay {
7 | int second = 0;
8 |
9 | /// Constructor for the class
10 | Time({required int hour, required int minute, int? second})
11 | : super(hour: hour, minute: minute) {
12 | this.second = second ?? 0;
13 | }
14 |
15 | /// Get [Time] instance from [TimeOfDay]
16 | factory Time.fromTimeOfDay(TimeOfDay time, int? secondVal) {
17 | return Time(hour: time.hour, minute: time.minute, second: secondVal);
18 | }
19 |
20 | /// Get [TimeOfDay] instance from [Time]
21 | TimeOfDay toTimeOfDay() {
22 | return TimeOfDay(hour: hour, minute: minute);
23 | }
24 |
25 | /// Toggle [DayPeriod]
26 | Time setPeriod(DayPeriod period) {
27 | return replacing(hour: _changeHourBasedOnAmPm(hour, period));
28 | }
29 |
30 | /// Overide [TimeOfDay.replacing]
31 | @override
32 | Time replacing({int? hour, int? minute, int? second}) {
33 | return Time.fromTimeOfDay(
34 | super.replacing(hour: hour, minute: minute),
35 | second ?? this.second,
36 | );
37 | }
38 |
39 | /// Helper for toggling period
40 | int _changeHourBasedOnAmPm(int hour, DayPeriod a) {
41 | if (a == DayPeriod.pm && hour < 12) {
42 | return hour + 12;
43 | }
44 | if (a == DayPeriod.am && hour >= 12) {
45 | return hour - 12;
46 | }
47 | return hour;
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/lib/lib/sun_moon.dart:
--------------------------------------------------------------------------------
1 | import 'package:day_night_time_picker/lib/constants.dart';
2 | import 'package:day_night_time_picker/lib/state/state_container.dart';
3 | import 'package:flutter/material.dart';
4 |
5 | /// [Widget] for rendering the Sun and Moon Asset
6 | class SunMoon extends StatelessWidget {
7 | /// Whether currently the Sun is displayed
8 | final bool? isSun;
9 |
10 | /// Initialize the Class
11 | const SunMoon({
12 | Key? key,
13 | this.isSun,
14 | }) : super(key: key);
15 |
16 | @override
17 | Widget build(BuildContext context) {
18 | final timeState = TimeModelBinding.of(context);
19 | return SizedBox(
20 | width: SUN_MOON_WIDTH,
21 | child: AnimatedSwitcher(
22 | switchInCurve: Curves.ease,
23 | switchOutCurve: Curves.ease,
24 | duration: const Duration(milliseconds: 250),
25 | child: isSun!
26 | ? Container(
27 | key: const ValueKey(1),
28 | child: timeState.widget.sunAsset ??
29 | const Image(
30 | image: AssetImage(
31 | 'packages/day_night_time_picker/assets/sun.png',
32 | ),
33 | ),
34 | )
35 | : Container(
36 | key: const ValueKey(2),
37 | child: timeState.widget.moonAsset ??
38 | const Image(
39 | image: AssetImage(
40 | 'packages/day_night_time_picker/assets/moon.png',
41 | ),
42 | ),
43 | ),
44 | transitionBuilder: (child, anim) {
45 | return ScaleTransition(
46 | scale: anim,
47 | child: FadeTransition(
48 | opacity: anim,
49 | child: SlideTransition(
50 | position: anim.drive(
51 | Tween(
52 | begin: const Offset(0, 4),
53 | end: const Offset(0, 0),
54 | ),
55 | ),
56 | child: child,
57 | ),
58 | ),
59 | );
60 | },
61 | ),
62 | );
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/lib/lib/utils.dart:
--------------------------------------------------------------------------------
1 | import 'package:day_night_time_picker/lib/constants.dart';
2 | import 'package:flutter/material.dart';
3 |
4 | /// Map a given value between a range
5 | double mapRange(
6 | double value,
7 | double iMin,
8 | double iMax, [
9 | double oMin = 0,
10 | double oMax = 1,
11 | ]) {
12 | return ((value - iMin) * (oMax - oMin)) / (iMax - iMin) + oMin;
13 | }
14 |
15 | int getIntFromTimePickerIntervalEnum(TimePickerInterval? interval) {
16 | switch (interval) {
17 | case TimePickerInterval.FIVE:
18 | return 5;
19 | case TimePickerInterval.TEN:
20 | return 10;
21 | case TimePickerInterval.FIFTEEN:
22 | return 15;
23 | case TimePickerInterval.THIRTY:
24 | return 30;
25 | default:
26 | return 1;
27 | }
28 | }
29 |
30 | /// Map MinuteInterval enum to division values
31 | int getDivisions(int diff, TimePickerInterval? interval) {
32 | switch (interval) {
33 | case TimePickerInterval.FIVE:
34 | // 12
35 | return (diff / 5).round();
36 | case TimePickerInterval.TEN:
37 | // 6
38 | return (diff / 10).round();
39 | case TimePickerInterval.FIFTEEN:
40 | // 4
41 | return (diff / 15).round();
42 | case TimePickerInterval.THIRTY:
43 | // 2
44 | return (diff / 30).round();
45 | default:
46 | return diff;
47 | }
48 | }
49 |
50 | /// Get the minimum minute from interval
51 | double getMin(double? minMinute, TimePickerInterval? interval) {
52 | if (minMinute == 0) {
53 | return 0;
54 | }
55 | int step = getIntFromTimePickerIntervalEnum(interval);
56 |
57 | double min = -1;
58 | double i = 1;
59 | while (min < 0) {
60 | double val = i * step;
61 | if (val >= minMinute!) {
62 | min = val;
63 | }
64 | i++;
65 | }
66 | return min;
67 | }
68 |
69 | /// Get the maximum minute from interval
70 | double getMax(double? maxMinute, TimePickerInterval? interval) {
71 | if (maxMinute == 59) {
72 | return 59;
73 | }
74 | int step = getIntFromTimePickerIntervalEnum(interval);
75 |
76 | double max = 60;
77 | double i = 1;
78 | while (max > maxMinute!) {
79 | double val = 60 - (i * step);
80 | if (val <= maxMinute) {
81 | max = val;
82 | }
83 | i++;
84 | }
85 | return max;
86 | }
87 |
88 | /// Generate a List of minutes
89 | List generateMinutesOrSeconds(
90 | int divisions,
91 | TimePickerInterval? interval,
92 | min,
93 | max,
94 | ) {
95 | final minutes = List.generate(divisions + 1, (index) {
96 | final val =
97 | min.round() + (getIntFromTimePickerIntervalEnum(interval) * index);
98 | if (val >= max) {
99 | return max.round();
100 | }
101 | return val;
102 | });
103 | return minutes;
104 | }
105 |
106 | /// Generate a List of hours
107 | List generateHours(int divisions, min, max) {
108 | final hours = List.generate(divisions, (index) {
109 | final val = min.round() + index;
110 | if (val >= max) {
111 | return max.round();
112 | }
113 | return val;
114 | });
115 | return hours;
116 | }
117 |
118 | /// Convert TimeOfDay to double for comparison
119 | double timeOfDayToDouble(TimeOfDay myTime) =>
120 | myTime.hour + myTime.minute / 60.0;
121 |
--------------------------------------------------------------------------------
/pubspec.lock:
--------------------------------------------------------------------------------
1 | # Generated by pub
2 | # See https://dart.dev/tools/pub/glossary#lockfile
3 | packages:
4 | async:
5 | dependency: transitive
6 | description:
7 | name: async
8 | sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c"
9 | url: "https://pub.dev"
10 | source: hosted
11 | version: "2.11.0"
12 | boolean_selector:
13 | dependency: transitive
14 | description:
15 | name: boolean_selector
16 | sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66"
17 | url: "https://pub.dev"
18 | source: hosted
19 | version: "2.1.1"
20 | characters:
21 | dependency: transitive
22 | description:
23 | name: characters
24 | sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605"
25 | url: "https://pub.dev"
26 | source: hosted
27 | version: "1.3.0"
28 | clock:
29 | dependency: transitive
30 | description:
31 | name: clock
32 | sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf
33 | url: "https://pub.dev"
34 | source: hosted
35 | version: "1.1.1"
36 | collection:
37 | dependency: transitive
38 | description:
39 | name: collection
40 | sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a
41 | url: "https://pub.dev"
42 | source: hosted
43 | version: "1.18.0"
44 | fake_async:
45 | dependency: transitive
46 | description:
47 | name: fake_async
48 | sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78"
49 | url: "https://pub.dev"
50 | source: hosted
51 | version: "1.3.1"
52 | flutter:
53 | dependency: "direct main"
54 | description: flutter
55 | source: sdk
56 | version: "0.0.0"
57 | flutter_lints:
58 | dependency: "direct dev"
59 | description:
60 | name: flutter_lints
61 | sha256: a25a15ebbdfc33ab1cd26c63a6ee519df92338a9c10f122adda92938253bef04
62 | url: "https://pub.dev"
63 | source: hosted
64 | version: "2.0.3"
65 | flutter_test:
66 | dependency: "direct dev"
67 | description: flutter
68 | source: sdk
69 | version: "0.0.0"
70 | lints:
71 | dependency: transitive
72 | description:
73 | name: lints
74 | sha256: "0a217c6c989d21039f1498c3ed9f3ed71b354e69873f13a8dfc3c9fe76f1b452"
75 | url: "https://pub.dev"
76 | source: hosted
77 | version: "2.1.1"
78 | matcher:
79 | dependency: transitive
80 | description:
81 | name: matcher
82 | sha256: "1803e76e6653768d64ed8ff2e1e67bea3ad4b923eb5c56a295c3e634bad5960e"
83 | url: "https://pub.dev"
84 | source: hosted
85 | version: "0.12.16"
86 | material_color_utilities:
87 | dependency: transitive
88 | description:
89 | name: material_color_utilities
90 | sha256: "9528f2f296073ff54cb9fee677df673ace1218163c3bc7628093e7eed5203d41"
91 | url: "https://pub.dev"
92 | source: hosted
93 | version: "0.5.0"
94 | meta:
95 | dependency: transitive
96 | description:
97 | name: meta
98 | sha256: a6e590c838b18133bb482a2745ad77c5bb7715fb0451209e1a7567d416678b8e
99 | url: "https://pub.dev"
100 | source: hosted
101 | version: "1.10.0"
102 | path:
103 | dependency: transitive
104 | description:
105 | name: path
106 | sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917"
107 | url: "https://pub.dev"
108 | source: hosted
109 | version: "1.8.3"
110 | sky_engine:
111 | dependency: transitive
112 | description: flutter
113 | source: sdk
114 | version: "0.0.99"
115 | source_span:
116 | dependency: transitive
117 | description:
118 | name: source_span
119 | sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c"
120 | url: "https://pub.dev"
121 | source: hosted
122 | version: "1.10.0"
123 | stack_trace:
124 | dependency: transitive
125 | description:
126 | name: stack_trace
127 | sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b"
128 | url: "https://pub.dev"
129 | source: hosted
130 | version: "1.11.1"
131 | stream_channel:
132 | dependency: transitive
133 | description:
134 | name: stream_channel
135 | sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7
136 | url: "https://pub.dev"
137 | source: hosted
138 | version: "2.1.2"
139 | string_scanner:
140 | dependency: transitive
141 | description:
142 | name: string_scanner
143 | sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde"
144 | url: "https://pub.dev"
145 | source: hosted
146 | version: "1.2.0"
147 | term_glyph:
148 | dependency: transitive
149 | description:
150 | name: term_glyph
151 | sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84
152 | url: "https://pub.dev"
153 | source: hosted
154 | version: "1.2.1"
155 | test_api:
156 | dependency: transitive
157 | description:
158 | name: test_api
159 | sha256: "5c2f730018264d276c20e4f1503fd1308dfbbae39ec8ee63c5236311ac06954b"
160 | url: "https://pub.dev"
161 | source: hosted
162 | version: "0.6.1"
163 | vector_math:
164 | dependency: transitive
165 | description:
166 | name: vector_math
167 | sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803"
168 | url: "https://pub.dev"
169 | source: hosted
170 | version: "2.1.4"
171 | web:
172 | dependency: transitive
173 | description:
174 | name: web
175 | sha256: afe077240a270dcfd2aafe77602b4113645af95d0ad31128cc02bce5ac5d5152
176 | url: "https://pub.dev"
177 | source: hosted
178 | version: "0.3.0"
179 | sdks:
180 | dart: ">=3.2.0-194.0.dev <4.0.0"
181 |
--------------------------------------------------------------------------------
/pubspec.yaml:
--------------------------------------------------------------------------------
1 | name: day_night_time_picker
2 | description: A day night time picker for Flutter. Beautiful day and night animation with Sun and Moon assets.
3 | version: 1.3.1
4 | homepage: https://github.com/subhamayd2/day_night_time_picker
5 |
6 | environment:
7 | sdk: ">=2.17.0 <4.0.0"
8 |
9 | dependencies:
10 | flutter:
11 | sdk: flutter
12 |
13 | dev_dependencies:
14 | flutter_test:
15 | sdk: flutter
16 | flutter_lints: ^2.0.1
17 |
18 | # For information on the generic Dart part of this file, see the
19 | # following page: https://dart.dev/tools/pub/pubspec
20 |
21 | # The following section is specific to Flutter.
22 | flutter:
23 | assets:
24 | - packages/day_night_time_picker/assets/sun.png
25 | - packages/day_night_time_picker/assets/moon.png
26 | #
27 | # For details regarding assets in packages, see
28 | # https://flutter.dev/assets-and-images/#from-packages
29 | #
30 | # An image asset can refer to one or more resolution-specific "variants", see
31 | # https://flutter.dev/assets-and-images/#resolution-aware.
32 | # To add custom fonts to your package, add a fonts section here,
33 | # in this "flutter" section. Each entry in this list should have a
34 | # "family" key with the font family name, and a "fonts" key with a
35 | # list giving the asset and other descriptors for the font. For
36 | # example:
37 | # fonts:
38 | # - family: Schyler
39 | # fonts:
40 | # - asset: fonts/Schyler-Regular.ttf
41 | # - asset: fonts/Schyler-Italic.ttf
42 | # style: italic
43 | # - family: Trajan Pro
44 | # fonts:
45 | # - asset: fonts/TrajanPro.ttf
46 | # - asset: fonts/TrajanPro_Bold.ttf
47 | # weight: 700
48 | #
49 | # For details regarding fonts in packages, see
50 | # https://flutter.dev/custom-fonts/#from-packages
51 |
--------------------------------------------------------------------------------