master #81
@ -11,7 +11,7 @@ class CustomAppBar extends AppBarComponent with $CustomAppBarCWMixin {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) => AppBar(
|
Widget build(BuildContext context) => AppBar(
|
||||||
title: Text(
|
title: Text(
|
||||||
super.title?.text ?? '',
|
super.title?.data ?? '',
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -12,6 +12,6 @@ class CustomErrorWidget extends ErrorWidgetComponent
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) => ColoredBox(
|
Widget build(BuildContext context) => ColoredBox(
|
||||||
color: Colors.red,
|
color: Colors.red,
|
||||||
child: Center(child: Text(error?.text ?? 'Error')),
|
child: Center(child: Text(error?.data ?? 'Error')),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -21,16 +21,87 @@ import 'package:wyatt_ui_components/wyatt_wyatt_ui_components.dart';
|
|||||||
/// a [Text] or a [RichText].
|
/// a [Text] or a [RichText].
|
||||||
class TextWrapper {
|
class TextWrapper {
|
||||||
const TextWrapper(
|
const TextWrapper(
|
||||||
this.text, {
|
this.data, {
|
||||||
this.style,
|
this.style,
|
||||||
this.gradientColors,
|
this.gradientColors,
|
||||||
|
this.textAlign,
|
||||||
|
this.textDirection,
|
||||||
|
this.softWrap,
|
||||||
|
this.overflow,
|
||||||
|
this.maxLines,
|
||||||
|
this.selectionColor,
|
||||||
});
|
});
|
||||||
|
|
||||||
const TextWrapper.text(this.text)
|
const TextWrapper.text(this.data)
|
||||||
: style = null,
|
: style = null,
|
||||||
gradientColors = null;
|
gradientColors = null,
|
||||||
|
textAlign = null,
|
||||||
|
textDirection = null,
|
||||||
|
softWrap = null,
|
||||||
|
overflow = null,
|
||||||
|
maxLines = null,
|
||||||
|
selectionColor = null;
|
||||||
|
|
||||||
final String text;
|
/// Text to be displayed
|
||||||
|
final String data;
|
||||||
|
|
||||||
|
/// Style of the text
|
||||||
final TextStyle? style;
|
final TextStyle? style;
|
||||||
|
|
||||||
|
/// Colors of the gradient, if any
|
||||||
final MultiColor? gradientColors;
|
final MultiColor? gradientColors;
|
||||||
|
|
||||||
|
/// How the text should be aligned horizontally.
|
||||||
|
final TextAlign? textAlign;
|
||||||
|
|
||||||
|
/// The directionality of the text.
|
||||||
|
///
|
||||||
|
/// This decides how [textAlign] values like [TextAlign.start] and
|
||||||
|
/// [TextAlign.end] are interpreted.
|
||||||
|
///
|
||||||
|
/// This is also used to disambiguate how to render bidirectional text. For
|
||||||
|
/// example, if the [data] is an English phrase followed by a Hebrew phrase,
|
||||||
|
/// in a [TextDirection.ltr] context the English phrase will be on the left
|
||||||
|
/// and the Hebrew phrase to its right, while in a [TextDirection.rtl]
|
||||||
|
/// context, the English phrase will be on the right and the Hebrew phrase on
|
||||||
|
/// its left.
|
||||||
|
///
|
||||||
|
/// Defaults to the ambient [Directionality], if any.
|
||||||
|
final TextDirection? textDirection;
|
||||||
|
|
||||||
|
/// Whether the text should break at soft line breaks.
|
||||||
|
///
|
||||||
|
/// If false, the glyphs in the text will be positioned as if there was
|
||||||
|
/// unlimited horizontal space.
|
||||||
|
final bool? softWrap;
|
||||||
|
|
||||||
|
/// How visual overflow should be handled.
|
||||||
|
///
|
||||||
|
/// If this is null [TextStyle.overflow] will be used, otherwise the value
|
||||||
|
/// from the nearest [DefaultTextStyle] ancestor will be used.
|
||||||
|
final TextOverflow? overflow;
|
||||||
|
|
||||||
|
/// An optional maximum number of lines for the text to span, wrapping if
|
||||||
|
/// necessary.
|
||||||
|
/// If the text exceeds the given number of lines, it will be truncated
|
||||||
|
/// according to [overflow].
|
||||||
|
///
|
||||||
|
/// If this is 1, text will not wrap. Otherwise, text will be wrapped at the
|
||||||
|
/// edge of the box.
|
||||||
|
///
|
||||||
|
/// If this is null, but there is an ambient [DefaultTextStyle] that specifies
|
||||||
|
/// an explicit number for its [DefaultTextStyle.maxLines], then the
|
||||||
|
/// [DefaultTextStyle] value will take precedence. You can use a [RichText]
|
||||||
|
/// widget directly to entirely override the [DefaultTextStyle].
|
||||||
|
final int? maxLines;
|
||||||
|
|
||||||
|
/// The color to use when painting the selection.
|
||||||
|
///
|
||||||
|
/// This is ignored if [SelectionContainer.maybeOf] returns null
|
||||||
|
/// in the [BuildContext] of the [Text] widget.
|
||||||
|
///
|
||||||
|
/// If null, the ambient [DefaultSelectionStyle] is used (if any); failing
|
||||||
|
/// that, the selection color defaults to [DefaultSelectionStyle.defaultColor]
|
||||||
|
/// (semi-transparent grey).
|
||||||
|
final Color? selectionColor;
|
||||||
}
|
}
|
||||||
|
@ -182,8 +182,14 @@ class FileSelectionButtonScreen
|
|||||||
/// More infos in `ThemeResolver` class
|
/// More infos in `ThemeResolver` class
|
||||||
if (title != null) ...[
|
if (title != null) ...[
|
||||||
Text(
|
Text(
|
||||||
title!.text,
|
title!.data,
|
||||||
style: title!.style ?? style.title,
|
style: title!.style ?? style.title,
|
||||||
|
textAlign: title!.textAlign,
|
||||||
|
textDirection: title!.textDirection,
|
||||||
|
softWrap: title!.softWrap,
|
||||||
|
overflow: title!.overflow,
|
||||||
|
maxLines: title!.maxLines,
|
||||||
|
selectionColor: title!.selectionColor,
|
||||||
).toGradient(
|
).toGradient(
|
||||||
gradientColors: style.foregroundColors,
|
gradientColors: style.foregroundColors,
|
||||||
),
|
),
|
||||||
@ -203,8 +209,14 @@ class FileSelectionButtonScreen
|
|||||||
if (subTitle != null) ...[
|
if (subTitle != null) ...[
|
||||||
const Gap(5),
|
const Gap(5),
|
||||||
Text(
|
Text(
|
||||||
subTitle!.text,
|
subTitle!.data,
|
||||||
style: subTitle!.style ?? style.subTitle,
|
style: subTitle!.style ?? style.subTitle,
|
||||||
|
textAlign: title!.textAlign,
|
||||||
|
textDirection: title!.textDirection,
|
||||||
|
softWrap: title!.softWrap,
|
||||||
|
overflow: title!.overflow,
|
||||||
|
maxLines: title!.maxLines,
|
||||||
|
selectionColor: title!.selectionColor,
|
||||||
).toGradient(
|
).toGradient(
|
||||||
gradientColors: style.foregroundColors,
|
gradientColors: style.foregroundColors,
|
||||||
),
|
),
|
||||||
|
@ -180,8 +180,14 @@ class FlatButtonScreen extends CubitScreen<ButtonCubit, ButtonState> {
|
|||||||
/// More infos in ThemeResolver class
|
/// More infos in ThemeResolver class
|
||||||
if (label != null) ...[
|
if (label != null) ...[
|
||||||
Text(
|
Text(
|
||||||
label!.text,
|
label!.data,
|
||||||
style: label!.style ?? style.label,
|
style: label!.style ?? style.label,
|
||||||
|
textAlign: label!.textAlign,
|
||||||
|
textDirection: label!.textDirection,
|
||||||
|
softWrap: label!.softWrap,
|
||||||
|
overflow: label!.overflow,
|
||||||
|
maxLines: label!.maxLines,
|
||||||
|
selectionColor: label!.selectionColor,
|
||||||
).toGradient(
|
).toGradient(
|
||||||
gradientColors: style.foregroundColors,
|
gradientColors: style.foregroundColors,
|
||||||
)
|
)
|
||||||
|
@ -193,8 +193,14 @@ class SymbolButtonScreen
|
|||||||
if (label != null) ...[
|
if (label != null) ...[
|
||||||
Gap(style.padding?.horizontal ?? 10),
|
Gap(style.padding?.horizontal ?? 10),
|
||||||
Text(
|
Text(
|
||||||
label!.text,
|
label!.data,
|
||||||
style: label!.style ?? style.label,
|
style: label!.style ?? style.label,
|
||||||
|
textAlign: label!.textAlign,
|
||||||
|
textDirection: label!.textDirection,
|
||||||
|
softWrap: label!.softWrap,
|
||||||
|
overflow: label!.overflow,
|
||||||
|
maxLines: label!.maxLines,
|
||||||
|
selectionColor: label!.selectionColor,
|
||||||
).toGradient(
|
).toGradient(
|
||||||
gradientColors: style.foregroundColors,
|
gradientColors: style.foregroundColors,
|
||||||
),
|
),
|
||||||
|
@ -77,7 +77,7 @@ class InformationCard extends InformationCardComponent
|
|||||||
if (body != null) ...[
|
if (body != null) ...[
|
||||||
const Gap(_bodyTopSpacing),
|
const Gap(_bodyTopSpacing),
|
||||||
CardText(
|
CardText(
|
||||||
body!.text,
|
body!,
|
||||||
textType: TextType.body,
|
textType: TextType.body,
|
||||||
style: body!.style,
|
style: body!.style,
|
||||||
gradientColors: body!.gradientColors,
|
gradientColors: body!.gradientColors,
|
||||||
|
@ -41,7 +41,7 @@ class InformationCardTitles extends StatelessWidget {
|
|||||||
children: [
|
children: [
|
||||||
if (title != null) ...[
|
if (title != null) ...[
|
||||||
CardText(
|
CardText(
|
||||||
title!.text,
|
title!,
|
||||||
textType: TextType.title,
|
textType: TextType.title,
|
||||||
style: title!.style,
|
style: title!.style,
|
||||||
gradientColors: title!.gradientColors,
|
gradientColors: title!.gradientColors,
|
||||||
@ -50,7 +50,7 @@ class InformationCardTitles extends StatelessWidget {
|
|||||||
if (subtitle != null) ...[
|
if (subtitle != null) ...[
|
||||||
const Gap(_titlesLineSpacing),
|
const Gap(_titlesLineSpacing),
|
||||||
CardText(
|
CardText(
|
||||||
subtitle!.text,
|
subtitle!,
|
||||||
textType: TextType.subtitle,
|
textType: TextType.subtitle,
|
||||||
style: subtitle!.style,
|
style: subtitle!.style,
|
||||||
gradientColors: subtitle!.gradientColors,
|
gradientColors: subtitle!.gradientColors,
|
||||||
|
@ -70,7 +70,7 @@ class PortfolioCard extends PortfolioCardComponent with $PortfolioCardCWMixin {
|
|||||||
const Gap(20),
|
const Gap(20),
|
||||||
],
|
],
|
||||||
CardText(
|
CardText(
|
||||||
description!.text,
|
description!,
|
||||||
textType: TextType.body,
|
textType: TextType.body,
|
||||||
style: description!.style,
|
style: description!.style,
|
||||||
gradientColors: description!.gradientColors,
|
gradientColors: description!.gradientColors,
|
||||||
@ -105,7 +105,7 @@ class PortfolioCard extends PortfolioCardComponent with $PortfolioCardCWMixin {
|
|||||||
const Gap(20),
|
const Gap(20),
|
||||||
],
|
],
|
||||||
CardText(
|
CardText(
|
||||||
description!.text,
|
description!,
|
||||||
textType: TextType.body,
|
textType: TextType.body,
|
||||||
style: description!.style,
|
style: description!.style,
|
||||||
gradientColors: description!.gradientColors,
|
gradientColors: description!.gradientColors,
|
||||||
|
@ -64,7 +64,7 @@ class PortfolioCardHeader extends StatelessWidget {
|
|||||||
children: [
|
children: [
|
||||||
if (keyword != null)
|
if (keyword != null)
|
||||||
...keyword!.map(
|
...keyword!.map(
|
||||||
(e) => Container(
|
(word) => Container(
|
||||||
margin: const EdgeInsets.all(3),
|
margin: const EdgeInsets.all(3),
|
||||||
padding: const EdgeInsets.all(6),
|
padding: const EdgeInsets.all(6),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
@ -75,8 +75,14 @@ class PortfolioCardHeader extends StatelessWidget {
|
|||||||
borderRadius: BorderRadius.circular(8),
|
borderRadius: BorderRadius.circular(8),
|
||||||
),
|
),
|
||||||
child: Text(
|
child: Text(
|
||||||
e.text,
|
word.data,
|
||||||
style: e.style ?? context.textTheme.bodySmall,
|
style: word.style ?? context.textTheme.bodySmall,
|
||||||
|
textAlign: word.textAlign,
|
||||||
|
textDirection: word.textDirection,
|
||||||
|
softWrap: word.softWrap,
|
||||||
|
overflow: word.overflow,
|
||||||
|
maxLines: word.maxLines,
|
||||||
|
selectionColor: word.selectionColor,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -71,7 +71,7 @@ class QuoteCard extends QuoteCardComponent with $QuoteCardCWMixin {
|
|||||||
),
|
),
|
||||||
if (quote != null) ...[
|
if (quote != null) ...[
|
||||||
CardText(
|
CardText(
|
||||||
quote!.text,
|
quote!,
|
||||||
textType: TextType.body,
|
textType: TextType.body,
|
||||||
style: quote!.style,
|
style: quote!.style,
|
||||||
gradientColors: quote!.gradientColors,
|
gradientColors: quote!.gradientColors,
|
||||||
@ -102,7 +102,7 @@ class QuoteCard extends QuoteCardComponent with $QuoteCardCWMixin {
|
|||||||
children: [
|
children: [
|
||||||
if (name != null) ...[
|
if (name != null) ...[
|
||||||
CardText(
|
CardText(
|
||||||
name!.text,
|
name!,
|
||||||
textType: TextType.body,
|
textType: TextType.body,
|
||||||
style: name!.style,
|
style: name!.style,
|
||||||
gradientColors: name!.gradientColors,
|
gradientColors: name!.gradientColors,
|
||||||
@ -110,7 +110,7 @@ class QuoteCard extends QuoteCardComponent with $QuoteCardCWMixin {
|
|||||||
],
|
],
|
||||||
if (subtitle != null) ...[
|
if (subtitle != null) ...[
|
||||||
CardText(
|
CardText(
|
||||||
subtitle!.text,
|
subtitle!,
|
||||||
textType: TextType.subtitle,
|
textType: TextType.subtitle,
|
||||||
style: subtitle!.style,
|
style: subtitle!.style,
|
||||||
gradientColors: subtitle!.gradientColors,
|
gradientColors: subtitle!.gradientColors,
|
||||||
|
@ -67,7 +67,7 @@ class SkillCard extends SkillCardComponent with $SkillCardCWMixin {
|
|||||||
const Gap(25),
|
const Gap(25),
|
||||||
if (description != null) ...[
|
if (description != null) ...[
|
||||||
CardText(
|
CardText(
|
||||||
description!.text,
|
description!,
|
||||||
textType: TextType.body,
|
textType: TextType.body,
|
||||||
style: description!.style,
|
style: description!.style,
|
||||||
gradientColors: description!.gradientColors,
|
gradientColors: description!.gradientColors,
|
||||||
|
@ -64,7 +64,7 @@ class SkillCardHeader extends StatelessWidget {
|
|||||||
children: [
|
children: [
|
||||||
if (title != null) ...[
|
if (title != null) ...[
|
||||||
CardText(
|
CardText(
|
||||||
title!.text,
|
title!,
|
||||||
textType: TextType.title,
|
textType: TextType.title,
|
||||||
style: title!.style,
|
style: title!.style,
|
||||||
gradientColors: title!.gradientColors,
|
gradientColors: title!.gradientColors,
|
||||||
|
@ -37,7 +37,7 @@ class SkillCardSkills extends StatelessWidget {
|
|||||||
Widget build(BuildContext context) => Column(
|
Widget build(BuildContext context) => Column(
|
||||||
children: skills!
|
children: skills!
|
||||||
.map(
|
.map(
|
||||||
(e) => Row(
|
(skill) => Row(
|
||||||
children: [
|
children: [
|
||||||
Icon(
|
Icon(
|
||||||
leadingIcon ?? Icons.check,
|
leadingIcon ?? Icons.check,
|
||||||
@ -47,10 +47,10 @@ class SkillCardSkills extends StatelessWidget {
|
|||||||
const Gap(10),
|
const Gap(10),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: CardText(
|
child: CardText(
|
||||||
e.text,
|
skill,
|
||||||
textType: TextType.body,
|
textType: TextType.body,
|
||||||
style: e.style,
|
style: skill.style,
|
||||||
gradientColors: e.gradientColors,
|
gradientColors: skill.gradientColors,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
@ -26,16 +26,17 @@ enum TextType {
|
|||||||
|
|
||||||
class CardText extends StatelessWidget {
|
class CardText extends StatelessWidget {
|
||||||
const CardText(
|
const CardText(
|
||||||
this.data, {
|
this.text, {
|
||||||
required this.textType,
|
required this.textType,
|
||||||
this.style,
|
this.style,
|
||||||
this.gradientColors,
|
this.gradientColors,
|
||||||
super.key,
|
super.key,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
final TextWrapper text;
|
||||||
final TextType textType;
|
final TextType textType;
|
||||||
final TextStyle? style;
|
final TextStyle? style;
|
||||||
final MultiColor? gradientColors;
|
final MultiColor? gradientColors;
|
||||||
final String data;
|
|
||||||
|
|
||||||
TextStyle? _getStyle(BuildContext context) {
|
TextStyle? _getStyle(BuildContext context) {
|
||||||
if (style != null) {
|
if (style != null) {
|
||||||
@ -56,7 +57,13 @@ class CardText extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) => Text(
|
Widget build(BuildContext context) => Text(
|
||||||
data,
|
text.data,
|
||||||
style: _getStyle(context),
|
style: _getStyle(context),
|
||||||
|
textAlign: text.textAlign,
|
||||||
|
textDirection: text.textDirection,
|
||||||
|
softWrap: text.softWrap,
|
||||||
|
overflow: text.overflow,
|
||||||
|
maxLines: text.maxLines,
|
||||||
|
selectionColor: text.selectionColor,
|
||||||
).toGradient(gradientColors: gradientColors);
|
).toGradient(gradientColors: gradientColors);
|
||||||
}
|
}
|
||||||
|
@ -315,14 +315,14 @@ class TextInputScreen extends CubitScreen<TextInputCubit, TextInputState> {
|
|||||||
labelStyle: style.labelStyle,
|
labelStyle: style.labelStyle,
|
||||||
)
|
)
|
||||||
: null,
|
: null,
|
||||||
hintText: hint?.text,
|
hintText: hint?.data,
|
||||||
hintStyle: hint?.style,
|
hintStyle: hint?.style,
|
||||||
prefixIcon: prefixIcon,
|
prefixIcon: prefixIcon,
|
||||||
prefixText: prefixText?.text,
|
prefixText: prefixText?.data,
|
||||||
prefixStyle: prefixText?.style,
|
prefixStyle: prefixText?.style,
|
||||||
prefixIconColor: style.prefixIconColor,
|
prefixIconColor: style.prefixIconColor,
|
||||||
suffixIcon: suffixIcon,
|
suffixIcon: suffixIcon,
|
||||||
suffixText: suffixText?.text,
|
suffixText: suffixText?.data,
|
||||||
suffixStyle: suffixText?.style,
|
suffixStyle: suffixText?.style,
|
||||||
suffixIconColor: style.suffixIconColor,
|
suffixIconColor: style.suffixIconColor,
|
||||||
enabled: state.controlState != ControlState.disabled,
|
enabled: state.controlState != ControlState.disabled,
|
||||||
|
@ -31,7 +31,13 @@ class LabelWidget extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) => Text(
|
Widget build(BuildContext context) => Text(
|
||||||
label?.text ?? '',
|
label?.data ?? '',
|
||||||
style: labelStyle,
|
style: labelStyle,
|
||||||
|
textAlign: label!.textAlign,
|
||||||
|
textDirection: label!.textDirection,
|
||||||
|
softWrap: label!.softWrap,
|
||||||
|
overflow: label!.overflow,
|
||||||
|
maxLines: label!.maxLines,
|
||||||
|
selectionColor: label!.selectionColor,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user