Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add calendar #81

Merged
merged 36 commits into from
Jul 16, 2024
Merged
Show file tree
Hide file tree
Changes from 29 commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
4cfa6ed
Prototype day widgets
Pante Jul 4, 2024
6c47a74
Add styling for different day states
Pante Jul 4, 2024
2f39894
wip
Pante Jul 8, 2024
ccb6202
WIP
Pante Jul 8, 2024
4577169
Add month
Pante Jul 8, 2024
b3c1114
Refactor month
Pante Jul 8, 2024
7ff9929
Add calendar header
Pante Jul 8, 2024
1e41d2c
First working scrolling calendar prototype
Pante Jul 8, 2024
cecb055
Fix focusNode issue in Month
Pante Jul 9, 2024
6eaeaa7
Rename month to day_picker & fix focusNode issue in EnabledDay
Pante Jul 9, 2024
3a4f625
Add offset logic
Pante Jul 9, 2024
6ed91ca
Semi-functioning calendar
Pante Jul 9, 2024
4c097ab
Add web and macos run configuration to forui example. Fix animation a…
Pante Jul 10, 2024
51a4bb5
Make consecutive dates connect smoothly
Pante Jul 10, 2024
9fe7a23
Underline today
Pante Jul 10, 2024
c21e85b
WIP year_picker
Pante Jul 10, 2024
a24282e
abstract paging logic
Pante Jul 10, 2024
0f22222
Refactor paged_day_picker
Pante Jul 10, 2024
9ba1927
Add PagedYearPicker
Pante Jul 10, 2024
e54302b
First fully working prototype
Pante Jul 11, 2024
19667d7
WIP refactor
Pante Jul 11, 2024
2361631
Add tests for inkwell
Pante Jul 11, 2024
d5a066c
Refactor calendar
Pante Jul 12, 2024
6677cb9
Expose FCalendar.raw(...)
Pante Jul 13, 2024
d9a4187
Add calendar controllers
Pante Jul 13, 2024
61f513a
Add documentation and tests
Pante Jul 14, 2024
d31370e
Commit from GitHub Actions (Forui Presubmit)
Pante Jul 14, 2024
6767661
Commit from GitHub Actions (Forui Example Presubmit)
Pante Jul 14, 2024
f1a1377
Commit from GitHub Actions (Forui Samples Presubmit)
Pante Jul 14, 2024
ef33bb1
Apply suggestions from code review
Pante Jul 15, 2024
b0293b0
Fix PR issues
Pante Jul 15, 2024
43f28f6
Commit from GitHub Actions (Forui Presubmit)
Pante Jul 15, 2024
5139cf3
Revert fix
Pante Jul 15, 2024
9ae0eb9
Merge branch 'feature/calendar' of https://github.com/forus-labs/foru…
Pante Jul 15, 2024
81697d8
Make radius configurable
Pante Jul 15, 2024
19677bb
Commit from GitHub Actions (Forui Presubmit)
Pante Jul 15, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
91 changes: 91 additions & 0 deletions docs/pages/docs/calendar.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
import { Tabs } from 'nextra/components';
import { Widget } from "../../components/widget";

# Calendar
A date field component that allows users to enter and edit date.

The calendar pages are designed to be navigable through swipe gestures on mobile platforms, allowing left and right swipes
to transition between pages.

<Tabs items={['Preview', 'Code']}>
<Tabs.Tab>
<Widget name='calendar' query={{}} height={500}/>
</Tabs.Tab>
<Tabs.Tab>
```dart
FCalendar(
controller: FCalendarSingleRangeController(),
start: DateTime.utc(2024),
end: DateTime.utc(2030),
);
```
</Tabs.Tab>
</Tabs>

## Usage

### `FCalendar(...)`

```dart
FCalendar(
controller: FCalendarSingleRangeController(),
start: DateTime.utc(2024),
end: DateTime.utc(2030),
today: DateTime.utc(2024, 7, 14),
initalType = FCalendarPickerType.yearMonth,
initialDate = DateTime.utc(2024, 9, 12),
enabled: (date) => allowed.contains(date),
onMonthChange: (date) => print(date),
onPress: (date) => print(date),
onLongPress: (date) => print(date),
);
```
## Examples

### Single Date
<Tabs items={['Preview', 'Code']}>
<Tabs.Tab>
<Widget name='calendar' query={{}} height={500}/>
</Tabs.Tab>
<Tabs.Tab>
```dart
FCalendar(
controller: FCalendarSingleValueController(),
start: DateTime.utc(2024),
end: DateTime.utc(2030),
);
```
</Tabs.Tab>
</Tabs>

### Multiple Dates
<Tabs items={['Preview', 'Code']}>
<Tabs.Tab>
<Widget name='calendar' variant='multi-value' query={{}} height={500}/>
</Tabs.Tab>
<Tabs.Tab>
```dart
FCalendar(
controller: FCalendarMultiValueController(),
start: DateTime.utc(2024),
end: DateTime.utc(2030),
);
```
</Tabs.Tab>
</Tabs>

### Single Range
<Tabs items={['Preview', 'Code']}>
<Tabs.Tab>
<Widget name='calendar' variant='single-range' query={{}} height={500}/>
</Tabs.Tab>
<Tabs.Tab>
```dart
FCalendar(
controller: FCalendarSingleRangeController(),
start: DateTime.utc(2024),
end: DateTime.utc(2030),
)
```
</Tabs.Tab>
</Tabs>
3 changes: 3 additions & 0 deletions forui/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
## Next

### Additions
* Add `FCalendar`

### Enhancements
* **Breaking** Change `FSwitch` to be usable in `Form`s.
* **Breaking** Rename `FThemeData.checkBoxStyle` to `FThemeData.checkboxStyle` for consistency.
Expand Down
18 changes: 6 additions & 12 deletions forui/example/.metadata
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# This file should be version controlled and should not be manually edited.

version:
revision: "bae5e49bc2a867403c43b2aae2de8f8c33b037e4"
revision: "761747bfc538b5af34aa0d3fac380f1bc331ec49"
channel: "stable"

project_type: app
Expand All @@ -13,17 +13,11 @@ project_type: app
migration:
platforms:
- platform: root
create_revision: bae5e49bc2a867403c43b2aae2de8f8c33b037e4
base_revision: bae5e49bc2a867403c43b2aae2de8f8c33b037e4
- platform: android
create_revision: bae5e49bc2a867403c43b2aae2de8f8c33b037e4
base_revision: bae5e49bc2a867403c43b2aae2de8f8c33b037e4
- platform: ios
create_revision: bae5e49bc2a867403c43b2aae2de8f8c33b037e4
base_revision: bae5e49bc2a867403c43b2aae2de8f8c33b037e4
- platform: web
create_revision: bae5e49bc2a867403c43b2aae2de8f8c33b037e4
base_revision: bae5e49bc2a867403c43b2aae2de8f8c33b037e4
create_revision: 761747bfc538b5af34aa0d3fac380f1bc331ec49
base_revision: 761747bfc538b5af34aa0d3fac380f1bc331ec49
- platform: macos
create_revision: 761747bfc538b5af34aa0d3fac380f1bc331ec49
base_revision: 761747bfc538b5af34aa0d3fac380f1bc331ec49

# User provided section

Expand Down
7 changes: 7 additions & 0 deletions forui/example/macos/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Flutter-related
**/Flutter/ephemeral/
**/Pods/

# Xcode-related
**/dgph
**/xcuserdata/
2 changes: 2 additions & 0 deletions forui/example/macos/Flutter/Flutter-Debug.xcconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
#include "ephemeral/Flutter-Generated.xcconfig"
2 changes: 2 additions & 0 deletions forui/example/macos/Flutter/Flutter-Release.xcconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
#include "ephemeral/Flutter-Generated.xcconfig"
43 changes: 43 additions & 0 deletions forui/example/macos/Podfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
platform :osx, '10.14'

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'

project 'Runner', {
'Debug' => :debug,
'Profile' => :release,
'Release' => :release,
}

def flutter_root
generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'ephemeral', 'Flutter-Generated.xcconfig'), __FILE__)
unless File.exist?(generated_xcode_build_settings_path)
raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure \"flutter pub get\" is executed first"
end

File.foreach(generated_xcode_build_settings_path) do |line|
matches = line.match(/FLUTTER_ROOT\=(.*)/)
return matches[1].strip if matches
end
raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Flutter-Generated.xcconfig, then run \"flutter pub get\""
end

require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)

flutter_macos_podfile_setup

target 'Runner' do
use_frameworks!
use_modular_headers!

flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__))
target 'RunnerTests' do
inherit! :search_paths
end
end

post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_macos_build_settings(target)
end
end
23 changes: 23 additions & 0 deletions forui/example/macos/Podfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
PODS:
- FlutterMacOS (1.0.0)
- path_provider_foundation (0.0.1):
- Flutter
- FlutterMacOS

DEPENDENCIES:
- FlutterMacOS (from `Flutter/ephemeral`)
- path_provider_foundation (from `Flutter/ephemeral/.symlinks/plugins/path_provider_foundation/darwin`)

EXTERNAL SOURCES:
FlutterMacOS:
:path: Flutter/ephemeral
path_provider_foundation:
:path: Flutter/ephemeral/.symlinks/plugins/path_provider_foundation/darwin

SPEC CHECKSUMS:
FlutterMacOS: 8f6f14fa908a6fb3fba0cd85dbd81ec4b251fb24
path_provider_foundation: 2b6b4c569c0fb62ec74538f866245ac84301af46

PODFILE CHECKSUM: 236401fc2c932af29a9fcf0e97baeeb2d750d367

COCOAPODS: 1.15.2
Loading
Loading