mirror of
https://github.com/krille-chan/fluffychat
synced 2024-09-17 06:15:10 +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
|
@override
|
||||||
Widget build(BuildContext context) => Provider<AppLock>(
|
Widget build(BuildContext context) => Provider<AppLock>(
|
||||||
create: (_) => this,
|
create: (_) => this,
|
||||||
child: Stack(
|
child: isLocked ? const LockScreen() : widget.child,
|
||||||
children: [
|
|
||||||
widget.child,
|
|
||||||
if (isLocked) const LockScreen(),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,10 +4,8 @@ import 'package:flutter/material.dart';
|
||||||
|
|
||||||
import 'package:flutter_gen/gen_l10n/l10n.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/config/themes.dart';
|
||||||
import 'package:fluffychat/widgets/app_lock.dart';
|
import 'package:fluffychat/widgets/app_lock.dart';
|
||||||
import 'package:fluffychat/widgets/theme_builder.dart';
|
|
||||||
|
|
||||||
class LockScreen extends StatefulWidget {
|
class LockScreen extends StatefulWidget {
|
||||||
const LockScreen({super.key});
|
const LockScreen({super.key});
|
||||||
|
@ -62,63 +60,50 @@ class _LockScreenState extends State<LockScreen> {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return ThemeBuilder(
|
return Scaffold(
|
||||||
builder: (context, themeMode, primaryColor) => MaterialApp(
|
appBar: AppBar(
|
||||||
title: AppConfig.applicationName,
|
title: Text(L10n.of(context)!.pleaseEnterYourPin),
|
||||||
themeMode: themeMode,
|
centerTitle: true,
|
||||||
theme: FluffyThemes.buildTheme(context, Brightness.light, primaryColor),
|
),
|
||||||
darkTheme:
|
extendBodyBehindAppBar: true,
|
||||||
FluffyThemes.buildTheme(context, Brightness.dark, primaryColor),
|
body: Center(
|
||||||
localizationsDelegates: L10n.localizationsDelegates,
|
child: Padding(
|
||||||
supportedLocales: L10n.supportedLocales,
|
padding: const EdgeInsets.all(16.0),
|
||||||
home: Builder(
|
child: ConstrainedBox(
|
||||||
builder: (context) => Scaffold(
|
constraints: const BoxConstraints(
|
||||||
appBar: AppBar(
|
maxWidth: FluffyThemes.columnWidth,
|
||||||
title: Text(L10n.of(context)!.pleaseEnterYourPin),
|
|
||||||
centerTitle: true,
|
|
||||||
),
|
),
|
||||||
extendBodyBehindAppBar: true,
|
child: ListView(
|
||||||
body: Center(
|
shrinkWrap: true,
|
||||||
child: Padding(
|
children: [
|
||||||
padding: const EdgeInsets.all(16.0),
|
Center(
|
||||||
child: ConstrainedBox(
|
child: Image.asset(
|
||||||
constraints: const BoxConstraints(
|
'assets/info-logo.png',
|
||||||
maxWidth: FluffyThemes.columnWidth,
|
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(),
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
Loading…
Reference in a new issue