2022-04-15 11:42:59 +02:00
|
|
|
import 'package:flutter/material.dart';
|
2022-10-16 12:37:38 +02:00
|
|
|
|
|
|
|
import 'package:fluffychat/config/app_config.dart';
|
|
|
|
import 'package:fluffychat/config/themes.dart';
|
2022-04-15 11:42:59 +02:00
|
|
|
|
|
|
|
class LoginScaffold extends StatelessWidget {
|
|
|
|
final Widget body;
|
|
|
|
final AppBar? appBar;
|
|
|
|
|
|
|
|
const LoginScaffold({
|
|
|
|
Key? key,
|
|
|
|
required this.body,
|
|
|
|
this.appBar,
|
|
|
|
}) : super(key: key);
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
2022-10-16 12:37:38 +02:00
|
|
|
final isMobileMode = !FluffyThemes.isColumnMode(context);
|
2022-11-04 11:17:22 +01:00
|
|
|
final scaffold = Scaffold(
|
|
|
|
backgroundColor: isMobileMode ? null : Colors.transparent,
|
|
|
|
appBar: appBar == null
|
|
|
|
? null
|
|
|
|
: AppBar(
|
|
|
|
titleSpacing: appBar?.titleSpacing,
|
|
|
|
automaticallyImplyLeading:
|
|
|
|
appBar?.automaticallyImplyLeading ?? true,
|
|
|
|
centerTitle: appBar?.centerTitle,
|
|
|
|
title: appBar?.title,
|
|
|
|
leading: appBar?.leading,
|
|
|
|
actions: appBar?.actions,
|
|
|
|
backgroundColor: isMobileMode ? null : Colors.transparent,
|
|
|
|
),
|
|
|
|
extendBodyBehindAppBar: true,
|
|
|
|
extendBody: true,
|
|
|
|
body: body,
|
|
|
|
);
|
|
|
|
if (isMobileMode) return scaffold;
|
2022-10-16 12:37:38 +02:00
|
|
|
return Container(
|
|
|
|
decoration: const BoxDecoration(
|
|
|
|
image: DecorationImage(
|
|
|
|
image: AssetImage('assets/login_wallpaper.png'),
|
|
|
|
fit: BoxFit.cover,
|
|
|
|
),
|
2022-08-28 11:39:33 +02:00
|
|
|
),
|
2022-10-16 12:37:38 +02:00
|
|
|
child: Center(
|
|
|
|
child: Material(
|
|
|
|
color: Theme.of(context).brightness == Brightness.light
|
|
|
|
? Theme.of(context).scaffoldBackgroundColor.withOpacity(0.9)
|
|
|
|
: Theme.of(context).scaffoldBackgroundColor.withOpacity(0.75),
|
|
|
|
borderRadius: isMobileMode
|
|
|
|
? null
|
|
|
|
: BorderRadius.circular(AppConfig.borderRadius),
|
|
|
|
elevation: isMobileMode ? 0 : 10,
|
|
|
|
clipBehavior: Clip.hardEdge,
|
|
|
|
shadowColor: Colors.black,
|
|
|
|
child: ConstrainedBox(
|
|
|
|
constraints: isMobileMode
|
|
|
|
? const BoxConstraints()
|
|
|
|
: const BoxConstraints(maxWidth: 480, maxHeight: 640),
|
2022-11-04 11:17:22 +01:00
|
|
|
child: scaffold,
|
2022-04-15 11:42:59 +02:00
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|