From 39a5b62b3d8e0cdc2e4947e233861b484e67df9a Mon Sep 17 00:00:00 2001 From: Lara Kreisz <91203178+larakreisz@users.noreply.github.com> Date: Sun, 19 May 2024 04:18:23 +0200 Subject: [PATCH 1/5] Create README.md --- README.md | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..a6df568 --- /dev/null +++ b/README.md @@ -0,0 +1,40 @@ +# flutter_multi_select_items +https://pub.dev/packages/flutter_multi_select_items + +This is a custom fork of the original package `flutter_multi_select` to address the deprecation and removal of `bodyText1` from `TextTheme`. + +## Changes Made + +### Fixed Issue: Deprecated `bodyText1` + +The Flutter framework has deprecated `bodyText1` in favor of `bodyLarge`. As a result, any reference to `bodyText1` has been updated to ensure compatibility with the latest version of Flutter. + +**Original:** + +```dart +Text( + 'Example Text', + style: Theme.of(context).textTheme.bodyText1, +) +``` + +**Updated:** + +```dart +Text( + 'Example Text', + style: Theme.of(context).textTheme.bodyLarge, +) +``` + +## How to Use This Fork + +To use this fixed version of the package in your Flutter project, add the following to your `pubspec.yaml` file: + +```yaml +dependencies: + package_name: + git: + url: https://github.com/larakreisz/flutter_multi_select.git + ref: main +``` From cd9369b69a9ebb75206639eb8a55164a3c17b56d Mon Sep 17 00:00:00 2001 From: Lara Kreisz <91203178+larakreisz@users.noreply.github.com> Date: Sun, 19 May 2024 04:22:04 +0200 Subject: [PATCH 2/5] Update multiselect_text_styles.dart remove deprecated bodyText1 --- .../lib/src/models/multiselect_text_styles.dart | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/flutter_multi_select/lib/src/models/multiselect_text_styles.dart b/flutter_multi_select/lib/src/models/multiselect_text_styles.dart index 1edb15a..87a9a51 100644 --- a/flutter_multi_select/lib/src/models/multiselect_text_styles.dart +++ b/flutter_multi_select/lib/src/models/multiselect_text_styles.dart @@ -66,21 +66,21 @@ class CheckListViewInitialTS extends MultiSelectTextStyles { @override TextStyle getTextStyle(BuildContext context) { final theme = Theme.of(context); - final TextStyle style = theme.textTheme.bodyText1!; + final TextStyle style = theme.textTheme.bodyLarge!; return textStyle ?? style; } @override TextStyle getSelectedTextStyle(BuildContext context) { final theme = Theme.of(context); - final TextStyle style = theme.textTheme.bodyText1!; + final TextStyle style = theme.textTheme.bodyLarge!; return selectedTextStyle ?? style; } @override TextStyle getDisabledTextStyle(BuildContext context) { final theme = Theme.of(context); - final TextStyle style = theme.textTheme.bodyText1!; + final TextStyle style = theme.textTheme.bodyLarge!; final Color? color = theme.textTheme.caption!.color; return disabledTextStyle ?? style.copyWith(color: color); } From 6af6dec9c1995d129dee3c1992278d02ef58b153 Mon Sep 17 00:00:00 2001 From: Lara Kreisz <91203178+larakreisz@users.noreply.github.com> Date: Sun, 19 May 2024 04:33:02 +0200 Subject: [PATCH 3/5] Fix for duplicate values using setState with initially selected items see https://github.com/CodeFoxLk/flutter_multi_select/pull/16#issue-1874431609 --- .../lib/src/containers/multi_select_container.dart | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/flutter_multi_select/lib/src/containers/multi_select_container.dart b/flutter_multi_select/lib/src/containers/multi_select_container.dart index 606e442..403c7b8 100644 --- a/flutter_multi_select/lib/src/containers/multi_select_container.dart +++ b/flutter_multi_select/lib/src/containers/multi_select_container.dart @@ -119,7 +119,7 @@ class _SimpleMultiSelectContainerState @override void didUpdateWidget(MultiSelectContainer oldWidget) { - _addInitiallySelectedItemsToSelectedList(); + _setPerpetualSelectedItemsCount(); if (widget.controller != null) { widget.controller!.deselectAll = oldWidget.controller!.deselectAll; widget.controller!.getSelectedItems = @@ -140,6 +140,13 @@ class _SimpleMultiSelectContainerState setState(() {}); } + // find perpetual selected items count + void _setPerpetualSelectedItemsCount() { + _perpetualSelectedItemsCount = + _items.where((item) => item.perpetualSelected).length; + setState(() {}); + } + // Deselect all selected items excluding Perpetual Selected Items // for controller deselect call back void _deSelectAll() { From 7d313cc45adff84ff24e9d23e87e9562359cd15d Mon Sep 17 00:00:00 2001 From: Lara Kreisz <91203178+larakreisz@users.noreply.github.com> Date: Sun, 19 May 2024 04:52:08 +0200 Subject: [PATCH 4/5] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a6df568..597a888 100644 --- a/README.md +++ b/README.md @@ -36,5 +36,5 @@ dependencies: package_name: git: url: https://github.com/larakreisz/flutter_multi_select.git - ref: main + ref: master ``` From 62b0e76d24182c69e361f90bfb6fa0a544dbad9b Mon Sep 17 00:00:00 2001 From: Lara Kreisz <91203178+larakreisz@users.noreply.github.com> Date: Sun, 19 May 2024 05:02:41 +0200 Subject: [PATCH 5/5] Delete README.md --- README.md | 40 ---------------------------------------- 1 file changed, 40 deletions(-) delete mode 100644 README.md diff --git a/README.md b/README.md deleted file mode 100644 index 597a888..0000000 --- a/README.md +++ /dev/null @@ -1,40 +0,0 @@ -# flutter_multi_select_items -https://pub.dev/packages/flutter_multi_select_items - -This is a custom fork of the original package `flutter_multi_select` to address the deprecation and removal of `bodyText1` from `TextTheme`. - -## Changes Made - -### Fixed Issue: Deprecated `bodyText1` - -The Flutter framework has deprecated `bodyText1` in favor of `bodyLarge`. As a result, any reference to `bodyText1` has been updated to ensure compatibility with the latest version of Flutter. - -**Original:** - -```dart -Text( - 'Example Text', - style: Theme.of(context).textTheme.bodyText1, -) -``` - -**Updated:** - -```dart -Text( - 'Example Text', - style: Theme.of(context).textTheme.bodyLarge, -) -``` - -## How to Use This Fork - -To use this fixed version of the package in your Flutter project, add the following to your `pubspec.yaml` file: - -```yaml -dependencies: - package_name: - git: - url: https://github.com/larakreisz/flutter_multi_select.git - ref: master -```