cpd_job_app/lib/main.dart

70 lines
2.2 KiB
Dart
Raw Normal View History

2023-06-06 21:29:18 +02:00
import 'package:cpd_ss23/user_state.dart';
2023-05-31 20:04:38 +02:00
import 'package:firebase_core/firebase_core.dart';
import 'package:cpd_ss23/firebase_options.dart'; // Importieren Sie die Firebase-Optionen
import 'package:flutter/material.dart';
void main() async {
2023-05-31 20:04:38 +02:00
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp(options: DefaultFirebaseOptions.currentPlatform);
runApp(MyApp());
}
class MyApp extends StatelessWidget {
final Future<FirebaseApp> _initialisation = Firebase.initializeApp();
@override
Widget build(BuildContext context) {
return FutureBuilder(
future: _initialisation,
builder: (context, snapshot) {
if (snapshot.connectionState == ConnectionState.waiting) {
return const MaterialApp(
home: Scaffold(
body: Center(
child: Text(
"JobFinder is being initialized",
style: TextStyle(
color: Colors.redAccent,
fontSize: 38,
fontWeight: FontWeight.bold,
fontFamily: 'Signatra',
),
),
),
),
);
} else if (snapshot.hasError && snapshot.hasData) {
print('Firebase Error: ${snapshot.error}');
print('Firebase hasData: ${snapshot.hasData}');
print('Firebase ConnectionState: ${snapshot.connectionState}');
return MaterialApp(
home: Scaffold(
body: Center(
child: Text(
'Error: ${snapshot.error} AND ${snapshot.hasData} AND ${snapshot.connectionState}',
style: const TextStyle(
color: Colors.green,
fontSize: 40,
fontWeight: FontWeight.bold,
),
),
),
),
);
}
return MaterialApp(
debugShowCheckedModeBanner: false,
title: "JobFinder App CPD_SS23",
theme: ThemeData(
scaffoldBackgroundColor: Colors.grey,
primarySwatch: Colors.blue,
),
2023-06-06 21:29:18 +02:00
home: UserState(),
2023-05-31 20:04:38 +02:00
);
},
);
}
}