From 02ccbb98d21ecf45d4c351734a7e82dc61f0bdf0 Mon Sep 17 00:00:00 2001 From: Tayeb Sedraia Date: Thu, 1 Feb 2024 17:06:58 +0100 Subject: [PATCH] 271 bug ods components cards horizontal card divider (#311) * app : correction fix bug customization divider * app : add changelog * app and library : add version number 0.8.0 --- app/CHANGELOG.md | 6 ++++++ app/lib/ui/components/cards/card_customization.dart | 10 ++++++++++ app/lib/ui/components/cards/card_horizontal.dart | 13 ++++++++----- app/pubspec.yaml | 2 +- library/pubspec.yaml | 2 +- 5 files changed, 26 insertions(+), 7 deletions(-) diff --git a/app/CHANGELOG.md b/app/CHANGELOG.md index fa19ac8a..720616e3 100644 --- a/app/CHANGELOG.md +++ b/app/CHANGELOG.md @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### [Unreleased](https://github.com/Orange-OpenSource/ods-flutter/releases) +### [0.8.O](https://github.com/Orange-OpenSource/ods-flutter/compare/0.1.1...0.8.0) - 2023-03-02 + +## Added + +- [Bug]: ODS - Components - Cards - Horizontal card - divider ([#271](https://github.com/Orange-OpenSource/ods-flutter/issues/271)) + ### [0.7.O](https://github.com/Orange-OpenSource/ods-flutter/compare/0.1.1...0.7.0) - 2023-02-02 ## Added diff --git a/app/lib/ui/components/cards/card_customization.dart b/app/lib/ui/components/cards/card_customization.dart index e3ef4bb8..9214a4f9 100644 --- a/app/lib/ui/components/cards/card_customization.dart +++ b/app/lib/ui/components/cards/card_customization.dart @@ -43,6 +43,7 @@ class CardCustomizationState extends State { set numberOfItems(int value) { setState(() { _numberOfItems = value; + updateHasDivider(); }); } @@ -100,6 +101,15 @@ class CardCustomizationState extends State { }); } + /// Determine if _hasDivider should be enabled + void updateHasDivider() { + setState(() { + if (_numberOfItems == 0) { + _hasDivider = false; + } + }); + } + @override Widget build(BuildContext context) { return _CardCustomization( diff --git a/app/lib/ui/components/cards/card_horizontal.dart b/app/lib/ui/components/cards/card_horizontal.dart index b0a0ec17..57a5cded 100644 --- a/app/lib/ui/components/cards/card_horizontal.dart +++ b/app/lib/ui/components/cards/card_horizontal.dart @@ -196,11 +196,14 @@ class _CustomizationContentState extends State<_CustomizationContent> { customizationState.numberOfItems = value; }), OdsListSwitch( - title: AppLocalizations.of(context)!.componentElementDivider, - checked: customizationState.hasDivider, - onCheckedChange: (bool value) { - customizationState.hasDivider = value; - }), + title: AppLocalizations.of(context)!.componentElementDivider, + checked: customizationState.hasDivider, + onCheckedChange: (customizationState.numberOfItems >= 1) + ? (bool value) { + customizationState.hasDivider = value; + } + : null, + ), ], ), ); diff --git a/app/pubspec.yaml b/app/pubspec.yaml index aa40bf0e..24dae643 100644 --- a/app/pubspec.yaml +++ b/app/pubspec.yaml @@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html # In Windows, build-name is used as the major, minor, and patch parts # of the product and file versions while build-number is used as the build suffix. -version: 0.7.0+1 +version: 0.8.0+1 environment: sdk: '>=2.19.6 <3.0.0' diff --git a/library/pubspec.yaml b/library/pubspec.yaml index 29209edd..494f8ffb 100644 --- a/library/pubspec.yaml +++ b/library/pubspec.yaml @@ -1,6 +1,6 @@ name: ods_flutter description: ODS Flutter provides Orange Flutter components for Android and iOS to developers, and a demo application. -version: 0.7.0 +version: 0.8.0 repository: https://github.com/Orange-OpenSource/ods-flutter environment: