Improved search, changed saved view display

This commit is contained in:
Anton Stubenbord
2023-01-31 00:29:07 +01:00
parent b697dc7d8d
commit e9e9fdc336
27 changed files with 1549 additions and 1016 deletions

View File

@@ -0,0 +1,53 @@
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';
typedef OpenSearchCallback = void Function(BuildContext context);
class SearchAppBar extends StatefulWidget with PreferredSizeWidget {
final PreferredSizeWidget? bottom;
final OpenSearchCallback onOpenSearch;
final Color? backgroundColor;
const SearchAppBar({
super.key,
required this.onOpenSearch,
this.bottom,
this.backgroundColor,
});
@override
State<SearchAppBar> createState() => _SearchAppBarState();
@override
Size get preferredSize => const Size.fromHeight(kToolbarHeight);
}
class _SearchAppBarState extends State<SearchAppBar> {
@override
Widget build(BuildContext context) {
return SliverAppBar(
floating: true,
pinned: true,
snap: true,
backgroundColor: widget.backgroundColor,
title: SearchBar(
height: kToolbarHeight - 8,
supportingText: "Search documents",
onTap: () => widget.onOpenSearch(context),
leadingIcon: IconButton(
icon: const Icon(Icons.menu),
onPressed: () {
Scaffold.of(context).openDrawer();
},
),
trailingIcon: IconButton(
icon: const CircleAvatar(
child: Text("A"),
),
onPressed: () {},
),
).paddedOnly(top: 4, bottom: 4),
bottom: widget.bottom,
);
}
}