Semantic colors and dimensions as a ThemeExtension. copyWith replaces individual tokens; lerp interpolates between themes.
TxThemeData
| Parameter | Type | Default | Meaning |
|---|---|---|---|
| background | Color | required | Background color. |
| surface | Color | required | Primary surface color. |
| surfaceAlt | Color | required | Alternate surface color. |
| text | Color | required | Text to display. |
| muted | Color | required | Secondary text color. |
| border | Color | required | Border color. |
| accent | Color | required | Accent color. |
| onAccent | Color | required | Text color on accent surfaces. |
| hover | Color | required | Hover background. |
| selection | Color | required | Selection mode. |
| danger | Color | required | Error color. |
| success | Color | required | Success color. |
| focus | Color | required | Focus color. |
| radius | double | 8 | Corner radius in logical pixels. |
| spacing | double | 8 | Base spacing in logical pixels. |
| controlHeight | double | 40 | Base input height in logical pixels. |
| Member / type / return | Meaning |
|---|---|
static const TxThemeData light = TxThemeData(background: Color(0xfff3f5fa), surface: Colors.white, surfaceAlt: Color(0xfff7f9fc), text: Color(0xff172339), muted: Color(0xff53627a), border: Color(0xffc7d0df), accent: Color(0xff365bc6), onAccent: Colors.white, hover: Color(0xffe9eefb), selection: Color(0xffe1eaff), danger: Color(0xffb42338), success: Color(0xff137553), focus: Color(0xff315dd6)) | Default light tokens or light Material theme. |
static const TxThemeData dark = TxThemeData(background: Color(0xff101725), surface: Color(0xff182236), surfaceAlt: Color(0xff1d2a40), text: Color(0xffedf2fc), muted: Color(0xffb0bfd6), border: Color(0xff465974), accent: Color(0xffa9beff), onAccent: Color(0xff132348), hover: Color(0xff283c5c), selection: Color(0xff2b416b), danger: Color(0xffff9cad), success: Color(0xff7bdbb4), focus: Color(0xffb5c8ff)) | Default dark tokens or dark Material theme. |
TxThemeData copyWith({Color? background, Color? surface, Color? surfaceAlt, Color? text, Color? muted, Color? border, Color? accent, Color? onAccent, Color? hover, Color? selection, Color? danger, Color? success, Color? focus, double? radius, double? spacing, double? controlHeight}) | Creates a copy with the supplied changes; preserves other values. |
TxThemeData lerp(covariant TxThemeData? other, double t) | Interpolates tokens toward another theme by factor t; null preserves this theme. |
import 'package:flutter/material.dart';
import 'package:tecexpress/tecexpress.dart';
Future<void> example() async {
final tokens = TxThemeData.light.copyWith(accent: Colors.indigo, radius: 12);
print(tokens.lerp(TxThemeData.dark, 0.5).accent);
}