Skip to content

Commit

Permalink
fix icon related error in recipe gen ai
Browse files Browse the repository at this point in the history
  • Loading branch information
ericwindmill committed May 29, 2024
1 parent 12ec63b commit 21a1d7e
Showing 1 changed file with 2 additions and 6 deletions.
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

0 comments on commit 21a1d7e

Please sign in to comment.