Skip to content
This repository was archived by the owner on Sep 14, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
rework loading screen
- center
  • Loading branch information
Nikolas Rimikis committed Apr 18, 2023
commit 39046f8df1c1c434c44759222b322d21b41ccc1a
2 changes: 1 addition & 1 deletion lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ class _AppState extends State<App> {
invalidCredentials: true,
);
case AuthenticationStatus.error:
return const LoadingErrorScreen();
return LoadingErrorScreen(message: state.error!);
}
},
),
Expand Down
58 changes: 29 additions & 29 deletions lib/src/screens/loading_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,39 +4,39 @@ import 'package:flutter_translate/flutter_translate.dart';
import 'package:nextcloud_cookbook_flutter/src/blocs/authentication/authentication_bloc.dart';

class LoadingErrorScreen extends StatelessWidget {
const LoadingErrorScreen({super.key});
const LoadingErrorScreen({required this.message, super.key});

final String message;

@override
Widget build(BuildContext context) {
return Scaffold(
body: BlocBuilder<AuthenticationBloc, AuthenticationState>(
builder: (context, authenticationState) {
return Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(authenticationState.error!),
const SizedBox(height: 10),
ElevatedButton(
onPressed: () {
BlocProvider.of<AuthenticationBloc>(context)
.add(const AppStarted());
},
child: Text(translate("login.retry")),
),
const SizedBox(height: 10),
ElevatedButton(
onPressed: () {
BlocProvider.of<AuthenticationBloc>(context)
.add(const LoggedOut());
},
child: Text(translate("login.reset")),
),
],
),
);
},
body: Center(
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(message),
const SizedBox(height: 10),
ElevatedButton(
onPressed: () {
BlocProvider.of<AuthenticationBloc>(context)
.add(const AppStarted());
},
child: Text(translate("login.retry")),
),
const SizedBox(height: 10),
ElevatedButton(
onPressed: () {
BlocProvider.of<AuthenticationBloc>(context)
.add(const LoggedOut());
},
child: Text(translate("login.reset")),
),
],
),
),
),
);
}
Expand Down