-
Notifications
You must be signed in to change notification settings - Fork 7
feat: add ZetaCalendar component and usage example #429
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
Open
Ashish3789
wants to merge
11
commits into
ZebraDevs:main
Choose a base branch
from
Ashish3789:WFCNG-48025
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 2 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
f29bfdb
feat: add ZetaCalendar component and usage example
Ashish3789 00b4209
chore(automated): Lint commit and format
invalid-email-address 1c460b8
fixed pr reviews and also added test case for all the calendar relate…
Ashish3789 96e784a
fixed pr reviews and also added test case for all the calendar relate…
Ashish3789 ca527e6
feat(widgetbook): add Calendar use case for ZetaCalendar component
Ashish3789 204fb05
feat(calendar): add range calendar API and showcase in example + Widg…
Ashish3789 c7eb40b
feat(calendar): add range calendar API and showcase in example + Widg…
Ashish3789 0b4cba0
feat(calendar): add range calendar API and showcase in example + Widg…
Ashish3789 994b718
chore(automated): Lint commit and format
invalid-email-address 52e4391
Merge branch 'main' into WFCNG-48025
thelukewalton 0ad8dd7
chore(automated): Lint commit and format
invalid-email-address File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,85 @@ | ||
| import 'package:flutter/material.dart'; | ||
| import 'package:zeta_example/config/components_config.dart'; | ||
| import 'package:zeta_example/widgets.dart'; | ||
| import 'package:zeta_flutter/zeta_flutter.dart'; | ||
|
|
||
| class CalendarExample extends StatefulWidget { | ||
| const CalendarExample({Key? key}) : super(key: key); | ||
|
|
||
| @override | ||
| State<CalendarExample> createState() => _CalendarExampleState(); | ||
| } | ||
|
|
||
| class _CalendarExampleState extends State<CalendarExample> { | ||
| DateTimeRange? _selectedRange; | ||
|
|
||
| @override | ||
| Widget build(BuildContext context) { | ||
| return ExampleScaffold( | ||
| name: calendarRoute, | ||
| child: SingleChildScrollView( | ||
| padding: const EdgeInsets.all(16), | ||
| child: Column( | ||
| crossAxisAlignment: CrossAxisAlignment.start, | ||
| children: [ | ||
| if (_selectedRange != null) | ||
| Padding( | ||
| padding: const EdgeInsets.only(bottom: 16), | ||
| child: Text( | ||
| 'Selected: ${_formatDate(_selectedRange!.start)} – ${_formatDate(_selectedRange!.end)}', | ||
| style: Zeta.of(context).textStyles.bodyMedium, | ||
| ), | ||
| ), | ||
| ZetaCalendar( | ||
| key: const Key('docs-calendar'), | ||
| initialStartDate: DateTime(2028, 7, 3), | ||
| initialEndDate: DateTime(2028, 8, 18), | ||
| minDate: DateTime(2020), | ||
| maxDate: DateTime(2035), | ||
| onRangeChanged: (range) { | ||
| setState(() => _selectedRange = range); | ||
| }, | ||
| onApply: (range) { | ||
| if (range != null) { | ||
| ScaffoldMessenger.of(context).showSnackBar( | ||
| SnackBar( | ||
| content: Text( | ||
| 'Applied: ${_formatDate(range.start)} – ${_formatDate(range.end)}', | ||
| ), | ||
| ), | ||
| ); | ||
| } | ||
| }, | ||
| onCancel: () { | ||
| ScaffoldMessenger.of(context).showSnackBar( | ||
| const SnackBar(content: Text('Cancelled')), | ||
| ); | ||
| }, | ||
| onReset: () { | ||
| setState(() => _selectedRange = null); | ||
| }, | ||
| ), | ||
| ], | ||
| ), | ||
| ), | ||
| ); | ||
| } | ||
|
|
||
| String _formatDate(DateTime date) { | ||
| const months = [ | ||
| 'Jan', | ||
| 'Feb', | ||
| 'Mar', | ||
| 'Apr', | ||
| 'May', | ||
| 'Jun', | ||
| 'Jul', | ||
| 'Aug', | ||
| 'Sep', | ||
| 'Oct', | ||
| 'Nov', | ||
| 'Dec', | ||
| ]; | ||
| return '${months[date.month - 1]} ${date.day}, ${date.year}'; | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.