Skip to content

Commit

Permalink
329 bug card buttons (#338)
Browse files Browse the repository at this point in the history
* app : fix number of items buttons by 0 default

* app and library : fix button lowest primary style

* app and library : add changelog
  • Loading branch information
Tayebsed93 authored Feb 28, 2024
1 parent 00ce692 commit 879fdeb
Show file tree
Hide file tree
Showing 9 changed files with 40 additions and 41 deletions.
1 change: 1 addition & 0 deletions app/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- [Bug]: Text Field > Input type > single line doesn't stay on 1 line ([#315](https://github.com/Orange-OpenSource/ods-flutter/issues/315))
- [Bug]: Icons Button name ([#334](https://github.com/Orange-OpenSource/ods-flutter/issues/334))
- [Bug]: - Navigation Rail : Name customization ([#333](https://github.com/Orange-OpenSource/ods-flutter/issues/333))
- [Bug]: Card buttons ([#329](https://github.com/Orange-OpenSource/ods-flutter/issues/329))

### [0.7.O](https://github.com/Orange-OpenSource/ods-flutter/compare/0.1.1...0.7.0) - 2023-02-02

Expand Down
2 changes: 1 addition & 1 deletion app/lib/ui/components/cards/card_customization.dart
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class CardCustomizationState extends State<CardCustomization> {

static get maxNavigationItemCount => 2;

int _numberOfItems = maxNavigationItemCount;
int _numberOfItems = minNavigationItemCount;

int get numberOfItems => _numberOfItems;

Expand Down
18 changes: 9 additions & 9 deletions app/lib/ui/components/cards/card_horizontal.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ import 'dart:math';

import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/ods_flutter_app_localizations.dart';
import 'package:ods_flutter/components/button/ods_button.dart';
import 'package:ods_flutter/components/button/ods_outlined_button.dart';
import 'package:ods_flutter/components/button/ods_text_button.dart';
import 'package:ods_flutter/components/card/ods_cards_common.dart';
import 'package:ods_flutter/components/card/ods_horizontal_card.dart';
import 'package:ods_flutter/components/chips/ods_choice_chips.dart';
Expand Down Expand Up @@ -69,28 +68,29 @@ class _Body extends StatelessWidget {
CardCustomization.of(context);

List<Widget> listButtons = [
OdsOutlinedButton(
OdsTextButton(
text: AppLocalizations.of(context)!.componentElementButton1,
style: OdsTextButtonStyle.functionalPrimary,
onClick: () {},
),
OdsButton(
OdsTextButton(
text: AppLocalizations.of(context)!.componentElementButton2,
style: OdsButtonStyle.functionalPrimary,
style: OdsTextButtonStyle.functionalPrimary,
onClick: () {},
),
];

List<Widget> buttons =
listButtons.sublist(0, customizationState?.numberOfItems);

OdsOutlinedButton? firstButton;
OdsButton? secondButton;
OdsTextButton? firstButton;
OdsTextButton? secondButton;

if (buttons.isNotEmpty) {
firstButton = buttons[0] as OdsOutlinedButton;
firstButton = buttons[0] as OdsTextButton;
}
if (buttons.length > 1) {
secondButton = buttons[1] as OdsButton;
secondButton = buttons[1] as OdsTextButton;
}

return SafeArea(
Expand Down
18 changes: 9 additions & 9 deletions app/lib/ui/components/cards/card_vertical_header_first.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ import 'dart:math';

import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/ods_flutter_app_localizations.dart';
import 'package:ods_flutter/components/button/ods_button.dart';
import 'package:ods_flutter/components/button/ods_outlined_button.dart';
import 'package:ods_flutter/components/button/ods_text_button.dart';
import 'package:ods_flutter/components/card/ods_cards_common.dart';
import 'package:ods_flutter/components/card/ods_vertical_header_first_card.dart';
import 'package:ods_flutter/components/lists/ods_list_switch.dart';
Expand Down Expand Up @@ -67,28 +66,29 @@ class _Body extends StatelessWidget {
CardCustomization.of(context);

List<Widget> listButtons = [
OdsOutlinedButton(
OdsTextButton(
text: AppLocalizations.of(context)!.componentElementButton1,
style: OdsTextButtonStyle.functionalPrimary,
onClick: () {},
),
OdsButton(
OdsTextButton(
text: AppLocalizations.of(context)!.componentElementButton2,
style: OdsButtonStyle.functionalPrimary,
style: OdsTextButtonStyle.functionalPrimary,
onClick: () {},
),
];

List<Widget> buttons =
listButtons.sublist(0, customizationState?.numberOfItems);

OdsOutlinedButton? firstButton;
OdsButton? secondButton;
OdsTextButton? firstButton;
OdsTextButton? secondButton;

if (buttons.isNotEmpty) {
firstButton = buttons[0] as OdsOutlinedButton;
firstButton = buttons[0] as OdsTextButton;
}
if (buttons.length > 1) {
secondButton = buttons[1] as OdsButton;
secondButton = buttons[1] as OdsTextButton;
}

return SingleChildScrollView(
Expand Down
20 changes: 10 additions & 10 deletions app/lib/ui/components/cards/card_vertical_image_first.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ import 'dart:math';

import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/ods_flutter_app_localizations.dart';
import 'package:ods_flutter/components/button/ods_button.dart';
import 'package:ods_flutter/components/button/ods_outlined_button.dart';
import 'package:ods_flutter/components/button/ods_text_button.dart';
import 'package:ods_flutter/components/card/ods_cards_common.dart';
import 'package:ods_flutter/components/card/ods_vertical_image_first_card.dart';
import 'package:ods_flutter/components/lists/ods_list_switch.dart';
Expand Down Expand Up @@ -67,28 +66,29 @@ class _Body extends StatelessWidget {
CardCustomization.of(context);

List<Widget> listButtons = [
OdsOutlinedButton(
text: AppLocalizations.of(context)!.componentElementButton1,
OdsTextButton(
text: AppLocalizations.of(context)!.componentElementButton2,
style: OdsTextButtonStyle.functionalPrimary,
onClick: () {},
),
OdsButton(
OdsTextButton(
text: AppLocalizations.of(context)!.componentElementButton2,
style: OdsButtonStyle.functionalPrimary,
style: OdsTextButtonStyle.functionalPrimary,
onClick: () {},
),
];

List<Widget> buttons =
listButtons.sublist(0, customizationState?.numberOfItems);

OdsOutlinedButton? firstButton;
OdsButton? secondButton;
OdsTextButton? firstButton;
OdsTextButton? secondButton;

if (buttons.isNotEmpty) {
firstButton = buttons[0] as OdsOutlinedButton;
firstButton = buttons[0] as OdsTextButton;
}
if (buttons.length > 1) {
secondButton = buttons[1] as OdsButton;
secondButton = buttons[1] as OdsTextButton;
}

return SingleChildScrollView(
Expand Down
1 change: 1 addition & 0 deletions library/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- [Bug]: Text Field > Input type > single line doesn't stay on 1 line ([#315](https://github.com/Orange-OpenSource/ods-flutter/issues/315))
- [Bug]: Icons Button name ([#334](https://github.com/Orange-OpenSource/ods-flutter/issues/334))
- [Bug]: - Navigation Rail : Name customization ([#333](https://github.com/Orange-OpenSource/ods-flutter/issues/333))
- [Bug]: Card buttons ([#329](https://github.com/Orange-OpenSource/ods-flutter/issues/329))

## [0.7.0](https://github.com/Orange-OpenSource/ods-flutter/compare/0.1.1...0.7.0) - 2023-02-02

Expand Down
7 changes: 3 additions & 4 deletions library/lib/components/card/ods_horizontal_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
*/

import 'package:flutter/material.dart';
import 'package:ods_flutter/components/button/ods_button.dart';
import 'package:ods_flutter/components/button/ods_outlined_button.dart';
import 'package:ods_flutter/components/button/ods_text_button.dart';
import 'package:ods_flutter/components/card/ods_cards_common.dart';
import 'package:ods_flutter/guidelines/spacings.dart';
import 'package:ods_flutter/theme/ods_theme.dart';
Expand Down Expand Up @@ -60,10 +59,10 @@ class OdsHorizontalCard extends StatefulWidget {
final String? text;

/// Optional first button. If null, button will not be shown.
final OdsOutlinedButton? firstButton;
final OdsTextButton? firstButton;

/// Optional second button in the card. If null, button will not be shown.
final OdsButton? secondButton;
final OdsTextButton? secondButton;

/// imagePosition Position of the image within the card, it can be set to [OdsHorizontalCardImagePosition.Start] or [OdsHorizontalCardImagePosition.End]. [OdsHorizontalCardImagePosition.Start] by default.
final OdsHorizontalCardImagePosition imagePosition;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
*/

import 'package:flutter/material.dart';
import 'package:ods_flutter/components/button/ods_button.dart';
import 'package:ods_flutter/components/button/ods_outlined_button.dart';
import 'package:ods_flutter/components/button/ods_text_button.dart';
import 'package:ods_flutter/components/card/ods_cards_common.dart';
import 'package:ods_flutter/guidelines/spacings.dart';

Expand Down Expand Up @@ -54,10 +53,10 @@ class OdsVerticalHeaderFirstCard extends StatefulWidget {
final String? text;

/// Optional first button. If null, button will not be shown.
final OdsOutlinedButton? firstButton;
final OdsTextButton? firstButton;

/// Optional second button in the card. If null, button will not be shown.
final OdsButton? secondButton;
final OdsTextButton? secondButton;

/// The action executed on card tap.
final Function()? onClick;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
*/

import 'package:flutter/material.dart';
import 'package:ods_flutter/components/button/ods_button.dart';
import 'package:ods_flutter/components/button/ods_outlined_button.dart';
import 'package:ods_flutter/components/button/ods_text_button.dart';
import 'package:ods_flutter/components/card/ods_cards_common.dart';
import 'package:ods_flutter/guidelines/spacings.dart';

Expand Down Expand Up @@ -50,10 +49,10 @@ class OdsVerticalImageFirstCard extends StatefulWidget {
final String? text;

/// Optional first button. If null, button will not be shown.
final OdsOutlinedButton? firstButton;
final OdsTextButton? firstButton;

/// Optional second button in the card. If null, button will not be shown.
final OdsButton? secondButton;
final OdsTextButton? secondButton;

/// The action executed on card tap.
final Function()? onClick;
Expand Down

0 comments on commit 879fdeb

Please sign in to comment.