Initial commit
This commit is contained in:
10
lib/core/constants/app_constants.dart
Normal file
10
lib/core/constants/app_constants.dart
Normal file
@@ -0,0 +1,10 @@
|
||||
class AppConstants {
|
||||
AppConstants._();
|
||||
|
||||
static const String appName = 'TrainHub';
|
||||
static const double windowWidth = 1280;
|
||||
static const double windowHeight = 800;
|
||||
static const double minWindowWidth = 800;
|
||||
static const double minWindowHeight = 600;
|
||||
static const String databaseName = 'trainhub.sqlite';
|
||||
}
|
||||
32
lib/core/constants/ui_constants.dart
Normal file
32
lib/core/constants/ui_constants.dart
Normal file
@@ -0,0 +1,32 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class UIConstants {
|
||||
UIConstants._();
|
||||
|
||||
static const double pagePadding = 24.0;
|
||||
static const double cardPadding = 16.0;
|
||||
static const double sidebarWidth = 300.0;
|
||||
static const double analysisSidebarWidth = 350.0;
|
||||
static const double dialogWidth = 400.0;
|
||||
|
||||
static const double spacing4 = 4.0;
|
||||
static const double spacing8 = 8.0;
|
||||
static const double spacing12 = 12.0;
|
||||
static const double spacing16 = 16.0;
|
||||
static const double spacing24 = 24.0;
|
||||
static const double spacing32 = 32.0;
|
||||
|
||||
static const double borderRadius = 12.0;
|
||||
static const double smallBorderRadius = 8.0;
|
||||
|
||||
static const Duration animationDuration = Duration(milliseconds: 200);
|
||||
static const Duration snackBarDuration = Duration(seconds: 2);
|
||||
|
||||
static const double navRailWidth = 80.0;
|
||||
|
||||
static BorderRadius get cardBorderRadius =>
|
||||
BorderRadius.circular(borderRadius);
|
||||
|
||||
static BorderRadius get smallCardBorderRadius =>
|
||||
BorderRadius.circular(smallBorderRadius);
|
||||
}
|
||||
35
lib/core/extensions/context_extensions.dart
Normal file
35
lib/core/extensions/context_extensions.dart
Normal file
@@ -0,0 +1,35 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:trainhub_flutter/core/theme/app_colors.dart';
|
||||
|
||||
extension BuildContextExtensions on BuildContext {
|
||||
ThemeData get theme => Theme.of(this);
|
||||
ColorScheme get colors => theme.colorScheme;
|
||||
TextTheme get textTheme => theme.textTheme;
|
||||
MediaQueryData get mediaQuery => MediaQuery.of(this);
|
||||
double get screenWidth => mediaQuery.size.width;
|
||||
double get screenHeight => mediaQuery.size.height;
|
||||
|
||||
void showSnackBar(String message, {bool isError = false}) {
|
||||
ScaffoldMessenger.of(this).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(message),
|
||||
backgroundColor:
|
||||
isError ? AppColors.destructive : AppColors.surfaceContainer,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
void showSuccessSnackBar(String message) {
|
||||
ScaffoldMessenger.of(this).showSnackBar(
|
||||
SnackBar(
|
||||
content: Row(
|
||||
children: [
|
||||
const Icon(Icons.check_circle, color: AppColors.success, size: 18),
|
||||
const SizedBox(width: 8),
|
||||
Expanded(child: Text(message)),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
7
lib/core/extensions/date_extensions.dart
Normal file
7
lib/core/extensions/date_extensions.dart
Normal file
@@ -0,0 +1,7 @@
|
||||
extension DateTimeExtensions on DateTime {
|
||||
String toDisplayDate() {
|
||||
return '${year.toString()}-${month.toString().padLeft(2, '0')}-${day.toString().padLeft(2, '0')}';
|
||||
}
|
||||
|
||||
String toIso() => toIso8601String();
|
||||
}
|
||||
15
lib/core/extensions/duration_extensions.dart
Normal file
15
lib/core/extensions/duration_extensions.dart
Normal file
@@ -0,0 +1,15 @@
|
||||
extension DurationExtensions on Duration {
|
||||
String toMmSs() {
|
||||
final int minutes = inMinutes.remainder(60);
|
||||
final int seconds = inSeconds.remainder(60);
|
||||
return '${minutes.toString().padLeft(2, '0')}:${seconds.toString().padLeft(2, '0')}';
|
||||
}
|
||||
}
|
||||
|
||||
extension IntTimeExtensions on int {
|
||||
String toMmSs() {
|
||||
final int minutes = this ~/ 60;
|
||||
final int seconds = this % 60;
|
||||
return '$minutes:${seconds.toString().padLeft(2, '0')}';
|
||||
}
|
||||
}
|
||||
32
lib/core/router/app_router.dart
Normal file
32
lib/core/router/app_router.dart
Normal file
@@ -0,0 +1,32 @@
|
||||
import 'package:auto_route/auto_route.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:trainhub_flutter/presentation/analysis/analysis_page.dart';
|
||||
import 'package:trainhub_flutter/presentation/calendar/calendar_page.dart';
|
||||
import 'package:trainhub_flutter/presentation/chat/chat_page.dart';
|
||||
import 'package:trainhub_flutter/presentation/home/home_page.dart';
|
||||
import 'package:trainhub_flutter/presentation/plan_editor/plan_editor_page.dart';
|
||||
import 'package:trainhub_flutter/presentation/shell/shell_page.dart';
|
||||
import 'package:trainhub_flutter/presentation/trainings/trainings_page.dart';
|
||||
import 'package:trainhub_flutter/presentation/workout_session/workout_session_page.dart';
|
||||
|
||||
part 'app_router.gr.dart';
|
||||
|
||||
@AutoRouterConfig(replaceInRouteName: 'Page|Screen,Route')
|
||||
class AppRouter extends RootStackRouter {
|
||||
@override
|
||||
List<AutoRoute> get routes => [
|
||||
AutoRoute(
|
||||
page: ShellRoute.page,
|
||||
initial: true,
|
||||
children: [
|
||||
AutoRoute(page: HomeRoute.page, initial: true),
|
||||
AutoRoute(page: TrainingsRoute.page),
|
||||
AutoRoute(page: AnalysisRoute.page),
|
||||
AutoRoute(page: CalendarRoute.page),
|
||||
AutoRoute(page: ChatRoute.page),
|
||||
],
|
||||
),
|
||||
AutoRoute(page: PlanEditorRoute.page),
|
||||
AutoRoute(page: WorkoutSessionRoute.page),
|
||||
];
|
||||
}
|
||||
191
lib/core/router/app_router.gr.dart
Normal file
191
lib/core/router/app_router.gr.dart
Normal file
@@ -0,0 +1,191 @@
|
||||
// dart format width=80
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
// **************************************************************************
|
||||
// AutoRouterGenerator
|
||||
// **************************************************************************
|
||||
|
||||
// ignore_for_file: type=lint
|
||||
// coverage:ignore-file
|
||||
|
||||
part of 'app_router.dart';
|
||||
|
||||
/// generated route for
|
||||
/// [AnalysisPage]
|
||||
class AnalysisRoute extends PageRouteInfo<void> {
|
||||
const AnalysisRoute({List<PageRouteInfo>? children})
|
||||
: super(AnalysisRoute.name, initialChildren: children);
|
||||
|
||||
static const String name = 'AnalysisRoute';
|
||||
|
||||
static PageInfo page = PageInfo(
|
||||
name,
|
||||
builder: (data) {
|
||||
return const AnalysisPage();
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/// generated route for
|
||||
/// [CalendarPage]
|
||||
class CalendarRoute extends PageRouteInfo<void> {
|
||||
const CalendarRoute({List<PageRouteInfo>? children})
|
||||
: super(CalendarRoute.name, initialChildren: children);
|
||||
|
||||
static const String name = 'CalendarRoute';
|
||||
|
||||
static PageInfo page = PageInfo(
|
||||
name,
|
||||
builder: (data) {
|
||||
return const CalendarPage();
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/// generated route for
|
||||
/// [ChatPage]
|
||||
class ChatRoute extends PageRouteInfo<void> {
|
||||
const ChatRoute({List<PageRouteInfo>? children})
|
||||
: super(ChatRoute.name, initialChildren: children);
|
||||
|
||||
static const String name = 'ChatRoute';
|
||||
|
||||
static PageInfo page = PageInfo(
|
||||
name,
|
||||
builder: (data) {
|
||||
return const ChatPage();
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/// generated route for
|
||||
/// [HomePage]
|
||||
class HomeRoute extends PageRouteInfo<void> {
|
||||
const HomeRoute({List<PageRouteInfo>? children})
|
||||
: super(HomeRoute.name, initialChildren: children);
|
||||
|
||||
static const String name = 'HomeRoute';
|
||||
|
||||
static PageInfo page = PageInfo(
|
||||
name,
|
||||
builder: (data) {
|
||||
return const HomePage();
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/// generated route for
|
||||
/// [PlanEditorPage]
|
||||
class PlanEditorRoute extends PageRouteInfo<PlanEditorRouteArgs> {
|
||||
PlanEditorRoute({
|
||||
Key? key,
|
||||
required String planId,
|
||||
List<PageRouteInfo>? children,
|
||||
}) : super(
|
||||
PlanEditorRoute.name,
|
||||
args: PlanEditorRouteArgs(key: key, planId: planId),
|
||||
rawPathParams: {'planId': planId},
|
||||
initialChildren: children,
|
||||
);
|
||||
|
||||
static const String name = 'PlanEditorRoute';
|
||||
|
||||
static PageInfo page = PageInfo(
|
||||
name,
|
||||
builder: (data) {
|
||||
final pathParams = data.inheritedPathParams;
|
||||
final args = data.argsAs<PlanEditorRouteArgs>(
|
||||
orElse: () =>
|
||||
PlanEditorRouteArgs(planId: pathParams.getString('planId')),
|
||||
);
|
||||
return PlanEditorPage(key: args.key, planId: args.planId);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
class PlanEditorRouteArgs {
|
||||
const PlanEditorRouteArgs({this.key, required this.planId});
|
||||
|
||||
final Key? key;
|
||||
|
||||
final String planId;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'PlanEditorRouteArgs{key: $key, planId: $planId}';
|
||||
}
|
||||
}
|
||||
|
||||
/// generated route for
|
||||
/// [ShellPage]
|
||||
class ShellRoute extends PageRouteInfo<void> {
|
||||
const ShellRoute({List<PageRouteInfo>? children})
|
||||
: super(ShellRoute.name, initialChildren: children);
|
||||
|
||||
static const String name = 'ShellRoute';
|
||||
|
||||
static PageInfo page = PageInfo(
|
||||
name,
|
||||
builder: (data) {
|
||||
return const ShellPage();
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/// generated route for
|
||||
/// [TrainingsPage]
|
||||
class TrainingsRoute extends PageRouteInfo<void> {
|
||||
const TrainingsRoute({List<PageRouteInfo>? children})
|
||||
: super(TrainingsRoute.name, initialChildren: children);
|
||||
|
||||
static const String name = 'TrainingsRoute';
|
||||
|
||||
static PageInfo page = PageInfo(
|
||||
name,
|
||||
builder: (data) {
|
||||
return const TrainingsPage();
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/// generated route for
|
||||
/// [WorkoutSessionPage]
|
||||
class WorkoutSessionRoute extends PageRouteInfo<WorkoutSessionRouteArgs> {
|
||||
WorkoutSessionRoute({
|
||||
Key? key,
|
||||
required String planId,
|
||||
List<PageRouteInfo>? children,
|
||||
}) : super(
|
||||
WorkoutSessionRoute.name,
|
||||
args: WorkoutSessionRouteArgs(key: key, planId: planId),
|
||||
rawPathParams: {'planId': planId},
|
||||
initialChildren: children,
|
||||
);
|
||||
|
||||
static const String name = 'WorkoutSessionRoute';
|
||||
|
||||
static PageInfo page = PageInfo(
|
||||
name,
|
||||
builder: (data) {
|
||||
final pathParams = data.inheritedPathParams;
|
||||
final args = data.argsAs<WorkoutSessionRouteArgs>(
|
||||
orElse: () =>
|
||||
WorkoutSessionRouteArgs(planId: pathParams.getString('planId')),
|
||||
);
|
||||
return WorkoutSessionPage(key: args.key, planId: args.planId);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
class WorkoutSessionRouteArgs {
|
||||
const WorkoutSessionRouteArgs({this.key, required this.planId});
|
||||
|
||||
final Key? key;
|
||||
|
||||
final String planId;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'WorkoutSessionRouteArgs{key: $key, planId: $planId}';
|
||||
}
|
||||
}
|
||||
41
lib/core/theme/app_colors.dart
Normal file
41
lib/core/theme/app_colors.dart
Normal file
@@ -0,0 +1,41 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class AppColors {
|
||||
AppColors._();
|
||||
|
||||
// Zinc palette
|
||||
static const Color zinc50 = Color(0xFFFAFAFA);
|
||||
static const Color zinc100 = Color(0xFFF4F4F5);
|
||||
static const Color zinc200 = Color(0xFFE4E4E7);
|
||||
static const Color zinc300 = Color(0xFFD4D4D8);
|
||||
static const Color zinc400 = Color(0xFFA1A1AA);
|
||||
static const Color zinc500 = Color(0xFF71717A);
|
||||
static const Color zinc600 = Color(0xFF52525B);
|
||||
static const Color zinc700 = Color(0xFF3F3F46);
|
||||
static const Color zinc800 = Color(0xFF27272A);
|
||||
static const Color zinc900 = Color(0xFF18181B);
|
||||
static const Color zinc950 = Color(0xFF09090B);
|
||||
|
||||
// Semantic colors
|
||||
static const Color surface = zinc950;
|
||||
static const Color surfaceContainer = zinc900;
|
||||
static const Color surfaceContainerHigh = zinc800;
|
||||
static const Color border = zinc800;
|
||||
static const Color borderSubtle = Color(0xFF1F1F23);
|
||||
static const Color textPrimary = zinc50;
|
||||
static const Color textSecondary = zinc400;
|
||||
static const Color textMuted = zinc500;
|
||||
|
||||
// Accent colors
|
||||
static const Color accent = Color(0xFFFF9800);
|
||||
static const Color accentMuted = Color(0x33FF9800);
|
||||
static const Color success = Color(0xFF22C55E);
|
||||
static const Color successMuted = Color(0x3322C55E);
|
||||
static const Color destructive = Color(0xFFEF4444);
|
||||
static const Color destructiveMuted = Color(0x33EF4444);
|
||||
static const Color info = Color(0xFF3B82F6);
|
||||
static const Color infoMuted = Color(0x333B82F6);
|
||||
static const Color purple = Color(0xFF8B5CF6);
|
||||
static const Color purpleMuted = Color(0x338B5CF6);
|
||||
static const Color warning = Color(0xFFF59E0B);
|
||||
}
|
||||
209
lib/core/theme/app_theme.dart
Normal file
209
lib/core/theme/app_theme.dart
Normal file
@@ -0,0 +1,209 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:trainhub_flutter/core/theme/app_colors.dart';
|
||||
import 'package:trainhub_flutter/core/constants/ui_constants.dart';
|
||||
|
||||
class AppTheme {
|
||||
AppTheme._();
|
||||
|
||||
static final ThemeData dark = ThemeData(
|
||||
useMaterial3: true,
|
||||
brightness: Brightness.dark,
|
||||
colorScheme: const ColorScheme.dark(
|
||||
primary: AppColors.zinc50,
|
||||
onPrimary: AppColors.zinc950,
|
||||
secondary: AppColors.zinc200,
|
||||
onSecondary: AppColors.zinc950,
|
||||
surface: AppColors.zinc950,
|
||||
onSurface: AppColors.zinc50,
|
||||
surfaceContainer: AppColors.zinc900,
|
||||
error: AppColors.destructive,
|
||||
onError: AppColors.zinc50,
|
||||
outline: AppColors.zinc800,
|
||||
outlineVariant: AppColors.zinc700,
|
||||
),
|
||||
scaffoldBackgroundColor: AppColors.surface,
|
||||
textTheme: GoogleFonts.interTextTheme(ThemeData.dark().textTheme).apply(
|
||||
bodyColor: AppColors.textPrimary,
|
||||
displayColor: AppColors.textPrimary,
|
||||
),
|
||||
cardTheme: CardThemeData(
|
||||
color: AppColors.surfaceContainer,
|
||||
elevation: 0,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: UIConstants.cardBorderRadius,
|
||||
side: const BorderSide(color: AppColors.border, width: 1),
|
||||
),
|
||||
margin: EdgeInsets.zero,
|
||||
),
|
||||
dividerTheme: const DividerThemeData(
|
||||
color: AppColors.border,
|
||||
thickness: 1,
|
||||
space: 1,
|
||||
),
|
||||
iconTheme: const IconThemeData(
|
||||
color: AppColors.textSecondary,
|
||||
size: 20,
|
||||
),
|
||||
navigationRailTheme: NavigationRailThemeData(
|
||||
backgroundColor: AppColors.surfaceContainer,
|
||||
selectedIconTheme: const IconThemeData(color: AppColors.textPrimary),
|
||||
unselectedIconTheme: const IconThemeData(color: AppColors.textMuted),
|
||||
selectedLabelTextStyle: GoogleFonts.inter(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: AppColors.textPrimary,
|
||||
),
|
||||
unselectedLabelTextStyle: GoogleFonts.inter(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w400,
|
||||
color: AppColors.textMuted,
|
||||
),
|
||||
indicatorColor: AppColors.zinc700,
|
||||
),
|
||||
inputDecorationTheme: InputDecorationTheme(
|
||||
filled: true,
|
||||
fillColor: AppColors.surfaceContainer,
|
||||
contentPadding: const EdgeInsets.symmetric(horizontal: 12, vertical: 12),
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: UIConstants.smallCardBorderRadius,
|
||||
borderSide: const BorderSide(color: AppColors.border),
|
||||
),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderRadius: UIConstants.smallCardBorderRadius,
|
||||
borderSide: const BorderSide(color: AppColors.border),
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderRadius: UIConstants.smallCardBorderRadius,
|
||||
borderSide: const BorderSide(color: AppColors.zinc400, width: 1),
|
||||
),
|
||||
hintStyle: GoogleFonts.inter(
|
||||
color: AppColors.textMuted,
|
||||
fontSize: 14,
|
||||
),
|
||||
labelStyle: GoogleFonts.inter(
|
||||
color: AppColors.textSecondary,
|
||||
fontSize: 14,
|
||||
),
|
||||
),
|
||||
dialogTheme: DialogThemeData(
|
||||
backgroundColor: AppColors.surfaceContainer,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: UIConstants.cardBorderRadius,
|
||||
side: const BorderSide(color: AppColors.border),
|
||||
),
|
||||
titleTextStyle: GoogleFonts.inter(
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: AppColors.textPrimary,
|
||||
),
|
||||
),
|
||||
filledButtonTheme: FilledButtonThemeData(
|
||||
style: FilledButton.styleFrom(
|
||||
backgroundColor: AppColors.zinc50,
|
||||
foregroundColor: AppColors.zinc950,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: UIConstants.smallCardBorderRadius,
|
||||
),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 10),
|
||||
textStyle: GoogleFonts.inter(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
),
|
||||
outlinedButtonTheme: OutlinedButtonThemeData(
|
||||
style: OutlinedButton.styleFrom(
|
||||
foregroundColor: AppColors.textPrimary,
|
||||
side: const BorderSide(color: AppColors.border),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: UIConstants.smallCardBorderRadius,
|
||||
),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 10),
|
||||
textStyle: GoogleFonts.inter(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
),
|
||||
textButtonTheme: TextButtonThemeData(
|
||||
style: TextButton.styleFrom(
|
||||
foregroundColor: AppColors.textSecondary,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: UIConstants.smallCardBorderRadius,
|
||||
),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
|
||||
textStyle: GoogleFonts.inter(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
),
|
||||
tabBarTheme: TabBarThemeData(
|
||||
labelColor: AppColors.textPrimary,
|
||||
unselectedLabelColor: AppColors.textMuted,
|
||||
indicatorColor: AppColors.textPrimary,
|
||||
dividerColor: AppColors.border,
|
||||
labelStyle: GoogleFonts.inter(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
unselectedLabelStyle: GoogleFonts.inter(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w400,
|
||||
),
|
||||
),
|
||||
snackBarTheme: SnackBarThemeData(
|
||||
backgroundColor: AppColors.surfaceContainer,
|
||||
contentTextStyle: GoogleFonts.inter(
|
||||
color: AppColors.textPrimary,
|
||||
fontSize: 14,
|
||||
),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: UIConstants.smallCardBorderRadius,
|
||||
side: const BorderSide(color: AppColors.border),
|
||||
),
|
||||
behavior: SnackBarBehavior.floating,
|
||||
),
|
||||
bottomSheetTheme: const BottomSheetThemeData(
|
||||
backgroundColor: AppColors.surfaceContainer,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.vertical(top: Radius.circular(16)),
|
||||
),
|
||||
),
|
||||
dropdownMenuTheme: DropdownMenuThemeData(
|
||||
inputDecorationTheme: InputDecorationTheme(
|
||||
filled: true,
|
||||
fillColor: AppColors.surfaceContainer,
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: UIConstants.smallCardBorderRadius,
|
||||
borderSide: const BorderSide(color: AppColors.border),
|
||||
),
|
||||
),
|
||||
),
|
||||
checkboxTheme: CheckboxThemeData(
|
||||
fillColor: WidgetStateProperty.resolveWith((states) {
|
||||
if (states.contains(WidgetState.selected)) {
|
||||
return AppColors.zinc50;
|
||||
}
|
||||
return Colors.transparent;
|
||||
}),
|
||||
checkColor: WidgetStateProperty.all(AppColors.zinc950),
|
||||
side: const BorderSide(color: AppColors.zinc400),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(4),
|
||||
),
|
||||
),
|
||||
tooltipTheme: TooltipThemeData(
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.zinc800,
|
||||
borderRadius: BorderRadius.circular(6),
|
||||
border: Border.all(color: AppColors.zinc700),
|
||||
),
|
||||
textStyle: GoogleFonts.inter(
|
||||
color: AppColors.textPrimary,
|
||||
fontSize: 12,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
103
lib/core/theme/app_typography.dart
Normal file
103
lib/core/theme/app_typography.dart
Normal file
@@ -0,0 +1,103 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:trainhub_flutter/core/theme/app_colors.dart';
|
||||
|
||||
class AppTypography {
|
||||
AppTypography._();
|
||||
|
||||
static TextStyle get displayLarge => GoogleFonts.inter(
|
||||
fontSize: 36,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: AppColors.textPrimary,
|
||||
height: 1.2,
|
||||
);
|
||||
|
||||
static TextStyle get headlineLarge => GoogleFonts.inter(
|
||||
fontSize: 28,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: AppColors.textPrimary,
|
||||
height: 1.3,
|
||||
);
|
||||
|
||||
static TextStyle get headlineMedium => GoogleFonts.inter(
|
||||
fontSize: 24,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: AppColors.textPrimary,
|
||||
height: 1.3,
|
||||
);
|
||||
|
||||
static TextStyle get titleLarge => GoogleFonts.inter(
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: AppColors.textPrimary,
|
||||
height: 1.4,
|
||||
);
|
||||
|
||||
static TextStyle get titleMedium => GoogleFonts.inter(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: AppColors.textPrimary,
|
||||
height: 1.4,
|
||||
);
|
||||
|
||||
static TextStyle get titleSmall => GoogleFonts.inter(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: AppColors.textPrimary,
|
||||
height: 1.4,
|
||||
);
|
||||
|
||||
static TextStyle get bodyLarge => GoogleFonts.inter(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w400,
|
||||
color: AppColors.textPrimary,
|
||||
height: 1.5,
|
||||
);
|
||||
|
||||
static TextStyle get bodyMedium => GoogleFonts.inter(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w400,
|
||||
color: AppColors.textPrimary,
|
||||
height: 1.5,
|
||||
);
|
||||
|
||||
static TextStyle get bodySmall => GoogleFonts.inter(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w400,
|
||||
color: AppColors.textSecondary,
|
||||
height: 1.5,
|
||||
);
|
||||
|
||||
static TextStyle get labelLarge => GoogleFonts.inter(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: AppColors.textPrimary,
|
||||
height: 1.4,
|
||||
);
|
||||
|
||||
static TextStyle get labelMedium => GoogleFonts.inter(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: AppColors.textPrimary,
|
||||
height: 1.4,
|
||||
);
|
||||
|
||||
static TextStyle get caption => GoogleFonts.inter(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w400,
|
||||
color: AppColors.textMuted,
|
||||
height: 1.4,
|
||||
);
|
||||
|
||||
static TextStyle get monoLarge => GoogleFonts.jetBrainsMono(
|
||||
fontSize: 72,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: AppColors.textPrimary,
|
||||
);
|
||||
|
||||
static TextStyle get monoMedium => GoogleFonts.jetBrainsMono(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w400,
|
||||
color: AppColors.textPrimary,
|
||||
);
|
||||
}
|
||||
9
lib/core/utils/id_generator.dart
Normal file
9
lib/core/utils/id_generator.dart
Normal file
@@ -0,0 +1,9 @@
|
||||
import 'package:uuid/uuid.dart';
|
||||
|
||||
class IdGenerator {
|
||||
IdGenerator._();
|
||||
|
||||
static const Uuid _uuid = Uuid();
|
||||
|
||||
static String generate() => _uuid.v4();
|
||||
}
|
||||
20
lib/core/utils/json_utils.dart
Normal file
20
lib/core/utils/json_utils.dart
Normal file
@@ -0,0 +1,20 @@
|
||||
import 'dart:convert';
|
||||
|
||||
class JsonUtils {
|
||||
JsonUtils._();
|
||||
|
||||
static List<dynamic> safeDecodeList(String? json) {
|
||||
if (json == null || json.isEmpty) return [];
|
||||
try {
|
||||
final decoded = jsonDecode(json);
|
||||
if (decoded is List) return decoded;
|
||||
return [];
|
||||
} catch (_) {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
static String encodeList(List<Map<String, dynamic>> list) {
|
||||
return jsonEncode(list);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user