mirror of
https://github.com/Xevion/paperless-mobile.git
synced 2025-12-15 06:12:29 -06:00
Added search bar on all pages
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:paperless_mobile/core/widgets/material/search/m3_search_bar.dart';
|
||||
import 'package:paperless_mobile/extensions/flutter_extensions.dart';
|
||||
import 'package:paperless_mobile/features/settings/view/dialogs/account_settings_dialog.dart';
|
||||
|
||||
typedef OpenSearchCallback = void Function(BuildContext context);
|
||||
|
||||
@@ -8,11 +9,13 @@ class SearchAppBar extends StatefulWidget with PreferredSizeWidget {
|
||||
final PreferredSizeWidget? bottom;
|
||||
final OpenSearchCallback onOpenSearch;
|
||||
final Color? backgroundColor;
|
||||
final String hintText;
|
||||
const SearchAppBar({
|
||||
super.key,
|
||||
required this.onOpenSearch,
|
||||
this.bottom,
|
||||
this.backgroundColor,
|
||||
required this.hintText,
|
||||
});
|
||||
|
||||
@override
|
||||
@@ -26,25 +29,29 @@ class _SearchAppBarState extends State<SearchAppBar> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return SliverAppBar(
|
||||
automaticallyImplyLeading: false,
|
||||
floating: true,
|
||||
pinned: true,
|
||||
snap: true,
|
||||
backgroundColor: widget.backgroundColor,
|
||||
title: SearchBar(
|
||||
height: kToolbarHeight - 8,
|
||||
supportingText: "Search documents",
|
||||
supportingText: widget.hintText,
|
||||
onTap: () => widget.onOpenSearch(context),
|
||||
leadingIcon: IconButton(
|
||||
icon: const Icon(Icons.menu),
|
||||
onPressed: () {
|
||||
Scaffold.of(context).openDrawer();
|
||||
},
|
||||
onPressed: Scaffold.of(context).openDrawer,
|
||||
),
|
||||
trailingIcon: IconButton(
|
||||
icon: const CircleAvatar(
|
||||
child: Text("A"),
|
||||
),
|
||||
onPressed: () {},
|
||||
onPressed: () {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) => AccountSettingsDialog(),
|
||||
);
|
||||
},
|
||||
),
|
||||
).paddedOnly(top: 4, bottom: 4),
|
||||
bottom: widget.bottom,
|
||||
|
||||
Reference in New Issue
Block a user