fix:fix qiniu repo page item dir show name semantic error

This commit is contained in:
hackycy
2020-08-16 01:27:38 +08:00
parent 8f906f6d21
commit 0bd68ef2a7
2 changed files with 7 additions and 4 deletions

View File

@@ -34,7 +34,7 @@ class _QiniuRepoPageState extends BaseLoadingPageState<QiniuRepoPage>
@override
AppBar get appBar => AppBar(
title: Text('图床仓库'),
title: Text(this._prefix == '/' ? '图床仓库' : this._prefix),
centerTitle: true,
);
@@ -97,7 +97,7 @@ class _QiniuRepoPageState extends BaseLoadingPageState<QiniuRepoPage>
onTap: () {
if (contents[index].type == FileContentType.DIR) {
Application.router.navigateTo(context,
'${Routes.settingPbQiniuRepo}?path=${Uri.encodeComponent(contents[index].key)}',
'${Routes.settingPbQiniuRepo}?path=${Uri.encodeComponent(contents[index].url)}',
transition: TransitionType.cupertino);
} else {
launch(contents[index].url);

View File

@@ -40,9 +40,9 @@ class QiniuRepoPagePresenter {
c.type = FileContentType.FILE;
c.url = pathlib.joinAll([
config.url,
prefix == '/' ? '' : prefix,
c.key,
]);
c.key = '${c.key}'.replaceFirst(prefix == '/' ? '' : prefix, '');
return c;
}).toList();
if (result['commonPrefixes'] != null) {
@@ -50,7 +50,10 @@ class QiniuRepoPagePresenter {
QiniuContent c = QiniuContent();
c.type = FileContentType.DIR;
c.url = element;
c.key = element;
/// 例如 xin/ax 去除 xin/ 只显示最后一个 ax
List<String> keys = '$element'.split('/');
print(keys);
c.key = keys[keys.length -2];
data.add(c);
});
}