Skip to content

Commit

Permalink
feat(cabin_icon): add percent occupied tooltip message
Browse files Browse the repository at this point in the history
  • Loading branch information
albertms10 committed Dec 6, 2021
1 parent 994cf4d commit 1b061d1
Showing 1 changed file with 26 additions and 19 deletions.
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 1b061d1

Please sign in to comment.