import 'package:flutter/material.dart';
import 'package:preferences/preferences.dart';
import 'package:provider/provider.dart';
import 'package:toolheim/data/github_adapter.dart';
import 'package:toolheim/screens/settings_screen.dart';
import 'package:toolheim/screens/unit_screen.dart';
import 'package:toolheim/screens/warband_roster_screen.dart';

void main() async {
  await PrefService.init(prefix: 'toolheim_');
  runApp(Toolheim());
}

class Toolheim extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return ChangeNotifierProvider(
      builder: (context) => GitHubAdapter(),
      child: MaterialApp(
        debugShowCheckedModeBanner: false,
        title: 'Toolheim',
        theme: ThemeData(
          primarySwatch: Colors.brown,
          accentColor: Colors.grey,
        ),
        initialRoute: '/',
        routes: {
          '/': (context) => WarbandRosterScreen(),
          '/unit': (context) => UnitScreen(),
          '/settings': (context) => SettingsScreen(),
        },
      ),
    );
  }
}
