Fix: replace collapsed search icon with X when search is active, hide FAB/pagination while searching
This commit is contained in:
1 parent
7db281547e
commit
ee69ca48c2
2 files changed
+16
-4
No files matched your search
@@ -481,7 +481,7 @@ class _StudentsScreenState extends ConsumerState<StudentsScreen> {
|
||||
return Scaffold(
|
||||
backgroundColor: Colors.transparent,
|
||||
floatingActionButtonLocation: FloatingActionButtonLocation.endFloat,
|
||||
floatingActionButton: (widget.userRole == 'teacher' || _showMultiSelect) ? null : FloatingActionButton(
|
||||
floatingActionButton: (widget.userRole == 'teacher' || _showMultiSelect || _searchFocusNode.hasFocus) ? null : FloatingActionButton(
|
||||
heroTag: 'add_student_fab',
|
||||
backgroundColor: AppColors.primaryGreen,
|
||||
foregroundColor: Colors.white,
|
||||
@@ -539,9 +539,10 @@ class _StudentsScreenState extends ConsumerState<StudentsScreen> {
|
||||
),
|
||||
|
||||
// ── Pagination ──
|
||||
pageAsync.maybeWhen(
|
||||
data: (page) => _buildPagination(query, page),
|
||||
orElse: () => const SizedBox.shrink(),
|
||||
if (!_searchFocusNode.hasFocus)
|
||||
pageAsync.maybeWhen(
|
||||
data: (page) => _buildPagination(query, page),
|
||||
orElse: () => const SizedBox.shrink(),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
@@ -199,6 +199,17 @@ class _AppSearchBarState extends ConsumerState<AppSearchBar> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if (!_isExpanded && widget.collapsible) {
|
||||
if (_hasText) {
|
||||
return IconButton(
|
||||
onPressed: () {
|
||||
_controller.clear();
|
||||
widget.onChanged?.call('');
|
||||
if (widget.onSubmitted != null) widget.onSubmitted!('');
|
||||
},
|
||||
icon: const Icon(Icons.close, size: 28, color: Colors.redAccent),
|
||||
tooltip: 'Clear search',
|
||||
);
|
||||
}
|
||||
return IconButton(
|
||||
onPressed: () {
|
||||
setState(() => _isExpanded = true);
|
||||
|
||||
Reference in new issue
Block a user