fluffychat/lib/pangea/analytics_summary/progress_bar/level_bar.dart
wcjord d773347d6e
Morph-repo-2 (#1681)
* feat(morphs): repo for getting lang-specific list of morphs

* integrated repo into use of morph features and tags

* generated

* merged with previous push

* generated

* generated

* chore: fix .env file path

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: ggurdin <46800240+ggurdin@users.noreply.github.com>
Co-authored-by: ggurdin <ggurdin@gmail.com>
2025-02-03 12:21:29 -05:00

44 lines
1.2 KiB
Dart

import 'package:flutter/material.dart';
import 'package:fluffychat/config/app_config.dart';
import 'package:fluffychat/pangea/analytics_summary/progress_bar/animated_level_dart.dart';
import 'package:fluffychat/pangea/analytics_summary/progress_bar/progress_bar_details.dart';
class LevelBar extends StatefulWidget {
final LevelBarDetails details;
final ProgressBarDetails progressBarDetails;
const LevelBar({
super.key,
required this.details,
required this.progressBarDetails,
});
@override
LevelBarState createState() => LevelBarState();
}
class LevelBarState extends State<LevelBar> {
double prevWidth = 0;
double get width =>
widget.progressBarDetails.totalWidth * widget.details.widthMultiplier;
@override
void didUpdateWidget(covariant LevelBar oldWidget) {
super.didUpdateWidget(oldWidget);
if (oldWidget.details.currentPoints != widget.details.currentPoints) {
setState(() => prevWidth = width);
}
}
@override
Widget build(BuildContext context) {
return AnimatedLevelBar(
height: widget.progressBarDetails.height,
beginWidth: prevWidth,
endWidth: width,
primaryColor: AppConfig.gold,
highlightColor: AppConfig.goldLight,
);
}
}