Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added enabled param #229

Merged
merged 1 commit into from
Nov 16, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 13 additions & 7 deletions lib/src/widgets/fields/ds_search_input.widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class DSSearchInput extends StatelessWidget {
this.hintText,
this.iconBackgroundColor = DSColors.disabledBg,
this.iconForegroundColor = DSColors.primaryNight,
this.enabled,
});

final void Function(String term) onSearch;
Expand All @@ -25,13 +26,15 @@ class DSSearchInput extends StatelessWidget {
final String? hintText;
final Color iconBackgroundColor;
final Color iconForegroundColor;
final bool? enabled;

// TODO: check if can use DSTextField or DSInputContainer
@override
Widget build(BuildContext context) {
return SizedBox(
height: 44.0,
child: TextField(
enabled: enabled ?? true,
focusNode: focusNode,
controller: controller,
onChanged: onSearch,
Expand Down Expand Up @@ -81,13 +84,8 @@ class DSSearchInput extends StatelessWidget {
width: 1.0,
),
),
enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(8.0),
borderSide: const BorderSide(
color: DSColors.neutralMediumWave,
width: 1.0,
),
),
disabledBorder: _getBorder(),
enabledBorder: _getBorder(),
filled: true,
hintText: hintText,
hintStyle: const DSBodyTextStyle(
Expand All @@ -97,4 +95,12 @@ class DSSearchInput extends StatelessWidget {
),
);
}

OutlineInputBorder _getBorder() => OutlineInputBorder(
borderRadius: BorderRadius.circular(8.0),
borderSide: const BorderSide(
color: DSColors.neutralMediumWave,
width: 1.0,
),
);
}