1
0
mirror of https://gitlab.com/comunic/comunicmobile synced 2024-11-22 12:59:21 +00:00

Fix tablet appearance of login screens

This commit is contained in:
Pierre HUBERT 2021-04-17 11:46:57 +02:00
parent 9c61252610
commit 2533c23703
5 changed files with 44 additions and 8 deletions

View File

@ -1,6 +1,6 @@
import 'package:comunic/ui/routes/login_route.dart'; import 'package:comunic/ui/routes/login_route.dart';
import 'package:comunic/ui/widgets/create_account_widget.dart'; import 'package:comunic/ui/widgets/create_account_widget.dart';
import 'package:comunic/ui/widgets/login_routes_theme.dart'; import 'package:comunic/ui/widgets/login_route_container.dart';
import 'package:comunic/utils/intl_utils.dart'; import 'package:comunic/utils/intl_utils.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -12,7 +12,7 @@ import 'package:flutter/material.dart';
class CreateAccountRoute extends StatelessWidget { class CreateAccountRoute extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return LoginRoutesTheme( return LoginRouteContainer(
child: Scaffold( child: Scaffold(
appBar: AppBar( appBar: AppBar(
title: Text(tr("Create an account")), title: Text(tr("Create an account")),

View File

@ -1,7 +1,7 @@
import 'package:comunic/helpers/account_helper.dart'; import 'package:comunic/helpers/account_helper.dart';
import 'package:comunic/ui/routes/password_reset_route.dart'; import 'package:comunic/ui/routes/password_reset_route.dart';
import 'package:comunic/ui/widgets/dialogs/cancel_dialog_button.dart'; import 'package:comunic/ui/widgets/dialogs/cancel_dialog_button.dart';
import 'package:comunic/ui/widgets/login_routes_theme.dart'; import 'package:comunic/ui/widgets/login_route_container.dart';
import 'package:comunic/ui/widgets/safe_state.dart'; import 'package:comunic/ui/widgets/safe_state.dart';
import 'package:comunic/utils/input_utils.dart'; import 'package:comunic/utils/input_utils.dart';
import 'package:comunic/utils/intl_utils.dart'; import 'package:comunic/utils/intl_utils.dart';
@ -17,7 +17,7 @@ import 'package:flutter/rendering.dart';
class ForgotPasswordRoute extends StatelessWidget { class ForgotPasswordRoute extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return LoginRoutesTheme( return LoginRouteContainer(
child: Scaffold( child: Scaffold(
appBar: AppBar( appBar: AppBar(
title: Text(tr("Password forgotten")), title: Text(tr("Password forgotten")),

View File

@ -1,6 +1,6 @@
import 'package:comunic/ui/routes/forgot_password_route.dart'; import 'package:comunic/ui/routes/forgot_password_route.dart';
import 'package:comunic/ui/widgets/init_widget.dart'; import 'package:comunic/ui/widgets/init_widget.dart';
import 'package:comunic/ui/widgets/login_routes_theme.dart'; import 'package:comunic/ui/widgets/login_route_container.dart';
import 'package:comunic/ui/widgets/login_widget.dart'; import 'package:comunic/ui/widgets/login_widget.dart';
import 'package:comunic/utils/intl_utils.dart'; import 'package:comunic/utils/intl_utils.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -22,7 +22,7 @@ class _LoginRouteState extends State<LoginRoute> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return LoginRoutesTheme( return LoginRouteContainer(
child: Scaffold( child: Scaffold(
appBar: AppBar( appBar: AppBar(
title: Text(tr("Login to Comunic")), title: Text(tr("Login to Comunic")),

View File

@ -2,7 +2,7 @@ import 'package:comunic/helpers/account_helper.dart';
import 'package:comunic/models/res_check_password_reset_token.dart'; import 'package:comunic/models/res_check_password_reset_token.dart';
import 'package:comunic/ui/dialogs/input_new_password_dialog.dart'; import 'package:comunic/ui/dialogs/input_new_password_dialog.dart';
import 'package:comunic/ui/widgets/async_screen_widget.dart'; import 'package:comunic/ui/widgets/async_screen_widget.dart';
import 'package:comunic/ui/widgets/login_routes_theme.dart'; import 'package:comunic/ui/widgets/login_route_container.dart';
import 'package:comunic/ui/widgets/new_password_input_widget.dart'; import 'package:comunic/ui/widgets/new_password_input_widget.dart';
import 'package:comunic/ui/widgets/safe_state.dart'; import 'package:comunic/ui/widgets/safe_state.dart';
import 'package:comunic/utils/intl_utils.dart'; import 'package:comunic/utils/intl_utils.dart';
@ -24,7 +24,7 @@ class PasswordResetRoute extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return LoginRoutesTheme( return LoginRouteContainer(
child: Scaffold( child: Scaffold(
appBar: AppBar( appBar: AppBar(
title: Text(tr("Change your password")), title: Text(tr("Change your password")),

View File

@ -0,0 +1,36 @@
import 'package:comunic/models/config.dart';
import 'package:comunic/ui/widgets/login_routes_theme.dart';
import 'package:comunic/utils/ui_utils.dart';
import 'package:flutter/material.dart';
/// Login route container
///
/// Contains both theme and route centering
///
/// @author Pierre Hubert
class LoginRouteContainer extends StatelessWidget {
final Widget child;
const LoginRouteContainer({Key key, @required this.child}) : super(key: key);
@override
Widget build(BuildContext context) {
if (!isTablet(context)) return LoginRoutesTheme(child: child);
return Container(
color: Config.get().splashBackgroundColor,
child: Padding(
padding: EdgeInsets.only(top: 10),
child: Center(
child: LoginRoutesTheme(
child: ConstrainedBox(
constraints: BoxConstraints(maxWidth: 370),
child: child,
),
),
),
),
);
}
}