ContentTheme class
A theme for content-driven sites.
The theme provides colors and typography styles for a page. When no theme is provided, the default ContentColors and ContentTypography are used.
Constructors
-
ContentTheme({Color? primary, Color? background, Color? text, List<
ColorToken> colors = const [], FontFamily? font, FontFamily? codeFont, ContentTypography? typography, Iterable<ThemeExtension< extensions = const []})Object?> > - Creates a default theme and applies the provided colors, fonts and styles.
- ContentTheme.none()
-
Disables any theming and styles for the page.
constfactory
-
ContentTheme.raw({List<
ColorToken> colors = const [], FontFamily? font, FontFamily? codeFont, ContentTypography typography = const ContentTypography.none(), Iterable<ThemeExtension< extensions = const [], bool reset = false})Object?> > - Creates an empty theme and applies the provided colors, fonts and styles.
Properties
- codeFont → FontFamily?
-
The font family used for code blocks and similar elements.
final
-
colors
→ List<
ColorToken> -
A set of color tokens for the site.
final
- enabled → bool
-
Whether the theme is enabled. This is false for ContentTheme.none.
final
-
extensions
→ Map<
Object, ThemeExtension< Object?> > -
Arbitrary additions to this theme.
final
- font → FontFamily?
-
The font family used for content on the page.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- reset → bool
-
Whether to apply a set of CSS reset styles to the page.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
styles
→ List<
StyleRule> -
no setter
- typography → ContentTypography
-
The typography styles to use for the content.
final
Methods
-
apply(
{List< ColorToken> ? colors, FontFamily? font, FontFamily? codeFont, ContentTypography? typography, Iterable<ThemeExtension< ? extensions}) → ContentThemeObject?> > -
copyWith(
{List< ColorToken> ? colors, FontFamily? font, FontFamily? codeFont, ContentTypography? typography, Iterable<ThemeExtension< ? extensions}) → ContentThemeObject?> > -
extension<
T> () → T? - Used to obtain a particular ThemeExtension from extensions.
-
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 Properties
- currentCodeFont → FontFamily
-
The current code font family, represented by the
--content-code-fontCSS variable.final - currentFont → FontFamily
-
The current font family, represented by the
--content-fontCSS variable.final - defaultCodeFont → FontFamily
-
The default font family to use for code blocks and similar elements.
final
- defaultFont → FontFamily
-
The default font family to use for the page.
final