mirror of
https://gitlab.com/famedly/fluffychat.git
synced 2024-11-27 23:09:35 +01:00
Merge branch 'homeserver-url-username-inputs-improvements' into 'master'
Cosmetic improvements of homeserver and user inputs Closes #64 and #34 See merge request ChristianPauly/fluffychat-flutter!97
This commit is contained in:
commit
0c6896f593
@ -8,17 +8,17 @@ class SimpleDialogs {
|
||||
|
||||
const SimpleDialogs(this.context);
|
||||
|
||||
Future<String> enterText({
|
||||
String titleText,
|
||||
String confirmText,
|
||||
String cancelText,
|
||||
String hintText,
|
||||
String labelText,
|
||||
String prefixText,
|
||||
String suffixText,
|
||||
bool password = false,
|
||||
bool multiLine = false,
|
||||
}) async {
|
||||
Future<String> enterText(
|
||||
{String titleText,
|
||||
String confirmText,
|
||||
String cancelText,
|
||||
String hintText,
|
||||
String labelText,
|
||||
String prefixText,
|
||||
String suffixText,
|
||||
bool password = false,
|
||||
bool multiLine = false,
|
||||
TextInputType keyboardType}) async {
|
||||
var textEditingController = TextEditingController();
|
||||
final controller = textEditingController;
|
||||
String input;
|
||||
@ -38,6 +38,7 @@ class SimpleDialogs {
|
||||
maxLines: multiLine ? 3 : 1,
|
||||
obscureText: password,
|
||||
textInputAction: multiLine ? TextInputAction.newline : null,
|
||||
keyboardType: keyboardType,
|
||||
decoration: InputDecoration(
|
||||
hintText: hintText,
|
||||
labelText: labelText,
|
||||
|
@ -12,7 +12,8 @@ class HomeserverPicker extends StatelessWidget {
|
||||
final homeserver = await SimpleDialogs(context).enterText(
|
||||
titleText: L10n.of(context).enterYourHomeserver,
|
||||
hintText: Matrix.defaultHomeserver,
|
||||
prefixText: 'https://');
|
||||
prefixText: 'https://',
|
||||
keyboardType: TextInputType.url);
|
||||
if (homeserver?.isEmpty ?? true) return;
|
||||
_checkHomeserverAction(homeserver, context);
|
||||
}
|
||||
@ -21,6 +22,13 @@ class HomeserverPicker extends StatelessWidget {
|
||||
if (!homeserver.startsWith('https://')) {
|
||||
homeserver = 'https://$homeserver';
|
||||
}
|
||||
|
||||
// removes trailing spaces and slash from url if present (api errors on it)
|
||||
homeserver = homeserver.trim();
|
||||
if (homeserver.endsWith('/')) {
|
||||
homeserver = homeserver.substring(0, homeserver.length - 1);
|
||||
}
|
||||
|
||||
final success = await SimpleDialogs(context).tryRequestWithLoadingDialog(
|
||||
Matrix.of(context).client.checkServer(homeserver));
|
||||
if (success != false) {
|
||||
|
@ -131,6 +131,7 @@ class _LoginState extends State<Login> {
|
||||
readOnly: loading,
|
||||
autocorrect: false,
|
||||
autofocus: true,
|
||||
keyboardType: TextInputType.emailAddress,
|
||||
onChanged: (t) => _checkWellKnownWithCoolDown(t, context),
|
||||
controller: usernameController,
|
||||
decoration: InputDecoration(
|
||||
|
Loading…
Reference in New Issue
Block a user