FTheme class - forui.theme library (original) (raw)

Applies a theme to descendant widgets.

A theme configures the colors and typographic choices of Forui widgets. The actual configuration is stored in a FThemeData. Descendant widgets obtain the current theme's FThemeData via either FThemeBuildContext.theme, or FTheme.of. When a widget uses either, it is automatically rebuilt if the theme later changes.

class Parent extends StatelessWidget {
  @override
  Widget build(BuildContext context) => FTheme(
     data: FThemes.zinc.light,
     child: Child(),
   );
 }

 class Child extends StatelessWidget {
   @override
   Widget build(BuildContext context) {
     final FThemeData theme = context.theme;
     final FThemeData sameTheme = FTheme.of(context);

     return const Placeholder();
   }
 }

See FThemeData which describes of the actual configuration of a theme.

Properties

childWidget

The widget below this widget in the tree.

final

dataFThemeData

The color and typography values for descendant Forui widgets.

final

hashCodeint

The hash code for this object.

no setterinherited

keyKey?

Controls how one widget replaces another widget in the tree.

finalinherited

runtimeTypeType

A representation of the runtime type of the object.

no setterinherited

textDirectionTextDirection?

The text direction. Defaults to the text direction inherited from its nearest ancestor.

final