From 21a1d7ed3a8562f525a9ef104c1eee52fa4e2830 Mon Sep 17 00:00:00 2001 From: Eric Windmill Date: Wed, 29 May 2024 13:39:15 -0400 Subject: [PATCH] fix icon related error in recipe gen ai --- .../lib/widgets/icon_loading_indicator.dart | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/ai_recipe_generation/lib/widgets/icon_loading_indicator.dart b/ai_recipe_generation/lib/widgets/icon_loading_indicator.dart index cc98a3d46..16dbc660e 100644 --- a/ai_recipe_generation/lib/widgets/icon_loading_indicator.dart +++ b/ai_recipe_generation/lib/widgets/icon_loading_indicator.dart @@ -30,7 +30,6 @@ class IconLoadingAnimator extends StatefulWidget { var rand = Random(); class _IconLoadingAnimatorState extends State { - late List notYetSeenIcons; late IconData currentIcon; late Color currentColor; late Timer timer; @@ -38,10 +37,8 @@ class _IconLoadingAnimatorState extends State { @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( @@ -53,10 +50,9 @@ class _IconLoadingAnimatorState extends State { } 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)]; }); }