Skip to content

Commit

Permalink
Merge pull request #29 from albertms10/feat/add-cabin-icon-percent-oc…
Browse files Browse the repository at this point in the history
…cupied-tooltip

feat(cabin_icon): add percent occupied tooltip
  • Loading branch information
albertms10 committed Dec 6, 2021
2 parents bf01efa + 1b061d1 commit d21dfe1
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 22 deletions.
7 changes: 6 additions & 1 deletion lib/localization/app_ca.arb
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,12 @@
"noCabinsMessage": "Afegeix una cabina per començar",
"noSchoolYearsMessage": "Afegeix un curs per començar",
"accumulatedTime": "Temps acumulat",
"occupancy": "Ocupació",
"nPercentOccupied": "{n} % d’ocupació",
"@nPercentOccupied": {
"placeholders": {
"n": {}
}
},
"mostOccupiedTimeRange": "Horari més ocupat",
"mostBookedDay": "Dia amb més reserves",
"onDate": "El dia",
Expand Down
7 changes: 6 additions & 1 deletion lib/localization/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,12 @@
"noCabinsMessage": "Add a cabin to begin",
"noSchoolYearsMessage": "Add a school year to begin",
"accumulatedTime": "Accumulated time",
"occupancy": "Occupancy",
"nPercentOccupied": "{n}% occupied",
"@nPercentOccupied": {
"placeholders": {
"n": {}
}
},
"mostOccupiedTimeRange": "Most occupied time range",
"mostBookedDay": "Most booked day",
"onDate": "On",
Expand Down
7 changes: 6 additions & 1 deletion lib/localization/app_es.arb
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,12 @@
"noCabinsMessage": "Añada una cabina para empezar",
"noSchoolYearsMessage": "Añada un curso para empezar",
"accumulatedTime": "Tiempo acumulado",
"occupancy": "Ocupación",
"nPercentOccupied": "{n} % de ocupación",
"@nPercentOccupied": {
"placeholders": {
"n": {}
}
},
"mostOccupiedTimeRange": "Horario más ocupado",
"mostBookedDay": "Día con más reservas",
"onDate": "El día",
Expand Down
45 changes: 26 additions & 19 deletions lib/widgets/cabin/cabin_icon.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';

class CabinIcon extends StatelessWidget {
final int number;
Expand Down Expand Up @@ -36,26 +37,32 @@ class CabinIcon extends StatelessWidget {
);
}

return Stack(
alignment: Alignment.center,
children: [
SizedBox(
width: radius * 2.0,
height: radius * 2.0,
child: TweenAnimationBuilder<double>(
tween: Tween<double>(begin: 0.0, end: progress),
duration: const Duration(milliseconds: 700),
curve: Curves.easeOutCubic,
builder: (context, value, child) {
return CircularProgressIndicator(
value: value,
backgroundColor: theme.colorScheme.secondary.withOpacity(0.25),
);
},
final appLocalizations = AppLocalizations.of(context)!;

return Tooltip(
message: appLocalizations.nPercentOccupied((progress! * 100).ceil()),
child: Stack(
alignment: Alignment.center,
children: [
SizedBox(
width: radius * 2.0,
height: radius * 2.0,
child: TweenAnimationBuilder<double>(
tween: Tween<double>(begin: 0.0, end: progress),
duration: const Duration(milliseconds: 700),
curve: Curves.easeOutCubic,
builder: (context, value, child) {
return CircularProgressIndicator(
value: value,
backgroundColor:
theme.colorScheme.secondary.withOpacity(0.25),
);
},
),
),
),
text,
],
text,
],
),
);
}
}

0 comments on commit d21dfe1

Please sign in to comment.