feat(ui)!: move last extensions + add extension provider
continuous-integration/drone/pr Build is failing
continuous-integration/drone/pr Build is failing
This commit is contained in:
@@ -54,6 +54,8 @@ class TopAppBar extends TopAppBarComponent with $TopAppBarCWMixin {
|
||||
[
|
||||
backgroundColor,
|
||||
context.themeExtension<TopBarThemeExtension>()?.backgroundColors,
|
||||
TopBarThemeExtensionDefault.from(Theme.of(context))
|
||||
.backgroundColors,
|
||||
],
|
||||
valueValidator: (value) => value?.isGradient,
|
||||
transform: (value) =>
|
||||
@@ -63,7 +65,8 @@ class TopAppBar extends TopAppBarComponent with $TopAppBarCWMixin {
|
||||
[
|
||||
backgroundColor,
|
||||
context.themeExtension<TopBarThemeExtension>()?.backgroundColors,
|
||||
MultiColor.single(Theme.of(context).appBarTheme.backgroundColor),
|
||||
TopBarThemeExtensionDefault.from(Theme.of(context))
|
||||
.backgroundColors,
|
||||
],
|
||||
valueValidator: (value) => value?.isColor,
|
||||
transform: (value) => value?.color,
|
||||
@@ -86,10 +89,8 @@ class TopAppBar extends TopAppBarComponent with $TopAppBarCWMixin {
|
||||
[
|
||||
iconTheme,
|
||||
context.themeExtension<TopBarThemeExtension>()?.iconTheme,
|
||||
Theme.of(context).iconTheme,
|
||||
TopBarThemeExtensionDefault.from(Theme.of(context)).iconTheme,
|
||||
],
|
||||
valueValidator: (value) => value != null,
|
||||
transform: (value) => value,
|
||||
),
|
||||
primary: primary ?? true,
|
||||
excludeHeaderSemantics: excludeHeaderSemantics ?? false,
|
||||
@@ -98,13 +99,12 @@ class TopAppBar extends TopAppBarComponent with $TopAppBarCWMixin {
|
||||
data: title?.data ?? '',
|
||||
style: ThemeHelper.getElement<TextStyle, TextStyle>(
|
||||
[
|
||||
context.textTheme.titleLarge,
|
||||
TopBarThemeExtensionDefault.from(Theme.of(context))
|
||||
.titleStyle,
|
||||
context.themeExtension<TopBarThemeExtension>()?.titleStyle,
|
||||
title?.style,
|
||||
],
|
||||
valueValidator: (value) => value != null,
|
||||
combine: (p0, p1) => p0?.merge(p1),
|
||||
transform: (value) => value,
|
||||
combine: (value, element) => value?.merge(element),
|
||||
),
|
||||
gradientColors: const MultiColor([]),
|
||||
),
|
||||
@@ -118,12 +118,10 @@ class TopAppBar extends TopAppBarComponent with $TopAppBarCWMixin {
|
||||
[
|
||||
context
|
||||
.themeExtension<TopBarThemeExtension>()
|
||||
?.secondaryColor
|
||||
?.withOpacity(0.1),
|
||||
Theme.of(context).dividerColor,
|
||||
?.dividerColor,
|
||||
TopBarThemeExtensionDefault.from(Theme.of(context))
|
||||
.dividerColor,
|
||||
],
|
||||
valueValidator: (value) => value != null,
|
||||
transform: (value) => value,
|
||||
),
|
||||
context: context,
|
||||
tiles: expandedWidget!,
|
||||
|
||||
@@ -58,6 +58,8 @@ class TopNavigationBar extends TopNavigationBarComponent
|
||||
[
|
||||
backgroundColor,
|
||||
context.themeExtension<TopBarThemeExtension>()?.backgroundColors,
|
||||
TopBarThemeExtensionDefault.from(Theme.of(context))
|
||||
.backgroundColors,
|
||||
],
|
||||
valueValidator: (value) => value?.isGradient,
|
||||
transform: (value) =>
|
||||
@@ -67,7 +69,8 @@ class TopNavigationBar extends TopNavigationBarComponent
|
||||
[
|
||||
backgroundColor,
|
||||
context.themeExtension<TopBarThemeExtension>()?.backgroundColors,
|
||||
MultiColor.single(Theme.of(context).appBarTheme.backgroundColor),
|
||||
TopBarThemeExtensionDefault.from(Theme.of(context))
|
||||
.backgroundColors,
|
||||
],
|
||||
valueValidator: (value) => value?.isColor,
|
||||
transform: (value) => value?.color,
|
||||
@@ -89,10 +92,8 @@ class TopNavigationBar extends TopNavigationBarComponent
|
||||
[
|
||||
iconTheme,
|
||||
context.themeExtension<TopBarThemeExtension>()?.iconTheme,
|
||||
Theme.of(context).iconTheme,
|
||||
TopBarThemeExtensionDefault.from(Theme.of(context)).iconTheme,
|
||||
],
|
||||
valueValidator: (value) => value != null,
|
||||
transform: (value) => value,
|
||||
),
|
||||
primary: primary ?? true,
|
||||
excludeHeaderSemantics: excludeHeaderSemantics ?? false,
|
||||
|
||||
@@ -37,35 +37,48 @@ class NavigationItem extends StatelessWidget {
|
||||
[
|
||||
context
|
||||
.themeExtension<TopBarThemeExtension>()
|
||||
?.selectedIndicatorHeight,
|
||||
// TODO(wyatt): move default value
|
||||
5,
|
||||
?.selectedIndicatorSize
|
||||
?.height,
|
||||
TopBarThemeExtensionDefault.from(Theme.of(context))
|
||||
.selectedIndicatorSize
|
||||
?.height,
|
||||
],
|
||||
valueValidator: (value) => value != null,
|
||||
transform: (value) => value,
|
||||
),
|
||||
width: ThemeHelper.getElement<double, double>(
|
||||
[
|
||||
context
|
||||
.themeExtension<TopBarThemeExtension>()
|
||||
?.selectedIndicatorWidth,
|
||||
// TODO(wyatt): move default value
|
||||
70,
|
||||
?.selectedIndicatorSize
|
||||
?.width,
|
||||
TopBarThemeExtensionDefault.from(Theme.of(context))
|
||||
.selectedIndicatorSize
|
||||
?.width,
|
||||
],
|
||||
valueValidator: (value) => value != null,
|
||||
transform: (value) => value,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(100),
|
||||
color: ThemeHelper.getElement<Color, Color>(
|
||||
gradient: ThemeHelper.maybeGetElement<MultiColor, Gradient>(
|
||||
[
|
||||
context
|
||||
.themeExtension<TopBarThemeExtension>()
|
||||
?.secondaryColor,
|
||||
context.colorScheme.primary
|
||||
?.selectedIndicatorColors,
|
||||
TopBarThemeExtensionDefault.from(Theme.of(context))
|
||||
.selectedIndicatorColors
|
||||
],
|
||||
valueValidator: (value) => value != null,
|
||||
transform: (value) => value,
|
||||
valueValidator: (value) => value?.isGradient,
|
||||
transform: (value) =>
|
||||
GradientHelper.linearFromNullableColors(value?.colors),
|
||||
),
|
||||
color: ThemeHelper.getElement<MultiColor, Color>(
|
||||
[
|
||||
context
|
||||
.themeExtension<TopBarThemeExtension>()
|
||||
?.selectedIndicatorColors,
|
||||
TopBarThemeExtensionDefault.from(Theme.of(context))
|
||||
.selectedIndicatorColors
|
||||
],
|
||||
valueValidator: (value) => value?.isColor,
|
||||
transform: (value) => value?.color,
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -75,12 +88,12 @@ class NavigationItem extends StatelessWidget {
|
||||
[
|
||||
context
|
||||
.themeExtension<TopBarThemeExtension>()
|
||||
?.selectedIndicatorWidth,
|
||||
// TODO(wyatt): move default value
|
||||
70,
|
||||
?.selectedIndicatorSize
|
||||
?.width,
|
||||
TopBarThemeExtensionDefault.from(Theme.of(context))
|
||||
.selectedIndicatorSize
|
||||
?.width,
|
||||
],
|
||||
valueValidator: (value) => value != null,
|
||||
transform: (value) => value,
|
||||
),
|
||||
),
|
||||
child: SizedBox(
|
||||
@@ -90,15 +103,14 @@ class NavigationItem extends StatelessWidget {
|
||||
item.data,
|
||||
style: ThemeHelper.getElement<TextStyle, TextStyle>(
|
||||
[
|
||||
context.textTheme.titleMedium,
|
||||
TopBarThemeExtensionDefault.from(Theme.of(context))
|
||||
.subtitleStyle,
|
||||
context
|
||||
.themeExtension<TopBarThemeExtension>()
|
||||
?.subTitleStyle,
|
||||
?.subtitleStyle,
|
||||
item.style,
|
||||
],
|
||||
combine: (value, element) => value?.merge(element),
|
||||
valueValidator: (value) => value != null,
|
||||
transform: (value) => value,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -48,29 +48,18 @@ class Loader extends LoaderComponent with $LoaderCWMixin {
|
||||
[
|
||||
colors,
|
||||
Theme.of(context).extension<LoaderThemeExtension>()?.colors,
|
||||
MultiColor([
|
||||
Theme.of(context).progressIndicatorTheme.color ??
|
||||
context.colorScheme.primary,
|
||||
context.colorScheme.onPrimary,
|
||||
]),
|
||||
|
||||
/// This is the default value. So the final
|
||||
/// value cannot be null.
|
||||
const MultiColor([])
|
||||
LoaderThemeExtensionDefault.from(Theme.of(context)).colors,
|
||||
],
|
||||
valueValidator: (multiColor) =>
|
||||
multiColor != null && multiColor.isColor,
|
||||
transform: (multiColor) => multiColor,
|
||||
),
|
||||
dimension / 2,
|
||||
ThemeHelper.getElement<double, double>(
|
||||
[
|
||||
stroke,
|
||||
Theme.of(context).extension<LoaderThemeExtension>()?.stroke,
|
||||
4,
|
||||
LoaderThemeExtensionDefault.from(Theme.of(context)).stroke,
|
||||
],
|
||||
valueValidator: (stroke) => stroke != null,
|
||||
transform: (stroke) => stroke,
|
||||
),
|
||||
flip: flip ?? false,
|
||||
),
|
||||
|
||||
@@ -45,21 +45,19 @@ class RichTextBuilder extends RichTextBuilderComponent
|
||||
Theme.of(context)
|
||||
.extension<RichTextBuilderThemeExtension>()
|
||||
?.defaultStyle,
|
||||
context.textTheme.bodyMedium,
|
||||
RichTextBuilderThemeExtensionDefault.from(Theme.of(context))
|
||||
.defaultStyle,
|
||||
],
|
||||
valueValidator: (style) => style != null,
|
||||
transform: (style) => style,
|
||||
),
|
||||
ThemeHelper.getElement<Map<String, TextStyle>, Map<String, TextStyle>>(
|
||||
[
|
||||
styles,
|
||||
RichTextBuilderThemeExtensionDefault.from(Theme.of(context)).styles,
|
||||
Theme.of(context)
|
||||
.extension<RichTextBuilderThemeExtension>()
|
||||
?.styles,
|
||||
const <String, TextStyle>{},
|
||||
styles,
|
||||
],
|
||||
valueValidator: (styles) => styles != null,
|
||||
transform: (styles) => styles,
|
||||
combine: (value, element) => value?..addAll(element ?? {}),
|
||||
),
|
||||
null,
|
||||
),
|
||||
|
||||
+26
-18
@@ -17,25 +17,33 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:wyatt_ui_components/wyatt_ui_components.dart';
|
||||
|
||||
abstract class TopBarThemeExtension
|
||||
extends ThemeExtension<TopBarThemeExtension> {
|
||||
const TopBarThemeExtension({
|
||||
this.iconTheme,
|
||||
this.backgroundColors,
|
||||
this.secondaryColor,
|
||||
this.titleStyle,
|
||||
this.subTitleStyle,
|
||||
this.selectedIndicatorHeight,
|
||||
this.selectedIndicatorWidth,
|
||||
class LoaderThemeExtensionImpl extends LoaderThemeExtension {
|
||||
const LoaderThemeExtensionImpl({
|
||||
super.colors,
|
||||
super.stroke,
|
||||
});
|
||||
|
||||
final MultiColor? backgroundColors;
|
||||
final IconThemeData? iconTheme;
|
||||
final Color? secondaryColor;
|
||||
factory LoaderThemeExtensionImpl.light({ThemeData? theme}) {
|
||||
theme ??= ThemeData.light();
|
||||
return const LoaderThemeExtensionImpl(
|
||||
colors: MultiColor([
|
||||
Color(0xFF436EF4),
|
||||
Color(0xFF3C97FB),
|
||||
Colors.transparent,
|
||||
]),
|
||||
stroke: 15,
|
||||
);
|
||||
}
|
||||
|
||||
final TextStyle? titleStyle;
|
||||
final TextStyle? subTitleStyle;
|
||||
|
||||
final double? selectedIndicatorHeight;
|
||||
final double? selectedIndicatorWidth;
|
||||
factory LoaderThemeExtensionImpl.dark({ThemeData? theme}) {
|
||||
theme ??= ThemeData.dark();
|
||||
return const LoaderThemeExtensionImpl(
|
||||
colors: MultiColor([
|
||||
Color(0xFF3C97FB),
|
||||
Color(0xFF436EF4),
|
||||
Colors.transparent,
|
||||
]),
|
||||
stroke: 15,
|
||||
);
|
||||
}
|
||||
}
|
||||
+111
@@ -0,0 +1,111 @@
|
||||
// Copyright (C) 2023 WYATT GROUP
|
||||
// Please see the AUTHORS file for details.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:wyatt_ui_components/wyatt_ui_components.dart';
|
||||
import 'package:wyatt_ui_kit/src/components/gradients/gradient_text_style.dart';
|
||||
|
||||
class RichTextBuilderThemeExtensionImpl extends RichTextBuilderThemeExtension {
|
||||
const RichTextBuilderThemeExtensionImpl({
|
||||
super.defaultStyle,
|
||||
super.styles,
|
||||
});
|
||||
|
||||
factory RichTextBuilderThemeExtensionImpl.dark({ThemeData? theme}) {
|
||||
theme ??= ThemeData.dark();
|
||||
|
||||
return RichTextBuilderThemeExtensionImpl(
|
||||
defaultStyle: theme.textTheme.bodyMedium?.copyWith(
|
||||
height: 1.8,
|
||||
),
|
||||
styles: stylesFor(theme),
|
||||
);
|
||||
}
|
||||
|
||||
factory RichTextBuilderThemeExtensionImpl.light({ThemeData? theme}) {
|
||||
theme ??= ThemeData.light();
|
||||
|
||||
return RichTextBuilderThemeExtensionImpl(
|
||||
defaultStyle: theme.textTheme.bodyMedium?.copyWith(
|
||||
height: 1.8,
|
||||
),
|
||||
styles: stylesFor(theme),
|
||||
);
|
||||
}
|
||||
|
||||
static Map<String, TextStyle> stylesFor(ThemeData theme) => {
|
||||
'gradient-blue': GradientTextStyle.from(
|
||||
theme.textTheme.bodyMedium?.copyWith(
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.w600,
|
||||
height: 1.8,
|
||||
),
|
||||
const MultiColor([
|
||||
Color(0xFF3C97FB),
|
||||
Color(0xFF436EF4),
|
||||
]),
|
||||
),
|
||||
'gradient-red': GradientTextStyle.from(
|
||||
theme.textTheme.bodyMedium?.copyWith(
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.w600,
|
||||
height: 1.8,
|
||||
),
|
||||
const MultiColor([
|
||||
Color(0xFFF44464),
|
||||
Color(0xFFF44464),
|
||||
]),
|
||||
),
|
||||
'gradient-green': GradientTextStyle.from(
|
||||
theme.textTheme.bodyMedium?.copyWith(
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.w600,
|
||||
height: 1.8,
|
||||
),
|
||||
const MultiColor([
|
||||
Color(0xFF00D16C),
|
||||
Color(0xFF00D16C),
|
||||
]),
|
||||
),
|
||||
'blue': theme.textTheme.bodyMedium?.copyWith(
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: const Color(0xFF3C97FB),
|
||||
height: 1.8,
|
||||
) ??
|
||||
const TextStyle(
|
||||
color: Color(0xFF3C97FB),
|
||||
),
|
||||
'red': theme.textTheme.bodyMedium?.copyWith(
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: const Color(0xFFF44464),
|
||||
height: 1.8,
|
||||
) ??
|
||||
const TextStyle(
|
||||
color: Color(0xFFF44464),
|
||||
),
|
||||
'green': theme.textTheme.bodyMedium?.copyWith(
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: const Color(0xFF00D16C),
|
||||
height: 1.8,
|
||||
) ??
|
||||
const TextStyle(
|
||||
color: Color(0xFF00D16C),
|
||||
),
|
||||
};
|
||||
}
|
||||
@@ -16,4 +16,7 @@
|
||||
|
||||
export 'button_theme_extensions/button_theme_extensions.dart';
|
||||
export 'card_theme_extension_impl.dart';
|
||||
export 'loader_theme_extension_impl.dart';
|
||||
export 'rich_text_builder_theme_extension_impl.dart';
|
||||
export 'text_input_theme_extension_impl.dart';
|
||||
export 'top_bar_theme_extension_impl.dart';
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
// Copyright (C) 2023 WYATT GROUP
|
||||
// Please see the AUTHORS file for details.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:wyatt_ui_components/wyatt_ui_components.dart';
|
||||
|
||||
class TopBarThemeExtensionImpl extends TopBarThemeExtension {
|
||||
const TopBarThemeExtensionImpl({
|
||||
super.iconTheme,
|
||||
super.backgroundColors,
|
||||
super.selectedIndicatorColors,
|
||||
super.selectedIndicatorSize,
|
||||
super.dividerColor,
|
||||
super.titleStyle,
|
||||
super.subtitleStyle,
|
||||
});
|
||||
|
||||
factory TopBarThemeExtensionImpl.light({ThemeData? theme}) {
|
||||
theme ??= ThemeData.light();
|
||||
return TopBarThemeExtensionImpl(
|
||||
backgroundColors: const MultiColor.single(
|
||||
Color.fromRGBO(246, 246, 246, 1),
|
||||
),
|
||||
dividerColor: const Color.fromRGBO(36, 38, 42, 0.1),
|
||||
selectedIndicatorColors:
|
||||
const MultiColor.single(Color.fromRGBO(36, 38, 42, 1)),
|
||||
titleStyle: theme.textTheme.bodyMedium?.copyWith(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: const Color.fromRGBO(36, 38, 42, 1),
|
||||
fontSize: 18,
|
||||
),
|
||||
subtitleStyle: theme.textTheme.bodyMedium?.copyWith(
|
||||
fontWeight: FontWeight.w400,
|
||||
color: const Color.fromRGBO(36, 38, 42, 1),
|
||||
fontSize: 18,
|
||||
),
|
||||
iconTheme: const IconThemeData(color: Color.fromRGBO(36, 38, 42, 1)),
|
||||
);
|
||||
}
|
||||
|
||||
factory TopBarThemeExtensionImpl.dark({ThemeData? theme}) {
|
||||
theme ??= ThemeData.dark();
|
||||
return TopBarThemeExtensionImpl(
|
||||
backgroundColors: const MultiColor([
|
||||
Color.fromRGBO(44, 50, 56, 1),
|
||||
Color.fromRGBO(39, 47, 61, 1),
|
||||
Color.fromRGBO(44, 50, 56, 1),
|
||||
]),
|
||||
dividerColor: const Color.fromRGBO(255, 255, 255, 0.1),
|
||||
selectedIndicatorColors: const MultiColor.single(Colors.white),
|
||||
titleStyle: theme.textTheme.bodyMedium?.copyWith(
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 18,
|
||||
),
|
||||
subtitleStyle: theme.textTheme.bodyMedium?.copyWith(
|
||||
fontWeight: FontWeight.w400,
|
||||
fontSize: 18,
|
||||
),
|
||||
iconTheme: const IconThemeData(color: Colors.white),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
// Copyright (C) 2023 WYATT GROUP
|
||||
// Please see the AUTHORS file for details.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
export './loader_theme_extension.dart';
|
||||
export './rich_text_builder_theme_extension.dart';
|
||||
export './text_input_theme_extension.dart';
|
||||
export 'top_bar_theme_extension.dart';
|
||||
@@ -1,32 +0,0 @@
|
||||
// Copyright (C) 2023 WYATT GROUP
|
||||
// Please see the AUTHORS file for details.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:wyatt_ui_components/wyatt_ui_components.dart';
|
||||
|
||||
abstract class LoaderThemeExtension
|
||||
extends ThemeExtension<LoaderThemeExtension> {
|
||||
const LoaderThemeExtension({
|
||||
this.colors,
|
||||
this.stroke,
|
||||
});
|
||||
|
||||
/// Gradient colors from start to end.
|
||||
final MultiColor? colors;
|
||||
|
||||
/// Loader stroke width
|
||||
final double? stroke;
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
// Copyright (C) 2023 WYATT GROUP
|
||||
// Please see the AUTHORS file for details.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
abstract class RichTextBuilderThemeExtension
|
||||
extends ThemeExtension<RichTextBuilderThemeExtension> {
|
||||
const RichTextBuilderThemeExtension({
|
||||
this.defaultStyle,
|
||||
this.styles,
|
||||
});
|
||||
|
||||
/// Default TextStyle used in this rich text component.
|
||||
final TextStyle? defaultStyle;
|
||||
|
||||
/// Used styles in this rich text component.
|
||||
final Map<String, TextStyle>? styles;
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
// Copyright (C) 2023 WYATT GROUP
|
||||
// Please see the AUTHORS file for details.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:wyatt_ui_components/wyatt_ui_components.dart';
|
||||
|
||||
abstract class TextInputThemeExtension
|
||||
extends ThemeExtension<TextInputThemeExtension> {
|
||||
const TextInputThemeExtension({
|
||||
this.normalStyle,
|
||||
this.focusedStyle,
|
||||
this.errorStyle,
|
||||
this.disableStyle,
|
||||
});
|
||||
|
||||
final TextInputStyle? normalStyle;
|
||||
final TextInputStyle? focusedStyle;
|
||||
final TextInputStyle? errorStyle;
|
||||
final TextInputStyle? disableStyle;
|
||||
}
|
||||
@@ -20,7 +20,7 @@ import 'package:wyatt_ui_kit/wyatt_ui_kit.dart';
|
||||
/// {@template wyatt_component_theme_data}
|
||||
/// A class that holds the theme data for the Wyatt UI Kit.
|
||||
/// {@endtemplate}
|
||||
class WyattComponentThemeData {
|
||||
abstract class WyattComponentThemeData {
|
||||
/// {@macro wyatt_component_theme_data}
|
||||
static ComponentThemeData get wyattComponentThemeData => ComponentThemeData(
|
||||
appBar: const TopAppBar(),
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
// Copyright (C) 2023 WYATT GROUP
|
||||
// Please see the AUTHORS file for details.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:wyatt_ui_components/wyatt_ui_components.dart';
|
||||
import 'package:wyatt_ui_kit/wyatt_ui_kit.dart';
|
||||
|
||||
/// {@template wyatt_theme_extensions}
|
||||
/// Wyatt UI Kit theme extensions
|
||||
///
|
||||
/// This class is used to provide the theme extensions for the Wyatt UI Kit.
|
||||
/// {@endtemplate}
|
||||
class WyattThemeExtensions extends ThemeExtensionProvider {
|
||||
/// {@macro wyatt_theme_extensions}
|
||||
const WyattThemeExtensions() : super();
|
||||
|
||||
/// Wyatt UI Kit, light theme extensions
|
||||
static List<ThemeExtension<dynamic>> light({ThemeData? theme}) => [
|
||||
// Cards
|
||||
CardThemeExtensionImpl.light(theme: theme),
|
||||
// Loader
|
||||
LoaderThemeExtensionImpl.light(theme: theme),
|
||||
// RichTextBuilder
|
||||
RichTextBuilderThemeExtensionImpl.light(theme: theme),
|
||||
// Buttons
|
||||
FileSelectionButtonThemeExtensionImpl.light(theme: theme),
|
||||
FlatButtonThemeExtensionImpl.light(theme: theme),
|
||||
SimpleIconButtonThemeExtensionImpl.light(theme: theme),
|
||||
SymbolButtonThemeExtensionImpl.light(theme: theme),
|
||||
// TextInput
|
||||
TextInputThemeExtensionImpl.light(theme: theme),
|
||||
// TopBar
|
||||
TopBarThemeExtensionImpl.light(theme: theme),
|
||||
];
|
||||
|
||||
/// Wyatt UI Kit, dark theme extensions
|
||||
static List<ThemeExtension<dynamic>> dark({ThemeData? theme}) => [
|
||||
// Cards
|
||||
CardThemeExtensionImpl.dark(theme: theme),
|
||||
// Loader
|
||||
LoaderThemeExtensionImpl.dark(theme: theme),
|
||||
// RichTextBuilder
|
||||
RichTextBuilderThemeExtensionImpl.dark(theme: theme),
|
||||
// Buttons
|
||||
FileSelectionButtonThemeExtensionImpl.dark(theme: theme),
|
||||
FlatButtonThemeExtensionImpl.dark(theme: theme),
|
||||
SimpleIconButtonThemeExtensionImpl.dark(theme: theme),
|
||||
SymbolButtonThemeExtensionImpl.dark(theme: theme),
|
||||
// TextInput
|
||||
TextInputThemeExtensionImpl.dark(theme: theme),
|
||||
// TopBar
|
||||
TopBarThemeExtensionImpl.dark(theme: theme),
|
||||
];
|
||||
|
||||
@override
|
||||
List<ThemeExtension<dynamic>> getThemeExtensionsFor(ThemeData theme) =>
|
||||
theme.brightness == Brightness.light
|
||||
? light(theme: theme)
|
||||
: dark(theme: theme);
|
||||
}
|
||||
@@ -17,5 +17,5 @@
|
||||
export 'components/components.dart';
|
||||
export 'core/core.dart';
|
||||
export 'data/data.dart';
|
||||
export 'domain/domain.dart';
|
||||
export 'features/wyatt_component_theme_data.dart';
|
||||
export 'features/wyatt_theme_extensions.dart';
|
||||
|
||||
Reference in New Issue
Block a user