master #81
| @ -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/>. | ||||||
| 
 | 
 | ||||||
| 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 { | ||||||
| @ -41,10 +42,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 List<Color>? borderColors; |   final MultiColor? borderColors; | ||||||
| 
 | 
 | ||||||
|   /// Card background color |   /// Card background color | ||||||
|   final List<Color>? backgroundColors; |   final MultiColor? backgroundColors; | ||||||
| 
 | 
 | ||||||
|   /// Minimum size for this card |   /// Minimum size for this card | ||||||
|   final Size? minSize; |   final Size? minSize; | ||||||
|  | |||||||
| @ -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(List<Color>? borderColors); |   InformationCardComponent borderColors(MultiColor? borderColors); | ||||||
|   InformationCardComponent backgroundColors(List<Color>? backgroundColors); |   InformationCardComponent backgroundColors(MultiColor? 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, | ||||||
|     List<Color>? borderColors, |     MultiColor? borderColors, | ||||||
|     List<Color>? backgroundColors, |     MultiColor? backgroundColors, | ||||||
|     Size? minSize, |     Size? minSize, | ||||||
|     Size? maxSize, |     Size? maxSize, | ||||||
|     BoxShadow? shadow, |     BoxShadow? shadow, | ||||||
|  | |||||||
| @ -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(List<Color>? borderColors); |   PortfolioCardComponent borderColors(MultiColor? borderColors); | ||||||
|   PortfolioCardComponent backgroundColors(List<Color>? backgroundColors); |   PortfolioCardComponent backgroundColors(MultiColor? 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, | ||||||
|     List<Color>? borderColors, |     MultiColor? borderColors, | ||||||
|     List<Color>? backgroundColors, |     MultiColor? backgroundColors, | ||||||
|     Size? minSize, |     Size? minSize, | ||||||
|     Size? maxSize, |     Size? maxSize, | ||||||
|     BoxShadow? shadow, |     BoxShadow? shadow, | ||||||
|  | |||||||
| @ -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(List<Color>? borderColors); |   QuoteCardComponent borderColors(MultiColor? borderColors); | ||||||
|   QuoteCardComponent backgroundColors(List<Color>? backgroundColors); |   QuoteCardComponent backgroundColors(MultiColor? 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, | ||||||
|     List<Color>? borderColors, |     MultiColor? borderColors, | ||||||
|     List<Color>? backgroundColors, |     MultiColor? backgroundColors, | ||||||
|     Size? minSize, |     Size? minSize, | ||||||
|     Size? maxSize, |     Size? maxSize, | ||||||
|     BoxShadow? shadow, |     BoxShadow? shadow, | ||||||
|  | |||||||
| @ -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(List<Color>? borderColors); |   SkillCardComponent borderColors(MultiColor? borderColors); | ||||||
|   SkillCardComponent backgroundColors(List<Color>? backgroundColors); |   SkillCardComponent backgroundColors(MultiColor? 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, | ||||||
|     List<Color>? borderColors, |     MultiColor? borderColors, | ||||||
|     List<Color>? backgroundColors, |     MultiColor? backgroundColors, | ||||||
|     Size? minSize, |     Size? minSize, | ||||||
|     Size? maxSize, |     Size? maxSize, | ||||||
|     BoxShadow? shadow, |     BoxShadow? shadow, | ||||||
|  | |||||||
| @ -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(List<Color>? borderColors) => |   InformationCard borderColors(MultiColor? borderColors) => | ||||||
|       this(borderColors: borderColors); |       this(borderColors: borderColors); | ||||||
|   @override |   @override | ||||||
|   InformationCard backgroundColors(List<Color>? backgroundColors) => |   InformationCard backgroundColors(MultiColor? 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, | ||||||
|     List<Color>? borderColors, |     MultiColor? borderColors, | ||||||
|     List<Color>? backgroundColors, |     MultiColor? backgroundColors, | ||||||
|     Size? minSize, |     Size? minSize, | ||||||
|     Size? maxSize, |     Size? maxSize, | ||||||
|     BoxShadow? shadow, |     BoxShadow? shadow, | ||||||
|  | |||||||
| @ -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(List<Color>? borderColors) => |   PortfolioCard borderColors(MultiColor? borderColors) => | ||||||
|       this(borderColors: borderColors); |       this(borderColors: borderColors); | ||||||
|   @override |   @override | ||||||
|   PortfolioCard backgroundColors(List<Color>? backgroundColors) => |   PortfolioCard backgroundColors(MultiColor? 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, | ||||||
|     List<Color>? borderColors, |     MultiColor? borderColors, | ||||||
|     List<Color>? backgroundColors, |     MultiColor? backgroundColors, | ||||||
|     Size? minSize, |     Size? minSize, | ||||||
|     Size? maxSize, |     Size? maxSize, | ||||||
|     BoxShadow? shadow, |     BoxShadow? shadow, | ||||||
|  | |||||||
| @ -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(List<Color>? borderColors) => |   QuoteCard borderColors(MultiColor? borderColors) => | ||||||
|       this(borderColors: borderColors); |       this(borderColors: borderColors); | ||||||
|   @override |   @override | ||||||
|   QuoteCard backgroundColors(List<Color>? backgroundColors) => |   QuoteCard backgroundColors(MultiColor? 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, | ||||||
|     List<Color>? borderColors, |     MultiColor? borderColors, | ||||||
|     List<Color>? backgroundColors, |     MultiColor? backgroundColors, | ||||||
|     Size? minSize, |     Size? minSize, | ||||||
|     Size? maxSize, |     Size? maxSize, | ||||||
|     BoxShadow? shadow, |     BoxShadow? shadow, | ||||||
|  | |||||||
| @ -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(List<Color>? borderColors) => |   SkillCard borderColors(MultiColor? borderColors) => | ||||||
|       this(borderColors: borderColors); |       this(borderColors: borderColors); | ||||||
|   @override |   @override | ||||||
|   SkillCard backgroundColors(List<Color>? backgroundColors) => |   SkillCard backgroundColors(MultiColor? 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, | ||||||
|     List<Color>? borderColors, |     MultiColor? borderColors, | ||||||
|     List<Color>? backgroundColors, |     MultiColor? backgroundColors, | ||||||
|     Size? minSize, |     Size? minSize, | ||||||
|     Size? maxSize, |     Size? maxSize, | ||||||
|     BoxShadow? shadow, |     BoxShadow? shadow, | ||||||
|  | |||||||
| @ -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/src/components/gradients/gradient_box_border.dart'; | import 'package:wyatt_ui_kit/wyatt_ui_kit.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 List<Color>? backgroundColors; |   final MultiColor? backgroundColors; | ||||||
|   final List<Color>? borderColors; |   final MultiColor? 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!.length >= 2) { |     if (backgroundColors != null && backgroundColors!.isGradient) { | ||||||
|       return LinearGradient(colors: backgroundColors!); |       return LinearGradientHelper.fromMultiColor(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!.length == 1) { |     if (backgroundColors != null && backgroundColors!.isColor) { | ||||||
|       return backgroundColors!.first; |       return backgroundColors!.color; | ||||||
|     } else { |     } else { | ||||||
|       final extensionCardColor = |       final extensionCardColor = | ||||||
|           Theme.of(context).extension<CardThemeExtension>(); |           Theme.of(context).extension<CardThemeExtension>(); | ||||||
| @ -101,15 +101,13 @@ class CardWrapper extends StatelessWidget { | |||||||
| 
 | 
 | ||||||
|   BoxBorder? _boxBorder(BuildContext context) { |   BoxBorder? _boxBorder(BuildContext context) { | ||||||
|     if (borderColors != null) { |     if (borderColors != null) { | ||||||
|       if (borderColors!.length >= 2) { |       if (borderColors!.isGradient) { | ||||||
|         return GradientBoxBorder( |         return GradientBoxBorder( | ||||||
|           gradient: LinearGradient( |           gradient: LinearGradientHelper.fromMultiColor(borderColors!), | ||||||
|             colors: borderColors!, |  | ||||||
|           ), |  | ||||||
|         ); |         ); | ||||||
|       } else if (borderColors!.isNotEmpty) { |       } else if (borderColors!.isColor) { | ||||||
|         return Border.all( |         return Border.all( | ||||||
|           color: borderColors!.first, |           color: borderColors!.color, | ||||||
|         ); |         ); | ||||||
|       } |       } | ||||||
|     } else { |     } else { | ||||||
|  | |||||||
| @ -15,3 +15,4 @@ | |||||||
| // 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'; | ||||||
|  | |||||||
| @ -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/>. | ||||||
| 
 | 
 | ||||||
| class ThemeHelper { | abstract 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, | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user