mirror of
https://github.com/Xevion/paperless-mobile.git
synced 2025-12-09 22:07:53 -06:00
Updated onboarding, reformatted files, improved referenced documents view, updated error handling
This commit is contained in:
@@ -1,14 +1,12 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:flutter_form_builder/flutter_form_builder.dart';
|
||||
import 'package:paperless_mobile/core/model/error_message.dart';
|
||||
import 'package:paperless_mobile/di_initializer.dart';
|
||||
import 'package:paperless_mobile/extensions/flutter_extensions.dart';
|
||||
import 'package:paperless_mobile/features/login/bloc/authentication_cubit.dart';
|
||||
import 'package:paperless_mobile/features/login/view/widgets/client_certificate_form_field.dart';
|
||||
import 'package:paperless_mobile/features/login/view/widgets/server_address_form_field.dart';
|
||||
import 'package:paperless_mobile/features/login/view/widgets/user_credentials_form_field.dart';
|
||||
import 'package:paperless_mobile/generated/l10n.dart';
|
||||
import 'package:paperless_mobile/util.dart';
|
||||
|
||||
class LoginPage extends StatefulWidget {
|
||||
const LoginPage({Key? key}) : super(key: key);
|
||||
@@ -73,7 +71,8 @@ class _LoginPageState extends State<LoginPage> {
|
||||
Widget _buildLoginButton() {
|
||||
return ElevatedButton(
|
||||
style: ButtonStyle(
|
||||
backgroundColor: MaterialStatePropertyAll(Theme.of(context).colorScheme.primaryContainer),
|
||||
backgroundColor: MaterialStatePropertyAll(
|
||||
Theme.of(context).colorScheme.primaryContainer),
|
||||
elevation: const MaterialStatePropertyAll(0),
|
||||
),
|
||||
onPressed: _login,
|
||||
@@ -83,19 +82,17 @@ class _LoginPageState extends State<LoginPage> {
|
||||
);
|
||||
}
|
||||
|
||||
void _login() async {
|
||||
void _login() {
|
||||
FocusScope.of(context).unfocus();
|
||||
if (_formKey.currentState?.saveAndValidate() ?? false) {
|
||||
setState(() => _isLoginLoading = true);
|
||||
final form = _formKey.currentState?.value;
|
||||
getIt<AuthenticationCubit>()
|
||||
BlocProvider.of<AuthenticationCubit>(context)
|
||||
.login(
|
||||
credentials: form?[UserCredentialsFormField.fkCredentials],
|
||||
serverUrl: form?[ServerAddressFormField.fkServerAddress],
|
||||
clientCertificate: form?[ClientCertificateFormField.fkClientCertificate],
|
||||
) //TODO: Move Intro slider route push here!
|
||||
.onError<ErrorMessage>(
|
||||
(error, _) => showError(context, error),
|
||||
clientCertificate:
|
||||
form?[ClientCertificateFormField.fkClientCertificate],
|
||||
)
|
||||
.whenComplete(() => setState(() => _isLoginLoading = false));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user