Hacked Textfield layout. Needs correct colors for hover/active/disabled etc. Fixes cursor height issue

This commit is contained in:
julian 2023-05-11 18:07:27 -06:00
parent bcb5075fb2
commit fcecb0d6b2

View file

@ -22,6 +22,7 @@ import 'package:stackwallet/widgets/custom_buttons/blue_text_button.dart';
import 'package:stackwallet/widgets/desktop/desktop_scaffold.dart'; import 'package:stackwallet/widgets/desktop/desktop_scaffold.dart';
import 'package:stackwallet/widgets/desktop/primary_button.dart'; import 'package:stackwallet/widgets/desktop/primary_button.dart';
import 'package:stackwallet/widgets/loading_indicator.dart'; import 'package:stackwallet/widgets/loading_indicator.dart';
import 'package:stackwallet/widgets/rounded_container.dart';
import 'package:stackwallet/widgets/stack_text_field.dart'; import 'package:stackwallet/widgets/stack_text_field.dart';
class DesktopLoginView extends ConsumerStatefulWidget { class DesktopLoginView extends ConsumerStatefulWidget {
@ -194,74 +195,104 @@ class _DesktopLoginViewState extends ConsumerState<DesktopLoginView> {
const SizedBox( const SizedBox(
height: 24, height: 24,
), ),
ClipRRect( RoundedContainer(
borderRadius: BorderRadius.circular( padding: EdgeInsets.zero,
Constants.size.circularBorderRadius, height: 74,
), color: Theme.of(context)
child: TextField( .extension<StackColors>()!
key: const Key("desktopLoginPasswordFieldKey"), .textFieldDefaultBG,
focusNode: passwordFocusNode, child: ClipRRect(
controller: passwordController, borderRadius: BorderRadius.circular(
style: STextStyles.desktopTextMedium(context).copyWith( Constants.size.circularBorderRadius,
height: 2,
), ),
obscureText: hidePassword, child: Padding(
enableSuggestions: false, padding: const EdgeInsets.symmetric(vertical: 16),
autocorrect: false, child: TextField(
autofocus: true, key: const Key("desktopLoginPasswordFieldKey"),
onSubmitted: (_) { focusNode: passwordFocusNode,
if (_continueEnabled) { controller: passwordController,
login(); style: STextStyles.desktopTextMedium(context),
} obscureText: hidePassword,
}, enableSuggestions: false,
decoration: standardInputDecoration( textAlignVertical: TextAlignVertical.bottom,
"Enter password", autocorrect: false,
passwordFocusNode, autofocus: true,
context, onSubmitted: (_) {
).copyWith( if (_continueEnabled) {
suffixIcon: UnconstrainedBox( login();
child: SizedBox( }
height: 70, },
child: Row( decoration: standardInputDecoration(
children: [ "Enter password",
const SizedBox( passwordFocusNode,
width: 24, context,
), ).copyWith(
GestureDetector( isDense: true,
key: const Key( fillColor: Colors.transparent,
"restoreFromFilePasswordFieldShowPasswordButtonKey"), focusColor: Colors.transparent,
onTap: () async { hoverColor: Colors.transparent,
setState(() { enabledBorder: OutlineInputBorder(
hidePassword = !hidePassword; borderSide: const BorderSide(
}); color: Colors.transparent, width: 1),
}, borderRadius: BorderRadius.circular(10),
child: MouseRegion( ),
cursor: SystemMouseCursors.click, focusedBorder: OutlineInputBorder(
child: SvgPicture.asset( borderSide: const BorderSide(
hidePassword color: Colors.transparent, width: 1),
? Assets.svg.eye borderRadius: BorderRadius.circular(10),
: Assets.svg.eyeSlash, ),
color: Theme.of(context) contentPadding: const EdgeInsets.only(
.extension<StackColors>()! top: 0,
.textDark3, left: 16,
width: 24, right: 16,
height: 24, bottom: 0,
),
suffixIcon: UnconstrainedBox(
child: SizedBox(
height: 70,
child: Row(
children: [
const SizedBox(
width: 20,
), ),
), GestureDetector(
key: const Key(
"restoreFromFilePasswordFieldShowPasswordButtonKey"),
onTap: () async {
setState(() {
hidePassword = !hidePassword;
});
},
child: MouseRegion(
cursor: SystemMouseCursors.click,
child: SvgPicture.asset(
hidePassword
? Assets.svg.eye
: Assets.svg.eyeSlash,
color: Theme.of(context)
.extension<StackColors>()!
.textDark3,
width: 20,
height: 20,
),
),
),
const SizedBox(
width: 12,
),
],
), ),
const SizedBox( ),
width: 12,
),
],
), ),
), ),
onChanged: (newValue) {
setState(() {
_continueEnabled =
passwordController.text.isNotEmpty;
});
},
), ),
), ),
onChanged: (newValue) {
setState(() {
_continueEnabled = passwordController.text.isNotEmpty;
});
},
), ),
), ),
const SizedBox( const SizedBox(