|
|
@ -4,7 +4,6 @@ import 'package:flutter_gen/gen_l10n/l10n.dart';
|
|
|
|
import 'package:url_launcher/url_launcher.dart';
|
|
|
|
import 'package:url_launcher/url_launcher.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/widgets/layouts/login_scaffold.dart';
|
|
|
|
import 'package:fluffychat/widgets/layouts/login_scaffold.dart';
|
|
|
|
import 'homeserver_picker.dart';
|
|
|
|
import 'homeserver_picker.dart';
|
|
|
|
|
|
|
|
|
|
|
@ -17,30 +16,7 @@ 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: AppBar(
|
|
|
|
body: Column(
|
|
|
|
actions: [
|
|
|
|
|
|
|
|
IconButton(
|
|
|
|
|
|
|
|
onPressed: controller.restoreBackup,
|
|
|
|
|
|
|
|
tooltip: L10n.of(context)!.hydrate,
|
|
|
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
|
|
|
icon: const Icon(Icons.restore_outlined),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
IconButton(
|
|
|
|
|
|
|
|
tooltip: L10n.of(context)!.privacy,
|
|
|
|
|
|
|
|
onPressed: () => launch(AppConfig.privacyUrl),
|
|
|
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
|
|
|
icon: const Icon(Icons.shield_outlined),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
IconButton(
|
|
|
|
|
|
|
|
tooltip: L10n.of(context)!.about,
|
|
|
|
|
|
|
|
onPressed: () => PlatformInfos.showDialog(context),
|
|
|
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
|
|
|
icon: const Icon(Icons.info_outlined),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
body: SafeArea(
|
|
|
|
|
|
|
|
child: 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
|
|
|
@ -70,7 +46,7 @@ class HomeserverPickerView extends StatelessWidget {
|
|
|
|
children: [
|
|
|
|
children: [
|
|
|
|
Container(
|
|
|
|
Container(
|
|
|
|
alignment: Alignment.center,
|
|
|
|
alignment: Alignment.center,
|
|
|
|
height: 200,
|
|
|
|
height: 190,
|
|
|
|
child: Image.asset('assets/info-logo.png'),
|
|
|
|
child: Image.asset('assets/info-logo.png'),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Padding(
|
|
|
|
Padding(
|
|
|
@ -84,10 +60,7 @@ class HomeserverPickerView extends StatelessWidget {
|
|
|
|
hintText: L10n.of(context)!.enterYourHomeserver,
|
|
|
|
hintText: L10n.of(context)!.enterYourHomeserver,
|
|
|
|
suffixIcon: const Icon(Icons.search),
|
|
|
|
suffixIcon: const Icon(Icons.search),
|
|
|
|
errorText: controller.error,
|
|
|
|
errorText: controller.error,
|
|
|
|
fillColor: Theme.of(context)
|
|
|
|
fillColor: Theme.of(context).backgroundColor,
|
|
|
|
.colorScheme
|
|
|
|
|
|
|
|
.background
|
|
|
|
|
|
|
|
.withOpacity(0.75),
|
|
|
|
|
|
|
|
),
|
|
|
|
),
|
|
|
|
readOnly: !AppConfig.allowOtherHomeservers,
|
|
|
|
readOnly: !AppConfig.allowOtherHomeservers,
|
|
|
|
onSubmitted: (_) => controller.checkHomeserverAction(),
|
|
|
|
onSubmitted: (_) => controller.checkHomeserverAction(),
|
|
|
@ -100,7 +73,7 @@ class HomeserverPickerView extends StatelessWidget {
|
|
|
|
child: Material(
|
|
|
|
child: Material(
|
|
|
|
borderRadius:
|
|
|
|
borderRadius:
|
|
|
|
BorderRadius.circular(AppConfig.borderRadius),
|
|
|
|
BorderRadius.circular(AppConfig.borderRadius),
|
|
|
|
color: Colors.white.withAlpha(200),
|
|
|
|
color: Theme.of(context).colorScheme.onInverseSurface,
|
|
|
|
clipBehavior: Clip.hardEdge,
|
|
|
|
clipBehavior: Clip.hardEdge,
|
|
|
|
child: benchmarkResults == null
|
|
|
|
child: benchmarkResults == null
|
|
|
|
? const Center(
|
|
|
|
? const Center(
|
|
|
@ -137,16 +110,50 @@ class HomeserverPickerView extends StatelessWidget {
|
|
|
|
.toList(),
|
|
|
|
.toList(),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
Padding(
|
|
|
|
|
|
|
|
padding: const EdgeInsets.all(16.0),
|
|
|
|
|
|
|
|
child: Center(
|
|
|
|
|
|
|
|
child: Text(
|
|
|
|
|
|
|
|
AppConfig.applicationWelcomeMessage ??
|
|
|
|
|
|
|
|
L10n.of(context)!.welcomeText,
|
|
|
|
|
|
|
|
textAlign: TextAlign.center,
|
|
|
|
|
|
|
|
style: const TextStyle(fontSize: 20),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Container(
|
|
|
|
SafeArea(
|
|
|
|
|
|
|
|
child: Container(
|
|
|
|
padding: const EdgeInsets.all(12),
|
|
|
|
padding: const EdgeInsets.all(12),
|
|
|
|
width: double.infinity,
|
|
|
|
width: double.infinity,
|
|
|
|
child: Hero(
|
|
|
|
child: Column(
|
|
|
|
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
|
|
|
|
|
|
|
children: [
|
|
|
|
|
|
|
|
TextButton(
|
|
|
|
|
|
|
|
style: TextButton.styleFrom(
|
|
|
|
|
|
|
|
foregroundColor:
|
|
|
|
|
|
|
|
Theme.of(context).colorScheme.onSurfaceVariant,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
onPressed: controller.restoreBackup,
|
|
|
|
|
|
|
|
child: Text(L10n.of(context)!.hydrate),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
TextButton(
|
|
|
|
|
|
|
|
onPressed: () => launch(AppConfig.privacyUrl),
|
|
|
|
|
|
|
|
child: Text(L10n.of(context)!.privacy),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
Hero(
|
|
|
|
tag: 'loginButton',
|
|
|
|
tag: 'loginButton',
|
|
|
|
child: ElevatedButton(
|
|
|
|
child: ElevatedButton(
|
|
|
|
|
|
|
|
style: ElevatedButton.styleFrom(
|
|
|
|
|
|
|
|
backgroundColor: Theme.of(context).colorScheme.primary,
|
|
|
|
|
|
|
|
foregroundColor:
|
|
|
|
|
|
|
|
Theme.of(context).colorScheme.onPrimary,
|
|
|
|
|
|
|
|
),
|
|
|
|
onPressed: controller.isLoading
|
|
|
|
onPressed: controller.isLoading
|
|
|
|
? null
|
|
|
|
? null
|
|
|
|
: controller.checkHomeserverAction,
|
|
|
|
: controller.checkHomeserverAction,
|
|
|
@ -155,10 +162,12 @@ class HomeserverPickerView extends StatelessWidget {
|
|
|
|
: Text(L10n.of(context)!.connect),
|
|
|
|
: Text(L10n.of(context)!.connect),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
],
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
),
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|