Skip to content

Commit

Permalink
Add animation to flux bar.
Browse files Browse the repository at this point in the history
  • Loading branch information
Berrysoft committed Jun 19, 2023
1 parent 51a98cd commit 628615d
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 8 deletions.
6 changes: 5 additions & 1 deletion tunet-flutter/lib/runtime.dart
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,11 @@ class ManagedRuntime extends NotifyPropertyChanged {

Future<void> queueLogin() => runtime.queueLogin();
Future<void> queueLogout() => runtime.queueLogout();
Future<void> queueFlux() => runtime.queueFlux();
Future<void> queueFlux() async {
netFlux = null;
await runtime.queueFlux();
}

Future<void> queueDetails() async {
detailsData.setData(List.empty());
daily = null;
Expand Down
23 changes: 16 additions & 7 deletions tunet-flutter/lib/views/home_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,22 @@ class _HomePageState extends State<HomePage> {
final flux = netFlux.flux.field0;
final balance = netFlux.balance.field0;

return CustomPaint(
size: Size(MediaQuery.of(context).size.width, 30.0),
painter: FluxPainter(
flux: flux.toDouble() / 1000000000.0,
balance: balance,
accent: Theme.of(context).colorScheme.primary,
),
return TweenAnimationBuilder<double>(
tween: Tween(begin: 0, end: 1.0),
duration: const Duration(milliseconds: 500),
curve: Curves.easeOut,
builder: (context, value, child) {
final cflux = flux.toDouble() / 1000000000.0 * value;
final cbalance = balance * value;
return CustomPaint(
size: Size(MediaQuery.of(context).size.width, 30.0),
painter: FluxPainter(
flux: cflux,
balance: cbalance,
accent: Theme.of(context).colorScheme.primary,
),
);
},
);
},
);
Expand Down

0 comments on commit 628615d

Please sign in to comment.