79 lines
2.2 KiB
Dart
79 lines
2.2 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
import '../domain/app_settings.dart';
|
|
|
|
const river = Color(0xFF007AFF);
|
|
const ink = Color(0xFF183451);
|
|
const canvas = Color(0xFFF3F7FF);
|
|
const coursePalette = [
|
|
Color(0xFFDDEEEF),
|
|
Color(0xFFE3E7F6),
|
|
Color(0xFFF6E7D6),
|
|
Color(0xFFE6EDDE),
|
|
Color(0xFFF3DFE7),
|
|
Color(0xFFE6E3F4),
|
|
];
|
|
Color courseColor(String id, AppSettings settings) =>
|
|
settings.colorMode == ColorMode.single
|
|
? Color(settings.singleColorArgb).withValues(alpha: 0.18)
|
|
: coursePalette[id.codeUnits.fold<int>(0, (a, b) => a + b) %
|
|
coursePalette.length];
|
|
ThemeData hepanTheme() => ThemeData(
|
|
useMaterial3: true,
|
|
colorScheme: ColorScheme.fromSeed(seedColor: river, surface: Colors.white),
|
|
scaffoldBackgroundColor: canvas,
|
|
textTheme: ThemeData.light().textTheme.apply(
|
|
bodyColor: ink,
|
|
displayColor: ink,
|
|
),
|
|
appBarTheme: const AppBarTheme(
|
|
backgroundColor: canvas,
|
|
foregroundColor: ink,
|
|
centerTitle: false,
|
|
elevation: 0,
|
|
),
|
|
inputDecorationTheme: InputDecorationTheme(
|
|
filled: true,
|
|
fillColor: canvas,
|
|
border: OutlineInputBorder(
|
|
borderRadius: BorderRadius.circular(14),
|
|
borderSide: BorderSide.none,
|
|
),
|
|
),
|
|
filledButtonTheme: FilledButtonThemeData(
|
|
style: FilledButton.styleFrom(
|
|
backgroundColor: river,
|
|
foregroundColor: Colors.white,
|
|
padding: const EdgeInsets.symmetric(horizontal: 22, vertical: 15),
|
|
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(16)),
|
|
),
|
|
),
|
|
);
|
|
|
|
class SurfaceCard extends StatelessWidget {
|
|
const SurfaceCard({
|
|
super.key,
|
|
required this.child,
|
|
this.padding = const EdgeInsets.all(20),
|
|
});
|
|
final Widget child;
|
|
final EdgeInsets padding;
|
|
@override
|
|
Widget build(BuildContext context) => Container(
|
|
padding: padding,
|
|
decoration: BoxDecoration(
|
|
color: Colors.white.withValues(alpha: 0.92),
|
|
borderRadius: BorderRadius.circular(24),
|
|
border: Border.all(color: Colors.white),
|
|
boxShadow: [
|
|
BoxShadow(
|
|
color: ink.withValues(alpha: 0.035),
|
|
blurRadius: 20,
|
|
offset: const Offset(0, 5),
|
|
),
|
|
],
|
|
),
|
|
child: Material(type: MaterialType.transparency, child: child),
|
|
);
|
|
}
|