2021-04-17 08:59:06 +00:00
|
|
|
import 'package:comunic/models/config.dart';
|
2020-05-04 17:05:21 +00:00
|
|
|
import 'package:comunic/utils/intl_utils.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
|
|
|
/// Custom "Scaffold" for signed out users
|
|
|
|
///
|
|
|
|
/// @author Pierre Hubert
|
|
|
|
|
|
|
|
class LoginScaffold extends StatelessWidget {
|
|
|
|
final Widget child;
|
2021-04-17 08:59:06 +00:00
|
|
|
final Widget noStyleChild;
|
2020-05-04 17:05:21 +00:00
|
|
|
|
2021-04-17 08:59:06 +00:00
|
|
|
const LoginScaffold({Key key, @required this.child, this.noStyleChild})
|
|
|
|
: assert(child != null || noStyleChild != null),
|
2020-05-04 17:05:21 +00:00
|
|
|
super(key: key);
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
final mediaQuery = MediaQuery.of(context);
|
|
|
|
|
|
|
|
final availableHeight =
|
|
|
|
mediaQuery.size.height - mediaQuery.viewInsets.bottom;
|
2020-05-04 17:28:09 +00:00
|
|
|
final minHeight = 450.0;
|
2020-05-04 17:05:21 +00:00
|
|
|
|
|
|
|
final contentHeight =
|
|
|
|
availableHeight < minHeight ? minHeight : availableHeight;
|
|
|
|
|
2020-05-04 17:28:09 +00:00
|
|
|
return Theme(
|
|
|
|
data: Theme.of(context).copyWith(
|
|
|
|
hintColor: Colors.white,
|
|
|
|
inputDecorationTheme: InputDecorationTheme(
|
|
|
|
errorStyle: TextStyle(color: Colors.white),
|
|
|
|
hintStyle: TextStyle(color: Colors.white),
|
|
|
|
labelStyle: TextStyle(color: Colors.white),
|
|
|
|
focusColor: Colors.white,
|
|
|
|
fillColor: Colors.white,
|
|
|
|
hoverColor: Colors.white,
|
|
|
|
),
|
2021-04-17 08:59:06 +00:00
|
|
|
scaffoldBackgroundColor: Config.get().splashBackgroundColor,
|
2020-05-04 17:28:09 +00:00
|
|
|
textTheme: TextTheme(
|
2021-02-07 16:09:08 +00:00
|
|
|
bodyText2: TextStyle(color: Colors.white),
|
2020-05-04 17:28:09 +00:00
|
|
|
button: TextStyle(color: Colors.white),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
child: Scaffold(
|
|
|
|
body: SingleChildScrollView(
|
|
|
|
child: Center(
|
|
|
|
child: Container(
|
|
|
|
height: contentHeight,
|
|
|
|
child: ConstrainedBox(
|
|
|
|
constraints: BoxConstraints(maxWidth: 300),
|
|
|
|
child: Column(
|
|
|
|
children: <Widget>[
|
|
|
|
Spacer(flex: 3),
|
2021-04-23 10:28:50 +00:00
|
|
|
Text(config().appName,
|
2021-04-17 08:59:06 +00:00
|
|
|
textAlign: TextAlign.center,
|
|
|
|
style: TextStyle(fontSize: 50)),
|
2020-05-04 17:28:09 +00:00
|
|
|
Spacer(flex: 1),
|
2021-04-17 08:59:06 +00:00
|
|
|
Text(
|
2021-04-26 08:24:48 +00:00
|
|
|
tr(config().appQuickDescription ??
|
|
|
|
tr("Free social network that respect your privacy")),
|
2021-04-17 08:59:06 +00:00
|
|
|
textAlign: TextAlign.center,
|
2020-05-04 17:05:21 +00:00
|
|
|
),
|
2021-04-17 08:59:06 +00:00
|
|
|
Spacer(flex: 3),
|
|
|
|
child != null
|
|
|
|
? Padding(
|
|
|
|
padding: const EdgeInsets.all(8.0),
|
|
|
|
child: Material(
|
|
|
|
child: child,
|
|
|
|
color: Colors.indigo.shade500,
|
|
|
|
),
|
|
|
|
)
|
|
|
|
: Container(),
|
|
|
|
noStyleChild ?? Container(),
|
|
|
|
Spacer(flex: 3),
|
2020-05-04 17:28:09 +00:00
|
|
|
],
|
|
|
|
),
|
2020-05-04 17:05:21 +00:00
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|