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

import 'injection_container.dart';
import 'presentation/blocs/wall/wall_bloc.dart';
import 'presentation/blocs/wall/wall_event.dart';
import 'presentation/screens/main_screen.dart';

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

  @override
  Widget build(BuildContext context) {
    return BlocProvider<WallBloc>(
      create: (_) => sl<WallBloc>()..add(const LoadWallConfig()),
      child: MaterialApp(
        title: 'COPILOT Keyboard',
        theme: _buildDarkTheme(),
        darkTheme: _buildDarkTheme(),
        themeMode: ThemeMode.dark,
        debugShowCheckedModeBanner: false,
        home: const MainScreen(),
      ),
    );
  }

  ThemeData _buildDarkTheme() {
    return ThemeData(
      useMaterial3: true,
      colorScheme: ColorScheme.fromSeed(
        seedColor: const Color(0xFF00D4FF),
        brightness: Brightness.dark,
      ),
      scaffoldBackgroundColor: const Color(0xFF0A0E14),
      cardTheme: CardTheme(
        elevation: 0,
        color: const Color(0xFF151A22),
        shape: RoundedRectangleBorder(
          borderRadius: BorderRadius.circular(4),
        ),
      ),
      elevatedButtonTheme: ElevatedButtonThemeData(
        style: ElevatedButton.styleFrom(
          minimumSize: const Size(36, 36),
          padding: const EdgeInsets.symmetric(horizontal: 12),
        ),
      ),
    );
  }
}
