From 87f15841ab3dda579d3857a327b72d5a1d4eb7be Mon Sep 17 00:00:00 2001 From: Ethan Lee <125412902+ethan-tbd@users.noreply.github.com> Date: Mon, 12 Feb 2024 12:09:14 -0800 Subject: [PATCH] undo last two commits to main (#60) --- .../payments/search_payment_methods_page.dart | 9 +---- lib/features/send/send_did_page.dart | 3 ++ lib/shared/json_schema_form.dart | 40 +++++++++---------- lib/shared/theme/theme.dart | 16 -------- 4 files changed, 22 insertions(+), 46 deletions(-) diff --git a/lib/features/payments/search_payment_methods_page.dart b/lib/features/payments/search_payment_methods_page.dart index 66fb0384..28ee348e 100644 --- a/lib/features/payments/search_payment_methods_page.dart +++ b/lib/features/payments/search_payment_methods_page.dart @@ -18,7 +18,6 @@ class SearchPaymentMethodsPage extends HookWidget { @override Widget build(BuildContext context) { final searchText = useState(''); - final focusNode = useFocusNode(); return Scaffold( appBar: AppBar(scrolledUnderElevation: 0), @@ -34,15 +33,9 @@ class SearchPaymentMethodsPage extends HookWidget { mainAxisSize: MainAxisSize.min, children: [ TextFormField( - focusNode: focusNode, - onTapOutside: (_) => focusNode.unfocus(), - enableSuggestions: false, - autocorrect: false, decoration: InputDecoration( labelText: Loc.of(context).search, - prefixIcon: const Padding( - padding: EdgeInsets.only(top: Grid.xs), - child: Icon(Icons.search)), + prefixIcon: const Icon(Icons.search), ), onChanged: (value) => searchText.value = value, ), diff --git a/lib/features/send/send_did_page.dart b/lib/features/send/send_did_page.dart index a5e70053..6fe7cdf4 100644 --- a/lib/features/send/send_did_page.dart +++ b/lib/features/send/send_did_page.dart @@ -66,6 +66,9 @@ class SendDidPage extends HookWidget { Expanded( child: TextField( decoration: InputDecoration( + border: InputBorder.none, + floatingLabelBehavior: + FloatingLabelBehavior.never, labelText: Loc.of(context).didTag), enableSuggestions: false, autocorrect: false, diff --git a/lib/shared/json_schema_form.dart b/lib/shared/json_schema_form.dart index b7a68458..251d2271 100644 --- a/lib/shared/json_schema_form.dart +++ b/lib/shared/json_schema_form.dart @@ -17,28 +17,20 @@ class JsonSchemaForm extends HookWidget { @override Widget build(BuildContext context) { final jsonSchema = json.decode(schema); - List formFields = []; - jsonSchema['properties']?.forEach( - (key, value) { - final focusNode = useFocusNode(); - - formFields.add( - TextFormField( - focusNode: focusNode, - onTapOutside: (_) => focusNode.unfocus(), - enableSuggestions: false, - autocorrect: false, - decoration: InputDecoration( - labelText: value['title'] ?? key, - ), - textInputAction: TextInputAction.next, - validator: (value) => _validateField(key, value, jsonSchema), - onSaved: (value) => formData[key] = value ?? '', + jsonSchema['properties']?.forEach((key, value) { + formFields.add(TextFormField( + decoration: InputDecoration( + labelText: value['title'] ?? key, + labelStyle: TextStyle( + color: Theme.of(context).colorScheme.outlineVariant, ), - ); - }, - ); + border: InputBorder.none, + ), + validator: (value) => _validateField(key, value, jsonSchema), + onSaved: (value) => formData[key] = value ?? '', + )); + }); return Form( key: _formKey, @@ -49,8 +41,12 @@ class JsonSchemaForm extends HookWidget { child: SingleChildScrollView( physics: const BouncingScrollPhysics(), child: Padding( - padding: const EdgeInsets.symmetric(horizontal: Grid.side), - child: Column(children: formFields), + padding: const EdgeInsets.symmetric( + horizontal: Grid.side, + ), + child: Column( + children: formFields, + ), ), ), ), diff --git a/lib/shared/theme/theme.dart b/lib/shared/theme/theme.dart index 7aee5972..6061e140 100644 --- a/lib/shared/theme/theme.dart +++ b/lib/shared/theme/theme.dart @@ -33,14 +33,6 @@ ThemeData lightTheme(BuildContext context) => ThemeData( ), ), ), - inputDecorationTheme: InputDecorationTheme( - border: InputBorder.none, - floatingLabelBehavior: FloatingLabelBehavior.never, - alignLabelWithHint: true, - labelStyle: TextStyle( - color: lightColorScheme.outlineVariant, - ), - ), ); ThemeData darkTheme(BuildContext context) => ThemeData( @@ -73,12 +65,4 @@ ThemeData darkTheme(BuildContext context) => ThemeData( ), ), ), - inputDecorationTheme: InputDecorationTheme( - border: InputBorder.none, - floatingLabelBehavior: FloatingLabelBehavior.never, - alignLabelWithHint: true, - labelStyle: TextStyle( - color: darkColorScheme.outlineVariant, - ), - ), );