Compare commits

..

No commits in common. "12d04c91eddd6e20ce5b983922f1bf7b2309de10" and "133e0e910b3fe1da2d95f90cd0e4c7f51b34c086" have entirely different histories.

17 changed files with 58 additions and 56 deletions

View File

@ -15,7 +15,6 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
import 'package:wyatt_ui_components/src/core/utils/multi_color.dart';
import 'package:wyatt_ui_components/src/domain/entities/component.dart'; import 'package:wyatt_ui_components/src/domain/entities/component.dart';
abstract class CardComponent extends Component { abstract class CardComponent extends Component {
@ -42,10 +41,10 @@ abstract class CardComponent extends Component {
final double? padding; final double? padding;
/// Border gradient color (from left to right) /// Border gradient color (from left to right)
final MultiColor? borderColors; final List<Color>? borderColors;
/// Card background color /// Card background color
final MultiColor? backgroundColors; final List<Color>? backgroundColors;
/// Minimum size for this card /// Minimum size for this card
final Size? minSize; final Size? minSize;

View File

@ -14,8 +14,8 @@ abstract class $InformationCardComponentCWProxy {
InformationCardComponent axis(Axis? axis); InformationCardComponent axis(Axis? axis);
InformationCardComponent radius(double? radius); InformationCardComponent radius(double? radius);
InformationCardComponent padding(double? padding); InformationCardComponent padding(double? padding);
InformationCardComponent borderColors(MultiColor? borderColors); InformationCardComponent borderColors(List<Color>? borderColors);
InformationCardComponent backgroundColors(MultiColor? backgroundColors); InformationCardComponent backgroundColors(List<Color>? backgroundColors);
InformationCardComponent minSize(Size? minSize); InformationCardComponent minSize(Size? minSize);
InformationCardComponent maxSize(Size? maxSize); InformationCardComponent maxSize(Size? maxSize);
InformationCardComponent shadow(BoxShadow? shadow); InformationCardComponent shadow(BoxShadow? shadow);
@ -29,8 +29,8 @@ abstract class $InformationCardComponentCWProxy {
Axis? axis, Axis? axis,
double? radius, double? radius,
double? padding, double? padding,
MultiColor? borderColors, List<Color>? borderColors,
MultiColor? backgroundColors, List<Color>? backgroundColors,
Size? minSize, Size? minSize,
Size? maxSize, Size? maxSize,
BoxShadow? shadow, BoxShadow? shadow,

View File

@ -19,8 +19,8 @@ abstract class $PortfolioCardComponentCWProxy {
PortfolioCardComponent assets(List<Widget>? assets); PortfolioCardComponent assets(List<Widget>? assets);
PortfolioCardComponent radius(double? radius); PortfolioCardComponent radius(double? radius);
PortfolioCardComponent padding(double? padding); PortfolioCardComponent padding(double? padding);
PortfolioCardComponent borderColors(MultiColor? borderColors); PortfolioCardComponent borderColors(List<Color>? borderColors);
PortfolioCardComponent backgroundColors(MultiColor? backgroundColors); PortfolioCardComponent backgroundColors(List<Color>? backgroundColors);
PortfolioCardComponent minSize(Size? minSize); PortfolioCardComponent minSize(Size? minSize);
PortfolioCardComponent maxSize(Size? maxSize); PortfolioCardComponent maxSize(Size? maxSize);
PortfolioCardComponent shadow(BoxShadow? shadow); PortfolioCardComponent shadow(BoxShadow? shadow);
@ -38,8 +38,8 @@ abstract class $PortfolioCardComponentCWProxy {
List<Widget>? assets, List<Widget>? assets,
double? radius, double? radius,
double? padding, double? padding,
MultiColor? borderColors, List<Color>? borderColors,
MultiColor? backgroundColors, List<Color>? backgroundColors,
Size? minSize, Size? minSize,
Size? maxSize, Size? maxSize,
BoxShadow? shadow, BoxShadow? shadow,

View File

@ -16,8 +16,8 @@ abstract class $QuoteCardComponentCWProxy {
QuoteCardComponent rightQuote(Widget? rightQuote); QuoteCardComponent rightQuote(Widget? rightQuote);
QuoteCardComponent radius(double? radius); QuoteCardComponent radius(double? radius);
QuoteCardComponent padding(double? padding); QuoteCardComponent padding(double? padding);
QuoteCardComponent borderColors(MultiColor? borderColors); QuoteCardComponent borderColors(List<Color>? borderColors);
QuoteCardComponent backgroundColors(MultiColor? backgroundColors); QuoteCardComponent backgroundColors(List<Color>? backgroundColors);
QuoteCardComponent minSize(Size? minSize); QuoteCardComponent minSize(Size? minSize);
QuoteCardComponent maxSize(Size? maxSize); QuoteCardComponent maxSize(Size? maxSize);
QuoteCardComponent shadow(BoxShadow? shadow); QuoteCardComponent shadow(BoxShadow? shadow);
@ -33,8 +33,8 @@ abstract class $QuoteCardComponentCWProxy {
Widget? rightQuote, Widget? rightQuote,
double? radius, double? radius,
double? padding, double? padding,
MultiColor? borderColors, List<Color>? borderColors,
MultiColor? backgroundColors, List<Color>? backgroundColors,
Size? minSize, Size? minSize,
Size? maxSize, Size? maxSize,
BoxShadow? shadow, BoxShadow? shadow,

View File

@ -17,8 +17,8 @@ abstract class $SkillCardComponentCWProxy {
Color? secondaryBackgroundColors); Color? secondaryBackgroundColors);
SkillCardComponent radius(double? radius); SkillCardComponent radius(double? radius);
SkillCardComponent padding(double? padding); SkillCardComponent padding(double? padding);
SkillCardComponent borderColors(MultiColor? borderColors); SkillCardComponent borderColors(List<Color>? borderColors);
SkillCardComponent backgroundColors(MultiColor? backgroundColors); SkillCardComponent backgroundColors(List<Color>? backgroundColors);
SkillCardComponent minSize(Size? minSize); SkillCardComponent minSize(Size? minSize);
SkillCardComponent maxSize(Size? maxSize); SkillCardComponent maxSize(Size? maxSize);
SkillCardComponent shadow(BoxShadow? shadow); SkillCardComponent shadow(BoxShadow? shadow);
@ -34,8 +34,8 @@ abstract class $SkillCardComponentCWProxy {
Color? secondaryBackgroundColors, Color? secondaryBackgroundColors,
double? radius, double? radius,
double? padding, double? padding,
MultiColor? borderColors, List<Color>? borderColors,
MultiColor? backgroundColors, List<Color>? backgroundColors,
Size? minSize, Size? minSize,
Size? maxSize, Size? maxSize,
BoxShadow? shadow, BoxShadow? shadow,

View File

@ -14,10 +14,12 @@ dependencies:
git: git:
url: ssh://git@git.wyatt-studio.fr:993/Wyatt-FOSS/wyatt-packages.git url: ssh://git@git.wyatt-studio.fr:993/Wyatt-FOSS/wyatt-packages.git
path: packages/wyatt_component_copy_with_extension path: packages/wyatt_component_copy_with_extension
freezed_annotation: ^2.2.0
dev_dependencies: dev_dependencies:
build_runner: ^2.3.3 build_runner: ^2.3.3
flutter_test: { sdk: flutter } flutter_test: { sdk: flutter }
freezed: ^2.3.2
wyatt_analysis: wyatt_analysis:
hosted: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub hosted: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub
version: ^2.4.0 version: ^2.4.0

View File

@ -121,7 +121,7 @@ class FlatButtonScreen extends CubitScreen<ButtonCubit, ButtonState> {
// If no border color => no default value // If no border color => no default value
border: (style.borderColors != null && style.stroke != null) border: (style.borderColors != null && style.stroke != null)
? (style.borderColors?.isGradient ?? false) ? (style.borderColors?.isGradient ?? false)
? GradientBoxBorder( ? CustomGradientBoxBorder(
gradient: LinearGradient( gradient: LinearGradient(
colors: style.borderColors!.colors, colors: style.borderColors!.colors,
), ),

View File

@ -120,7 +120,7 @@ class SimpleIconButtonScreen extends CubitScreen<ButtonCubit, ButtonState> {
// If no border color => no default value // If no border color => no default value
border: (style.borderColors != null && style.stroke != null) border: (style.borderColors != null && style.stroke != null)
? (style.borderColors?.isGradient ?? false) ? (style.borderColors?.isGradient ?? false)
? GradientBoxBorder( ? CustomGradientBoxBorder(
gradient: LinearGradient( gradient: LinearGradient(
colors: style.borderColors!.colors, colors: style.borderColors!.colors,
), ),

View File

@ -144,7 +144,7 @@ class SymbolButtonScreen
border: border:
(style.borderColors != null && style.stroke != null) (style.borderColors != null && style.stroke != null)
? (style.borderColors?.isGradient ?? false) ? (style.borderColors?.isGradient ?? false)
? GradientBoxBorder( ? CustomGradientBoxBorder(
gradient: LinearGradient( gradient: LinearGradient(
colors: style.borderColors!.colors, colors: style.borderColors!.colors,
), ),

View File

@ -24,10 +24,10 @@ class $InformationCardCWProxyImpl implements $InformationCardComponentCWProxy {
@override @override
InformationCard padding(double? padding) => this(padding: padding); InformationCard padding(double? padding) => this(padding: padding);
@override @override
InformationCard borderColors(MultiColor? borderColors) => InformationCard borderColors(List<Color>? borderColors) =>
this(borderColors: borderColors); this(borderColors: borderColors);
@override @override
InformationCard backgroundColors(MultiColor? backgroundColors) => InformationCard backgroundColors(List<Color>? backgroundColors) =>
this(backgroundColors: backgroundColors); this(backgroundColors: backgroundColors);
@override @override
InformationCard minSize(Size? minSize) => this(minSize: minSize); InformationCard minSize(Size? minSize) => this(minSize: minSize);
@ -49,8 +49,8 @@ class $InformationCardCWProxyImpl implements $InformationCardComponentCWProxy {
Axis? axis, Axis? axis,
double? radius, double? radius,
double? padding, double? padding,
MultiColor? borderColors, List<Color>? borderColors,
MultiColor? backgroundColors, List<Color>? backgroundColors,
Size? minSize, Size? minSize,
Size? maxSize, Size? maxSize,
BoxShadow? shadow, BoxShadow? shadow,

View File

@ -36,10 +36,10 @@ class $PortfolioCardCWProxyImpl implements $PortfolioCardComponentCWProxy {
@override @override
PortfolioCard padding(double? padding) => this(padding: padding); PortfolioCard padding(double? padding) => this(padding: padding);
@override @override
PortfolioCard borderColors(MultiColor? borderColors) => PortfolioCard borderColors(List<Color>? borderColors) =>
this(borderColors: borderColors); this(borderColors: borderColors);
@override @override
PortfolioCard backgroundColors(MultiColor? backgroundColors) => PortfolioCard backgroundColors(List<Color>? backgroundColors) =>
this(backgroundColors: backgroundColors); this(backgroundColors: backgroundColors);
@override @override
PortfolioCard minSize(Size? minSize) => this(minSize: minSize); PortfolioCard minSize(Size? minSize) => this(minSize: minSize);
@ -64,8 +64,8 @@ class $PortfolioCardCWProxyImpl implements $PortfolioCardComponentCWProxy {
List<Widget>? assets, List<Widget>? assets,
double? radius, double? radius,
double? padding, double? padding,
MultiColor? borderColors, List<Color>? borderColors,
MultiColor? backgroundColors, List<Color>? backgroundColors,
Size? minSize, Size? minSize,
Size? maxSize, Size? maxSize,
BoxShadow? shadow, BoxShadow? shadow,

View File

@ -28,10 +28,10 @@ class $QuoteCardCWProxyImpl implements $QuoteCardComponentCWProxy {
@override @override
QuoteCard padding(double? padding) => this(padding: padding); QuoteCard padding(double? padding) => this(padding: padding);
@override @override
QuoteCard borderColors(MultiColor? borderColors) => QuoteCard borderColors(List<Color>? borderColors) =>
this(borderColors: borderColors); this(borderColors: borderColors);
@override @override
QuoteCard backgroundColors(MultiColor? backgroundColors) => QuoteCard backgroundColors(List<Color>? backgroundColors) =>
this(backgroundColors: backgroundColors); this(backgroundColors: backgroundColors);
@override @override
QuoteCard minSize(Size? minSize) => this(minSize: minSize); QuoteCard minSize(Size? minSize) => this(minSize: minSize);
@ -54,8 +54,8 @@ class $QuoteCardCWProxyImpl implements $QuoteCardComponentCWProxy {
Widget? rightQuote, Widget? rightQuote,
double? radius, double? radius,
double? padding, double? padding,
MultiColor? borderColors, List<Color>? borderColors,
MultiColor? backgroundColors, List<Color>? backgroundColors,
Size? minSize, Size? minSize,
Size? maxSize, Size? maxSize,
BoxShadow? shadow, BoxShadow? shadow,

View File

@ -31,10 +31,10 @@ class $SkillCardCWProxyImpl implements $SkillCardComponentCWProxy {
@override @override
SkillCard padding(double? padding) => this(padding: padding); SkillCard padding(double? padding) => this(padding: padding);
@override @override
SkillCard borderColors(MultiColor? borderColors) => SkillCard borderColors(List<Color>? borderColors) =>
this(borderColors: borderColors); this(borderColors: borderColors);
@override @override
SkillCard backgroundColors(MultiColor? backgroundColors) => SkillCard backgroundColors(List<Color>? backgroundColors) =>
this(backgroundColors: backgroundColors); this(backgroundColors: backgroundColors);
@override @override
SkillCard minSize(Size? minSize) => this(minSize: minSize); SkillCard minSize(Size? minSize) => this(minSize: minSize);
@ -57,8 +57,8 @@ class $SkillCardCWProxyImpl implements $SkillCardComponentCWProxy {
Color? secondaryBackgroundColors, Color? secondaryBackgroundColors,
double? radius, double? radius,
double? padding, double? padding,
MultiColor? borderColors, List<Color>? borderColors,
MultiColor? backgroundColors, List<Color>? backgroundColors,
Size? minSize, Size? minSize,
Size? maxSize, Size? maxSize,
BoxShadow? shadow, BoxShadow? shadow,

View File

@ -15,9 +15,9 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:wyatt_ui_components/wyatt_wyatt_ui_components.dart';
import 'package:wyatt_ui_kit/src/components/cards/widgets/card_background.dart'; import 'package:wyatt_ui_kit/src/components/cards/widgets/card_background.dart';
import 'package:wyatt_ui_kit/wyatt_ui_kit.dart'; import 'package:wyatt_ui_kit/src/components/gradients/gradient_box_border.dart';
import 'package:wyatt_ui_kit/src/domain/card_theme_extension.dart';
class CardWrapper extends StatelessWidget { class CardWrapper extends StatelessWidget {
CardWrapper({ CardWrapper({
@ -34,8 +34,8 @@ class CardWrapper extends StatelessWidget {
final Widget? background; final Widget? background;
final Widget child; final Widget child;
final MultiColor? backgroundColors; final List<Color>? backgroundColors;
final MultiColor? borderColors; final List<Color>? borderColors;
final BoxShadow? shadow; final BoxShadow? shadow;
final Size? minSize; final Size? minSize;
final Size? maxSize; final Size? maxSize;
@ -67,8 +67,8 @@ class CardWrapper extends StatelessWidget {
); );
Gradient? _cardGradient(BuildContext context) { Gradient? _cardGradient(BuildContext context) {
if (backgroundColors != null && backgroundColors!.isGradient) { if (backgroundColors != null && backgroundColors!.length >= 2) {
return LinearGradientHelper.fromMultiColor(backgroundColors!); return LinearGradient(colors: backgroundColors!);
} else { } else {
final extensionCardColor = final extensionCardColor =
Theme.of(context).extension<CardThemeExtension>(); Theme.of(context).extension<CardThemeExtension>();
@ -85,8 +85,8 @@ class CardWrapper extends StatelessWidget {
} }
Color? _cardColor(BuildContext context) { Color? _cardColor(BuildContext context) {
if (backgroundColors != null && backgroundColors!.isColor) { if (backgroundColors != null && backgroundColors!.length == 1) {
return backgroundColors!.color; return backgroundColors!.first;
} else { } else {
final extensionCardColor = final extensionCardColor =
Theme.of(context).extension<CardThemeExtension>(); Theme.of(context).extension<CardThemeExtension>();
@ -101,13 +101,15 @@ class CardWrapper extends StatelessWidget {
BoxBorder? _boxBorder(BuildContext context) { BoxBorder? _boxBorder(BuildContext context) {
if (borderColors != null) { if (borderColors != null) {
if (borderColors!.isGradient) { if (borderColors!.length >= 2) {
return GradientBoxBorder( return CustomGradientBoxBorder(
gradient: LinearGradientHelper.fromMultiColor(borderColors!), gradient: LinearGradient(
colors: borderColors!,
),
); );
} else if (borderColors!.isColor) { } else if (borderColors!.isNotEmpty) {
return Border.all( return Border.all(
color: borderColors!.color, color: borderColors!.first,
); );
} }
} else { } else {
@ -116,7 +118,7 @@ class CardWrapper extends StatelessWidget {
if (extensionCardColor != null && if (extensionCardColor != null &&
extensionCardColor.borderColors != null) { extensionCardColor.borderColors != null) {
if (extensionCardColor.borderColors!.isGradient) { if (extensionCardColor.borderColors!.isGradient) {
return GradientBoxBorder( return CustomGradientBoxBorder(
gradient: LinearGradient( gradient: LinearGradient(
colors: extensionCardColor.borderColors!.colors, colors: extensionCardColor.borderColors!.colors,
), ),

View File

@ -17,8 +17,8 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/painting.dart'; import 'package:flutter/painting.dart';
class GradientBoxBorder extends Border { class CustomGradientBoxBorder extends Border {
const GradientBoxBorder({this.gradient, this.width = 1}); const CustomGradientBoxBorder({this.gradient, this.width = 1});
final Gradient? gradient; final Gradient? gradient;
final double width; final double width;

View File

@ -15,4 +15,3 @@
// 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 './linear_gradient_helper.dart'; export './linear_gradient_helper.dart';
export './theme_helper.dart';

View File

@ -14,7 +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 super program. If not, see <https://www.gnu.org/licenses/>. // along with super program. If not, see <https://www.gnu.org/licenses/>.
abstract class ThemeHelper { class ThemeHelper {
static T? getThemeElement<P, T>( static T? getThemeElement<P, T>(
List<P?>? styles, { List<P?>? styles, {
required T? Function(P?)? transform, required T? Function(P?)? transform,