Co-authored-by: Azareth-Tr <Azareth-Tr@users.noreply.github.com>
Co-authored-by: MENDOZA BALLARDO GAEL RICARDO <gael-meb123@users.noreply.github.com> configuracion para firebase
This commit is contained in:
@@ -1,88 +1,9 @@
|
||||
// ============================================================
|
||||
// main.dart — App Recolecta (corregido)
|
||||
// Cambios aplicados:
|
||||
// 1. Agregados imports faltantes (material, riverpod)
|
||||
// 2. Corregido ColorScheme.fromSeed (faltaba el tipo)
|
||||
// 3. Corregido MainAxisAlignment.center (faltaba el tipo)
|
||||
// 4. Agregado WidgetsFlutterBinding.ensureInitialized() antes de dotenv
|
||||
// ============================================================
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:flutter_dotenv/flutter_dotenv.dart';
|
||||
|
||||
import 'app/app.dart';
|
||||
|
||||
Future<void> main() async {
|
||||
// NECESARIO antes de cualquier async en main (inicializa el motor de Flutter)
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
|
||||
// Carga el .env desde assets/
|
||||
await dotenv.load(fileName: "assets/.env");
|
||||
|
||||
runApp(const ProviderScope(child: MyApp()));
|
||||
runApp(const ProviderScope(child: RecolectaApp()));
|
||||
}
|
||||
|
||||
class MyApp extends StatelessWidget {
|
||||
const MyApp({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return MaterialApp(
|
||||
title: 'Recolecta',
|
||||
theme: ThemeData(
|
||||
// ❌ ANTES: colorScheme: .fromSeed(seedColor: Colors.deepPurple),
|
||||
// ✅ AHORA: faltaba el tipo ColorScheme antes del .fromSeed
|
||||
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
|
||||
useMaterial3: true,
|
||||
),
|
||||
home: const MyHomePage(title: 'Recolecta - Demo'),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class MyHomePage extends StatefulWidget {
|
||||
const MyHomePage({super.key, required this.title});
|
||||
|
||||
final String title;
|
||||
|
||||
@override
|
||||
State<MyHomePage> createState() => _MyHomePageState();
|
||||
}
|
||||
|
||||
class _MyHomePageState extends State<MyHomePage> {
|
||||
int _counter = 0;
|
||||
|
||||
void _incrementCounter() {
|
||||
setState(() {
|
||||
_counter++;
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
backgroundColor: Theme.of(context).colorScheme.inversePrimary,
|
||||
title: Text(widget.title),
|
||||
),
|
||||
body: Center(
|
||||
child: Column(
|
||||
// ❌ ANTES: mainAxisAlignment: .center,
|
||||
// ✅ AHORA: faltaba el tipo MainAxisAlignment antes del .center
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
const Text('You have pushed the button this many times:'),
|
||||
Text(
|
||||
'$_counter',
|
||||
style: Theme.of(context).textTheme.headlineMedium,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
floatingActionButton: FloatingActionButton(
|
||||
onPressed: _incrementCounter,
|
||||
tooltip: 'Increment',
|
||||
child: const Icon(Icons.add),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user