mirror of
https://github.com/Xevion/paperless-mobile.git
synced 2025-12-14 22:12:18 -06:00
feat: fix bug where tags were overwritten
This commit is contained in:
@@ -10,16 +10,16 @@ class LabelCubit extends Cubit<LabelState> {
|
||||
final LabelRepository labelRepository;
|
||||
|
||||
LabelCubit(this.labelRepository) : super(const LabelState()) {
|
||||
labelRepository.addListener(
|
||||
() {
|
||||
emit(state.copyWith(
|
||||
correspondents: labelRepository.correspondents,
|
||||
documentTypes: labelRepository.documentTypes,
|
||||
storagePaths: labelRepository.storagePaths,
|
||||
tags: labelRepository.tags,
|
||||
));
|
||||
},
|
||||
);
|
||||
labelRepository.addListener(_updateStateListener);
|
||||
}
|
||||
|
||||
void _updateStateListener() {
|
||||
emit(state.copyWith(
|
||||
correspondents: labelRepository.correspondents,
|
||||
documentTypes: labelRepository.documentTypes,
|
||||
storagePaths: labelRepository.storagePaths,
|
||||
tags: labelRepository.tags,
|
||||
));
|
||||
}
|
||||
|
||||
Future<void> reload({
|
||||
@@ -130,6 +130,7 @@ class LabelCubit extends Cubit<LabelState> {
|
||||
|
||||
@override
|
||||
Future<void> close() {
|
||||
labelRepository.removeListener(_updateStateListener);
|
||||
return super.close();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -117,8 +117,12 @@ class TagsFormField extends StatelessWidget {
|
||||
scrollDirection: Axis.horizontal,
|
||||
itemCount: displayedSuggestions.length,
|
||||
itemBuilder: (context, index) {
|
||||
print(options);
|
||||
final suggestion =
|
||||
options[displayedSuggestions.elementAt(index)]!;
|
||||
options[displayedSuggestions.elementAt(index)];
|
||||
if (suggestion == null) {
|
||||
return SizedBox.shrink();
|
||||
}
|
||||
return ColoredChipWrapper(
|
||||
child: ActionChip(
|
||||
label: Text(suggestion.name),
|
||||
|
||||
Reference in New Issue
Block a user