mobile_team/lib/main.dart
2026-04-16 15:06:41 +05:30

117 lines
3.8 KiB
Dart

import 'package:firebase_core/firebase_core.dart';
import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:provider/provider.dart';
import 'providers/auth_provider.dart';
import 'screens/login_screen.dart';
import 'screens/home_screen.dart';
import 'services/auth_service.dart';
import 'services/project_service.dart';
import 'services/task_log_service.dart';
import 'services/report_service.dart';
import 'firebase_options.dart';
void main() async {
WidgetsFlutterBinding.ensureInitialized();
try {
await Firebase.initializeApp(
options: DefaultFirebaseOptions.currentPlatform,
);
} catch (e) {
debugPrint("Firebase not initialized: $e");
}
runApp(
MultiProvider(
providers: [
ChangeNotifierProvider(create: (_) => AuthProvider()),
Provider(create: (_) => AuthService()),
Provider(create: (_) => ProjectService()),
Provider(create: (_) => TaskLogService()),
Provider(create: (_) => ReportService()),
],
child: const MyApp(),
),
);
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Antigravity Logs',
debugShowCheckedModeBanner: false,
theme: ThemeData(
useMaterial3: true,
colorScheme: ColorScheme.fromSeed(
seedColor: const Color(0xFF6366F1), // Modern Indigo
primary: const Color(0xFF6366F1),
secondary: const Color(0xFFEC4899), // Pink accent
surface: Colors.white,
background: const Color(0xFFF8FAFC), // Slight grayish background
),
textTheme: GoogleFonts.outfitTextTheme(),
appBarTheme: AppBarTheme(
centerTitle: true,
elevation: 0,
backgroundColor: Colors.transparent,
surfaceTintColor: Colors.transparent,
titleTextStyle: GoogleFonts.outfit(
color: const Color(0xFF1E293B),
fontSize: 20,
fontWeight: FontWeight.bold,
),
iconTheme: const IconThemeData(color: Color(0xFF64748B)),
),
elevatedButtonTheme: ElevatedButtonThemeData(
style: ElevatedButton.styleFrom(
backgroundColor: const Color(0xFF6366F1),
foregroundColor: Colors.white,
minimumSize: const Size(double.infinity, 56),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(16),
),
elevation: 0,
textStyle: const TextStyle(fontWeight: FontWeight.bold, fontSize: 16),
),
),
inputDecorationTheme: InputDecorationTheme(
filled: true,
fillColor: Colors.white,
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(16),
borderSide: BorderSide(color: Colors.grey.shade200),
),
enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(16),
borderSide: BorderSide(color: Colors.grey.shade200),
),
focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(16),
borderSide: const BorderSide(color: Color(0xFF6366F1), width: 2),
),
contentPadding: const EdgeInsets.all(18),
),
cardTheme: CardThemeData(
elevation: 0,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20),
side: BorderSide(color: Colors.grey.shade100),
),
color: Colors.white,
),
),
home: Consumer<AuthProvider>(
builder: (context, auth, _) {
return auth.isAuthenticated
? const HomeScreen()
: const LoginScreen();
},
),
);
}
}