Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions app/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- [Library] `Filter chip` Apply high contrast theme to filter chip (selected) ([#494](https://github.com/Orange-OpenSource/ouds-flutter/issues/494))

### Changed
- [DemoApp][Library] update `badge icon` component to 1.3.0 ([#680](https://github.com/Orange-OpenSource/ouds-flutter/issues/680))
- [DemoApp][Library] update tokens 2.4.0 ([#726](https://github.com/Orange-OpenSource/ouds-flutter/issues/726))
- [Library] update tokens 1.9.0 - Component Bullet List ([#710](https://github.com/Orange-OpenSource/ouds-flutter/issues/710))
- [Library] update tokens 1.9.0 - Component Alert ([#672](https://github.com/Orange-OpenSource/ouds-flutter/issues/672))

Expand Down
8 changes: 2 additions & 6 deletions app/lib/ui/components/badge/badge_customization.dart
Original file line number Diff line number Diff line change
Expand Up @@ -91,19 +91,15 @@ class BadgeCustomizationState
final isSmallSize =
selectedState == BadgeEnumSize.xsmall ||
selectedState == BadgeEnumSize.small;
final isTypeTrigger =
selectedType == BadgeEnumType.icon ||
selectedType == BadgeEnumType.count;
final isTypeTrigger = selectedType == BadgeEnumType.count;

if (isSmallSize && isTypeTrigger) {
selectedState = BadgeEnumSize.medium;
}
}

bool isSizeDisabled(BadgeEnumSize size) {
final isTypeTrigger =
selectedType == BadgeEnumType.icon ||
selectedType == BadgeEnumType.count;
final isTypeTrigger = selectedType == BadgeEnumType.count;
if (isTypeTrigger &&
(size == BadgeEnumSize.xsmall || size == BadgeEnumSize.small)) {
return true;
Expand Down
16 changes: 14 additions & 2 deletions app/lib/ui/components/badge/badge_demo_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,23 @@ class _Body extends StatefulWidget {
class _BodyState extends State<_Body> {
@override
Widget build(BuildContext context) {
final customizationState = BadgeCustomization.of(context)!;
ThemeController? themeController = Provider.of<ThemeController>(
context,
listen: false,
);

String getVersion() {
switch (customizationState.selectedType) {
case BadgeEnumType.standard:
return OudsComponentVersion.badge;
case BadgeEnumType.count:
return OudsComponentVersion.badgeCount;
case BadgeEnumType.icon:
return OudsComponentVersion.badgeIcon;
}
}

return DetailScreenDescription(
description: context.l10n.app_components_badge_description_text,
widget: Column(
Expand All @@ -120,7 +133,7 @@ class _BodyState extends State<_Body> {
.fixedMedium,
),
Code(code: BadgeCodeGenerator.updateCode(context)),
ReferenceDesignVersionComponent(version: OudsComponentVersion.badge),
ReferenceDesignVersionComponent(version: getVersion()),
],
),
);
Expand Down Expand Up @@ -280,7 +293,6 @@ class _CustomizationContentState extends State<_CustomizationContent> {
onSelected: (selectedOption) {
setState(() {
bool isTypeTrigger =
customizationState.selectedType == BadgeEnumType.icon ||
customizationState.selectedType == BadgeEnumType.count;
bool isSizeTrigger =
selectedOption == BadgeEnumSize.xsmall ||
Expand Down
60 changes: 37 additions & 23 deletions app/lib/ui/components/chip/chip_filter_demo_sreen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import 'package:provider/provider.dart';
class ChipFilterDemoScreen extends StatefulWidget {
final String? previousPageTitle;

const ChipFilterDemoScreen({super.key,this.previousPageTitle});
const ChipFilterDemoScreen({super.key, this.previousPageTitle});

@override
State<StatefulWidget> createState() => _ChipFilterDemoScreenState();
Expand All @@ -59,7 +59,11 @@ class _ChipFilterDemoScreenState extends State<ChipFilterDemoScreen> {
child: ChipCustomization(
key: _scaffoldKey,
child: Padding(
padding: EdgeInsets.only(bottom: defaultTargetPlatform == TargetPlatform.android ? MediaQuery.of(context).viewPadding.bottom : OudsTheme.of(context).spaceScheme(context).paddingBlockNone),
padding: EdgeInsets.only(
bottom: defaultTargetPlatform == TargetPlatform.android
? MediaQuery.of(context).viewPadding.bottom
: OudsTheme.of(context).spaceScheme(context).paddingBlockNone,
),
child: Scaffold(
bottomSheet: OudsSheetsBottom(
onExpansionChanged: _onExpansionChanged,
Expand All @@ -70,7 +74,8 @@ class _ChipFilterDemoScreenState extends State<ChipFilterDemoScreen> {
appBar: MainAppBar(
title: context.l10n.app_components_filterChip_label,
showBackButton: true,
previousPageTitle: widget.previousPageTitle,),
previousPageTitle: widget.previousPageTitle,
),
body: ExcludeSemantics(
excluding: !_isBottomSheetExpanded,
child: _Body(),
Expand All @@ -93,19 +98,24 @@ class _Body extends StatefulWidget {
class _BodyState extends State<_Body> {
@override
Widget build(BuildContext context) {
ThemeController? themeController = Provider.of<ThemeController>(context, listen: false);
ThemeController? themeController = Provider.of<ThemeController>(
context,
listen: false,
);
return DetailScreenDescription(
description: context.l10n.app_components_chip_filterChip_description_text,
widget: Column(
children: [
_ChipFilterDemo(),
SizedBox(height: themeController.currentTheme.spaceScheme(context).fixedMedium),
Code(
code: ChipFilterCodeGenerator.updateCode(context),
SizedBox(
height: themeController.currentTheme
.spaceScheme(context)
.fixedMedium,
),
Code(code: ChipFilterCodeGenerator.updateCode(context)),
ReferenceDesignVersionComponent(
version: OudsComponentVersion.chip,
)
version: OudsComponentVersion.filterChip,
),
],
),
);
Expand Down Expand Up @@ -134,18 +144,20 @@ class _ChipFilterDemoState extends State<_ChipFilterDemo> {

return LightDarkBox(
child: OudsFilterChip(
label: ChipCustomizationUtils.getText(customizationState),
avatar: ChipCustomizationUtils.getIcon(customizationState, themeController!),
selected: customizationState?.hasSelected,
onSelected: customizationState?.hasEnabled == true
? (newValue) {
setState(
() {
customizationState?.hasSelected = newValue;
},
);
}
: null),
label: ChipCustomizationUtils.getText(customizationState),
avatar: ChipCustomizationUtils.getIcon(
customizationState,
themeController!,
),
selected: customizationState?.hasSelected,
onSelected: customizationState?.hasEnabled == true
? (newValue) {
setState(() {
customizationState?.hasSelected = newValue;
});
}
: null,
),
);
}
}
Expand Down Expand Up @@ -176,7 +188,9 @@ class _CustomizationContentState extends State<_CustomizationContent> {

@override
Widget build(BuildContext context) {
final ChipCustomizationState? customizationState = ChipCustomization.of(context);
final ChipCustomizationState? customizationState = ChipCustomization.of(
context,
);

return CustomizableSection(
children: [
Expand Down Expand Up @@ -212,7 +226,7 @@ class _CustomizationContentState extends State<_CustomizationContent> {
text: customizationState.labelText,
focusNode: labelFocus,
fieldType: FieldType.label,
)
),
],
);
}
Expand Down
4 changes: 3 additions & 1 deletion app/lib/ui/components/chip/chip_suggestion_demo_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,9 @@ class _BodyState extends State<_Body> {
.fixedMedium,
),
Code(code: ChipSuggestionCodeGenerator.updateCode(context)),
ReferenceDesignVersionComponent(version: OudsComponentVersion.chip),
ReferenceDesignVersionComponent(
version: OudsComponentVersion.suggestionChip,
),
],
),
);
Expand Down
Loading
Loading