89 lines
3.0 KiB
Dart
89 lines
3.0 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'tripz_colors.dart';
|
|
import 'typography.dart';
|
|
|
|
/// بناء الثيم — المدخلان الوحيدان: السطوع واللغة.
|
|
/// docs/26 §2, §4
|
|
ThemeData buildTheme({required Brightness brightness, required Locale locale}) {
|
|
final bool isDark = brightness == Brightness.dark;
|
|
final seed = const Color(0xFF0E7C66); // أخضر تركوازي — بذرة المستأجر
|
|
|
|
final colorScheme = ColorScheme.fromSeed(
|
|
seedColor: seed,
|
|
brightness: brightness,
|
|
);
|
|
|
|
final textTheme = buildTextTheme(locale);
|
|
|
|
return ThemeData(
|
|
useMaterial3: true,
|
|
brightness: brightness,
|
|
colorScheme: colorScheme,
|
|
textTheme: textTheme,
|
|
extensions: [
|
|
isDark ? TripzColors.dark : TripzColors.light,
|
|
],
|
|
appBarTheme: AppBarTheme(
|
|
backgroundColor: colorScheme.surface,
|
|
foregroundColor: colorScheme.onSurface,
|
|
elevation: 0,
|
|
scrolledUnderElevation: 0,
|
|
centerTitle: false,
|
|
titleTextStyle: textTheme.titleLarge?.copyWith(
|
|
color: colorScheme.onSurface,
|
|
),
|
|
),
|
|
inputDecorationTheme: InputDecorationTheme(
|
|
filled: true,
|
|
fillColor: colorScheme.surfaceContainerHighest,
|
|
border: OutlineInputBorder(
|
|
borderRadius: BorderRadius.circular(8),
|
|
borderSide: BorderSide(color: colorScheme.outline),
|
|
),
|
|
enabledBorder: OutlineInputBorder(
|
|
borderRadius: BorderRadius.circular(8),
|
|
borderSide: BorderSide(color: colorScheme.outline),
|
|
),
|
|
focusedBorder: OutlineInputBorder(
|
|
borderRadius: BorderRadius.circular(8),
|
|
borderSide: BorderSide(color: colorScheme.primary, width: 2),
|
|
),
|
|
errorBorder: OutlineInputBorder(
|
|
borderRadius: BorderRadius.circular(8),
|
|
borderSide: BorderSide(color: colorScheme.error),
|
|
),
|
|
contentPadding: const EdgeInsets.symmetric(horizontal: 16, vertical: 14),
|
|
labelStyle: textTheme.bodyLarge,
|
|
hintStyle: textTheme.bodyLarge?.copyWith(color: colorScheme.onSurfaceVariant),
|
|
),
|
|
filledButtonTheme: FilledButtonThemeData(
|
|
style: FilledButton.styleFrom(
|
|
minimumSize: const Size.fromHeight(52),
|
|
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
|
|
textStyle: textTheme.labelLarge,
|
|
),
|
|
),
|
|
outlinedButtonTheme: OutlinedButtonThemeData(
|
|
style: OutlinedButton.styleFrom(
|
|
minimumSize: const Size.fromHeight(52),
|
|
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
|
|
textStyle: textTheme.labelLarge,
|
|
),
|
|
),
|
|
cardTheme: CardThemeData(
|
|
elevation: 0,
|
|
shape: RoundedRectangleBorder(
|
|
borderRadius: BorderRadius.circular(12),
|
|
side: BorderSide(color: colorScheme.outlineVariant),
|
|
),
|
|
margin: EdgeInsets.zero,
|
|
),
|
|
bottomSheetTheme: const BottomSheetThemeData(
|
|
shape: RoundedRectangleBorder(
|
|
borderRadius: BorderRadius.vertical(top: Radius.circular(24)),
|
|
),
|
|
showDragHandle: true,
|
|
),
|
|
);
|
|
}
|