1
0
mirror of https://gitlab.com/comunic/comunicmobile synced 2024-10-23 15:03:22 +00:00
comunicmobile/lib/ui/widgets/login_scaffold.dart

75 lines
2.2 KiB
Dart
Raw Normal View History

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;
const LoginScaffold({Key key, @required this.child})
: assert(child != null),
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,
),
scaffoldBackgroundColor: Colors.indigo.shade900,
textTheme: TextTheme(
body1: TextStyle(color: Colors.white),
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),
Text("Comunic", style: TextStyle(fontSize: 50)),
Spacer(flex: 1),
Text(tr("Free social network that respect your privacy")),
Spacer(flex: 1),
Padding(
padding: const EdgeInsets.all(8.0),
child: Material(
child: child,
color: Colors.indigo.shade500,
),
2020-05-04 17:05:21 +00:00
),
2020-05-04 17:28:09 +00:00
Spacer(flex: 5),
],
),
2020-05-04 17:05:21 +00:00
),
),
),
),
),
);
}
}