fix(ui): use multicolor in cards

This commit is contained in:
2023-02-21 15:17:05 +01:00
parent 5906d54aad
commit 12d04c91ed
12 changed files with 49 additions and 49 deletions
@@ -24,10 +24,10 @@ class $InformationCardCWProxyImpl implements $InformationCardComponentCWProxy {
@override
InformationCard padding(double? padding) => this(padding: padding);
@override
InformationCard borderColors(List<Color>? borderColors) =>
InformationCard borderColors(MultiColor? borderColors) =>
this(borderColors: borderColors);
@override
InformationCard backgroundColors(List<Color>? backgroundColors) =>
InformationCard backgroundColors(MultiColor? backgroundColors) =>
this(backgroundColors: backgroundColors);
@override
InformationCard minSize(Size? minSize) => this(minSize: minSize);
@@ -49,8 +49,8 @@ class $InformationCardCWProxyImpl implements $InformationCardComponentCWProxy {
Axis? axis,
double? radius,
double? padding,
List<Color>? borderColors,
List<Color>? backgroundColors,
MultiColor? borderColors,
MultiColor? backgroundColors,
Size? minSize,
Size? maxSize,
BoxShadow? shadow,
@@ -36,10 +36,10 @@ class $PortfolioCardCWProxyImpl implements $PortfolioCardComponentCWProxy {
@override
PortfolioCard padding(double? padding) => this(padding: padding);
@override
PortfolioCard borderColors(List<Color>? borderColors) =>
PortfolioCard borderColors(MultiColor? borderColors) =>
this(borderColors: borderColors);
@override
PortfolioCard backgroundColors(List<Color>? backgroundColors) =>
PortfolioCard backgroundColors(MultiColor? backgroundColors) =>
this(backgroundColors: backgroundColors);
@override
PortfolioCard minSize(Size? minSize) => this(minSize: minSize);
@@ -64,8 +64,8 @@ class $PortfolioCardCWProxyImpl implements $PortfolioCardComponentCWProxy {
List<Widget>? assets,
double? radius,
double? padding,
List<Color>? borderColors,
List<Color>? backgroundColors,
MultiColor? borderColors,
MultiColor? backgroundColors,
Size? minSize,
Size? maxSize,
BoxShadow? shadow,
@@ -28,10 +28,10 @@ class $QuoteCardCWProxyImpl implements $QuoteCardComponentCWProxy {
@override
QuoteCard padding(double? padding) => this(padding: padding);
@override
QuoteCard borderColors(List<Color>? borderColors) =>
QuoteCard borderColors(MultiColor? borderColors) =>
this(borderColors: borderColors);
@override
QuoteCard backgroundColors(List<Color>? backgroundColors) =>
QuoteCard backgroundColors(MultiColor? backgroundColors) =>
this(backgroundColors: backgroundColors);
@override
QuoteCard minSize(Size? minSize) => this(minSize: minSize);
@@ -54,8 +54,8 @@ class $QuoteCardCWProxyImpl implements $QuoteCardComponentCWProxy {
Widget? rightQuote,
double? radius,
double? padding,
List<Color>? borderColors,
List<Color>? backgroundColors,
MultiColor? borderColors,
MultiColor? backgroundColors,
Size? minSize,
Size? maxSize,
BoxShadow? shadow,
@@ -31,10 +31,10 @@ class $SkillCardCWProxyImpl implements $SkillCardComponentCWProxy {
@override
SkillCard padding(double? padding) => this(padding: padding);
@override
SkillCard borderColors(List<Color>? borderColors) =>
SkillCard borderColors(MultiColor? borderColors) =>
this(borderColors: borderColors);
@override
SkillCard backgroundColors(List<Color>? backgroundColors) =>
SkillCard backgroundColors(MultiColor? backgroundColors) =>
this(backgroundColors: backgroundColors);
@override
SkillCard minSize(Size? minSize) => this(minSize: minSize);
@@ -57,8 +57,8 @@ class $SkillCardCWProxyImpl implements $SkillCardComponentCWProxy {
Color? secondaryBackgroundColors,
double? radius,
double? padding,
List<Color>? borderColors,
List<Color>? backgroundColors,
MultiColor? borderColors,
MultiColor? backgroundColors,
Size? minSize,
Size? maxSize,
BoxShadow? shadow,
@@ -15,9 +15,9 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>.
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/gradients/gradient_box_border.dart';
import 'package:wyatt_ui_kit/src/domain/card_theme_extension.dart';
import 'package:wyatt_ui_kit/wyatt_ui_kit.dart';
class CardWrapper extends StatelessWidget {
CardWrapper({
@@ -34,8 +34,8 @@ class CardWrapper extends StatelessWidget {
final Widget? background;
final Widget child;
final List<Color>? backgroundColors;
final List<Color>? borderColors;
final MultiColor? backgroundColors;
final MultiColor? borderColors;
final BoxShadow? shadow;
final Size? minSize;
final Size? maxSize;
@@ -67,8 +67,8 @@ class CardWrapper extends StatelessWidget {
);
Gradient? _cardGradient(BuildContext context) {
if (backgroundColors != null && backgroundColors!.length >= 2) {
return LinearGradient(colors: backgroundColors!);
if (backgroundColors != null && backgroundColors!.isGradient) {
return LinearGradientHelper.fromMultiColor(backgroundColors!);
} else {
final extensionCardColor =
Theme.of(context).extension<CardThemeExtension>();
@@ -85,8 +85,8 @@ class CardWrapper extends StatelessWidget {
}
Color? _cardColor(BuildContext context) {
if (backgroundColors != null && backgroundColors!.length == 1) {
return backgroundColors!.first;
if (backgroundColors != null && backgroundColors!.isColor) {
return backgroundColors!.color;
} else {
final extensionCardColor =
Theme.of(context).extension<CardThemeExtension>();
@@ -101,15 +101,13 @@ class CardWrapper extends StatelessWidget {
BoxBorder? _boxBorder(BuildContext context) {
if (borderColors != null) {
if (borderColors!.length >= 2) {
if (borderColors!.isGradient) {
return GradientBoxBorder(
gradient: LinearGradient(
colors: borderColors!,
),
gradient: LinearGradientHelper.fromMultiColor(borderColors!),
);
} else if (borderColors!.isNotEmpty) {
} else if (borderColors!.isColor) {
return Border.all(
color: borderColors!.first,
color: borderColors!.color,
);
}
} else {
@@ -15,3 +15,4 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>.
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
// along with super program. If not, see <https://www.gnu.org/licenses/>.
class ThemeHelper {
abstract class ThemeHelper {
static T? getThemeElement<P, T>(
List<P?>? styles, {
required T? Function(P?)? transform,