diff --git a/lib/src/models/contributors_model.dart b/lib/src/models/contributors_model.dart index 05dc20b507..45744407c9 100644 --- a/lib/src/models/contributors_model.dart +++ b/lib/src/models/contributors_model.dart @@ -43,7 +43,7 @@ class Contributors { name: json['name'], githubId: json['github_id'], githubUrl: json['github_url'], - image: json['avatar'], + image: json['avatar_url'], type: json['contributor_type'], contributions: json['contributions'], ); diff --git a/lib/src/models/project_model.dart b/lib/src/models/project_model.dart index 8552a2ea64..060d5a19e2 100644 --- a/lib/src/models/project_model.dart +++ b/lib/src/models/project_model.dart @@ -1,7 +1,5 @@ import 'package:blt/src/models/contributors_model.dart'; -import '../util/util_import.dart'; - class Project { final int id; final String name; @@ -10,7 +8,7 @@ class Project { final String github_url; String? wiki_url; String? homepage_url; - final String logo; + String? logo_url; DateTime? created; List? contributors; @@ -22,7 +20,7 @@ class Project { required this.github_url, this.wiki_url, this.homepage_url, - required this.logo, + this.logo_url, this.created, this.contributors, }); @@ -35,7 +33,7 @@ class Project { String? github_url, String? wiki_url, String? homepage_url, - String? logo, + String? logo_url, DateTime? created, List? contributors, }) { @@ -47,7 +45,7 @@ class Project { github_url: github_url ?? this.github_url, wiki_url: wiki_url ?? this.wiki_url, homepage_url: homepage_url ?? this.homepage_url, - logo: logo ?? this.logo, + logo_url: logo_url ?? this.logo_url, created: created ?? this.created, contributors: contributors ?? this.contributors, ); @@ -63,7 +61,7 @@ class Project { wiki_url: json['wiki_url'] != null ? json['wiki_url'] as String : "", homepage_url: json['homepage_url'] != null ? json['homepage_url'] as String : "", - logo: GeneralEndPoints.baseUrl + json['logo'], + logo_url: json['logo_url'] != null ? json['logo_url'] : "", created: json['created'] != null ? DateTime.parse(json['created']) : null, contributors: json['contributors'] != null ? Contributors.fromSnapshot(json['contributors']) diff --git a/lib/src/pages/drawer/projects.dart b/lib/src/pages/drawer/projects.dart index bb3becf965..011d2e487e 100644 --- a/lib/src/pages/drawer/projects.dart +++ b/lib/src/pages/drawer/projects.dart @@ -106,7 +106,7 @@ class _ContributorsPageState extends ConsumerState if (projectList!.isEmpty) { return Center( child: Text( - "${AppLocalizations.of(context)!.notManyBugs}:) \n ${AppLocalizations.of(context)!.yay}", + "Looks like there aren't many projects \n right now !", textAlign: TextAlign.center, ), ); @@ -165,7 +165,7 @@ class _ProjectSectionState extends State { List? contributors = []; @override void initState() { - contributors = widget.project.contributors; + contributors = widget.project.contributors ?? []; super.initState(); } @@ -179,17 +179,21 @@ class _ProjectSectionState extends State { children: [ Row( children: [ - SizedBox( - height: 25, - width: 25, - child: ClipRRect( - borderRadius: BorderRadius.circular(4), - child: CachedNetworkImage(imageUrl: widget.project.logo), + if (widget.project.logo_url != "") + SizedBox( + height: 25, + width: 25, + child: ClipRRect( + borderRadius: BorderRadius.circular(4), + child: CachedNetworkImage(imageUrl: widget.project.logo_url!), + ), ), - ), SizedBox(width: 5), Text( widget.project.name, + softWrap: true, + maxLines: 1, + overflow: TextOverflow.ellipsis, style: GoogleFonts.ubuntu( textStyle: TextStyle( color: Color(0xFFDC4654), diff --git a/lib/src/util/api/project_apis.dart b/lib/src/util/api/project_apis.dart index 317084886d..dff0fa7ba0 100644 --- a/lib/src/util/api/project_apis.dart +++ b/lib/src/util/api/project_apis.dart @@ -12,9 +12,9 @@ class ProjectAPiClient { var uri = GeneralEndPoints.apiBaseUrl + "projects/"; var response = await http.get(Uri.parse(uri)); var json_res = json.decode(response.body); - print(json_res); projects = Project.fromSnapshot(json_res['projects']); } catch (e) { + print(projects); print(e); } return projects;