import 'package:flutter/material.dart';
import 'package:flutter_downloader/flutter_downloader.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:quiosco_soler_2/catalogo/pages/apl.dart';
import 'package:quiosco_soler_2/memorias_calculo/pages/atenuadores_acusticos.dart';
import 'package:quiosco_soler_2/memorias_calculo/pages/memorias_index.dart';
import 'package:quiosco_soler_2/memorias_calculo/pages/ventilacion_ambiental_page.dart';
import 'package:quiosco_soler_2/quiosco/pages/files_page.dart';
import 'package:quiosco_soler_2/quiosco/pages/order_page.dart';
import 'package:quiosco_soler_2/quiosco/pages/otp_page.dart';
import 'package:quiosco_soler_2/quiosco/pages/search_page.dart';
import 'package:quiosco_soler_2/quiosco/pages/sections_page.dart';
import 'package:quiosco_soler_2/quiosco/pages/categories_page.dart';
import 'package:quiosco_soler_2/quiosco/pages/home_page.dart';
import 'package:quiosco_soler_2/src/pages/check_page.dart';
import 'package:quiosco_soler_2/src/pages/menu_inicio.dart';

import 'catalogo/pages/recuperacion_energia.dart';
import 'memorias_calculo/pages/ventilacion_estacionamientos.dart';
import 'memorias_calculo/pages/ventilacion_localizada_page.dart';

void main() async{
  WidgetsFlutterBinding.ensureInitialized();
  await FlutterDownloader.initialize();
  runApp(const MyApp());
}

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Catálogo Soler & Palau',
      debugShowCheckedModeBanner: false,
      initialRoute: 'menini',
      routes: {
        'menini' : (context) => const MenuInicio(),
        'check'  : (context) => const CheckPage(),
        'ener'   : (context) => const RecuperacionEnergia(),
        'apl'    : (context) => const APL(),
        'indexMC': (context) => const MemoriasIndex(),
        "ventilacionLocalizada": (ctx) => const VentilacionLocalizadaPage(),
        "ventilacionEstacionamientos": (ctx) => const VentilacionEstacionamientosPage(),
        "ventilacionAmbiental": (ctx) => const VentilacionAmbientalPage(),
        "atenuadoresAcusticos": (ctx) => const AtenuadoresAcusticosPage(),
        'otp'    : (context) => const OTPPage(),
        'home'   : (context) => const HomePage(),
        'secc'   : (context) => const SectionsPage(),
        'cate'   : (context) => const CategoriesPage(),
        'files'  : (context) => const FilesPage(),
        'search' : (context) => const SearchPage(),
        'order'  : (context) => const OrderPage()
      },
      onGenerateRoute: (settings) => MaterialPageRoute(
        builder: (context) => const CheckPage(),
      ),
      theme: ThemeData(
        brightness: Brightness.light,
        primaryColor: const Color.fromRGBO(255, 0, 0, 1),
        splashColor: const Color.fromRGBO(180, 4, 4, 1),
        colorScheme: const ColorScheme.light(
          primary: Color.fromRGBO(180, 4, 4, 1),
        ).copyWith(
          secondary: const Color.fromRGBO(180, 4, 4, 1),
        ),
      ),
      localizationsDelegates: const [
        GlobalMaterialLocalizations.delegate
      ],
      supportedLocales: const [
        Locale('en'),
        Locale('es')
      ],
    );
  }
}
