mirror of
https://github.com/krille-chan/fluffychat
synced 2024-09-10 01:05:17 +00:00
fix: Keyboard disappears in lockscreen
This commit is contained in:
parent
7fe8d196fb
commit
1a0b240d5d
2 changed files with 42 additions and 62 deletions
|
@ -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,
|
||||
);
|
||||
}
|
||||
|
|
|
@ -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(),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
|
|
Loading…
Reference in a new issue