PerformanceTheme class

Colors and wording used by the frame_insights widgets.

Register an instance in your ThemeData to restyle the UI, switch language, or both:

MaterialApp(
  theme: ThemeData(
    extensions: [
      PerformanceTheme(
        strings: PerformanceStrings.chinese,
        badColor: Color(0xFFD8674B),
      ),
    ],
  ),
)

Every field has a default that matches the package's own look, so a MaterialApp without this extension still renders correctly: the widgets fall back to PerformanceTheme.of, which returns the defaults plus a "healthy" color taken from the ambient ColorScheme.

The spacing and corner radii are deliberately not part of this class — they are internal, and a restyle almost never needs them.

Inheritance
Annotations

Constructors

PerformanceTheme({PerformanceStrings strings = PerformanceStrings.english, Color buildColor = buildColorDefault, Color rasterColor = rasterColorDefault, Color otherColor = otherColorDefault, Color? goodColor, Color warnColor = warnColorDefault, Color badColor = badColorDefault, Color hudSurface = hudSurfaceDefault, Color hudPrimaryText = hudPrimaryTextDefault, Color hudSecondaryText = hudSecondaryTextDefault, Color hudAccent = hudAccentDefault, Color hudIdle = hudIdleDefault, Color hudGood = hudGoodDefault, Color hudWarn = hudWarnDefault, Color hudBad = hudBadDefault})
Creates a theme; every argument falls back to the package default.
const

Properties

badColor → Color
Color for a metric that is far outside the expected range.
final
buildColor → Color
Color of the UI thread segment of a frame bar.
final
goodColor → Color?
Color for a healthy metric, or null to follow the app accent.
final
hashCode → int
The hash code for this object.
no setterinherited
hudAccent → Color
Color of the filled action inside the floating window.
final
hudBad → Color
"Bad" color inside the floating window.
final
hudGood → Color
"Healthy" color inside the floating window.
final
hudIdle → Color
Color used by the floating window before the first measurement.
final
hudPrimaryText → Color
Color of values inside the floating window.
final
hudSecondaryText → Color
Color of labels inside the floating window.
final
hudSurface → Color
Background of the floating window.
final
hudWarn → Color
"Slightly off" color inside the floating window.
final
otherColor → Color
Color of the segment that is neither build nor raster.
final
rasterColor → Color
Color of the raster thread segment of a frame bar.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
strings → PerformanceStrings
Wording of every widget in this package.
final
type → Object
The extension's type.
no setterinherited
warnColor → Color
Color for a metric that left the expected range a little.
final

Methods

copyWith({PerformanceStrings? strings, Color? buildColor, Color? rasterColor, Color? otherColor, Color? goodColor, Color? warnColor, Color? badColor, Color? hudSurface, Color? hudPrimaryText, Color? hudSecondaryText, Color? hudAccent, Color? hudIdle, Color? hudGood, Color? hudWarn, Color? hudBad}) → PerformanceTheme
Creates a copy of this theme extension with the given fields replaced by the non-null parameter values.
override
goodColorIn(ColorScheme scheme) → Color
The healthy color, resolved against scheme when none was configured.
healthHighlight(PerformanceHealthLevel level) → Color?
Color highlighting a metric outside its expected range.
hudHealthHighlight(PerformanceHealthLevel level) → Color?
Like healthHighlight, but with the floating window's colors.
lerp(covariant ThemeExtension<PerformanceTheme>? other, double t) → PerformanceTheme
Linearly interpolate with another ThemeExtension object.
override
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
The equality operator.
inherited

Static Methods

of(BuildContext context) → PerformanceTheme
The theme registered in context, or the package defaults.

Constants

badColorDefault → const Color
Default color for a metric that is far outside the expected range.
buildColorDefault → const Color
Default color of the UI thread segment of a frame bar.
hudAccentDefault → const Color
Default color of the filled action inside the floating window.
hudBadDefault → const Color
Default "bad" color inside the floating window.
hudGoodDefault → const Color
Default "healthy" color inside the floating window.
hudIdleDefault → const Color
Default color used before the first measurement is available.
hudPrimaryTextDefault → const Color
Default color of values inside the floating window.
hudSecondaryTextDefault → const Color
Default color of labels inside the floating window.
hudSurfaceDefault → const Color
Default background of the floating window.
hudWarnDefault → const Color
Default "slightly off" color inside the floating window.
otherColorDefault → const Color
Default color of the segment that is neither build nor raster.
rasterColorDefault → const Color
Default color of the raster thread segment of a frame bar.
warnColorDefault → const Color
Default color for a metric that left the expected range a little.