Daily commit

This commit is contained in:
Dennis Nemec
2026-02-05 10:46:13 +01:00
parent 4e808e234d
commit e0007dcf33
51 changed files with 2131 additions and 139 deletions

View File

@ -1,4 +1,17 @@
import 'package:app_gaslieferung/bloc/authentication/auth_bloc.dart';
import 'package:app_gaslieferung/bloc/authentication/auth_event.dart';
import 'package:app_gaslieferung/bloc/authentication/auth_state.dart';
import 'package:app_gaslieferung/bloc/message_wrapper/message_bloc.dart';
import 'package:app_gaslieferung/bloc/message_wrapper/message_event.dart';
import 'package:app_gaslieferung/exceptions/login.dart';
import 'package:app_links/app_links.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:url_launcher/url_launcher.dart';
import '../../bloc/tour_select/bloc.dart';
import '../../repository/tour_repository.dart';
import '../../service/tour_service.dart';
import '../../util/login.dart';
import 'tour_select.dart';
class LoginPage extends StatefulWidget {
@ -9,46 +22,67 @@ class LoginPage extends StatefulWidget {
}
class _LoginPageState extends State<LoginPage> {
void _onLogin() {
Navigator.pushReplacement(context, MaterialPageRoute(builder: (context) => const TourSelectPage()));
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: Padding(
padding: EdgeInsets.only(
top: MediaQuery.of(context).size.height * 0.1,
),
child: Column(
children: [
Image.asset(
"assets/graphics/bg-supplier-clouds.png",
fit: BoxFit.contain,
),
Text(
"Willkommen bei\nGaslieferung!",
style: Theme.of(context).textTheme.headlineMedium,
textAlign: TextAlign.center,
body: BlocConsumer<AuthBloc, AuthState>(
builder: (context, state) {
return Center(
child: Padding(
padding: EdgeInsets.only(
top: MediaQuery.of(context).size.height * 0.1,
),
child: Column(
children: [
Image.asset(
"assets/graphics/bg-supplier-clouds.png",
fit: BoxFit.contain,
),
Text(
"Willkommen bei\nGaslieferung!",
style: Theme.of(context).textTheme.headlineMedium,
textAlign: TextAlign.center,
),
Text(
"\nMelden Sie sich an, um Ihre Tour zu starten.",
style: Theme.of(context).textTheme.bodySmall,
textAlign: TextAlign.center,
),
Text(
"\nMelden Sie sich an, um Ihre Tour zu starten.",
style: Theme.of(context).textTheme.bodySmall,
textAlign: TextAlign.center,
),
Padding(
padding: const EdgeInsets.all(50),
child: FilledButton(
onPressed: _onLogin,
child: Text("Einloggen"),
Padding(
padding: const EdgeInsets.all(50),
child: FilledButton(
onPressed: () {
context.read<AuthBloc>().add(AuthLoginEvent());
},
child: Text("Einloggen"),
),
),
],
),
),
);
},
listener: (context, state) {
if (state is AuthenticatedState) {
Navigator.pushReplacement(
context,
MaterialPageRoute(
builder: (context) => BlocProvider(
create: (context) => TourSelectBloc(
repository: TourRepository(
service: TourService(
baseUrl: "http://127.0.0.1:3000",
),
),
),
child: TourSelectPage(),
),
),
],
),
),
);
}
},
),
);
}