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(
|
child: MarketplaceButton(
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
await viewModel.submitPrompt().then((_) async {
|
await viewModel.submitPrompt().then((_) async {
|
||||||
|
if (!context.mounted) return;
|
||||||
if (viewModel.recipe != null) {
|
if (viewModel.recipe != null) {
|
||||||
bool? shouldSave = await showDialog<bool>(
|
bool? shouldSave = await showDialog<bool>(
|
||||||
context: context,
|
context: context,
|
||||||
|
|||||||
@@ -30,7 +30,6 @@ class IconLoadingAnimator extends StatefulWidget {
|
|||||||
var rand = Random();
|
var rand = Random();
|
||||||
|
|
||||||
class _IconLoadingAnimatorState extends State<IconLoadingAnimator> {
|
class _IconLoadingAnimatorState extends State<IconLoadingAnimator> {
|
||||||
late List<IconData> notYetSeenIcons;
|
|
||||||
late IconData currentIcon;
|
late IconData currentIcon;
|
||||||
late Color currentColor;
|
late Color currentColor;
|
||||||
late Timer timer;
|
late Timer timer;
|
||||||
@@ -38,10 +37,8 @@ class _IconLoadingAnimatorState extends State<IconLoadingAnimator> {
|
|||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
notYetSeenIcons = widget.icons;
|
|
||||||
|
|
||||||
currentIcon =
|
currentIcon = widget.icons[rand.nextInt(widget.icons.length)];
|
||||||
notYetSeenIcons.removeAt(rand.nextInt(notYetSeenIcons.length));
|
|
||||||
currentColor = widget.colors[rand.nextInt(widget.colors.length)];
|
currentColor = widget.colors[rand.nextInt(widget.colors.length)];
|
||||||
|
|
||||||
timer = Timer.periodic(
|
timer = Timer.periodic(
|
||||||
@@ -53,10 +50,8 @@ class _IconLoadingAnimatorState extends State<IconLoadingAnimator> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void nextIcon() {
|
void nextIcon() {
|
||||||
if (notYetSeenIcons.length == 1) notYetSeenIcons = widget.icons;
|
|
||||||
setState(() {
|
setState(() {
|
||||||
currentIcon =
|
currentIcon = widget.icons[rand.nextInt(widget.icons.length)];
|
||||||
notYetSeenIcons.removeAt(rand.nextInt(notYetSeenIcons.length));
|
|
||||||
currentColor = widget.colors[rand.nextInt(widget.colors.length)];
|
currentColor = widget.colors[rand.nextInt(widget.colors.length)];
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -92,6 +92,7 @@ class _PerformancePageState extends State<PerformancePage> {
|
|||||||
var snackBar = const SnackBar(
|
var snackBar = const SnackBar(
|
||||||
content: Text('Main Isolate Done!'),
|
content: Text('Main Isolate Done!'),
|
||||||
);
|
);
|
||||||
|
if (!context.mounted) return;
|
||||||
ScaffoldMessenger.of(context).showSnackBar(snackBar);
|
ScaffoldMessenger.of(context).showSnackBar(snackBar);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -106,6 +107,7 @@ class _PerformancePageState extends State<PerformancePage> {
|
|||||||
var snackBar = const SnackBar(
|
var snackBar = const SnackBar(
|
||||||
content: Text('Secondary Isolate Done!'),
|
content: Text('Secondary Isolate Done!'),
|
||||||
);
|
);
|
||||||
|
if (!context.mounted) return;
|
||||||
ScaffoldMessenger.of(context).showSnackBar(snackBar);
|
ScaffoldMessenger.of(context).showSnackBar(snackBar);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ declare -ar PROJECT_NAMES=(
|
|||||||
"add_to_app/multiple_flutters/multiple_flutters_module"
|
"add_to_app/multiple_flutters/multiple_flutters_module"
|
||||||
"add_to_app/plugin/flutter_module_using_plugin"
|
"add_to_app/plugin/flutter_module_using_plugin"
|
||||||
"add_to_app/prebuilt_module/flutter_module"
|
"add_to_app/prebuilt_module/flutter_module"
|
||||||
|
"ai_recipe_generation"
|
||||||
"analysis_defaults"
|
"analysis_defaults"
|
||||||
"android_splash_screen"
|
"android_splash_screen"
|
||||||
"animations"
|
"animations"
|
||||||
@@ -26,6 +27,7 @@ declare -ar PROJECT_NAMES=(
|
|||||||
"deeplink_store_example"
|
"deeplink_store_example"
|
||||||
"desktop_photo_search/fluent_ui"
|
"desktop_photo_search/fluent_ui"
|
||||||
"desktop_photo_search/material"
|
"desktop_photo_search/material"
|
||||||
|
"dynamic_theme"
|
||||||
"experimental/federated_plugin/federated_plugin"
|
"experimental/federated_plugin/federated_plugin"
|
||||||
"experimental/federated_plugin/federated_plugin/example"
|
"experimental/federated_plugin/federated_plugin/example"
|
||||||
"experimental/federated_plugin/federated_plugin_macos"
|
"experimental/federated_plugin/federated_plugin_macos"
|
||||||
@@ -42,11 +44,11 @@ declare -ar PROJECT_NAMES=(
|
|||||||
"flutter_maps_firestore"
|
"flutter_maps_firestore"
|
||||||
"form_app"
|
"form_app"
|
||||||
"game_template"
|
"game_template"
|
||||||
|
"gemini_tasks"
|
||||||
"google_maps"
|
"google_maps"
|
||||||
"infinite_list"
|
"infinite_list"
|
||||||
"ios_app_clip"
|
"ios_app_clip"
|
||||||
# Don't use 'BuildContext's across async gaps.
|
"isolate_example"
|
||||||
# "isolate_example"
|
|
||||||
"material_3_demo"
|
"material_3_demo"
|
||||||
"navigation_and_routing"
|
"navigation_and_routing"
|
||||||
"place_tracker"
|
"place_tracker"
|
||||||
|
|||||||
@@ -14,8 +14,7 @@ declare -ar PROJECT_NAMES=(
|
|||||||
"add_to_app/multiple_flutters/multiple_flutters_module"
|
"add_to_app/multiple_flutters/multiple_flutters_module"
|
||||||
"add_to_app/plugin/flutter_module_using_plugin"
|
"add_to_app/plugin/flutter_module_using_plugin"
|
||||||
"add_to_app/prebuilt_module/flutter_module"
|
"add_to_app/prebuilt_module/flutter_module"
|
||||||
# Don't use 'BuildContext's across async gaps.
|
"ai_recipe_generation"
|
||||||
# "ai_recipe_generation"
|
|
||||||
"analysis_defaults"
|
"analysis_defaults"
|
||||||
"android_splash_screen"
|
"android_splash_screen"
|
||||||
"animations"
|
"animations"
|
||||||
@@ -28,6 +27,7 @@ declare -ar PROJECT_NAMES=(
|
|||||||
"deeplink_store_example"
|
"deeplink_store_example"
|
||||||
"desktop_photo_search/fluent_ui"
|
"desktop_photo_search/fluent_ui"
|
||||||
"desktop_photo_search/material"
|
"desktop_photo_search/material"
|
||||||
|
"dynamic_theme"
|
||||||
"experimental/federated_plugin/federated_plugin"
|
"experimental/federated_plugin/federated_plugin"
|
||||||
"experimental/federated_plugin/federated_plugin/example"
|
"experimental/federated_plugin/federated_plugin/example"
|
||||||
"experimental/federated_plugin/federated_plugin_macos"
|
"experimental/federated_plugin/federated_plugin_macos"
|
||||||
@@ -44,11 +44,11 @@ declare -ar PROJECT_NAMES=(
|
|||||||
"flutter_maps_firestore"
|
"flutter_maps_firestore"
|
||||||
"form_app"
|
"form_app"
|
||||||
"game_template"
|
"game_template"
|
||||||
|
"gemini_tasks"
|
||||||
"google_maps"
|
"google_maps"
|
||||||
"infinite_list"
|
"infinite_list"
|
||||||
"ios_app_clip"
|
"ios_app_clip"
|
||||||
# Don't use 'BuildContext's across async gaps.
|
"isolate_example"
|
||||||
# "isolate_example"
|
|
||||||
"material_3_demo"
|
"material_3_demo"
|
||||||
"navigation_and_routing"
|
"navigation_and_routing"
|
||||||
"place_tracker"
|
"place_tracker"
|
||||||
|
|||||||
Reference in New Issue
Block a user