mirror of
https://gitlab.com/famedly/fluffychat.git
synced 2024-11-24 04:59:26 +01:00
chore: Change startpage design
This commit is contained in:
parent
dcd6dc0707
commit
4b8ad1bde9
@ -142,8 +142,8 @@
|
|||||||
"type": "text",
|
"type": "text",
|
||||||
"placeholders": {}
|
"placeholders": {}
|
||||||
},
|
},
|
||||||
"byDefaultYouWillBeConnectedTo": "By default you will be connected to {homeserver}",
|
"youWillBeConnectedTo": "You will be connected to {homeserver}",
|
||||||
"@byDefaultYouWillBeConnectedTo": {
|
"@youWillBeConnectedTo": {
|
||||||
"type": "text",
|
"type": "text",
|
||||||
"placeholders": {
|
"placeholders": {
|
||||||
"homeserver": {}
|
"homeserver": {}
|
||||||
|
@ -39,6 +39,10 @@ abstract class PlatformInfos {
|
|||||||
context: context,
|
context: context,
|
||||||
children: [
|
children: [
|
||||||
Text('Version: $version'),
|
Text('Version: $version'),
|
||||||
|
RaisedButton(
|
||||||
|
child: Text(L10n.of(context).privacy),
|
||||||
|
onPressed: () => launch(AppConfig.privacyUrl),
|
||||||
|
),
|
||||||
RaisedButton(
|
RaisedButton(
|
||||||
child: Text(L10n.of(context).sourceCode),
|
child: Text(L10n.of(context).sourceCode),
|
||||||
onPressed: () => launch(AppConfig.sourceCodeUrl),
|
onPressed: () => launch(AppConfig.sourceCodeUrl),
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import 'dart:math';
|
import 'dart:math';
|
||||||
|
|
||||||
|
import 'package:adaptive_dialog/adaptive_dialog.dart';
|
||||||
import 'package:adaptive_page_layout/adaptive_page_layout.dart';
|
import 'package:adaptive_page_layout/adaptive_page_layout.dart';
|
||||||
import 'package:famedlysdk/famedlysdk.dart';
|
import 'package:famedlysdk/famedlysdk.dart';
|
||||||
import 'package:fluffychat/components/matrix.dart';
|
import 'package:fluffychat/components/matrix.dart';
|
||||||
@ -9,7 +10,6 @@ import 'package:fluffychat/utils/platform_infos.dart';
|
|||||||
import 'package:flushbar/flushbar_helper.dart';
|
import 'package:flushbar/flushbar_helper.dart';
|
||||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:url_launcher/url_launcher.dart';
|
|
||||||
import '../utils/localized_exception_extension.dart';
|
import '../utils/localized_exception_extension.dart';
|
||||||
|
|
||||||
class HomeserverPicker extends StatefulWidget {
|
class HomeserverPicker extends StatefulWidget {
|
||||||
@ -18,13 +18,11 @@ class HomeserverPicker extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _HomeserverPickerState extends State<HomeserverPicker> {
|
class _HomeserverPickerState extends State<HomeserverPicker> {
|
||||||
final TextEditingController _controller =
|
|
||||||
TextEditingController(text: AppConfig.defaultHomeserver);
|
|
||||||
|
|
||||||
bool _isLoading = false;
|
bool _isLoading = false;
|
||||||
|
String _domain = AppConfig.defaultHomeserver;
|
||||||
|
|
||||||
void _checkHomeserverAction(BuildContext context) async {
|
void _checkHomeserverAction(BuildContext context) async {
|
||||||
var homeserver = _controller.text;
|
var homeserver = _domain;
|
||||||
|
|
||||||
if (!homeserver.startsWith('https://')) {
|
if (!homeserver.startsWith('https://')) {
|
||||||
homeserver = 'https://$homeserver';
|
homeserver = 'https://$homeserver';
|
||||||
@ -70,40 +68,29 @@ class _HomeserverPickerState extends State<HomeserverPicker> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void _changeHomeserverAction(BuildContext context) async {
|
||||||
|
final input = await showTextInputDialog(
|
||||||
|
context: context,
|
||||||
|
title: L10n.of(context).changeTheHomeserver,
|
||||||
|
textFields: [
|
||||||
|
DialogTextField(
|
||||||
|
keyboardType: TextInputType.url,
|
||||||
|
prefixText: 'https://',
|
||||||
|
hintText: AppConfig.defaultHomeserver,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
if (input?.single?.isNotEmpty ?? false) {
|
||||||
|
setState(() => _domain = input.single);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final padding = EdgeInsets.symmetric(
|
final padding = EdgeInsets.symmetric(
|
||||||
horizontal: max((MediaQuery.of(context).size.width - 600) / 2, 0),
|
horizontal: max((MediaQuery.of(context).size.width - 600) / 2, 0),
|
||||||
);
|
);
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
|
||||||
title: Container(
|
|
||||||
height: 40,
|
|
||||||
padding: padding,
|
|
||||||
child: Material(
|
|
||||||
color: Theme.of(context).secondaryHeaderColor,
|
|
||||||
borderRadius: BorderRadius.circular(32),
|
|
||||||
child: TextField(
|
|
||||||
controller: _controller,
|
|
||||||
autocorrect: false,
|
|
||||||
readOnly: !AppConfig.allowOtherHomeservers,
|
|
||||||
decoration: InputDecoration(
|
|
||||||
prefixText: 'https://',
|
|
||||||
suffix: Icon(Icons.domain_outlined),
|
|
||||||
contentPadding: EdgeInsets.only(
|
|
||||||
left: 24,
|
|
||||||
right: 16,
|
|
||||||
),
|
|
||||||
border: OutlineInputBorder(
|
|
||||||
borderRadius: BorderRadius.circular(32),
|
|
||||||
),
|
|
||||||
labelText: L10n.of(context).changeTheHomeserver,
|
|
||||||
hintText: AppConfig.defaultHomeserver,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
body: SafeArea(
|
body: SafeArea(
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: padding,
|
padding: padding,
|
||||||
@ -125,41 +112,45 @@ class _HomeserverPickerState extends State<HomeserverPicker> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
SizedBox(height: 16),
|
SizedBox(height: 16),
|
||||||
Hero(
|
Padding(
|
||||||
tag: 'loginButton',
|
padding: const EdgeInsets.symmetric(horizontal: 16.0),
|
||||||
child: Container(
|
child: Material(
|
||||||
width: double.infinity,
|
borderRadius: BorderRadius.circular(16),
|
||||||
height: 50,
|
elevation: 2,
|
||||||
padding: EdgeInsets.symmetric(horizontal: 12),
|
child: Column(
|
||||||
child: RaisedButton(
|
mainAxisSize: MainAxisSize.min,
|
||||||
elevation: 7,
|
children: [
|
||||||
color: Theme.of(context).primaryColor,
|
SizedBox(height: 8),
|
||||||
shape: RoundedRectangleBorder(
|
Text(
|
||||||
borderRadius: BorderRadius.circular(6),
|
L10n.of(context).youWillBeConnectedTo(_domain),
|
||||||
),
|
style: TextStyle(fontSize: 16),
|
||||||
child: _isLoading
|
),
|
||||||
? LinearProgressIndicator()
|
FlatButton(
|
||||||
: Text(
|
padding: EdgeInsets.all(8),
|
||||||
L10n.of(context).connect.toUpperCase(),
|
child: Text(
|
||||||
style: TextStyle(color: Colors.white, fontSize: 16),
|
L10n.of(context).changeTheHomeserver,
|
||||||
|
style: TextStyle(
|
||||||
|
decoration: TextDecoration.underline,
|
||||||
|
fontSize: 16,
|
||||||
|
color: Colors.blue,
|
||||||
),
|
),
|
||||||
onPressed: _isLoading
|
),
|
||||||
? null
|
onPressed: () => _changeHomeserverAction(context),
|
||||||
: () => _checkHomeserverAction(context),
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
SentrySwitchListTile(),
|
|
||||||
Wrap(
|
Wrap(
|
||||||
alignment: WrapAlignment.center,
|
alignment: WrapAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
FlatButton(
|
FlatButton(
|
||||||
padding: EdgeInsets.all(8),
|
padding: EdgeInsets.all(8),
|
||||||
child: Text(
|
child: Text(
|
||||||
L10n.of(context).about,
|
L10n.of(context).privacy,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
decoration: TextDecoration.underline,
|
decoration: TextDecoration.underline,
|
||||||
fontSize: 16,
|
color: Colors.blueGrey,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
onPressed: () => PlatformInfos.showDialog(context),
|
onPressed: () => PlatformInfos.showDialog(context),
|
||||||
@ -167,21 +158,52 @@ class _HomeserverPickerState extends State<HomeserverPicker> {
|
|||||||
FlatButton(
|
FlatButton(
|
||||||
padding: EdgeInsets.all(8),
|
padding: EdgeInsets.all(8),
|
||||||
child: Text(
|
child: Text(
|
||||||
L10n.of(context).privacy,
|
L10n.of(context).about,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
decoration: TextDecoration.underline,
|
decoration: TextDecoration.underline,
|
||||||
fontSize: 16,
|
color: Colors.blueGrey,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
onPressed: () => launch(AppConfig.privacyUrl),
|
onPressed: () => PlatformInfos.showDialog(context),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
SizedBox(height: 16),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
bottomNavigationBar: Padding(
|
||||||
|
padding: padding,
|
||||||
|
child: Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
Hero(
|
||||||
|
tag: 'loginButton',
|
||||||
|
child: Container(
|
||||||
|
width: double.infinity,
|
||||||
|
height: 50,
|
||||||
|
padding: EdgeInsets.symmetric(horizontal: 12),
|
||||||
|
child: RaisedButton(
|
||||||
|
elevation: 7,
|
||||||
|
color: Theme.of(context).primaryColor,
|
||||||
|
shape: RoundedRectangleBorder(
|
||||||
|
borderRadius: BorderRadius.circular(6),
|
||||||
|
),
|
||||||
|
child: _isLoading
|
||||||
|
? LinearProgressIndicator()
|
||||||
|
: Text(
|
||||||
|
L10n.of(context).connect.toUpperCase(),
|
||||||
|
style: TextStyle(color: Colors.white, fontSize: 16),
|
||||||
|
),
|
||||||
|
onPressed:
|
||||||
|
_isLoading ? null : () => _checkHomeserverAction(context),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SentrySwitchListTile(),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user