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:
- MacosTheme, in which this MacosThemeData is inserted.
- Mixed in types
Constructors
- MacosThemeData({Brightness? brightness, Color? primaryColor, Color? canvasColor, MacosTypography? typography, PushButtonThemeData? pushButtonTheme, Color? dividerColor, HelpButtonThemeData? helpButtonTheme, TooltipThemeData? tooltipTheme, VisualDensity? visualDensity, ScrollbarThemeData? scrollbarTheme, MacosIconButtonThemeData? macosIconButtonThemeData, MacosIconThemeData? iconTheme, MacosPopupButtonThemeData? macosPopupButtonTheme, MacosTextFieldThemeData? textFieldTheme})
-
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 TooltipThemeData tooltipTheme, required VisualDensity visualDensity, required ScrollbarThemeData scrollbarTheme, required MacosIconButtonThemeData macosIconButtonTheme, required MacosIconThemeData iconTheme, required MacosPopupButtonThemeData macosPopupButtonTheme, required MacosTextFieldThemeData textFieldTheme})
-
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
- dividerColor → Color
-
The color to use when painting the line used for the TitleBar bottom,
Sidebar and
ResizableBar
sidesfinal - hashCode → int
-
The hash code for this object.
no setterinherited
- helpButtonTheme → HelpButtonThemeData
-
The default style for HelpButtons below the overall MacosTheme.
final
- iconTheme → MacosIconThemeData
-
The default style for MacosIcons below the overall MacosTheme
final
- macosIconButtonTheme → MacosIconButtonThemeData
-
The default style for MacosIconButtons below the overall MacosTheme
final
- macosPopupButtonTheme → MacosPopupButtonThemeData
-
The default style for MacosPopupButtons below the overall MacosTheme
final
- primaryColor → Color
-
A color used on primary interactive elements of the theme.
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 → ScrollbarThemeData
-
The default style for MacosScrollbars below the overall MacosTheme
final
- textFieldTheme → MacosTextFieldThemeData
-
final
- tooltipTheme → TooltipThemeData
-
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, TooltipThemeData? tooltipTheme, VisualDensity? visualDensity, ScrollbarThemeData? scrollbarTheme, MacosIconButtonThemeData? macosIconButtonTheme, MacosIconThemeData? iconTheme, MacosPopupButtonThemeData? macosPopupButtonTheme, MacosTextFieldThemeData? textFieldTheme}) → 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 -
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.