MacosThemeData class

Defines the configuration of the overall visual MacosTheme for a MacosApp or a widget subtree within the app.

The MacosApp theme property can be used to configure the appearance of the entire app. A widget's subtree within an app can override the app's theme by including a MacosTheme widget at the top of the subtree.

Widgets whose appearance should align with the overall theme can obtain the current theme's configuration with MacosTheme.of.

{@tool snippet} In this example, the Container widget uses MacosTheme.of to retrieve the primary color from the theme's primaryColor to draw a blue square. The Builder widget separates the parent theme's BuildContext from the child's BuildContext.

MacosTheme(
  data: MacosThemeData(
    primaryColor: CupertinoColors.activeBlue,
  ),
  child: Builder(
    builder: (BuildContext context) {
      return Container(
        width: 100,
        height: 100,
        color: MacosTheme.of(context).primaryColor,
      );
    },
  ),
)

{@end-tool}

See also:

Mixed in types

Constructors

MacosThemeData({Brightness? brightness, Color? primaryColor, Color? canvasColor, MacosTypography? typography, PushButtonThemeData? pushButtonTheme, Color? dividerColor, HelpButtonThemeData? helpButtonTheme, MacosTooltipThemeData? tooltipTheme, VisualDensity? visualDensity, MacosScrollbarThemeData? scrollbarTheme, MacosIconButtonThemeData? macosIconButtonTheme, MacosIconThemeData? iconTheme, MacosPopupButtonThemeData? popupButtonTheme, MacosPulldownButtonThemeData? pulldownButtonTheme, MacosDatePickerThemeData? datePickerTheme, MacosTimePickerThemeData? timePickerTheme, MacosSearchFieldThemeData? searchFieldTheme})
Creates a MacosThemeData that's used to configure MacosTheme.
factory
MacosThemeData.dark()
A default dark theme.
factory
MacosThemeData.fallback()
The default color theme. Same as ThemeData.light.
factory
MacosThemeData.light()
A default light theme.
factory
MacosThemeData.raw({required Brightness brightness, required Color primaryColor, required Color canvasColor, required MacosTypography typography, required PushButtonThemeData pushButtonTheme, required Color dividerColor, required HelpButtonThemeData helpButtonTheme, required MacosTooltipThemeData tooltipTheme, required VisualDensity visualDensity, required MacosScrollbarThemeData scrollbarTheme, required MacosIconButtonThemeData iconButtonTheme, required MacosIconThemeData iconTheme, required MacosPopupButtonThemeData popupButtonTheme, required MacosPulldownButtonThemeData pulldownButtonTheme, required MacosDatePickerThemeData datePickerTheme, required MacosTimePickerThemeData timePickerTheme, required MacosSearchFieldThemeData searchFieldTheme})
Create a MacosThemeData given a set of exact values. All the values must be specified. They all must also be non-null.
const

Properties

brightness Brightness
The overall theme brightness.
final
canvasColor Color
The default color of Scaffold backgrounds.
final
datePickerTheme MacosDatePickerThemeData
The default style for MacosDatePickers below the overall MacosTheme
final
dividerColor Color
The color to use when painting the line used for the TitleBar bottom, Sidebar and ResizableBar sides
final
hashCode int
The hash code for this object.
no setterinherited
helpButtonTheme HelpButtonThemeData
The default style for HelpButtons below the overall MacosTheme.
final
iconButtonTheme MacosIconButtonThemeData
The default style for MacosIconButtons below the overall MacosTheme
final
iconTheme MacosIconThemeData
The default style for MacosIcons below the overall MacosTheme
final
popupButtonTheme MacosPopupButtonThemeData
The default style for MacosPopupButtons below the overall MacosTheme
final
primaryColor Color
A color used on primary interactive elements of the theme.
final
pulldownButtonTheme MacosPulldownButtonThemeData
The default style for MacosPulldownButtons below the overall MacosTheme
final
pushButtonTheme PushButtonThemeData
The default style for PushButtons below the overall MacosTheme.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
scrollbarTheme MacosScrollbarThemeData
The default style for MacosScrollbars below the overall MacosTheme
final
searchFieldTheme MacosSearchFieldThemeData
The default style for MacosSearchFields below the overall MacosTheme
final
timePickerTheme MacosTimePickerThemeData
The default style for MacosTimePickers below the overall MacosTheme
final
tooltipTheme MacosTooltipThemeData
The default style for MacosTooltips below the overall MacosTheme
final
typography MacosTypography
The default text styling for this theme.
final
visualDensity VisualDensity
The density value for specifying the compactness of various UI components.
final

Methods

copyWith({Brightness? brightness, Color? primaryColor, Color? canvasColor, MacosTypography? typography, PushButtonThemeData? pushButtonTheme, Color? dividerColor, HelpButtonThemeData? helpButtonTheme, MacosTooltipThemeData? tooltipTheme, VisualDensity? visualDensity, MacosScrollbarThemeData? scrollbarTheme, MacosIconButtonThemeData? iconButtonTheme, MacosIconThemeData? iconTheme, MacosPopupButtonThemeData? popupButtonTheme, MacosPulldownButtonThemeData? pulldownButtonTheme, MacosDatePickerThemeData? datePickerTheme, MacosTimePickerThemeData? timePickerTheme, MacosSearchFieldThemeData? searchFieldTheme}) MacosThemeData
Creates a copy of this theme but with the given fields replaced with the new values.
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
override
merge(MacosThemeData? other) MacosThemeData
Merges this MacosThemeData with another.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) String
A string representation of this object.
inherited
toStringShort() String
A brief description of this object, usually just the runtimeType and the hashCode.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

lerp(MacosThemeData a, MacosThemeData b, double t) MacosThemeData
Linearly interpolate between two themes.