mirror of
https://github.com/git-touch/git-touch
synced 2025-03-11 00:30:06 +01:00
parent
c3cf25bcf3
commit
89c311c410
@ -74,11 +74,23 @@ class ObjectScreen extends StatelessWidget {
|
|||||||
return ObjectTree(
|
return ObjectTree(
|
||||||
items: (data as GhObjectTree).entries.map((v) {
|
items: (data as GhObjectTree).entries.map((v) {
|
||||||
// if (item.type == 'commit') return null;
|
// if (item.type == 'commit') return null;
|
||||||
|
String url;
|
||||||
|
var ext = p.extension(v.name);
|
||||||
|
if (ext.startsWith('.')) ext = ext.substring(1);
|
||||||
|
if (['pdf', 'docx', 'doc', 'pptx', 'ppt', 'xlsx', 'xls']
|
||||||
|
.contains(ext)) {
|
||||||
|
// Let system browser handle these files
|
||||||
|
url =
|
||||||
|
'https://raw.githubusercontent.com/$owner/$name/$branch/$path';
|
||||||
|
} else {
|
||||||
|
url =
|
||||||
|
'/$owner/$name/blob/$branch?path=${p.join(_pathNotNull, v.name).urlencode}';
|
||||||
|
}
|
||||||
|
|
||||||
return ObjectTreeItem(
|
return ObjectTreeItem(
|
||||||
name: v.name,
|
name: v.name,
|
||||||
type: v.type,
|
type: v.type,
|
||||||
url:
|
url: url,
|
||||||
'/$owner/$name/blob/$branch?path=${p.join(_pathNotNull, v.name).urlencode}',
|
|
||||||
size: v.object.resolveType == 'Blob'
|
size: v.object.resolveType == 'Blob'
|
||||||
? (v.object as GhObjectBlob).byteSize
|
? (v.object as GhObjectBlob).byteSize
|
||||||
: null,
|
: null,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user