WIP - Replaced get_it + injectable with Provider

This commit is contained in:
Anton Stubenbord
2022-12-21 01:14:06 +01:00
parent 10149fb7c1
commit 60aecb549d
59 changed files with 1099 additions and 1362 deletions

View File

@@ -99,8 +99,9 @@ class _DocumentEditPageState extends State<DocumentEditPage> {
return LabelFormField<StoragePath>(
notAssignedSelectable: false,
formBuilderState: _formKey.currentState,
labelCreationWidgetBuilder: (initialValue) => RepositoryProvider.value(
value: RepositoryProvider.of<LabelRepository<StoragePath>>(context),
labelCreationWidgetBuilder: (initialValue) =>
RepositoryProvider<LabelRepository<StoragePath>>(
create: (context) => context.watch(),
child: AddStoragePathPage(initalValue: initialValue),
),
textFieldLabel: S.of(context).documentStoragePathPropertyLabel,
@@ -116,10 +117,9 @@ class _DocumentEditPageState extends State<DocumentEditPage> {
return LabelFormField<Correspondent>(
notAssignedSelectable: false,
formBuilderState: _formKey.currentState,
labelCreationWidgetBuilder: (initialValue) => RepositoryProvider.value(
value: RepositoryProvider.of<LabelRepository<Correspondent>>(
context,
),
labelCreationWidgetBuilder: (initialValue) =>
RepositoryProvider<LabelRepository<Correspondent>>(
create: context.watch(),
child: AddCorrespondentPage(initialName: initialValue),
),
textFieldLabel: S.of(context).documentCorrespondentPropertyLabel,
@@ -135,10 +135,9 @@ class _DocumentEditPageState extends State<DocumentEditPage> {
return LabelFormField<DocumentType>(
notAssignedSelectable: false,
formBuilderState: _formKey.currentState,
labelCreationWidgetBuilder: (currentInput) => RepositoryProvider.value(
value: RepositoryProvider.of<LabelRepository<DocumentType>>(
context,
),
labelCreationWidgetBuilder: (currentInput) =>
RepositoryProvider<LabelRepository<DocumentType>>(
create: (context) => context.watch(),
child: AddDocumentTypePage(
initialName: currentInput,
),
@@ -170,8 +169,7 @@ class _DocumentEditPageState extends State<DocumentEditPage> {
_isSubmitLoading = true;
});
try {
await BlocProvider.of<EditDocumentCubit>(context)
.updateDocument(mergedDocument);
await context.read<EditDocumentCubit>().updateDocument(mergedDocument);
showSnackBar(context, S.of(context).documentUpdateSuccessMessage);
} on PaperlessServerException catch (error, stackTrace) {
showErrorMessage(context, error, stackTrace);