LogViewerTheme class

Log viewer colors: an extension of the app theme.

Without configuration the colors derive from the current theme's ColorScheme (LogViewerTheme.fallback), so light and dark themes work out of the box. To override, add the extension to the theme:

ThemeData(extensions: [LogViewerTheme.fallback(colorScheme).copyWith(fatalColor: Colors.black)]);
Inheritance
Annotations

Constructors

LogViewerTheme({required Color traceColor, required Color debugColor, required Color infoColor, required Color warningColor, required Color errorColor, required Color fatalColor, required Color warningBackground, required Color errorBackground, Color tagColor(String tag) = colorForTag})
const
LogViewerTheme.fallback(ColorScheme scheme)
Default colors for scheme: the trace, debug, info and error levels take scheme colors; Material has no colors for warning and fatal, so those are constant.
factory
LogViewerTheme.of(BuildContext context)
Theme from the context: the extension from ThemeData.extensions, or LogViewerTheme.fallback for the current ColorScheme.
factory

Properties

debugColor → Color
final
errorBackground → Color
final
errorColor → Color
final
fatalColor → Color
final
hashCode → int
The hash code for this object.
no setteroverride
infoColor → Color
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
tagColor → Color Function(String tag)
Tag color: the same tag is always colored the same.
final
traceColor → Color
Colors of the level icons in the list.
final
type → Object
The extension's type.
no setterinherited
warningBackground → Color
Tile background for warnings and for errors (error and fatal).
final
warningColor → Color
final

Methods

copyWith({Color? traceColor, Color? debugColor, Color? infoColor, Color? warningColor, Color? errorColor, Color? fatalColor, Color? warningBackground, Color? errorBackground, Color tagColor(String tag)?}) → LogViewerTheme
Creates a copy of this theme extension with the given fields replaced by the non-null parameter values.
override
lerp(covariant LogViewerTheme? other, double t) → LogViewerTheme
Linearly interpolate with another ThemeExtension object.
override
levelBackground(LogLevel level) → Color?
Tile background for level; null means the regular background.
levelColor(LogLevel level) → Color
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
Themes with the same colors and the same tagColor function are equal: ThemeData compares extensions by ==, and without equality every new theme copy would rebuild all its consumers.
override

Static Methods

resolveIn(ThemeData theme) → ThemeData
theme with the LogViewerTheme extension: the same theme if it already has one, otherwise a copy with LogViewerTheme.fallback. The list page wraps its tiles in it so each finds a ready theme via LogViewerTheme.of instead of building a fallback on every build. Compute the result in didChangeDependencies, not in build: ThemeData.copyWith is not free.