From fda0ef079ab38fc586254a558e36b77a6947c697 Mon Sep 17 00:00:00 2001 From: Alex Yocom-Piatt Date: Tue, 26 Sep 2023 15:11:23 -0500 Subject: [PATCH] bruig: Fix unlock page crash when isScreenSmall --- .../bruig/lib/screens/unlock_ln.dart | 111 +++++++++--------- 1 file changed, 54 insertions(+), 57 deletions(-) diff --git a/bruig/flutterui/bruig/lib/screens/unlock_ln.dart b/bruig/flutterui/bruig/lib/screens/unlock_ln.dart index 83fb35b8..470a8f0b 100644 --- a/bruig/flutterui/bruig/lib/screens/unlock_ln.dart +++ b/bruig/flutterui/bruig/lib/screens/unlock_ln.dart @@ -163,64 +163,61 @@ class __LNUnlockPageState extends State<_LNUnlockPage> { ) : const SizedBox(height: 50), SizedBox(height: MediaQuery.of(context).size.height / 6), - Center( - child: Expanded( - child: TextField( + Expanded( + child: TextField( + enabled: !loading, + autofocus: true, + cursorColor: secondaryTextColor, + decoration: InputDecoration( enabled: !loading, - autofocus: true, - cursorColor: secondaryTextColor, - decoration: InputDecoration( - enabled: !loading, - labelText: "Password", - labelStyle: TextStyle( - letterSpacing: 0, - color: secondaryTextColor), - errorText: - _validate != "" ? _validate : null, - errorBorder: const OutlineInputBorder( - borderRadius: BorderRadius.all( - Radius.circular(10.0)), - borderSide: BorderSide( - color: Colors.red, width: 2.0), - ), - focusedBorder: OutlineInputBorder( - borderRadius: const BorderRadius.all( - Radius.circular(10.0)), - borderSide: BorderSide( - color: secondaryTextColor, - width: 2.0), - ), - border: OutlineInputBorder( - borderRadius: const BorderRadius.all( - Radius.circular(10.0)), - borderSide: BorderSide( - color: cardColor, width: 2.0), - ), - hintText: "Password", - hintStyle: TextStyle( - letterSpacing: 0, - fontWeight: FontWeight.w100, - color: secondaryTextColor), - filled: true, - fillColor: cardColor), - style: TextStyle( - letterSpacing: 5, - color: secondaryTextColor, - fontSize: 21), - controller: passCtrl, - obscureText: true, - onSubmitted: (value) { - if (!loading) { - unlock(); - } - }, - onChanged: (value) { - setState(() { - _validate = value.isEmpty - ? "Password cannot be empty" - : ""; - }); - }))), + labelText: "Password", + labelStyle: TextStyle( + letterSpacing: 0, + color: secondaryTextColor), + errorText: _validate != "" ? _validate : null, + errorBorder: const OutlineInputBorder( + borderRadius: + BorderRadius.all(Radius.circular(10.0)), + borderSide: + BorderSide(color: Colors.red, width: 2.0), + ), + focusedBorder: OutlineInputBorder( + borderRadius: const BorderRadius.all( + Radius.circular(10.0)), + borderSide: BorderSide( + color: secondaryTextColor, width: 2.0), + ), + border: OutlineInputBorder( + borderRadius: const BorderRadius.all( + Radius.circular(10.0)), + borderSide: + BorderSide(color: cardColor, width: 2.0), + ), + hintText: "Password", + hintStyle: TextStyle( + letterSpacing: 0, + fontWeight: FontWeight.w100, + color: secondaryTextColor), + filled: true, + fillColor: cardColor), + style: TextStyle( + letterSpacing: 5, + color: secondaryTextColor, + fontSize: 21), + controller: passCtrl, + obscureText: true, + onSubmitted: (value) { + if (!loading) { + unlock(); + } + }, + onChanged: (value) { + setState(() { + _validate = value.isEmpty + ? "Password cannot be empty" + : ""; + }); + })), _validate == "" ? const SizedBox(height: 22) : const Empty(),