diff --git a/lib/presentation/widgets/custom_search_bar.dart b/lib/presentation/widgets/custom_search_bar.dart index b482efb..61a2154 100644 --- a/lib/presentation/widgets/custom_search_bar.dart +++ b/lib/presentation/widgets/custom_search_bar.dart @@ -6,11 +6,17 @@ class CustomSearchBar extends StatelessWidget { final String hintText; final ValueChanged? onChanged; final BoxConstraints? constraints; + final bool trailingButtonEnabled; + final bool trailingButtonShown; + final VoidCallback? onTrailingButtonPressed; const CustomSearchBar({ super.key, required this.controller, required this.hintText, + this.trailingButtonShown = false, + this.trailingButtonEnabled = true, + this.onTrailingButtonPressed, this.onChanged, this.constraints, }); @@ -25,6 +31,20 @@ class CustomSearchBar extends StatelessWidget { onChanged: onChanged, hintStyle: WidgetStateProperty.all(const TextStyle(fontSize: 16)), leading: const Icon(Icons.search), + trailing: trailingButtonShown + ? [ + GestureDetector( + onTap: onTrailingButtonPressed, + child: Icon( + Icons.add_circle, + color: trailingButtonEnabled + ? null + : Colors.grey.withValues(alpha: 0.2), + ), + ), + SizedBox(width: 5), + ] + : null, backgroundColor: WidgetStateProperty.all(CustomTheme.boxColor), side: WidgetStateProperty.all(BorderSide(color: CustomTheme.boxBorder)), shape: WidgetStateProperty.all(