From 9816742b2cf92e565644f294b430819aff7df247 Mon Sep 17 00:00:00 2001 From: hieubt Date: Sun, 24 Sep 2023 23:43:26 +0700 Subject: [PATCH] TF-2084 Add select action hint (cherry picked from commit 0917989494ba6bba0ce574b7a4498fb69ad791e4) --- lib/features/base/widget/drop_down_button_widget.dart | 6 ++++-- .../presentation/widgets/rule_filter_button_field.dart | 9 ++++++--- lib/l10n/intl_messages.arb | 8 +++++++- lib/main/localizations/app_localizations.dart | 7 +++++++ 4 files changed, 24 insertions(+), 6 deletions(-) diff --git a/lib/features/base/widget/drop_down_button_widget.dart b/lib/features/base/widget/drop_down_button_widget.dart index 9df9b2059..5a98b2b90 100644 --- a/lib/features/base/widget/drop_down_button_widget.dart +++ b/lib/features/base/widget/drop_down_button_widget.dart @@ -32,6 +32,7 @@ class DropDownButtonWidget extends StatelessWidget { final String tooltip; final double? dropdownWidth; final double? dropdownMaxHeight; + final String? hintText; const DropDownButtonWidget({ Key? key, @@ -50,6 +51,7 @@ class DropDownButtonWidget extends StatelessWidget { this.dropdownMaxHeight, this.colorButton = Colors.white, this.tooltip = '', + this.hintText, }) : super(key: key); @override @@ -120,7 +122,7 @@ class DropDownButtonWidget extends StatelessWidget { _getTextItemDropdown(context, item: itemSelected), style: TextStyle(fontSize: 16, fontWeight: FontWeight.normal, - color: Colors.black.withOpacity(opacity)), + color: itemSelected != null ? Colors.black.withOpacity(opacity) : AppColor.textFieldHintColor), maxLines: 1, softWrap: CommonTextStyle.defaultSoftWrap, overflow: CommonTextStyle.defaultTextOverFlow, @@ -192,6 +194,6 @@ class DropDownButtonWidget extends StatelessWidget { if (item is ConditionCombiner) { return item.getTitle(context); } - return ''; + return hintText ?? ''; } } \ No newline at end of file diff --git a/lib/features/rules_filter_creator/presentation/widgets/rule_filter_button_field.dart b/lib/features/rules_filter_creator/presentation/widgets/rule_filter_button_field.dart index 79b8746c3..e22b6fa15 100644 --- a/lib/features/rules_filter_creator/presentation/widgets/rule_filter_button_field.dart +++ b/lib/features/rules_filter_creator/presentation/widgets/rule_filter_button_field.dart @@ -19,17 +19,20 @@ class RuleFilterButtonField extends StatelessWidget { final T? value; final OnTapActionCallback? tapActionCallback; final Color? borderColor; + final String? hintText; const RuleFilterButtonField({ super.key, this.value, this.tapActionCallback, this.borderColor, + this.hintText, }); @override Widget build(BuildContext context) { final imagePaths = Get.find(); + final Color textColor = value != null ? Colors.black : AppColor.textFieldHintColor; return InkWell( onTap: () => tapActionCallback?.call(value), @@ -45,10 +48,10 @@ class RuleFilterButtonField extends StatelessWidget { child: Row(children: [ Expanded(child: Text( _getName(context, value), - style: const TextStyle( + style: TextStyle( fontSize: 16, fontWeight: FontWeight.normal, - color: Colors.black), + color: textColor), maxLines: 1, softWrap: CommonTextStyle.defaultSoftWrap, overflow: CommonTextStyle.defaultTextOverFlow, @@ -75,6 +78,6 @@ class RuleFilterButtonField extends StatelessWidget { if (value is ConditionCombiner) { return value.getTitle(context); } - return ''; + return hintText ?? ''; } } \ No newline at end of file diff --git a/lib/l10n/intl_messages.arb b/lib/l10n/intl_messages.arb index 662f036f4..463d65c04 100644 --- a/lib/l10n/intl_messages.arb +++ b/lib/l10n/intl_messages.arb @@ -1,5 +1,5 @@ { - "@@last_modified": "2023-09-24T21:58:41.292766", + "@@last_modified": "2023-09-24T22:04:38.879050", "initializing_data": "Initializing data...", "@initializing_data": { "type": "text", @@ -3379,5 +3379,11 @@ "type": "text", "placeholders_order": [], "placeholders": {} + }, + "selectAction": "Select action", + "@selectAction": { + "type": "text", + "placeholders_order": [], + "placeholders": {} } } \ No newline at end of file diff --git a/lib/main/localizations/app_localizations.dart b/lib/main/localizations/app_localizations.dart index 7b73179ca..cd47a2020 100644 --- a/lib/main/localizations/app_localizations.dart +++ b/lib/main/localizations/app_localizations.dart @@ -3491,4 +3491,11 @@ class AppLocalizations { name: 'forwardTo', ); } + + String get selectAction { + return Intl.message( + 'Select action', + name: 'selectAction', + ); + } } \ No newline at end of file