chore+fix+feat: Apply dart fixes after upgrade to flutter 3.10, add permission checks, make most api calls work again

This commit is contained in:
Anton Stubenbord
2023-05-12 00:16:30 +02:00
parent c8ff261fc7
commit 39342eecf1
114 changed files with 546 additions and 685 deletions

View File

@@ -11,7 +11,9 @@ class LabelTabView<T extends Label> extends StatelessWidget {
final Map<int, T> labels;
final DocumentFilter Function(Label) filterBuilder;
final void Function(T) onEdit;
final bool canEdit;
final void Function() onAddNew;
final bool canAddNew;
/// Displayed as the subtitle of the [ListTile]
final Widget Function(T)? contentBuilder;
@@ -33,6 +35,8 @@ class LabelTabView<T extends Label> extends StatelessWidget {
required this.onAddNew,
required this.emptyStateActionButtonLabel,
required this.labels,
required this.canEdit,
required this.canAddNew,
});
@override
@@ -54,7 +58,7 @@ class LabelTabView<T extends Label> extends StatelessWidget {
textAlign: TextAlign.center,
),
TextButton(
onPressed: onAddNew,
onPressed: canAddNew ? onAddNew : null,
child: Text(emptyStateActionButtonLabel),
),
].padded(),
@@ -70,14 +74,11 @@ class LabelTabView<T extends Label> extends StatelessWidget {
name: l.name,
content: contentBuilder?.call(l) ??
Text(
translateMatchingAlgorithmName(
context, l.matchingAlgorithm) +
((l.match?.isNotEmpty ?? false)
? ": ${l.match}"
: ""),
translateMatchingAlgorithmName(context, l.matchingAlgorithm) +
((l.match?.isNotEmpty ?? false) ? ": ${l.match}" : ""),
maxLines: 2,
),
onOpenEditPage: onEdit,
onOpenEditPage: canEdit ? onEdit : null,
filterBuilder: filterBuilder,
leading: leadingBuilder?.call(l),
label: l,