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

Fixups #2310

Merged
merged 7 commits into from
May 29, 2024
Merged

Fixups #2310

Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions ai_recipe_generation/lib/widgets/icon_loading_indicator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,15 @@ class IconLoadingAnimator extends StatefulWidget {
var rand = Random();

class _IconLoadingAnimatorState extends State<IconLoadingAnimator> {
late List<IconData> notYetSeenIcons;
late IconData currentIcon;
late Color currentColor;
late Timer timer;

@override
void initState() {
super.initState();
notYetSeenIcons = widget.icons;

currentIcon =
notYetSeenIcons.removeAt(rand.nextInt(notYetSeenIcons.length));
currentIcon = widget.icons[rand.nextInt(widget.icons.length)];
currentColor = widget.colors[rand.nextInt(widget.colors.length)];

timer = Timer.periodic(
Expand All @@ -53,10 +50,9 @@ class _IconLoadingAnimatorState extends State<IconLoadingAnimator> {
}

void nextIcon() {
if (notYetSeenIcons.length == 1) notYetSeenIcons = widget.icons;
setState(() {
currentIcon =
notYetSeenIcons.removeAt(rand.nextInt(notYetSeenIcons.length));
widget.icons[rand.nextInt(widget.icons.length)];
currentColor = widget.colors[rand.nextInt(widget.colors.length)];
});
}
Expand Down
Loading