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 {
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);
final body = jsonDecode(response.body) as List;
return body.map((e) => Record.fromMap(e)).toList();

View file

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

View file

@ -16,14 +16,14 @@ class ResoniteDirectory {
@override
String toString() {
return record.name;
return record.formattedName.toString();
}
bool get isRoot => record.isRoot;
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;

View file

@ -113,7 +113,17 @@ class _InventoryBrowserState extends State<InventoryBrowser> with AutomaticKeepA
onPressed: () {
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
# 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.
version: 0.10.1-beta+1
version: 0.10.2-beta+1
environment:
sdk: '>=3.0.1'