Skip to content

Commit

Permalink
feat: add date range picker
Browse files Browse the repository at this point in the history
  • Loading branch information
sahani-deriv committed Feb 21, 2024
1 parent 3ffaac3 commit f2f1f39
Show file tree
Hide file tree
Showing 3 changed files with 82 additions and 91 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import 'package:deriv_ui/deriv_ui.dart';
import 'package:flutter/material.dart';
import 'package:widgetbook/widgetbook.dart';
import 'package:widgetbook_annotation/widgetbook_annotation.dart';

final globalKey = GlobalKey();

@UseCase(
name: 'DateRangePicker calendar mode',
type: DerivDateRangePicker,
)
Widget dateRangePickerUseCase(BuildContext context) {
return DerivDateRangePicker(
key: globalKey,
mode: DateRangePickerMode.calendar,
context: context,
currentDate: DateTime.now(),
minAllowedDate: DateTime(2021),
maxAllowedDate: DateTime(2025, 12, 31),
cancelText: 'Cancel',
confirmText: 'Confirm',
semanticLabelCalendar: 'Calendar',
semanticLabelClose: 'Close',
semanticLabelConfirm: 'Confirm',
semanticLabelEditIcon: 'Edit',
labelSelectedDateRange: 'Selected Date Range',
toolTipCalendar: 'Calendar',
toolTipConfirm: 'Confirm',
toolTipClose: 'Close',
toolTipEdit: 'Edit',
fieldEndLabelText: 'Start',
fieldStartLabelText: 'End',
initialStartDate: context.knobs.dateTime(
label: 'Start Date',
initialValue: DateTime.now(),
start: DateTime.now(),
end: DateTime(2024, 12, 11)),
initialEndDate: context.knobs.dateTime(
label: 'End Date',
initialValue: DateTime(2024, 12, 11),
start: DateTime.now(),
end: DateTime(2024, 12, 11)),
);
}
94 changes: 38 additions & 56 deletions packages/deriv_widgetbook/lib/main.directories.g.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,58 +9,40 @@
// **************************************************************************

// ignore_for_file: no_leading_underscores_for_library_prefixes
import 'package:deriv_widgetbook/components/banner/banner_usecases.dart' as _i2;
import 'package:deriv_widgetbook/components/date_range_picker/date_range_picker_calender_usecase.dart'
as _i3;
as _i2;
import 'package:deriv_widgetbook/components/expandable_bottomsheet/expandable_bottomsheet_usecase.dart'
as _i4;
as _i3;
import 'package:deriv_widgetbook/components/grouped_list_view/grouped_list_view_usecase.dart'
as _i5;
as _i4;
import 'package:deriv_widgetbook/components/numpad/numpad_with_exchanger_usecase.dart'
as _i6;
as _i5;
import 'package:deriv_widgetbook/components/numpad/numpad_without_exchanger_usecase.dart'
as _i7;
as _i6;
import 'package:deriv_widgetbook/widgets/buttons/info_icon_button_usecases.dart'
as _i12;
as _i11;
import 'package:deriv_widgetbook/widgets/buttons/primary_button_usecases.dart'
as _i15;
as _i14;
import 'package:deriv_widgetbook/widgets/buttons/secondary_button_usecases.dart'
as _i16;
as _i15;
import 'package:deriv_widgetbook/widgets/checkbox/checkbox_usecases.dart'
as _i10;
import 'package:deriv_widgetbook/widgets/dialogs/custom_alert_dailog_usecases.dart'
as _i9;
import 'package:deriv_widgetbook/widgets/dialogs/custom_alert_dailog_usecases.dart'
as _i8;
import 'package:deriv_widgetbook/widgets/dialogs/popup_alert_dialog_usecases.dart'
as _i14;
as _i13;
import 'package:deriv_widgetbook/widgets/full_screen_message/full_screen_message_usecases.dart'
as _i11;
as _i10;
import 'package:deriv_widgetbook/widgets/loading_indicator/loading_indicator_usecases.dart'
as _i13;
as _i12;
import 'package:deriv_widgetbook/widgets/text_fields/base_text_field_usecases.dart'
as _i8;
as _i7;
import 'package:widgetbook/widgetbook.dart' as _i1;

final directories = <_i1.WidgetbookNode>[
_i1.WidgetbookFolder(
name: 'components',
children: [
_i1.WidgetbookFolder(
name: 'banner',
children: [
_i1.WidgetbookFolder(
name: 'widgets',
children: [
_i1.WidgetbookLeafComponent(
name: 'StackedBanner',
useCase: _i1.WidgetbookUseCase(
name: 'Stacked banner',
builder: _i2.stackedBannerUseCase,
),
)
],
)
],
),
_i1.WidgetbookFolder(
name: 'date_range_picker',
children: [
Expand All @@ -71,7 +53,7 @@ final directories = <_i1.WidgetbookNode>[
name: 'DerivDateRangePicker',
useCase: _i1.WidgetbookUseCase(
name: 'DateRangePicker calendar mode',
builder: _i3.dateRangePickerUseCase,
builder: _i2.dateRangePickerUseCase,
),
)
],
Expand All @@ -88,7 +70,7 @@ final directories = <_i1.WidgetbookNode>[
name: 'ExpandableBottomSheet',
useCase: _i1.WidgetbookUseCase(
name: 'Default',
builder: _i4.expandableBottomSheetDefaultUseCase,
builder: _i3.expandableBottomSheetDefaultUseCase,
),
)
],
Expand All @@ -105,7 +87,7 @@ final directories = <_i1.WidgetbookNode>[
name: 'GroupedListView<dynamic, dynamic>',
useCase: _i1.WidgetbookUseCase(
name: 'Grouped List View',
builder: _i5.groupedListViewUseCase,
builder: _i4.groupedListViewUseCase,
),
)
],
Expand All @@ -123,11 +105,11 @@ final directories = <_i1.WidgetbookNode>[
useCases: [
_i1.WidgetbookUseCase(
name: 'With Currency Exchanger',
builder: _i6.numpadWithCurrencyExchangerUseCase,
builder: _i5.numpadWithCurrencyExchangerUseCase,
),
_i1.WidgetbookUseCase(
name: 'Without Currency Exchanger',
builder: _i7.numpadUseCase,
builder: _i6.numpadUseCase,
),
],
)
Expand All @@ -145,15 +127,15 @@ final directories = <_i1.WidgetbookNode>[
useCases: [
_i1.WidgetbookUseCase(
name: 'Disabled',
builder: _i8.baseTextFieldDisabledUseCase,
builder: _i7.baseTextFieldDisabledUseCase,
),
_i1.WidgetbookUseCase(
name: 'Enabled',
builder: _i8.baseTextFieldEnabledUseCase,
builder: _i7.baseTextFieldEnabledUseCase,
),
_i1.WidgetbookUseCase(
name: 'Error',
builder: _i8.baseTextFieldErrorUseCase,
builder: _i7.baseTextFieldErrorUseCase,
),
],
),
Expand All @@ -162,15 +144,15 @@ final directories = <_i1.WidgetbookNode>[
useCases: [
_i1.WidgetbookUseCase(
name: 'No button',
builder: _i9.customAlertDialogNoButtonUseCase,
builder: _i8.customAlertDialogNoButtonUseCase,
),
_i1.WidgetbookUseCase(
name: 'One button',
builder: _i9.customAlertDialogOneButtonUseCase,
builder: _i8.customAlertDialogOneButtonUseCase,
),
_i1.WidgetbookUseCase(
name: 'Two buttons',
builder: _i9.customAlertDialogUseCase,
builder: _i8.customAlertDialogUseCase,
),
],
),
Expand All @@ -179,11 +161,11 @@ final directories = <_i1.WidgetbookNode>[
useCases: [
_i1.WidgetbookUseCase(
name: 'checked',
builder: _i10.checkboxCheckedUsecase,
builder: _i9.checkboxCheckedUsecase,
),
_i1.WidgetbookUseCase(
name: 'unchecked',
builder: _i10.checkboxUncheckedUsecase,
builder: _i9.checkboxUncheckedUsecase,
),
],
),
Expand All @@ -192,31 +174,31 @@ final directories = <_i1.WidgetbookNode>[
useCases: [
_i1.WidgetbookUseCase(
name: 'No button',
builder: _i11.fullScreenMessageUseCase,
builder: _i10.fullScreenMessageUseCase,
),
_i1.WidgetbookUseCase(
name: 'With button',
builder: _i11.fullScreenMessageWithButtonUseCase,
builder: _i10.fullScreenMessageWithButtonUseCase,
),
],
),
_i1.WidgetbookLeafComponent(
name: 'InfoIconButton',
useCase: _i1.WidgetbookUseCase(
name: 'Info icon button',
builder: _i12.infoIconButtonUseCase,
builder: _i11.infoIconButtonUseCase,
),
),
_i1.WidgetbookComponent(
name: 'LoadingIndicator',
useCases: [
_i1.WidgetbookUseCase(
name: 'Circular',
builder: _i13.loadingIndicatorUseCase,
builder: _i12.loadingIndicatorUseCase,
),
_i1.WidgetbookUseCase(
name: 'Linear',
builder: _i13.linearLoadingIndicatorUseCase,
builder: _i12.linearLoadingIndicatorUseCase,
),
],
),
Expand All @@ -225,11 +207,11 @@ final directories = <_i1.WidgetbookNode>[
useCases: [
_i1.WidgetbookUseCase(
name: 'With checkbox',
builder: _i14.popupAlertDialogUseCase,
builder: _i13.popupAlertDialogUseCase,
),
_i1.WidgetbookUseCase(
name: 'Without checkbox',
builder: _i14.popupAlertDialogWithoutCheckboxUseCase,
builder: _i13.popupAlertDialogWithoutCheckboxUseCase,
),
],
),
Expand All @@ -238,11 +220,11 @@ final directories = <_i1.WidgetbookNode>[
useCases: [
_i1.WidgetbookUseCase(
name: 'Disabled',
builder: _i15.primaryButtonDisabledUseCase,
builder: _i14.primaryButtonDisabledUseCase,
),
_i1.WidgetbookUseCase(
name: 'Enabled',
builder: _i15.primaryButtonEnabledUseCase,
builder: _i14.primaryButtonEnabledUseCase,
),
],
),
Expand All @@ -251,11 +233,11 @@ final directories = <_i1.WidgetbookNode>[
useCases: [
_i1.WidgetbookUseCase(
name: 'Disabled',
builder: _i16.secondaryButtonDisabledUseCase,
builder: _i15.secondaryButtonDisabledUseCase,
),
_i1.WidgetbookUseCase(
name: 'Enabled',
builder: _i16.secondaryButtonEnabledUseCase,
builder: _i15.secondaryButtonEnabledUseCase,
),
],
),
Expand Down

0 comments on commit f2f1f39

Please sign in to comment.