WeTheme class
The design tokens used by every Widgets Easier component.
Install it as a ThemeExtension on your ThemeData:
MaterialApp(
theme: ThemeData.light().copyWith(extensions: [WeTheme.light()]),
darkTheme: ThemeData.dark().copyWith(extensions: [WeTheme.dark()]),
)
Components read it with WeTheme.of. When no extension is installed a default palette matching the ambient ThemeData.brightness is used, so the widgets keep working in apps that never configure a theme.
On touch (see interaction) WeTheme.of swaps the standard sizes for WeSizeScheme.touch; custom sizes are left alone.
- Inheritance
-
- Object
- ThemeExtension<
WeTheme> - WeTheme
- Annotations
Constructors
- WeTheme({required WeColorScheme colors, WeSizeScheme sizes = const WeSizeScheme.standard(), WeRadiusScheme radius = const WeRadiusScheme.standard(), WeSpacingScheme spacing = const WeSpacingScheme.standard(), WeShadowScheme shadows = const WeShadowScheme.standard(), WeInteraction interaction = WeInteraction.auto})
-
const
- WeTheme.dark({WeColorScheme colors = const WeColorScheme.dark(), WeSizeScheme sizes = const WeSizeScheme.standard(), WeRadiusScheme radius = const WeRadiusScheme.standard(), WeSpacingScheme spacing = const WeSpacingScheme.standard(), WeShadowScheme shadows = const WeShadowScheme.standard(), WeInteraction interaction = WeInteraction.auto})
-
Dark theme with the default palette.
const
- WeTheme.light({WeColorScheme colors = const WeColorScheme.light(), WeSizeScheme sizes = const WeSizeScheme.standard(), WeRadiusScheme radius = const WeRadiusScheme.standard(), WeSpacingScheme spacing = const WeSpacingScheme.standard(), WeShadowScheme shadows = const WeShadowScheme.standard(), WeInteraction interaction = WeInteraction.auto})
-
Light theme with the default palette.
const
Properties
- colors → WeColorScheme
-
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- interaction → WeInteraction
-
Pointer or touch; WeInteraction.auto decides by platform. Use
WeInteraction.pointer to keep desktop sizes and hover on a phone.
final
- radius → WeRadiusScheme
-
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- shadows → WeShadowScheme
-
final
- sizes → WeSizeScheme
-
final
- spacing → WeSpacingScheme
-
final
- type → Object
-
The extension's type.
no setterinherited
Methods
-
copyWith(
{WeColorScheme? colors, WeSizeScheme? sizes, WeRadiusScheme? radius, WeSpacingScheme? spacing, WeShadowScheme? shadows, WeInteraction? interaction}) → WeTheme -
Creates a copy of this theme extension with the given fields
replaced by the non-null parameter values.
override
-
lerp(
covariant ThemeExtension< WeTheme> ? other, double t) → WeTheme -
Linearly interpolate with another ThemeExtension object.
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
maybeOf(
BuildContext context) → WeTheme? -
The WeTheme installed on the closest Theme, or
null. Unlike of it returns the extension as installed, without touch sizes. -
of(
BuildContext context) → WeTheme - The WeTheme installed on the closest Theme, or a default one that matches the theme's brightness, with touch sizes applied on touch.