showSubZeroFullScreenSearch function
Future<String?>
showSubZeroFullScreenSearch({
- required BuildContext context,
- String hintText = 'Search here',
- List<
String> recentSearches = const [], - Future<
List< onSearch(SubZeroSearchSuggestion> >- String query
- bool showMicrophone = true,
- VoidCallback? onMicrophoneTap,
Shows a full-screen search modal following SubZero 2.0 Design System.
Provides a focused search experience with recent searches and results.
Example usage:
final result = await showSubZeroFullScreenSearch(
context: context,
recentSearches: ['iPhone', 'MacBook', 'AirPods'],
onSearch: (query) async => await searchProducts(query),
);
if (result != null) {
navigateToProduct(result);
}
Implementation
Future<String?> showSubZeroFullScreenSearch({
required BuildContext context,
String hintText = 'Search here',
List<String> recentSearches = const [],
Future<List<SubZeroSearchSuggestion>> Function(String query)? onSearch,
bool showMicrophone = true,
VoidCallback? onMicrophoneTap,
}) {
return Navigator.of(context).push<String>(
PageRouteBuilder(
opaque: false,
pageBuilder: (context, animation, secondaryAnimation) =>
_FullScreenSearchModal(
hintText: hintText,
recentSearches: recentSearches,
onSearch: onSearch,
showMicrophone: showMicrophone,
onMicrophoneTap: onMicrophoneTap,
),
transitionsBuilder: (context, animation, secondaryAnimation, child) {
return FadeTransition(
opacity: animation,
child: SlideTransition(
position: Tween<Offset>(
begin: const Offset(0, -0.02),
end: Offset.zero,
).animate(CurvedAnimation(
parent: animation,
curve: Curves.easeOut,
)),
child: child,
),
);
},
transitionDuration: const Duration(milliseconds: 200),
reverseTransitionDuration: const Duration(milliseconds: 150),
),
);
}