Files
KC-APP/client/app/lib/main.dart
linusandClaude Sonnet 5 8af927c0f2 feat(backend): Wahl-Phasen, Verantwortliche-Invites, Auth fixes
- New VerantwortlicheInvite model: LT-issued invites so a person can
  register as Gemeinde Verantwortliche(r) for a specific Gemeinde,
  skipping the self-registration approval step.
- Wahl/Workshop/Teilnehmer gain phase support (phasenAnzahl,
  beschreibung), mirroring the WP plugin's multi-phase elections.
  Teilnehmer unique constraint now scoped per phase.
- Auth: team login + guest auth adjustments, spec coverage.
- sync.service.ts: register VerantwortlicheInvite as a synced model.
- wahl.service.ts: submitTeilnehmer updated for the new phase-scoped
  unique key.
- client: login/home screen rework, new theme.dart, FCM web tweaks.
- .gitignore: ignore .DS_Store.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-11 18:00:18 +02:00

57 lines
1.5 KiB
Dart

import 'package:flutter/material.dart';
import 'package:http/http.dart' as http;
import 'api.dart';
import 'screens/home_screen.dart';
import 'screens/login_screen.dart';
import 'theme.dart';
void main() {
final state = AppState(Api(http.Client()))..bootstrap();
runApp(KcApp(state: state));
}
/// Minimal InheritedNotifier so screens can read `AppState.of(context)` and
/// rebuild on change — no third-party state management.
class AppScope extends InheritedNotifier<AppState> {
const AppScope({super.key, required AppState state, required super.child})
: super(notifier: state);
static AppState of(BuildContext context) {
final scope = context.dependOnInheritedWidgetOfExactType<AppScope>();
assert(scope != null, 'AppScope missing above this widget');
return scope!.notifier!;
}
}
class KcApp extends StatelessWidget {
const KcApp({super.key, required this.state});
final AppState state;
@override
Widget build(BuildContext context) {
return AppScope(
state: state,
child: MaterialApp(
title: 'KC-App',
debugShowCheckedModeBanner: false,
theme: buildKcTheme(),
home: const _AuthGate(),
),
);
}
}
class _AuthGate extends StatelessWidget {
const _AuthGate();
@override
Widget build(BuildContext context) {
final state = AppScope.of(context);
if (state.loading) {
return const Scaffold(body: Center(child: CircularProgressIndicator()));
}
return state.isLoggedIn ? const HomeScreen() : const LoginScreen();
}
}