diff --git a/lib/widgets/app_lock.dart b/lib/widgets/app_lock.dart index ace02b227..3ec30aa8f 100644 --- a/lib/widgets/app_lock.dart +++ b/lib/widgets/app_lock.dart @@ -103,11 +103,6 @@ class AppLock extends State with WidgetsBindingObserver { @override Widget build(BuildContext context) => Provider( create: (_) => this, - child: Stack( - children: [ - widget.child, - if (isLocked) const LockScreen(), - ], - ), + child: isLocked ? const LockScreen() : widget.child, ); } diff --git a/lib/widgets/lock_screen.dart b/lib/widgets/lock_screen.dart index 8825f6cd8..93c0b54fb 100644 --- a/lib/widgets/lock_screen.dart +++ b/lib/widgets/lock_screen.dart @@ -4,10 +4,8 @@ import 'package:flutter/material.dart'; import 'package:flutter_gen/gen_l10n/l10n.dart'; -import 'package:fluffychat/config/app_config.dart'; import 'package:fluffychat/config/themes.dart'; import 'package:fluffychat/widgets/app_lock.dart'; -import 'package:fluffychat/widgets/theme_builder.dart'; class LockScreen extends StatefulWidget { const LockScreen({super.key}); @@ -62,63 +60,50 @@ class _LockScreenState extends State { @override Widget build(BuildContext context) { - return ThemeBuilder( - builder: (context, themeMode, primaryColor) => MaterialApp( - title: AppConfig.applicationName, - themeMode: themeMode, - theme: FluffyThemes.buildTheme(context, Brightness.light, primaryColor), - darkTheme: - FluffyThemes.buildTheme(context, Brightness.dark, primaryColor), - localizationsDelegates: L10n.localizationsDelegates, - supportedLocales: L10n.supportedLocales, - home: Builder( - builder: (context) => Scaffold( - appBar: AppBar( - title: Text(L10n.of(context)!.pleaseEnterYourPin), - centerTitle: true, + return Scaffold( + appBar: AppBar( + title: Text(L10n.of(context)!.pleaseEnterYourPin), + centerTitle: true, + ), + extendBodyBehindAppBar: true, + body: Center( + child: Padding( + padding: const EdgeInsets.all(16.0), + child: ConstrainedBox( + constraints: const BoxConstraints( + maxWidth: FluffyThemes.columnWidth, ), - extendBodyBehindAppBar: true, - body: Center( - child: Padding( - padding: const EdgeInsets.all(16.0), - child: ConstrainedBox( - constraints: const BoxConstraints( - maxWidth: FluffyThemes.columnWidth, + child: ListView( + shrinkWrap: true, + children: [ + Center( + child: Image.asset( + 'assets/info-logo.png', + width: 256, ), - child: ListView( - shrinkWrap: true, - children: [ - Center( - child: Image.asset( - 'assets/info-logo.png', - width: 256, - ), - ), - TextField( - controller: _textEditingController, - textInputAction: TextInputAction.done, - keyboardType: TextInputType.number, - obscureText: true, - autofocus: true, - textAlign: TextAlign.center, - readOnly: _inputBlocked, - onChanged: (_) => tryUnlock(context), - onSubmitted: (_) => tryUnlock(context), - style: const TextStyle(fontSize: 40), - decoration: InputDecoration( - errorText: _errorText, - hintText: '****', - ), - ), - if (_inputBlocked) - const Padding( - padding: EdgeInsets.all(8.0), - child: LinearProgressIndicator(), - ), - ], + ), + TextField( + controller: _textEditingController, + textInputAction: TextInputAction.done, + keyboardType: TextInputType.number, + obscureText: true, + autofocus: true, + textAlign: TextAlign.center, + readOnly: _inputBlocked, + onChanged: (_) => tryUnlock(context), + onSubmitted: (_) => tryUnlock(context), + style: const TextStyle(fontSize: 40), + decoration: InputDecoration( + errorText: _errorText, + hintText: '****', ), ), - ), + if (_inputBlocked) + const Padding( + padding: EdgeInsets.all(8.0), + child: LinearProgressIndicator(), + ), + ], ), ), ),