Fix inventory links with format strings not opening

This commit is contained in:
Nutcake 2023-10-31 22:42:26 +01:00
parent 0ed40295eb
commit 2981db0d17
5 changed files with 16 additions and 6 deletions

View file

@ -25,7 +25,7 @@ class RecordApi {
} }
static Future<List<Record>> getUserRecordsAt(ApiClient client, {required String path, String? user}) async { static Future<List<Record>> getUserRecordsAt(ApiClient client, {required String path, String? user}) async {
final response = await client.get("/users/${user ?? client.userId}/records?path=$path"); final response = await client.get(Uri.encodeFull("/users/${user ?? client.userId}/records?path=$path"));
client.checkResponse(response); client.checkResponse(response);
final body = jsonDecode(response.body) as List; final body = jsonDecode(response.body) as List;
return body.map((e) => Record.fromMap(e)).toList(); return body.map((e) => Record.fromMap(e)).toList();

View file

@ -116,7 +116,7 @@ class InventoryClient extends ChangeNotifier {
final linkRecord = final linkRecord =
await RecordApi.getUserRecord(apiClient, recordId: record.linkRecordId, user: record.linkOwnerId); await RecordApi.getUserRecord(apiClient, recordId: record.linkRecordId, user: record.linkOwnerId);
records = await RecordApi.getUserRecordsAt(apiClient, records = await RecordApi.getUserRecordsAt(apiClient,
path: "${linkRecord.path}\\${record.name}", user: linkRecord.ownerId); path: "${linkRecord.path}\\${linkRecord.name}", user: linkRecord.ownerId);
} else { } else {
records = records =
await RecordApi.getUserRecordsAt(apiClient, path: "${record.path}\\${record.name}", user: record.ownerId); await RecordApi.getUserRecordsAt(apiClient, path: "${record.path}\\${record.name}", user: record.ownerId);

View file

@ -16,14 +16,14 @@ class ResoniteDirectory {
@override @override
String toString() { String toString() {
return record.name; return record.formattedName.toString();
} }
bool get isRoot => record.isRoot; bool get isRoot => record.isRoot;
String get absolutePath => "${parent?.absolutePath ?? ""}/${(record.name)}"; String get absolutePath => "${parent?.absolutePath ?? ""}/${(record.name)}";
List<String> get absolutePathSegments => (parent?.absolutePathSegments ?? []) + [record.name]; List<String> get absolutePathSegments => (parent?.absolutePathSegments ?? []) + [record.formattedName.toString()];
bool containsRecord(Record record) => children.where((element) => element.record.id == record.id).isNotEmpty; bool containsRecord(Record record) => children.where((element) => element.record.id == record.id).isNotEmpty;

View file

@ -113,7 +113,17 @@ class _InventoryBrowserState extends State<InventoryBrowser> with AutomaticKeepA
onPressed: () { onPressed: () {
iClient.navigateUp(times: pathSegments.length - 1 - idx); iClient.navigateUp(times: pathSegments.length - 1 - idx);
}, },
child: Text(segment), child: ConstrainedBox(
constraints: BoxConstraints(
maxWidth: MediaQuery.of(context).size.width * 0.8,
),
child: Text(
segment,
maxLines: 2,
overflow: TextOverflow.ellipsis,
softWrap: true,
),
),
), ),
), ),
], ],

View file

@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
# In Windows, build-name is used as the major, minor, and patch parts # In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix. # of the product and file versions while build-number is used as the build suffix.
version: 0.10.1-beta+1 version: 0.10.2-beta+1
environment: environment:
sdk: '>=3.0.1' sdk: '>=3.0.1'