feat: Matrix login flow with auth guard and client provider
This commit is contained in:
+25
-1
@@ -1,8 +1,32 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:pyramid/core/app.dart';
|
||||
import 'package:pyramid/core/matrix_client.dart';
|
||||
|
||||
void main() async {
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
runApp(const ProviderScope(child: PyramidApp()));
|
||||
runApp(const ProviderScope(child: PyramidBootstrap()));
|
||||
}
|
||||
|
||||
class PyramidBootstrap extends ConsumerWidget {
|
||||
const PyramidBootstrap({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final clientAsync = ref.watch(matrixClientProvider);
|
||||
|
||||
return clientAsync.when(
|
||||
loading: () => const MaterialApp(
|
||||
home: Scaffold(
|
||||
body: Center(child: CircularProgressIndicator()),
|
||||
),
|
||||
),
|
||||
error: (e, _) => MaterialApp(
|
||||
home: Scaffold(
|
||||
body: Center(child: Text('Fehler: $e')),
|
||||
),
|
||||
),
|
||||
data: (_) => const PyramidApp(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user