import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import '../core/app_colors.dart';
import '../services/theme_service.dart';

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

  @override
  Widget build(BuildContext context) {
    final theme = context.watch<ThemeService>();
    return Scaffold(
      appBar: AppBar(title: const Text('Configuracion'),
          backgroundColor: AppColors.guindaPrimary, foregroundColor: Colors.white,
          bottom: PreferredSize(preferredSize: const Size.fromHeight(4),
              child: Container(height: 4, color: AppColors.dorado))),
      body: ListView(padding: const EdgeInsets.all(16), children: [
        Card(child: Column(children: [
          const Padding(padding: EdgeInsets.all(14),
            child: Row(children: [
              Icon(Icons.palette_outlined, color: AppColors.guindaPrimary),
              SizedBox(width: 8),
              Text('Apariencia', style: TextStyle(fontWeight: FontWeight.bold, fontSize: 15)),
            ])),
          const Divider(height: 1),
          SwitchListTile(
            value: theme.isDark,
            onChanged: (_) => theme.toggle(),
            secondary: Icon(theme.isDark ? Icons.dark_mode : Icons.light_mode,
                color: theme.isDark ? Colors.amber : AppColors.guindaPrimary),
            title: Text(theme.isDark ? 'Modo oscuro activo' : 'Modo claro activo'),
            subtitle: const Text('Util para rutas nocturnas'),
            activeColor: AppColors.guindaPrimary,
          ),
        ])),
        const SizedBox(height: 12),
        Card(child: Column(children: [
          const Padding(padding: EdgeInsets.all(14),
            child: Row(children: [
              Icon(Icons.info_outline, color: AppColors.guindaPrimary),
              SizedBox(width: 8),
              Text('Acerca de', style: TextStyle(fontWeight: FontWeight.bold, fontSize: 15)),
            ])),
          const Divider(height: 1),
          const ListTile(leading: Icon(Icons.location_city), title: Text('H. Ayuntamiento de Celaya'),
              subtitle: Text('Guanajuato, Mexico')),
          const ListTile(leading: Icon(Icons.code), title: Text('Version 2.0.0'),
              subtitle: Text('Sistema Integral de Recoleccion de Residuos')),
        ])),
      ]),
    );
  }
}
