design: Make homepicker page nicer

This commit is contained in:
Krille Fear 2021-10-16 10:28:50 +02:00
parent e879278186
commit 4a8d50c201
1 changed files with 33 additions and 35 deletions

View File

@ -1,5 +1,6 @@
import 'package:cached_network_image/cached_network_image.dart'; import 'package:cached_network_image/cached_network_image.dart';
import 'package:fluffychat/widgets/matrix.dart'; import 'package:fluffychat/widgets/matrix.dart';
import 'package:flutter/cupertino.dart';
import 'package:vrouter/vrouter.dart'; import 'package:vrouter/vrouter.dart';
import '../homeserver_picker.dart'; import '../homeserver_picker.dart';
@ -126,37 +127,35 @@ class HomeserverPickerView extends StatelessWidget {
const Expanded(child: Divider()), const Expanded(child: Divider()),
]), ]),
}, },
Row( if (controller.passwordLoginSupported)
children: [ Center(
if (controller.passwordLoginSupported) child: _LoginButton(
Expanded( onPressed: () =>
child: _LoginButton( VRouter.of(context).to('login'),
onPressed: () => icon: Icon(
VRouter.of(context).to('login'), CupertinoIcons.lock_open_fill,
icon: const Icon(Icons.login_outlined), color: Theme.of(context)
labelText: L10n.of(context).login, .textTheme
), .bodyText1
.color,
), ),
if (controller.registrationSupported && labelText: L10n.of(context).login,
controller.passwordLoginSupported) ),
const SizedBox(width: 12), ),
if (controller.registrationSupported && if (controller.registrationSupported)
// Registration is broken on matrix.org Center(
Matrix.of(context) child: _LoginButton(
.client onPressed: controller.signUpAction,
.homeserver icon: Icon(
.host != CupertinoIcons.person_add,
'matrix-client.matrix.org') color: Theme.of(context)
Expanded( .textTheme
child: _LoginButton( .bodyText1
onPressed: controller.signUpAction, .color,
icon:
const Icon(Icons.add_box_outlined),
labelText: L10n.of(context).register,
),
), ),
], labelText: L10n.of(context).register,
), ),
),
] ]
.map( .map(
(widget) => Container( (widget) => Container(
@ -215,12 +214,11 @@ class _LoginButton extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return OutlinedButton.icon( return OutlinedButton.icon(
style: OutlinedButton.styleFrom( style: OutlinedButton.styleFrom(
minimumSize: const Size(256, 56), minimumSize: const Size(256, 56),
side: BorderSide( textStyle: const TextStyle(fontWeight: FontWeight.bold),
color: Theme.of(context).textTheme.bodyText1.color, backgroundColor: Theme.of(context).backgroundColor,
), shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(7)),
shape: ),
RoundedRectangleBorder(borderRadius: BorderRadius.circular(90))),
onPressed: onPressed, onPressed: onPressed,
icon: icon, icon: icon,
label: Text( label: Text(