asnasd/lib/helpers/extensions/scheme_to_theme.dart
Henry-Hiles 53105025c9
bring fixups back
should be reverted on flutter bump
2026-11-23 12:57:55 -05:00

47 lines
1.5 KiB
Dart

import "package:material_ui/material_ui.dart";
extension SchemeToTheme on ColorScheme {
ThemeData get theme {
final textTheme = ThemeData(
fontFamily: "bundled-sans",
fontFamilyFallback: [
"emoji",
// TODO: Remove once on Flutter 3.50, whose Linux arm64 engine uses
// fontconfig and so understands the "emoji" alias
"Noto Color Emoji",
"Twemoji",
],
brightness: brightness,
).textTheme;
return .from(colorScheme: this).copyWith(
cardTheme: .new(color: primaryContainer),
badgeTheme: .new(backgroundColor: primary, textColor: onPrimary),
popupMenuTheme: .new(
shape: RoundedRectangleBorder(borderRadius: .circular(16)),
color: surfaceContainerHigh,
),
// So ink at the edges of a sheet doesn't spill past its rounded corners
bottomSheetTheme: .new(clipBehavior: .antiAlias),
appBarTheme: AppBarTheme(
titleSpacing: 0,
backgroundColor: surfaceContainerLow,
),
tooltipTheme: .new(
textStyle: textTheme.labelLarge?.copyWith(
fontSize: 16,
fontWeight: .w600,
),
padding: .all(8),
decoration: BoxDecoration(
color: surfaceContainerHighest,
borderRadius: .circular(8),
),
),
iconButtonTheme: .new(variant: .material3Expressive),
textTheme: textTheme,
inputDecorationTheme: const InputDecorationTheme(
border: OutlineInputBorder(),
),
);
}
}