Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/77 scoresection #136

Merged
merged 16 commits into from
Oct 1, 2024
3 changes: 3 additions & 0 deletions assets/company/unpublished.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 6 additions & 2 deletions lib/i18n/strings.g.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
/// To regenerate, run: `dart run slang`
///
/// Locales: 1
/// Strings: 28
/// Strings: 30
///
/// Built on 2024-09-24 at 17:35 UTC
/// Built on 2024-10-01 at 14:21 UTC

// coverage:ignore-file
// ignore_for_file: type=lint
Expand Down Expand Up @@ -189,6 +189,8 @@ class _StringsCompanyScreenEn {
String points({required Object score}) => '${score} pkt';
String get companyFriend => ' Ta firma jest przyjacielem Poli';
String get polaFriends => 'Przyjaciele Poli';
String get companyUnverified => 'Niestety, ta firma nie została jeszcze zweryfikowana, więc nie możemy wyświetlić jej oceny. Stale rozszerzamy naszą bazę, aby uwzględnić więcej firm.';
String get thankYou => 'Dziękujemy za cierpliwość!';
}

// Path: scan
Expand Down Expand Up @@ -234,6 +236,8 @@ extension on Translations {
case 'companyScreen.points': return ({required Object score}) => '${score} pkt';
case 'companyScreen.companyFriend': return ' Ta firma jest przyjacielem Poli';
case 'companyScreen.polaFriends': return 'Przyjaciele Poli';
case 'companyScreen.companyUnverified': return 'Niestety, ta firma nie została jeszcze zweryfikowana, więc nie możemy wyświetlić jej oceny. Stale rozszerzamy naszą bazę, aby uwzględnić więcej firm.';
case 'companyScreen.thankYou': return 'Dziękujemy za cierpliwość!';
case 'scan.scanning': return 'Skanowanie';
case 'scan.tryAgain': return 'Niestety nie udało się pobrać danych. Spróbuj ponownie.';
case 'scan.pkt': return ' pkt';
Expand Down
4 changes: 3 additions & 1 deletion lib/i18n/strings.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@
"seeLess":" zobacz mniej",
"points":"$score pkt",
"companyFriend": " Ta firma jest przyjacielem Poli",
"polaFriends": "Przyjaciele Poli"
"polaFriends": "Przyjaciele Poli",
"companyUnverified": "Niestety, ta firma nie została jeszcze zweryfikowana, więc nie możemy wyświetlić jej oceny. Stale rozszerzamy naszą bazę, aby uwzględnić więcej firm.",
"thankYou": "Dziękujemy za cierpliwość!"
},
"scan": {
"scanning": "Skanowanie",
Expand Down
170 changes: 170 additions & 0 deletions lib/pages/detail/company_score_widget.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,170 @@
import 'package:flutter/material.dart';
import 'package:pola_flutter/i18n/strings.g.dart';
import 'package:pola_flutter/theme/assets.gen.dart';
import 'package:pola_flutter/theme/colors.dart';
import 'package:pola_flutter/theme/fonts.gen.dart';
import 'package:pola_flutter/theme/text_size.dart';
import 'polish_capital_graph.dart';

class CompanyScoreData {
final double plCapital;
final bool plWorkers;
final bool plRnD;
final bool plRegistered;
final bool plNotGlobEnt;
final int plScore;

CompanyScoreData(
{required this.plCapital,
required this.plWorkers,
required this.plRnD,
required this.plRegistered,
required this.plNotGlobEnt,
required this.plScore});
}

class CompanyScoreWidget extends StatelessWidget {
final CompanyScoreData data;

const CompanyScoreWidget({super.key, required this.data});

@override
Widget build(BuildContext context) {
final Translations t = Translations.of(context);

return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Align(
alignment: Alignment.centerLeft,
child: Row(
children: [
Assets.company.info.svg(height: 24.0, width: 24.0),
const SizedBox(width: 8.0),
Text(
t.companyScreen.ourRating,
style: TextStyle(
fontSize: TextSize.mediumTitle,
fontWeight: FontWeight.w600,
fontFamily: FontFamily.lato,
color: AppColors.text,
),
),
const SizedBox(width: 8.0),
Text(
t.companyScreen.points(score: data.plScore),
style: TextStyle(
fontSize: TextSize.newsTitle,
fontWeight: FontWeight.w700,
fontFamily: FontFamily.lato,
color: AppColors.text,
),
),
],
),
),
Padding(
padding: const EdgeInsets.symmetric(vertical: 8.0),
child: ClipRRect(
borderRadius: BorderRadius.circular(10.0),
child: LinearProgressIndicator(
value: data.plScore / 100.0,
backgroundColor: AppColors.buttonBackground,
valueColor:
const AlwaysStoppedAnimation<Color>(AppColors.defaultRed),
minHeight: 12.0,
),
),
),
const SizedBox(height: 17.0),
Divider(
thickness: 1.0,
color: AppColors.divider,
indent: 0,
endIndent: 0,
),
Padding(
padding: const EdgeInsets.only(top: 22.0),
child: Align(
alignment: Alignment.centerLeft,
child: Text(
t.companyScreen.gradingCriteria,
style: TextStyle(
fontSize: TextSize.mediumTitle,
fontWeight: FontWeight.w600,
fontFamily: FontFamily.lato,
color: AppColors.text,
),
),
),
),
const SizedBox(height: 22.0),
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
PolishCapitalGraph(percentage: data.plCapital),
const SizedBox(width: 35.0),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
_DetailItem(t.companyScreen.producedInPoland, data.plWorkers),
const SizedBox(height: 14.0),
_DetailItem(t.companyScreen.researchInPoland, data.plRnD),
const SizedBox(height: 14.0),
_DetailItem(
t.companyScreen.registeredInPoland, data.plRegistered),
const SizedBox(height: 14.0),
_DetailItem(
t.companyScreen.notConcernPart, data.plNotGlobEnt),
],
),
),
],
),
const SizedBox(height: 22.0),
Divider(
thickness: 1.0,
color: AppColors.divider,
indent: 0,
endIndent: 0,
),
],
);
}
}

class _DetailItem extends StatelessWidget {
const _DetailItem(this.text, this.state, {Key? key}) : super(key: key);

final String text;
final bool state;

@override
Widget build(BuildContext context) {
return Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Padding(
padding: const EdgeInsets.only(right: 3.0),
child: state
? Assets.company.taskAlt.svg()
: Assets.company.radioButtonUnchecked.svg()),
Expanded(
child: Text(
text,
style: TextStyle(
fontSize: TextSize.description,
fontWeight: FontWeight.w400,
fontFamily: FontFamily.lato,
color: AppColors.text,
),
softWrap: true,
overflow: TextOverflow.visible,
),
),
],
);
}
}
Loading
Loading