Skip to content

Commit

Permalink
resolved issues in the companies page
Browse files Browse the repository at this point in the history
  • Loading branch information
Uttkarsh-raj committed Aug 15, 2024
1 parent c254bfc commit e984516
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 44 deletions.
2 changes: 1 addition & 1 deletion lib/src/models/company_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class Company {
parsedJson["closed"] ?? 0,
parsedJson["issue_count"] ?? 0,
DateTime.parse(parsedJson["modified"]),
parsedJson["logo"].toString(),
parsedJson["logo"] ?? "",
parsedJson["top"] ?? "",
parsedJson["twitter"],
parsedJson["facebook"],
Expand Down
68 changes: 36 additions & 32 deletions lib/src/pages/companies/company_details_and_issues.dart
Original file line number Diff line number Diff line change
Expand Up @@ -47,30 +47,33 @@ class CompanyDetailWithIssuesState
setState(() {
loading = true;
});
IssueData? response =
await IssueApiClient.getIssueByStatus("open", widget.company.url!);
openIssues = response!.issueList ?? [];
response =
await IssueApiClient.getIssueByStatus("closed", widget.company.url!);
closedIssues = response!.issueList ?? [];

// intialize the segments
segments = [
Segment(
value: closedIssues.length,
color: Color.fromARGB(255, 101, 205, 105),
label: Text(
"Closed",
if (widget.company.url != null && widget.company.url != "") {
IssueData? response =
await IssueApiClient.getIssueByStatus("open", widget.company.url!);
openIssues = response!.issueList ?? [];
response =
await IssueApiClient.getIssueByStatus("closed", widget.company.url!);
closedIssues = response!.issueList ?? [];

// intialize the segments
segments = [
Segment(
value: closedIssues.length,
color: Color.fromARGB(255, 101, 205, 105),
label: Text(
"Closed",
),
),
),
Segment(
value: openIssues.length,
color: Colors.deepOrange,
label: Text(
"Open",
Segment(
value: openIssues.length,
color: Colors.deepOrange,
label: Text(
"Open",
),
),
),
];
];
}
setState(() {
loading = false;
});
Expand Down Expand Up @@ -121,17 +124,18 @@ class CompanyDetailWithIssuesState
padding: EdgeInsets.symmetric(horizontal: 20).copyWith(top: 12),
child:
Column(mainAxisAlignment: MainAxisAlignment.start, children: [
ClipRRect(
borderRadius: BorderRadius.circular(12),
child: SizedBox(
// width: size.width * 0.89,
height: size.height * 0.17,
child: Image.network(
company.logoLink,
fit: BoxFit.contain,
if (company.logoLink != "")
ClipRRect(
borderRadius: BorderRadius.circular(12),
child: SizedBox(
// width: size.width * 0.89,
height: size.height * 0.17,
child: Image.network(
company.logoLink,
fit: BoxFit.contain,
),
),
),
),
SizedBox(height: 8),
Text(
company.companyName,
Expand All @@ -143,7 +147,7 @@ class CompanyDetailWithIssuesState
),
),
SizedBox(height: 8),
if (company.email != "") ...[
if (company.email != null && company.email != "") ...[
Text(
company.email!,
style: GoogleFonts.ubuntu(
Expand Down Expand Up @@ -249,7 +253,7 @@ class CompanyDetailWithIssuesState
// ),
SizedBox(height: 20),
// About Us Section: only if have a desc
if (company.description != null) ...[
if (company.description != null && company.description != "") ...[
Align(
alignment: Alignment.centerLeft,
child: Text(
Expand Down
16 changes: 11 additions & 5 deletions lib/src/pages/companies/company_list_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -259,11 +259,17 @@ class CompanyListElement extends StatelessWidget {
child: SizedBox(
height: 80,
width: 120,
child: Image.network(
company.logoLink,
fit: BoxFit.cover,
alignment: Alignment.center,
),
child: (company.logoLink != "")
? Image.network(
company.logoLink,
fit: BoxFit.cover,
alignment: Alignment.center,
)
: Image.asset(
"assets/image-not-found.png",
fit: BoxFit.cover,
alignment: Alignment.center,
),
),
),
SizedBox(height: 8),
Expand Down
9 changes: 5 additions & 4 deletions lib/src/pages/leaderboards/company_scoreboard.dart
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class CompanyScoreboardPageState extends ConsumerState<CompanyScoreboardPage>
else
return CircleAvatar(
foregroundImage: CachedNetworkImageProvider(
GeneralEndPoints.apiBaseUrl + "media/" + partUrl,
"https://storage.googleapis.com/bhfiles/" + partUrl,
),
radius: 20,
);
Expand Down Expand Up @@ -190,9 +190,10 @@ class CompanyScoreboardPageState extends ConsumerState<CompanyScoreboardPage>
company.closedIssues,
company.issueCount,
company.lastModified,
GeneralEndPoints.apiBaseUrl +
"media/" +
company.logoLink,
(company.logoLink != "")
? "https://storage.googleapis.com/bhfiles/" +
company.logoLink
: "",
company.topTester,
company.twitter,
company.facebook,
Expand Down
2 changes: 1 addition & 1 deletion lib/src/providers/companies/company_list_provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class CompanyListNotifier extends StateNotifier<AsyncValue<List<Company>?>?> {
final client = http.Client();
try {
final List<Company>? companyData =
await CompanyApiClient.getListOfCompanies(client, "/company/");
await CompanyApiClient.getListOfCompanies(client, "companies/");
state = AsyncValue.data(companyData);
} catch (e) {
AsyncValue.error(e);
Expand Down
2 changes: 1 addition & 1 deletion lib/src/util/api/issues_api.dart
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ class IssueApiClient {
List<Issue>? issueList;
try {
String searchUrl = GeneralEndPoints.apiBaseUrl +
"/api/v1/issues/" +
"issues/" +
"?status=$status&domain=$url";
response = await http.get(Uri.parse(searchUrl));
if (response.statusCode == 200) {
Expand Down

0 comments on commit e984516

Please sign in to comment.