We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I was trying to hide the floating bar after clicking on a result but it does work and does not throw any error.
import 'package:eshop/data/models/models.dart'; import 'package:eshop/data/providers/providers.dart'; import 'package:eshop/utils/res/enums.dart'; import 'package:eshop/utils/utils.dart'; import 'package:flutter/material.dart'; import 'package:go_router/go_router.dart'; import 'package:material_floating_search_bar/material_floating_search_bar.dart'; import 'package:provider/provider.dart'; class FilterSearch extends StatelessWidget { const FilterSearch({super.key}); @override Widget build(BuildContext context) { BrandsProvider bp = context.read<BrandsProvider>(); BrandsProvider bpW = context.watch<BrandsProvider>(); SearchProvider sp = context.read<SearchProvider>(); final FloatingSearchBarController searchController = FloatingSearchBarController(); return Scaffold( appBar: AppBar( title: const Text("Search filter"), leading: IconButton( onPressed: () { context.pop(); }, icon: const Icon(Icons.arrow_back), ), ), body: Padding( padding: const EdgeInsets.symmetric(horizontal: 10.0), child: Stack( children: [ FloatingSearchBar( height: 60, controller: searchController, progress: bpW.uiState == UIState.LOADING ? true : false, automaticallyImplyBackButton: false, backdropColor: Colors.transparent, onQueryChanged: (q) { bp.getBrands(q); }, builder: (context, anim) { switch (bpW.uiState) { case UIState.UNINITIALIZED: return const SizedBox(height: 0, width: 0); case UIState.ERROR: return const ListTile( title: Center(child: Text("An error occurred")), ); case UIState.LOADING: return const SizedBox(height: 0); case UIState.DATA: return ListView.builder( padding: EdgeInsets.zero, shrinkWrap: true, itemCount: bpW.brands.length, itemBuilder: (context, i) { Brand brand = bpW.brands[i]; return GestureDetector( onTap: () { sp.filters[QueryProductDto.brand] = brand.id; searchController.query = brand.name; searchController.hide(); /// DOES NOT WORK bp.clear(); }, child: ListTile( title: Text(brand.name), ), ); }, ); } }, ), ], ), ), ); } }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I was trying to hide the floating bar after clicking on a result but it does work and does not throw any error.
The text was updated successfully, but these errors were encountered: