Skip to content

Commit

Permalink
Fix/show request item title as title of a requested file (#236)
Browse files Browse the repository at this point in the history
* chore: update configs

* fix: remove flexible

* fix: show request item title as title of a requested file

* chore: bump app version
  • Loading branch information
jkoenig134 authored Aug 14, 2024
1 parent 6160b4c commit d2773b5
Show file tree
Hide file tree
Showing 9 changed files with 51 additions and 45 deletions.
12 changes: 6 additions & 6 deletions apps/enmeshed/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ PODS:
- GTMSessionFetcher/Core (< 4.0, >= 3.3.2)
- MLImage (= 1.0.0-beta5)
- MLKitCommon (~> 11.0)
- mobile_scanner (5.0.2):
- mobile_scanner (5.1.1):
- Flutter
- GoogleMLKit/BarcodeScanning (~> 6.0.0)
- nanopb (2.30910.0):
Expand Down Expand Up @@ -226,24 +226,24 @@ SPEC CHECKSUMS:
GoogleUtilities: ea963c370a38a8069cc5f7ba4ca849a60b6d7d15
GoogleUtilitiesComponents: 679b2c881db3b615a2777504623df6122dd20afe
GTMSessionFetcher: 8000756fc1c19d2e5697b90311f7832d2e33f6cd
image_picker_ios: b545a5f16c0fa88e3ecbbce3ed4de45567a8ec18
image_picker_ios: c560581cceedb403a6ff17f2f816d7fea1421fc1
MLImage: 1824212150da33ef225fbd3dc49f184cf611046c
MLKitBarcodeScanning: 10ca0845a6d15f2f6e911f682a1998b68b973e8b
MLKitCommon: afec63980417d29ffbb4790529a1b0a2291699e1
MLKitVision: e858c5f125ecc288e4a31127928301eaba9ae0c1
mobile_scanner: cfc76f77dca7e074fc9ca5993e3e7c35901c8b34
mobile_scanner: 8564358885a9253c43f822435b70f9345c87224f
nanopb: 438bc412db1928dac798aa6fd75726007be04262
open_file: 02eb5cb6b21264bd3a696876f5afbfb7ca4f4b7d
OrderedSet: aaeb196f7fef5a9edf55d89760da9176ad40b93c
package_info_plus: 58f0028419748fad15bf008b270aaa8e54380b1c
path_provider_foundation: 3784922295ac71e43754bd15e0653ccfd36a147c
path_provider_foundation: 2b6b4c569c0fb62ec74538f866245ac84301af46
permission_handler_apple: 9878588469a2b0d0fc1e048d9f43605f92e6cec2
PromisesObjC: f5707f49cb48b9636751c5b2e7d227e43fba9f47
push_ios: 2bd1b4d3f782209da1f571db1250af236957e807
SDWebImage: dfe95b2466a9823cf9f0c6d01217c06550d7b29a
shared_preferences_foundation: b4c3b4cddf1c21f02770737f147a3f5da9d39695
shared_preferences_foundation: fcdcbc04712aee1108ac7fda236f363274528f78
SwiftyGif: 706c60cf65fa2bc5ee0313beece843c8eb8194d4
url_launcher_ios: 6116280ddcfe98ab8820085d8d76ae7449447586
url_launcher_ios: 5334b05cef931de560670eeae103fd3e431ac3fe

PODFILE CHECKSUM: c4c93c5f6502fe2754f48404d3594bf779584011

Expand Down
2 changes: 1 addition & 1 deletion apps/enmeshed/ios/Runner/AppDelegate.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import UIKit
import Flutter

@UIApplicationMain
@main
@objc class AppDelegate: FlutterAppDelegate {
override func application(
_ application: UIApplication,
Expand Down
24 changes: 11 additions & 13 deletions apps/enmeshed/lib/core/widgets/message_dvo_renderer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -49,19 +49,17 @@ class _MessagesContent extends StatelessWidget {

@override
Widget build(BuildContext context) {
return Flexible(
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
_MessageHeader(message: message, query: query),
switch (message) {
final MailDVO mail => _MailContent(message: mail, query: query),
final RequestMessageDVO requestMessage => _RequestMessageContent(message: requestMessage),
_ => Text(context.l10n.mailbox_technicalMessage, style: Theme.of(context).textTheme.bodyLarge),
},
],
),
return Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
_MessageHeader(message: message, query: query),
switch (message) {
final MailDVO mail => _MailContent(message: mail, query: query),
final RequestMessageDVO requestMessage => _RequestMessageContent(message: requestMessage),
_ => Text(context.l10n.mailbox_technicalMessage, style: Theme.of(context).textTheme.bodyLarge),
},
],
);
}
}
Expand Down
2 changes: 1 addition & 1 deletion apps/enmeshed/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: enmeshed
description: The official Enmeshed app.
publish_to: "none"
version: 3.1.0
version: 3.1.1

environment:
sdk: ">=3.5.0 <4.0.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ class FileReferenceRenderer extends StatefulWidget {
final String valueType;
final Widget? extraLine;
final bool showTitle;
final String? titleOverride;
final Future<FileDVO> Function(String) expandFileReference;
final void Function(FileDVO) openFileDetails;
final Widget? trailing;
Expand All @@ -17,6 +18,7 @@ class FileReferenceRenderer extends StatefulWidget {
required this.valueType,
this.extraLine,
this.showTitle = true,
this.titleOverride,
required this.expandFileReference,
required this.openFileDetails,
this.trailing,
Expand Down Expand Up @@ -56,7 +58,7 @@ class _FileReferenceRendererState extends State<FileReferenceRenderer> {
children: [
if (widget.showTitle)
TranslatedText(
'i18n://dvo.attribute.name.${widget.valueType}',
widget.titleOverride ?? 'i18n://dvo.attribute.name.${widget.valueType}',
style: TextStyle(fontSize: 12, color: Theme.of(context).colorScheme.onSurfaceVariant),
),
if (expandedFileReference == null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class IdentityAttributeValueRenderer extends StatelessWidget {
final TextStyle valueTextStyle;
final Widget? extraLine;
final Widget? trailing;
final String? titleOverride;
final Future<FileDVO> Function(String) expandFileReference;
final void Function(FileDVO) openFileDetails;

Expand All @@ -28,6 +29,7 @@ class IdentityAttributeValueRenderer extends StatelessWidget {
this.valueTextStyle = const TextStyle(fontSize: 16),
this.extraLine,
this.trailing,
this.titleOverride,
required this.expandFileReference,
required this.openFileDetails,
});
Expand Down Expand Up @@ -86,6 +88,7 @@ class IdentityAttributeValueRenderer extends StatelessWidget {

if (value is IdentityFileReferenceAttributeValue) {
return FileReferenceRenderer(
titleOverride: titleOverride,
fileReference: (value as IdentityFileReferenceAttributeValue).value,
expandFileReference: expandFileReference,
openFileDetails: openFileDetails,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ class _DecidableReadAttributeRequestItemRendererState extends State<DecidableRea
openFileDetails: widget.openFileDetails,
),
final ProcessedIQLQueryDVO query => ProcessedIQLQueryRenderer(
requestItemTitle: widget.item.name,
query: query,
checkboxSettings: (isChecked: isChecked, onUpdateCheckbox: widget.item.checkboxEnabled ? onUpdateCheckbox : null),
onUpdateAttribute: _onUpdateAttribute,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import 'package:flutter/material.dart';
import 'package:i18n_translated_text/i18n_translated_text.dart';
import 'package:value_renderer/value_renderer.dart';

import '../../widgets/value_renderer_list_tile.dart';
import '/src/attribute/identity_attribute_value_renderer.dart';
import '/src/attribute/relationship_attribute_value_renderer.dart';
import '/src/checkbox_settings.dart';
import '../../widgets/value_renderer_list_tile.dart';

class ProcessedIdentityAttributeQueryRenderer extends StatelessWidget {
final ProcessedIdentityAttributeQueryDVO query;
Expand Down Expand Up @@ -71,13 +71,7 @@ class ProcessedIdentityAttributeQueryRenderer extends StatelessWidget {
valueHints: query.results.first.valueHints,
trailing: onUpdateAttribute == null
? null
: SizedBox(
width: 50,
child: IconButton(
onPressed: () => onUpdateAttribute!(query.valueType),
icon: const Icon(Icons.chevron_right),
),
),
: IconButton(onPressed: () => onUpdateAttribute!(query.valueType), icon: const Icon(Icons.chevron_right)),
expandFileReference: expandFileReference,
openFileDetails: openFileDetails,
),
Expand Down Expand Up @@ -209,6 +203,7 @@ class ProcessedThirdPartyRelationshipAttributeQueryRenderer extends StatelessWid
}

class ProcessedIQLQueryRenderer extends StatelessWidget {
final String? requestItemTitle;
final ProcessedIQLQueryDVO query;
final CheckboxSettings? checkboxSettings;
final AbstractAttribute? selectedAttribute;
Expand All @@ -221,6 +216,7 @@ class ProcessedIQLQueryRenderer extends StatelessWidget {

const ProcessedIQLQueryRenderer({
super.key,
required this.requestItemTitle,
required this.query,
this.checkboxSettings,
this.selectedAttribute,
Expand All @@ -239,17 +235,18 @@ class ProcessedIQLQueryRenderer extends StatelessWidget {
if (query.results.isEmpty) {
if (query.valueType != null && query.valueHints != null && query.renderHints != null) {
return ValueRendererListTile(
fieldName: switch (query.valueType) {
'Affiliation' ||
'BirthDate' ||
'BirthPlace' ||
'DeliveryBoxAddress' ||
'PersonName' ||
'PostOfficeBoxAddress' ||
'StreetAddress' =>
'i18n://attributes.values.${query.valueType}._title',
_ => 'i18n://dvo.attribute.name.${query.valueType}',
},
fieldName: requestItemTitle ??
switch (query.valueType) {
'Affiliation' ||
'BirthDate' ||
'BirthPlace' ||
'DeliveryBoxAddress' ||
'PersonName' ||
'PostOfficeBoxAddress' ||
'StreetAddress' =>
'i18n://attributes.values.${query.valueType}._title',
_ => 'i18n://dvo.attribute.name.${query.valueType}',
},
renderHints: query.renderHints!,
valueHints: query.valueHints!,
onUpdateInput: onUpdateInput,
Expand All @@ -275,6 +272,7 @@ class ProcessedIQLQueryRenderer extends StatelessWidget {
if (checkboxSettings != null) Checkbox(value: checkboxSettings!.isChecked, onChanged: checkboxSettings!.onUpdateCheckbox),
Expanded(
child: IdentityAttributeValueRenderer(
titleOverride: requestItemTitle,
value: selectedAttribute is IdentityAttribute ? selectedAttribute.value : query.results.first.value as IdentityAttributeValue,
valueHints: query.results.first.valueHints,
trailing: onUpdateAttribute == null
Expand Down
12 changes: 8 additions & 4 deletions packages/value_renderer/lib/src/renderers/file_reference.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ class FileReferenceRenderer extends StatefulWidget {
final AttributeValue? initialValue;
final bool mustBeFilledOut;
final ValueHints valueHints;
final TextStyle valueTextStyle;
final Future<FileDVO> Function(String) expandFileReference;
final void Function(FileDVO) openFileDetails;
final Future<FileDVO?> Function() chooseFile;
Expand All @@ -24,6 +25,7 @@ class FileReferenceRenderer extends StatefulWidget {
this.initialValue,
required this.mustBeFilledOut,
required this.valueHints,
this.valueTextStyle = const TextStyle(fontSize: 16),
required this.expandFileReference,
required this.openFileDetails,
required this.chooseFile,
Expand Down Expand Up @@ -65,18 +67,20 @@ class _FileReferenceRendererState extends State<FileReferenceRenderer> {

@override
Widget build(BuildContext context) {
final title = widget.fieldName != null ? TranslatedText(widget.fieldName!) : null;
final title = widget.fieldName != null
? TranslatedText(widget.fieldName!, style: TextStyle(fontSize: 12, color: Theme.of(context).colorScheme.onSurfaceVariant))
: null;
final subtitle = !initialLoadComplete
? const LinearProgressIndicator()
: selectedFile != null
? Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(selectedFile!.title),
Text(selectedFile!.filename),
Text(selectedFile!.title, style: widget.valueTextStyle),
Text(selectedFile!.filename, style: widget.valueTextStyle),
],
)
: const TranslatedText('i18n://valueRenderer.fileReference.noFileSelected');
: TranslatedText('i18n://valueRenderer.fileReference.noFileSelected', style: widget.valueTextStyle);

return ListTile(
contentPadding: EdgeInsets.zero,
Expand Down

0 comments on commit d2773b5

Please sign in to comment.