feat: Enhanced configuration
This commit is contained in:
parent
11c2a8bb26
commit
8eb2e2fb9d
22 changed files with 191 additions and 236 deletions
|
|
@ -4,7 +4,7 @@ import 'package:adaptive_dialog/adaptive_dialog.dart';
|
|||
import 'package:famedlysdk/famedlysdk.dart';
|
||||
import 'package:fluffychat/components/dialogs/simple_dialogs.dart';
|
||||
import 'package:fluffychat/components/matrix.dart';
|
||||
import 'package:fluffychat/config/app_config.dart';
|
||||
import 'package:fluffychat/app_config.dart';
|
||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||
import 'package:fluffychat/utils/app_route.dart';
|
||||
import 'package:fluffychat/utils/sentry_controller.dart';
|
||||
|
|
@ -12,6 +12,8 @@ import 'package:fluffychat/views/sign_up.dart';
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
import 'login.dart';
|
||||
|
||||
class HomeserverPicker extends StatelessWidget {
|
||||
Future<void> _setHomeserverAction(BuildContext context) async {
|
||||
const prefix = 'https://';
|
||||
|
|
@ -42,7 +44,8 @@ class HomeserverPicker extends StatelessWidget {
|
|||
final success = await SimpleDialogs(context).tryRequestWithLoadingDialog(
|
||||
checkHomeserver(homeserver, Matrix.of(context).client));
|
||||
if (success == true) {
|
||||
await Navigator.of(context).push(AppRoute(SignUp()));
|
||||
await Navigator.of(context)
|
||||
.push(AppRoute(AppConfig.enableRegistration ? SignUp() : Login()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -61,35 +64,42 @@ class HomeserverPicker extends StatelessWidget {
|
|||
max((MediaQuery.of(context).size.width - 600) / 2, 0)),
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
Hero(
|
||||
tag: 'loginBanner',
|
||||
child: InkWell(
|
||||
onTap: () => showAboutDialog(
|
||||
context: context,
|
||||
children: [
|
||||
RaisedButton(
|
||||
child: Text(L10n.of(context).privacy),
|
||||
onPressed: () => launch(AppConfig.privacyUrl),
|
||||
)
|
||||
],
|
||||
applicationIcon:
|
||||
Image.asset('assets/logo.png', width: 100, height: 100),
|
||||
applicationName: AppConfig.applicationName,
|
||||
),
|
||||
child: Image.asset('assets/fluffychat-banner.png'),
|
||||
Expanded(
|
||||
child: ListView(
|
||||
children: [
|
||||
Hero(
|
||||
tag: 'loginBanner',
|
||||
child: InkWell(
|
||||
onTap: () => showAboutDialog(
|
||||
context: context,
|
||||
children: [
|
||||
RaisedButton(
|
||||
child: Text(L10n.of(context).privacy),
|
||||
onPressed: () => launch(AppConfig.privacyUrl),
|
||||
)
|
||||
],
|
||||
applicationIcon: Image.asset('assets/logo.png',
|
||||
width: 100, height: 100),
|
||||
applicationName: AppConfig.applicationName,
|
||||
),
|
||||
child: Image.asset('assets/banner.png'),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
child: Text(
|
||||
AppConfig.applicationWelcomeMessage ??
|
||||
L10n.of(context).welcomeText,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 22,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
child: Text(
|
||||
L10n.of(context).welcomeText,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 22,
|
||||
),
|
||||
),
|
||||
),
|
||||
Spacer(),
|
||||
SizedBox(height: 16),
|
||||
Hero(
|
||||
tag: 'loginButton',
|
||||
child: Container(
|
||||
|
|
@ -123,16 +133,31 @@ class HomeserverPicker extends StatelessWidget {
|
|||
),
|
||||
),
|
||||
),
|
||||
FlatButton(
|
||||
child: Text(
|
||||
L10n.of(context).changeTheHomeserver,
|
||||
style: TextStyle(
|
||||
decoration: TextDecoration.underline,
|
||||
color: Colors.blue,
|
||||
fontSize: 16,
|
||||
Wrap(
|
||||
children: [
|
||||
if (AppConfig.allowOtherHomeservers)
|
||||
FlatButton(
|
||||
child: Text(
|
||||
L10n.of(context).changeTheHomeserver,
|
||||
style: TextStyle(
|
||||
decoration: TextDecoration.underline,
|
||||
color: Theme.of(context).primaryColor,
|
||||
fontSize: 16,
|
||||
),
|
||||
),
|
||||
onPressed: () => _setHomeserverAction(context),
|
||||
),
|
||||
FlatButton(
|
||||
child: Text(
|
||||
L10n.of(context).privacy,
|
||||
style: TextStyle(
|
||||
decoration: TextDecoration.underline,
|
||||
fontSize: 16,
|
||||
),
|
||||
),
|
||||
onPressed: () => launch(AppConfig.privacyUrl),
|
||||
),
|
||||
),
|
||||
onPressed: () => _setHomeserverAction(context),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 16),
|
||||
],
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue