From 5e5dbe599524b2dc92c713af8f2ea360d8ff6a92 Mon Sep 17 00:00:00 2001 From: Alexandru Mariuti Date: Wed, 23 Oct 2024 09:51:50 +0100 Subject: [PATCH 1/8] fix: select initial values (#174) --- CHANGELOG.md | 4 ++++ lib/src/components/select.dart | 1 + pubspec.yaml | 2 +- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6aa002e8..c401d659 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.13.5 + +- **FIX**: Fix `ShadSelect` initial values on widget creation. + ## 0.13.4+1 - **CHORE**: Update svg dependencies diff --git a/lib/src/components/select.dart b/lib/src/components/select.dart index 6dfad974..4331a071 100644 --- a/lib/src/components/select.dart +++ b/lib/src/components/select.dart @@ -462,6 +462,7 @@ class ShadSelectState extends State> { FocusNode? internalFocusNode; late final selectedValues = { if (widget.initialValue is T) widget.initialValue as T, + ...widget.initialValues, }; ShadPopoverController? _controller; diff --git a/pubspec.yaml b/pubspec.yaml index 3ddf65c5..b26b0f47 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: shadcn_ui description: shadcn-ui ported in Flutter. Awesome UI components for Flutter, fully customizable. -version: 0.13.4+1 +version: 0.13.5 homepage: https://flutter-shadcn-ui.mariuti.com repository: https://github.com/nank1ro/flutter-shadcn-ui documentation: https://flutter-shadcn-ui.mariuti.com From f3f063b106e4f23daec4af4a12939c7a0606ebb1 Mon Sep 17 00:00:00 2001 From: Muslimin Ontong <57244338+moshOntong-IT@users.noreply.github.com> Date: Sun, 27 Oct 2024 17:24:23 +0800 Subject: [PATCH 2/8] feat: display cursor click when the onRowTap or onColumnTap visible. (#178) --- lib/src/components/table.dart | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/src/components/table.dart b/lib/src/components/table.dart index 2dfe6c9d..092b3377 100644 --- a/lib/src/components/table.dart +++ b/lib/src/components/table.dart @@ -353,6 +353,9 @@ class _ShadTableState extends State { }, ), }, + cursor: widget.onColumnTap != null + ? SystemMouseCursors.click + : MouseCursor.defer, ); } @@ -433,6 +436,9 @@ class _ShadTableState extends State { }, ), }, + cursor: widget.onRowTap != null + ? SystemMouseCursors.click + : MouseCursor.defer, ); } From 82f7b41dfe6561e3992ecba99020f2e8723fb430 Mon Sep 17 00:00:00 2001 From: Muslimin Ontong <57244338+moshOntong-IT@users.noreply.github.com> Date: Sun, 27 Oct 2024 17:26:25 +0800 Subject: [PATCH 3/8] =?UTF-8?q?refactor:=20remove=20`onChangedNullable`,?= =?UTF-8?q?=20update=20`onChanged`=20for=20null=20val=E2=80=A6=20(#177)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lib/common/properties/enum_property.dart | 2 +- example/lib/pages/accordion.dart | 6 ++- example/lib/pages/button.dart | 6 ++- example/lib/pages/calendar.dart | 8 ++-- example/lib/pages/checkbox_form_field.dart | 6 ++- example/lib/pages/input_form_field.dart | 6 ++- example/lib/pages/radio_group.dart | 6 ++- example/lib/pages/radio_group_form_field.dart | 6 ++- example/lib/pages/select.dart | 12 ++--- example/lib/pages/select_form_field.dart | 10 +++-- example/lib/pages/sheet.dart | 8 +++- example/lib/pages/switch_form_field.dart | 6 ++- example/lib/pages/toast.dart | 8 ++-- lib/src/components/calendar.dart | 8 +++- lib/src/components/form/fields/select.dart | 45 +++++-------------- lib/src/components/select.dart | 41 +++++------------ 16 files changed, 94 insertions(+), 90 deletions(-) diff --git a/example/lib/common/properties/enum_property.dart b/example/lib/common/properties/enum_property.dart index d9337550..6537286f 100644 --- a/example/lib/common/properties/enum_property.dart +++ b/example/lib/common/properties/enum_property.dart @@ -13,7 +13,7 @@ class MyEnumProperty extends StatelessWidget { final String label; final T value; final List values; - final ValueChanged onChanged; + final ValueChanged onChanged; @override Widget build(BuildContext context) { diff --git a/example/lib/pages/accordion.dart b/example/lib/pages/accordion.dart index 6bf02c37..066fc10c 100644 --- a/example/lib/pages/accordion.dart +++ b/example/lib/pages/accordion.dart @@ -52,7 +52,11 @@ class _AccordionPageState extends State { label: 'Type', value: type, values: ShadAccordionType.values, - onChanged: (value) => setState(() => type = value), + onChanged: (value) { + if (value != null) { + setState(() => type = value); + } + }, ), MyBoolProperty( label: 'Underline title', diff --git a/example/lib/pages/button.dart b/example/lib/pages/button.dart index bde675ab..2512d7a9 100644 --- a/example/lib/pages/button.dart +++ b/example/lib/pages/button.dart @@ -27,7 +27,11 @@ class _ButtonPageState extends State { label: 'Size', value: size, values: ShadButtonSize.values, - onChanged: (value) => setState(() => size = value), + onChanged: (value) { + if (value != null) { + setState(() => size = value); + } + }, ), MyBoolProperty( label: 'Enabled', diff --git a/example/lib/pages/calendar.dart b/example/lib/pages/calendar.dart index 2e1340fe..0f3b346b 100644 --- a/example/lib/pages/calendar.dart +++ b/example/lib/pages/calendar.dart @@ -41,9 +41,11 @@ class _CalendarPageState extends State { value: captionLayout, values: ShadCalendarCaptionLayout.values, onChanged: (value) { - setState(() { - captionLayout = value; - }); + if (value != null) { + setState(() { + captionLayout = value; + }); + } }, ), MyBoolProperty( diff --git a/example/lib/pages/checkbox_form_field.dart b/example/lib/pages/checkbox_form_field.dart index 6ed97d9c..8323f07a 100644 --- a/example/lib/pages/checkbox_form_field.dart +++ b/example/lib/pages/checkbox_form_field.dart @@ -42,7 +42,11 @@ class _CheckboxFormFieldPageState extends State { label: 'autovalidateMode', value: autovalidateMode, values: ShadAutovalidateMode.values, - onChanged: (value) => setState(() => autovalidateMode = value), + onChanged: (value) { + if (value != null) { + setState(() => autovalidateMode = value); + } + }, ), MyBoolProperty( label: 'Form Initial Value', diff --git a/example/lib/pages/input_form_field.dart b/example/lib/pages/input_form_field.dart index 17d60d1e..ece5b90b 100644 --- a/example/lib/pages/input_form_field.dart +++ b/example/lib/pages/input_form_field.dart @@ -43,7 +43,11 @@ class _InputFormFieldPageState extends State { label: 'autovalidateMode', value: autovalidateMode, values: ShadAutovalidateMode.values, - onChanged: (value) => setState(() => autovalidateMode = value), + onChanged: (value) { + if (value != null) { + setState(() => autovalidateMode = value); + } + }, ), MyStringProperty( label: 'Form Initial Value', diff --git a/example/lib/pages/radio_group.dart b/example/lib/pages/radio_group.dart index 9477f65f..f2018a65 100644 --- a/example/lib/pages/radio_group.dart +++ b/example/lib/pages/radio_group.dart @@ -45,7 +45,11 @@ class _RadioPageState extends State { MyEnumProperty( label: 'Axis', value: axis, - onChanged: (value) => setState(() => axis = value), + onChanged: (value) { + if (value != null) { + setState(() => axis = value); + } + }, values: Axis.values, ), ], diff --git a/example/lib/pages/radio_group_form_field.dart b/example/lib/pages/radio_group_form_field.dart index 4077c701..51eedcd7 100644 --- a/example/lib/pages/radio_group_form_field.dart +++ b/example/lib/pages/radio_group_form_field.dart @@ -57,7 +57,11 @@ class _RadioGroupFormFieldPageState extends State { label: 'autovalidateMode', value: autovalidateMode, values: ShadAutovalidateMode.values, - onChanged: (value) => setState(() => autovalidateMode = value), + onChanged: (value) { + if (value != null) { + setState(() => autovalidateMode = value); + } + }, ), MyEnumProperty( label: 'Form Initial Value', diff --git a/example/lib/pages/select.dart b/example/lib/pages/select.dart index b0b1101c..794e4810 100644 --- a/example/lib/pages/select.dart +++ b/example/lib/pages/select.dart @@ -133,11 +133,11 @@ class _SelectPageState extends State { children: [ ShadSelect( minWidth: 180, - onChanged: allowDeselection ? null : print, - onChangedNullable: allowDeselection ? print : null, + onChanged: print, enabled: enabled, focusNode: focusNodes[0], placeholder: const Text('Select a fruit'), + allowDeselection: allowDeselection, options: [ Padding( padding: const EdgeInsets.fromLTRB(32, 6, 6, 6), @@ -159,8 +159,7 @@ class _SelectPageState extends State { ShadSelect( minWidth: 280, focusNode: focusNodes[1], - onChanged: allowDeselection ? null : print, - onChangedNullable: allowDeselection ? print : null, + onChanged: print, enabled: enabled, placeholder: const Text('Select a timezone'), options: timezones.entries.map( @@ -187,6 +186,7 @@ class _SelectPageState extends State { ], ), ), + allowDeselection: allowDeselection, selectedOptionBuilder: (context, value) { final timezone = timezones.entries .firstWhere((element) => element.value.containsKey(value)) @@ -223,8 +223,8 @@ class _SelectPageState extends State { ) ], selectedOptionBuilder: (context, value) => Text(frameworks[value]!), - onChanged: allowDeselection ? null : print, - onChangedNullable: allowDeselection ? print : null, + onChanged: print, + allowDeselection: allowDeselection, ), ShadSelect.multiple( minWidth: 340, diff --git a/example/lib/pages/select_form_field.dart b/example/lib/pages/select_form_field.dart index fcb5d336..38abd363 100644 --- a/example/lib/pages/select_form_field.dart +++ b/example/lib/pages/select_form_field.dart @@ -48,7 +48,11 @@ class _SelectFormFieldPageState extends State { label: 'autovalidateMode', value: autovalidateMode, values: ShadAutovalidateMode.values, - onChanged: (value) => setState(() => autovalidateMode = value), + onChanged: (value) { + if (value != null) { + setState(() => autovalidateMode = value); + } + }, ), ShadSelect( options: ['none', ...verifiedEmails].map( @@ -81,10 +85,10 @@ class _SelectFormFieldPageState extends State { children: [ ShadSelectFormField( id: 'email', + allowDeselection: allowDeselection, minWidth: 350, initialValue: initialValue, - onChanged: allowDeselection ? null : print, - onChangedNullable: allowDeselection ? print : null, + onChanged: print, options: verifiedEmails .map((email) => ShadOption(value: email, child: Text(email))) diff --git a/example/lib/pages/sheet.dart b/example/lib/pages/sheet.dart index bd9f66db..9354bcfe 100644 --- a/example/lib/pages/sheet.dart +++ b/example/lib/pages/sheet.dart @@ -30,7 +30,13 @@ class _SheetPageState extends State { label: 'Side', value: side, values: ShadSheetSide.values, - onChanged: (value) => setState(() => side = value), + onChanged: (value) { + if (value != null) { + setState(() { + side = value; + }); + } + }, ), MyBoolProperty( label: 'Draggable', diff --git a/example/lib/pages/switch_form_field.dart b/example/lib/pages/switch_form_field.dart index 71332f35..8685d4cd 100644 --- a/example/lib/pages/switch_form_field.dart +++ b/example/lib/pages/switch_form_field.dart @@ -42,7 +42,11 @@ class _SwitchFormFieldPageState extends State { label: 'autovalidateMode', value: autovalidateMode, values: ShadAutovalidateMode.values, - onChanged: (value) => setState(() => autovalidateMode = value), + onChanged: (value) { + if (value != null) { + setState(() => autovalidateMode = value); + } + }, ), MyBoolProperty( label: 'Form Initial Value', diff --git a/example/lib/pages/toast.dart b/example/lib/pages/toast.dart index 05714cee..a1f3b217 100644 --- a/example/lib/pages/toast.dart +++ b/example/lib/pages/toast.dart @@ -49,9 +49,11 @@ class _ToastPageState extends State { value: alignment, values: Alignm.values, onChanged: (v) { - setState(() { - alignment = v; - }); + if (v != null) { + setState(() { + alignment = v; + }); + } }) ], children: [ diff --git a/lib/src/components/calendar.dart b/lib/src/components/calendar.dart index b84b1920..5e3294e4 100644 --- a/lib/src/components/calendar.dart +++ b/lib/src/components/calendar.dart @@ -1283,7 +1283,9 @@ class _ShadCalendarState extends State { ), ), onChanged: (year) { - goToMonth(DateTime(year, currentMonth.month)); + if (year != null) { + goToMonth(DateTime(year, currentMonth.month)); + } }, ); @@ -1305,7 +1307,9 @@ class _ShadCalendarState extends State { }, ), onChanged: (month) { - goToMonth(DateTime(currentMonth.year, month)); + if (month != null) { + goToMonth(DateTime(currentMonth.year, month)); + } }, ); diff --git a/lib/src/components/form/fields/select.dart b/lib/src/components/form/fields/select.dart index 5d0947e1..a55449a0 100644 --- a/lib/src/components/form/fields/select.dart +++ b/lib/src/components/form/fields/select.dart @@ -17,9 +17,6 @@ class ShadSelectFormField extends ShadFormBuilderField { super.error, super.description, super.onChanged, - - /// {@macro ShadSelect.onChangedNullable} - ValueChanged? onChangedNullable, super.valueTransformer, super.onReset, super.enabled, @@ -54,6 +51,7 @@ class ShadSelectFormField extends ShadFormBuilderField { /// {@macro select.footer} Widget? footer, + bool allowDeselection = false, bool closeOnSelect = true, }) : super( decorationBuilder: (context) => @@ -65,19 +63,14 @@ class ShadSelectFormField extends ShadFormBuilderField { return ShadSelect( options: options, + allowDeselection: allowDeselection, optionsBuilder: optionsBuilder, selectedOptionBuilder: selectedOptionBuilder, focusNode: state.focusNode, placeholder: placeholder, initialValue: initialValue, enabled: state.enabled, - onChanged: onChangedNullable != null ? state.didChange : null, - onChangedNullable: onChangedNullable != null - ? (v) { - state.didChange(v); - onChangedNullable(v); - } - : null, + onChanged: onChanged != null ? state.didChange : null, closeOnTapOutside: closeOnTapOutside, anchor: anchor, minWidth: minWidth, @@ -107,9 +100,6 @@ class ShadSelectFormField extends ShadFormBuilderField { super.error, super.description, super.onChanged, - - /// {@macro ShadSelect.onChangedNullable} - ValueChanged? onChangedNullable, super.valueTransformer, super.onReset, super.enabled, @@ -151,6 +141,7 @@ class ShadSelectFormField extends ShadFormBuilderField { /// {@macro select.footer} Widget? footer, + bool allowDeselection = false, bool closeOnSelect = true, }) : super( decorationBuilder: (context) => @@ -162,19 +153,14 @@ class ShadSelectFormField extends ShadFormBuilderField { return ShadSelect.withSearch( options: options, + allowDeselection: allowDeselection, optionsBuilder: optionsBuilder, selectedOptionBuilder: selectedOptionBuilder, focusNode: state.focusNode, placeholder: placeholder, initialValue: initialValue, enabled: state.enabled, - onChanged: onChangedNullable != null ? state.didChange : null, - onChangedNullable: onChangedNullable != null - ? (v) { - state.didChange(v); - onChangedNullable(v); - } - : null, + onChanged: onChanged != null ? state.didChange : null, closeOnTapOutside: closeOnTapOutside, anchor: anchor, minWidth: minWidth, @@ -211,9 +197,6 @@ class ShadSelectFormField extends ShadFormBuilderField { super.error, super.description, super.onChanged, - - /// {@macro ShadSelect.onChangedNullable} - ValueChanged? onChangedNullable, super.valueTransformer, super.onReset, super.enabled, @@ -252,7 +235,7 @@ class ShadSelectFormField extends ShadFormBuilderField { /// {@macro select.footer} Widget? footer, - bool? allowDeselection, + bool allowDeselection = false, bool closeOnSelect = true, }) : assert( variant == ShadSelectVariant.primary || onSearchChanged != null, @@ -279,13 +262,7 @@ class ShadSelectFormField extends ShadFormBuilderField { placeholder: placeholder, initialValue: initialValue, enabled: state.enabled, - onChanged: onChangedNullable != null ? state.didChange : null, - onChangedNullable: onChangedNullable != null - ? (v) { - state.didChange(v); - onChangedNullable(v); - } - : null, + onChanged: onChanged != null ? state.didChange : null, closeOnTapOutside: closeOnTapOutside, anchor: anchor, minWidth: minWidth, @@ -368,7 +345,7 @@ class ShadSelectMultipleFormField extends ShadFormBuilderField> { bool closeOnSelect = true, /// {@macro ShadSelect.allowDeselection} - bool allowDeselection = false, + bool allowDeselection = true, }) : super( decorationBuilder: (context) => (ShadTheme.of(context).selectTheme.decoration ?? @@ -460,7 +437,7 @@ class ShadSelectMultipleFormField extends ShadFormBuilderField> { bool closeOnSelect = true, /// {@macro ShadSelect.allowDeselection} - bool allowDeselection = false, + bool allowDeselection = true, }) : super( decorationBuilder: (context) => (ShadTheme.of(context).selectTheme.decoration ?? @@ -553,7 +530,7 @@ class ShadSelectMultipleFormField extends ShadFormBuilderField> { /// {@macro select.footer} Widget? footer, - bool? allowDeselection, + bool allowDeselection = true, bool closeOnSelect = true, }) : assert( variant == ShadSelectVariant.multiple || diff --git a/lib/src/components/select.dart b/lib/src/components/select.dart index 4331a071..860639b6 100644 --- a/lib/src/components/select.dart +++ b/lib/src/components/select.dart @@ -38,7 +38,6 @@ class ShadSelect extends StatefulWidget { this.initialValue, this.initialValues = const [], this.onChanged, - this.onChangedNullable, this.focusNode, this.closeOnTapOutside = true, this.minWidth, @@ -58,6 +57,7 @@ class ShadSelect extends StatefulWidget { this.header, this.footer, this.closeOnSelect = true, + this.allowDeselection = false, }) : variant = ShadSelectVariant.primary, onSearchChanged = null, searchDivider = null, @@ -67,7 +67,6 @@ class ShadSelect extends StatefulWidget { searchPadding = null, search = null, clearSearchOnClose = false, - allowDeselection = onChangedNullable != null, assert( options != null || optionsBuilder != null, 'Either options or optionsBuilder must be provided', @@ -84,7 +83,6 @@ class ShadSelect extends StatefulWidget { this.selectedOptionBuilder, required ValueChanged this.onSearchChanged, this.onChanged, - this.onChangedNullable, this.controller, this.searchDivider, this.searchInputPrefix, @@ -115,10 +113,10 @@ class ShadSelect extends StatefulWidget { this.header, this.footer, this.closeOnSelect = true, + this.allowDeselection = false, }) : variant = ShadSelectVariant.search, selectedOptionsBuilder = null, onMultipleChanged = null, - allowDeselection = onChangedNullable != null, assert( options != null || optionsBuilder != null, 'Either options or optionsBuilder must be provided', @@ -152,7 +150,7 @@ class ShadSelect extends StatefulWidget { this.filter, this.header, this.footer, - this.allowDeselection = false, + this.allowDeselection = true, this.closeOnSelect = true, }) : variant = ShadSelectVariant.multiple, onSearchChanged = null, @@ -165,7 +163,6 @@ class ShadSelect extends StatefulWidget { search = null, clearSearchOnClose = false, onChanged = null, - onChangedNullable = null, onMultipleChanged = onChanged, assert( options != null || optionsBuilder != null, @@ -207,12 +204,11 @@ class ShadSelect extends StatefulWidget { this.filter, this.header, this.footer, - this.allowDeselection = false, + this.allowDeselection = true, this.closeOnSelect = true, }) : variant = ShadSelectVariant.multipleWithSearch, selectedOptionBuilder = null, onChanged = null, - onChangedNullable = null, onMultipleChanged = onChanged, initialValue = null, assert( @@ -240,7 +236,6 @@ class ShadSelect extends StatefulWidget { this.initialValue, this.initialValues = const [], this.onChanged, - this.onChangedNullable, this.onMultipleChanged, this.focusNode, this.closeOnTapOutside = true, @@ -260,7 +255,7 @@ class ShadSelect extends StatefulWidget { this.filter, this.header, this.footer, - bool? allowDeselection, + this.allowDeselection = false, this.closeOnSelect = true, }) : assert( variant == ShadSelectVariant.primary || onSearchChanged != null, @@ -273,20 +268,10 @@ class ShadSelect extends StatefulWidget { assert( (selectedOptionBuilder != null) ^ (selectedOptionsBuilder != null), '''Either selectedOptionBuilder or selectedOptionsBuilder must be provided''', - ), - allowDeselection = allowDeselection ?? onChangedNullable != null; - - /// The callback that is called when the value of the [ShadSelect] changes. - final ValueChanged? onChanged; + ); - /// {@template ShadSelect.onChangedNullable} /// The callback that is called when the value of the [ShadSelect] changes. - /// - /// The difference between [onChanged] and [onChangedNullable] is that - /// [onChangedNullable] will be called with `null` when the same value is - /// selected, meaning that the selected value is deselected. - /// {@endtemplate} - final ValueChanged? onChangedNullable; + final ValueChanged? onChanged; /// {@template ShadSelect.onMultipleChanged} /// The callback that is called when the values of the [ShadSelect] changes. @@ -296,7 +281,7 @@ class ShadSelect extends StatefulWidget { /// {@template ShadSelect.allowDeselection} /// Whether the [ShadSelect] allows deselection, defaults to - /// `onChangedNullable != null`. + /// `false`. /// {@endtemplate} final bool allowDeselection; @@ -595,13 +580,9 @@ class ShadSelectState extends State> { if (isMultiSelection) { widget.onMultipleChanged?.call(selectedValues.toList()); } else { - if (widget.allowDeselection) { - widget.onChangedNullable?.call( - selectedValues.isEmpty ? null : selectedValues.first, - ); - } else { - widget.onChanged?.call(value); - } + widget.onChanged?.call( + selectedValues.isEmpty ? null : selectedValues.first, + ); } } } From 7d37a88e347508be5cb6f7e3f400390e79e9803c Mon Sep 17 00:00:00 2001 From: Alexandru Mariuti Date: Sun, 27 Oct 2024 09:34:20 +0000 Subject: [PATCH 4/8] chore: update docs update on changed --- CHANGELOG.md | 5 +++++ docs/src/content/docs/Components/select.mdx | 4 +--- lib/src/components/form/fields/select.dart | 2 +- lib/src/components/select.dart | 4 +--- pubspec.yaml | 2 +- 5 files changed, 9 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c401d659..4cd8dc45 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## 0.14.0 + +- **BREAKING CHANGE**: Remove `onChangedNullable` from `ShadSelect` and `ShadSelectFormField`. Now the `onChanged` callback will be called with `null` when the user deselects an option if `allowDeselection` is set to `true`. (thanks to @moshOntong-IT) +- **FEAT**: Add click mouse cursor to `ShadTable` when `onRowTap` or `onColumnTap` is provided. + ## 0.13.5 - **FIX**: Fix `ShadSelect` initial values on widget creation. diff --git a/docs/src/content/docs/Components/select.mdx b/docs/src/content/docs/Components/select.mdx index 57237fbc..877f5402 100644 --- a/docs/src/content/docs/Components/select.mdx +++ b/docs/src/content/docs/Components/select.mdx @@ -240,7 +240,7 @@ class _SelectWithSearchState extends State { :::tip -If you want to be able to deselect an option, you can use the `onChangedNullable` callback instead of `onChanged`. +If you want to be able to deselect an option, you can use the `allowDeselection` property. ::: ## Multiple @@ -250,8 +250,6 @@ This example shows how to select multiple options. In addition, the `allowDeselection` property is set to `true` to allow the user to deselect an option and the `closeOnSelect` property is set to `false` to keep the popover open after selecting an option. If you tap outside the popover, it will close. -> The `allowDeselection` property is present only in the `ShadSelect.multiple` constructor, to use it in a normal select use `onChangedNullable` instead of `onChanged`. - ```dart diff --git a/lib/src/components/form/fields/select.dart b/lib/src/components/form/fields/select.dart index a55449a0..882ddf44 100644 --- a/lib/src/components/form/fields/select.dart +++ b/lib/src/components/form/fields/select.dart @@ -70,7 +70,7 @@ class ShadSelectFormField extends ShadFormBuilderField { placeholder: placeholder, initialValue: initialValue, enabled: state.enabled, - onChanged: onChanged != null ? state.didChange : null, + onChanged: state.didChange, closeOnTapOutside: closeOnTapOutside, anchor: anchor, minWidth: minWidth, diff --git a/lib/src/components/select.dart b/lib/src/components/select.dart index 860639b6..c23c768c 100644 --- a/lib/src/components/select.dart +++ b/lib/src/components/select.dart @@ -580,9 +580,7 @@ class ShadSelectState extends State> { if (isMultiSelection) { widget.onMultipleChanged?.call(selectedValues.toList()); } else { - widget.onChanged?.call( - selectedValues.isEmpty ? null : selectedValues.first, - ); + widget.onChanged?.call(selectedValues.firstOrNull); } } } diff --git a/pubspec.yaml b/pubspec.yaml index b26b0f47..24eb30f9 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: shadcn_ui description: shadcn-ui ported in Flutter. Awesome UI components for Flutter, fully customizable. -version: 0.13.5 +version: 0.14.0 homepage: https://flutter-shadcn-ui.mariuti.com repository: https://github.com/nank1ro/flutter-shadcn-ui documentation: https://flutter-shadcn-ui.mariuti.com From 5c5e84a86349c65272023bcf133c91370b016b9d Mon Sep 17 00:00:00 2001 From: Alexandru Mariuti Date: Sun, 27 Oct 2024 09:44:15 +0000 Subject: [PATCH 5/8] docs: move playground website to cloudflare --- .../src/content/docs/Components/accordion.mdx | 4 +-- docs/src/content/docs/Components/alert.mdx | 4 +-- docs/src/content/docs/Components/avatar.mdx | 2 +- docs/src/content/docs/Components/badge.mdx | 8 +++--- docs/src/content/docs/Components/button.mdx | 20 +++++++------- docs/src/content/docs/Components/calendar.mdx | 22 ++++++++-------- docs/src/content/docs/Components/card.mdx | 4 +-- docs/src/content/docs/Components/checkbox.mdx | 4 +-- .../content/docs/Components/context-menu.mdx | 2 +- docs/src/content/docs/Components/dialog.mdx | 4 +-- docs/src/content/docs/Components/form.mdx | 2 +- docs/src/content/docs/Components/image.mdx | 6 ++--- docs/src/content/docs/Components/input.mdx | 6 ++--- docs/src/content/docs/Components/popover.mdx | 2 +- docs/src/content/docs/Components/progress.mdx | 4 +-- .../content/docs/Components/radio-group.mdx | 4 +-- .../src/content/docs/Components/resizable.mdx | 6 ++--- docs/src/content/docs/Components/select.mdx | 10 +++---- docs/src/content/docs/Components/sheet.mdx | 4 +-- docs/src/content/docs/Components/slider.mdx | 2 +- docs/src/content/docs/Components/switch.mdx | 4 +-- docs/src/content/docs/Components/table.mdx | 2 +- docs/src/content/docs/Components/tabs.mdx | 2 +- docs/src/content/docs/Components/toast.mdx | 10 +++---- docs/src/content/docs/Components/tooltip.mdx | 2 +- docs/src/content/docs/typography.mdx | 26 +++++++++---------- 26 files changed, 83 insertions(+), 83 deletions(-) diff --git a/docs/src/content/docs/Components/accordion.mdx b/docs/src/content/docs/Components/accordion.mdx index d15d991c..b4726bb1 100644 --- a/docs/src/content/docs/Components/accordion.mdx +++ b/docs/src/content/docs/Components/accordion.mdx @@ -7,7 +7,7 @@ import Preview from '../../../components/Preview.astro'; A vertically stacked set of interactive headings that each reveal a section of content. - + ```dart final details = [ @@ -45,7 +45,7 @@ Widget build(BuildContext context) { ## Multiple - + ```dart final details = [ diff --git a/docs/src/content/docs/Components/alert.mdx b/docs/src/content/docs/Components/alert.mdx index 57de00aa..00223203 100644 --- a/docs/src/content/docs/Components/alert.mdx +++ b/docs/src/content/docs/Components/alert.mdx @@ -7,7 +7,7 @@ import Preview from '../../../components/Preview.astro'; Displays a callout for user attention. - + ```dart ShadAlert( iconSrc: LucideIcons.terminal, @@ -20,7 +20,7 @@ ShadAlert( ## Destructive - + ```dart ShadAlert.destructive( iconSrc: LucideIcons.circleAlert, diff --git a/docs/src/content/docs/Components/avatar.mdx b/docs/src/content/docs/Components/avatar.mdx index 89f1c565..4b289a50 100644 --- a/docs/src/content/docs/Components/avatar.mdx +++ b/docs/src/content/docs/Components/avatar.mdx @@ -7,7 +7,7 @@ import Preview from '../../../components/Preview.astro'; An image element with a placeholder for representing the user. - + ```dart ShadAvatar( 'https://app.requestly.io/delay/2000/avatars.githubusercontent.com/u/124599?v=4', diff --git a/docs/src/content/docs/Components/badge.mdx b/docs/src/content/docs/Components/badge.mdx index c57ed5f6..ae8b6515 100644 --- a/docs/src/content/docs/Components/badge.mdx +++ b/docs/src/content/docs/Components/badge.mdx @@ -9,7 +9,7 @@ Displays a badge or a component that looks like a badge. ## Primary - + ```dart ShadBadge( child: const Text('Primary'), @@ -19,7 +19,7 @@ ShadBadge( ## Secondary - + ```dart ShadBadge.secondary( child: const Text('Secondary'), @@ -29,7 +29,7 @@ ShadBadge.secondary( ## Destructive - + ```dart ShadBadge.destructive( child: const Text('Destructive'), @@ -39,7 +39,7 @@ ShadBadge.destructive( ## Outline - + ```dart ShadBadge.outline( child: const Text('Outline'), diff --git a/docs/src/content/docs/Components/button.mdx b/docs/src/content/docs/Components/button.mdx index a63c5ea2..43e4cff0 100644 --- a/docs/src/content/docs/Components/button.mdx +++ b/docs/src/content/docs/Components/button.mdx @@ -9,7 +9,7 @@ Displays a button or a component that looks like a button. ## Primary - + ```dart ShadButton( text: const Text('Primary'), @@ -20,7 +20,7 @@ ShadButton( ## Secondary - + ```dart ShadButton.secondary( text: const Text('Secondary'), @@ -31,7 +31,7 @@ ShadButton.secondary( ## Destructive - + ```dart ShadButton.destructive( text: const Text('Destructive'), @@ -42,7 +42,7 @@ ShadButton.destructive( ## Outline - + ```dart ShadButton.outline( text: const Text('Outline'), @@ -53,7 +53,7 @@ ShadButton.outline( ## Ghost - + ```dart ShadButton.ghost( text: const Text('Ghost'), @@ -64,7 +64,7 @@ ShadButton.ghost( ## Link - + ```dart ShadButton.link( text: const Text('Link'), @@ -75,7 +75,7 @@ ShadButton.link( ## Icon - + ```dart ShadButton.outline( icon: const Icon( @@ -89,7 +89,7 @@ ShadButton.outline( ## Text and Icon - + ```dart ShadButton( onPressed: () {}, @@ -104,7 +104,7 @@ ShadButton( ## Loading - + ```dart ShadButton( onPressed: () {}, @@ -119,7 +119,7 @@ ShadButton( ## Gradient and Shadow - + ```dart ShadButton( onPressed: () {}, diff --git a/docs/src/content/docs/Components/calendar.mdx b/docs/src/content/docs/Components/calendar.mdx index 41b59ad7..ca8bb27c 100644 --- a/docs/src/content/docs/Components/calendar.mdx +++ b/docs/src/content/docs/Components/calendar.mdx @@ -8,7 +8,7 @@ import Preview from "../../../components/Preview.astro"; A date field component that allows users to enter and edit date. - + ```dart class SingleCalendar extends StatefulWidget { @@ -36,7 +36,7 @@ class _SingleCalendarState extends State { ## Multiple - + ```dart class MultipleCalendar extends StatefulWidget { @@ -66,7 +66,7 @@ class _MultipleCalendarState extends State { ## Range - + ```dart class RangeCalendar extends StatelessWidget { @@ -91,55 +91,55 @@ class RangeCalendar extends StatelessWidget { #### Dropdown #### DropdownMonths #### DropdownYears ### Hide Navigation ### Show Week Numbers ### Show Outside Days (false) ### Fixed Weeks ### Hide Weekday Names diff --git a/docs/src/content/docs/Components/card.mdx b/docs/src/content/docs/Components/card.mdx index 90c67493..600f50c5 100644 --- a/docs/src/content/docs/Components/card.mdx +++ b/docs/src/content/docs/Components/card.mdx @@ -7,7 +7,7 @@ import Preview from '../../../components/Preview.astro'; Displays a card with header, content, and footer. - + ```dart const frameworks = { 'next': 'Next.js', @@ -71,7 +71,7 @@ class CardProject extends StatelessWidget { ## Notifications Example - + ```dart const notifications = [ ( diff --git a/docs/src/content/docs/Components/checkbox.mdx b/docs/src/content/docs/Components/checkbox.mdx index 9d09ddcf..f2053768 100644 --- a/docs/src/content/docs/Components/checkbox.mdx +++ b/docs/src/content/docs/Components/checkbox.mdx @@ -7,7 +7,7 @@ import Preview from '../../../components/Preview.astro'; A control that allows the user to toggle between checked and not checked. - + ```dart bool value = false; @@ -27,7 +27,7 @@ Widget build(BuildContext context) { ## Form - + ```dart ShadCheckboxFormField( id: 'terms', diff --git a/docs/src/content/docs/Components/context-menu.mdx b/docs/src/content/docs/Components/context-menu.mdx index 7da61dad..cd50986e 100644 --- a/docs/src/content/docs/Components/context-menu.mdx +++ b/docs/src/content/docs/Components/context-menu.mdx @@ -8,7 +8,7 @@ import Preview from "../../../components/Preview.astro"; Displays a menu to the user — such as a set of actions or functions — triggered by a mouse right-click. - + ```dart import 'package:flutter/material.dart'; diff --git a/docs/src/content/docs/Components/dialog.mdx b/docs/src/content/docs/Components/dialog.mdx index 4a89e1ff..5c4d6de4 100644 --- a/docs/src/content/docs/Components/dialog.mdx +++ b/docs/src/content/docs/Components/dialog.mdx @@ -7,7 +7,7 @@ import Preview from '../../../components/Preview.astro'; A modal dialog that interrupts the user. - + ```dart final profile = [ (title: 'Name', value: 'Alexandru'), @@ -61,7 +61,7 @@ ShadButton.outline( ## Alert - + ```dart ShadButton.outline( child: const Text('Show Dialog'), diff --git a/docs/src/content/docs/Components/form.mdx b/docs/src/content/docs/Components/form.mdx index 2e33bfda..2aecce34 100644 --- a/docs/src/content/docs/Components/form.mdx +++ b/docs/src/content/docs/Components/form.mdx @@ -7,7 +7,7 @@ import Preview from '../../../components/Preview.astro'; Builds a form with validation and easy access to form fields values. - + ```dart class FormPage extends StatefulWidget { const FormPage({ diff --git a/docs/src/content/docs/Components/image.mdx b/docs/src/content/docs/Components/image.mdx index bcd7a9c0..1f1fe9e2 100644 --- a/docs/src/content/docs/Components/image.mdx +++ b/docs/src/content/docs/Components/image.mdx @@ -9,7 +9,7 @@ Displays an image, many formats supported (_.png_, _.jpg_, _.jpeg_, _.svg_, _.sv ## Local - + ```dart const ShadImage( 'assets/banner.png', @@ -21,7 +21,7 @@ const ShadImage( ## Remote - + ```dart const ShadImage.square( 'https://avatars.githubusercontent.com/u/124599?v=4', @@ -32,7 +32,7 @@ const ShadImage.square( ## Svg - + ```dart const ShadImage.square( 'assets/flutter.svg', diff --git a/docs/src/content/docs/Components/input.mdx b/docs/src/content/docs/Components/input.mdx index 4c71e796..0f601061 100644 --- a/docs/src/content/docs/Components/input.mdx +++ b/docs/src/content/docs/Components/input.mdx @@ -8,7 +8,7 @@ import Preview from '../../../components/Preview.astro'; Displays a form input field or a component that looks like an input field. - + ```dart ConstrainedBox( constraints: const BoxConstraints(maxWidth: 320), @@ -22,7 +22,7 @@ ConstrainedBox( ## With prefix and suffix - + ```dart class PasswordInput extends StatefulWidget { const PasswordInput({super.key}); @@ -67,7 +67,7 @@ class _PasswordInputState extends State { ## Form - + ```dart ShadInputFormField( id: 'username', diff --git a/docs/src/content/docs/Components/popover.mdx b/docs/src/content/docs/Components/popover.mdx index 1b3ecad6..93a04fb2 100644 --- a/docs/src/content/docs/Components/popover.mdx +++ b/docs/src/content/docs/Components/popover.mdx @@ -8,7 +8,7 @@ import Preview from '../../../components/Preview.astro'; Displays rich content in a portal, triggered by a button. - + ```dart import 'package:flutter/material.dart'; import 'package:shadcn_ui/shadcn_ui.dart'; diff --git a/docs/src/content/docs/Components/progress.mdx b/docs/src/content/docs/Components/progress.mdx index ec8aebba..75b43c0f 100644 --- a/docs/src/content/docs/Components/progress.mdx +++ b/docs/src/content/docs/Components/progress.mdx @@ -9,7 +9,7 @@ Displays an indicator showing the completion progress of a task, typically displ ## Determinate - + ```dart ConstrainedBox( constraints: BoxConstraints( @@ -22,7 +22,7 @@ ConstrainedBox( ## Indeterminate - + ```dart ConstrainedBox( constraints: BoxConstraints( diff --git a/docs/src/content/docs/Components/radio-group.mdx b/docs/src/content/docs/Components/radio-group.mdx index 37bf93ef..c3be60ed 100644 --- a/docs/src/content/docs/Components/radio-group.mdx +++ b/docs/src/content/docs/Components/radio-group.mdx @@ -7,7 +7,7 @@ import Preview from '../../../components/Preview.astro'; A set of checkable buttons—known as radio buttons—where no more than one of the buttons can be checked at a time. - + ```dart ShadRadioGroup( items: [ @@ -30,7 +30,7 @@ ShadRadioGroup( ## Form - + ```dart enum NotifyAbout { all, diff --git a/docs/src/content/docs/Components/resizable.mdx b/docs/src/content/docs/Components/resizable.mdx index a66e69bd..f30881c1 100644 --- a/docs/src/content/docs/Components/resizable.mdx +++ b/docs/src/content/docs/Components/resizable.mdx @@ -7,7 +7,7 @@ import Preview from '../../../components/Preview.astro'; Resizable panel groups and layouts. - + ```dart class BasicResizable extends StatelessWidget { const BasicResizable({super.key}); @@ -72,7 +72,7 @@ Try resizing a panel, then double-click on the handle to reset to the default si Use the `axis` property to change the direction of the resizable panels. - + ```dart class VerticalResizable extends StatelessWidget { const VerticalResizable({super.key}); @@ -124,7 +124,7 @@ You can show the handle by using the `showHandle` property. You can customize it using the `handleIcon` or `handleIconSrc` properties. - + ```dart class HandleResizable extends StatelessWidget { const HandleResizable({super.key}); diff --git a/docs/src/content/docs/Components/select.mdx b/docs/src/content/docs/Components/select.mdx index 877f5402..d5a0de2c 100644 --- a/docs/src/content/docs/Components/select.mdx +++ b/docs/src/content/docs/Components/select.mdx @@ -8,7 +8,7 @@ import Preview from "../../../components/Preview.astro"; Displays a list of options for the user to pick from—triggered by a button. - + ```dart final fruits = { @@ -52,7 +52,7 @@ return ConstrainedBox( ## Scrollable - + ```dart final timezones = { @@ -140,7 +140,7 @@ Widget build(BuildContext context) { ## Form - + ```dart final verifiedEmails = [ @@ -174,7 +174,7 @@ ShadSelectFormField( ## With Search - + ```dart const frameworks = { @@ -250,7 +250,7 @@ This example shows how to select multiple options. In addition, the `allowDeselection` property is set to `true` to allow the user to deselect an option and the `closeOnSelect` property is set to `false` to keep the popover open after selecting an option. If you tap outside the popover, it will close. - + ```dart class SelectMultiple extends StatelessWidget { diff --git a/docs/src/content/docs/Components/sheet.mdx b/docs/src/content/docs/Components/sheet.mdx index db086535..594c9681 100644 --- a/docs/src/content/docs/Components/sheet.mdx +++ b/docs/src/content/docs/Components/sheet.mdx @@ -7,7 +7,7 @@ import Preview from '../../../components/Preview.astro'; Extends the Dialog component to display content that complements the main content of the screen. - + ```dart ShadButton.outline( child: const Text('Open'), @@ -78,7 +78,7 @@ class EditProfileSheet extends StatelessWidget { Use the `side` property to `showShadSheet` to indicate the edge of the screen where the component will appear. The values can be `top`, `right`, `bottom` or `left`. - + ```dart Row( mainAxisSize: MainAxisSize.min, diff --git a/docs/src/content/docs/Components/slider.mdx b/docs/src/content/docs/Components/slider.mdx index ef3732f6..e3916361 100644 --- a/docs/src/content/docs/Components/slider.mdx +++ b/docs/src/content/docs/Components/slider.mdx @@ -7,7 +7,7 @@ import Preview from '../../../components/Preview.astro'; An input where the user selects a value from within a given range. - + ```dart ShadSlider( initialValue: 33, diff --git a/docs/src/content/docs/Components/switch.mdx b/docs/src/content/docs/Components/switch.mdx index 3a3e4827..273c69c6 100644 --- a/docs/src/content/docs/Components/switch.mdx +++ b/docs/src/content/docs/Components/switch.mdx @@ -7,7 +7,7 @@ import Preview from '../../../components/Preview.astro'; A control that allows the user to toggle between checked and not checked. - + ```dart bool value = false; @@ -24,7 +24,7 @@ Widget build(BuildContext context) { ## Form - + ```dart ShadSwitchFormField( id: 'terms', diff --git a/docs/src/content/docs/Components/table.mdx b/docs/src/content/docs/Components/table.mdx index 1c8d8f58..c80bde76 100644 --- a/docs/src/content/docs/Components/table.mdx +++ b/docs/src/content/docs/Components/table.mdx @@ -12,7 +12,7 @@ A responsive table component. Use the `ShadTable.list` widget to create a table from a two dimensional array of children. Use it just for **small** tables, because every child will be created. - + ```dart import 'package:flutter/material.dart'; import 'package:shadcn_ui/shadcn_ui.dart'; diff --git a/docs/src/content/docs/Components/tabs.mdx b/docs/src/content/docs/Components/tabs.mdx index b76bbb16..a7f1f5d4 100644 --- a/docs/src/content/docs/Components/tabs.mdx +++ b/docs/src/content/docs/Components/tabs.mdx @@ -7,7 +7,7 @@ import Preview from '../../../components/Preview.astro'; A set of layered sections of content—known as tab panels—that are displayed one at a time. - + ```dart ShadTabs( value: 'account', diff --git a/docs/src/content/docs/Components/toast.mdx b/docs/src/content/docs/Components/toast.mdx index a783c73b..bdfb9c91 100644 --- a/docs/src/content/docs/Components/toast.mdx +++ b/docs/src/content/docs/Components/toast.mdx @@ -8,7 +8,7 @@ import Preview from "../../../components/Preview.astro"; A succinct message that is displayed temporarily. - + ```dart ShadButton.outline( child: const Text('Add to calendar'), @@ -31,7 +31,7 @@ ShadButton.outline( ## Simple - + ```dart ShadButton.outline( child: const Text('Show Toast'), @@ -48,7 +48,7 @@ ShadButton.outline( ## With Title - + ```dart ShadButton.outline( child: const Text('Show Toast'), @@ -67,7 +67,7 @@ ShadButton.outline( ## With Action - + ```dart ShadButton.outline( child: const Text('Show Toast'), @@ -90,7 +90,7 @@ ShadButton.outline( ## Destructive - + ```dart ShadButton.outline( child: const Text('Show Toast'), diff --git a/docs/src/content/docs/Components/tooltip.mdx b/docs/src/content/docs/Components/tooltip.mdx index efd71efc..aeea4d0b 100644 --- a/docs/src/content/docs/Components/tooltip.mdx +++ b/docs/src/content/docs/Components/tooltip.mdx @@ -7,7 +7,7 @@ import Preview from '../../../components/Preview.astro'; A popup that displays information related to an element when the element receives keyboard focus or the mouse hovers over it. - + ```dart ShadTooltip( builder: (context) => const Text('Add to library'), diff --git a/docs/src/content/docs/typography.mdx b/docs/src/content/docs/typography.mdx index d68f554e..c46cf900 100644 --- a/docs/src/content/docs/typography.mdx +++ b/docs/src/content/docs/typography.mdx @@ -10,7 +10,7 @@ Styles for headings, paragraphs, lists...etc ## h1Large - + ```dart Text( 'Taxing Laughter: The Joke Tax Chronicles', @@ -21,7 +21,7 @@ Text( ## h1 - + ```dart Text( 'Taxing Laughter: The Joke Tax Chronicles', @@ -32,7 +32,7 @@ Text( ## h2 - + ```dart Text( 'The People of the Kingdom', @@ -43,7 +43,7 @@ Text( ## h3 - + ```dart Text( 'The Joke Tax', @@ -54,7 +54,7 @@ Text( ## h4 - + ```dart Text( 'The king, seeing how much happier his subjects were, realized the error of his ways and repealed the joke tax.', @@ -65,7 +65,7 @@ Text( ## p - + ```dart Text( 'The king, seeing how much happier his subjects were, realized the error of his ways and repealed the joke tax.', @@ -76,7 +76,7 @@ Text( ## Blockquote - + ```dart Text( '"After all," he said, "everyone enjoys a good joke, so it\'s only fair that they should pay for the privilege."', @@ -87,7 +87,7 @@ Text( ## Table - + ```dart Text( "King's Treasury", @@ -98,7 +98,7 @@ Text( ## List - + ```dart Text( '1st level of puns: 5 gold coins', @@ -109,7 +109,7 @@ Text( ## Lead - + ```dart Text( 'A modal dialog that interrupts the user with important content and expects a response.', @@ -120,7 +120,7 @@ Text( ## Large - + ```dart Text( 'Are you absolutely sure?', @@ -131,7 +131,7 @@ Text( ## Small - + ```dart Text( 'Email address', @@ -142,7 +142,7 @@ Text( ## Muted - + ```dart Text( 'Enter your email address.', From 08aaa3c5884dfb0725a1d1d552bb1bb8ea18d2ea Mon Sep 17 00:00:00 2001 From: Alexandru Mariuti Date: Mon, 28 Oct 2024 09:45:14 +0000 Subject: [PATCH 6/8] fix: scroll behavior of app (#180) --- CHANGELOG.md | 4 ++++ lib/src/app.dart | 4 ++++ pubspec.yaml | 2 +- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4cd8dc45..52be73a2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.14.1 + +- **FIX**: `ShadApp` scroll behavior. + ## 0.14.0 - **BREAKING CHANGE**: Remove `onChangedNullable` from `ShadSelect` and `ShadSelectFormField`. Now the `onChanged` callback will be called with `null` when the user deselects an option if `allowDeselection` is set to `true`. (thanks to @moshOntong-IT) diff --git a/lib/src/app.dart b/lib/src/app.dart index 05abd23d..2c857d4a 100644 --- a/lib/src/app.dart +++ b/lib/src/app.dart @@ -832,6 +832,7 @@ class _ShadAppState extends State { actions: widget.actions, restorationScopeId: widget.restorationScopeId, localizationsDelegates: localizationsDelegates, + scrollBehavior: widget.scrollBehavior, ); } return MaterialApp( @@ -859,6 +860,7 @@ class _ShadAppState extends State { actions: widget.actions, restorationScopeId: widget.restorationScopeId, localizationsDelegates: localizationsDelegates, + scrollBehavior: widget.scrollBehavior, ); case ShadAppType.cupertino: @@ -887,6 +889,7 @@ class _ShadAppState extends State { actions: widget.actions, restorationScopeId: widget.restorationScopeId, localizationsDelegates: localizationsDelegates, + scrollBehavior: widget.scrollBehavior, ), ); } @@ -917,6 +920,7 @@ class _ShadAppState extends State { actions: widget.actions, restorationScopeId: widget.restorationScopeId, localizationsDelegates: localizationsDelegates, + scrollBehavior: widget.scrollBehavior, ), ); case ShadAppType.custom: diff --git a/pubspec.yaml b/pubspec.yaml index 24eb30f9..89dbfae5 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: shadcn_ui description: shadcn-ui ported in Flutter. Awesome UI components for Flutter, fully customizable. -version: 0.14.0 +version: 0.14.1 homepage: https://flutter-shadcn-ui.mariuti.com repository: https://github.com/nank1ro/flutter-shadcn-ui documentation: https://flutter-shadcn-ui.mariuti.com From f2cd3d2294551757b8df4db94154ea42c59a52e8 Mon Sep 17 00:00:00 2001 From: Alexandru Mariuti Date: Wed, 30 Oct 2024 10:26:54 +0000 Subject: [PATCH 7/8] docs: add packages section (#182) --- docs/astro.config.mjs | 1 + docs/src/content/docs/packages.md | 34 +++++++++++++++++++++++++++++++ lib/shadcn_ui.dart | 1 + 3 files changed, 36 insertions(+) create mode 100644 docs/src/content/docs/packages.md diff --git a/docs/astro.config.mjs b/docs/astro.config.mjs index 1fb3811b..48c0dfa4 100644 --- a/docs/astro.config.mjs +++ b/docs/astro.config.mjs @@ -40,6 +40,7 @@ export default defineConfig({ collapsed: false, }, { label: 'Typography', link: 'typography' }, + { label: 'Packages', link: 'packages' }, { label: 'Components', autogenerate: { directory: 'Components' }, diff --git a/docs/src/content/docs/packages.md b/docs/src/content/docs/packages.md new file mode 100644 index 00000000..e152ba6f --- /dev/null +++ b/docs/src/content/docs/packages.md @@ -0,0 +1,34 @@ +--- +title: Packages +sidebar: + order: 3 +--- + +## Packages included in the library + +Flutter Shadcn UI consists of fantastic open-source libraries that are exported and you can use them without importing them into your project. + +### [flutter_animate](https://pub.dev/packages/flutter_animate) + +The flutter animate library is a very cool animations library extensively used in Shadcn UI Components. + +With flutter_animate animations can be easily customized from the user, because components will take a `List`. + +### [lucide_icons_flutter](https://pub.dev/packages/lucide_icons_flutter) + +A nice icon library that is used in Shadcn UI Components. +You can use Lucide icons with the `LucideIcons` class, for example `LucideIcons.activity`. + +You can browse all the icons [here](https://lucide.dev/icons/). + +### [two_dimensional_scrollables](https://pub.dev/packages/two_dimensional_scrollables) + +A nice raw table (very performant) implementation used by the [ShadTable](./components/table) component. + +### [intl](https://pub.dev/packages/intl) + +The intl package provides internationalization and localization facilities, including message translation. + +### [flutter_svg_plus](https://pub.dev/packages/flutter_svg_plus) + +Draw SVG images. Used by the [ShadImage](./components/image) component. diff --git a/lib/shadcn_ui.dart b/lib/shadcn_ui.dart index fe53ca49..134fa8a1 100644 --- a/lib/shadcn_ui.dart +++ b/lib/shadcn_ui.dart @@ -107,3 +107,4 @@ export 'package:flutter_animate/flutter_animate.dart' hide Effect; export 'package:lucide_icons_flutter/lucide_icons.dart'; export 'package:two_dimensional_scrollables/two_dimensional_scrollables.dart'; export 'package:intl/intl.dart'; +export 'package:flutter_svg_plus/flutter_svg.dart'; From 57b73050a781757f890137d74d906fc5267820bb Mon Sep 17 00:00:00 2001 From: Alexandru Mariuti Date: Wed, 30 Oct 2024 10:30:35 +0000 Subject: [PATCH 8/8] docs: update links in packages --- docs/src/content/docs/packages.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/src/content/docs/packages.md b/docs/src/content/docs/packages.md index e152ba6f..68dd4e87 100644 --- a/docs/src/content/docs/packages.md +++ b/docs/src/content/docs/packages.md @@ -23,7 +23,7 @@ You can browse all the icons [here](https://lucide.dev/icons/). ### [two_dimensional_scrollables](https://pub.dev/packages/two_dimensional_scrollables) -A nice raw table (very performant) implementation used by the [ShadTable](./components/table) component. +A nice raw table (very performant) implementation used by the [ShadTable](../components/table) component. ### [intl](https://pub.dev/packages/intl) @@ -31,4 +31,4 @@ The intl package provides internationalization and localization facilities, incl ### [flutter_svg_plus](https://pub.dev/packages/flutter_svg_plus) -Draw SVG images. Used by the [ShadImage](./components/image) component. +Draw SVG images. Used by the [ShadImage](../components/image) component.