shared_theme_flutter library

Flutter plugin to easily share a theme between Flutter and the web.

It is recommended you import this library using 'as': import ... as themer;.

Classes

Border
A border has four BorderSides and four corners, each a BorderRadius.
BorderRadius
A corner of a Border.
BorderSide
One side of a Border.
BorderStyle
An enum-like class.
BoxSpacing
Such as margins or padding.
Brightness
An enum-like class.
Color
A color in the red-green-blue scheme with optional alpha.
Colors
Material design Font colors with opacity.
ColorSet
The named colors in a theme.
ContrastingColors
A color and its contrast. [...]
Element
An abstract container with commonly used properties such as color, font, margin, padding, border, shadow, text align, and size constraints. [...]
ElementSet
The named elements in a theme.
Font
Font properties that can be mapped to Flutter and CSS.
FontFace
A CSS @font-face definition.
FontFormat
The types of formats a FontFace can have.
FontSet
The named fonts in a theme.
FontStyle
Italic or not.
ShadowElevation
Valid material elevations in dp.
SizeLimits
Height and width min/max limits. Defaults to unlimited.
TextAlign
How text should be aligned in a container, e.g. an Element.
TextDecoration
Underline, line-through, solid, dashed, color, etc.
TextDecorationLine
A the types of lines that can be in a TextDecoration.
TextDecorationStyle
An enum-like class.
Theme
The colors, fonts, and elements in a theme.
ThemeSet
A collection of themes and font-faces.

Properties

currentTheme Theme
The current theme is used by primaryButton(), secondaryButton(), tertiaryButton(), and wrapInput() to lookup the related elements. [...]
read / write

Functions

borderRadius(Border border, [ BorderRadius fallback ]) BorderRadius
Translate between a shared_theme BorderRadius and a Futter BorderRadius, in a null-safe manner.
borderSide(BorderSide side) BorderSide
Translate between a shared_theme BorderSide and a Futter BorderSide.
borderStyle(BorderStyle style) BorderStyle
Translate between a shared_theme BorderStyle and a Futter BorderStyle.
buttonTextTheme(Theme theme, [ Element button ]) ButtonTextTheme
Get a button's text theme, using the theme's primary button by default.
buttonTheme(Theme theme, Element button, ButtonThemeData fallback) ButtonThemeData
Transform a shared_theme Element, based on theme.
buttonWidget(Element button, void onPressed(), { String text, Widget child }) Widget
Helper function to translate a shared_theme Element into a Flutter RaisedButton, which will be wrapped in Padding if the Element's margin is non-zero.
color(Color c, [ Color fallback ]) Color
Get a Flutter Color from a shared_theme Color. [...]
colorOf(ContrastingColors colors, [ Color fallback ]) Color
Get the primary color from a pair of contrasting colors.
contrastOf(ContrastingColors colors, [ Color fallback ]) Color
Get the contrast color from a pair of contrasting colors.
edgeInsets(BoxSpacing spacing, [ EdgeInsets fallback ]) EdgeInsets
Transform a shared_theme BoxSpacing into EdgeInsets, in a null-safe manner.
fontStyle(FontStyle style, [ FontStyle fallback ]) FontStyle
Translates between a shared_theme FontStyle and a Flutter FontStyle, in a null-safe manner.
fontWeight(int weight, [ FontWeight fallback ]) FontWeight
Translates between a weight integer and a Flutter FontWeight, in a null-safe manner.
inputBorder(Border border, [ InputBorder fallback ]) InputBorder
Transforms a shared_theme Border into a Flutter InputBorder, in a null-safe manner.
inputDecorationTheme(Element input, [ InputDecorationTheme fallback ]) InputDecorationTheme
Transforms a shared_theme Element into a Flutter InputDecorationTheme. Uses the Element's font to create a labelStyle.
primaryButton(void onPressed(), { String text, Widget child }) Widget
Get the current theme's primary button, using text if child is null.
radius(BorderRadius radius) Radius
Translate between a shared_theme BorderRadius and a Futter Radius, in a null-safe manner.
secondaryButton(void onPressed(), { String text, Widget child }) Widget
Get the current theme's secondary button, using text if child is null.
setTheme(Theme theme) → void
Set currentTheme directly.
shapeBorder(Element el, [ ShapeBorder fallback ]) ShapeBorder
Transform a shared_theme Element into a ShapeBorder, returning fallback if el.border is null.
tertiaryButton(void onPressed(), { String text, Widget child }) Widget
Get the current theme's tertiary button, using text if child is null.
textDecoration(TextDecoration decoration, [ TextDecoration fallback ]) TextDecoration
Translates between a shared_theme TextDecoration and a Flutter TextDecoration, in a null-safe manner.
textDecorationLine(TextDecorationLine line) TextDecoration
Translates between a shared_theme TextDecorationLine and a Flutter TextDecoration.
textDecorationStyle(TextDecorationStyle style, [ TextDecorationStyle fallback ]) TextDecorationStyle
Translates between a shared_theme TextDecorationStyle and a Flutter TextDecorationStyle, in a null-safe manner.
textStyle(Font font, [ TextStyle base ]) TextStyle
Translates between a shared_theme Font and a Flutter TextStyle, in a null-safe manner.
textStyleColored(Font font, Color color, [ TextStyle base ]) TextStyle
Helper function to use textStyle() and change the resultant color.
textTheme(TextTheme base, Theme t) TextTheme
Creates a TextTheme from a shared_theme Theme.
themeData(Theme t, [ TargetPlatform platform ]) ThemeData
Transform a shared_theme's Theme into Flutter's ThemeData.
wrap(Widget child, BoxSpacing margin) Widget
Wraps child in Padding if margin is non-zero.
wrapInput(Widget input) Widget
Wrap a widget in padding if currentTheme.elements.inputBase.margin is non-zero.