Skip to content

Commit

Permalink
sail_ui: improve text field slightly
Browse files Browse the repository at this point in the history
  • Loading branch information
octobocto committed Nov 9, 2023
1 parent d805813 commit a11c0ec
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 10 deletions.
9 changes: 3 additions & 6 deletions lib/pages/tabs/settings/node_settings_tab.dart
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,9 @@ class NodeConnectionSettings extends ViewModelWidget<NodeConnectionViewModel> {
label: 'Config path',
controller: settings.configPathController,
hintText: '/the/path/to/your/somethingchain.conf',
suffixWidget: Padding(
padding: const EdgeInsets.only(left: SailStyleValues.padding08),
child: SailTextButton(
label: 'Read file',
onPressed: settings.readAndSetValuesFromFile,
),
suffixWidget: SailTextButton(
label: 'Read file',
onPressed: settings.readAndSetValuesFromFile,
),
),
SailTextField(
Expand Down
8 changes: 5 additions & 3 deletions packages/sail_ui/lib/widgets/core/sail_shadow.dart
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,13 @@ class SailShadow extends StatelessWidget {
class SailErrorShadow extends StatelessWidget {
final bool enabled;
final Widget child;
final bool small;

const SailErrorShadow({
super.key,
required this.enabled,
required this.child,
this.small = false,
});

@override
Expand All @@ -92,21 +94,21 @@ class SailErrorShadow extends StatelessWidget {
BoxShadow(
color: theme.colors.error,
spreadRadius: 0,
blurRadius: 24,
blurRadius: small ? 6 : 24,
offset: const Offset(0, 5),
),
// Left shadow
BoxShadow(
color: theme.colors.error,
spreadRadius: 0,
blurRadius: 24,
blurRadius: small ? 6 : 24,
offset: const Offset(-5, 0),
),
// Right shadow
BoxShadow(
color: theme.colors.error,
spreadRadius: 0,
blurRadius: 24,
blurRadius: small ? 6 : 24,
offset: const Offset(5, 0),
),
],
Expand Down
11 changes: 10 additions & 1 deletion packages/sail_ui/lib/widgets/inputs/text_field.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ enum TextFieldType { number, bitcoin, text }

class SailTextField extends StatelessWidget {
final TextEditingController controller;
final FocusNode? focusNode;
final String? label;
final String hintText;
final String? suffix;
Expand All @@ -20,6 +21,7 @@ class SailTextField extends StatelessWidget {
final Widget? prefixIcon;
final BoxConstraints? prefixIconConstraints;
final TextFieldSize size;
final void Function(String)? onSubmitted;

const SailTextField({
super.key,
Expand All @@ -34,6 +36,8 @@ class SailTextField extends StatelessWidget {
this.prefixIcon,
this.prefixIconConstraints,
this.size = TextFieldSize.regular,
this.focusNode,
this.onSubmitted,
});

@override
Expand Down Expand Up @@ -62,6 +66,8 @@ class SailTextField extends StatelessWidget {
TextField(
cursorColor: theme.colors.primary,
controller: controller,
focusNode: focusNode,
onSubmitted: onSubmitted,
style: TextStyle(
color: SailTheme.of(context).colors.text,
fontSize: textSize,
Expand All @@ -86,7 +92,10 @@ class SailTextField extends StatelessWidget {
fontSize: textSize,
),
suffixText: suffix,
suffix: suffixWidget,
suffix: Padding(
padding: const EdgeInsets.only(left: SailStyleValues.padding08),
child: suffixWidget,
),
prefixStyle: TextStyle(
color: SailTheme.of(context).colors.textTertiary,
fontSize: textSize,
Expand Down

0 comments on commit a11c0ec

Please sign in to comment.