29 lines
846 B
Dart
29 lines
846 B
Dart
import 'package:flutter/material.dart';
|
|
|
|
@immutable
|
|
class AppMonoText extends ThemeExtension<AppMonoText> {
|
|
const AppMonoText({required this.label, required this.body});
|
|
|
|
final TextStyle label;
|
|
final TextStyle body;
|
|
|
|
@override
|
|
AppMonoText copyWith({TextStyle? label, TextStyle? body}) {
|
|
return AppMonoText(label: label ?? this.label, body: body ?? this.body);
|
|
}
|
|
|
|
@override
|
|
AppMonoText lerp(ThemeExtension<AppMonoText>? other, double t) {
|
|
if (other is! AppMonoText) return this;
|
|
return AppMonoText(
|
|
label: TextStyle.lerp(label, other.label, t) ?? label,
|
|
body: TextStyle.lerp(body, other.body, t) ?? body,
|
|
);
|
|
}
|
|
|
|
static AppMonoText of(BuildContext context) {
|
|
final ext = Theme.of(context).extension<AppMonoText>();
|
|
return ext ?? const AppMonoText(label: TextStyle(), body: TextStyle());
|
|
}
|
|
}
|