mirror of
https://gitlab.com/famedly/fluffychat.git
synced 2024-12-18 10:52:34 +01:00
feat: Redesign start page
This commit is contained in:
parent
7c3fffc8a6
commit
7167d0ace6
@ -1277,7 +1277,7 @@
|
|||||||
"homeserver": {}
|
"homeserver": {}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"loginWith": "Anmelden mit {brand}",
|
"loginWith": "Anmelden mit",
|
||||||
"@loginWith": {
|
"@loginWith": {
|
||||||
"type": "text",
|
"type": "text",
|
||||||
"placeholders": {
|
"placeholders": {
|
||||||
|
@ -1309,13 +1309,7 @@
|
|||||||
"homeserver": {}
|
"homeserver": {}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"loginWith": "Sign in with {brand}",
|
"loginWithOneClick": "Sign in with one click",
|
||||||
"@loginWith": {
|
|
||||||
"type": "text",
|
|
||||||
"placeholders": {
|
|
||||||
"brand": {}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"logout": "Logout",
|
"logout": "Logout",
|
||||||
"@logout": {
|
"@logout": {
|
||||||
"type": "text",
|
"type": "text",
|
||||||
|
@ -97,15 +97,17 @@ abstract class FluffyThemes {
|
|||||||
),
|
),
|
||||||
inputDecorationTheme: InputDecorationTheme(
|
inputDecorationTheme: InputDecorationTheme(
|
||||||
border: OutlineInputBorder(
|
border: OutlineInputBorder(
|
||||||
borderRadius: BorderRadius.circular(AppConfig.borderRadius)),
|
borderRadius: BorderRadius.circular(AppConfig.borderRadius),
|
||||||
|
),
|
||||||
enabledBorder: OutlineInputBorder(
|
enabledBorder: OutlineInputBorder(
|
||||||
borderRadius: BorderRadius.circular(AppConfig.borderRadius),
|
borderRadius: BorderRadius.circular(AppConfig.borderRadius),
|
||||||
borderSide: BorderSide(
|
borderSide: BorderSide(
|
||||||
color: lighten(AppConfig.chatColor, .51),
|
color: lighten(AppConfig.chatColor, .51),
|
||||||
|
width: 1,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
filled: true,
|
filled: true,
|
||||||
fillColor: lighten(AppConfig.chatColor, .51),
|
fillColor: Colors.blueGrey.shade50,
|
||||||
),
|
),
|
||||||
appBarTheme: const AppBarTheme(
|
appBarTheme: const AppBarTheme(
|
||||||
elevation: 6,
|
elevation: 6,
|
||||||
@ -171,7 +173,7 @@ abstract class FluffyThemes {
|
|||||||
border: OutlineInputBorder(
|
border: OutlineInputBorder(
|
||||||
borderRadius: BorderRadius.circular(AppConfig.borderRadius)),
|
borderRadius: BorderRadius.circular(AppConfig.borderRadius)),
|
||||||
filled: true,
|
filled: true,
|
||||||
fillColor: FluffyThemes.darken(AppConfig.chatColor, 0.4),
|
fillColor: Colors.blueGrey.shade900,
|
||||||
enabledBorder: OutlineInputBorder(
|
enabledBorder: OutlineInputBorder(
|
||||||
borderRadius: BorderRadius.circular(AppConfig.borderRadius),
|
borderRadius: BorderRadius.circular(AppConfig.borderRadius),
|
||||||
borderSide: BorderSide(
|
borderSide: BorderSide(
|
||||||
|
@ -40,7 +40,8 @@ class HomeserverPickerController extends State<HomeserverPicker> {
|
|||||||
this.domain = domain;
|
this.domain = domain;
|
||||||
_coolDown?.cancel();
|
_coolDown?.cancel();
|
||||||
if (domain.isNotEmpty) {
|
if (domain.isNotEmpty) {
|
||||||
_coolDown = Timer(const Duration(seconds: 1), checkHomeserverAction);
|
_coolDown =
|
||||||
|
Timer(const Duration(milliseconds: 500), checkHomeserverAction);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,7 +11,6 @@ import 'package:vrouter/vrouter.dart';
|
|||||||
import 'package:fluffychat/config/app_config.dart';
|
import 'package:fluffychat/config/app_config.dart';
|
||||||
import 'package:fluffychat/utils/platform_infos.dart';
|
import 'package:fluffychat/utils/platform_infos.dart';
|
||||||
import 'package:fluffychat/widgets/default_app_bar_search_field.dart';
|
import 'package:fluffychat/widgets/default_app_bar_search_field.dart';
|
||||||
import 'package:fluffychat/widgets/fluffy_banner.dart';
|
|
||||||
import 'package:fluffychat/widgets/layouts/one_page_card.dart';
|
import 'package:fluffychat/widgets/layouts/one_page_card.dart';
|
||||||
import 'package:fluffychat/widgets/matrix.dart';
|
import 'package:fluffychat/widgets/matrix.dart';
|
||||||
import '../../utils/localized_exception_extension.dart';
|
import '../../utils/localized_exception_extension.dart';
|
||||||
@ -44,9 +43,10 @@ class HomeserverPickerView extends StatelessWidget {
|
|||||||
elevation: 0,
|
elevation: 0,
|
||||||
),
|
),
|
||||||
body: ListView(children: [
|
body: ListView(children: [
|
||||||
const Hero(
|
Image.asset(
|
||||||
tag: 'loginBanner',
|
Theme.of(context).brightness == Brightness.dark
|
||||||
child: FluffyBanner(),
|
? 'assets/banner_dark.png'
|
||||||
|
: 'assets/banner.png',
|
||||||
),
|
),
|
||||||
controller.isLoading
|
controller.isLoading
|
||||||
? const Center(
|
? const Center(
|
||||||
@ -88,45 +88,43 @@ class HomeserverPickerView extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
|
||||||
children: [
|
children: [
|
||||||
if (controller.ssoLoginSupported) ...{
|
if (controller.ssoLoginSupported)
|
||||||
for (final identityProvider
|
Row(children: [
|
||||||
in controller.identityProviders)
|
const Expanded(child: Divider()),
|
||||||
Center(
|
Padding(
|
||||||
child: _LoginButton(
|
padding: const EdgeInsets.all(12.0),
|
||||||
onPressed: () => controller
|
child: Text(
|
||||||
.ssoLoginAction(identityProvider.id),
|
L10n.of(context).loginWithOneClick),
|
||||||
icon: identityProvider.icon == null
|
|
||||||
? const Icon(Icons.web_outlined)
|
|
||||||
: CachedNetworkImage(
|
|
||||||
imageUrl: Uri.parse(
|
|
||||||
identityProvider.icon)
|
|
||||||
.getDownloadLink(
|
|
||||||
Matrix.of(context)
|
|
||||||
.getLoginClient())
|
|
||||||
.toString(),
|
|
||||||
width: 24,
|
|
||||||
height: 24,
|
|
||||||
),
|
|
||||||
labelText: L10n.of(context).loginWith(
|
|
||||||
identityProvider.name ??
|
|
||||||
identityProvider.brand ??
|
|
||||||
L10n.of(context).singlesignon),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
if (controller.registrationSupported ||
|
const Expanded(child: Divider()),
|
||||||
controller.passwordLoginSupported)
|
]),
|
||||||
Row(children: [
|
Wrap(
|
||||||
const Expanded(child: Divider()),
|
children: [
|
||||||
Padding(
|
if (controller.ssoLoginSupported) ...{
|
||||||
padding: const EdgeInsets.all(12.0),
|
for (final identityProvider
|
||||||
child: Text(L10n.of(context).or),
|
in controller.identityProviders)
|
||||||
),
|
_SsoButton(
|
||||||
const Expanded(child: Divider()),
|
onPressed: () =>
|
||||||
]),
|
controller.ssoLoginAction(
|
||||||
},
|
identityProvider.id),
|
||||||
if (controller.passwordLoginSupported)
|
identityProvider: identityProvider,
|
||||||
|
),
|
||||||
|
},
|
||||||
|
].toList(),
|
||||||
|
),
|
||||||
|
if (controller.ssoLoginSupported &&
|
||||||
|
(controller.registrationSupported ||
|
||||||
|
controller.passwordLoginSupported))
|
||||||
|
Row(children: [
|
||||||
|
const Expanded(child: Divider()),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.all(12.0),
|
||||||
|
child: Text(L10n.of(context).or),
|
||||||
|
),
|
||||||
|
const Expanded(child: Divider()),
|
||||||
|
]),
|
||||||
|
if (controller.passwordLoginSupported) ...[
|
||||||
Center(
|
Center(
|
||||||
child: _LoginButton(
|
child: _LoginButton(
|
||||||
onPressed: () =>
|
onPressed: () =>
|
||||||
@ -141,6 +139,8 @@ class HomeserverPickerView extends StatelessWidget {
|
|||||||
labelText: L10n.of(context).login,
|
labelText: L10n.of(context).login,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
const SizedBox(height: 12),
|
||||||
|
],
|
||||||
if (controller.registrationSupported)
|
if (controller.registrationSupported)
|
||||||
Center(
|
Center(
|
||||||
child: _LoginButton(
|
child: _LoginButton(
|
||||||
@ -155,19 +155,15 @@ class HomeserverPickerView extends StatelessWidget {
|
|||||||
labelText: L10n.of(context).register,
|
labelText: L10n.of(context).register,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
]
|
],
|
||||||
.map(
|
|
||||||
(widget) => Container(
|
|
||||||
height: 64,
|
|
||||||
padding:
|
|
||||||
const EdgeInsets.only(bottom: 12),
|
|
||||||
child: widget),
|
|
||||||
)
|
|
||||||
.toList(),
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
Wrap(
|
]),
|
||||||
|
bottomNavigationBar: Material(
|
||||||
|
elevation: 6,
|
||||||
|
color: Theme.of(context).scaffoldBackgroundColor,
|
||||||
|
child: Wrap(
|
||||||
alignment: WrapAlignment.center,
|
alignment: WrapAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
TextButton(
|
TextButton(
|
||||||
@ -192,7 +188,54 @@ class HomeserverPickerView extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
]),
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class _SsoButton extends StatelessWidget {
|
||||||
|
final IdentityProvider identityProvider;
|
||||||
|
final void Function() onPressed;
|
||||||
|
const _SsoButton({
|
||||||
|
Key key,
|
||||||
|
@required this.identityProvider,
|
||||||
|
this.onPressed,
|
||||||
|
}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return InkWell(
|
||||||
|
onTap: onPressed,
|
||||||
|
borderRadius: BorderRadius.circular(7),
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 12.0, vertical: 8.0),
|
||||||
|
child: Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
identityProvider.icon == null
|
||||||
|
? const Icon(Icons.web_outlined)
|
||||||
|
: CachedNetworkImage(
|
||||||
|
imageUrl: Uri.parse(identityProvider.icon)
|
||||||
|
.getDownloadLink(Matrix.of(context).getLoginClient())
|
||||||
|
.toString(),
|
||||||
|
width: 32,
|
||||||
|
height: 32,
|
||||||
|
),
|
||||||
|
const SizedBox(height: 8),
|
||||||
|
Text(
|
||||||
|
identityProvider.name ??
|
||||||
|
identityProvider.brand ??
|
||||||
|
L10n.of(context).singlesignon,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 12,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
color: Theme.of(context).textTheme.subtitle2.color,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -216,7 +259,9 @@ class _LoginButton extends StatelessWidget {
|
|||||||
minimumSize: const Size(256, 56),
|
minimumSize: const Size(256, 56),
|
||||||
textStyle: const TextStyle(fontWeight: FontWeight.bold),
|
textStyle: const TextStyle(fontWeight: FontWeight.bold),
|
||||||
backgroundColor: Theme.of(context).backgroundColor,
|
backgroundColor: Theme.of(context).backgroundColor,
|
||||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(7)),
|
shape: RoundedRectangleBorder(
|
||||||
|
borderRadius: BorderRadius.circular(AppConfig.borderRadius),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
onPressed: onPressed,
|
onPressed: onPressed,
|
||||||
icon: icon,
|
icon: icon,
|
||||||
|
@ -80,8 +80,8 @@ abstract class ClientManager {
|
|||||||
legacyDatabaseBuilder: FlutterMatrixHiveStore.hiveDatabaseBuilder,
|
legacyDatabaseBuilder: FlutterMatrixHiveStore.hiveDatabaseBuilder,
|
||||||
supportedLoginTypes: {
|
supportedLoginTypes: {
|
||||||
AuthenticationTypes.password,
|
AuthenticationTypes.password,
|
||||||
if (PlatformInfos.isMobile || PlatformInfos.isWeb)
|
//if (PlatformInfos.isMobile || PlatformInfos.isWeb)
|
||||||
AuthenticationTypes.sso
|
AuthenticationTypes.sso
|
||||||
},
|
},
|
||||||
compute: compute,
|
compute: compute,
|
||||||
);
|
);
|
||||||
|
@ -1,12 +0,0 @@
|
|||||||
import 'package:flutter/material.dart';
|
|
||||||
|
|
||||||
class FluffyBanner extends StatelessWidget {
|
|
||||||
const FluffyBanner({Key key}) : super(key: key);
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return Image.asset(Theme.of(context).brightness == Brightness.dark
|
|
||||||
? 'assets/banner_dark.png'
|
|
||||||
: 'assets/banner.png');
|
|
||||||
}
|
|
||||||
}
|
|
@ -14,6 +14,8 @@ class OnePageCard extends StatelessWidget {
|
|||||||
static num breakpoint = FluffyThemes.columnWidth * 2;
|
static num breakpoint = FluffyThemes.columnWidth * 2;
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
final horizontalPadding =
|
||||||
|
max((MediaQuery.of(context).size.width - 600) / 2, 24);
|
||||||
return MediaQuery.of(context).size.width <= breakpoint ||
|
return MediaQuery.of(context).size.width <= breakpoint ||
|
||||||
Matrix.of(context).client.isLogged()
|
Matrix.of(context).client.isLogged()
|
||||||
? child
|
? child
|
||||||
@ -25,13 +27,13 @@ class OnePageCard extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: EdgeInsets.symmetric(
|
padding: EdgeInsets.only(
|
||||||
horizontal:
|
top: 16,
|
||||||
max((MediaQuery.of(context).size.width - 600) / 2, 24),
|
left: horizontalPadding,
|
||||||
vertical:
|
right: horizontalPadding,
|
||||||
max((MediaQuery.of(context).size.height - 800) / 2, 24),
|
bottom: max((MediaQuery.of(context).size.height - 600) / 2, 24),
|
||||||
),
|
),
|
||||||
child: SafeArea(child: Card(elevation: 5, child: child)),
|
child: SafeArea(child: Card(elevation: 16, child: child)),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user