master #81
@ -15,6 +15,7 @@
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
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';
|
||||
|
||||
abstract class CardComponent extends Component {
|
||||
@ -41,10 +42,10 @@ abstract class CardComponent extends Component {
|
||||
final double? padding;
|
||||
|
||||
/// Border gradient color (from left to right)
|
||||
final List<Color>? borderColors;
|
||||
final MultiColor? borderColors;
|
||||
|
||||
/// Card background color
|
||||
final List<Color>? backgroundColors;
|
||||
final MultiColor? backgroundColors;
|
||||
|
||||
/// Minimum size for this card
|
||||
final Size? minSize;
|
||||
|
@ -14,8 +14,8 @@ abstract class $InformationCardComponentCWProxy {
|
||||
InformationCardComponent axis(Axis? axis);
|
||||
InformationCardComponent radius(double? radius);
|
||||
InformationCardComponent padding(double? padding);
|
||||
InformationCardComponent borderColors(List<Color>? borderColors);
|
||||
InformationCardComponent backgroundColors(List<Color>? backgroundColors);
|
||||
InformationCardComponent borderColors(MultiColor? borderColors);
|
||||
InformationCardComponent backgroundColors(MultiColor? backgroundColors);
|
||||
InformationCardComponent minSize(Size? minSize);
|
||||
InformationCardComponent maxSize(Size? maxSize);
|
||||
InformationCardComponent shadow(BoxShadow? shadow);
|
||||
@ -29,8 +29,8 @@ abstract class $InformationCardComponentCWProxy {
|
||||
Axis? axis,
|
||||
double? radius,
|
||||
double? padding,
|
||||
List<Color>? borderColors,
|
||||
List<Color>? backgroundColors,
|
||||
MultiColor? borderColors,
|
||||
MultiColor? backgroundColors,
|
||||
Size? minSize,
|
||||
Size? maxSize,
|
||||
BoxShadow? shadow,
|
||||
|
@ -19,8 +19,8 @@ abstract class $PortfolioCardComponentCWProxy {
|
||||
PortfolioCardComponent assets(List<Widget>? assets);
|
||||
PortfolioCardComponent radius(double? radius);
|
||||
PortfolioCardComponent padding(double? padding);
|
||||
PortfolioCardComponent borderColors(List<Color>? borderColors);
|
||||
PortfolioCardComponent backgroundColors(List<Color>? backgroundColors);
|
||||
PortfolioCardComponent borderColors(MultiColor? borderColors);
|
||||
PortfolioCardComponent backgroundColors(MultiColor? backgroundColors);
|
||||
PortfolioCardComponent minSize(Size? minSize);
|
||||
PortfolioCardComponent maxSize(Size? maxSize);
|
||||
PortfolioCardComponent shadow(BoxShadow? shadow);
|
||||
@ -38,8 +38,8 @@ abstract class $PortfolioCardComponentCWProxy {
|
||||
List<Widget>? assets,
|
||||
double? radius,
|
||||
double? padding,
|
||||
List<Color>? borderColors,
|
||||
List<Color>? backgroundColors,
|
||||
MultiColor? borderColors,
|
||||
MultiColor? backgroundColors,
|
||||
Size? minSize,
|
||||
Size? maxSize,
|
||||
BoxShadow? shadow,
|
||||
|
@ -16,8 +16,8 @@ abstract class $QuoteCardComponentCWProxy {
|
||||
QuoteCardComponent rightQuote(Widget? rightQuote);
|
||||
QuoteCardComponent radius(double? radius);
|
||||
QuoteCardComponent padding(double? padding);
|
||||
QuoteCardComponent borderColors(List<Color>? borderColors);
|
||||
QuoteCardComponent backgroundColors(List<Color>? backgroundColors);
|
||||
QuoteCardComponent borderColors(MultiColor? borderColors);
|
||||
QuoteCardComponent backgroundColors(MultiColor? backgroundColors);
|
||||
QuoteCardComponent minSize(Size? minSize);
|
||||
QuoteCardComponent maxSize(Size? maxSize);
|
||||
QuoteCardComponent shadow(BoxShadow? shadow);
|
||||
@ -33,8 +33,8 @@ abstract class $QuoteCardComponentCWProxy {
|
||||
Widget? rightQuote,
|
||||
double? radius,
|
||||
double? padding,
|
||||
List<Color>? borderColors,
|
||||
List<Color>? backgroundColors,
|
||||
MultiColor? borderColors,
|
||||
MultiColor? backgroundColors,
|
||||
Size? minSize,
|
||||
Size? maxSize,
|
||||
BoxShadow? shadow,
|
||||
|
@ -17,8 +17,8 @@ abstract class $SkillCardComponentCWProxy {
|
||||
Color? secondaryBackgroundColors);
|
||||
SkillCardComponent radius(double? radius);
|
||||
SkillCardComponent padding(double? padding);
|
||||
SkillCardComponent borderColors(List<Color>? borderColors);
|
||||
SkillCardComponent backgroundColors(List<Color>? backgroundColors);
|
||||
SkillCardComponent borderColors(MultiColor? borderColors);
|
||||
SkillCardComponent backgroundColors(MultiColor? backgroundColors);
|
||||
SkillCardComponent minSize(Size? minSize);
|
||||
SkillCardComponent maxSize(Size? maxSize);
|
||||
SkillCardComponent shadow(BoxShadow? shadow);
|
||||
@ -34,8 +34,8 @@ abstract class $SkillCardComponentCWProxy {
|
||||
Color? secondaryBackgroundColors,
|
||||
double? radius,
|
||||
double? padding,
|
||||
List<Color>? borderColors,
|
||||
List<Color>? backgroundColors,
|
||||
MultiColor? borderColors,
|
||||
MultiColor? backgroundColors,
|
||||
Size? minSize,
|
||||
Size? maxSize,
|
||||
BoxShadow? shadow,
|
||||
|
@ -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,
|
||||
|
Loading…
x
Reference in New Issue
Block a user