import 'package:flutter/material.dart';
import 'package:mitra_corporate/screen/home/home_screen.dart';
import 'package:mitra_corporate/screen/loging/loging.dart';
import 'package:mitra_corporate/screen/splash_screen.dart/splash_screen.dart';

import '../screen/login/login_screen.dart';

const loginRoute = "/LoginScreen";
const registrasiPasienRoute = "/RegistrasiPasienScrenn";
const suratJalanRoute = "/SuratJalanScreen";
const suratJalanDetailRoute = "/SuratJalanDetailScreen";
const homeRoute = "/homeRoute";

const dashboardRoute = "/DashboardScreen";
const splashRoute = "/splashRoute";
const logingRoute = "/logingRoute";

class AppRoute {
  static Route<dynamic>? generateRoute(RouteSettings settings) {
    if (settings.name == loginRoute) {
      return MaterialPageRoute(builder: (context) {
        return MediaQuery(
            data: MediaQuery.of(context).copyWith(
              padding: const EdgeInsets.all(0),
              textScaler: TextScaler.linear(1.0),
            ),
            child: LoginScreen());
      });
    }

    // if (settings.name == dashboardRoute) {
    //   return MaterialPageRoute(builder: (context) {
    //     return MediaQuery(
    //         data: MediaQuery.of(context).copyWith(
    //           textScaleFactor: 1.0,
    //           padding: const EdgeInsets.all(0),
    //         ),
    //         child: DashboardScreen());
    //   });
    // }
    if (settings.name == homeRoute) {
      return MaterialPageRoute(builder: (context) {
        return MediaQuery(
            data: MediaQuery.of(context).copyWith(
              padding: const EdgeInsets.all(0),
              textScaler: TextScaler.linear(1.0),
            ),
            child: HomeScreen());
      });
    }

    // if (settings.name == registrasiPasienRoute) {
    //   return MaterialPageRoute(builder: (context) {
    //     return MediaQuery(
    //         data: MediaQuery.of(context).copyWith(
    //           textScaleFactor: 1.0,
    //           padding: const EdgeInsets.all(0),
    //         ),
    //         child: const RegistrasiPasienScreen());
    //   });
    // }

    // if (settings.name == suratJalanRoute) {
    //   return MaterialPageRoute(builder: (context) {
    //     return MediaQuery(
    //         data: MediaQuery.of(context).copyWith(
    //           textScaleFactor: 1.0,
    //           padding: const EdgeInsets.all(0),
    //         ),
    //         child: const SuratJalanScreen());
    //   });
    // }

    // if (settings.name == suratJalanDetailRoute) {
    //   return MaterialPageRoute(builder: (context) {
    //     return MediaQuery(
    //         data: MediaQuery.of(context).copyWith(
    //           textScaleFactor: 1.0,
    //           padding: const EdgeInsets.all(0),
    //         ),
    //         child: const SuratJalanDetailScreen());
    //   });
    // }
    if (settings.name == splashRoute) {
      return MaterialPageRoute(builder: (context) {
        return MediaQuery(
            data: MediaQuery.of(context).copyWith(
              padding: const EdgeInsets.all(0),
              textScaler: TextScaler.linear(1.0),
            ),
            child: const SplashScreen());
      });
    }
    if (settings.name == logingRoute) {
      return MaterialPageRoute(builder: (context) {
        return MediaQuery(
            data: MediaQuery.of(context).copyWith(
              padding: const EdgeInsets.all(0),
              textScaler: TextScaler.linear(1.0),
            ),
            child: const LogingScreen());
      });
    }
    return null;
  }
}
