import 'package:flutter/material.dart';
import 'package:provider/provider.dart';

import 'pages/about_page.dart';
import 'pages/flood_station_page.dart';
import 'pages/main_navigation_scaffold.dart';
import 'services/flood_station_provider.dart';
import 'package:timezone/data/latest.dart' as tz;

import 'theme.dart';

void main() {
  runApp(
    ChangeNotifierProvider(
      create: (context) => FloodStationProvider(),
      child: const MyApp(),
    ),
  );
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    tz.initializeTimeZones();
    return MaterialApp(
      title: 'Floodwatch',
      theme: defaultTheme,
      initialRoute: MainNavigationScaffold.routeName,
      routes: {
        MainNavigationScaffold.routeName: (context) => MainNavigationScaffold(),
        FloodStationPage.routeName: (context) => FloodStationPage(),
        AboutPage.routeName: (context) => AboutPage(),
      },
    );
  }
}
