2024-02-17 20:32:01 +05:30
|
|
|
import "package:flutter/material.dart";
|
|
|
|
|
|
2026-09-26 22:45:38 +03:00
|
|
|
import "package:smol_mail/presentation/theme/app_colors.dart";
|
|
|
|
|
|
|
|
|
|
const _seedColor = Color.fromRGBO(63, 207, 142, 1);
|
|
|
|
|
const _darkSurface = Color.fromRGBO(1, 17, 29, 1);
|
|
|
|
|
|
|
|
|
|
TextTheme _textTheme(TextTheme base, Color mutedColor) {
|
|
|
|
|
return base.copyWith(
|
|
|
|
|
bodySmall: base.bodySmall?.copyWith(
|
2024-02-17 20:32:01 +05:30
|
|
|
fontFamily: "Inter",
|
|
|
|
|
fontSize: 16,
|
|
|
|
|
fontWeight: FontWeight.normal,
|
|
|
|
|
),
|
2026-09-26 22:45:38 +03:00
|
|
|
bodyMedium: base.bodyMedium?.copyWith(
|
2024-02-17 20:32:01 +05:30
|
|
|
fontFamily: "Inter",
|
|
|
|
|
fontSize: 20,
|
|
|
|
|
fontWeight: FontWeight.w500,
|
|
|
|
|
),
|
2026-09-26 22:45:38 +03:00
|
|
|
bodyLarge: base.bodyLarge?.copyWith(
|
2024-02-17 20:32:01 +05:30
|
|
|
fontFamily: "Inter",
|
|
|
|
|
fontSize: 24,
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
),
|
2026-09-26 22:45:38 +03:00
|
|
|
titleMedium: base.titleMedium?.copyWith(
|
2024-02-17 20:32:01 +05:30
|
|
|
fontSize: 14,
|
|
|
|
|
fontWeight: FontWeight.w300,
|
|
|
|
|
),
|
2026-09-26 22:45:38 +03:00
|
|
|
titleLarge: base.titleLarge?.copyWith(
|
2024-02-17 20:32:01 +05:30
|
|
|
fontFamily: "Inter",
|
|
|
|
|
fontSize: 35,
|
|
|
|
|
fontWeight: FontWeight.w900,
|
|
|
|
|
),
|
2026-09-26 22:45:38 +03:00
|
|
|
labelSmall: base.labelSmall?.copyWith(
|
2024-02-17 20:32:01 +05:30
|
|
|
fontFamily: "Inter",
|
|
|
|
|
fontSize: 16,
|
2026-09-26 22:45:38 +03:00
|
|
|
color: mutedColor,
|
2024-02-17 20:32:01 +05:30
|
|
|
fontWeight: FontWeight.w700,
|
|
|
|
|
),
|
2026-09-26 22:45:38 +03:00
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ThemeData _buildTheme(ColorScheme scheme, AppColors appColors) {
|
|
|
|
|
return ThemeData(
|
|
|
|
|
colorScheme: scheme,
|
|
|
|
|
// ThemeData defaults this legacy field to Colors.grey[900] on a dark
|
|
|
|
|
// theme when unset, which is nearly invisible against our dark surfaces —
|
|
|
|
|
// several screens still read it via Theme.of(context).primaryColor.
|
|
|
|
|
primaryColor: scheme.primary,
|
|
|
|
|
scaffoldBackgroundColor: scheme.surface,
|
|
|
|
|
extensions: [appColors],
|
|
|
|
|
appBarTheme: AppBarTheme(
|
|
|
|
|
backgroundColor: scheme.surface,
|
|
|
|
|
iconTheme: IconThemeData(color: scheme.onSurface, size: 30),
|
|
|
|
|
titleTextStyle: TextStyle(
|
|
|
|
|
color: scheme.onSurface,
|
|
|
|
|
fontFamily: "Inter",
|
|
|
|
|
fontWeight: FontWeight.w900,
|
|
|
|
|
fontSize: 30,
|
2024-02-17 20:32:01 +05:30
|
|
|
),
|
2026-09-26 22:45:38 +03:00
|
|
|
elevation: 0.0,
|
|
|
|
|
),
|
|
|
|
|
textTheme: _textTheme(
|
|
|
|
|
ThemeData(brightness: scheme.brightness).textTheme,
|
|
|
|
|
scheme.onSurfaceVariant,
|
|
|
|
|
),
|
|
|
|
|
snackBarTheme: SnackBarThemeData(
|
|
|
|
|
backgroundColor: scheme.inverseSurface,
|
|
|
|
|
contentTextStyle: TextStyle(
|
2024-02-17 20:32:01 +05:30
|
|
|
fontFamily: "Inter",
|
2026-09-26 22:45:38 +03:00
|
|
|
fontSize: 16,
|
|
|
|
|
color: scheme.onInverseSurface,
|
2024-02-17 20:32:01 +05:30
|
|
|
),
|
|
|
|
|
),
|
2026-09-26 22:45:38 +03:00
|
|
|
elevatedButtonTheme: ElevatedButtonThemeData(
|
|
|
|
|
style: ElevatedButton.styleFrom(
|
|
|
|
|
backgroundColor: scheme.primary,
|
|
|
|
|
foregroundColor: scheme.onPrimary,
|
|
|
|
|
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(5)),
|
|
|
|
|
textStyle: const TextStyle(
|
|
|
|
|
fontFamily: "Inter",
|
|
|
|
|
fontSize: 17,
|
|
|
|
|
fontWeight: FontWeight.w500,
|
|
|
|
|
),
|
2024-02-17 20:32:01 +05:30
|
|
|
),
|
2026-09-26 22:45:38 +03:00
|
|
|
),
|
|
|
|
|
textButtonTheme: TextButtonThemeData(
|
|
|
|
|
style: TextButton.styleFrom(
|
|
|
|
|
foregroundColor: scheme.primary,
|
|
|
|
|
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(5)),
|
|
|
|
|
textStyle: const TextStyle(
|
|
|
|
|
fontFamily: "Inter",
|
|
|
|
|
fontWeight: FontWeight.w500,
|
|
|
|
|
fontSize: 17,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
// Without this, an empty/unfocused field's resting label inherits
|
|
|
|
|
// bodyLarge (24px bold) — that's what made "Host" etc. look huge.
|
|
|
|
|
inputDecorationTheme: InputDecorationTheme(
|
|
|
|
|
labelStyle: TextStyle(
|
2024-02-17 20:32:01 +05:30
|
|
|
fontFamily: "Inter",
|
2026-09-26 22:45:38 +03:00
|
|
|
fontSize: 16,
|
|
|
|
|
fontWeight: FontWeight.normal,
|
|
|
|
|
color: scheme.onSurfaceVariant,
|
|
|
|
|
),
|
|
|
|
|
floatingLabelStyle: TextStyle(
|
|
|
|
|
fontFamily: "Inter",
|
|
|
|
|
fontSize: 14,
|
2024-02-17 20:32:01 +05:30
|
|
|
fontWeight: FontWeight.w500,
|
2026-09-26 22:45:38 +03:00
|
|
|
color: scheme.primary,
|
|
|
|
|
),
|
|
|
|
|
hintStyle: TextStyle(
|
|
|
|
|
fontFamily: "Inter",
|
|
|
|
|
fontSize: 16,
|
|
|
|
|
fontWeight: FontWeight.normal,
|
|
|
|
|
color: scheme.onSurfaceVariant,
|
|
|
|
|
),
|
|
|
|
|
border: OutlineInputBorder(
|
|
|
|
|
borderRadius: BorderRadius.circular(8),
|
|
|
|
|
borderSide: BorderSide.none,
|
2024-02-17 20:32:01 +05:30
|
|
|
),
|
2026-09-26 22:45:38 +03:00
|
|
|
contentPadding: const EdgeInsets.symmetric(horizontal: 16, vertical: 14),
|
2024-02-17 20:32:01 +05:30
|
|
|
),
|
2026-09-26 22:45:38 +03:00
|
|
|
useMaterial3: true,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
final ThemeData appThemeDark = _buildTheme(
|
|
|
|
|
ColorScheme.fromSeed(
|
|
|
|
|
seedColor: _seedColor,
|
|
|
|
|
brightness: Brightness.dark,
|
|
|
|
|
).copyWith(surface: _darkSurface),
|
|
|
|
|
AppColors.dark,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
final ThemeData appThemeLight = _buildTheme(
|
|
|
|
|
ColorScheme.fromSeed(
|
|
|
|
|
seedColor: _seedColor,
|
|
|
|
|
brightness: Brightness.light,
|
2024-02-17 20:32:01 +05:30
|
|
|
),
|
2026-09-26 22:45:38 +03:00
|
|
|
AppColors.light,
|
2024-02-17 20:32:01 +05:30
|
|
|
);
|