import 'package:ernaehrung/pages/nav_pages/main_page.dart';
import 'package:ernaehrung/pages/user_data_form/initial_user_data_form.dart';
import 'package:flutter/material.dart';
import 'package:flutter_dotenv/flutter_dotenv.dart';
import 'package:hive/hive.dart';
import 'models/user.dart';

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

  @override
  Widget build(BuildContext context) {
    final box = Hive.box<User>(dotenv.env['USER_BOX'] ?? 'USER');
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      title: 'Flutter Demo',
      theme: ThemeData(
        scaffoldBackgroundColor: Colors.grey.shade200, //<-- SEE
      ),
      home: box.get("USER") == null ? const OnboardingPage() : const MainPage(),
      routes: {
        '/navigation': (context) => const  MainPage(),
      },
    );
  }
}