mirror of
https://github.com/flutter/samples.git
synced 2025-11-08 13:58:47 +00:00
Fixups (#2310)
Fixes #2301 --------- Co-authored-by: Brett Morgan <brett.morgan@gmail.com> Co-authored-by: Brett Morgan <brettmorgan@google.com>
This commit is contained in:
@@ -251,6 +251,7 @@ class PromptScreen extends StatelessWidget {
|
||||
child: MarketplaceButton(
|
||||
onPressed: () async {
|
||||
await viewModel.submitPrompt().then((_) async {
|
||||
if (!context.mounted) return;
|
||||
if (viewModel.recipe != null) {
|
||||
bool? shouldSave = await showDialog<bool>(
|
||||
context: context,
|
||||
|
||||
@@ -30,7 +30,6 @@ 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;
|
||||
@@ -38,10 +37,8 @@ class _IconLoadingAnimatorState extends State<IconLoadingAnimator> {
|
||||
@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,8 @@ class _IconLoadingAnimatorState extends State<IconLoadingAnimator> {
|
||||
}
|
||||
|
||||
void nextIcon() {
|
||||
if (notYetSeenIcons.length == 1) notYetSeenIcons = widget.icons;
|
||||
setState(() {
|
||||
currentIcon =
|
||||
notYetSeenIcons.removeAt(rand.nextInt(notYetSeenIcons.length));
|
||||
currentIcon = widget.icons[rand.nextInt(widget.icons.length)];
|
||||
currentColor = widget.colors[rand.nextInt(widget.colors.length)];
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user