Files
home-control/lib/main.dart
2026-06-14 15:34:53 -04:00

114 lines
3.2 KiB
Dart

import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'providers/servicio_provider.dart';
import 'providers/factura_provider.dart';
import 'providers/configuracion_provider.dart';
import 'screens/splash_screen.dart';
import 'utils/transitions.dart';
void main() {
WidgetsFlutterBinding.ensureInitialized();
runApp(
MultiProvider(
providers: [
ChangeNotifierProvider(create: (_) => ServicioProvider()),
ChangeNotifierProvider(create: (_) => FacturaProvider()),
ChangeNotifierProvider(create: (_) => ConfiguracionProvider()),
],
child: const HogarControlApp(),
),
);
}
class HogarControlApp extends StatelessWidget {
const HogarControlApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Factura del Hogar',
debugShowCheckedModeBanner: false,
theme: _buildLightTheme(),
darkTheme: _buildDarkTheme(),
themeMode: ThemeMode.system,
home: const SplashScreen(),
);
}
ThemeData _buildLightTheme() {
final colorScheme = ColorScheme.fromSeed(
seedColor: Colors.teal,
brightness: Brightness.light,
);
return ThemeData(
colorScheme: colorScheme,
useMaterial3: true,
cardTheme: CardTheme(
elevation: 1,
shadowColor: colorScheme.shadow,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(16),
),
clipBehavior: Clip.antiAlias,
),
inputDecorationTheme: InputDecorationTheme(
filled: true,
fillColor: colorScheme.surfaceContainerHighest,
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(12),
),
contentPadding: const EdgeInsets.symmetric(
horizontal: 16,
vertical: 14,
),
),
pageTransitionsTheme: const PageTransitionsTheme(
builders: {
TargetPlatform.android: SmoothPageTransitionBuilder(),
TargetPlatform.iOS: SmoothPageTransitionBuilder(),
},
),
textTheme: const TextTheme(
titleLarge: TextStyle(fontWeight: FontWeight.w600),
titleMedium: TextStyle(fontWeight: FontWeight.w600),
),
);
}
ThemeData _buildDarkTheme() {
final colorScheme = ColorScheme.fromSeed(
seedColor: Colors.teal,
brightness: Brightness.dark,
);
return ThemeData(
colorScheme: colorScheme,
useMaterial3: true,
cardTheme: CardTheme(
elevation: 1,
shadowColor: colorScheme.shadow,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(16),
),
clipBehavior: Clip.antiAlias,
),
inputDecorationTheme: InputDecorationTheme(
filled: true,
fillColor: colorScheme.surfaceContainerHighest,
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(12),
),
contentPadding: const EdgeInsets.symmetric(
horizontal: 16,
vertical: 14,
),
),
pageTransitionsTheme: const PageTransitionsTheme(
builders: {
TargetPlatform.android: SmoothPageTransitionBuilder(),
TargetPlatform.iOS: SmoothPageTransitionBuilder(),
},
),
);
}
}