fix: authwebview

This commit is contained in:
Christian Pauly 2021-01-16 15:13:29 +01:00
parent 6d5dc9fcdb
commit 2f7749a0c5
5 changed files with 10 additions and 34 deletions

View File

@ -135,6 +135,7 @@ class HomeserverPicker extends StatelessWidget {
children: [
if (AppConfig.allowOtherHomeservers)
FlatButton(
padding: EdgeInsets.all(8),
child: Text(
L10n.of(context).changeTheHomeserver,
style: TextStyle(
@ -146,6 +147,7 @@ class HomeserverPicker extends StatelessWidget {
onPressed: () => _setHomeserverAction(context),
),
FlatButton(
padding: EdgeInsets.all(8),
child: Text(
L10n.of(context).privacy,
style: TextStyle(

View File

@ -1,38 +1,12 @@
import 'package:famedlysdk/famedlysdk.dart';
import 'package:fluffychat/components/matrix.dart';
import 'package:flushbar/flushbar_helper.dart';
import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'chat_list.dart';
import 'homeserver_picker.dart';
class LoadingView extends StatelessWidget {
@override
Widget build(BuildContext context) {
return FutureBuilder<LoginState>(
future: Matrix.of(context).client.onLoginStateChanged.stream.first,
builder: (context, snapshot) {
if (snapshot.hasError) {
WidgetsBinding.instance
.addPostFrameCallback((_) => FlushbarHelper.createError(
title: L10n.of(context).oopsSomethingWentWrong,
message: snapshot.error.toString(),
).show(context));
return HomeserverPicker();
}
if (!snapshot.hasData) {
return Scaffold(
body: Center(
child: CircularProgressIndicator(),
),
);
}
if (Matrix.of(context).client.isLogged()) {
return ChatList();
}
return HomeserverPicker();
},
return Scaffold(
body: Center(
child: CircularProgressIndicator(),
),
);
}
}

View File

@ -230,7 +230,7 @@ class _LoginState extends State<Login> {
borderRadius: BorderRadius.circular(6),
),
child: loading
? CircularProgressIndicator()
? LinearProgressIndicator()
: Text(
L10n.of(context).login.toUpperCase(),
style: TextStyle(color: Colors.white, fontSize: 16),

View File

@ -148,7 +148,7 @@ class _SignUpState extends State<SignUp> {
borderRadius: BorderRadius.circular(6),
),
child: loading
? CircularProgressIndicator()
? LinearProgressIndicator()
: Text(
L10n.of(context).signUp.toUpperCase(),
style: TextStyle(color: Colors.white, fontSize: 16),

View File

@ -67,7 +67,7 @@ class _SignUpPasswordState extends State<SignUpPassword> {
);
} else {
await AdaptivePageLayout.of(context).pushNamed(
'/authwebview',
'/authwebview/$currentStage/${exception.session}',
arguments: () => _signUpAction(
context,
auth: AuthenticationData(session: exception.session),
@ -157,7 +157,7 @@ class _SignUpPasswordState extends State<SignUpPassword> {
borderRadius: BorderRadius.circular(6),
),
child: loading
? CircularProgressIndicator()
? LinearProgressIndicator()
: Text(
L10n.of(context).createAccountNow.toUpperCase(),
style: TextStyle(color: Colors.white, fontSize: 16),