fix: Keyboard disappears in lockscreen

This commit is contained in:
Krille 2024-01-24 09:01:11 +01:00
parent 7fe8d196fb
commit 1a0b240d5d
No known key found for this signature in database
GPG key ID: E067ECD60F1A0652
2 changed files with 42 additions and 62 deletions

View file

@ -103,11 +103,6 @@ class AppLock extends State<AppLockWidget> with WidgetsBindingObserver {
@override
Widget build(BuildContext context) => Provider<AppLock>(
create: (_) => this,
child: Stack(
children: [
widget.child,
if (isLocked) const LockScreen(),
],
),
child: isLocked ? const LockScreen() : widget.child,
);
}

View file

@ -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<LockScreen> {
@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,
),
),
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(),
),
],
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(),
),
],
),
),
),