mirror of
https://github.com/git-touch/git-touch
synced 2025-02-02 00:46:48 +01:00
fix(bb): download url
This commit is contained in:
parent
76a2f4b960
commit
f9fa142702
@ -70,6 +70,7 @@ class BbTree {
|
||||
String type;
|
||||
String path;
|
||||
int size;
|
||||
Map<String, dynamic> links;
|
||||
BbTree();
|
||||
factory BbTree.fromJson(Map<String, dynamic> json) => _$BbTreeFromJson(json);
|
||||
}
|
||||
|
@ -122,11 +122,13 @@ BbTree _$BbTreeFromJson(Map<String, dynamic> json) {
|
||||
return BbTree()
|
||||
..type = json['type'] as String
|
||||
..path = json['path'] as String
|
||||
..size = json['size'] as int;
|
||||
..size = json['size'] as int
|
||||
..links = json['links'] as Map<String, dynamic>;
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$BbTreeToJson(BbTree instance) => <String, dynamic>{
|
||||
'type': instance.type,
|
||||
'path': instance.path,
|
||||
'size': instance.size,
|
||||
'links': instance.links,
|
||||
};
|
||||
|
@ -21,10 +21,11 @@ class BbObjectScreen extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final auth = Provider.of<AuthModel>(context);
|
||||
return RefreshStatefulScaffold(
|
||||
title: AppBarTitle(path ?? 'Files'),
|
||||
fetchData: () async {
|
||||
final res = await Provider.of<AuthModel>(context)
|
||||
final res = await auth
|
||||
.fetchBb('/repositories/$owner/$name/src/$ref/${path ?? ''}');
|
||||
if (res.headers[HttpHeaders.contentTypeHeader] == 'text/plain') {
|
||||
return res.body;
|
||||
@ -58,7 +59,7 @@ class BbObjectScreen extends StatelessWidget {
|
||||
size: v.type == 'commit_file' ? v.size : null,
|
||||
url:
|
||||
'/bitbucket/$owner/$name/src/$ref?path=${v.path.urlencode}',
|
||||
downloadUrl: null,
|
||||
downloadUrl: v.links['self']['href'] as String,
|
||||
),
|
||||
]);
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user