feat: add generic card

This commit is contained in:
Hugo Pointcheval 2023-10-26 17:22:02 +02:00 committed by Malo Léon
parent 1cadba5cd5
commit 375bb8f04a
6 changed files with 224 additions and 0 deletions

View File

@ -15,6 +15,7 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
export './card_component.dart'; export './card_component.dart';
export './generic_card_component.dart';
export './information_card_component.dart'; export './information_card_component.dart';
export './portfolio_card_component.dart'; export './portfolio_card_component.dart';
export './pricing_card_component.dart'; export './pricing_card_component.dart';

View File

@ -0,0 +1,45 @@
// Copyright (C) 2023 WYATT GROUP
// Please see the AUTHORS file for details.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
import 'package:flutter/widgets.dart';
import 'package:wyatt_component_copy_with_extension/wyatt_component_copy_with_extension.dart';
import 'package:wyatt_ui_components/wyatt_ui_components.dart';
part 'generic_card_component.g.dart';
@ComponentProxyExtension()
abstract class GenericCardComponent extends CardComponent
with CopyWithMixin<$GenericCardComponentCWProxy> {
const GenericCardComponent({
this.child,
super.radius,
super.padding,
super.borderColors,
super.backgroundColors,
super.stroke,
super.minSize,
super.maxSize,
super.shadow,
super.titleStyle,
super.subtitleStyle,
super.bodyStyle,
super.background,
super.key,
});
/// Child of this card
final Widget? child;
}

View File

@ -0,0 +1,40 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'generic_card_component.dart';
// **************************************************************************
// ComponentProxyGenerator
// **************************************************************************
abstract class $GenericCardComponentCWProxy {
GenericCardComponent child(Widget? child);
GenericCardComponent radius(BorderRadiusGeometry? radius);
GenericCardComponent padding(EdgeInsetsGeometry? padding);
GenericCardComponent borderColors(MultiColor? borderColors);
GenericCardComponent backgroundColors(MultiColor? backgroundColors);
GenericCardComponent stroke(double? stroke);
GenericCardComponent minSize(Size? minSize);
GenericCardComponent maxSize(Size? maxSize);
GenericCardComponent shadow(BoxShadow? shadow);
GenericCardComponent titleStyle(TextStyle? titleStyle);
GenericCardComponent subtitleStyle(TextStyle? subtitleStyle);
GenericCardComponent bodyStyle(TextStyle? bodyStyle);
GenericCardComponent background(Widget? background);
GenericCardComponent key(Key? key);
GenericCardComponent call({
Widget? child,
BorderRadiusGeometry? radius,
EdgeInsetsGeometry? padding,
MultiColor? borderColors,
MultiColor? backgroundColors,
double? stroke,
Size? minSize,
Size? maxSize,
BoxShadow? shadow,
TextStyle? titleStyle,
TextStyle? subtitleStyle,
TextStyle? bodyStyle,
Widget? background,
Key? key,
});
}

View File

@ -14,6 +14,7 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
export './generic_card/generic_card.dart';
export './information_card/information_card.dart'; export './information_card/information_card.dart';
export './portfolio_card/portfolio_card.dart'; export './portfolio_card/portfolio_card.dart';
export './pricing_card/pricing_card.dart'; export './pricing_card/pricing_card.dart';

View File

@ -0,0 +1,56 @@
// Copyright (C) 2023 WYATT GROUP
// Please see the AUTHORS file for details.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
import 'package:flutter/material.dart';
import 'package:wyatt_component_copy_with_extension/wyatt_component_copy_with_extension.dart';
import 'package:wyatt_ui_components/wyatt_ui_components.dart';
import 'package:wyatt_ui_kit/src/components/cards/widgets/card_wrapper.dart';
part 'generic_card.g.dart';
@ComponentCopyWithExtension()
class GenericCard extends GenericCardComponent with $GenericCardCWMixin {
const GenericCard({
super.child,
super.radius,
super.padding,
super.borderColors,
super.backgroundColors,
super.stroke,
super.minSize,
super.maxSize,
super.shadow,
super.titleStyle,
super.subtitleStyle,
super.bodyStyle,
super.background,
super.key,
});
@override
Widget build(BuildContext context) => CardWrapper(
background: background,
padding: padding,
radius: radius,
backgroundColors: backgroundColors,
borderColors: borderColors,
shadow: shadow,
stroke: stroke,
maxSize: maxSize,
minSize: minSize,
child: child ?? const SizedBox.shrink(),
);
}

View File

@ -0,0 +1,81 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'generic_card.dart';
// **************************************************************************
// ComponentCopyWithGenerator
// **************************************************************************
class $GenericCardCWProxyImpl implements $GenericCardComponentCWProxy {
const $GenericCardCWProxyImpl(this._value);
final GenericCard _value;
@override
GenericCard child(Widget? child) => this(child: child);
@override
GenericCard radius(BorderRadiusGeometry? radius) => this(radius: radius);
@override
GenericCard padding(EdgeInsetsGeometry? padding) => this(padding: padding);
@override
GenericCard borderColors(MultiColor? borderColors) =>
this(borderColors: borderColors);
@override
GenericCard backgroundColors(MultiColor? backgroundColors) =>
this(backgroundColors: backgroundColors);
@override
GenericCard stroke(double? stroke) => this(stroke: stroke);
@override
GenericCard minSize(Size? minSize) => this(minSize: minSize);
@override
GenericCard maxSize(Size? maxSize) => this(maxSize: maxSize);
@override
GenericCard shadow(BoxShadow? shadow) => this(shadow: shadow);
@override
GenericCard titleStyle(TextStyle? titleStyle) => this(titleStyle: titleStyle);
@override
GenericCard subtitleStyle(TextStyle? subtitleStyle) =>
this(subtitleStyle: subtitleStyle);
@override
GenericCard bodyStyle(TextStyle? bodyStyle) => this(bodyStyle: bodyStyle);
@override
GenericCard background(Widget? background) => this(background: background);
@override
GenericCard key(Key? key) => this(key: key);
@override
GenericCard call({
Widget? child,
BorderRadiusGeometry? radius,
EdgeInsetsGeometry? padding,
MultiColor? borderColors,
MultiColor? backgroundColors,
double? stroke,
Size? minSize,
Size? maxSize,
BoxShadow? shadow,
TextStyle? titleStyle,
TextStyle? subtitleStyle,
TextStyle? bodyStyle,
Widget? background,
Key? key,
}) =>
GenericCard(
child: child ?? _value.child,
radius: radius ?? _value.radius,
padding: padding ?? _value.padding,
borderColors: borderColors ?? _value.borderColors,
backgroundColors: backgroundColors ?? _value.backgroundColors,
stroke: stroke ?? _value.stroke,
minSize: minSize ?? _value.minSize,
maxSize: maxSize ?? _value.maxSize,
shadow: shadow ?? _value.shadow,
titleStyle: titleStyle ?? _value.titleStyle,
subtitleStyle: subtitleStyle ?? _value.subtitleStyle,
bodyStyle: bodyStyle ?? _value.bodyStyle,
background: background ?? _value.background,
key: key ?? _value.key,
);
}
mixin $GenericCardCWMixin on Component {
$GenericCardComponentCWProxy get copyWith =>
$GenericCardCWProxyImpl(this as GenericCard);
}