FurryChat/lib/views/auth_web_view.dart

42 lines
1.1 KiB
Dart
Raw Normal View History

2020-01-14 14:53:35 +00:00
import 'package:fluffychat/components/matrix.dart';
2020-01-20 12:46:39 +00:00
import 'package:fluffychat/i18n/i18n.dart';
2020-01-14 14:53:35 +00:00
import 'package:flutter/material.dart';
import 'package:webview_flutter/webview_flutter.dart';
class AuthWebView extends StatelessWidget {
final String authType;
final String session;
final Function onAuthDone;
const AuthWebView(this.authType, this.session, this.onAuthDone);
@override
Widget build(BuildContext context) {
final String url = Matrix.of(context).client.homeserver +
"/_matrix/client/r0/auth/$authType/fallback/web?session=$session";
return Scaffold(
appBar: AppBar(
2020-01-20 12:46:39 +00:00
title: Text(I18n.of(context).authentication),
2020-01-14 14:53:35 +00:00
leading: IconButton(
2020-02-16 07:35:35 +00:00
icon: Icon(Icons.close),
2020-01-14 14:53:35 +00:00
onPressed: () {
Navigator.of(context).pop();
2020-02-16 07:35:35 +00:00
onAuthDone();
2020-01-14 14:53:35 +00:00
},
),
),
2020-02-16 07:35:35 +00:00
body: Column(
children: <Widget>[
LinearProgressIndicator(),
Expanded(
child: WebView(
initialUrl: url,
javascriptMode: JavascriptMode.unrestricted,
),
),
],
2020-01-14 14:53:35 +00:00
),
);
}
}