fix: Fixed saved views bug, formatted files, minor changes

This commit is contained in:
Anton Stubenbord
2023-06-10 16:29:12 +02:00
parent 3161343c35
commit 4c3f97136e
93 changed files with 1049 additions and 585 deletions

View File

@@ -11,7 +11,8 @@ import 'package:paperless_mobile/features/settings/model/view_type.dart';
part 'document_search_cubit.g.dart';
part 'document_search_state.dart';
class DocumentSearchCubit extends Cubit<DocumentSearchState> with DocumentPagingBlocMixin {
class DocumentSearchCubit extends Cubit<DocumentSearchState>
with DocumentPagingBlocMixin {
@override
final PaperlessDocumentsApi api;
@@ -23,7 +24,8 @@ class DocumentSearchCubit extends Cubit<DocumentSearchState> with DocumentPaging
this.api,
this.notifier,
this._userAppState,
) : super(DocumentSearchState(searchHistory: _userAppState.documentSearchHistory)) {
) : super(DocumentSearchState(
searchHistory: _userAppState.documentSearchHistory)) {
notifier.addListener(
this,
onDeleted: remove,
@@ -46,7 +48,8 @@ class DocumentSearchCubit extends Cubit<DocumentSearchState> with DocumentPaging
state.copyWith(
searchHistory: [
query,
...state.searchHistory.whereNot((previousQuery) => previousQuery == query)
...state.searchHistory
.whereNot((previousQuery) => previousQuery == query)
],
),
);
@@ -62,7 +65,9 @@ class DocumentSearchCubit extends Cubit<DocumentSearchState> with DocumentPaging
void removeHistoryEntry(String entry) {
emit(
state.copyWith(
searchHistory: state.searchHistory.whereNot((element) => element == entry).toList(),
searchHistory: state.searchHistory
.whereNot((element) => element == entry)
.toList(),
),
);
_userAppState

View File

@@ -65,7 +65,10 @@ class _DocumentSearchBarState extends State<DocumentSearchBar> {
Flexible(
child: Text(
S.of(context)!.searchDocuments,
style: Theme.of(context).textTheme.bodyLarge?.copyWith(
style: Theme.of(context)
.textTheme
.bodyLarge
?.copyWith(
fontWeight: FontWeight.w500,
color: Theme.of(context).hintColor,
),
@@ -112,7 +115,9 @@ class _DocumentSearchBarState extends State<DocumentSearchBar> {
icon: GlobalSettingsBuilder(
builder: (context, settings) {
return ValueListenableBuilder(
valueListenable: Hive.box<LocalUserAccount>(HiveBoxes.localUserAccount).listenable(),
valueListenable:
Hive.box<LocalUserAccount>(HiveBoxes.localUserAccount)
.listenable(),
builder: (context, box, _) {
final account = box.get(settings.currentLoggedInUser!)!;
return UserAvatar(account: account);