mirror of
https://gitlab.com/famedly/fluffychat.git
synced 2025-01-22 18:14:24 +01:00
change: Sign in button according to apples HIG
This commit is contained in:
parent
8fef28ae87
commit
3601e40a82
@ -2044,7 +2044,7 @@
|
|||||||
"type": "text",
|
"type": "text",
|
||||||
"placeholders": {}
|
"placeholders": {}
|
||||||
},
|
},
|
||||||
"loginWith": "Login with {brand}",
|
"loginWith": "Sign in with {brand}",
|
||||||
"@loginWith": {
|
"@loginWith": {
|
||||||
"type": "text",
|
"type": "text",
|
||||||
"placeholders": {
|
"placeholders": {
|
||||||
|
@ -149,9 +149,13 @@ class HomeserverPickerController extends State<HomeserverPicker> {
|
|||||||
final rawProviders = _rawLoginTypes.tryGetList('flows').singleWhere(
|
final rawProviders = _rawLoginTypes.tryGetList('flows').singleWhere(
|
||||||
(flow) =>
|
(flow) =>
|
||||||
flow['type'] == AuthenticationTypes.sso)['identity_providers'];
|
flow['type'] == AuthenticationTypes.sso)['identity_providers'];
|
||||||
return (rawProviders as List)
|
final list = (rawProviders as List)
|
||||||
.map((json) => IdentityProvider.fromJson(json))
|
.map((json) => IdentityProvider.fromJson(json))
|
||||||
.toList();
|
.toList();
|
||||||
|
if (!PlatformInfos.isCupertinoStyle) {
|
||||||
|
list.sort((a, b) => a.brand == 'apple' ? -1 : 1);
|
||||||
|
}
|
||||||
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool get passwordLoginSupported =>
|
bool get passwordLoginSupported =>
|
||||||
|
@ -85,7 +85,8 @@ class HomeserverPickerView extends StatelessWidget {
|
|||||||
if (controller.ssoLoginSupported) ...{
|
if (controller.ssoLoginSupported) ...{
|
||||||
for (final identityProvider
|
for (final identityProvider
|
||||||
in controller.identityProviders)
|
in controller.identityProviders)
|
||||||
OutlinedButton.icon(
|
Center(
|
||||||
|
child: _LoginButton(
|
||||||
onPressed: () => controller
|
onPressed: () => controller
|
||||||
.ssoLoginAction(identityProvider.id),
|
.ssoLoginAction(identityProvider.id),
|
||||||
icon: identityProvider.icon == null
|
icon: identityProvider.icon == null
|
||||||
@ -99,10 +100,11 @@ class HomeserverPickerView extends StatelessWidget {
|
|||||||
width: 24,
|
width: 24,
|
||||||
height: 24,
|
height: 24,
|
||||||
),
|
),
|
||||||
label: Text(L10n.of(context).loginWith(
|
labelText: L10n.of(context).loginWith(
|
||||||
identityProvider.brand ??
|
|
||||||
identityProvider.name ??
|
identityProvider.name ??
|
||||||
L10n.of(context).singlesignon)),
|
identityProvider.brand ??
|
||||||
|
L10n.of(context).singlesignon),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
if (controller.registrationSupported ||
|
if (controller.registrationSupported ||
|
||||||
controller.passwordLoginSupported)
|
controller.passwordLoginSupported)
|
||||||
@ -119,14 +121,11 @@ class HomeserverPickerView extends StatelessWidget {
|
|||||||
children: [
|
children: [
|
||||||
if (controller.passwordLoginSupported)
|
if (controller.passwordLoginSupported)
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Container(
|
child: _LoginButton(
|
||||||
height: 64,
|
|
||||||
child: OutlinedButton.icon(
|
|
||||||
onPressed: () =>
|
onPressed: () =>
|
||||||
VRouter.of(context).to('/login'),
|
VRouter.of(context).to('/login'),
|
||||||
icon: Icon(Icons.login_outlined),
|
icon: Icon(Icons.login_outlined),
|
||||||
label: Text(L10n.of(context).login),
|
labelText: L10n.of(context).login,
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
if (controller.registrationSupported &&
|
if (controller.registrationSupported &&
|
||||||
@ -134,14 +133,10 @@ class HomeserverPickerView extends StatelessWidget {
|
|||||||
SizedBox(width: 12),
|
SizedBox(width: 12),
|
||||||
if (controller.registrationSupported)
|
if (controller.registrationSupported)
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Container(
|
child: _LoginButton(
|
||||||
height: 64,
|
|
||||||
child: OutlinedButton.icon(
|
|
||||||
onPressed: controller.signUpAction,
|
onPressed: controller.signUpAction,
|
||||||
icon: Icon(Icons.add_box_outlined),
|
icon: Icon(Icons.add_box_outlined),
|
||||||
label:
|
labelText: L10n.of(context).register,
|
||||||
Text(L10n.of(context).register),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@ -157,11 +152,7 @@ class HomeserverPickerView extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
]),
|
Wrap(
|
||||||
bottomNavigationBar: Material(
|
|
||||||
elevation: 7,
|
|
||||||
color: Theme.of(context).scaffoldBackgroundColor,
|
|
||||||
child: Wrap(
|
|
||||||
alignment: WrapAlignment.center,
|
alignment: WrapAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
TextButton(
|
TextButton(
|
||||||
@ -186,6 +177,39 @@ class HomeserverPickerView extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
]),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class _LoginButton extends StatelessWidget {
|
||||||
|
final String labelText;
|
||||||
|
final Widget icon;
|
||||||
|
final void Function() onPressed;
|
||||||
|
const _LoginButton({
|
||||||
|
Key key,
|
||||||
|
this.labelText,
|
||||||
|
this.icon,
|
||||||
|
this.onPressed,
|
||||||
|
}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return OutlinedButton.icon(
|
||||||
|
style: OutlinedButton.styleFrom(
|
||||||
|
minimumSize: Size(256, 56),
|
||||||
|
side: BorderSide(
|
||||||
|
color: Theme.of(context).textTheme.bodyText1.color,
|
||||||
|
),
|
||||||
|
shape:
|
||||||
|
RoundedRectangleBorder(borderRadius: BorderRadius.circular(90))),
|
||||||
|
onPressed: onPressed,
|
||||||
|
icon: icon,
|
||||||
|
label: Text(
|
||||||
|
labelText,
|
||||||
|
style: TextStyle(
|
||||||
|
color: Theme.of(context).textTheme.bodyText1.color,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user