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: [ children: [
if (AppConfig.allowOtherHomeservers) if (AppConfig.allowOtherHomeservers)
FlatButton( FlatButton(
padding: EdgeInsets.all(8),
child: Text( child: Text(
L10n.of(context).changeTheHomeserver, L10n.of(context).changeTheHomeserver,
style: TextStyle( style: TextStyle(
@ -146,6 +147,7 @@ class HomeserverPicker extends StatelessWidget {
onPressed: () => _setHomeserverAction(context), onPressed: () => _setHomeserverAction(context),
), ),
FlatButton( FlatButton(
padding: EdgeInsets.all(8),
child: Text( child: Text(
L10n.of(context).privacy, L10n.of(context).privacy,
style: TextStyle( 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/material.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'chat_list.dart';
import 'homeserver_picker.dart';
class LoadingView extends StatelessWidget { class LoadingView extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return FutureBuilder<LoginState>( return Scaffold(
future: Matrix.of(context).client.onLoginStateChanged.stream.first, body: Center(
builder: (context, snapshot) { child: CircularProgressIndicator(),
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();
},
); );
} }
} }

View File

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

View File

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

View File

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