diff --git a/packages/deriv_widgetbook/lib/components/banner/banner_usecases.dart b/packages/deriv_widgetbook/lib/components/banner/banner_usecases.dart deleted file mode 100644 index 85ec220eb..000000000 --- a/packages/deriv_widgetbook/lib/components/banner/banner_usecases.dart +++ /dev/null @@ -1,35 +0,0 @@ -import 'package:deriv_theme/deriv_theme.dart'; -import 'package:flutter/material.dart'; -import 'package:deriv_ui/deriv_ui.dart'; -import 'package:widgetbook/widgetbook.dart'; -import 'package:widgetbook_annotation/widgetbook_annotation.dart'; - -@UseCase( - name: 'Stacked banner', - type: StackedBanner, -) -Widget stackedBannerUseCase(BuildContext context) { - return StackedBanner( - collapseButtonBuilder: (BuildContext context) => Container( - alignment: Alignment.center, - height: ThemeProvider.margin32, - decoration: BoxDecoration( - color: bannerButtonColor, - borderRadius: BorderRadius.circular( - ThemeProvider.borderRadius04, - ), - ), - child: Text( - context.knobs - .string(label: 'Collapse Button Label', initialValue: 'Collapse'), - style: context.theme.textStyle( - textStyle: TextStyles.body1, - color: context.theme.colors.prominent, - ), - ), - ), - controller: StackedBannerController(), - onDismissed: () {}, - isExpanded: ({required bool isExpanded}) {}, - ); -} diff --git a/packages/deriv_widgetbook/lib/components/date_range_picker/date_range_picker_calender_usecase.dart b/packages/deriv_widgetbook/lib/components/date_range_picker/date_range_picker_calender_usecase.dart new file mode 100644 index 000000000..c34bdfaf8 --- /dev/null +++ b/packages/deriv_widgetbook/lib/components/date_range_picker/date_range_picker_calender_usecase.dart @@ -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)), + ); +} diff --git a/packages/deriv_widgetbook/lib/main.directories.g.dart b/packages/deriv_widgetbook/lib/main.directories.g.dart index 6bc336b90..fa8bf5160 100644 --- a/packages/deriv_widgetbook/lib/main.directories.g.dart +++ b/packages/deriv_widgetbook/lib/main.directories.g.dart @@ -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: [ @@ -71,7 +53,7 @@ final directories = <_i1.WidgetbookNode>[ name: 'DerivDateRangePicker', useCase: _i1.WidgetbookUseCase( name: 'DateRangePicker calendar mode', - builder: _i3.dateRangePickerUseCase, + builder: _i2.dateRangePickerUseCase, ), ) ], @@ -88,7 +70,7 @@ final directories = <_i1.WidgetbookNode>[ name: 'ExpandableBottomSheet', useCase: _i1.WidgetbookUseCase( name: 'Default', - builder: _i4.expandableBottomSheetDefaultUseCase, + builder: _i3.expandableBottomSheetDefaultUseCase, ), ) ], @@ -105,7 +87,7 @@ final directories = <_i1.WidgetbookNode>[ name: 'GroupedListView', useCase: _i1.WidgetbookUseCase( name: 'Grouped List View', - builder: _i5.groupedListViewUseCase, + builder: _i4.groupedListViewUseCase, ), ) ], @@ -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, ), ], ) @@ -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, ), ], ), @@ -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, ), ], ), @@ -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, ), ], ), @@ -192,11 +174,11 @@ 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, ), ], ), @@ -204,7 +186,7 @@ final directories = <_i1.WidgetbookNode>[ name: 'InfoIconButton', useCase: _i1.WidgetbookUseCase( name: 'Info icon button', - builder: _i12.infoIconButtonUseCase, + builder: _i11.infoIconButtonUseCase, ), ), _i1.WidgetbookComponent( @@ -212,11 +194,11 @@ final directories = <_i1.WidgetbookNode>[ useCases: [ _i1.WidgetbookUseCase( name: 'Circular', - builder: _i13.loadingIndicatorUseCase, + builder: _i12.loadingIndicatorUseCase, ), _i1.WidgetbookUseCase( name: 'Linear', - builder: _i13.linearLoadingIndicatorUseCase, + builder: _i12.linearLoadingIndicatorUseCase, ), ], ), @@ -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, ), ], ), @@ -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, ), ], ), @@ -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, ), ], ),