|
|
@ -2,7 +2,6 @@ import 'package:flutter/material.dart';
|
|
|
|
|
|
|
|
|
|
|
|
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
|
|
|
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
|
|
|
import 'package:url_launcher/url_launcher.dart';
|
|
|
|
import 'package:url_launcher/url_launcher.dart';
|
|
|
|
import 'package:vrouter/vrouter.dart';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import 'package:fluffychat/config/app_config.dart';
|
|
|
|
import 'package:fluffychat/config/app_config.dart';
|
|
|
|
import 'package:fluffychat/utils/platform_infos.dart';
|
|
|
|
import 'package:fluffychat/utils/platform_infos.dart';
|
|
|
@ -18,11 +17,36 @@ class HomeserverPickerView extends StatelessWidget {
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
final benchmarkResults = controller.benchmarkResults;
|
|
|
|
final benchmarkResults = controller.benchmarkResults;
|
|
|
|
return LoginScaffold(
|
|
|
|
return LoginScaffold(
|
|
|
|
appBar: VRouter.of(context).path == '/home'
|
|
|
|
appBar: AppBar(
|
|
|
|
? null
|
|
|
|
backgroundColor: Colors.transparent,
|
|
|
|
: AppBar(title: Text(L10n.of(context)!.addAccount)),
|
|
|
|
actions: [
|
|
|
|
body: SafeArea(
|
|
|
|
IconButton(
|
|
|
|
child: Column(
|
|
|
|
onPressed: controller.restoreBackup,
|
|
|
|
|
|
|
|
tooltip: L10n.of(context)!.hydrate,
|
|
|
|
|
|
|
|
icon: const Icon(
|
|
|
|
|
|
|
|
Icons.restore_outlined,
|
|
|
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
IconButton(
|
|
|
|
|
|
|
|
tooltip: L10n.of(context)!.privacy,
|
|
|
|
|
|
|
|
onPressed: () => launch(AppConfig.privacyUrl),
|
|
|
|
|
|
|
|
icon: const Icon(
|
|
|
|
|
|
|
|
Icons.shield_outlined,
|
|
|
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
IconButton(
|
|
|
|
|
|
|
|
tooltip: L10n.of(context)!.about,
|
|
|
|
|
|
|
|
onPressed: () => PlatformInfos.showDialog(context),
|
|
|
|
|
|
|
|
icon: const Icon(
|
|
|
|
|
|
|
|
Icons.info_outlined,
|
|
|
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
body: Column(
|
|
|
|
children: [
|
|
|
|
children: [
|
|
|
|
// display a prominent banner to import session for TOR browser
|
|
|
|
// display a prominent banner to import session for TOR browser
|
|
|
|
// users. This feature is just some UX sugar as TOR users are
|
|
|
|
// users. This feature is just some UX sugar as TOR users are
|
|
|
@ -52,11 +76,11 @@ class HomeserverPickerView extends StatelessWidget {
|
|
|
|
children: [
|
|
|
|
children: [
|
|
|
|
Container(
|
|
|
|
Container(
|
|
|
|
alignment: Alignment.center,
|
|
|
|
alignment: Alignment.center,
|
|
|
|
height: 256,
|
|
|
|
height: 200,
|
|
|
|
child: Image.asset('assets/info-logo.png'),
|
|
|
|
child: Image.asset('assets/info-logo.png'),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Padding(
|
|
|
|
Padding(
|
|
|
|
padding: const EdgeInsets.all(16.0),
|
|
|
|
padding: const EdgeInsets.all(12.0),
|
|
|
|
child: TextField(
|
|
|
|
child: TextField(
|
|
|
|
focusNode: controller.homeserverFocusNode,
|
|
|
|
focusNode: controller.homeserverFocusNode,
|
|
|
|
controller: controller.homeserverController,
|
|
|
|
controller: controller.homeserverController,
|
|
|
@ -78,7 +102,7 @@ class HomeserverPickerView extends StatelessWidget {
|
|
|
|
),
|
|
|
|
),
|
|
|
|
if (controller.displayServerList)
|
|
|
|
if (controller.displayServerList)
|
|
|
|
Padding(
|
|
|
|
Padding(
|
|
|
|
padding: const EdgeInsets.all(16.0),
|
|
|
|
padding: const EdgeInsets.all(12.0),
|
|
|
|
child: Material(
|
|
|
|
child: Material(
|
|
|
|
borderRadius:
|
|
|
|
borderRadius:
|
|
|
|
BorderRadius.circular(AppConfig.borderRadius),
|
|
|
|
BorderRadius.circular(AppConfig.borderRadius),
|
|
|
@ -87,7 +111,7 @@ class HomeserverPickerView extends StatelessWidget {
|
|
|
|
child: benchmarkResults == null
|
|
|
|
child: benchmarkResults == null
|
|
|
|
? const Center(
|
|
|
|
? const Center(
|
|
|
|
child: Padding(
|
|
|
|
child: Padding(
|
|
|
|
padding: EdgeInsets.all(16.0),
|
|
|
|
padding: EdgeInsets.all(12.0),
|
|
|
|
child: CircularProgressIndicator.adaptive(),
|
|
|
|
child: CircularProgressIndicator.adaptive(),
|
|
|
|
))
|
|
|
|
))
|
|
|
|
: Column(
|
|
|
|
: Column(
|
|
|
@ -120,36 +144,11 @@ class HomeserverPickerView extends StatelessWidget {
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Wrap(
|
|
|
|
|
|
|
|
alignment: WrapAlignment.center,
|
|
|
|
|
|
|
|
children: [
|
|
|
|
|
|
|
|
TextButton(
|
|
|
|
|
|
|
|
onPressed: () => launch(AppConfig.privacyUrl),
|
|
|
|
|
|
|
|
child: Text(
|
|
|
|
|
|
|
|
L10n.of(context)!.privacy,
|
|
|
|
|
|
|
|
style: const TextStyle(
|
|
|
|
|
|
|
|
decoration: TextDecoration.underline,
|
|
|
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
TextButton(
|
|
|
|
|
|
|
|
onPressed: () => PlatformInfos.showDialog(context),
|
|
|
|
|
|
|
|
child: Text(
|
|
|
|
|
|
|
|
L10n.of(context)!.about,
|
|
|
|
|
|
|
|
style: const TextStyle(
|
|
|
|
|
|
|
|
decoration: TextDecoration.underline,
|
|
|
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
],
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Container(
|
|
|
|
Container(
|
|
|
|
padding: const EdgeInsets.all(16),
|
|
|
|
padding: const EdgeInsets.all(12),
|
|
|
|
width: double.infinity,
|
|
|
|
width: double.infinity,
|
|
|
|
child: Hero(
|
|
|
|
child: Hero(
|
|
|
|
tag: 'loginButton',
|
|
|
|
tag: 'loginButton',
|
|
|
@ -163,33 +162,8 @@ class HomeserverPickerView extends StatelessWidget {
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Padding(
|
|
|
|
|
|
|
|
padding: const EdgeInsets.all(16),
|
|
|
|
|
|
|
|
child: ExpansionTile(
|
|
|
|
|
|
|
|
title: Text(L10n.of(context)!.advanced),
|
|
|
|
|
|
|
|
children: [
|
|
|
|
|
|
|
|
Padding(
|
|
|
|
|
|
|
|
padding: const EdgeInsets.all(8.0),
|
|
|
|
|
|
|
|
child: TextButton(
|
|
|
|
|
|
|
|
onPressed: controller.isLoading
|
|
|
|
|
|
|
|
? () {}
|
|
|
|
|
|
|
|
: controller.restoreBackup,
|
|
|
|
|
|
|
|
style: ElevatedButton.styleFrom(
|
|
|
|
|
|
|
|
primary: Colors.white.withAlpha(200),
|
|
|
|
|
|
|
|
onPrimary: Colors.black,
|
|
|
|
|
|
|
|
shadowColor: Colors.white,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
child: controller.isLoading
|
|
|
|
|
|
|
|
? const LinearProgressIndicator()
|
|
|
|
|
|
|
|
: Text(L10n.of(context)!.hydrate),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
],
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|