feat(ui_kit): make skillcard header icon customizable

This commit is contained in:
2023-04-12 12:31:00 +00:00
committed by hugo
parent 8d12f84fcc
commit 6f09eeca0e
5 changed files with 43 additions and 44 deletions
@@ -62,7 +62,6 @@ class SkillCard extends SkillCardComponent with $SkillCardCWMixin {
secondaryBackgroundColors: secondaryBackgroundColors,
icon: icon,
title: title,
gradient: gradient,
),
const Gap(25),
if (description != null) ...[
@@ -10,7 +10,7 @@ class $SkillCardCWProxyImpl implements $SkillCardComponentCWProxy {
const $SkillCardCWProxyImpl(this._value);
final SkillCard _value;
@override
SkillCard icon(IconData? icon) => this(icon: icon);
SkillCard icon(Widget? icon) => this(icon: icon);
@override
SkillCard gradient(List<Color>? gradient) => this(gradient: gradient);
@override
@@ -48,7 +48,7 @@ class $SkillCardCWProxyImpl implements $SkillCardComponentCWProxy {
SkillCard key(Key? key) => this(key: key);
@override
SkillCard call({
IconData? icon,
Widget? icon,
List<Color>? gradient,
TextWrapper? title,
TextWrapper? description,
@@ -18,61 +18,38 @@ import 'package:flutter/material.dart';
import 'package:gap/gap.dart';
import 'package:wyatt_ui_components/wyatt_ui_components.dart';
import 'package:wyatt_ui_kit/src/components/cards/widgets/card_text.dart';
import 'package:wyatt_ui_kit/src/components/gradients/gradient_icon.dart';
import 'package:wyatt_ui_kit/src/domain/card_theme_extension.dart';
class SkillCardHeader extends StatelessWidget {
const SkillCardHeader({
super.key,
this.icon,
this.title,
this.gradient,
this.secondaryBackgroundColors,
});
final IconData? icon;
final Widget? icon;
final TextWrapper? title;
final List<Color>? gradient;
final Color? secondaryBackgroundColors;
@override
Widget build(BuildContext context) => Column(
children: [
if (icon != null) ...[
Container(
padding: const EdgeInsets.all(10),
decoration: BoxDecoration(
shape: BoxShape.circle,
color: secondaryBackgroundColors ??
Theme.of(context)
.extension<CardThemeExtension>()
?.secondaryBackgroundColor,
),
child: gradient != null
? GradientIcon(
icon,
size: 45,
gradient: LinearGradient(colors: gradient!),
)
: Icon(
icon,
size: 45,
),
),
icon!,
const Gap(25),
Column(
children: [
if (title != null) ...[
CardText(
title!,
textType: TextType.title,
style: title!.style,
gradientColors: title!.gradientColors,
),
],
],
)
],
Column(
children: [
if (title != null) ...[
CardText(
title!,
textType: TextType.title,
style: title!.style,
gradientColors: title!.gradientColors,
),
],
],
)
],
);
}