import 'package:flutter/material.dart';
import 'package:flutter_dotenv/flutter_dotenv.dart';
import '/views/main/home.dart';
import '/views/authentication/unauthenticated_landing.dart';
import '/views/authentication/login.dart';
import '/views/authentication/signup.dart';

void main() async {
  await dotenv.load(fileName: ".env");
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  static const String _title = 'Capsule';

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
        title: _title,
        routes: {
          '/home': (context) => const Home(),
          '/landing': (context) => const UnauthenticatedLandingWidget(),
          '/login': (context) => const Login(),
          '/signup': (context) => const Signup(),
        },
        home: const Scaffold(
                  body: SafeArea(
                      child: Home(),
                  )
              ),
        theme: ThemeData(
            brightness: Brightness.light,
            primaryColor: Colors.red,
            appBarTheme: const AppBarTheme(
                backgroundColor: Colors.cyan,
                elevation: 0,
            ),
            inputDecorationTheme: const InputDecorationTheme(
                labelStyle: TextStyle(
                    color: Colors.white,
                    fontSize: 30,
                ),
                filled: false,
            ),
        ),
      darkTheme: ThemeData(
          brightness: Brightness.dark,
          primaryColor: Colors.orange.shade900,
          backgroundColor: Colors.grey.shade800,
          scaffoldBackgroundColor: Colors.grey[850],
          disabledColor: Colors.grey[400],
          colorScheme: ColorScheme(
              brightness: Brightness.dark,
              primary: Colors.orange.shade900,
              onPrimary: Colors.white,
              secondary: Colors.orange.shade900,
              onSecondary: Colors.white,
              tertiary: Colors.grey.shade500,
              onTertiary: Colors.black,
              error: Colors.red,
              onError: Colors.white,
              background: Colors.grey.shade900,
              onBackground: Colors.white,
              surface: Colors.grey.shade700,
              onSurface: Colors.white,
          ),
          hintColor: Colors.grey.shade500,
          inputDecorationTheme: InputDecorationTheme(
              filled: true,
              fillColor: Colors.grey.shade800,
              hintStyle: TextStyle(
                  color: Colors.grey.shade500,
              ),
              iconColor: Colors.grey.shade500,
              contentPadding: const EdgeInsets.all(8),
              enabledBorder: OutlineInputBorder(
                  borderRadius: BorderRadius.circular(15),
                  borderSide: const BorderSide(
                      color: Colors.transparent,
                  )
              ),
              focusedBorder: OutlineInputBorder(
                  borderRadius: BorderRadius.circular(15),
                  borderSide: const BorderSide(
                      color: Colors.transparent,
                  )
              ),

          ),
          appBarTheme: AppBarTheme(
              color: Colors.grey.shade800,
              iconTheme: IconThemeData(
                  color: Colors.grey.shade400
              ),
              toolbarTextStyle: TextStyle(
                  color: Colors.grey.shade400
              ),
          ),
      ),
    );
  }
}
