From e3bc8efd39a414c2fe07c88177f42a7070b95d48 Mon Sep 17 00:00:00 2001 From: Greg Spencer Date: Tue, 4 Apr 2023 13:34:29 -0700 Subject: [PATCH] Rename Sample classes (#124080) Rename Sample classes --- .../api/lib/animation/curves/curve2_d.0.dart | 23 +- .../cupertino_activity_indicator.0.dart | 6 +- .../bottom_tab_bar/cupertino_tab_bar.0.dart | 6 +- .../cupertino/button/cupertino_button.0.dart | 4 +- .../cupertino_context_menu.0.dart | 4 +- .../cupertino_context_menu.1.dart | 13 +- .../date_picker/cupertino_date_picker.0.dart | 15 +- .../date_picker/cupertino_timer_picker.0.dart | 9 +- .../dialog/cupertino_action_sheet.0.dart | 4 +- .../dialog/cupertino_alert_dialog.0.dart | 4 +- .../form_row/cupertino_form_row.0.dart | 12 +- .../list_section/list_section_base.0.dart | 13 +- .../list_section/list_section_inset.0.dart | 13 +- .../nav_bar/cupertino_navigation_bar.0.dart | 4 +- .../nav_bar/cupertino_sliver_nav_bar.0.dart | 23 +- .../cupertino_page_scaffold.0.dart | 4 +- .../cupertino/picker/cupertino_picker.0.dart | 4 +- .../cupertino/radio/cupertino_radio.0.dart | 4 +- .../radio/cupertino_radio.toggleable.0.dart | 4 +- .../cupertino_sliver_refresh_control.0.dart | 4 +- .../route/show_cupertino_dialog.0.dart | 7 +- .../route/show_cupertino_modal_popup.0.dart | 4 +- .../scrollbar/cupertino_scrollbar.0.dart | 4 +- .../scrollbar/cupertino_scrollbar.1.dart | 4 +- .../cupertino_search_field.0.dart | 4 +- .../cupertino_search_field.1.dart | 4 +- .../cupertino_segmented_control.0.dart | 6 +- ...cupertino_sliding_segmented_control.0.dart | 6 +- .../cupertino/slider/cupertino_slider.0.dart | 10 +- .../cupertino/switch/cupertino_switch.0.dart | 4 +- .../cupertino_tab_controller.0.dart | 6 +- .../cupertino_tab_scaffold.0.dart | 4 +- .../text_field/cupertino_text_field.0.dart | 6 +- .../cupertino_text_form_field_row.1.dart | 4 +- .../pointer_signal_resolver.0.dart | 24 +- .../lib/material/about/about_list_tile.0.dart | 21 +- .../action_buttons/action_icon_theme.0.dart | 11 +- .../animated_icon/animated_icon.0.dart | 9 +- .../animated_icon/animated_icons_data.0.dart | 9 +- .../api/lib/material/app_bar/app_bar.0.dart | 7 +- .../api/lib/material/app_bar/app_bar.1.dart | 4 +- .../api/lib/material/app_bar/app_bar.2.dart | 4 +- .../api/lib/material/app_bar/app_bar.3.dart | 10 +- .../material/app_bar/sliver_app_bar.1.dart | 4 +- .../material/app_bar/sliver_app_bar.2.dart | 6 +- .../material/app_bar/sliver_app_bar.3.dart | 6 +- .../material/autocomplete/autocomplete.0.dart | 4 +- .../material/autocomplete/autocomplete.1.dart | 8 +- .../material/banner/material_banner.0.dart | 17 +- .../material/banner/material_banner.1.dart | 17 +- .../bottom_app_bar/bottom_app_bar.1.dart | 10 +- .../bottom_app_bar/bottom_app_bar.2.dart | 9 +- .../bottom_navigation_bar.0.dart | 24 +- .../bottom_navigation_bar.1.dart | 24 +- .../bottom_navigation_bar.2.dart | 21 +- .../show_modal_bottom_sheet.0.dart | 4 +- .../show_modal_bottom_sheet.1.dart | 4 +- .../material/button_style/button_style.0.dart | 6 +- examples/api/lib/material/card/card.0.dart | 19 +- examples/api/lib/material/card/card.1.dart | 19 +- examples/api/lib/material/card/card.2.dart | 14 +- .../api/lib/material/checkbox/checkbox.0.dart | 23 +- .../api/lib/material/checkbox/checkbox.1.dart | 24 +- .../checkbox_list_tile.0.dart | 4 +- .../checkbox_list_tile.1.dart | 10 +- .../custom_labeled_checkbox.0.dart | 4 +- .../custom_labeled_checkbox.1.dart | 4 +- ...eletable_chip_attributes.on_deleted.0.dart | 23 +- .../material/choice_chip/choice_chip.0.dart | 4 +- .../color_scheme/dynamic_content_color.0.dart | 161 ++++-------- .../context_menu_controller.0.dart | 18 +- .../editable_text_toolbar_builder.0.dart | 10 +- .../editable_text_toolbar_builder.1.dart | 36 +-- .../editable_text_toolbar_builder.2.dart | 10 +- .../selectable_region_toolbar_builder.0.dart | 18 +- .../lib/material/data_table/data_table.0.dart | 19 +- .../lib/material/data_table/data_table.1.dart | 26 +- .../date_picker/show_date_picker.0.dart | 20 +- .../date_picker/show_date_range_picker.0.dart | 35 +-- .../lib/material/dialog/alert_dialog.0.dart | 10 +- .../lib/material/dialog/alert_dialog.1.dart | 10 +- .../api/lib/material/dialog/dialog.0.dart | 14 +- .../lib/material/dialog/show_dialog.0.dart | 19 +- .../lib/material/dialog/show_dialog.1.dart | 19 +- .../lib/material/dialog/show_dialog.2.dart | 22 +- .../api/lib/material/divider/divider.0.dart | 10 +- .../api/lib/material/divider/divider.1.dart | 10 +- .../material/divider/vertical_divider.0.dart | 10 +- .../material/divider/vertical_divider.1.dart | 10 +- .../material/dropdown/dropdown_button.0.dart | 4 +- ...opdown_button.selected_item_builder.0.dart | 6 +- .../dropdown/dropdown_button.style.0.dart | 4 +- .../dropdown_menu/dropdown_menu.0.dart | 27 +- .../elevated_button/elevated_button.0.dart | 26 +- .../expansion_panel_list.0.dart | 26 +- ...nel_list.expansion_panel_list_radio.0.dart | 29 +-- .../expansion_tile/expansion_tile.0.dart | 8 +- .../expansion_tile/expansion_tile.1.dart | 9 +- .../filled_button/filled_button.0.dart | 4 +- .../material/filter_chip/filter_chip.0.dart | 7 +- .../flexible_space_bar.0.dart | 13 +- .../floating_action_button.0.dart | 10 +- .../floating_action_button.1.dart | 10 +- .../floating_action_button.2.dart | 10 +- .../floating_action_button.3.dart | 10 +- .../standard_fab_location.0.dart | 29 +-- .../material/icon_button/icon_button.0.dart | 23 +- .../material/icon_button/icon_button.1.dart | 19 +- .../material/icon_button/icon_button.2.dart | 6 +- .../material/icon_button/icon_button.3.dart | 6 +- .../lib/material/ink/ink.image_clip.0.dart | 25 +- .../lib/material/ink/ink.image_clip.1.dart | 13 +- .../api/lib/material/ink_well/ink_well.0.dart | 23 +- .../input_decorator/input_decoration.0.dart | 19 +- .../input_decorator/input_decoration.1.dart | 19 +- .../input_decorator/input_decoration.2.dart | 19 +- .../input_decorator/input_decoration.3.dart | 19 +- ...coration.floating_label_style_error.0.dart | 18 +- .../input_decoration.label.0.dart | 19 +- .../input_decoration.label_style_error.0.dart | 18 +- .../input_decoration.material_state.0.dart | 22 +- .../input_decoration.material_state.1.dart | 40 +-- .../input_decoration.prefix_icon.0.dart | 11 +- ..._decoration.prefix_icon_constraints.0.dart | 19 +- .../input_decoration.suffix_icon.0.dart | 11 +- ..._decoration.suffix_icon_constraints.0.dart | 19 +- .../list_tile/custom_list_item.0.dart | 4 +- .../list_tile/custom_list_item.1.dart | 4 +- .../lib/material/list_tile/list_tile.0.dart | 9 +- .../lib/material/list_tile/list_tile.1.dart | 8 +- .../lib/material/list_tile/list_tile.2.dart | 22 +- .../lib/material/list_tile/list_tile.3.dart | 4 +- .../lib/material/list_tile/list_tile.4.dart | 9 +- .../list_tile/list_tile.selected.0.dart | 5 +- .../material_state_border_side.0.dart | 23 +- .../material_state_mouse_cursor.0.dart | 19 +- .../material_state_outlined_border.0.dart | 24 +- .../material_state_property.0.dart | 19 +- .../menu_anchor/checkbox_menu_button.0.dart | 4 +- .../menu_anchor/menu_accelerator_label.0.dart | 4 +- .../material/menu_anchor/menu_anchor.0.dart | 26 +- .../material/menu_anchor/menu_anchor.1.dart | 26 +- .../lib/material/menu_anchor/menu_bar.0.dart | 4 +- .../menu_anchor/radio_menu_button.0.dart | 12 +- .../navigation_bar/navigation_bar.0.dart | 4 +- .../navigation_bar/navigation_bar.1.dart | 4 +- .../navigation_bar/navigation_bar.2.dart | 33 +-- .../navigation_drawer.0.dart | 34 +-- .../navigation_rail/navigation_rail.0.dart | 226 ++++++++--------- .../navigation_rail/navigation_rail.1.dart | 40 +-- .../navigation_rail.extended_animation.0.dart | 10 +- .../outlined_button/outlined_button.0.dart | 19 +- .../page_transitions_theme.0.dart | 4 +- .../page_transitions_theme.1.dart | 4 +- .../platform_menu_bar.0.dart | 6 +- .../lib/material/popup_menu/popup_menu.0.dart | 4 +- .../lib/material/popup_menu/popup_menu.1.dart | 4 +- .../circular_progress_indicator.0.dart | 7 +- .../circular_progress_indicator.1.dart | 11 +- .../linear_progress_indicator.0.dart | 7 +- .../linear_progress_indicator.1.dart | 11 +- examples/api/lib/material/radio/radio.0.dart | 23 +- .../material/radio/radio.toggleable.0.dart | 23 +- .../custom_labeled_radio.0.dart | 4 +- .../custom_labeled_radio.1.dart | 4 +- .../radio_list_tile/radio_list_tile.0.dart | 4 +- .../radio_list_tile/radio_list_tile.1.dart | 10 +- .../radio_list_tile.toggleable.0.dart | 4 +- .../material/range_slider/range_slider.0.dart | 23 +- .../refresh_indicator.0.dart | 13 +- .../refresh_indicator.1.dart | 10 +- .../reorderable_list_view.0.dart | 8 +- .../reorderable_list_view.1.dart | 3 +- ...ist_view.build_default_drag_handles.0.dart | 4 +- ..._view.reorderable_list_view_builder.0.dart | 4 +- .../api/lib/material/scaffold/scaffold.0.dart | 21 +- .../api/lib/material/scaffold/scaffold.1.dart | 21 +- .../api/lib/material/scaffold/scaffold.2.dart | 21 +- .../material/scaffold/scaffold.drawer.0.dart | 21 +- .../scaffold/scaffold.end_drawer.0.dart | 21 +- .../lib/material/scaffold/scaffold.of.0.dart | 11 +- .../lib/material/scaffold/scaffold.of.1.dart | 17 +- .../scaffold/scaffold_messenger.0.dart | 19 +- .../scaffold/scaffold_messenger.of.0.dart | 19 +- .../scaffold/scaffold_messenger.of.1.dart | 17 +- ...essenger_state.show_material_banner.0.dart | 19 +- ...fold_messenger_state.show_snack_bar.0.dart | 19 +- ...fold_messenger_state.show_snack_bar.1.dart | 4 +- .../scaffold_state.show_bottom_sheet.0.dart | 19 +- .../scaffold_state.show_snack_bar.0.dart | 19 +- .../lib/material/scrollbar/scrollbar.0.dart | 22 +- .../lib/material/scrollbar/scrollbar.1.dart | 26 +- .../search_anchor/search_anchor.0.dart | 63 +++-- .../search_anchor/search_anchor.1.dart | 26 +- .../search_anchor/search_anchor.2.dart | 13 +- .../segmented_button/segmented_button.0.dart | 10 +- .../selectable_region.0.dart | 33 +-- .../selection_area/selection_area.0.dart | 13 +- .../selection_container.0.dart | 18 +- .../selection_container_disabled.0.dart | 11 +- .../api/lib/material/slider/slider.0.dart | 4 +- .../api/lib/material/slider/slider.1.dart | 4 +- .../api/lib/material/slider/slider.2.dart | 4 +- .../lib/material/snack_bar/snack_bar.0.dart | 19 +- .../lib/material/snack_bar/snack_bar.1.dart | 19 +- .../lib/material/snack_bar/snack_bar.2.dart | 234 +++++++++--------- .../api/lib/material/stepper/stepper.0.dart | 28 +-- .../stepper/stepper.controls_builder.0.dart | 19 +- .../api/lib/material/switch/switch.0.dart | 4 +- .../api/lib/material/switch/switch.1.dart | 4 +- .../api/lib/material/switch/switch.2.dart | 4 +- .../api/lib/material/switch/switch.3.dart | 4 +- .../custom_labeled_switch.0.dart | 4 +- .../custom_labeled_switch.1.dart | 4 +- .../switch_list_tile/switch_list_tile.0.dart | 4 +- .../switch_list_tile/switch_list_tile.1.dart | 14 +- .../tab_controller/tab_controller.1.dart | 17 +- examples/api/lib/material/tabs/tab_bar.0.dart | 4 +- examples/api/lib/material/tabs/tab_bar.1.dart | 4 +- examples/api/lib/material/tabs/tab_bar.2.dart | 4 +- .../material/text_button/text_button.0.dart | 19 +- .../material/text_button/text_button.1.dart | 15 +- .../lib/material/text_field/text_field.0.dart | 10 +- .../lib/material/text_field/text_field.1.dart | 24 +- .../lib/material/text_field/text_field.2.dart | 14 +- .../text_form_field/text_form_field.1.dart | 21 +- .../lib/material/theme/theme_extension.1.dart | 19 +- .../time_picker/show_time_picker.0.dart | 4 +- .../toggle_buttons/toggle_buttons.0.dart | 30 +-- .../api/lib/material/tooltip/tooltip.0.dart | 13 +- .../api/lib/material/tooltip/tooltip.1.dart | 16 +- .../api/lib/material/tooltip/tooltip.2.dart | 13 +- .../api/lib/material/tooltip/tooltip.3.dart | 13 +- .../axis_direction/axis_direction.0.dart | 21 +- .../borders/border_side.stroke_align.0.dart | 10 +- .../painting/gradient/linear_gradient.0.dart | 10 +- .../linear_border/linear_border.0.dart | 44 ++-- .../growth_direction/growth_direction.0.dart | 36 ++- .../scroll_direction/scroll_direction.0.dart | 23 +- ...elegate_with_fixed_cross_axis_count.0.dart | 19 +- ...elegate_with_fixed_cross_axis_count.1.dart | 19 +- .../api/lib/sample_templates/cupertino.0.dart | 4 +- .../api/lib/sample_templates/material.0.dart | 4 +- .../api/lib/sample_templates/widgets.0.dart | 4 +- .../keyboard_key/logical_keyboard_key.0.dart | 4 +- .../keyboard_key/physical_keyboard_key.0.dart | 4 +- .../services/mouse_cursor/mouse_cursor.0.dart | 19 +- ...chrome.set_system_u_i_overlay_style.0.dart | 4 +- ...chrome.set_system_u_i_overlay_style.1.dart | 4 +- .../text_input/text_input_control.0.dart | 20 +- examples/api/lib/ui/text/font_feature.0.dart | 3 +- ...nt_feature.font_feature_alternative.0.dart | 3 +- ....font_feature_alternative_fractions.0.dart | 3 +- ...e.font_feature_case_sensitive_forms.0.dart | 3 +- ...ture.font_feature_character_variant.0.dart | 3 +- ....font_feature_contextual_alternates.0.dart | 3 +- ...nt_feature.font_feature_denominator.0.dart | 3 +- ...font_feature.font_feature_fractions.0.dart | 3 +- ...ature.font_feature_historical_forms.0.dart | 3 +- ...e.font_feature_historical_ligatures.0.dart | 4 +- ...feature.font_feature_lining_figures.0.dart | 4 +- ...t_feature.font_feature_locale_aware.0.dart | 4 +- ...ature.font_feature_notational_forms.0.dart | 3 +- ...ont_feature.font_feature_numerators.0.dart | 3 +- ...ature.font_feature_oldstyle_figures.0.dart | 3 +- ..._feature.font_feature_ordinal_forms.0.dart | 3 +- ...e.font_feature_proportional_figures.0.dart | 3 +- ...e.font_feature_scientific_inferiors.0.dart | 3 +- ...t_feature.font_feature_slashed_zero.0.dart | 3 +- ...e.font_feature_stylistic_alternates.0.dart | 3 +- ..._feature.font_feature_stylistic_set.0.dart | 3 +- ..._feature.font_feature_stylistic_set.1.dart | 3 +- ...ont_feature.font_feature_subscripts.0.dart | 3 +- ...t_feature.font_feature_superscripts.0.dart | 4 +- .../font_feature.font_feature_swash.0.dart | 3 +- ...eature.font_feature_tabular_figures.0.dart | 3 +- .../actions/action.action_overridable.0.dart | 21 +- .../widgets/actions/action_listener.0.dart | 32 +-- .../api/lib/widgets/actions/actions.0.dart | 26 +- .../actions/focusable_action_detector.0.dart | 27 +- .../animated_grid/animated_grid.0.dart | 4 +- .../animated_grid/sliver_animated_grid.0.dart | 4 +- .../animated_list/animated_list.0.dart | 21 +- .../animated_list/sliver_animated_list.0.dart | 35 +-- .../animated_size/animated_size.0.dart | 23 +- .../animated_switcher.0.dart | 21 +- .../app/widgets_app.widgets_app.0.dart | 13 +- .../lib/widgets/async/future_builder.0.dart | 21 +- .../lib/widgets/async/stream_builder.0.dart | 21 +- .../autocomplete/raw_autocomplete.0.dart | 21 +- .../autocomplete/raw_autocomplete.1.dart | 21 +- .../autocomplete/raw_autocomplete.2.dart | 28 ++- .../raw_autocomplete.focus_node.0.dart | 12 +- .../widgets/autofill/autofill_group.0.dart | 23 +- .../lib/widgets/basic/absorb_pointer.0.dart | 4 +- .../api/lib/widgets/basic/aspect_ratio.0.dart | 4 +- .../api/lib/widgets/basic/aspect_ratio.1.dart | 4 +- .../api/lib/widgets/basic/aspect_ratio.2.dart | 4 +- .../api/lib/widgets/basic/clip_rrect.0.dart | 4 +- .../api/lib/widgets/basic/clip_rrect.1.dart | 4 +- .../basic/custom_multi_child_layout.0.dart | 7 +- .../api/lib/widgets/basic/expanded.0.dart | 6 +- .../api/lib/widgets/basic/expanded.1.dart | 4 +- examples/api/lib/widgets/basic/flow.0.dart | 20 +- .../basic/fractionally_sized_box.0.dart | 4 +- .../lib/widgets/basic/ignore_pointer.0.dart | 6 +- .../lib/widgets/basic/indexed_stack.0.dart | 8 +- .../api/lib/widgets/basic/listener.0.dart | 7 +- .../api/lib/widgets/basic/mouse_region.0.dart | 7 +- .../widgets/basic/mouse_region.on_exit.0.dart | 4 +- .../widgets/basic/mouse_region.on_exit.1.dart | 41 ++- .../api/lib/widgets/basic/offstage.0.dart | 10 +- .../api/lib/widgets/basic/overflowbox.0.dart | 4 +- .../lib/widgets/basic/physical_shape.0.dart | 4 +- .../binding/widget_binding_observer.0.dart | 24 +- .../color_filter/color_filtered.0.dart | 19 +- .../widgets/dismissible/dismissible.0.dart | 23 +- .../lib/widgets/drag_target/draggable.0.dart | 23 +- .../editable_text.on_changed.0.dart | 21 +- .../editable_text.on_content_inserted.0.dart | 13 +- .../text_editing_controller.0.dart | 24 +- .../widgets/focus_manager/focus_node.0.dart | 22 +- .../focus_manager/focus_node.unfocus.0.dart | 25 +- .../api/lib/widgets/focus_scope/focus.0.dart | 27 +- .../api/lib/widgets/focus_scope/focus.1.dart | 17 +- .../api/lib/widgets/focus_scope/focus.2.dart | 24 +- .../widgets/focus_scope/focus_scope.0.dart | 35 ++- .../focus_traversal_group.0.dart | 29 +-- .../ordered_traversal_policy.0.dart | 19 +- examples/api/lib/widgets/form/form.0.dart | 23 +- .../lib/widgets/framework/build_owner.0.dart | 4 +- .../lib/widgets/framework/error_widget.0.dart | 23 +- .../gesture_detector/gesture_detector.0.dart | 21 +- .../gesture_detector/gesture_detector.1.dart | 25 +- .../gesture_detector/gesture_detector.2.dart | 11 +- .../key_event_manager.0.dart | 29 ++- examples/api/lib/widgets/heroes/hero.0.dart | 4 +- examples/api/lib/widgets/heroes/hero.1.dart | 8 +- .../widgets/image/image.error_builder.0.dart | 20 +- .../widgets/image/image.frame_builder.0.dart | 20 +- .../image/image.loading_builder.0.dart | 23 +- .../implicit_animations/animated_align.0.dart | 23 +- .../animated_container.0.dart | 26 +- .../animated_fractionally_sized_box.0.dart | 23 +- .../animated_padding.0.dart | 23 +- .../animated_positioned.0.dart | 23 +- .../implicit_animations/animated_slide.0.dart | 4 +- .../sliver_animated_opacity.0.dart | 23 +- .../inherited_model/inherited_model.0.dart | 9 +- .../inherited_notifier.0.dart | 27 +- .../inherited_theme/inherited_theme.0.dart | 13 +- .../interactive_viewer.0.dart | 19 +- .../interactive_viewer.builder.0.dart | 11 +- .../interactive_viewer.constrained.0.dart | 26 +- ...ve_viewer.transformation_controller.0.dart | 24 +- .../layout_builder/layout_builder.0.dart | 17 +- .../lib/widgets/magnifier/magnifier.0.dart | 10 +- ...ia_query_data.system_gesture_insets.0.dart | 27 +- .../lib/widgets/navigator/navigator.0.dart | 14 +- .../navigator.restorable_push.0.dart | 23 +- ...or.restorable_push_and_remove_until.0.dart | 23 +- ...vigator.restorable_push_replacement.0.dart | 26 +- .../navigator_state.restorable_push.0.dart | 23 +- ...te.restorable_push_and_remove_until.0.dart | 23 +- ...r_state.restorable_push_replacement.0.dart | 23 +- .../navigator/restorable_route_future.0.dart | 16 +- .../nested_scroll_view.0.dart | 27 +- .../nested_scroll_view.1.dart | 20 +- .../nested_scroll_view.2.dart | 26 +- .../nested_scroll_view_state.0.dart | 17 +- .../notification_listener/notification.0.dart | 22 +- .../widgets/overflow_bar/overflow_bar.0.dart | 26 +- .../api/lib/widgets/overlay/overlay.0.dart | 28 +-- .../lib/widgets/overlay/overlay_portal.0.dart | 11 +- .../glowing_overscroll_indicator.0.dart | 22 +- .../glowing_overscroll_indicator.1.dart | 19 +- .../widgets/page_storage/page_storage.0.dart | 10 +- .../lib/widgets/page_view/page_view.0.dart | 19 +- .../preferred_size/preferred_size.0.dart | 17 +- .../restoration/restoration_mixin.0.dart | 7 +- .../restorable_value.0.dart | 23 +- .../api/lib/widgets/routes/popup_route.0.dart | 4 +- .../widgets/routes/show_general_dialog.0.dart | 7 +- .../scroll_metrics_notification.0.dart | 4 +- .../scroll_view/custom_scroll_view.1.dart | 21 +- ...istview_select.1.dart => list_view.0.dart} | 22 +- .../widgets/scrollbar/raw_scrollbar.0.dart | 30 +-- .../widgets/scrollbar/raw_scrollbar.1.dart | 22 +- .../widgets/scrollbar/raw_scrollbar.2.dart | 26 +- .../scrollbar/raw_scrollbar.desktop.0.dart | 20 +- .../scrollbar/raw_scrollbar.shape.0.dart | 23 +- .../shared_app_data/shared_app_data.0.dart | 14 +- .../shared_app_data/shared_app_data.1.dart | 12 +- .../shortcuts/character_activator.0.dart | 23 +- .../widgets/shortcuts/logical_key_set.0.dart | 26 +- .../lib/widgets/shortcuts/shortcuts.0.dart | 26 +- .../lib/widgets/shortcuts/shortcuts.1.dart | 26 +- .../single_activator.single_activator.0.dart | 26 +- .../single_child_scroll_view.0.dart | 17 +- .../single_child_scroll_view.1.dart | 17 +- .../lib/widgets/sliver/sliver_opacity.1.dart | 21 +- .../sliver_fill/sliver_fill_remaining.0.dart | 19 +- .../sliver_fill/sliver_fill_remaining.1.dart | 19 +- .../sliver_fill/sliver_fill_remaining.2.dart | 19 +- .../sliver_fill/sliver_fill_remaining.3.dart | 22 +- ...ti_child_render_object_widget_mixin.0.dart | 21 +- examples/api/lib/widgets/table/table.0.dart | 19 +- .../tap_region/text_field_tap_region.0.dart | 4 +- examples/api/lib/widgets/text/text.0.dart | 4 +- .../text_magnifier/text_magnifier.0.dart | 9 +- .../transitions/align_transition.0.dart | 22 +- .../transitions/animated_builder.0.dart | 22 +- .../transitions/animated_widget.0.dart | 22 +- .../decorated_box_transition.0.dart | 22 +- .../default_text_style_transition.0.dart | 27 +- .../transitions/fade_transition.0.dart | 22 +- .../transitions/listenable_builder.0.dart | 4 +- .../transitions/listenable_builder.1.dart | 8 +- .../transitions/listenable_builder.2.dart | 8 +- .../transitions/listenable_builder.3.dart | 8 +- .../transitions/positioned_transition.0.dart | 36 +-- .../relative_positioned_transition.0.dart | 33 +-- .../transitions/rotation_transition.0.dart | 22 +- .../transitions/scale_transition.0.dart | 22 +- .../transitions/size_transition.0.dart | 22 +- .../transitions/slide_transition.0.dart | 24 +- .../transitions/sliver_fade_transition.0.dart | 24 +- .../tween_animation_builder.0.dart | 23 +- .../undo_history_controller.0.dart | 13 +- .../will_pop_scope/will_pop_scope.0.dart | 23 +- .../action_icon_theme.0_test.dart | 2 +- .../bottom_navigation_bar.2_test.dart | 2 +- .../api/test/material/card/card.1_test.dart | 2 +- .../context_menu_controller.0_test.dart | 2 +- .../editable_text_toolbar_builder.0_test.dart | 2 +- .../editable_text_toolbar_builder.1_test.dart | 2 +- .../editable_text_toolbar_builder.2_test.dart | 2 +- ...ectable_region_toolbar_builder.0_test.dart | 2 +- .../material/dialog/alert_dialog.0_test.dart | 2 +- .../material/dialog/alert_dialog.1_test.dart | 2 +- .../test/material/dialog/dialog.0_test.dart | 4 +- .../material/dialog/show_dialog.0_test.dart | 2 +- .../material/dialog/show_dialog.1_test.dart | 2 +- .../material/dialog/show_dialog.2_test.dart | 2 +- .../test/material/divider/divider.0_test.dart | 2 +- .../test/material/divider/divider.1_test.dart | 2 +- .../divider/vertical_divider.0_test.dart | 2 +- .../divider/vertical_divider.1_test.dart | 2 +- .../floating_action_button.0_test.dart | 2 +- .../floating_action_button.1_test.dart | 2 +- .../floating_action_button.2_test.dart | 2 +- .../floating_action_button.3_test.dart | 2 +- .../material/ink/ink.image_clip.0_test.dart | 2 +- .../material/ink/ink.image_clip.1_test.dart | 2 +- ...ion.floating_label_style_error.0_test.dart | 2 +- ...t_decoration.label_style_error.0_test.dart | 2 +- .../input_decoration.prefix_icon.0_test.dart | 2 +- .../input_decoration.suffix_icon.0_test.dart | 2 +- .../navigation_rail.0_test.dart | 8 +- .../navigation_rail.1_test.dart | 8 +- .../refresh_indicator.0_test.dart | 4 +- .../refresh_indicator.1_test.dart | 2 +- .../text_field/text_field.0_test.dart | 2 +- .../toggle_buttons/toggle_buttons.0_test.dart | 6 +- .../test/material/tooltip/tooltip.0_test.dart | 2 +- .../test/material/tooltip/tooltip.1_test.dart | 2 +- .../test/material/tooltip/tooltip.2_test.dart | 2 +- .../test/material/tooltip/tooltip.3_test.dart | 2 +- .../mouse_cursor/mouse_cursor.0_test.dart | 2 +- .../text_input/text_input_control.0_test.dart | 2 +- .../app/widgets_app.widgets_app.0_test.dart | 2 +- .../widget_binding_observer.0_test.dart | 2 +- .../layout_builder/layout_builder.0_test.dart | 4 +- .../widgets/magnifier/magnifier.0_test.dart | 4 +- .../overlay/overlay_portal.0_test.dart | 8 +- .../list_view.0_test.dart} | 8 +- .../widgets/sliver/sliver_opacity.1_test.dart | 2 +- .../text_magnifier/text_magnifier.0_test.dart | 6 +- .../will_pop_scope/will_pop_scope.0_test.dart | 8 +- .../flutter/lib/src/widgets/scroll_view.dart | 6 +- 480 files changed, 3125 insertions(+), 3816 deletions(-) rename examples/api/lib/widgets/scroll_view/{listview_select.1.dart => list_view.0.dart} (90%) rename examples/api/test/widgets/{scrollview/listview_select_test.1.dart => scroll_view/list_view.0_test.dart} (92%) diff --git a/examples/api/lib/animation/curves/curve2_d.0.dart b/examples/api/lib/animation/curves/curve2_d.0.dart index 74b93a66b9..f2d0d81d62 100644 --- a/examples/api/lib/animation/curves/curve2_d.0.dart +++ b/examples/api/lib/animation/curves/curve2_d.0.dart @@ -2,22 +2,19 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [Curve2D]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [Curve2D]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const Curve2DExampleApp()); - static const String _title = 'Flutter Code Sample'; +class Curve2DExampleApp extends StatelessWidget { + const Curve2DExampleApp({super.key}); @override Widget build(BuildContext context) { return const MaterialApp( - title: _title, - home: MyStatelessWidget(), + home: Curve2DExample(), ); } } @@ -59,8 +56,7 @@ class FollowCurve2D extends StatefulWidget { State createState() => _FollowCurve2DState(); } -class _FollowCurve2DState extends State - with TickerProviderStateMixin { +class _FollowCurve2DState extends State with TickerProviderStateMixin { // The animation controller for this animation. late AnimationController controller; // The animation that will be used to apply the widget's animation curve. @@ -87,8 +83,7 @@ class _FollowCurve2DState extends State @override Widget build(BuildContext context) { // Scale the path values to match the -1.0 to 1.0 domain of the Alignment widget. - final Offset position = - widget.path.transform(animation.value) * 2.0 - const Offset(1.0, 1.0); + final Offset position = widget.path.transform(animation.value) * 2.0 - const Offset(1.0, 1.0); return Align( alignment: Alignment(position.dx, position.dy), child: widget.child, @@ -96,8 +91,8 @@ class _FollowCurve2DState extends State } } -class MyStatelessWidget extends StatelessWidget { - const MyStatelessWidget({super.key}); +class Curve2DExample extends StatelessWidget { + const Curve2DExample({super.key}); @override Widget build(BuildContext context) { diff --git a/examples/api/lib/cupertino/activity_indicator/cupertino_activity_indicator.0.dart b/examples/api/lib/cupertino/activity_indicator/cupertino_activity_indicator.0.dart index 50148793bf..a21e57142c 100644 --- a/examples/api/lib/cupertino/activity_indicator/cupertino_activity_indicator.0.dart +++ b/examples/api/lib/cupertino/activity_indicator/cupertino_activity_indicator.0.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [CupertinoActivityIndicator]. - import 'package:flutter/cupertino.dart'; +/// Flutter code sample for [CupertinoActivityIndicator]. + void main() => runApp(const CupertinoIndicatorApp()); class CupertinoIndicatorApp extends StatelessWidget { @@ -69,7 +69,7 @@ class CupertinoIndicatorExample extends StatelessWidget { ), ], ), - ) + ), ); } } diff --git a/examples/api/lib/cupertino/bottom_tab_bar/cupertino_tab_bar.0.dart b/examples/api/lib/cupertino/bottom_tab_bar/cupertino_tab_bar.0.dart index 582bf25544..4f145eac1e 100644 --- a/examples/api/lib/cupertino/bottom_tab_bar/cupertino_tab_bar.0.dart +++ b/examples/api/lib/cupertino/bottom_tab_bar/cupertino_tab_bar.0.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [CupertinoTabBar]. - import 'package:flutter/cupertino.dart'; +/// Flutter code sample for [CupertinoTabBar]. + void main() => runApp(const CupertinoTabBarApp()); class CupertinoTabBarApp extends StatelessWidget { @@ -30,7 +30,7 @@ class CupertinoTabBarExample extends StatelessWidget { items: const [ BottomNavigationBarItem( icon: Icon(CupertinoIcons.star_fill), - label: 'Favourites', + label: 'Favorites', ), BottomNavigationBarItem( icon: Icon(CupertinoIcons.clock_solid), diff --git a/examples/api/lib/cupertino/button/cupertino_button.0.dart b/examples/api/lib/cupertino/button/cupertino_button.0.dart index e8264b3314..77581f6203 100644 --- a/examples/api/lib/cupertino/button/cupertino_button.0.dart +++ b/examples/api/lib/cupertino/button/cupertino_button.0.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [CupertinoButton]. - import 'package:flutter/cupertino.dart'; +/// Flutter code sample for [CupertinoButton]. + void main() => runApp(const CupertinoButtonApp()); class CupertinoButtonApp extends StatelessWidget { diff --git a/examples/api/lib/cupertino/context_menu/cupertino_context_menu.0.dart b/examples/api/lib/cupertino/context_menu/cupertino_context_menu.0.dart index e989b91180..f20ab23a14 100644 --- a/examples/api/lib/cupertino/context_menu/cupertino_context_menu.0.dart +++ b/examples/api/lib/cupertino/context_menu/cupertino_context_menu.0.dart @@ -2,11 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [CupertinoContextMenu]. - import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +/// Flutter code sample for [CupertinoContextMenu]. + void main() => runApp(const ContextMenuApp()); class ContextMenuApp extends StatelessWidget { diff --git a/examples/api/lib/cupertino/context_menu/cupertino_context_menu.1.dart b/examples/api/lib/cupertino/context_menu/cupertino_context_menu.1.dart index dc75a71c07..b54ab15412 100644 --- a/examples/api/lib/cupertino/context_menu/cupertino_context_menu.1.dart +++ b/examples/api/lib/cupertino/context_menu/cupertino_context_menu.1.dart @@ -2,11 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [CupertinoContextMenu]. - import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +/// Flutter code sample for [CupertinoContextMenu]. + final DecorationTween _tween = DecorationTween( begin: BoxDecoration( color: CupertinoColors.systemYellow, @@ -93,15 +93,12 @@ class ContextMenuExample extends StatelessWidget { child: const Text('Delete'), ), ], - builder:(BuildContext context, Animation animation) { - final Animation boxDecorationAnimation = - _boxDecorationAnimation(animation); + builder: (BuildContext context, Animation animation) { + final Animation boxDecorationAnimation = _boxDecorationAnimation(animation); return Container( decoration: - animation.value < CupertinoContextMenu.animationOpensAt - ? boxDecorationAnimation.value - : null, + animation.value < CupertinoContextMenu.animationOpensAt ? boxDecorationAnimation.value : null, child: Container( decoration: BoxDecoration( color: CupertinoColors.systemYellow, diff --git a/examples/api/lib/cupertino/date_picker/cupertino_date_picker.0.dart b/examples/api/lib/cupertino/date_picker/cupertino_date_picker.0.dart index a682f7508b..bc9acb33e3 100644 --- a/examples/api/lib/cupertino/date_picker/cupertino_date_picker.0.dart +++ b/examples/api/lib/cupertino/date_picker/cupertino_date_picker.0.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [CupertinoDatePicker]. - import 'package:flutter/cupertino.dart'; +/// Flutter code sample for [CupertinoDatePicker]. + void main() => runApp(const DatePickerApp()); class DatePickerApp extends StatelessWidget { @@ -52,7 +52,7 @@ class _DatePickerExampleState extends State { top: false, child: child, ), - ) + ), ); } @@ -92,7 +92,8 @@ class _DatePickerExampleState extends State { // In this example, the date is formatted manually. You can // use the intl package to format the value based on the // user's locale settings. - child: Text('${date.month}-${date.day}-${date.year}', + child: Text( + '${date.month}-${date.day}-${date.year}', style: const TextStyle( fontSize: 22.0, ), @@ -119,7 +120,8 @@ class _DatePickerExampleState extends State { // In this example, the time value is formatted manually. // You can use the intl package to format the value based on // the user's locale settings. - child: Text('${time.hour}:${time.minute}', + child: Text( + '${time.hour}:${time.minute}', style: const TextStyle( fontSize: 22.0, ), @@ -145,7 +147,8 @@ class _DatePickerExampleState extends State { // In this example, the time value is formatted manually. You // can use the intl package to format the value based on the // user's locale settings. - child: Text('${dateTime.month}-${dateTime.day}-${dateTime.year} ${dateTime.hour}:${dateTime.minute}', + child: Text( + '${dateTime.month}-${dateTime.day}-${dateTime.year} ${dateTime.hour}:${dateTime.minute}', style: const TextStyle( fontSize: 22.0, ), diff --git a/examples/api/lib/cupertino/date_picker/cupertino_timer_picker.0.dart b/examples/api/lib/cupertino/date_picker/cupertino_timer_picker.0.dart index e27dbaeb0c..c71a9112fc 100644 --- a/examples/api/lib/cupertino/date_picker/cupertino_timer_picker.0.dart +++ b/examples/api/lib/cupertino/date_picker/cupertino_timer_picker.0.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [CupertinoTimerPicker]. - import 'package:flutter/cupertino.dart'; +/// Flutter code sample for [CupertinoTimerPicker]. + void main() => runApp(const TimerPickerApp()); class TimerPickerApp extends StatelessWidget { @@ -50,7 +50,7 @@ class _TimerPickerExampleState extends State { top: false, child: child, ), - ) + ), ); } @@ -88,7 +88,8 @@ class _TimerPickerExampleState extends State { // In this example, the timer's value is formatted manually. // You can use the intl package to format the value based on // the user's locale settings. - child: Text('$duration', + child: Text( + '$duration', style: const TextStyle( fontSize: 22.0, ), diff --git a/examples/api/lib/cupertino/dialog/cupertino_action_sheet.0.dart b/examples/api/lib/cupertino/dialog/cupertino_action_sheet.0.dart index 5da52bbeaa..f215bd283b 100644 --- a/examples/api/lib/cupertino/dialog/cupertino_action_sheet.0.dart +++ b/examples/api/lib/cupertino/dialog/cupertino_action_sheet.0.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [CupertinoActionSheet]. - import 'package:flutter/cupertino.dart'; +/// Flutter code sample for [CupertinoActionSheet]. + void main() => runApp(const ActionSheetApp()); class ActionSheetApp extends StatelessWidget { diff --git a/examples/api/lib/cupertino/dialog/cupertino_alert_dialog.0.dart b/examples/api/lib/cupertino/dialog/cupertino_alert_dialog.0.dart index 74a3d5842b..185b4e34a7 100644 --- a/examples/api/lib/cupertino/dialog/cupertino_alert_dialog.0.dart +++ b/examples/api/lib/cupertino/dialog/cupertino_alert_dialog.0.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [CupertinoAlertDialog]. - import 'package:flutter/cupertino.dart'; +/// Flutter code sample for [CupertinoAlertDialog]. + void main() => runApp(const AlertDialogApp()); class AlertDialogApp extends StatelessWidget { diff --git a/examples/api/lib/cupertino/form_row/cupertino_form_row.0.dart b/examples/api/lib/cupertino/form_row/cupertino_form_row.0.dart index bbc4197b6b..982d3f0367 100644 --- a/examples/api/lib/cupertino/form_row/cupertino_form_row.0.dart +++ b/examples/api/lib/cupertino/form_row/cupertino_form_row.0.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [CupertinoFormRow]. - import 'package:flutter/cupertino.dart'; +/// Flutter code sample for [CupertinoFormRow]. + void main() => runApp(const CupertinoFormRowApp()); class CupertinoFormRowApp extends StatelessWidget { @@ -65,11 +65,7 @@ class _CupertinoFormRowExampleState extends State { error: Text('Home network unavailable'), child: Row( mainAxisAlignment: MainAxisAlignment.end, - children: [ - Text('Not connected'), - SizedBox(width: 5), - Icon(CupertinoIcons.forward) - ], + children: [Text('Not connected'), SizedBox(width: 5), Icon(CupertinoIcons.forward)], ), ), const CupertinoFormRow( @@ -93,7 +89,7 @@ class _CupertinoFormRowExampleState extends State { children: [ Text('On'), SizedBox(width: 5), - Icon(CupertinoIcons.forward) + Icon(CupertinoIcons.forward), ], ), ), diff --git a/examples/api/lib/cupertino/list_section/list_section_base.0.dart b/examples/api/lib/cupertino/list_section/list_section_base.0.dart index dcdc6a2913..c30d50a201 100644 --- a/examples/api/lib/cupertino/list_section/list_section_base.0.dart +++ b/examples/api/lib/cupertino/list_section/list_section_base.0.dart @@ -2,28 +2,25 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for base [CupertinoListSection] and [CupertinoListTile]. - import 'package:flutter/cupertino.dart'; +/// Flutter code sample for base [CupertinoListSection] and [CupertinoListTile]. + void main() => runApp(const CupertinoListSectionBaseApp()); class CupertinoListSectionBaseApp extends StatelessWidget { const CupertinoListSectionBaseApp({super.key}); - static const String _title = 'Flutter Code Sample'; - @override Widget build(BuildContext context) { return const CupertinoApp( - title: _title, - home: MyStatelessWidget(), + home: ListSectionBaseExample(), ); } } -class MyStatelessWidget extends StatelessWidget { - const MyStatelessWidget({super.key}); +class ListSectionBaseExample extends StatelessWidget { + const ListSectionBaseExample({super.key}); @override Widget build(BuildContext context) { diff --git a/examples/api/lib/cupertino/list_section/list_section_inset.0.dart b/examples/api/lib/cupertino/list_section/list_section_inset.0.dart index 3844514a72..d2d1105c0d 100644 --- a/examples/api/lib/cupertino/list_section/list_section_inset.0.dart +++ b/examples/api/lib/cupertino/list_section/list_section_inset.0.dart @@ -2,28 +2,25 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for inset [CupertinoListSection] and [CupertinoListTile]. - import 'package:flutter/cupertino.dart'; +/// Flutter code sample for inset [CupertinoListSection] and [CupertinoListTile]. + void main() => runApp(const CupertinoListSectionInsetApp()); class CupertinoListSectionInsetApp extends StatelessWidget { const CupertinoListSectionInsetApp({super.key}); - static const String _title = 'Flutter Code Sample'; - @override Widget build(BuildContext context) { return const CupertinoApp( - title: _title, - home: MyStatelessWidget(), + home: ListSectionInsetExample(), ); } } -class MyStatelessWidget extends StatelessWidget { - const MyStatelessWidget({super.key}); +class ListSectionInsetExample extends StatelessWidget { + const ListSectionInsetExample({super.key}); @override Widget build(BuildContext context) { diff --git a/examples/api/lib/cupertino/nav_bar/cupertino_navigation_bar.0.dart b/examples/api/lib/cupertino/nav_bar/cupertino_navigation_bar.0.dart index 4db7493826..97a211cc53 100644 --- a/examples/api/lib/cupertino/nav_bar/cupertino_navigation_bar.0.dart +++ b/examples/api/lib/cupertino/nav_bar/cupertino_navigation_bar.0.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [CupertinoNavigationBar]. - import 'package:flutter/cupertino.dart'; +/// Flutter code sample for [CupertinoNavigationBar]. + void main() => runApp(const NavBarApp()); class NavBarApp extends StatelessWidget { diff --git a/examples/api/lib/cupertino/nav_bar/cupertino_sliver_nav_bar.0.dart b/examples/api/lib/cupertino/nav_bar/cupertino_sliver_nav_bar.0.dart index 9175381a39..bc897e1469 100644 --- a/examples/api/lib/cupertino/nav_bar/cupertino_sliver_nav_bar.0.dart +++ b/examples/api/lib/cupertino/nav_bar/cupertino_sliver_nav_bar.0.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [CupertinoSliverNavigationBar]. - import 'package:flutter/cupertino.dart'; +/// Flutter code sample for [CupertinoSliverNavigationBar]. + void main() => runApp(const SliverNavBarApp()); class SliverNavBarApp extends StatelessWidget { @@ -47,9 +47,14 @@ class SliverNavBarExample extends StatelessWidget { const Text('Drag me up', textAlign: TextAlign.center), CupertinoButton.filled( onPressed: () { - Navigator.push(context, CupertinoPageRoute(builder: (BuildContext context) { - return const NextPage(); - })); + Navigator.push( + context, + CupertinoPageRoute( + builder: (BuildContext context) { + return const NextPage(); + }, + ), + ); }, child: const Text('Go to Next Page'), ), @@ -63,21 +68,19 @@ class SliverNavBarExample extends StatelessWidget { } class NextPage extends StatelessWidget { - const NextPage({ super.key }); + const NextPage({super.key}); @override Widget build(BuildContext context) { final Brightness brightness = CupertinoTheme.brightnessOf(context); - return CupertinoPageScaffold( + return CupertinoPageScaffold( child: CustomScrollView( slivers: [ CupertinoSliverNavigationBar( backgroundColor: CupertinoColors.systemYellow, border: Border( bottom: BorderSide( - color: brightness == Brightness.light - ? CupertinoColors.black - : CupertinoColors.white, + color: brightness == Brightness.light ? CupertinoColors.black : CupertinoColors.white, ), ), // The middle widget is visible in both collapsed and expanded states. diff --git a/examples/api/lib/cupertino/page_scaffold/cupertino_page_scaffold.0.dart b/examples/api/lib/cupertino/page_scaffold/cupertino_page_scaffold.0.dart index c7c4dcd870..41c3c3bfa2 100644 --- a/examples/api/lib/cupertino/page_scaffold/cupertino_page_scaffold.0.dart +++ b/examples/api/lib/cupertino/page_scaffold/cupertino_page_scaffold.0.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [CupertinoPageScaffold]. - import 'package:flutter/cupertino.dart'; +/// Flutter code sample for [CupertinoPageScaffold]. + void main() => runApp(const PageScaffoldApp()); class PageScaffoldApp extends StatelessWidget { diff --git a/examples/api/lib/cupertino/picker/cupertino_picker.0.dart b/examples/api/lib/cupertino/picker/cupertino_picker.0.dart index 73d57cc11d..4ab0a2e1c2 100644 --- a/examples/api/lib/cupertino/picker/cupertino_picker.0.dart +++ b/examples/api/lib/cupertino/picker/cupertino_picker.0.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [CupertinoPicker]. - import 'package:flutter/cupertino.dart'; +/// Flutter code sample for [CupertinoPicker]. + const double _kItemExtent = 32.0; const List _fruitNames = [ 'Apple', diff --git a/examples/api/lib/cupertino/radio/cupertino_radio.0.dart b/examples/api/lib/cupertino/radio/cupertino_radio.0.dart index e30859f7bc..6033b75cb6 100644 --- a/examples/api/lib/cupertino/radio/cupertino_radio.0.dart +++ b/examples/api/lib/cupertino/radio/cupertino_radio.0.dart @@ -11,15 +11,13 @@ void main() => runApp(const CupertinoRadioApp()); class CupertinoRadioApp extends StatelessWidget { const CupertinoRadioApp({super.key}); - static const String _title = 'CuptertinoRadio Example'; - @override Widget build(BuildContext context) { return const CupertinoApp( theme: CupertinoThemeData(brightness: Brightness.light), home: CupertinoPageScaffold( navigationBar: CupertinoNavigationBar( - middle: Text(_title), + middle: Text('CupertinoRadio Example'), ), child: SafeArea( child: CupertinoRadioExample(), diff --git a/examples/api/lib/cupertino/radio/cupertino_radio.toggleable.0.dart b/examples/api/lib/cupertino/radio/cupertino_radio.toggleable.0.dart index 0cc210e945..5a81881168 100644 --- a/examples/api/lib/cupertino/radio/cupertino_radio.toggleable.0.dart +++ b/examples/api/lib/cupertino/radio/cupertino_radio.toggleable.0.dart @@ -11,14 +11,12 @@ void main() => runApp(const CupertinoRadioApp()); class CupertinoRadioApp extends StatelessWidget { const CupertinoRadioApp({super.key}); - static const String _title = 'CuptertinoRadio Toggleable Example'; - @override Widget build(BuildContext context) { return const CupertinoApp( home: CupertinoPageScaffold( navigationBar: CupertinoNavigationBar( - middle: Text(_title), + middle: Text('CupertinoRadio Toggleable Example'), ), child: SafeArea( child: CupertinoRadioExample(), diff --git a/examples/api/lib/cupertino/refresh/cupertino_sliver_refresh_control.0.dart b/examples/api/lib/cupertino/refresh/cupertino_sliver_refresh_control.0.dart index ac5da6acf3..a7a8883b0f 100644 --- a/examples/api/lib/cupertino/refresh/cupertino_sliver_refresh_control.0.dart +++ b/examples/api/lib/cupertino/refresh/cupertino_sliver_refresh_control.0.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [CupertinoSliverRefreshControl]. - import 'package:flutter/cupertino.dart'; +/// Flutter code sample for [CupertinoSliverRefreshControl]. + void main() => runApp(const RefreshControlApp()); class RefreshControlApp extends StatelessWidget { diff --git a/examples/api/lib/cupertino/route/show_cupertino_dialog.0.dart b/examples/api/lib/cupertino/route/show_cupertino_dialog.0.dart index a846728260..06a26577d9 100644 --- a/examples/api/lib/cupertino/route/show_cupertino_dialog.0.dart +++ b/examples/api/lib/cupertino/route/show_cupertino_dialog.0.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [showCupertinoDialog]. - import 'package:flutter/cupertino.dart'; +/// Flutter code sample for [showCupertinoDialog]. + void main() => runApp(const CupertinoDialogApp()); class CupertinoDialogApp extends StatelessWidget { @@ -42,8 +42,7 @@ class CupertinoDialogExample extends StatelessWidget { } @pragma('vm:entry-point') - static Route _dialogBuilder( - BuildContext context, Object? arguments) { + static Route _dialogBuilder(BuildContext context, Object? arguments) { return CupertinoDialogRoute( context: context, builder: (BuildContext context) { diff --git a/examples/api/lib/cupertino/route/show_cupertino_modal_popup.0.dart b/examples/api/lib/cupertino/route/show_cupertino_modal_popup.0.dart index 60cd006d72..188087ec0e 100644 --- a/examples/api/lib/cupertino/route/show_cupertino_modal_popup.0.dart +++ b/examples/api/lib/cupertino/route/show_cupertino_modal_popup.0.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [showCupertinoModalPopup]. - import 'package:flutter/cupertino.dart'; +/// Flutter code sample for [showCupertinoModalPopup]. + void main() => runApp(const ModalPopupApp()); class ModalPopupApp extends StatelessWidget { diff --git a/examples/api/lib/cupertino/scrollbar/cupertino_scrollbar.0.dart b/examples/api/lib/cupertino/scrollbar/cupertino_scrollbar.0.dart index 277a89f2fd..8f5855e087 100644 --- a/examples/api/lib/cupertino/scrollbar/cupertino_scrollbar.0.dart +++ b/examples/api/lib/cupertino/scrollbar/cupertino_scrollbar.0.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [CupertinoScrollbar]. - import 'package:flutter/cupertino.dart'; +/// Flutter code sample for [CupertinoScrollbar]. + void main() => runApp(const ScrollbarApp()); class ScrollbarApp extends StatelessWidget { diff --git a/examples/api/lib/cupertino/scrollbar/cupertino_scrollbar.1.dart b/examples/api/lib/cupertino/scrollbar/cupertino_scrollbar.1.dart index efcfb1eeda..f8b1462e30 100644 --- a/examples/api/lib/cupertino/scrollbar/cupertino_scrollbar.1.dart +++ b/examples/api/lib/cupertino/scrollbar/cupertino_scrollbar.1.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [CupertinoScrollbar]. - import 'package:flutter/cupertino.dart'; +/// Flutter code sample for [CupertinoScrollbar]. + void main() => runApp(const ScrollbarApp()); class ScrollbarApp extends StatelessWidget { diff --git a/examples/api/lib/cupertino/search_field/cupertino_search_field.0.dart b/examples/api/lib/cupertino/search_field/cupertino_search_field.0.dart index c2b2bedbe8..01c956eacd 100644 --- a/examples/api/lib/cupertino/search_field/cupertino_search_field.0.dart +++ b/examples/api/lib/cupertino/search_field/cupertino_search_field.0.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [CupertinoSearchTextField]. - import 'package:flutter/cupertino.dart'; +/// Flutter code sample for [CupertinoSearchTextField]. + void main() => runApp(const SearchTextFieldApp()); class SearchTextFieldApp extends StatelessWidget { diff --git a/examples/api/lib/cupertino/search_field/cupertino_search_field.1.dart b/examples/api/lib/cupertino/search_field/cupertino_search_field.1.dart index 84ae329861..6a106cc5a6 100644 --- a/examples/api/lib/cupertino/search_field/cupertino_search_field.1.dart +++ b/examples/api/lib/cupertino/search_field/cupertino_search_field.1.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [CupertinoSearchTextField]. - import 'package:flutter/cupertino.dart'; +/// Flutter code sample for [CupertinoSearchTextField]. + void main() => runApp(const SearchTextFieldApp()); class SearchTextFieldApp extends StatelessWidget { diff --git a/examples/api/lib/cupertino/segmented_control/cupertino_segmented_control.0.dart b/examples/api/lib/cupertino/segmented_control/cupertino_segmented_control.0.dart index 9eedc9ddda..caad200d02 100644 --- a/examples/api/lib/cupertino/segmented_control/cupertino_segmented_control.0.dart +++ b/examples/api/lib/cupertino/segmented_control/cupertino_segmented_control.0.dart @@ -2,13 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [CupertinoSegmentedControl]. - import 'package:flutter/cupertino.dart'; +/// Flutter code sample for [CupertinoSegmentedControl]. + enum Sky { midnight, viridian, cerulean } -Map skyColors = { +Map skyColors = { Sky.midnight: const Color(0xff191970), Sky.viridian: const Color(0xff40826d), Sky.cerulean: const Color(0xff007ba7), diff --git a/examples/api/lib/cupertino/segmented_control/cupertino_sliding_segmented_control.0.dart b/examples/api/lib/cupertino/segmented_control/cupertino_sliding_segmented_control.0.dart index 7b98ec3e07..64f51a9125 100644 --- a/examples/api/lib/cupertino/segmented_control/cupertino_sliding_segmented_control.0.dart +++ b/examples/api/lib/cupertino/segmented_control/cupertino_sliding_segmented_control.0.dart @@ -2,13 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [CupertinoSlidingSegmentedControl]. - import 'package:flutter/cupertino.dart'; +/// Flutter code sample for [CupertinoSlidingSegmentedControl]. + enum Sky { midnight, viridian, cerulean } -Map skyColors = { +Map skyColors = { Sky.midnight: const Color(0xff191970), Sky.viridian: const Color(0xff40826d), Sky.cerulean: const Color(0xff007ba7), diff --git a/examples/api/lib/cupertino/slider/cupertino_slider.0.dart b/examples/api/lib/cupertino/slider/cupertino_slider.0.dart index 13468066a8..d50faaf932 100644 --- a/examples/api/lib/cupertino/slider/cupertino_slider.0.dart +++ b/examples/api/lib/cupertino/slider/cupertino_slider.0.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [CupertinoSlider]. - import 'package:flutter/cupertino.dart'; +/// Flutter code sample for [CupertinoSlider]. + void main() => runApp(const CupertinoSliderApp()); class CupertinoSliderApp extends StatelessWidget { @@ -28,7 +28,7 @@ class CupertinoSliderExample extends StatefulWidget { } class _CupertinoSliderExampleState extends State { - double _currentSliderValue = 0.0; + double _currentSliderValue = 0.0; String? _sliderStatus; @override @@ -75,8 +75,8 @@ class _CupertinoSliderExampleState extends State { Text( _sliderStatus ?? '', style: CupertinoTheme.of(context).textTheme.textStyle.copyWith( - fontSize: 12, - ), + fontSize: 12, + ), ), ], ), diff --git a/examples/api/lib/cupertino/switch/cupertino_switch.0.dart b/examples/api/lib/cupertino/switch/cupertino_switch.0.dart index 8f5759f16a..9f40bf03d7 100644 --- a/examples/api/lib/cupertino/switch/cupertino_switch.0.dart +++ b/examples/api/lib/cupertino/switch/cupertino_switch.0.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [CupertinoSwitch]. - import 'package:flutter/cupertino.dart'; +/// Flutter code sample for [CupertinoSwitch]. + void main() => runApp(const CupertinoSwitchApp()); class CupertinoSwitchApp extends StatelessWidget { diff --git a/examples/api/lib/cupertino/tab_scaffold/cupertino_tab_controller.0.dart b/examples/api/lib/cupertino/tab_scaffold/cupertino_tab_controller.0.dart index fbc139e455..0c67f83f00 100644 --- a/examples/api/lib/cupertino/tab_scaffold/cupertino_tab_controller.0.dart +++ b/examples/api/lib/cupertino/tab_scaffold/cupertino_tab_controller.0.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [CupertinoTabController]. - import 'package:flutter/cupertino.dart'; +/// Flutter code sample for [CupertinoTabController]. + void main() => runApp(const TabControllerApp()); class TabControllerApp extends StatelessWidget { @@ -64,7 +64,7 @@ class _TabControllerExampleState extends State { child: const Text('Go to first tab'), ), ], - ) + ), ); }, ); diff --git a/examples/api/lib/cupertino/tab_scaffold/cupertino_tab_scaffold.0.dart b/examples/api/lib/cupertino/tab_scaffold/cupertino_tab_scaffold.0.dart index 14be6554f4..e69049c313 100644 --- a/examples/api/lib/cupertino/tab_scaffold/cupertino_tab_scaffold.0.dart +++ b/examples/api/lib/cupertino/tab_scaffold/cupertino_tab_scaffold.0.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [CupertinoTabScaffold]. - import 'package:flutter/cupertino.dart'; +/// Flutter code sample for [CupertinoTabScaffold]. + void main() => runApp(const TabScaffoldApp()); class TabScaffoldApp extends StatelessWidget { diff --git a/examples/api/lib/cupertino/text_field/cupertino_text_field.0.dart b/examples/api/lib/cupertino/text_field/cupertino_text_field.0.dart index f33365a8e6..70ddb14c56 100644 --- a/examples/api/lib/cupertino/text_field/cupertino_text_field.0.dart +++ b/examples/api/lib/cupertino/text_field/cupertino_text_field.0.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [CupertinoTextField]. - import 'package:flutter/cupertino.dart'; +/// Flutter code sample for [CupertinoTextField]. + void main() => runApp(const CupertinoTextFieldApp()); class CupertinoTextFieldApp extends StatelessWidget { @@ -51,7 +51,7 @@ class _CupertinoTextFieldExampleState extends State { child: Center( child: CupertinoTextField( controller: _textController, - ) + ), ), ); } diff --git a/examples/api/lib/cupertino/text_form_field_row/cupertino_text_form_field_row.1.dart b/examples/api/lib/cupertino/text_form_field_row/cupertino_text_form_field_row.1.dart index 73a2b73567..4506b60b77 100644 --- a/examples/api/lib/cupertino/text_form_field_row/cupertino_text_form_field_row.1.dart +++ b/examples/api/lib/cupertino/text_form_field_row/cupertino_text_form_field_row.1.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [CupertinoTextFormFieldRow]. - import 'package:flutter/cupertino.dart'; +/// Flutter code sample for [CupertinoTextFormFieldRow]. + void main() => runApp(const FormSectionApp()); class FormSectionApp extends StatelessWidget { diff --git a/examples/api/lib/gestures/pointer_signal_resolver/pointer_signal_resolver.0.dart b/examples/api/lib/gestures/pointer_signal_resolver/pointer_signal_resolver.0.dart index d2f5a22733..ff1b060d8f 100644 --- a/examples/api/lib/gestures/pointer_signal_resolver/pointer_signal_resolver.0.dart +++ b/examples/api/lib/gestures/pointer_signal_resolver/pointer_signal_resolver.0.dart @@ -2,24 +2,21 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [PointerSignalResolver]. - import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [PointerSignalResolver]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const PointerSignalResolverExampleApp()); - static const String _title = 'Flutter Code Sample'; +class PointerSignalResolverExampleApp extends StatelessWidget { + const PointerSignalResolverExampleApp({super.key}); @override Widget build(BuildContext context) { return const MaterialApp( - title: _title, - home: MyStatefulWidget(), + home: PointerSignalResolverExample(), ); } } @@ -65,8 +62,7 @@ class _ColorChangerState extends State { child: Listener( onPointerSignal: (PointerSignalEvent event) { if (widget.useResolver) { - GestureBinding.instance.pointerSignalResolver.register(event, - (PointerSignalEvent event) { + GestureBinding.instance.pointerSignalResolver.register(event, (PointerSignalEvent event) { rotateColor(); }); } else { @@ -85,14 +81,14 @@ class _ColorChangerState extends State { } } -class MyStatefulWidget extends StatefulWidget { - const MyStatefulWidget({super.key}); +class PointerSignalResolverExample extends StatefulWidget { + const PointerSignalResolverExample({super.key}); @override - State createState() => _MyStatefulWidgetState(); + State createState() => _PointerSignalResolverExampleState(); } -class _MyStatefulWidgetState extends State { +class _PointerSignalResolverExampleState extends State { bool useResolver = false; @override diff --git a/examples/api/lib/material/about/about_list_tile.0.dart b/examples/api/lib/material/about/about_list_tile.0.dart index 7b7e7e9e5c..ca431cb3a0 100644 --- a/examples/api/lib/material/about/about_list_tile.0.dart +++ b/examples/api/lib/material/about/about_list_tile.0.dart @@ -2,28 +2,25 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [AboutListTile]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [AboutListTile]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const AboutListTileExampleApp()); - static const String _title = 'Flutter Code Sample'; +class AboutListTileExampleApp extends StatelessWidget { + const AboutListTileExampleApp({super.key}); @override Widget build(BuildContext context) { return const MaterialApp( - title: _title, - home: MyStatelessWidget(), + home: AboutListTileExample(), ); } } -class MyStatelessWidget extends StatelessWidget { - const MyStatelessWidget({super.key}); +class AboutListTileExample extends StatelessWidget { + const AboutListTileExample({super.key}); @override Widget build(BuildContext context) { @@ -39,9 +36,7 @@ class MyStatelessWidget extends StatelessWidget { text: "Flutter is Google's UI toolkit for building beautiful, " 'natively compiled applications for mobile, web, and desktop ' 'from a single codebase. Learn more about Flutter at '), - TextSpan( - style: textStyle.copyWith(color: theme.colorScheme.primary), - text: 'https://flutter.dev'), + TextSpan(style: textStyle.copyWith(color: theme.colorScheme.primary), text: 'https://flutter.dev'), TextSpan(style: textStyle, text: '.'), ], ), diff --git a/examples/api/lib/material/action_buttons/action_icon_theme.0.dart b/examples/api/lib/material/action_buttons/action_icon_theme.0.dart index 44d28a29a9..653b6ee6a7 100644 --- a/examples/api/lib/material/action_buttons/action_icon_theme.0.dart +++ b/examples/api/lib/material/action_buttons/action_icon_theme.0.dart @@ -2,12 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [ActionIconTheme]. - import 'package:flutter/material.dart'; +/// Flutter code sample for [ActionIconTheme]. + void main() { - runApp(const MyApp()); + runApp(const ActionIconThemeExampleApp()); } class _CustomEndDrawerIcon extends StatelessWidget { @@ -36,13 +36,12 @@ class _CustomDrawerIcon extends StatelessWidget { } } -class MyApp extends StatelessWidget { - const MyApp({super.key}); +class ActionIconThemeExampleApp extends StatelessWidget { + const ActionIconThemeExampleApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( - title: 'Flutter Demo', debugShowCheckedModeBanner: false, theme: ThemeData( useMaterial3: true, diff --git a/examples/api/lib/material/animated_icon/animated_icon.0.dart b/examples/api/lib/material/animated_icon/animated_icon.0.dart index 9e07162526..c63df8b9c9 100644 --- a/examples/api/lib/material/animated_icon/animated_icon.0.dart +++ b/examples/api/lib/material/animated_icon/animated_icon.0.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [AnimatedIcon]. - import 'package:flutter/material.dart'; +/// Flutter code sample for [AnimatedIcon]. + void main() { runApp(const AnimatedIconApp()); } @@ -44,8 +44,9 @@ class _AnimatedIconExampleState extends State with SingleTi controller = AnimationController( vsync: this, duration: const Duration(seconds: 2), - )..forward() - ..repeat(reverse: true); + ) + ..forward() + ..repeat(reverse: true); animation = Tween(begin: 0.0, end: 1.0).animate(controller); } diff --git a/examples/api/lib/material/animated_icon/animated_icons_data.0.dart b/examples/api/lib/material/animated_icon/animated_icons_data.0.dart index 6f068730d5..cc1ae2c6eb 100644 --- a/examples/api/lib/material/animated_icon/animated_icons_data.0.dart +++ b/examples/api/lib/material/animated_icon/animated_icons_data.0.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [AnimatedIcon]. - import 'package:flutter/material.dart'; +/// Flutter code sample for [AnimatedIcon]. + final Map iconsList = { 'add_event': AnimatedIcons.add_event, 'arrow_menu': AnimatedIcons.arrow_menu, @@ -61,8 +61,9 @@ class _AnimatedIconExampleState extends State with SingleTi controller = AnimationController( vsync: this, duration: const Duration(seconds: 2), - )..forward() - ..repeat(reverse: true); + ) + ..forward() + ..repeat(reverse: true); animation = Tween(begin: 0.0, end: 1.0).animate(controller); } diff --git a/examples/api/lib/material/app_bar/app_bar.0.dart b/examples/api/lib/material/app_bar/app_bar.0.dart index e079892297..e64d3b859b 100644 --- a/examples/api/lib/material/app_bar/app_bar.0.dart +++ b/examples/api/lib/material/app_bar/app_bar.0.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [AppBar]. - import 'package:flutter/material.dart'; +/// Flutter code sample for [AppBar]. + void main() => runApp(const AppBarApp()); class AppBarApp extends StatelessWidget { @@ -32,8 +32,7 @@ class AppBarExample extends StatelessWidget { icon: const Icon(Icons.add_alert), tooltip: 'Show Snackbar', onPressed: () { - ScaffoldMessenger.of(context).showSnackBar( - const SnackBar(content: Text('This is a snackbar'))); + ScaffoldMessenger.of(context).showSnackBar(const SnackBar(content: Text('This is a snackbar'))); }, ), IconButton( diff --git a/examples/api/lib/material/app_bar/app_bar.1.dart b/examples/api/lib/material/app_bar/app_bar.1.dart index 2f4eb93cba..387ad18b7d 100644 --- a/examples/api/lib/material/app_bar/app_bar.1.dart +++ b/examples/api/lib/material/app_bar/app_bar.1.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [AppBar]. - import 'package:flutter/material.dart'; +/// Flutter code sample for [AppBar]. + final List _items = List.generate(51, (int index) => index); void main() => runApp(const AppBarApp()); diff --git a/examples/api/lib/material/app_bar/app_bar.2.dart b/examples/api/lib/material/app_bar/app_bar.2.dart index 23632b4792..1e0823ce6b 100644 --- a/examples/api/lib/material/app_bar/app_bar.2.dart +++ b/examples/api/lib/material/app_bar/app_bar.2.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [AppBar]. - import 'package:flutter/material.dart'; +/// Flutter code sample for [AppBar]. + void main() => runApp(const AppBarApp()); class AppBarApp extends StatelessWidget { diff --git a/examples/api/lib/material/app_bar/app_bar.3.dart b/examples/api/lib/material/app_bar/app_bar.3.dart index e8624f1cc2..4f7e8f5290 100644 --- a/examples/api/lib/material/app_bar/app_bar.3.dart +++ b/examples/api/lib/material/app_bar/app_bar.3.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [AppBar]. - import 'package:flutter/material.dart'; +/// Flutter code sample for [AppBar]. + List titles = [ 'Cloud', 'Beach', @@ -80,7 +80,7 @@ class AppBarExample extends StatelessWidget { ListView.builder( itemCount: 25, itemBuilder: (BuildContext context, int index) { - return ListTile( + return ListTile( tileColor: index.isOdd ? oddItemColor : evenItemColor, title: Text('${titles[0]} $index'), ); @@ -89,7 +89,7 @@ class AppBarExample extends StatelessWidget { ListView.builder( itemCount: 25, itemBuilder: (BuildContext context, int index) { - return ListTile( + return ListTile( tileColor: index.isOdd ? oddItemColor : evenItemColor, title: Text('${titles[1]} $index'), ); @@ -98,7 +98,7 @@ class AppBarExample extends StatelessWidget { ListView.builder( itemCount: 25, itemBuilder: (BuildContext context, int index) { - return ListTile( + return ListTile( tileColor: index.isOdd ? oddItemColor : evenItemColor, title: Text('${titles[2]} $index'), ); diff --git a/examples/api/lib/material/app_bar/sliver_app_bar.1.dart b/examples/api/lib/material/app_bar/sliver_app_bar.1.dart index 1c8266efed..9d7ad116fc 100644 --- a/examples/api/lib/material/app_bar/sliver_app_bar.1.dart +++ b/examples/api/lib/material/app_bar/sliver_app_bar.1.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [SliverAppBar]. - import 'package:flutter/material.dart'; +/// Flutter code sample for [SliverAppBar]. + void main() => runApp(const AppBarApp()); class AppBarApp extends StatelessWidget { diff --git a/examples/api/lib/material/app_bar/sliver_app_bar.2.dart b/examples/api/lib/material/app_bar/sliver_app_bar.2.dart index a5108d616a..2185659dbf 100644 --- a/examples/api/lib/material/app_bar/sliver_app_bar.2.dart +++ b/examples/api/lib/material/app_bar/sliver_app_bar.2.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [SliverAppBar.medium]. - import 'package:flutter/material.dart'; +/// Flutter code sample for [SliverAppBar.medium]. + void main() { runApp(const AppBarMediumApp()); } @@ -18,7 +18,7 @@ class AppBarMediumApp extends StatelessWidget { return MaterialApp( theme: ThemeData( useMaterial3: true, - colorSchemeSeed: const Color(0xff6750A4) + colorSchemeSeed: const Color(0xff6750A4), ), home: Material( child: CustomScrollView( diff --git a/examples/api/lib/material/app_bar/sliver_app_bar.3.dart b/examples/api/lib/material/app_bar/sliver_app_bar.3.dart index fec0a738ae..30e2602021 100644 --- a/examples/api/lib/material/app_bar/sliver_app_bar.3.dart +++ b/examples/api/lib/material/app_bar/sliver_app_bar.3.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [SliverAppBar.large]. - import 'package:flutter/material.dart'; +/// Flutter code sample for [SliverAppBar.large]. + void main() { runApp(const AppBarLargeApp()); } @@ -18,7 +18,7 @@ class AppBarLargeApp extends StatelessWidget { return MaterialApp( theme: ThemeData( useMaterial3: true, - colorSchemeSeed: const Color(0xff6750A4) + colorSchemeSeed: const Color(0xff6750A4), ), home: Material( child: CustomScrollView( diff --git a/examples/api/lib/material/autocomplete/autocomplete.0.dart b/examples/api/lib/material/autocomplete/autocomplete.0.dart index 3c17423dc2..21478cabb3 100644 --- a/examples/api/lib/material/autocomplete/autocomplete.0.dart +++ b/examples/api/lib/material/autocomplete/autocomplete.0.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [Autocomplete]. - import 'package:flutter/material.dart'; +/// Flutter code sample for [Autocomplete]. + void main() => runApp(const AutocompleteExampleApp()); class AutocompleteExampleApp extends StatelessWidget { diff --git a/examples/api/lib/material/autocomplete/autocomplete.1.dart b/examples/api/lib/material/autocomplete/autocomplete.1.dart index 09700bf7d4..7e3798e558 100644 --- a/examples/api/lib/material/autocomplete/autocomplete.1.dart +++ b/examples/api/lib/material/autocomplete/autocomplete.1.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [Autocomplete]. - import 'package:flutter/material.dart'; +/// Flutter code sample for [Autocomplete]. + void main() => runApp(const AutocompleteExampleApp()); class AutocompleteExampleApp extends StatelessWidget { @@ -73,9 +73,7 @@ class AutocompleteBasicUserExample extends StatelessWidget { return const Iterable.empty(); } return _userOptions.where((User option) { - return option - .toString() - .contains(textEditingValue.text.toLowerCase()); + return option.toString().contains(textEditingValue.text.toLowerCase()); }); }, onSelected: (User selection) { diff --git a/examples/api/lib/material/banner/material_banner.0.dart b/examples/api/lib/material/banner/material_banner.0.dart index 5569c04cd7..fc3791f89b 100644 --- a/examples/api/lib/material/banner/material_banner.0.dart +++ b/examples/api/lib/material/banner/material_banner.0.dart @@ -2,28 +2,25 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [MaterialBanner]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [MaterialBanner]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const MaterialBannerExampleApp()); - static const String _title = 'Flutter Code Sample'; +class MaterialBannerExampleApp extends StatelessWidget { + const MaterialBannerExampleApp({super.key}); @override Widget build(BuildContext context) { return const MaterialApp( - title: _title, - home: MyStatelessWidget(), + home: MaterialBannerExample(), ); } } -class MyStatelessWidget extends StatelessWidget { - const MyStatelessWidget({super.key}); +class MaterialBannerExample extends StatelessWidget { + const MaterialBannerExample({super.key}); @override Widget build(BuildContext context) { diff --git a/examples/api/lib/material/banner/material_banner.1.dart b/examples/api/lib/material/banner/material_banner.1.dart index 1811a30a68..ddba00b826 100644 --- a/examples/api/lib/material/banner/material_banner.1.dart +++ b/examples/api/lib/material/banner/material_banner.1.dart @@ -2,28 +2,25 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [MaterialBanner]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [MaterialBanner]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const MaterialBannerExampleApp()); - static const String _title = 'Flutter Code Sample'; +class MaterialBannerExampleApp extends StatelessWidget { + const MaterialBannerExampleApp({super.key}); @override Widget build(BuildContext context) { return const MaterialApp( - title: _title, - home: MyStatelessWidget(), + home: MaterialBannerExample(), ); } } -class MyStatelessWidget extends StatelessWidget { - const MyStatelessWidget({super.key}); +class MaterialBannerExample extends StatelessWidget { + const MaterialBannerExample({super.key}); @override Widget build(BuildContext context) { diff --git a/examples/api/lib/material/bottom_app_bar/bottom_app_bar.1.dart b/examples/api/lib/material/bottom_app_bar/bottom_app_bar.1.dart index 2e629db549..a35c580131 100644 --- a/examples/api/lib/material/bottom_app_bar/bottom_app_bar.1.dart +++ b/examples/api/lib/material/bottom_app_bar/bottom_app_bar.1.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [BottomAppBar]. - import 'package:flutter/material.dart'; +/// Flutter code sample for [BottomAppBar]. + void main() { runApp(const BottomAppBarDemo()); } @@ -20,8 +20,7 @@ class BottomAppBarDemo extends StatefulWidget { class _BottomAppBarDemoState extends State { bool _showFab = true; bool _showNotch = true; - FloatingActionButtonLocation _fabLocation = - FloatingActionButtonLocation.endDocked; + FloatingActionButtonLocation _fabLocation = FloatingActionButtonLocation.endDocked; void _onShowNotchChanged(bool value) { setState(() { @@ -120,8 +119,7 @@ class _DemoBottomAppBar extends StatelessWidget { final FloatingActionButtonLocation fabLocation; final NotchedShape? shape; - static final List centerLocations = - [ + static final List centerLocations = [ FloatingActionButtonLocation.centerDocked, FloatingActionButtonLocation.centerFloat, ]; diff --git a/examples/api/lib/material/bottom_app_bar/bottom_app_bar.2.dart b/examples/api/lib/material/bottom_app_bar/bottom_app_bar.2.dart index 2e48077bec..1aa6b981b8 100644 --- a/examples/api/lib/material/bottom_app_bar/bottom_app_bar.2.dart +++ b/examples/api/lib/material/bottom_app_bar/bottom_app_bar.2.dart @@ -2,11 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for BottomAppBar with Material 3 - import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; +/// Flutter code sample for [BottomAppBar] with Material 3. + void main() { runApp(const BottomAppBarDemo()); } @@ -37,9 +37,8 @@ class _BottomAppBarDemoState extends State { bool _isElevated = true; bool _isVisible = true; - FloatingActionButtonLocation get _fabLocation => _isVisible - ? FloatingActionButtonLocation.endContained - : FloatingActionButtonLocation.endFloat; + FloatingActionButtonLocation get _fabLocation => + _isVisible ? FloatingActionButtonLocation.endContained : FloatingActionButtonLocation.endFloat; void _listen() { final ScrollDirection direction = _controller.position.userScrollDirection; diff --git a/examples/api/lib/material/bottom_navigation_bar/bottom_navigation_bar.0.dart b/examples/api/lib/material/bottom_navigation_bar/bottom_navigation_bar.0.dart index 58e6d5e84d..4bdf47c2e2 100644 --- a/examples/api/lib/material/bottom_navigation_bar/bottom_navigation_bar.0.dart +++ b/examples/api/lib/material/bottom_navigation_bar/bottom_navigation_bar.0.dart @@ -2,37 +2,33 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [BottomNavigationBar]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [BottomNavigationBar]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const BottomNavigationBarExampleApp()); - static const String _title = 'Flutter Code Sample'; +class BottomNavigationBarExampleApp extends StatelessWidget { + const BottomNavigationBarExampleApp({super.key}); @override Widget build(BuildContext context) { return const MaterialApp( - title: _title, - home: MyStatefulWidget(), + home: BottomNavigationBarExample(), ); } } -class MyStatefulWidget extends StatefulWidget { - const MyStatefulWidget({super.key}); +class BottomNavigationBarExample extends StatefulWidget { + const BottomNavigationBarExample({super.key}); @override - State createState() => _MyStatefulWidgetState(); + State createState() => _BottomNavigationBarExampleState(); } -class _MyStatefulWidgetState extends State { +class _BottomNavigationBarExampleState extends State { int _selectedIndex = 0; - static const TextStyle optionStyle = - TextStyle(fontSize: 30, fontWeight: FontWeight.bold); + static const TextStyle optionStyle = TextStyle(fontSize: 30, fontWeight: FontWeight.bold); static const List _widgetOptions = [ Text( 'Index 0: Home', diff --git a/examples/api/lib/material/bottom_navigation_bar/bottom_navigation_bar.1.dart b/examples/api/lib/material/bottom_navigation_bar/bottom_navigation_bar.1.dart index 1eb7b0df5e..f60330daed 100644 --- a/examples/api/lib/material/bottom_navigation_bar/bottom_navigation_bar.1.dart +++ b/examples/api/lib/material/bottom_navigation_bar/bottom_navigation_bar.1.dart @@ -2,37 +2,33 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [BottomNavigationBar]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [BottomNavigationBar]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const BottomNavigationBarExampleApp()); - static const String _title = 'Flutter Code Sample'; +class BottomNavigationBarExampleApp extends StatelessWidget { + const BottomNavigationBarExampleApp({super.key}); @override Widget build(BuildContext context) { return const MaterialApp( - title: _title, - home: MyStatefulWidget(), + home: BottomNavigationBarExample(), ); } } -class MyStatefulWidget extends StatefulWidget { - const MyStatefulWidget({super.key}); +class BottomNavigationBarExample extends StatefulWidget { + const BottomNavigationBarExample({super.key}); @override - State createState() => _MyStatefulWidgetState(); + State createState() => _BottomNavigationBarExampleState(); } -class _MyStatefulWidgetState extends State { +class _BottomNavigationBarExampleState extends State { int _selectedIndex = 0; - static const TextStyle optionStyle = - TextStyle(fontSize: 30, fontWeight: FontWeight.bold); + static const TextStyle optionStyle = TextStyle(fontSize: 30, fontWeight: FontWeight.bold); static const List _widgetOptions = [ Text( 'Index 0: Home', diff --git a/examples/api/lib/material/bottom_navigation_bar/bottom_navigation_bar.2.dart b/examples/api/lib/material/bottom_navigation_bar/bottom_navigation_bar.2.dart index 9fc5fa2b37..560406e34c 100644 --- a/examples/api/lib/material/bottom_navigation_bar/bottom_navigation_bar.2.dart +++ b/examples/api/lib/material/bottom_navigation_bar/bottom_navigation_bar.2.dart @@ -2,34 +2,31 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [BottomNavigationBar]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [BottomNavigationBar]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const BottomNavigationBarExampleApp()); - static const String _title = 'Flutter Code Sample'; +class BottomNavigationBarExampleApp extends StatelessWidget { + const BottomNavigationBarExampleApp({super.key}); @override Widget build(BuildContext context) { return const MaterialApp( - title: _title, - home: MyStatefulWidget(), + home: BottomNavigationBarExample(), ); } } -class MyStatefulWidget extends StatefulWidget { - const MyStatefulWidget({super.key}); +class BottomNavigationBarExample extends StatefulWidget { + const BottomNavigationBarExample({super.key}); @override - State createState() => _MyStatefulWidgetState(); + State createState() => _BottomNavigationBarExampleState(); } -class _MyStatefulWidgetState extends State { +class _BottomNavigationBarExampleState extends State { int _selectedIndex = 0; final ScrollController _homeController = ScrollController(); diff --git a/examples/api/lib/material/bottom_sheet/show_modal_bottom_sheet.0.dart b/examples/api/lib/material/bottom_sheet/show_modal_bottom_sheet.0.dart index 9508152c76..fef506c1d6 100644 --- a/examples/api/lib/material/bottom_sheet/show_modal_bottom_sheet.0.dart +++ b/examples/api/lib/material/bottom_sheet/show_modal_bottom_sheet.0.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [showModalBottomSheet]. - import 'package:flutter/material.dart'; +/// Flutter code sample for [showModalBottomSheet]. + void main() => runApp(const BottomSheetApp()); class BottomSheetApp extends StatelessWidget { diff --git a/examples/api/lib/material/bottom_sheet/show_modal_bottom_sheet.1.dart b/examples/api/lib/material/bottom_sheet/show_modal_bottom_sheet.1.dart index eb40ff768e..096adc8d79 100644 --- a/examples/api/lib/material/bottom_sheet/show_modal_bottom_sheet.1.dart +++ b/examples/api/lib/material/bottom_sheet/show_modal_bottom_sheet.1.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [showModalBottomSheet]. - import 'package:flutter/material.dart'; +/// Flutter code sample for [showModalBottomSheet]. + void main() => runApp(const BottomSheetApp()); class BottomSheetApp extends StatelessWidget { diff --git a/examples/api/lib/material/button_style/button_style.0.dart b/examples/api/lib/material/button_style/button_style.0.dart index 0cec279c17..03a49430c4 100644 --- a/examples/api/lib/material/button_style/button_style.0.dart +++ b/examples/api/lib/material/button_style/button_style.0.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [ElevatedButton]. - import 'package:flutter/material.dart'; +/// Flutter code sample for [ElevatedButton]. + void main() { runApp(const ButtonApp()); } @@ -45,7 +45,7 @@ class ButtonTypesExample extends StatelessWidget { } class ButtonTypesGroup extends StatelessWidget { - const ButtonTypesGroup({ super.key, required this.enabled }); + const ButtonTypesGroup({super.key, required this.enabled}); final bool enabled; diff --git a/examples/api/lib/material/card/card.0.dart b/examples/api/lib/material/card/card.0.dart index fcfaf6ef31..1b90628c08 100644 --- a/examples/api/lib/material/card/card.0.dart +++ b/examples/api/lib/material/card/card.0.dart @@ -2,31 +2,28 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [Card]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [Card]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const CardExampleApp()); - static const String _title = 'Flutter Code Sample'; +class CardExampleApp extends StatelessWidget { + const CardExampleApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( - title: _title, home: Scaffold( - appBar: AppBar(title: const Text(_title)), - body: const MyStatelessWidget(), + appBar: AppBar(title: const Text('Card Sample')), + body: const CardExample(), ), ); } } -class MyStatelessWidget extends StatelessWidget { - const MyStatelessWidget({super.key}); +class CardExample extends StatelessWidget { + const CardExample({super.key}); @override Widget build(BuildContext context) { diff --git a/examples/api/lib/material/card/card.1.dart b/examples/api/lib/material/card/card.1.dart index 931ada357c..3be967d815 100644 --- a/examples/api/lib/material/card/card.1.dart +++ b/examples/api/lib/material/card/card.1.dart @@ -2,31 +2,28 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [Card]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [Card]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const CardExampleApp()); - static const String _title = 'Flutter Code Sample'; +class CardExampleApp extends StatelessWidget { + const CardExampleApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( - title: _title, home: Scaffold( - appBar: AppBar(title: const Text(_title)), - body: const MyStatelessWidget(), + appBar: AppBar(title: const Text('Card Sample')), + body: const CardExample(), ), ); } } -class MyStatelessWidget extends StatelessWidget { - const MyStatelessWidget({super.key}); +class CardExample extends StatelessWidget { + const CardExample({super.key}); @override Widget build(BuildContext context) { diff --git a/examples/api/lib/material/card/card.2.dart b/examples/api/lib/material/card/card.2.dart index 215398c73f..5334df907f 100644 --- a/examples/api/lib/material/card/card.2.dart +++ b/examples/api/lib/material/card/card.2.dart @@ -2,11 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [Card]. - import 'package:flutter/material.dart'; -void main() { runApp(const CardExamplesApp()); } +/// Flutter code sample for [Card]. + +void main() { + runApp(const CardExamplesApp()); +} class CardExamplesApp extends StatelessWidget { const CardExamplesApp({super.key}); @@ -38,7 +40,7 @@ class CardExamplesApp extends StatelessWidget { /// /// https://m3.material.io/components/cards/specs#a012d40d-7a5c-4b07-8740-491dec79d58b class ElevatedCardExample extends StatelessWidget { - const ElevatedCardExample({ super.key }); + const ElevatedCardExample({super.key}); @override Widget build(BuildContext context) { @@ -61,7 +63,7 @@ class ElevatedCardExample extends StatelessWidget { /// /// https://m3.material.io/components/cards/specs#0f55bf62-edf2-4619-b00d-b9ed462f2c5a class FilledCardExample extends StatelessWidget { - const FilledCardExample({ super.key }); + const FilledCardExample({super.key}); @override Widget build(BuildContext context) { @@ -86,7 +88,7 @@ class FilledCardExample extends StatelessWidget { /// /// https://m3.material.io/components/cards/specs#0f55bf62-edf2-4619-b00d-b9ed462f2c5a class OutlinedCardExample extends StatelessWidget { - const OutlinedCardExample({ super.key }); + const OutlinedCardExample({super.key}); @override Widget build(BuildContext context) { diff --git a/examples/api/lib/material/checkbox/checkbox.0.dart b/examples/api/lib/material/checkbox/checkbox.0.dart index 8597947130..074e5adcda 100644 --- a/examples/api/lib/material/checkbox/checkbox.0.dart +++ b/examples/api/lib/material/checkbox/checkbox.0.dart @@ -2,39 +2,36 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [Checkbox]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [Checkbox]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const CheckboxExampleApp()); - static const String _title = 'Flutter Code Sample'; +class CheckboxExampleApp extends StatelessWidget { + const CheckboxExampleApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( - title: _title, home: Scaffold( - appBar: AppBar(title: const Text(_title)), + appBar: AppBar(title: const Text('Checkbox Sample')), body: const Center( - child: MyStatefulWidget(), + child: CheckboxExample(), ), ), ); } } -class MyStatefulWidget extends StatefulWidget { - const MyStatefulWidget({super.key}); +class CheckboxExample extends StatefulWidget { + const CheckboxExample({super.key}); @override - State createState() => _MyStatefulWidgetState(); + State createState() => _CheckboxExampleState(); } -class _MyStatefulWidgetState extends State { +class _CheckboxExampleState extends State { bool isChecked = false; @override diff --git a/examples/api/lib/material/checkbox/checkbox.1.dart b/examples/api/lib/material/checkbox/checkbox.1.dart index 77c83adbf3..9593bacf61 100644 --- a/examples/api/lib/material/checkbox/checkbox.1.dart +++ b/examples/api/lib/material/checkbox/checkbox.1.dart @@ -2,40 +2,38 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for M3 Checkbox with error state - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for M3 [Checkbox] with error state. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const CheckboxExampleApp()); - static const String _title = 'Flutter Code Sample'; +class CheckboxExampleApp extends StatelessWidget { + const CheckboxExampleApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( theme: ThemeData(useMaterial3: true, colorSchemeSeed: const Color(0xff6750a4)), - title: _title, + title: 'Checkbox Sample', home: Scaffold( - appBar: AppBar(title: const Text(_title)), + appBar: AppBar(title: const Text('Checkbox Sample')), body: const Center( - child: MyStatefulWidget(), + child: CheckboxExample(), ), ), ); } } -class MyStatefulWidget extends StatefulWidget { - const MyStatefulWidget({super.key}); +class CheckboxExample extends StatefulWidget { + const CheckboxExample({super.key}); @override - State createState() => _MyStatefulWidgetState(); + State createState() => _CheckboxExampleState(); } -class _MyStatefulWidgetState extends State { +class _CheckboxExampleState extends State { bool? isChecked = true; @override diff --git a/examples/api/lib/material/checkbox_list_tile/checkbox_list_tile.0.dart b/examples/api/lib/material/checkbox_list_tile/checkbox_list_tile.0.dart index 47c3241831..bf67c15b94 100644 --- a/examples/api/lib/material/checkbox_list_tile/checkbox_list_tile.0.dart +++ b/examples/api/lib/material/checkbox_list_tile/checkbox_list_tile.0.dart @@ -2,11 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [CheckboxListTile]. - import 'package:flutter/material.dart'; import 'package:flutter/scheduler.dart' show timeDilation; +/// Flutter code sample for [CheckboxListTile]. + void main() => runApp(const CheckboxListTileApp()); class CheckboxListTileApp extends StatelessWidget { diff --git a/examples/api/lib/material/checkbox_list_tile/checkbox_list_tile.1.dart b/examples/api/lib/material/checkbox_list_tile/checkbox_list_tile.1.dart index a97d57a3f4..8d3808f4e2 100644 --- a/examples/api/lib/material/checkbox_list_tile/checkbox_list_tile.1.dart +++ b/examples/api/lib/material/checkbox_list_tile/checkbox_list_tile.1.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [CheckboxListTile]. - import 'package:flutter/material.dart'; +/// Flutter code sample for [CheckboxListTile]. + void main() => runApp(const CheckboxListTileApp()); class CheckboxListTileApp extends StatelessWidget { @@ -57,7 +57,8 @@ class _CheckboxListTileExampleState extends State { }); }, title: const Text('Headline'), - subtitle: const Text('Longer supporting text to demonstrate how the text wraps and the checkbox is centered vertically with the text.'), + subtitle: const Text( + 'Longer supporting text to demonstrate how the text wraps and the checkbox is centered vertically with the text.'), ), const Divider(height: 0), CheckboxListTile( @@ -68,7 +69,8 @@ class _CheckboxListTileExampleState extends State { }); }, title: const Text('Headline'), - subtitle: const Text("Longer supporting text to demonstrate how the text wraps and how setting 'CheckboxListTile.isThreeLine = true' aligns the checkbox to the top vertically with the text."), + subtitle: const Text( + "Longer supporting text to demonstrate how the text wraps and how setting 'CheckboxListTile.isThreeLine = true' aligns the checkbox to the top vertically with the text."), isThreeLine: true, ), const Divider(height: 0), diff --git a/examples/api/lib/material/checkbox_list_tile/custom_labeled_checkbox.0.dart b/examples/api/lib/material/checkbox_list_tile/custom_labeled_checkbox.0.dart index 891d9181f3..50705bc9b0 100644 --- a/examples/api/lib/material/checkbox_list_tile/custom_labeled_checkbox.0.dart +++ b/examples/api/lib/material/checkbox_list_tile/custom_labeled_checkbox.0.dart @@ -2,12 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for custom labeled checkbox. - import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; +/// Flutter code sample for custom labeled checkbox. + void main() => runApp(const LabeledCheckboxApp()); class LabeledCheckboxApp extends StatelessWidget { diff --git a/examples/api/lib/material/checkbox_list_tile/custom_labeled_checkbox.1.dart b/examples/api/lib/material/checkbox_list_tile/custom_labeled_checkbox.1.dart index 181e485173..f1866cf09c 100644 --- a/examples/api/lib/material/checkbox_list_tile/custom_labeled_checkbox.1.dart +++ b/examples/api/lib/material/checkbox_list_tile/custom_labeled_checkbox.1.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for custom labeled checkbox. - import 'package:flutter/material.dart'; +/// Flutter code sample for custom labeled checkbox. + void main() => runApp(const LabeledCheckboxApp()); class LabeledCheckboxApp extends StatelessWidget { diff --git a/examples/api/lib/material/chip/deletable_chip_attributes.on_deleted.0.dart b/examples/api/lib/material/chip/deletable_chip_attributes.on_deleted.0.dart index 01b24a09ec..6c91b2de78 100644 --- a/examples/api/lib/material/chip/deletable_chip_attributes.on_deleted.0.dart +++ b/examples/api/lib/material/chip/deletable_chip_attributes.on_deleted.0.dart @@ -2,25 +2,22 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [DeletableChipAttributes.onDeleted]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [DeletableChipAttributes.onDeleted]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const OnDeletedExampleApp()); - static const String _title = 'Flutter Code Sample'; +class OnDeletedExampleApp extends StatelessWidget { + const OnDeletedExampleApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( - title: _title, home: Scaffold( - appBar: AppBar(title: const Text(_title)), + appBar: AppBar(title: const Text('DeletableChipAttributes.onDeleted Sample')), body: const Center( - child: MyStatefulWidget(), + child: OnDeletedExample(), ), ), ); @@ -75,14 +72,14 @@ class CastListState extends State { } } -class MyStatefulWidget extends StatefulWidget { - const MyStatefulWidget({super.key}); +class OnDeletedExample extends StatefulWidget { + const OnDeletedExample({super.key}); @override - State createState() => _MyStatefulWidgetState(); + State createState() => _OnDeletedExampleState(); } -class _MyStatefulWidgetState extends State { +class _OnDeletedExampleState extends State { @override Widget build(BuildContext context) { return const CastList(); diff --git a/examples/api/lib/material/choice_chip/choice_chip.0.dart b/examples/api/lib/material/choice_chip/choice_chip.0.dart index a7b444217d..097c198380 100644 --- a/examples/api/lib/material/choice_chip/choice_chip.0.dart +++ b/examples/api/lib/material/choice_chip/choice_chip.0.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [ActionChoice]. - import 'package:flutter/material.dart'; +/// Flutter code sample for [ActionChoice]. + void main() => runApp(const ChipApp()); class ChipApp extends StatelessWidget { diff --git a/examples/api/lib/material/color_scheme/dynamic_content_color.0.dart b/examples/api/lib/material/color_scheme/dynamic_content_color.0.dart index 62ff25ce08..94a0ce0e98 100644 --- a/examples/api/lib/material/color_scheme/dynamic_content_color.0.dart +++ b/examples/api/lib/material/color_scheme/dynamic_content_color.0.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [ColorScheme.fromImageProvider] with content-based dynamic color. - import 'package:flutter/material.dart'; +/// Flutter code sample for [ColorScheme.fromImageProvider] with content-based dynamic color. + const Widget divider = SizedBox(height: 10); const double narrowScreenWidthThreshold = 400; const double imageSize = 150; @@ -16,12 +16,18 @@ class DynamicColorExample extends StatefulWidget { DynamicColorExample({super.key}); final List images = [ - const NetworkImage('https://flutter.github.io/assets-for-api-docs/assets/material/content_based_color_scheme_1.png'), - const NetworkImage('https://flutter.github.io/assets-for-api-docs/assets/material/content_based_color_scheme_2.png'), - const NetworkImage('https://flutter.github.io/assets-for-api-docs/assets/material/content_based_color_scheme_3.png'), - const NetworkImage('https://flutter.github.io/assets-for-api-docs/assets/material/content_based_color_scheme_4.png'), - const NetworkImage('https://flutter.github.io/assets-for-api-docs/assets/material/content_based_color_scheme_5.png'), - const NetworkImage('https://flutter.github.io/assets-for-api-docs/assets/material/content_based_color_scheme_6.png'), + const NetworkImage( + 'https://flutter.github.io/assets-for-api-docs/assets/material/content_based_color_scheme_1.png'), + const NetworkImage( + 'https://flutter.github.io/assets-for-api-docs/assets/material/content_based_color_scheme_2.png'), + const NetworkImage( + 'https://flutter.github.io/assets-for-api-docs/assets/material/content_based_color_scheme_3.png'), + const NetworkImage( + 'https://flutter.github.io/assets-for-api-docs/assets/material/content_based_color_scheme_4.png'), + const NetworkImage( + 'https://flutter.github.io/assets-for-api-docs/assets/material/content_based_color_scheme_5.png'), + const NetworkImage( + 'https://flutter.github.io/assets-for-api-docs/assets/material/content_based_color_scheme_6.png'), ]; @override @@ -69,9 +75,7 @@ class _DynamicColorExampleState extends State { padding: const EdgeInsets.symmetric(vertical: 15), child: Text( brightness, - style: TextStyle( - fontWeight: FontWeight.bold, - color: colorScheme.onSecondaryContainer), + style: TextStyle(fontWeight: FontWeight.bold, color: colorScheme.onSecondaryContainer), ), ); } @@ -84,7 +88,6 @@ class _DynamicColorExampleState extends State { } return MaterialApp( - title: 'Content Based Dynamic Color', theme: ThemeData(useMaterial3: true, colorScheme: colorScheme), debugShowCheckedModeBanner: false, home: Builder( @@ -125,21 +128,17 @@ class _DynamicColorExampleState extends State { Expanded( child: ColoredBox( color: colorScheme.background, - child: LayoutBuilder(builder: (BuildContext context, - BoxConstraints constraints) { - if (constraints.maxWidth < - narrowScreenWidthThreshold) { + child: LayoutBuilder(builder: (BuildContext context, BoxConstraints constraints) { + if (constraints.maxWidth < narrowScreenWidthThreshold) { return SingleChildScrollView( child: Column( children: [ divider, - schemeLabel( - 'Light ColorScheme', colorScheme), + schemeLabel('Light ColorScheme', colorScheme), schemeView(lightTheme), divider, divider, - schemeLabel( - 'Dark ColorScheme', colorScheme), + schemeLabel('Dark ColorScheme', colorScheme), schemeView(darkTheme), ], ), @@ -155,9 +154,7 @@ class _DynamicColorExampleState extends State { Expanded( child: Column( children: [ - schemeLabel( - 'Light ColorScheme', - colorScheme), + schemeLabel('Light ColorScheme', colorScheme), schemeView(lightTheme), ], ), @@ -165,9 +162,7 @@ class _DynamicColorExampleState extends State { Expanded( child: Column( children: [ - schemeLabel( - 'Dark ColorScheme', - colorScheme), + schemeLabel('Dark ColorScheme', colorScheme), schemeView(darkTheme), ], ), @@ -193,8 +188,7 @@ class _DynamicColorExampleState extends State { Future _updateImage(ImageProvider provider) async { final ColorScheme newColorScheme = await ColorScheme.fromImageProvider( - provider: provider, - brightness: isLight ? Brightness.light : Brightness.dark); + provider: provider, brightness: isLight ? Brightness.light : Brightness.dark); setState(() { selectedImage = widget.images.indexOf(provider); currentColorScheme = newColorScheme; @@ -203,30 +197,25 @@ class _DynamicColorExampleState extends State { // For small screens, have two rows of image selection. For wide screens, // fit them onto one row. - Widget _imagesRow(BuildContext context, List images, - ColorScheme colorScheme) { + Widget _imagesRow(BuildContext context, List images, ColorScheme colorScheme) { final double windowHeight = MediaQuery.of(context).size.height; final double windowWidth = MediaQuery.of(context).size.width; return Padding( padding: const EdgeInsets.all(8.0), - child: LayoutBuilder( - builder: (BuildContext context, BoxConstraints constraints) { + child: LayoutBuilder(builder: (BuildContext context, BoxConstraints constraints) { if (constraints.maxWidth > 800) { return _adaptiveLayoutImagesRow(images, colorScheme, windowHeight); } else { return Column(children: [ - _adaptiveLayoutImagesRow( - images.sublist(0, 3), colorScheme, windowWidth), - _adaptiveLayoutImagesRow( - images.sublist(3), colorScheme, windowWidth), + _adaptiveLayoutImagesRow(images.sublist(0, 3), colorScheme, windowWidth), + _adaptiveLayoutImagesRow(images.sublist(3), colorScheme, windowWidth), ]); } }), ); } - Widget _adaptiveLayoutImagesRow( - List images, ColorScheme colorScheme, double windowWidth) { + Widget _adaptiveLayoutImagesRow(List images, ColorScheme colorScheme, double windowWidth) { return Row( mainAxisAlignment: MainAxisAlignment.center, children: images @@ -268,18 +257,10 @@ class ColorSchemeView extends StatelessWidget { return Column( children: [ ColorGroup(children: [ + ColorChip(label: 'primary', color: colorScheme.primary, onColor: colorScheme.onPrimary), + ColorChip(label: 'onPrimary', color: colorScheme.onPrimary, onColor: colorScheme.primary), ColorChip( - label: 'primary', - color: colorScheme.primary, - onColor: colorScheme.onPrimary), - ColorChip( - label: 'onPrimary', - color: colorScheme.onPrimary, - onColor: colorScheme.primary), - ColorChip( - label: 'primaryContainer', - color: colorScheme.primaryContainer, - onColor: colorScheme.onPrimaryContainer), + label: 'primaryContainer', color: colorScheme.primaryContainer, onColor: colorScheme.onPrimaryContainer), ColorChip( label: 'onPrimaryContainer', color: colorScheme.onPrimaryContainer, @@ -287,14 +268,8 @@ class ColorSchemeView extends StatelessWidget { ]), divider, ColorGroup(children: [ - ColorChip( - label: 'secondary', - color: colorScheme.secondary, - onColor: colorScheme.onSecondary), - ColorChip( - label: 'onSecondary', - color: colorScheme.onSecondary, - onColor: colorScheme.secondary), + ColorChip(label: 'secondary', color: colorScheme.secondary, onColor: colorScheme.onSecondary), + ColorChip(label: 'onSecondary', color: colorScheme.onSecondary, onColor: colorScheme.secondary), ColorChip( label: 'secondaryContainer', color: colorScheme.secondaryContainer, @@ -307,14 +282,8 @@ class ColorSchemeView extends StatelessWidget { divider, ColorGroup( children: [ - ColorChip( - label: 'tertiary', - color: colorScheme.tertiary, - onColor: colorScheme.onTertiary), - ColorChip( - label: 'onTertiary', - color: colorScheme.onTertiary, - onColor: colorScheme.tertiary), + ColorChip(label: 'tertiary', color: colorScheme.tertiary, onColor: colorScheme.onTertiary), + ColorChip(label: 'onTertiary', color: colorScheme.onTertiary, onColor: colorScheme.tertiary), ColorChip( label: 'tertiaryContainer', color: colorScheme.tertiaryContainer, @@ -328,56 +297,30 @@ class ColorSchemeView extends StatelessWidget { divider, ColorGroup( children: [ + ColorChip(label: 'error', color: colorScheme.error, onColor: colorScheme.onError), + ColorChip(label: 'onError', color: colorScheme.onError, onColor: colorScheme.error), ColorChip( - label: 'error', - color: colorScheme.error, - onColor: colorScheme.onError), + label: 'errorContainer', color: colorScheme.errorContainer, onColor: colorScheme.onErrorContainer), ColorChip( - label: 'onError', - color: colorScheme.onError, - onColor: colorScheme.error), - ColorChip( - label: 'errorContainer', - color: colorScheme.errorContainer, - onColor: colorScheme.onErrorContainer), - ColorChip( - label: 'onErrorContainer', - color: colorScheme.onErrorContainer, - onColor: colorScheme.errorContainer), + label: 'onErrorContainer', color: colorScheme.onErrorContainer, onColor: colorScheme.errorContainer), ], ), divider, ColorGroup( children: [ - ColorChip( - label: 'background', - color: colorScheme.background, - onColor: colorScheme.onBackground), - ColorChip( - label: 'onBackground', - color: colorScheme.onBackground, - onColor: colorScheme.background), + ColorChip(label: 'background', color: colorScheme.background, onColor: colorScheme.onBackground), + ColorChip(label: 'onBackground', color: colorScheme.onBackground, onColor: colorScheme.background), ], ), divider, ColorGroup( children: [ + ColorChip(label: 'surface', color: colorScheme.surface, onColor: colorScheme.onSurface), + ColorChip(label: 'onSurface', color: colorScheme.onSurface, onColor: colorScheme.surface), ColorChip( - label: 'surface', - color: colorScheme.surface, - onColor: colorScheme.onSurface), + label: 'surfaceVariant', color: colorScheme.surfaceVariant, onColor: colorScheme.onSurfaceVariant), ColorChip( - label: 'onSurface', - color: colorScheme.onSurface, - onColor: colorScheme.surface), - ColorChip( - label: 'surfaceVariant', - color: colorScheme.surfaceVariant, - onColor: colorScheme.onSurfaceVariant), - ColorChip( - label: 'onSurfaceVariant', - color: colorScheme.onSurfaceVariant, - onColor: colorScheme.surfaceVariant), + label: 'onSurfaceVariant', color: colorScheme.onSurfaceVariant, onColor: colorScheme.surfaceVariant), ], ), divider, @@ -386,17 +329,10 @@ class ColorSchemeView extends StatelessWidget { ColorChip(label: 'outline', color: colorScheme.outline), ColorChip(label: 'shadow', color: colorScheme.shadow), ColorChip( - label: 'inverseSurface', - color: colorScheme.inverseSurface, - onColor: colorScheme.onInverseSurface), + label: 'inverseSurface', color: colorScheme.inverseSurface, onColor: colorScheme.onInverseSurface), ColorChip( - label: 'onInverseSurface', - color: colorScheme.onInverseSurface, - onColor: colorScheme.inverseSurface), - ColorChip( - label: 'inversePrimary', - color: colorScheme.inversePrimary, - onColor: colorScheme.primary), + label: 'onInverseSurface', color: colorScheme.onInverseSurface, onColor: colorScheme.inverseSurface), + ColorChip(label: 'inversePrimary', color: colorScheme.inversePrimary, onColor: colorScheme.primary), ], ), ], @@ -412,8 +348,7 @@ class ColorGroup extends StatelessWidget { @override Widget build(BuildContext context) { return RepaintBoundary( - child: - Card(clipBehavior: Clip.antiAlias, child: Column(children: children)), + child: Card(clipBehavior: Clip.antiAlias, child: Column(children: children)), ); } } diff --git a/examples/api/lib/material/context_menu/context_menu_controller.0.dart b/examples/api/lib/material/context_menu/context_menu_controller.0.dart index 9e128ea347..99e77ec935 100644 --- a/examples/api/lib/material/context_menu/context_menu_controller.0.dart +++ b/examples/api/lib/material/context_menu/context_menu_controller.0.dart @@ -9,25 +9,24 @@ import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; -void main() => runApp(const MyApp()); +void main() => runApp(const ContextMenuControllerExampleApp()); /// A builder that includes an Offset to draw the context menu at. typedef ContextMenuBuilder = Widget Function(BuildContext context, Offset offset); -class MyApp extends StatefulWidget { - const MyApp({super.key}); +class ContextMenuControllerExampleApp extends StatefulWidget { + const ContextMenuControllerExampleApp({super.key}); @override - State createState() => _MyAppState(); + State createState() => _ContextMenuControllerExampleAppState(); } -class _MyAppState extends State { - void _showDialog (BuildContext context) { +class _ContextMenuControllerExampleAppState extends State { + void _showDialog(BuildContext context) { Navigator.of(context).push( DialogRoute( context: context, - builder: (BuildContext context) => - const AlertDialog(title: Text('You clicked print!')), + builder: (BuildContext context) => const AlertDialog(title: Text('You clicked print!')), ), ); } @@ -82,7 +81,8 @@ class _MyAppState extends State { child: ListView( children: [ Container(height: 20.0), - const Text('Right click (desktop) or long press (mobile) anywhere, not just on this text, to show the custom menu.'), + const Text( + 'Right click (desktop) or long press (mobile) anywhere, not just on this text, to show the custom menu.'), ], ), ), diff --git a/examples/api/lib/material/context_menu/editable_text_toolbar_builder.0.dart b/examples/api/lib/material/context_menu/editable_text_toolbar_builder.0.dart index 7a4f07905f..138c14d468 100644 --- a/examples/api/lib/material/context_menu/editable_text_toolbar_builder.0.dart +++ b/examples/api/lib/material/context_menu/editable_text_toolbar_builder.0.dart @@ -10,16 +10,16 @@ import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; -void main() => runApp(const MyApp()); +void main() => runApp(const EditableTextToolbarBuilderExampleApp()); -class MyApp extends StatefulWidget { - const MyApp({super.key}); +class EditableTextToolbarBuilderExampleApp extends StatefulWidget { + const EditableTextToolbarBuilderExampleApp({super.key}); @override - State createState() => _MyAppState(); + State createState() => _EditableTextToolbarBuilderExampleAppState(); } -class _MyAppState extends State { +class _EditableTextToolbarBuilderExampleAppState extends State { final TextEditingController _controller = TextEditingController( text: 'Right click (desktop) or long press (mobile) to see the menu with custom buttons.', ); diff --git a/examples/api/lib/material/context_menu/editable_text_toolbar_builder.1.dart b/examples/api/lib/material/context_menu/editable_text_toolbar_builder.1.dart index 588fca63bb..c7c16f05e7 100644 --- a/examples/api/lib/material/context_menu/editable_text_toolbar_builder.1.dart +++ b/examples/api/lib/material/context_menu/editable_text_toolbar_builder.1.dart @@ -9,30 +9,28 @@ import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; -void main() => runApp(const MyApp()); +void main() => runApp(const EditableTextToolbarBuilderExampleApp()); const String emailAddress = 'me@example.com'; const String text = 'Select the email address and open the menu: $emailAddress'; -class MyApp extends StatefulWidget { - const MyApp({super.key}); +class EditableTextToolbarBuilderExampleApp extends StatefulWidget { + const EditableTextToolbarBuilderExampleApp({super.key}); @override - State createState() => _MyAppState(); + State createState() => _EditableTextToolbarBuilderExampleAppState(); } -class _MyAppState extends State { - +class _EditableTextToolbarBuilderExampleAppState extends State { final TextEditingController _controller = TextEditingController( text: text, ); - void _showDialog (BuildContext context) { + void _showDialog(BuildContext context) { Navigator.of(context).push( DialogRoute( context: context, - builder: (BuildContext context) => - const AlertDialog(title: Text('You clicked send email!')), + builder: (BuildContext context) => const AlertDialog(title: Text('You clicked send email!')), ), ); } @@ -69,20 +67,22 @@ class _MyAppState extends State { TextField( controller: _controller, contextMenuBuilder: (BuildContext context, EditableTextState editableTextState) { - final List buttonItems = - editableTextState.contextMenuButtonItems; + final List buttonItems = editableTextState.contextMenuButtonItems; // Here we add an "Email" button to the default TextField // context menu for the current platform, but only if an email // address is currently selected. final TextEditingValue value = _controller.value; if (_isValidEmail(value.selection.textInside(value.text))) { - buttonItems.insert(0, ContextMenuButtonItem( - label: 'Send email', - onPressed: () { - ContextMenuController.removeAny(); - _showDialog(context); - }, - )); + buttonItems.insert( + 0, + ContextMenuButtonItem( + label: 'Send email', + onPressed: () { + ContextMenuController.removeAny(); + _showDialog(context); + }, + ), + ); } return AdaptiveTextSelectionToolbar.buttonItems( anchors: editableTextState.contextMenuAnchors, diff --git a/examples/api/lib/material/context_menu/editable_text_toolbar_builder.2.dart b/examples/api/lib/material/context_menu/editable_text_toolbar_builder.2.dart index dcc9f1bfc2..25fa23637c 100644 --- a/examples/api/lib/material/context_menu/editable_text_toolbar_builder.2.dart +++ b/examples/api/lib/material/context_menu/editable_text_toolbar_builder.2.dart @@ -9,16 +9,16 @@ import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; -void main() => runApp(const MyApp()); +void main() => runApp(const EditableTextToolbarBuilderExampleApp()); -class MyApp extends StatefulWidget { - const MyApp({super.key}); +class EditableTextToolbarBuilderExampleApp extends StatefulWidget { + const EditableTextToolbarBuilderExampleApp({super.key}); @override - State createState() => _MyAppState(); + State createState() => _EditableTextToolbarBuilderExampleAppState(); } -class _MyAppState extends State { +class _EditableTextToolbarBuilderExampleAppState extends State { final TextEditingController _controller = TextEditingController( text: 'Right click (desktop) or long press (mobile) to see the menu with a custom toolbar.', ); diff --git a/examples/api/lib/material/context_menu/selectable_region_toolbar_builder.0.dart b/examples/api/lib/material/context_menu/selectable_region_toolbar_builder.0.dart index 91137ce9ed..a63b625c42 100644 --- a/examples/api/lib/material/context_menu/selectable_region_toolbar_builder.0.dart +++ b/examples/api/lib/material/context_menu/selectable_region_toolbar_builder.0.dart @@ -9,24 +9,24 @@ import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; -void main() => runApp(const MyApp()); +void main() => runApp(const SelectableRegionToolbarBuilderExampleApp()); -const String text = 'I am some text inside of SelectionArea. Right click (desktop) or long press (mobile) me to show the customized context menu.'; +const String text = + 'I am some text inside of SelectionArea. Right click (desktop) or long press (mobile) me to show the customized context menu.'; -class MyApp extends StatefulWidget { - const MyApp({super.key}); +class SelectableRegionToolbarBuilderExampleApp extends StatefulWidget { + const SelectableRegionToolbarBuilderExampleApp({super.key}); @override - State createState() => _MyAppState(); + State createState() => _SelectableRegionToolbarBuilderExampleAppState(); } -class _MyAppState extends State { - void _showDialog (BuildContext context) { +class _SelectableRegionToolbarBuilderExampleAppState extends State { + void _showDialog(BuildContext context) { Navigator.of(context).push( DialogRoute( context: context, - builder: (BuildContext context) => - const AlertDialog(title: Text('You clicked print!')), + builder: (BuildContext context) => const AlertDialog(title: Text('You clicked print!')), ), ); } diff --git a/examples/api/lib/material/data_table/data_table.0.dart b/examples/api/lib/material/data_table/data_table.0.dart index f9707cd059..2d1ff244bc 100644 --- a/examples/api/lib/material/data_table/data_table.0.dart +++ b/examples/api/lib/material/data_table/data_table.0.dart @@ -2,31 +2,28 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [DataTable]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [DataTable]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const DataTableExampleApp()); - static const String _title = 'Flutter Code Sample'; +class DataTableExampleApp extends StatelessWidget { + const DataTableExampleApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( - title: _title, home: Scaffold( - appBar: AppBar(title: const Text(_title)), - body: const MyStatelessWidget(), + appBar: AppBar(title: const Text('DataTable Sample')), + body: const DataTableExample(), ), ); } } -class MyStatelessWidget extends StatelessWidget { - const MyStatelessWidget({super.key}); +class DataTableExample extends StatelessWidget { + const DataTableExample({super.key}); @override Widget build(BuildContext context) { diff --git a/examples/api/lib/material/data_table/data_table.1.dart b/examples/api/lib/material/data_table/data_table.1.dart index 219db6ec46..cdb47e73bd 100644 --- a/examples/api/lib/material/data_table/data_table.1.dart +++ b/examples/api/lib/material/data_table/data_table.1.dart @@ -2,37 +2,34 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [DataTable]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [DataTable]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const DataTableExampleApp()); - static const String _title = 'Flutter Code Sample'; +class DataTableExampleApp extends StatelessWidget { + const DataTableExampleApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( - title: _title, home: Scaffold( - appBar: AppBar(title: const Text(_title)), - body: const MyStatefulWidget(), + appBar: AppBar(title: const Text('DataTable Sample')), + body: const DataTableExample(), ), ); } } -class MyStatefulWidget extends StatefulWidget { - const MyStatefulWidget({super.key}); +class DataTableExample extends StatefulWidget { + const DataTableExample({super.key}); @override - State createState() => _MyStatefulWidgetState(); + State createState() => _DataTableExampleState(); } -class _MyStatefulWidgetState extends State { +class _DataTableExampleState extends State { static const int numItems = 10; List selected = List.generate(numItems, (int index) => false); @@ -49,8 +46,7 @@ class _MyStatefulWidgetState extends State { rows: List.generate( numItems, (int index) => DataRow( - color: MaterialStateProperty.resolveWith( - (Set states) { + color: MaterialStateProperty.resolveWith((Set states) { // All rows will have the same selected color. if (states.contains(MaterialState.selected)) { return Theme.of(context).colorScheme.primary.withOpacity(0.08); diff --git a/examples/api/lib/material/date_picker/show_date_picker.0.dart b/examples/api/lib/material/date_picker/show_date_picker.0.dart index 79b658ca09..cd6b8d5fae 100644 --- a/examples/api/lib/material/date_picker/show_date_picker.0.dart +++ b/examples/api/lib/material/date_picker/show_date_picker.0.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [showDatePicker]. - import 'package:flutter/material.dart'; +/// Flutter code sample for [showDatePicker]. + void main() => runApp(const DatePickerApp()); class DatePickerApp extends StatelessWidget { @@ -31,17 +31,14 @@ class DatePickerExample extends StatefulWidget { } /// RestorationProperty objects can be used because of RestorationMixin. -class _DatePickerExampleState extends State - with RestorationMixin { +class _DatePickerExampleState extends State with RestorationMixin { // In this example, the restoration ID for the mixin is passed in through // the [StatefulWidget]'s constructor. @override String? get restorationId => widget.restorationId; - final RestorableDateTime _selectedDate = - RestorableDateTime(DateTime(2021, 7, 25)); - late final RestorableRouteFuture _restorableDatePickerRouteFuture = - RestorableRouteFuture( + final RestorableDateTime _selectedDate = RestorableDateTime(DateTime(2021, 7, 25)); + late final RestorableRouteFuture _restorableDatePickerRouteFuture = RestorableRouteFuture( onComplete: _selectDate, onPresent: (NavigatorState navigator, Object? arguments) { return navigator.restorablePush( @@ -73,8 +70,7 @@ class _DatePickerExampleState extends State @override void restoreState(RestorationBucket? oldBucket, bool initialRestore) { registerForRestoration(_selectedDate, 'selected_date'); - registerForRestoration( - _restorableDatePickerRouteFuture, 'date_picker_route_future'); + registerForRestoration(_restorableDatePickerRouteFuture, 'date_picker_route_future'); } void _selectDate(DateTime? newSelectedDate) { @@ -82,8 +78,8 @@ class _DatePickerExampleState extends State setState(() { _selectedDate.value = newSelectedDate; ScaffoldMessenger.of(context).showSnackBar(SnackBar( - content: Text( - 'Selected: ${_selectedDate.value.day}/${_selectedDate.value.month}/${_selectedDate.value.year}'), + content: + Text('Selected: ${_selectedDate.value.day}/${_selectedDate.value.month}/${_selectedDate.value.year}'), )); }); } diff --git a/examples/api/lib/material/date_picker/show_date_range_picker.0.dart b/examples/api/lib/material/date_picker/show_date_range_picker.0.dart index 873ce9ad03..9efd6d037c 100644 --- a/examples/api/lib/material/date_picker/show_date_range_picker.0.dart +++ b/examples/api/lib/material/date_picker/show_date_range_picker.0.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [showDateRangePicker]. - import 'package:flutter/material.dart'; +/// Flutter code sample for [showDateRangePicker]. + void main() => runApp(const DatePickerApp()); class DatePickerApp extends StatelessWidget { @@ -21,7 +21,6 @@ class DatePickerApp extends StatelessWidget { } } - class DatePickerExample extends StatefulWidget { const DatePickerExample({super.key, this.restorationId}); @@ -32,24 +31,19 @@ class DatePickerExample extends StatefulWidget { } /// RestorationProperty objects can be used because of RestorationMixin. -class _DatePickerExampleState extends State - with RestorationMixin { +class _DatePickerExampleState extends State with RestorationMixin { // In this example, the restoration ID for the mixin is passed in through // the [StatefulWidget]'s constructor. @override String? get restorationId => widget.restorationId; - final RestorableDateTimeN _startDate = - RestorableDateTimeN(DateTime(2021)); - final RestorableDateTimeN _endDate = - RestorableDateTimeN(DateTime(2021, 1, 5)); - late final RestorableRouteFuture - _restorableDateRangePickerRouteFuture = + final RestorableDateTimeN _startDate = RestorableDateTimeN(DateTime(2021)); + final RestorableDateTimeN _endDate = RestorableDateTimeN(DateTime(2021, 1, 5)); + late final RestorableRouteFuture _restorableDateRangePickerRouteFuture = RestorableRouteFuture( onComplete: _selectDateRange, onPresent: (NavigatorState navigator, Object? arguments) { - return navigator - .restorablePush(_dateRangePickerRoute, arguments: { + return navigator.restorablePush(_dateRangePickerRoute, arguments: { 'initialStartDate': _startDate.value?.millisecondsSinceEpoch, 'initialEndDate': _endDate.value?.millisecondsSinceEpoch, }); @@ -69,8 +63,7 @@ class _DatePickerExampleState extends State void restoreState(RestorationBucket? oldBucket, bool initialRestore) { registerForRestoration(_startDate, 'start_date'); registerForRestoration(_endDate, 'end_date'); - registerForRestoration( - _restorableDateRangePickerRouteFuture, 'date_picker_route_future'); + registerForRestoration(_restorableDateRangePickerRouteFuture, 'date_picker_route_future'); } @pragma('vm:entry-point') @@ -83,8 +76,7 @@ class _DatePickerExampleState extends State builder: (BuildContext context) { return DateRangePickerDialog( restorationId: 'date_picker_dialog', - initialDateRange: - _initialDateTimeRange(arguments! as Map), + initialDateRange: _initialDateTimeRange(arguments! as Map), firstDate: DateTime(2021), currentDate: DateTime(2021, 1, 25), lastDate: DateTime(2022), @@ -94,13 +86,10 @@ class _DatePickerExampleState extends State } static DateTimeRange? _initialDateTimeRange(Map arguments) { - if (arguments['initialStartDate'] != null && - arguments['initialEndDate'] != null) { + if (arguments['initialStartDate'] != null && arguments['initialEndDate'] != null) { return DateTimeRange( - start: DateTime.fromMillisecondsSinceEpoch( - arguments['initialStartDate'] as int), - end: DateTime.fromMillisecondsSinceEpoch( - arguments['initialEndDate'] as int), + start: DateTime.fromMillisecondsSinceEpoch(arguments['initialStartDate'] as int), + end: DateTime.fromMillisecondsSinceEpoch(arguments['initialEndDate'] as int), ); } diff --git a/examples/api/lib/material/dialog/alert_dialog.0.dart b/examples/api/lib/material/dialog/alert_dialog.0.dart index 98745b503b..82b0708bbe 100644 --- a/examples/api/lib/material/dialog/alert_dialog.0.dart +++ b/examples/api/lib/material/dialog/alert_dialog.0.dart @@ -2,14 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [AlertDialog]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [AlertDialog]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const AlertDialogExampleApp()); + +class AlertDialogExampleApp extends StatelessWidget { + const AlertDialogExampleApp({super.key}); @override Widget build(BuildContext context) { diff --git a/examples/api/lib/material/dialog/alert_dialog.1.dart b/examples/api/lib/material/dialog/alert_dialog.1.dart index aef1273cd8..0785b5ed09 100644 --- a/examples/api/lib/material/dialog/alert_dialog.1.dart +++ b/examples/api/lib/material/dialog/alert_dialog.1.dart @@ -2,14 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [AlertDialog]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [AlertDialog]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const AlertDialogExampleApp()); + +class AlertDialogExampleApp extends StatelessWidget { + const AlertDialogExampleApp({super.key}); @override Widget build(BuildContext context) { diff --git a/examples/api/lib/material/dialog/dialog.0.dart b/examples/api/lib/material/dialog/dialog.0.dart index aa20856def..4dbda85c56 100644 --- a/examples/api/lib/material/dialog/dialog.0.dart +++ b/examples/api/lib/material/dialog/dialog.0.dart @@ -2,14 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [Dialog]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [Dialog]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const DialogExampleApp()); + +class DialogExampleApp extends StatelessWidget { + const DialogExampleApp({super.key}); @override Widget build(BuildContext context) { @@ -42,7 +42,7 @@ class DialogExample extends StatelessWidget { mainAxisSize: MainAxisSize.min, mainAxisAlignment: MainAxisAlignment.center, children: [ - const Text('This is a typical dialog.'), + const Text('This is a typical dialog.'), const SizedBox(height: 15), TextButton( onPressed: () { @@ -66,7 +66,7 @@ class DialogExample extends StatelessWidget { mainAxisSize: MainAxisSize.min, mainAxisAlignment: MainAxisAlignment.center, children: [ - const Text('This is a fullscreen dialog.'), + const Text('This is a fullscreen dialog.'), const SizedBox(height: 15), TextButton( onPressed: () { diff --git a/examples/api/lib/material/dialog/show_dialog.0.dart b/examples/api/lib/material/dialog/show_dialog.0.dart index 2ef272e59d..614e40b350 100644 --- a/examples/api/lib/material/dialog/show_dialog.0.dart +++ b/examples/api/lib/material/dialog/show_dialog.0.dart @@ -2,14 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [showDialog]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [showDialog]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const ShowDialogExampleApp()); + +class ShowDialogExampleApp extends StatelessWidget { + const ShowDialogExampleApp({super.key}); @override Widget build(BuildContext context) { @@ -42,10 +42,11 @@ class DialogExample extends StatelessWidget { return AlertDialog( title: const Text('Basic dialog title'), content: const Text( - 'A dialog is a type of modal window that\n' - 'appears in front of app content to\n' - 'provide critical information, or prompt\n' - 'for a decision to be made.'), + 'A dialog is a type of modal window that\n' + 'appears in front of app content to\n' + 'provide critical information, or prompt\n' + 'for a decision to be made.', + ), actions: [ TextButton( style: TextButton.styleFrom( diff --git a/examples/api/lib/material/dialog/show_dialog.1.dart b/examples/api/lib/material/dialog/show_dialog.1.dart index 50d1748215..73b6807da3 100644 --- a/examples/api/lib/material/dialog/show_dialog.1.dart +++ b/examples/api/lib/material/dialog/show_dialog.1.dart @@ -2,14 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [showDialog]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [showDialog]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const ShowDialogExampleApp()); + +class ShowDialogExampleApp extends StatelessWidget { + const ShowDialogExampleApp({super.key}); @override Widget build(BuildContext context) { @@ -43,10 +43,11 @@ class DialogExample extends StatelessWidget { return AlertDialog( title: const Text('Basic dialog title'), content: const Text( - 'A dialog is a type of modal window that\n' - 'appears in front of app content to\n' - 'provide critical information, or prompt\n' - 'for a decision to be made.'), + 'A dialog is a type of modal window that\n' + 'appears in front of app content to\n' + 'provide critical information, or prompt\n' + 'for a decision to be made.', + ), actions: [ TextButton( style: TextButton.styleFrom( diff --git a/examples/api/lib/material/dialog/show_dialog.2.dart b/examples/api/lib/material/dialog/show_dialog.2.dart index 3cb875507e..f76a84ea61 100644 --- a/examples/api/lib/material/dialog/show_dialog.2.dart +++ b/examples/api/lib/material/dialog/show_dialog.2.dart @@ -2,14 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [showDialog]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [showDialog]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const ShowDialogExampleApp()); + +class ShowDialogExampleApp extends StatelessWidget { + const ShowDialogExampleApp({super.key}); @override Widget build(BuildContext context) { @@ -39,18 +39,18 @@ class DialogExample extends StatelessWidget { } @pragma('vm:entry-point') - static Route _dialogBuilder( - BuildContext context, Object? arguments) { + static Route _dialogBuilder(BuildContext context, Object? arguments) { return DialogRoute( context: context, builder: (BuildContext context) { return AlertDialog( title: const Text('Basic dialog title'), content: const Text( - 'A dialog is a type of modal window that\n' - 'appears in front of app content to\n' - 'provide critical information, or prompt\n' - 'for a decision to be made.'), + 'A dialog is a type of modal window that\n' + 'appears in front of app content to\n' + 'provide critical information, or prompt\n' + 'for a decision to be made.', + ), actions: [ TextButton( style: TextButton.styleFrom( diff --git a/examples/api/lib/material/divider/divider.0.dart b/examples/api/lib/material/divider/divider.0.dart index 7c87236dd4..15cb5af017 100644 --- a/examples/api/lib/material/divider/divider.0.dart +++ b/examples/api/lib/material/divider/divider.0.dart @@ -2,14 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [Divider]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [Divider]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const DividerExampleApp()); + +class DividerExampleApp extends StatelessWidget { + const DividerExampleApp({super.key}); @override Widget build(BuildContext context) { diff --git a/examples/api/lib/material/divider/divider.1.dart b/examples/api/lib/material/divider/divider.1.dart index bf4da00505..ae91b18d01 100644 --- a/examples/api/lib/material/divider/divider.1.dart +++ b/examples/api/lib/material/divider/divider.1.dart @@ -2,14 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [Divider]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [Divider]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const DividerExampleApp()); + +class DividerExampleApp extends StatelessWidget { + const DividerExampleApp({super.key}); @override Widget build(BuildContext context) { diff --git a/examples/api/lib/material/divider/vertical_divider.0.dart b/examples/api/lib/material/divider/vertical_divider.0.dart index 512283f611..cf1c988755 100644 --- a/examples/api/lib/material/divider/vertical_divider.0.dart +++ b/examples/api/lib/material/divider/vertical_divider.0.dart @@ -2,14 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [VerticalDivider]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [VerticalDivider]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const VerticalDividerExampleApp()); + +class VerticalDividerExampleApp extends StatelessWidget { + const VerticalDividerExampleApp({super.key}); @override Widget build(BuildContext context) { diff --git a/examples/api/lib/material/divider/vertical_divider.1.dart b/examples/api/lib/material/divider/vertical_divider.1.dart index 563649cf0c..a272b7e62e 100644 --- a/examples/api/lib/material/divider/vertical_divider.1.dart +++ b/examples/api/lib/material/divider/vertical_divider.1.dart @@ -2,14 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [Divider]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [Divider]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const VerticalDividerExampleApp()); + +class VerticalDividerExampleApp extends StatelessWidget { + const VerticalDividerExampleApp({super.key}); @override Widget build(BuildContext context) { diff --git a/examples/api/lib/material/dropdown/dropdown_button.0.dart b/examples/api/lib/material/dropdown/dropdown_button.0.dart index fb8647fca0..15d1ccb601 100644 --- a/examples/api/lib/material/dropdown/dropdown_button.0.dart +++ b/examples/api/lib/material/dropdown/dropdown_button.0.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [DropdownButton]. - import 'package:flutter/material.dart'; +/// Flutter code sample for [DropdownButton]. + const List list = ['One', 'Two', 'Three', 'Four']; void main() => runApp(const DropdownButtonApp()); diff --git a/examples/api/lib/material/dropdown/dropdown_button.selected_item_builder.0.dart b/examples/api/lib/material/dropdown/dropdown_button.selected_item_builder.0.dart index ee453fee5a..1c4f832e7f 100644 --- a/examples/api/lib/material/dropdown/dropdown_button.selected_item_builder.0.dart +++ b/examples/api/lib/material/dropdown/dropdown_button.selected_item_builder.0.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [DropdownButton.selectedItemBuilder]. - import 'package:flutter/material.dart'; +/// Flutter code sample for [DropdownButton.selectedItemBuilder]. + Map cities = { 'New York': 'NYC', 'Los Angeles': 'LA', @@ -61,7 +61,7 @@ class _DropdownButtonExampleState extends State { // Here custom text style, alignment and layout size can be applied // to selected item string. return Container( - alignment:Alignment.centerLeft, + alignment: Alignment.centerLeft, constraints: const BoxConstraints(minWidth: 100), child: Text( item, diff --git a/examples/api/lib/material/dropdown/dropdown_button.style.0.dart b/examples/api/lib/material/dropdown/dropdown_button.style.0.dart index f17f27256a..825e9fc6e3 100644 --- a/examples/api/lib/material/dropdown/dropdown_button.style.0.dart +++ b/examples/api/lib/material/dropdown/dropdown_button.style.0.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [DropdownButton.style]. - import 'package:flutter/material.dart'; +/// Flutter code sample for [DropdownButton.style]. + void main() => runApp(const DropdownButtonApp()); class DropdownButtonApp extends StatelessWidget { diff --git a/examples/api/lib/material/dropdown_menu/dropdown_menu.0.dart b/examples/api/lib/material/dropdown_menu/dropdown_menu.0.dart index d1aa12b22e..8a8e51b66c 100644 --- a/examples/api/lib/material/dropdown_menu/dropdown_menu.0.dart +++ b/examples/api/lib/material/dropdown_menu/dropdown_menu.0.dart @@ -2,11 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [DropdownMenu]s. The first dropdown menu has an outlined border // which is the default configuration, and the second one has a filled input decoration. import 'package:flutter/material.dart'; +/// Flutter code sample for [DropdownMenu]s. The first dropdown menu has an outlined border. + void main() => runApp(const DropdownMenuExample()); class DropdownMenuExample extends StatefulWidget { @@ -27,7 +28,8 @@ class _DropdownMenuExampleState extends State { final List> colorEntries = >[]; for (final ColorLabel color in ColorLabel.values) { colorEntries.add( - DropdownMenuEntry(value: color, label: color.label, enabled: color.label != 'Grey')); + DropdownMenuEntry(value: color, label: color.label, enabled: color.label != 'Grey'), + ); } final List> iconEntries = >[]; @@ -38,7 +40,7 @@ class _DropdownMenuExampleState extends State { return MaterialApp( theme: ThemeData( useMaterial3: true, - colorSchemeSeed: Colors.green + colorSchemeSeed: Colors.green, ), home: Scaffold( body: SafeArea( @@ -69,7 +71,8 @@ class _DropdownMenuExampleState extends State { dropdownMenuEntries: iconEntries, inputDecorationTheme: const InputDecorationTheme( filled: true, - contentPadding: EdgeInsets.symmetric(vertical: 5.0)), + contentPadding: EdgeInsets.symmetric(vertical: 5.0), + ), onSelected: (IconLabel? icon) { setState(() { selectedIcon = icon; @@ -86,12 +89,17 @@ class _DropdownMenuExampleState extends State { Text('You selected a ${selectedColor?.label} ${selectedIcon?.label}'), Padding( padding: const EdgeInsets.symmetric(horizontal: 5), - child: Icon(selectedIcon?.icon, color: selectedColor?.color,)) + child: Icon( + selectedIcon?.icon, + color: selectedColor?.color, + ), + ) ], ) - else const Text('Please select a color and an icon.') + else + const Text('Please select a color and an icon.') ], - ) + ), ), ), ); @@ -112,7 +120,10 @@ enum ColorLabel { enum IconLabel { smile('Smile', Icons.sentiment_satisfied_outlined), - cloud('Cloud', Icons.cloud_outlined,), + cloud( + 'Cloud', + Icons.cloud_outlined, + ), brush('Brush', Icons.brush_outlined), heart('Heart', Icons.favorite); diff --git a/examples/api/lib/material/elevated_button/elevated_button.0.dart b/examples/api/lib/material/elevated_button/elevated_button.0.dart index e9dd0179ed..ece62f42a9 100644 --- a/examples/api/lib/material/elevated_button/elevated_button.0.dart +++ b/examples/api/lib/material/elevated_button/elevated_button.0.dart @@ -2,41 +2,37 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [ElevatedButton]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [ElevatedButton]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const ElevatedButtonExampleApp()); - static const String _title = 'Flutter Code Sample'; +class ElevatedButtonExampleApp extends StatelessWidget { + const ElevatedButtonExampleApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( - title: _title, home: Scaffold( - appBar: AppBar(title: const Text(_title)), - body: const MyStatefulWidget(), + appBar: AppBar(title: const Text('ElevatedButton Sample')), + body: const ElevatedButtonExample(), ), ); } } -class MyStatefulWidget extends StatefulWidget { - const MyStatefulWidget({super.key}); +class ElevatedButtonExample extends StatefulWidget { + const ElevatedButtonExample({super.key}); @override - State createState() => _MyStatefulWidgetState(); + State createState() => _ElevatedButtonExampleState(); } -class _MyStatefulWidgetState extends State { +class _ElevatedButtonExampleState extends State { @override Widget build(BuildContext context) { - final ButtonStyle style = - ElevatedButton.styleFrom(textStyle: const TextStyle(fontSize: 20)); + final ButtonStyle style = ElevatedButton.styleFrom(textStyle: const TextStyle(fontSize: 20)); return Center( child: Column( diff --git a/examples/api/lib/material/expansion_panel/expansion_panel_list.0.dart b/examples/api/lib/material/expansion_panel/expansion_panel_list.0.dart index cefe7482e4..740250e4f6 100644 --- a/examples/api/lib/material/expansion_panel/expansion_panel_list.0.dart +++ b/examples/api/lib/material/expansion_panel/expansion_panel_list.0.dart @@ -2,24 +2,21 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [ExpansionPanelList]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [ExpansionPanelList]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const ExpansionPanelListExampleApp()); - static const String _title = 'Flutter Code Sample'; +class ExpansionPanelListExampleApp extends StatelessWidget { + const ExpansionPanelListExampleApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( - title: _title, home: Scaffold( - appBar: AppBar(title: const Text(_title)), - body: const MyStatefulWidget(), + appBar: AppBar(title: const Text('ExpansionPanelList Sample')), + body: const ExpansionPanelListExample(), ), ); } @@ -47,14 +44,14 @@ List generateItems(int numberOfItems) { }); } -class MyStatefulWidget extends StatefulWidget { - const MyStatefulWidget({super.key}); +class ExpansionPanelListExample extends StatefulWidget { + const ExpansionPanelListExample({super.key}); @override - State createState() => _MyStatefulWidgetState(); + State createState() => _ExpansionPanelListExampleState(); } -class _MyStatefulWidgetState extends State { +class _ExpansionPanelListExampleState extends State { final List _data = generateItems(8); @override @@ -82,8 +79,7 @@ class _MyStatefulWidgetState extends State { }, body: ListTile( title: Text(item.expandedValue), - subtitle: - const Text('To delete this panel, tap the trash can icon'), + subtitle: const Text('To delete this panel, tap the trash can icon'), trailing: const Icon(Icons.delete), onTap: () { setState(() { diff --git a/examples/api/lib/material/expansion_panel/expansion_panel_list.expansion_panel_list_radio.0.dart b/examples/api/lib/material/expansion_panel/expansion_panel_list.expansion_panel_list_radio.0.dart index b8c25e0572..db7ec03f4e 100644 --- a/examples/api/lib/material/expansion_panel/expansion_panel_list.expansion_panel_list_radio.0.dart +++ b/examples/api/lib/material/expansion_panel/expansion_panel_list.expansion_panel_list_radio.0.dart @@ -2,24 +2,21 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [ExpansionPanelList.ExpansionPanelList.radio]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [ExpansionPanelList.ExpansionPanelList.radio]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const ExpansionPanelListRadioExampleApp()); - static const String _title = 'Flutter Code Sample'; +class ExpansionPanelListRadioExampleApp extends StatelessWidget { + const ExpansionPanelListRadioExampleApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( - title: _title, home: Scaffold( - appBar: AppBar(title: const Text(_title)), - body: const MyStatefulWidget(), + appBar: AppBar(title: const Text('ExpansionPanelList.radio Sample')), + body: const ExpansionPanelListRadioExample(), ), ); } @@ -48,14 +45,14 @@ List generateItems(int numberOfItems) { }); } -class MyStatefulWidget extends StatefulWidget { - const MyStatefulWidget({super.key}); +class ExpansionPanelListRadioExample extends StatefulWidget { + const ExpansionPanelListRadioExample({super.key}); @override - State createState() => _MyStatefulWidgetState(); + State createState() => _ExpansionPanelListRadioExampleState(); } -class _MyStatefulWidgetState extends State { +class _ExpansionPanelListRadioExampleState extends State { final List _data = generateItems(8); @override @@ -80,13 +77,11 @@ class _MyStatefulWidgetState extends State { }, body: ListTile( title: Text(item.expandedValue), - subtitle: - const Text('To delete this panel, tap the trash can icon'), + subtitle: const Text('To delete this panel, tap the trash can icon'), trailing: const Icon(Icons.delete), onTap: () { setState(() { - _data - .removeWhere((Item currentItem) => item == currentItem); + _data.removeWhere((Item currentItem) => item == currentItem); }); })); }).toList(), diff --git a/examples/api/lib/material/expansion_tile/expansion_tile.0.dart b/examples/api/lib/material/expansion_tile/expansion_tile.0.dart index 6a2651430c..384c88912f 100644 --- a/examples/api/lib/material/expansion_tile/expansion_tile.0.dart +++ b/examples/api/lib/material/expansion_tile/expansion_tile.0.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [ExpansionTile]. - import 'package:flutter/material.dart'; +/// Flutter code sample for [ExpansionTile]. + void main() => runApp(const ExpansionTileApp()); class ExpansionTileApp extends StatelessWidget { @@ -48,9 +48,7 @@ class _ExpansionTileExampleState extends State { title: const Text('ExpansionTile 2'), subtitle: const Text('Custom expansion arrow icon'), trailing: Icon( - _customTileExpanded - ? Icons.arrow_drop_down_circle - : Icons.arrow_drop_down, + _customTileExpanded ? Icons.arrow_drop_down_circle : Icons.arrow_drop_down, ), children: const [ ListTile(title: Text('This is tile number 2')), diff --git a/examples/api/lib/material/expansion_tile/expansion_tile.1.dart b/examples/api/lib/material/expansion_tile/expansion_tile.1.dart index 66de0ee2a8..76799ec989 100644 --- a/examples/api/lib/material/expansion_tile/expansion_tile.1.dart +++ b/examples/api/lib/material/expansion_tile/expansion_tile.1.dart @@ -2,16 +2,16 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [ExpansionTile] and [ExpansionTileController] - import 'package:flutter/material.dart'; +/// Flutter code sample for [ExpansionTile] and [ExpansionTileController]. + void main() { runApp(const ExpansionTileControllerApp()); } class ExpansionTileControllerApp extends StatefulWidget { - const ExpansionTileControllerApp({ super.key }); + const ExpansionTileControllerApp({super.key}); @override State createState() => _ExpansionTileControllerAppState(); @@ -23,10 +23,9 @@ class _ExpansionTileControllerAppState extends State @override Widget build(BuildContext context) { return MaterialApp( - title: 'Flutter Code Sample for ExpansionTileController.', theme: ThemeData(useMaterial3: true), home: Scaffold( - appBar: AppBar(title: const Text('ExpansionTileController Example')), + appBar: AppBar(title: const Text('ExpansionTileController Sample')), body: Column( children: [ // A controller has been provided to the ExpansionTile because it's diff --git a/examples/api/lib/material/filled_button/filled_button.0.dart b/examples/api/lib/material/filled_button/filled_button.0.dart index 36e8e83be0..7b0ca199ea 100644 --- a/examples/api/lib/material/filled_button/filled_button.0.dart +++ b/examples/api/lib/material/filled_button/filled_button.0.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [FilledButton]. - import 'package:flutter/material.dart'; +/// Flutter code sample for [FilledButton]. + void main() { runApp(const FilledButtonApp()); } diff --git a/examples/api/lib/material/filter_chip/filter_chip.0.dart b/examples/api/lib/material/filter_chip/filter_chip.0.dart index d3da52ff9f..acf72b1db4 100644 --- a/examples/api/lib/material/filter_chip/filter_chip.0.dart +++ b/examples/api/lib/material/filter_chip/filter_chip.0.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [FilterChip]. - import 'package:flutter/material.dart'; +/// Flutter code sample for [FilterChip]. + enum ExerciseFilter { walking, running, cycling, hiking } void main() => runApp(const ChipApp()); @@ -67,8 +67,7 @@ class _FilterChipExampleState extends State { ), const SizedBox(height: 10.0), Text( - 'Looking for: ${filters.map( - (ExerciseFilter e) => e.name).join(', ')}', + 'Looking for: ${filters.map((ExerciseFilter e) => e.name).join(', ')}', style: textTheme.labelLarge, ), ], diff --git a/examples/api/lib/material/flexible_space_bar/flexible_space_bar.0.dart b/examples/api/lib/material/flexible_space_bar/flexible_space_bar.0.dart index 48cf73b0d7..b1649afa0b 100644 --- a/examples/api/lib/material/flexible_space_bar/flexible_space_bar.0.dart +++ b/examples/api/lib/material/flexible_space_bar/flexible_space_bar.0.dart @@ -2,21 +2,20 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [FlexibleSpaceBar]. - import 'package:flutter/material.dart'; -void main() => runApp(const MaterialApp(home: MyApp())); +/// Flutter code sample for [FlexibleSpaceBar]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const MaterialApp(home: FlexibleSpaceBarExampleApp())); + +class FlexibleSpaceBarExampleApp extends StatelessWidget { + const FlexibleSpaceBarExampleApp({super.key}); @override Widget build(BuildContext context) { return Scaffold( body: CustomScrollView( - physics: const BouncingScrollPhysics( - parent: AlwaysScrollableScrollPhysics()), + physics: const BouncingScrollPhysics(parent: AlwaysScrollableScrollPhysics()), slivers: [ SliverAppBar( stretch: true, diff --git a/examples/api/lib/material/floating_action_button/floating_action_button.0.dart b/examples/api/lib/material/floating_action_button/floating_action_button.0.dart index 63a9aa69ed..26b2a5baf8 100644 --- a/examples/api/lib/material/floating_action_button/floating_action_button.0.dart +++ b/examples/api/lib/material/floating_action_button/floating_action_button.0.dart @@ -2,14 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [FloatingActionButton]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [FloatingActionButton]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const FloatingActionButtonExampleApp()); + +class FloatingActionButtonExampleApp extends StatelessWidget { + const FloatingActionButtonExampleApp({super.key}); @override Widget build(BuildContext context) { diff --git a/examples/api/lib/material/floating_action_button/floating_action_button.1.dart b/examples/api/lib/material/floating_action_button/floating_action_button.1.dart index 79eaa06194..7180a52d43 100644 --- a/examples/api/lib/material/floating_action_button/floating_action_button.1.dart +++ b/examples/api/lib/material/floating_action_button/floating_action_button.1.dart @@ -2,14 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [FloatingActionButton]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [FloatingActionButton]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const FloatingActionButtonExampleApp()); + +class FloatingActionButtonExampleApp extends StatelessWidget { + const FloatingActionButtonExampleApp({super.key}); @override Widget build(BuildContext context) { diff --git a/examples/api/lib/material/floating_action_button/floating_action_button.2.dart b/examples/api/lib/material/floating_action_button/floating_action_button.2.dart index 30e6f75644..4eedfc1a2b 100644 --- a/examples/api/lib/material/floating_action_button/floating_action_button.2.dart +++ b/examples/api/lib/material/floating_action_button/floating_action_button.2.dart @@ -2,14 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [FloatingActionButton]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [FloatingActionButton]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const FloatingActionButtonExampleApp()); + +class FloatingActionButtonExampleApp extends StatelessWidget { + const FloatingActionButtonExampleApp({super.key}); @override Widget build(BuildContext context) { diff --git a/examples/api/lib/material/floating_action_button/floating_action_button.3.dart b/examples/api/lib/material/floating_action_button/floating_action_button.3.dart index 5d88caf18c..9650247a25 100644 --- a/examples/api/lib/material/floating_action_button/floating_action_button.3.dart +++ b/examples/api/lib/material/floating_action_button/floating_action_button.3.dart @@ -2,14 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [FloatingActionButton]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [FloatingActionButton]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const FloatingActionButtonExampleApp()); + +class FloatingActionButtonExampleApp extends StatelessWidget { + const FloatingActionButtonExampleApp({super.key}); @override Widget build(BuildContext context) { diff --git a/examples/api/lib/material/floating_action_button_location/standard_fab_location.0.dart b/examples/api/lib/material/floating_action_button_location/standard_fab_location.0.dart index 2cb8105090..ce77bf7a5f 100644 --- a/examples/api/lib/material/floating_action_button_location/standard_fab_location.0.dart +++ b/examples/api/lib/material/floating_action_button_location/standard_fab_location.0.dart @@ -2,40 +2,33 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [StandardFabLocation]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [StandardFabLocation]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const StandardFabLocationExampleApp()); - static const String _title = 'Flutter Code Sample'; +class StandardFabLocationExampleApp extends StatelessWidget { + const StandardFabLocationExampleApp({super.key}); @override Widget build(BuildContext context) { return const MaterialApp( - title: _title, - home: MyStatelessWidget(), + home: StandardFabLocationExample(), ); } } -class AlmostEndFloatFabLocation extends StandardFabLocation - with FabEndOffsetX, FabFloatOffsetY { +class AlmostEndFloatFabLocation extends StandardFabLocation with FabEndOffsetX, FabFloatOffsetY { @override - double getOffsetX( - ScaffoldPrelayoutGeometry scaffoldGeometry, double adjustment) { - final double directionalAdjustment = - scaffoldGeometry.textDirection == TextDirection.ltr ? -50.0 : 50.0; - return super.getOffsetX(scaffoldGeometry, adjustment) + - directionalAdjustment; + double getOffsetX(ScaffoldPrelayoutGeometry scaffoldGeometry, double adjustment) { + final double directionalAdjustment = scaffoldGeometry.textDirection == TextDirection.ltr ? -50.0 : 50.0; + return super.getOffsetX(scaffoldGeometry, adjustment) + directionalAdjustment; } } -class MyStatelessWidget extends StatelessWidget { - const MyStatelessWidget({super.key}); +class StandardFabLocationExample extends StatelessWidget { + const StandardFabLocationExample({super.key}); @override Widget build(BuildContext context) { diff --git a/examples/api/lib/material/icon_button/icon_button.0.dart b/examples/api/lib/material/icon_button/icon_button.0.dart index 5a03a4432f..309d4ce475 100644 --- a/examples/api/lib/material/icon_button/icon_button.0.dart +++ b/examples/api/lib/material/icon_button/icon_button.0.dart @@ -2,25 +2,22 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [IconButton]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [IconButton]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const IconButtonExampleApp()); - static const String _title = 'Flutter Code Sample'; +class IconButtonExampleApp extends StatelessWidget { + const IconButtonExampleApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( - title: _title, home: Scaffold( - appBar: AppBar(title: const Text(_title)), + appBar: AppBar(title: const Text('IconButton Sample')), body: const Center( - child: MyStatefulWidget(), + child: IconButtonExample(), ), ), ); @@ -29,14 +26,14 @@ class MyApp extends StatelessWidget { double _volume = 0.0; -class MyStatefulWidget extends StatefulWidget { - const MyStatefulWidget({super.key}); +class IconButtonExample extends StatefulWidget { + const IconButtonExample({super.key}); @override - State createState() => _MyStatefulWidgetState(); + State createState() => _IconButtonExampleState(); } -class _MyStatefulWidgetState extends State { +class _IconButtonExampleState extends State { @override Widget build(BuildContext context) { return Column( diff --git a/examples/api/lib/material/icon_button/icon_button.1.dart b/examples/api/lib/material/icon_button/icon_button.1.dart index 6b8ec045f5..2bc28d1acf 100644 --- a/examples/api/lib/material/icon_button/icon_button.1.dart +++ b/examples/api/lib/material/icon_button/icon_button.1.dart @@ -2,31 +2,28 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [IconButton]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [IconButton]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const IconButtonExampleApp()); - static const String _title = 'Flutter Code Sample'; +class IconButtonExampleApp extends StatelessWidget { + const IconButtonExampleApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( - title: _title, home: Scaffold( - appBar: AppBar(title: const Text(_title)), - body: const MyStatelessWidget(), + appBar: AppBar(title: const Text('IconButton Sample')), + body: const IconButtonExample(), ), ); } } -class MyStatelessWidget extends StatelessWidget { - const MyStatelessWidget({super.key}); +class IconButtonExample extends StatelessWidget { + const IconButtonExample({super.key}); @override @override diff --git a/examples/api/lib/material/icon_button/icon_button.2.dart b/examples/api/lib/material/icon_button/icon_button.2.dart index 91c66f575a..e057781c2d 100644 --- a/examples/api/lib/material/icon_button/icon_button.2.dart +++ b/examples/api/lib/material/icon_button/icon_button.2.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [IconButton]. - import 'package:flutter/material.dart'; +/// Flutter code sample for [IconButton]. + void main() { runApp(const IconButtonApp()); } @@ -45,7 +45,7 @@ class ButtonTypesExample extends StatelessWidget { } class ButtonTypesGroup extends StatelessWidget { - const ButtonTypesGroup({ super.key, required this.enabled }); + const ButtonTypesGroup({super.key, required this.enabled}); final bool enabled; diff --git a/examples/api/lib/material/icon_button/icon_button.3.dart b/examples/api/lib/material/icon_button/icon_button.3.dart index 6eb6884b70..00ff53fa66 100644 --- a/examples/api/lib/material/icon_button/icon_button.3.dart +++ b/examples/api/lib/material/icon_button/icon_button.3.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [IconButton] with toggle feature. - import 'package:flutter/material.dart'; +/// Flutter code sample for [IconButton] with toggle feature. + void main() { runApp(const IconButtonToggleApp()); } @@ -134,7 +134,7 @@ class _DemoIconToggleButtonsState extends State { ), ], ), - ] + ], ); } } diff --git a/examples/api/lib/material/ink/ink.image_clip.0.dart b/examples/api/lib/material/ink/ink.image_clip.0.dart index 5a39b61c95..c4a58d959d 100644 --- a/examples/api/lib/material/ink/ink.image_clip.0.dart +++ b/examples/api/lib/material/ink/ink.image_clip.0.dart @@ -2,26 +2,27 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [Image.frameBuilder]. - import 'package:flutter/material.dart'; +/// Flutter code sample for [Image.frameBuilder]. + void main() { - runApp(MaterialApp( - title: 'Flutter Code Sample', - home: Scaffold( - appBar: AppBar(title: const Text('Flutter Code Sample')), - body: const Center( - child: MyStatelessWidget( - image: NetworkImage('https://flutter.github.io/assets-for-api-docs/assets/widgets/puffin.jpg'), + runApp( + MaterialApp( + home: Scaffold( + appBar: AppBar(title: const Text('Image.frameBuilder Sample')), + body: const Center( + child: ImageClipExample( + image: NetworkImage('https://flutter.github.io/assets-for-api-docs/assets/widgets/puffin.jpg'), + ), ), ), ), - )); + ); } -class MyStatelessWidget extends StatelessWidget { - const MyStatelessWidget({super.key, required this.image}); +class ImageClipExample extends StatelessWidget { + const ImageClipExample({super.key, required this.image}); final ImageProvider image; diff --git a/examples/api/lib/material/ink/ink.image_clip.1.dart b/examples/api/lib/material/ink/ink.image_clip.1.dart index 334d63115c..aa981ebb54 100644 --- a/examples/api/lib/material/ink/ink.image_clip.1.dart +++ b/examples/api/lib/material/ink/ink.image_clip.1.dart @@ -2,17 +2,16 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [Image.frameBuilder]. - import 'package:flutter/material.dart'; +/// Flutter code sample for [Image.frameBuilder]. + void main() { runApp(MaterialApp( - title: 'Flutter Code Sample', home: Scaffold( - appBar: AppBar(title: const Text('Flutter Code Sample')), + appBar: AppBar(title: const Text('Image.frameBuilder Sample')), body: const Center( - child: MyStatelessWidget( + child: ImageClipExample( image: NetworkImage('https://flutter.github.io/assets-for-api-docs/assets/widgets/puffin.jpg'), ), ), @@ -20,8 +19,8 @@ void main() { )); } -class MyStatelessWidget extends StatelessWidget { - const MyStatelessWidget({super.key, required this.image}); +class ImageClipExample extends StatelessWidget { + const ImageClipExample({super.key, required this.image}); final ImageProvider image; diff --git a/examples/api/lib/material/ink_well/ink_well.0.dart b/examples/api/lib/material/ink_well/ink_well.0.dart index 36712b223e..723bfd1ed0 100644 --- a/examples/api/lib/material/ink_well/ink_well.0.dart +++ b/examples/api/lib/material/ink_well/ink_well.0.dart @@ -2,39 +2,36 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [InkWell]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [InkWell]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const InkWellExampleApp()); - static const String _title = 'Flutter Code Sample'; +class InkWellExampleApp extends StatelessWidget { + const InkWellExampleApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( - title: _title, home: Scaffold( - appBar: AppBar(title: const Text(_title)), + appBar: AppBar(title: const Text('InkWell Sample')), body: const Center( - child: MyStatefulWidget(), + child: InkWellExample(), ), ), ); } } -class MyStatefulWidget extends StatefulWidget { - const MyStatefulWidget({super.key}); +class InkWellExample extends StatefulWidget { + const InkWellExample({super.key}); @override - State createState() => _MyStatefulWidgetState(); + State createState() => _InkWellExampleState(); } -class _MyStatefulWidgetState extends State { +class _InkWellExampleState extends State { double sideLength = 50; @override diff --git a/examples/api/lib/material/input_decorator/input_decoration.0.dart b/examples/api/lib/material/input_decorator/input_decoration.0.dart index e6c4b67091..51454591a8 100644 --- a/examples/api/lib/material/input_decorator/input_decoration.0.dart +++ b/examples/api/lib/material/input_decorator/input_decoration.0.dart @@ -2,31 +2,28 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [InputDecoration]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [InputDecoration]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const InputDecorationExampleApp()); - static const String _title = 'Flutter Code Sample'; +class InputDecorationExampleApp extends StatelessWidget { + const InputDecorationExampleApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( - title: _title, home: Scaffold( - appBar: AppBar(title: const Text(_title)), - body: const MyStatelessWidget(), + appBar: AppBar(title: const Text('InputDecoration Sample')), + body: const InputDecorationExample(), ), ); } } -class MyStatelessWidget extends StatelessWidget { - const MyStatelessWidget({super.key}); +class InputDecorationExample extends StatelessWidget { + const InputDecorationExample({super.key}); @override Widget build(BuildContext context) { diff --git a/examples/api/lib/material/input_decorator/input_decoration.1.dart b/examples/api/lib/material/input_decorator/input_decoration.1.dart index cb0412ac71..15e8feac84 100644 --- a/examples/api/lib/material/input_decorator/input_decoration.1.dart +++ b/examples/api/lib/material/input_decorator/input_decoration.1.dart @@ -2,31 +2,28 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [InputDecoration]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [InputDecoration]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const InputDecorationExampleApp()); - static const String _title = 'Flutter Code Sample'; +class InputDecorationExampleApp extends StatelessWidget { + const InputDecorationExampleApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( - title: _title, home: Scaffold( - appBar: AppBar(title: const Text(_title)), - body: const MyStatelessWidget(), + appBar: AppBar(title: const Text('InputDecoration Sample')), + body: const InputDecorationExample(), ), ); } } -class MyStatelessWidget extends StatelessWidget { - const MyStatelessWidget({super.key}); +class InputDecorationExample extends StatelessWidget { + const InputDecorationExample({super.key}); @override Widget build(BuildContext context) { diff --git a/examples/api/lib/material/input_decorator/input_decoration.2.dart b/examples/api/lib/material/input_decorator/input_decoration.2.dart index 331493ba5a..ce9493f1ae 100644 --- a/examples/api/lib/material/input_decorator/input_decoration.2.dart +++ b/examples/api/lib/material/input_decorator/input_decoration.2.dart @@ -2,31 +2,28 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [InputDecoration]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [InputDecoration]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const InputDecorationExampleApp()); - static const String _title = 'Flutter Code Sample'; +class InputDecorationExampleApp extends StatelessWidget { + const InputDecorationExampleApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( - title: _title, home: Scaffold( - appBar: AppBar(title: const Text(_title)), - body: const MyStatelessWidget(), + appBar: AppBar(title: const Text('InputDecoration Sample')), + body: const InputDecorationExample(), ), ); } } -class MyStatelessWidget extends StatelessWidget { - const MyStatelessWidget({super.key}); +class InputDecorationExample extends StatelessWidget { + const InputDecorationExample({super.key}); @override Widget build(BuildContext context) { diff --git a/examples/api/lib/material/input_decorator/input_decoration.3.dart b/examples/api/lib/material/input_decorator/input_decoration.3.dart index ad67a95ca7..ce63e2e99c 100644 --- a/examples/api/lib/material/input_decorator/input_decoration.3.dart +++ b/examples/api/lib/material/input_decorator/input_decoration.3.dart @@ -2,31 +2,28 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [InputDecoration]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [InputDecoration]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const InputDecorationExampleApp()); - static const String _title = 'Flutter Code Sample'; +class InputDecorationExampleApp extends StatelessWidget { + const InputDecorationExampleApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( - title: _title, home: Scaffold( - appBar: AppBar(title: const Text(_title)), - body: const MyStatelessWidget(), + appBar: AppBar(title: const Text('InputDecoration Sample')), + body: const InputDecorationExample(), ), ); } } -class MyStatelessWidget extends StatelessWidget { - const MyStatelessWidget({super.key}); +class InputDecorationExample extends StatelessWidget { + const InputDecorationExample({super.key}); @override Widget build(BuildContext context) { diff --git a/examples/api/lib/material/input_decorator/input_decoration.floating_label_style_error.0.dart b/examples/api/lib/material/input_decorator/input_decoration.floating_label_style_error.0.dart index 98e5c90417..a7a3f2beb7 100644 --- a/examples/api/lib/material/input_decorator/input_decoration.floating_label_style_error.0.dart +++ b/examples/api/lib/material/input_decorator/input_decoration.floating_label_style_error.0.dart @@ -2,23 +2,20 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [InputDecorator]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [InputDecorator]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const FloatingLabelStyleErrorExampleApp()); - static const String _title = 'Flutter Code Sample'; +class FloatingLabelStyleErrorExampleApp extends StatelessWidget { + const FloatingLabelStyleErrorExampleApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( - title: _title, home: Scaffold( - appBar: AppBar(title: const Text(_title)), + appBar: AppBar(title: const Text('InputDecorator Sample')), body: const Center( child: InputDecoratorExample(), ), @@ -41,9 +38,10 @@ class InputDecoratorExample extends StatelessWidget { // is in its error state. floatingLabelStyle: MaterialStateTextStyle.resolveWith( (Set states) { - final Color color = states.contains(MaterialState.error) ? Theme.of(context).colorScheme.error: Colors.orange; + final Color color = + states.contains(MaterialState.error) ? Theme.of(context).colorScheme.error : Colors.orange; return TextStyle(color: color, letterSpacing: 1.3); - } + }, ), ), validator: (String? value) { diff --git a/examples/api/lib/material/input_decorator/input_decoration.label.0.dart b/examples/api/lib/material/input_decorator/input_decoration.label.0.dart index 9852129485..f8199678bc 100644 --- a/examples/api/lib/material/input_decorator/input_decoration.label.0.dart +++ b/examples/api/lib/material/input_decorator/input_decoration.label.0.dart @@ -2,31 +2,28 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [InputDecoration.label]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [InputDecoration.label]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const LabelExampleApp()); - static const String _title = 'Flutter Code Sample'; +class LabelExampleApp extends StatelessWidget { + const LabelExampleApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( - title: _title, home: Scaffold( - appBar: AppBar(title: const Text(_title)), - body: const MyStatelessWidget(), + appBar: AppBar(title: const Text('InputDecoration.label Sample')), + body: const LabelExample(), ), ); } } -class MyStatelessWidget extends StatelessWidget { - const MyStatelessWidget({super.key}); +class LabelExample extends StatelessWidget { + const LabelExample({super.key}); @override Widget build(BuildContext context) { diff --git a/examples/api/lib/material/input_decorator/input_decoration.label_style_error.0.dart b/examples/api/lib/material/input_decorator/input_decoration.label_style_error.0.dart index 5655ecea9a..a87a0563ca 100644 --- a/examples/api/lib/material/input_decorator/input_decoration.label_style_error.0.dart +++ b/examples/api/lib/material/input_decorator/input_decoration.label_style_error.0.dart @@ -2,23 +2,20 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [InputDecorator]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [InputDecorator]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const LabelStyleErrorExampleApp()); - static const String _title = 'Flutter Code Sample'; +class LabelStyleErrorExampleApp extends StatelessWidget { + const LabelStyleErrorExampleApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( - title: _title, home: Scaffold( - appBar: AppBar(title: const Text(_title)), + appBar: AppBar(title: const Text('InputDecorator Sample')), body: const Center( child: InputDecoratorExample(), ), @@ -41,9 +38,10 @@ class InputDecoratorExample extends StatelessWidget { // is in its error state. labelStyle: MaterialStateTextStyle.resolveWith( (Set states) { - final Color color = states.contains(MaterialState.error) ? Theme.of(context).colorScheme.error: Colors.orange; + final Color color = + states.contains(MaterialState.error) ? Theme.of(context).colorScheme.error : Colors.orange; return TextStyle(color: color, letterSpacing: 1.3); - } + }, ), ), validator: (String? value) { diff --git a/examples/api/lib/material/input_decorator/input_decoration.material_state.0.dart b/examples/api/lib/material/input_decorator/input_decoration.material_state.0.dart index 1d621c0325..e7b607259c 100644 --- a/examples/api/lib/material/input_decorator/input_decoration.material_state.0.dart +++ b/examples/api/lib/material/input_decorator/input_decoration.material_state.0.dart @@ -2,31 +2,28 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [InputDecoration]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [InputDecoration]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const MaterialStateExampleApp()); - static const String _title = 'Flutter Code Sample'; +class MaterialStateExampleApp extends StatelessWidget { + const MaterialStateExampleApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( - title: _title, home: Scaffold( - appBar: AppBar(title: const Text(_title)), - body: const MyStatelessWidget(), + appBar: AppBar(title: const Text('InputDecoration Sample')), + body: const MaterialStateExample(), ), ); } } -class MyStatelessWidget extends StatelessWidget { - const MyStatelessWidget({super.key}); +class MaterialStateExample extends StatelessWidget { + const MaterialStateExample({super.key}); @override Widget build(BuildContext context) { @@ -37,7 +34,8 @@ class MyStatelessWidget extends StatelessWidget { prefixIconColor: MaterialStateColor.resolveWith((Set states) { if (states.contains(MaterialState.focused)) { return Colors.green; - } if (states.contains(MaterialState.error)) { + } + if (states.contains(MaterialState.error)) { return Colors.red; } return Colors.grey; diff --git a/examples/api/lib/material/input_decorator/input_decoration.material_state.1.dart b/examples/api/lib/material/input_decorator/input_decoration.material_state.1.dart index 6de8207644..5a1930dd8a 100644 --- a/examples/api/lib/material/input_decorator/input_decoration.material_state.1.dart +++ b/examples/api/lib/material/input_decorator/input_decoration.material_state.1.dart @@ -2,31 +2,28 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [InputDecoration]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [InputDecoration]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const MaterialStateExampleApp()); - static const String _title = 'Flutter Code Sample'; +class MaterialStateExampleApp extends StatelessWidget { + const MaterialStateExampleApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( - title: _title, home: Scaffold( - appBar: AppBar(title: const Text(_title)), - body: const MyStatelessWidget(), + appBar: AppBar(title: const Text('InputDecoration Sample')), + body: const MaterialStateExample(), ), ); } } -class MyStatelessWidget extends StatelessWidget { - const MyStatelessWidget({super.key}); +class MaterialStateExample extends StatelessWidget { + const MaterialStateExample({super.key}); @override Widget build(BuildContext context) { @@ -34,15 +31,18 @@ class MyStatelessWidget extends StatelessWidget { return Theme( data: themeData.copyWith( inputDecorationTheme: themeData.inputDecorationTheme.copyWith( - prefixIconColor: MaterialStateColor.resolveWith((Set states) { - if (states.contains(MaterialState.focused)) { - return Colors.green; - } if (states.contains(MaterialState.error)) { - return Colors.red; - } - return Colors.grey; - }), - ) + prefixIconColor: MaterialStateColor.resolveWith( + (Set states) { + if (states.contains(MaterialState.focused)) { + return Colors.green; + } + if (states.contains(MaterialState.error)) { + return Colors.red; + } + return Colors.grey; + }, + ), + ), ), child: TextFormField( initialValue: 'abc', diff --git a/examples/api/lib/material/input_decorator/input_decoration.prefix_icon.0.dart b/examples/api/lib/material/input_decorator/input_decoration.prefix_icon.0.dart index 42cc45ff77..1a45563723 100644 --- a/examples/api/lib/material/input_decorator/input_decoration.prefix_icon.0.dart +++ b/examples/api/lib/material/input_decorator/input_decoration.prefix_icon.0.dart @@ -2,19 +2,18 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [InputDecorator]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [InputDecorator]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const PrefixIconExampleApp()); + +class PrefixIconExampleApp extends StatelessWidget { + const PrefixIconExampleApp({super.key}); @override Widget build(BuildContext context) { return const MaterialApp( - title: 'Input Decorator Sample', home: Scaffold(body: InputDecoratorExample()), ); } diff --git a/examples/api/lib/material/input_decorator/input_decoration.prefix_icon_constraints.0.dart b/examples/api/lib/material/input_decorator/input_decoration.prefix_icon_constraints.0.dart index 99ee08bab2..eb781afee0 100644 --- a/examples/api/lib/material/input_decorator/input_decoration.prefix_icon_constraints.0.dart +++ b/examples/api/lib/material/input_decorator/input_decoration.prefix_icon_constraints.0.dart @@ -2,31 +2,28 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [InputDecoration.prefixIconConstraints]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [InputDecoration.prefixIconConstraints]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const PrefixIconConstraintsExampleApp()); - static const String _title = 'Flutter Code Sample'; +class PrefixIconConstraintsExampleApp extends StatelessWidget { + const PrefixIconConstraintsExampleApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( - title: _title, home: Scaffold( - appBar: AppBar(title: const Text(_title)), - body: const MyStatelessWidget(), + appBar: AppBar(title: const Text('InputDecoration Sample')), + body: const PrefixIconConstraintsExample(), ), ); } } -class MyStatelessWidget extends StatelessWidget { - const MyStatelessWidget({super.key}); +class PrefixIconConstraintsExample extends StatelessWidget { + const PrefixIconConstraintsExample({super.key}); @override Widget build(BuildContext context) { diff --git a/examples/api/lib/material/input_decorator/input_decoration.suffix_icon.0.dart b/examples/api/lib/material/input_decorator/input_decoration.suffix_icon.0.dart index 83e1acc855..eeda66917f 100644 --- a/examples/api/lib/material/input_decorator/input_decoration.suffix_icon.0.dart +++ b/examples/api/lib/material/input_decorator/input_decoration.suffix_icon.0.dart @@ -2,19 +2,18 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [InputDecorator]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [InputDecorator]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const SuffixIconExampleApp()); + +class SuffixIconExampleApp extends StatelessWidget { + const SuffixIconExampleApp({super.key}); @override Widget build(BuildContext context) { return const MaterialApp( - title: 'Input Decorator Sample', home: Scaffold(body: InputDecoratorExample()), ); } diff --git a/examples/api/lib/material/input_decorator/input_decoration.suffix_icon_constraints.0.dart b/examples/api/lib/material/input_decorator/input_decoration.suffix_icon_constraints.0.dart index 1103c6d6cf..df1422d7ab 100644 --- a/examples/api/lib/material/input_decorator/input_decoration.suffix_icon_constraints.0.dart +++ b/examples/api/lib/material/input_decorator/input_decoration.suffix_icon_constraints.0.dart @@ -2,31 +2,28 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [InputDecoration.suffixIconConstraints]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [InputDecoration.suffixIconConstraints]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const SuffixIconConstraintsExampleApp()); - static const String _title = 'Flutter Code Sample'; +class SuffixIconConstraintsExampleApp extends StatelessWidget { + const SuffixIconConstraintsExampleApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( - title: _title, home: Scaffold( - appBar: AppBar(title: const Text(_title)), - body: const MyStatelessWidget(), + appBar: AppBar(title: const Text('InputDecoration Sample')), + body: const SuffixIconConstraintsExample(), ), ); } } -class MyStatelessWidget extends StatelessWidget { - const MyStatelessWidget({super.key}); +class SuffixIconConstraintsExample extends StatelessWidget { + const SuffixIconConstraintsExample({super.key}); @override Widget build(BuildContext context) { diff --git a/examples/api/lib/material/list_tile/custom_list_item.0.dart b/examples/api/lib/material/list_tile/custom_list_item.0.dart index 9c5a1172ce..891f8039a8 100644 --- a/examples/api/lib/material/list_tile/custom_list_item.0.dart +++ b/examples/api/lib/material/list_tile/custom_list_item.0.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for custom list items. - import 'package:flutter/material.dart'; +/// Flutter code sample for custom list items. + void main() => runApp(const CustomListItemApp()); class CustomListItemApp extends StatelessWidget { diff --git a/examples/api/lib/material/list_tile/custom_list_item.1.dart b/examples/api/lib/material/list_tile/custom_list_item.1.dart index 19477cd64e..d04b2614a0 100644 --- a/examples/api/lib/material/list_tile/custom_list_item.1.dart +++ b/examples/api/lib/material/list_tile/custom_list_item.1.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for custom list items. - import 'package:flutter/material.dart'; +/// Flutter code sample for custom list items. + void main() => runApp(const CustomListItemApp()); class CustomListItemApp extends StatelessWidget { diff --git a/examples/api/lib/material/list_tile/list_tile.0.dart b/examples/api/lib/material/list_tile/list_tile.0.dart index 996c6e3a5e..50e712234f 100644 --- a/examples/api/lib/material/list_tile/list_tile.0.dart +++ b/examples/api/lib/material/list_tile/list_tile.0.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [ListTile]. - import 'package:flutter/material.dart'; +/// Flutter code sample for [ListTile]. + void main() => runApp(const ListTileApp()); class ListTileApp extends StatelessWidget { @@ -86,8 +86,9 @@ class _LisTileExampleState extends State with TickerProviderStat subtitle: const Text('Tap here for Hero transition'), tileColor: Colors.cyan, onTap: () { - Navigator.push(context, MaterialPageRoute( - builder: (BuildContext context) { + Navigator.push( + context, + MaterialPageRoute(builder: (BuildContext context) { return Scaffold( appBar: AppBar(title: const Text('ListTile Hero')), body: Center( diff --git a/examples/api/lib/material/list_tile/list_tile.1.dart b/examples/api/lib/material/list_tile/list_tile.1.dart index 389977e804..3ad480ac6e 100644 --- a/examples/api/lib/material/list_tile/list_tile.1.dart +++ b/examples/api/lib/material/list_tile/list_tile.1.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [ListTile]. - import 'package:flutter/material.dart'; +/// Flutter code sample for [ListTile]. + void main() => runApp(const ListTileApp()); class ListTileApp extends StatelessWidget { @@ -67,9 +67,7 @@ class LisTileExample extends StatelessWidget { child: ListTile( leading: FlutterLogo(size: 72.0), title: Text('Three-line ListTile'), - subtitle: Text( - 'A sufficiently long subtitle warrants three lines.' - ), + subtitle: Text('A sufficiently long subtitle warrants three lines.'), trailing: Icon(Icons.more_vert), isThreeLine: true, ), diff --git a/examples/api/lib/material/list_tile/list_tile.2.dart b/examples/api/lib/material/list_tile/list_tile.2.dart index ad8a25ddef..7caa7ff4f9 100644 --- a/examples/api/lib/material/list_tile/list_tile.2.dart +++ b/examples/api/lib/material/list_tile/list_tile.2.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [ListTile]. - import 'package:flutter/material.dart'; +/// Flutter code sample for [ListTile]. + void main() => runApp(const ListTileApp()); class ListTileApp extends StatelessWidget { @@ -30,29 +30,25 @@ class ListTileExample extends StatelessWidget { body: ListView( children: const [ ListTile( - leading: CircleAvatar( - child: Text('A') - ), + leading: CircleAvatar(child: Text('A')), title: Text('Headline'), subtitle: Text('Supporting text'), trailing: Icon(Icons.favorite_rounded), ), Divider(height: 0), ListTile( - leading: CircleAvatar( - child: Text('B') - ), + leading: CircleAvatar(child: Text('B')), title: Text('Headline'), - subtitle: Text('Longer supporting text to demonstrate how the text wraps and how the leading and trailing widgets are centered vertically with the text.'), + subtitle: Text( + 'Longer supporting text to demonstrate how the text wraps and how the leading and trailing widgets are centered vertically with the text.'), trailing: Icon(Icons.favorite_rounded), ), Divider(height: 0), ListTile( - leading: CircleAvatar( - child: Text('C') - ), + leading: CircleAvatar(child: Text('C')), title: Text('Headline'), - subtitle: Text("Longer supporting text to demonstrate how the text wraps and how setting 'ListTile.isThreeLine = true' aligns leading and trailing widgets to the top vertically with the text."), + subtitle: Text( + "Longer supporting text to demonstrate how the text wraps and how setting 'ListTile.isThreeLine = true' aligns leading and trailing widgets to the top vertically with the text."), trailing: Icon(Icons.favorite_rounded), isThreeLine: true, ), diff --git a/examples/api/lib/material/list_tile/list_tile.3.dart b/examples/api/lib/material/list_tile/list_tile.3.dart index d0d47b8f7c..82f326491f 100644 --- a/examples/api/lib/material/list_tile/list_tile.3.dart +++ b/examples/api/lib/material/list_tile/list_tile.3.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [ListTile]. - import 'package:flutter/material.dart'; +/// Flutter code sample for [ListTile]. + void main() => runApp(const ListTileApp()); class ListTileApp extends StatelessWidget { diff --git a/examples/api/lib/material/list_tile/list_tile.4.dart b/examples/api/lib/material/list_tile/list_tile.4.dart index d7c2453170..9ad3494d03 100644 --- a/examples/api/lib/material/list_tile/list_tile.4.dart +++ b/examples/api/lib/material/list_tile/list_tile.4.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [ListTile]. - import 'package:flutter/material.dart'; +/// Flutter code sample for [ListTile]. + void main() => runApp(const ListTileApp()); class ListTileApp extends StatelessWidget { @@ -41,10 +41,11 @@ class _ListTileExampleState extends State { titleAlignment: titleAlignment, leading: Checkbox( value: true, - onChanged:(bool? value) { }, + onChanged: (bool? value) {}, ), title: const Text('Headline Text'), - subtitle: const Text('Tapping on the trailing widget will show a menu that allows you to change the title alignment. The title alignment is set to threeLine by default if `ThemeData.useMaterial3` is true. Otherwise, defaults to titleHeight.'), + subtitle: const Text( + 'Tapping on the trailing widget will show a menu that allows you to change the title alignment. The title alignment is set to threeLine by default if `ThemeData.useMaterial3` is true. Otherwise, defaults to titleHeight.'), trailing: PopupMenuButton( onSelected: (ListTileTitleAlignment? value) { setState(() { diff --git a/examples/api/lib/material/list_tile/list_tile.selected.0.dart b/examples/api/lib/material/list_tile/list_tile.selected.0.dart index 7ff56ac83c..513bddefc5 100644 --- a/examples/api/lib/material/list_tile/list_tile.selected.0.dart +++ b/examples/api/lib/material/list_tile/list_tile.selected.0.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [ListTile.selected]. - import 'package:flutter/material.dart'; +/// Flutter code sample for [ListTile.selected]. + void main() => runApp(const ListTileApp()); class ListTileApp extends StatelessWidget { @@ -19,6 +19,7 @@ class ListTileApp extends StatelessWidget { ); } } + class LisTileExample extends StatefulWidget { const LisTileExample({super.key}); diff --git a/examples/api/lib/material/material_state/material_state_border_side.0.dart b/examples/api/lib/material/material_state/material_state_border_side.0.dart index 4cb49e25f2..dadd03d2ab 100644 --- a/examples/api/lib/material/material_state/material_state_border_side.0.dart +++ b/examples/api/lib/material/material_state/material_state_border_side.0.dart @@ -2,39 +2,36 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [MaterialStateBorderSide]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [MaterialStateBorderSide]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const MaterialStateBorderSideExampleApp()); - static const String _title = 'Flutter Code Sample'; +class MaterialStateBorderSideExampleApp extends StatelessWidget { + const MaterialStateBorderSideExampleApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( - title: _title, home: Scaffold( - appBar: AppBar(title: const Text(_title)), + appBar: AppBar(title: const Text('MaterialStateBorderSide Sample')), body: const Center( - child: MyStatefulWidget(), + child: MaterialStateBorderSideExample(), ), ), ); } } -class MyStatefulWidget extends StatefulWidget { - const MyStatefulWidget({super.key}); +class MaterialStateBorderSideExample extends StatefulWidget { + const MaterialStateBorderSideExample({super.key}); @override - State createState() => _MyStatefulWidgetState(); + State createState() => _MaterialStateBorderSideExampleState(); } -class _MyStatefulWidgetState extends State { +class _MaterialStateBorderSideExampleState extends State { bool isSelected = true; @override diff --git a/examples/api/lib/material/material_state/material_state_mouse_cursor.0.dart b/examples/api/lib/material/material_state/material_state_mouse_cursor.0.dart index fc4af22a4b..446f8e034b 100644 --- a/examples/api/lib/material/material_state/material_state_mouse_cursor.0.dart +++ b/examples/api/lib/material/material_state/material_state_mouse_cursor.0.dart @@ -2,25 +2,22 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [MaterialStateMouseCursor]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [MaterialStateMouseCursor]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const MaterialStateMouseCursorExampleApp()); - static const String _title = 'Flutter Code Sample'; +class MaterialStateMouseCursorExampleApp extends StatelessWidget { + const MaterialStateMouseCursorExampleApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( - title: _title, home: Scaffold( - appBar: AppBar(title: const Text(_title)), + appBar: AppBar(title: const Text('MaterialStateMouseCursor Sample')), body: const Center( - child: MyStatelessWidget(), + child: MaterialStateMouseCursorExample(), ), ), ); @@ -42,8 +39,8 @@ class ListTileCursor extends MaterialStateMouseCursor { String get debugDescription => 'ListTileCursor()'; } -class MyStatelessWidget extends StatelessWidget { - const MyStatelessWidget({super.key}); +class MaterialStateMouseCursorExample extends StatelessWidget { + const MaterialStateMouseCursorExample({super.key}); @override Widget build(BuildContext context) { diff --git a/examples/api/lib/material/material_state/material_state_outlined_border.0.dart b/examples/api/lib/material/material_state/material_state_outlined_border.0.dart index 337534bd3d..525bafce7e 100644 --- a/examples/api/lib/material/material_state/material_state_outlined_border.0.dart +++ b/examples/api/lib/material/material_state/material_state_outlined_border.0.dart @@ -2,28 +2,24 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [MaterialStateOutlinedBorder]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [MaterialStateOutlinedBorder]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const MaterialStateOutlinedBorderExampleApp()); - static const String _title = 'Flutter Code Sample'; +class MaterialStateOutlinedBorderExampleApp extends StatelessWidget { + const MaterialStateOutlinedBorderExampleApp({super.key}); @override Widget build(BuildContext context) { return const MaterialApp( - title: _title, - home: MyStatefulWidget(), + home: MaterialStateOutlinedBorderExample(), ); } } -class SelectedBorder extends RoundedRectangleBorder - implements MaterialStateOutlinedBorder { +class SelectedBorder extends RoundedRectangleBorder implements MaterialStateOutlinedBorder { const SelectedBorder(); @override @@ -35,14 +31,14 @@ class SelectedBorder extends RoundedRectangleBorder } } -class MyStatefulWidget extends StatefulWidget { - const MyStatefulWidget({super.key}); +class MaterialStateOutlinedBorderExample extends StatefulWidget { + const MaterialStateOutlinedBorderExample({super.key}); @override - State createState() => _MyStatefulWidgetState(); + State createState() => _MaterialStateOutlinedBorderExampleState(); } -class _MyStatefulWidgetState extends State { +class _MaterialStateOutlinedBorderExampleState extends State { bool isSelected = true; @override diff --git a/examples/api/lib/material/material_state/material_state_property.0.dart b/examples/api/lib/material/material_state/material_state_property.0.dart index a55baeccaf..0840d583db 100644 --- a/examples/api/lib/material/material_state/material_state_property.0.dart +++ b/examples/api/lib/material/material_state/material_state_property.0.dart @@ -2,33 +2,30 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [MaterialStateProperty]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [MaterialStateProperty]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const MaterialStatePropertyExampleApp()); - static const String _title = 'Flutter Code Sample'; +class MaterialStatePropertyExampleApp extends StatelessWidget { + const MaterialStatePropertyExampleApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( - title: _title, home: Scaffold( - appBar: AppBar(title: const Text(_title)), + appBar: AppBar(title: const Text('MaterialStateProperty Sample')), body: const Center( - child: MyStatelessWidget(), + child: MaterialStatePropertyExample(), ), ), ); } } -class MyStatelessWidget extends StatelessWidget { - const MyStatelessWidget({super.key}); +class MaterialStatePropertyExample extends StatelessWidget { + const MaterialStatePropertyExample({super.key}); @override Widget build(BuildContext context) { diff --git a/examples/api/lib/material/menu_anchor/checkbox_menu_button.0.dart b/examples/api/lib/material/menu_anchor/checkbox_menu_button.0.dart index fc89517abf..6279b6e222 100644 --- a/examples/api/lib/material/menu_anchor/checkbox_menu_button.0.dart +++ b/examples/api/lib/material/menu_anchor/checkbox_menu_button.0.dart @@ -2,11 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [CheckboxMenuButton]. - import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; +/// Flutter code sample for [CheckboxMenuButton]. + void main() => runApp(const MenuApp()); class MyCheckboxMenu extends StatefulWidget { diff --git a/examples/api/lib/material/menu_anchor/menu_accelerator_label.0.dart b/examples/api/lib/material/menu_anchor/menu_accelerator_label.0.dart index 9bcb1e7dbe..16869c6c6b 100644 --- a/examples/api/lib/material/menu_anchor/menu_accelerator_label.0.dart +++ b/examples/api/lib/material/menu_anchor/menu_accelerator_label.0.dart @@ -2,11 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [MenuAcceleratorLabel]. - import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; +/// Flutter code sample for [MenuAcceleratorLabel]. + void main() => runApp(const MenuAcceleratorApp()); class MyMenuBar extends StatelessWidget { diff --git a/examples/api/lib/material/menu_anchor/menu_anchor.0.dart b/examples/api/lib/material/menu_anchor/menu_anchor.0.dart index 3edac65d9a..0b3c374525 100644 --- a/examples/api/lib/material/menu_anchor/menu_anchor.0.dart +++ b/examples/api/lib/material/menu_anchor/menu_anchor.0.dart @@ -2,11 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [MenuAnchor]. - import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; +/// Flutter code sample for [MenuAnchor]. + void main() => runApp(const MenuApp()); /// An enhanced enum to define the available menus and their shortcuts. @@ -98,16 +98,18 @@ class _MyCascadingMenuState extends State { child: Text(MenuEntry.about.label), onPressed: () => _activate(MenuEntry.about), ), - if (_showingMessage) MenuItemButton( - onPressed: () => _activate(MenuEntry.hideMessage), - shortcut: MenuEntry.hideMessage.shortcut, - child: Text(MenuEntry.hideMessage.label), - ), - if (!_showingMessage) MenuItemButton( - onPressed: () => _activate(MenuEntry.showMessage), - shortcut: MenuEntry.showMessage.shortcut, - child: Text(MenuEntry.showMessage.label), - ), + if (_showingMessage) + MenuItemButton( + onPressed: () => _activate(MenuEntry.hideMessage), + shortcut: MenuEntry.hideMessage.shortcut, + child: Text(MenuEntry.hideMessage.label), + ), + if (!_showingMessage) + MenuItemButton( + onPressed: () => _activate(MenuEntry.showMessage), + shortcut: MenuEntry.showMessage.shortcut, + child: Text(MenuEntry.showMessage.label), + ), SubmenuButton( menuChildren: [ MenuItemButton( diff --git a/examples/api/lib/material/menu_anchor/menu_anchor.1.dart b/examples/api/lib/material/menu_anchor/menu_anchor.1.dart index 32254d5905..b46509491a 100644 --- a/examples/api/lib/material/menu_anchor/menu_anchor.1.dart +++ b/examples/api/lib/material/menu_anchor/menu_anchor.1.dart @@ -2,11 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [MenuAnchor]. - import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; +/// Flutter code sample for [MenuAnchor]. + void main() => runApp(const ContextMenuApp()); /// An enhanced enum to define the available menus and their shortcuts. @@ -101,16 +101,18 @@ class _MyContextMenuState extends State { child: Text(MenuEntry.about.label), onPressed: () => _activate(MenuEntry.about), ), - if (_showingMessage) MenuItemButton( - onPressed: () => _activate(MenuEntry.hideMessage), - shortcut: MenuEntry.hideMessage.shortcut, - child: Text(MenuEntry.hideMessage.label), - ), - if (!_showingMessage) MenuItemButton( - onPressed: () => _activate(MenuEntry.showMessage), - shortcut: MenuEntry.showMessage.shortcut, - child: Text(MenuEntry.showMessage.label), - ), + if (_showingMessage) + MenuItemButton( + onPressed: () => _activate(MenuEntry.hideMessage), + shortcut: MenuEntry.hideMessage.shortcut, + child: Text(MenuEntry.hideMessage.label), + ), + if (!_showingMessage) + MenuItemButton( + onPressed: () => _activate(MenuEntry.showMessage), + shortcut: MenuEntry.showMessage.shortcut, + child: Text(MenuEntry.showMessage.label), + ), SubmenuButton( menuChildren: [ MenuItemButton( diff --git a/examples/api/lib/material/menu_anchor/menu_bar.0.dart b/examples/api/lib/material/menu_anchor/menu_bar.0.dart index da1436811a..23ccec1099 100644 --- a/examples/api/lib/material/menu_anchor/menu_bar.0.dart +++ b/examples/api/lib/material/menu_anchor/menu_bar.0.dart @@ -2,11 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [MenuBar]. - import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; +/// Flutter code sample for [MenuBar]. + void main() => runApp(const MenuBarApp()); /// A class for consolidating the definition of menu entries. diff --git a/examples/api/lib/material/menu_anchor/radio_menu_button.0.dart b/examples/api/lib/material/menu_anchor/radio_menu_button.0.dart index 6e36147d4f..20448926d3 100644 --- a/examples/api/lib/material/menu_anchor/radio_menu_button.0.dart +++ b/examples/api/lib/material/menu_anchor/radio_menu_button.0.dart @@ -2,11 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [RadioMenuButton]. - import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; +/// Flutter code sample for [RadioMenuButton]. + void main() => runApp(const MenuApp()); class MyRadioMenu extends StatefulWidget { @@ -29,10 +29,10 @@ class _MyRadioMenuState extends State { void didChangeDependencies() { super.didChangeDependencies(); _entry = ShortcutRegistry.of(context).addAll({ - _redShortcut: VoidCallbackIntent(() => _setBackgroundColor(Colors.red)), - _greenShortcut: VoidCallbackIntent(() => _setBackgroundColor(Colors.green)), - _blueShortcut: VoidCallbackIntent(() => _setBackgroundColor(Colors.blue)), - }); + _redShortcut: VoidCallbackIntent(() => _setBackgroundColor(Colors.red)), + _greenShortcut: VoidCallbackIntent(() => _setBackgroundColor(Colors.green)), + _blueShortcut: VoidCallbackIntent(() => _setBackgroundColor(Colors.blue)), + }); } @override diff --git a/examples/api/lib/material/navigation_bar/navigation_bar.0.dart b/examples/api/lib/material/navigation_bar/navigation_bar.0.dart index 422a08e1cf..689b97316b 100644 --- a/examples/api/lib/material/navigation_bar/navigation_bar.0.dart +++ b/examples/api/lib/material/navigation_bar/navigation_bar.0.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [NavigationBar]. - import 'package:flutter/material.dart'; +/// Flutter code sample for [NavigationBar]. + void main() => runApp(const NavigationBarApp()); class NavigationBarApp extends StatelessWidget { diff --git a/examples/api/lib/material/navigation_bar/navigation_bar.1.dart b/examples/api/lib/material/navigation_bar/navigation_bar.1.dart index acd3005353..edd5e2d094 100644 --- a/examples/api/lib/material/navigation_bar/navigation_bar.1.dart +++ b/examples/api/lib/material/navigation_bar/navigation_bar.1.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [NavigationBar]. - import 'package:flutter/material.dart'; +/// Flutter code sample for [NavigationBar]. + void main() => runApp(const NavigationBarApp()); class NavigationBarApp extends StatelessWidget { diff --git a/examples/api/lib/material/navigation_bar/navigation_bar.2.dart b/examples/api/lib/material/navigation_bar/navigation_bar.2.dart index e430eb410c..7af02cfe00 100644 --- a/examples/api/lib/material/navigation_bar/navigation_bar.2.dart +++ b/examples/api/lib/material/navigation_bar/navigation_bar.2.dart @@ -2,16 +2,16 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [NavigationBar] with nested [Navigator] destinations. - import 'package:flutter/material.dart'; +/// Flutter code sample for [NavigationBar] with nested [Navigator] destinations. + void main() { runApp(const MaterialApp(home: Home())); } class Home extends StatefulWidget { - const Home({ super.key }); + const Home({super.key}); @override State createState() => _HomeState(); @@ -32,10 +32,11 @@ class _HomeState extends State with TickerProviderStateMixin { int selectedIndex = 0; AnimationController buildFaderController() { - final AnimationController controller = AnimationController(vsync: this, duration: const Duration(milliseconds: 200)); + final AnimationController controller = + AnimationController(vsync: this, duration: const Duration(milliseconds: 200)); controller.addStatusListener((AnimationStatus status) { if (status == AnimationStatus.dismissed) { - setState(() { }); // Rebuild unselected destinations offstage. + setState(() {}); // Rebuild unselected destinations offstage. } }); return controller; @@ -44,8 +45,10 @@ class _HomeState extends State with TickerProviderStateMixin { @override void initState() { super.initState(); - navigatorKeys = List>.generate(allDestinations.length, (int index) => GlobalKey()).toList(); - destinationFaders = List.generate(allDestinations.length, (int index) => buildFaderController()).toList(); + navigatorKeys = + List>.generate(allDestinations.length, (int index) => GlobalKey()).toList(); + destinationFaders = + List.generate(allDestinations.length, (int index) => buildFaderController()).toList(); destinationFaders[selectedIndex].value = 1.0; destinationViews = allDestinations.map((Destination destination) { return FadeTransition( @@ -53,7 +56,7 @@ class _HomeState extends State with TickerProviderStateMixin { child: DestinationView( destination: destination, navigatorKey: navigatorKeys[destination.index], - ) + ), ); }).toList(); } @@ -126,7 +129,7 @@ class Destination { } class RootPage extends StatelessWidget { - const RootPage({ super.key, required this.destination }); + const RootPage({super.key, required this.destination}); final Destination destination; @@ -135,7 +138,9 @@ class RootPage extends StatelessWidget { title: Text('${destination.title} AlertDialog'), actions: [ TextButton( - onPressed: () { Navigator.pop(context); }, + onPressed: () { + Navigator.pop(context); + }, child: const Text('OK'), ), ], @@ -228,7 +233,7 @@ class RootPage extends StatelessWidget { } class ListPage extends StatelessWidget { - const ListPage({ super.key, required this.destination }); + const ListPage({super.key, required this.destination}); final Destination destination; @@ -255,7 +260,7 @@ class ListPage extends StatelessWidget { child: OutlinedButton( style: buttonStyle.copyWith( backgroundColor: MaterialStatePropertyAll( - Color.lerp(destination.color[100], Colors.white, index / itemCount)! + Color.lerp(destination.color[100], Colors.white, index / itemCount)!, ), ), onPressed: () { @@ -272,7 +277,7 @@ class ListPage extends StatelessWidget { } class TextPage extends StatefulWidget { - const TextPage({ super.key, required this.destination }); + const TextPage({super.key, required this.destination}); final Destination destination; @@ -349,7 +354,7 @@ class _DestinationViewState extends State { return MaterialPageRoute( settings: settings, builder: (BuildContext context) { - switch(settings.name) { + switch (settings.name) { case '/': return RootPage(destination: widget.destination); case '/list': diff --git a/examples/api/lib/material/navigation_drawer/navigation_drawer.0.dart b/examples/api/lib/material/navigation_drawer/navigation_drawer.0.dart index 5a69c74c98..446cd1308c 100644 --- a/examples/api/lib/material/navigation_drawer/navigation_drawer.0.dart +++ b/examples/api/lib/material/navigation_drawer/navigation_drawer.0.dart @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [NavigationDrawer] . - // Builds an adaptive navigation widget layout. When the screen width is less than // 450, A [NavigationBar] will be displayed. Otherwise, a [NavigationRail] will be // displayed on the left side, and also a button to open the [NavigationDrawer]. @@ -11,6 +9,8 @@ import 'package:flutter/material.dart'; +/// Flutter code sample for [NavigationDrawer]. + class ExampleDestination { const ExampleDestination(this.label, this.icon, this.selectedIcon); @@ -29,7 +29,6 @@ const List destinations = [ void main() { runApp( MaterialApp( - title: 'NavigationDrawer Example', debugShowCheckedModeBanner: false, theme: ThemeData(useMaterial3: true), home: const NavigationDrawerExample(), @@ -60,7 +59,7 @@ class _NavigationDrawerExampleState extends State { scaffoldKey.currentState!.openEndDrawer(); } - Widget buildBottomBarScaffold(){ + Widget buildBottomBarScaffold() { return Scaffold( body: Center( child: Column( @@ -77,21 +76,21 @@ class _NavigationDrawerExampleState extends State { screenIndex = index; }); }, - destinations: destinations - .map((ExampleDestination destination) { + destinations: destinations.map( + (ExampleDestination destination) { return NavigationDestination( label: destination.label, icon: destination.icon, selectedIcon: destination.selectedIcon, tooltip: destination.label, ); - }) - .toList(), + }, + ).toList(), ), ); } - Widget buildDrawerScaffold(BuildContext context){ + Widget buildDrawerScaffold(BuildContext context) { return Scaffold( key: scaffoldKey, body: SafeArea( @@ -103,15 +102,15 @@ class _NavigationDrawerExampleState extends State { padding: const EdgeInsets.symmetric(horizontal: 5), child: NavigationRail( minWidth: 50, - destinations: destinations - .map((ExampleDestination destination) { + destinations: destinations.map( + (ExampleDestination destination) { return NavigationRailDestination( label: Text(destination.label), icon: destination.icon, selectedIcon: destination.selectedIcon, ); - }) - .toList(), + }, + ).toList(), selectedIndex: screenIndex, useIndicator: true, onDestinationSelected: (int index) { @@ -148,14 +147,15 @@ class _NavigationDrawerExampleState extends State { style: Theme.of(context).textTheme.titleSmall, ), ), - ...destinations - .map((ExampleDestination destination) { + ...destinations.map( + (ExampleDestination destination) { return NavigationDrawerDestination( label: Text(destination.label), icon: destination.icon, selectedIcon: destination.selectedIcon, ); - }), + }, + ), const Padding( padding: EdgeInsets.fromLTRB(28, 16, 28, 10), child: Divider(), @@ -168,7 +168,7 @@ class _NavigationDrawerExampleState extends State { @override void didChangeDependencies() { super.didChangeDependencies(); - showNavigationDrawer = MediaQuery.of(context).size.width >= 450; + showNavigationDrawer = MediaQuery.of(context).size.width >= 450; } @override diff --git a/examples/api/lib/material/navigation_rail/navigation_rail.0.dart b/examples/api/lib/material/navigation_rail/navigation_rail.0.dart index d6ac9ad8de..fbe7f6ab8d 100644 --- a/examples/api/lib/material/navigation_rail/navigation_rail.0.dart +++ b/examples/api/lib/material/navigation_rail/navigation_rail.0.dart @@ -2,14 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [NavigationRail]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [NavigationRail]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const NavigationRailExampleApp()); + +class NavigationRailExampleApp extends StatelessWidget { + const NavigationRailExampleApp({super.key}); @override Widget build(BuildContext context) { @@ -47,19 +47,23 @@ class _NavRailExampleState extends State { }); }, labelType: labelType, - leading: showLeading ? FloatingActionButton( - elevation: 0, - onPressed: () { - // Add your onPressed code here! - }, - child: const Icon(Icons.add), - ) : const SizedBox(), - trailing: showTrailing ? IconButton( - onPressed: () { - // Add your onPressed code here! - }, - icon: const Icon(Icons.more_horiz_rounded), - ) : const SizedBox(), + leading: showLeading + ? FloatingActionButton( + elevation: 0, + onPressed: () { + // Add your onPressed code here! + }, + child: const Icon(Icons.add), + ) + : const SizedBox(), + trailing: showTrailing + ? IconButton( + onPressed: () { + // Add your onPressed code here! + }, + icon: const Icon(Icons.more_horiz_rounded), + ) + : const SizedBox(), destinations: const [ NavigationRailDestination( icon: Icon(Icons.favorite_border), @@ -80,100 +84,100 @@ class _NavRailExampleState extends State { ), const VerticalDivider(thickness: 1, width: 1), // This is the main content. - Expanded( - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Text('selectedIndex: $_selectedIndex'), - const SizedBox(height: 20), - Text('Label type: ${labelType.name}'), - const SizedBox(height: 10), - OverflowBar( - spacing: 10.0, - children: [ - ElevatedButton( - onPressed: () { - setState(() { - labelType = NavigationRailLabelType.none; - }); - }, - child: const Text('None'), - ), - ElevatedButton( - onPressed: () { - setState(() { - labelType = NavigationRailLabelType.selected; - }); - }, - child: const Text('Selected'), - ), - ElevatedButton( - onPressed: () { - setState(() { - labelType = NavigationRailLabelType.all; - }); - }, - child: const Text('All'), - ), - ], - ), - const SizedBox(height: 20), - Text('Group alignment: $groupAlignment'), - const SizedBox(height: 10), - OverflowBar( - spacing: 10.0, - children: [ - ElevatedButton( - onPressed: () { - setState(() { - groupAlignment = -1.0; - }); - }, - child: const Text('Top'), - ), - ElevatedButton( - onPressed: () { - setState(() { - groupAlignment = 0.0; - }); - }, - child: const Text('Center'), - ), - ElevatedButton( - onPressed: () { - setState(() { - groupAlignment = 1.0; - }); - }, - child: const Text('Bottom'), - ), - ], - ), - const SizedBox(height: 20), - OverflowBar( - spacing: 10.0, - children: [ - ElevatedButton( - onPressed: () { - setState(() { - showLeading = !showLeading; - }); - }, - child: Text(showLeading ? 'Hide Leading' : 'Show Leading'), - ), - ElevatedButton( - onPressed: () { - setState(() { - showTrailing = !showTrailing; - }); - }, - child: Text(showTrailing ? 'Hide Trailing' : 'Show Trailing'), - ), - ], - ), - ], - ), + Expanded( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text('selectedIndex: $_selectedIndex'), + const SizedBox(height: 20), + Text('Label type: ${labelType.name}'), + const SizedBox(height: 10), + OverflowBar( + spacing: 10.0, + children: [ + ElevatedButton( + onPressed: () { + setState(() { + labelType = NavigationRailLabelType.none; + }); + }, + child: const Text('None'), + ), + ElevatedButton( + onPressed: () { + setState(() { + labelType = NavigationRailLabelType.selected; + }); + }, + child: const Text('Selected'), + ), + ElevatedButton( + onPressed: () { + setState(() { + labelType = NavigationRailLabelType.all; + }); + }, + child: const Text('All'), + ), + ], + ), + const SizedBox(height: 20), + Text('Group alignment: $groupAlignment'), + const SizedBox(height: 10), + OverflowBar( + spacing: 10.0, + children: [ + ElevatedButton( + onPressed: () { + setState(() { + groupAlignment = -1.0; + }); + }, + child: const Text('Top'), + ), + ElevatedButton( + onPressed: () { + setState(() { + groupAlignment = 0.0; + }); + }, + child: const Text('Center'), + ), + ElevatedButton( + onPressed: () { + setState(() { + groupAlignment = 1.0; + }); + }, + child: const Text('Bottom'), + ), + ], + ), + const SizedBox(height: 20), + OverflowBar( + spacing: 10.0, + children: [ + ElevatedButton( + onPressed: () { + setState(() { + showLeading = !showLeading; + }); + }, + child: Text(showLeading ? 'Hide Leading' : 'Show Leading'), + ), + ElevatedButton( + onPressed: () { + setState(() { + showTrailing = !showTrailing; + }); + }, + child: Text(showTrailing ? 'Hide Trailing' : 'Show Trailing'), + ), + ], + ), + ], ), + ), ], ), ); diff --git a/examples/api/lib/material/navigation_rail/navigation_rail.1.dart b/examples/api/lib/material/navigation_rail/navigation_rail.1.dart index 9345d58edd..812f3341b6 100644 --- a/examples/api/lib/material/navigation_rail/navigation_rail.1.dart +++ b/examples/api/lib/material/navigation_rail/navigation_rail.1.dart @@ -2,14 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [NavigationRail]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [NavigationRail]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const NavigationRailExampleApp()); + +class NavigationRailExampleApp extends StatelessWidget { + const NavigationRailExampleApp({super.key}); @override Widget build(BuildContext context) { @@ -49,19 +49,23 @@ class _NavRailExampleState extends State { }); }, labelType: labelType, - leading: showLeading ? FloatingActionButton( - elevation: 0, - onPressed: () { - // Add your onPressed code here! - }, - child: const Icon(Icons.add), - ) : const SizedBox(), - trailing: showTrailing ? IconButton( - onPressed: () { - // Add your onPressed code here! - }, - icon: const Icon(Icons.more_horiz_rounded), - ) : const SizedBox(), + leading: showLeading + ? FloatingActionButton( + elevation: 0, + onPressed: () { + // Add your onPressed code here! + }, + child: const Icon(Icons.add), + ) + : const SizedBox(), + trailing: showTrailing + ? IconButton( + onPressed: () { + // Add your onPressed code here! + }, + icon: const Icon(Icons.more_horiz_rounded), + ) + : const SizedBox(), destinations: const [ NavigationRailDestination( icon: Icon(Icons.favorite_border), diff --git a/examples/api/lib/material/navigation_rail/navigation_rail.extended_animation.0.dart b/examples/api/lib/material/navigation_rail/navigation_rail.extended_animation.0.dart index 36f575ed5f..c2163662e3 100644 --- a/examples/api/lib/material/navigation_rail/navigation_rail.extended_animation.0.dart +++ b/examples/api/lib/material/navigation_rail/navigation_rail.extended_animation.0.dart @@ -2,16 +2,16 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [NavigationRail.extendedAnimation]. - import 'dart:ui'; import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [NavigationRail.extendedAnimation]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const ExtendedAnimationExampleApp()); + +class ExtendedAnimationExampleApp extends StatelessWidget { + const ExtendedAnimationExampleApp({super.key}); @override Widget build(BuildContext context) { diff --git a/examples/api/lib/material/outlined_button/outlined_button.0.dart b/examples/api/lib/material/outlined_button/outlined_button.0.dart index e9109bfa50..b177a70c80 100644 --- a/examples/api/lib/material/outlined_button/outlined_button.0.dart +++ b/examples/api/lib/material/outlined_button/outlined_button.0.dart @@ -2,33 +2,30 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [OutlinedButton]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [OutlinedButton]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const OutlinedButtonExampleApp()); - static const String _title = 'Flutter Code Sample'; +class OutlinedButtonExampleApp extends StatelessWidget { + const OutlinedButtonExampleApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( - title: _title, home: Scaffold( - appBar: AppBar(title: const Text(_title)), + appBar: AppBar(title: const Text('OutlinedButton Sample')), body: const Center( - child: MyStatelessWidget(), + child: OutlinedButtonExample(), ), ), ); } } -class MyStatelessWidget extends StatelessWidget { - const MyStatelessWidget({super.key}); +class OutlinedButtonExample extends StatelessWidget { + const OutlinedButtonExample({super.key}); @override Widget build(BuildContext context) { diff --git a/examples/api/lib/material/page_transitions_theme/page_transitions_theme.0.dart b/examples/api/lib/material/page_transitions_theme/page_transitions_theme.0.dart index 7283b1ff74..e541cd898d 100644 --- a/examples/api/lib/material/page_transitions_theme/page_transitions_theme.0.dart +++ b/examples/api/lib/material/page_transitions_theme/page_transitions_theme.0.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [PageTransitionsTheme]. - import 'package:flutter/material.dart'; +/// Flutter code sample for [PageTransitionsTheme]. + void main() => runApp(const PageTransitionsThemeApp()); class PageTransitionsThemeApp extends StatelessWidget { diff --git a/examples/api/lib/material/page_transitions_theme/page_transitions_theme.1.dart b/examples/api/lib/material/page_transitions_theme/page_transitions_theme.1.dart index 65454fa32a..8f106d0241 100644 --- a/examples/api/lib/material/page_transitions_theme/page_transitions_theme.1.dart +++ b/examples/api/lib/material/page_transitions_theme/page_transitions_theme.1.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [PageTransitionsTheme]. - import 'package:flutter/material.dart'; +/// Flutter code sample for [PageTransitionsTheme]. + void main() => runApp(const PageTransitionsThemeApp()); class PageTransitionsThemeApp extends StatelessWidget { diff --git a/examples/api/lib/material/platform_menu_bar/platform_menu_bar.0.dart b/examples/api/lib/material/platform_menu_bar/platform_menu_bar.0.dart index 03861768a0..5b79009a2e 100644 --- a/examples/api/lib/material/platform_menu_bar/platform_menu_bar.0.dart +++ b/examples/api/lib/material/platform_menu_bar/platform_menu_bar.0.dart @@ -2,13 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [PlatformMenuBar]. - // THIS SAMPLE ONLY WORKS ON MACOS. import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; +/// Flutter code sample for [PlatformMenuBar]. + void main() => runApp(const ExampleApp()); enum MenuSelection { @@ -126,7 +126,7 @@ class _PlatformMenuBarExampleState extends State { child: Text(_showMessage ? _message : 'This space intentionally left blank.\n' - 'Show a message here using the menu.'), + 'Show a message here using the menu.'), ), ); } diff --git a/examples/api/lib/material/popup_menu/popup_menu.0.dart b/examples/api/lib/material/popup_menu/popup_menu.0.dart index 1ceee33894..47f7c820dc 100644 --- a/examples/api/lib/material/popup_menu/popup_menu.0.dart +++ b/examples/api/lib/material/popup_menu/popup_menu.0.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [PopupMenuButton]. - import 'package:flutter/material.dart'; +/// Flutter code sample for [PopupMenuButton]. + // This is the type used by the popup menu below. enum SampleItem { itemOne, itemTwo, itemThree } diff --git a/examples/api/lib/material/popup_menu/popup_menu.1.dart b/examples/api/lib/material/popup_menu/popup_menu.1.dart index 2c0063d367..2a3a4d6a92 100644 --- a/examples/api/lib/material/popup_menu/popup_menu.1.dart +++ b/examples/api/lib/material/popup_menu/popup_menu.1.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [PopupMenuButton]. - import 'package:flutter/material.dart'; +/// Flutter code sample for [PopupMenuButton]. + // This is the type used by the popup menu below. enum SampleItem { itemOne, itemTwo, itemThree } diff --git a/examples/api/lib/material/progress_indicator/circular_progress_indicator.0.dart b/examples/api/lib/material/progress_indicator/circular_progress_indicator.0.dart index c701c8c8cd..a41036a8c4 100644 --- a/examples/api/lib/material/progress_indicator/circular_progress_indicator.0.dart +++ b/examples/api/lib/material/progress_indicator/circular_progress_indicator.0.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [CircularProgressIndicator]. - import 'package:flutter/material.dart'; +/// Flutter code sample for [CircularProgressIndicator]. + void main() => runApp(const ProgressIndicatorApp()); class ProgressIndicatorApp extends StatelessWidget { @@ -26,8 +26,7 @@ class ProgressIndicatorExample extends StatefulWidget { State createState() => _ProgressIndicatorExampleState(); } -class _ProgressIndicatorExampleState extends State - with TickerProviderStateMixin { +class _ProgressIndicatorExampleState extends State with TickerProviderStateMixin { late AnimationController controller; @override diff --git a/examples/api/lib/material/progress_indicator/circular_progress_indicator.1.dart b/examples/api/lib/material/progress_indicator/circular_progress_indicator.1.dart index eba53f6c77..6b228f89e2 100644 --- a/examples/api/lib/material/progress_indicator/circular_progress_indicator.1.dart +++ b/examples/api/lib/material/progress_indicator/circular_progress_indicator.1.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [CircularProgressIndicator]. - import 'package:flutter/material.dart'; +/// Flutter code sample for [CircularProgressIndicator]. + void main() => runApp(const ProgressIndicatorApp()); class ProgressIndicatorApp extends StatelessWidget { @@ -27,8 +27,7 @@ class ProgressIndicatorExample extends StatefulWidget { State createState() => _ProgressIndicatorExampleState(); } -class _ProgressIndicatorExampleState extends State - with TickerProviderStateMixin { +class _ProgressIndicatorExampleState extends State with TickerProviderStateMixin { late AnimationController controller; bool determinate = false; @@ -86,7 +85,9 @@ class _ProgressIndicatorExampleState extends State if (determinate) { controller.stop(); } else { - controller..forward(from: controller.value)..repeat(); + controller + ..forward(from: controller.value) + ..repeat(); } }); }, diff --git a/examples/api/lib/material/progress_indicator/linear_progress_indicator.0.dart b/examples/api/lib/material/progress_indicator/linear_progress_indicator.0.dart index 81d5271210..7e2e7c3587 100644 --- a/examples/api/lib/material/progress_indicator/linear_progress_indicator.0.dart +++ b/examples/api/lib/material/progress_indicator/linear_progress_indicator.0.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [LinearProgressIndicator]. - import 'package:flutter/material.dart'; +/// Flutter code sample for [LinearProgressIndicator]. + void main() => runApp(const ProgressIndicatorApp()); class ProgressIndicatorApp extends StatelessWidget { @@ -26,8 +26,7 @@ class ProgressIndicatorExample extends StatefulWidget { State createState() => _ProgressIndicatorExampleState(); } -class _ProgressIndicatorExampleState extends State - with TickerProviderStateMixin { +class _ProgressIndicatorExampleState extends State with TickerProviderStateMixin { late AnimationController controller; @override diff --git a/examples/api/lib/material/progress_indicator/linear_progress_indicator.1.dart b/examples/api/lib/material/progress_indicator/linear_progress_indicator.1.dart index 4fff2efb37..9a954e46eb 100644 --- a/examples/api/lib/material/progress_indicator/linear_progress_indicator.1.dart +++ b/examples/api/lib/material/progress_indicator/linear_progress_indicator.1.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [LinearProgressIndicator]. - import 'package:flutter/material.dart'; +/// Flutter code sample for [LinearProgressIndicator]. + void main() => runApp(const ProgressIndicatorApp()); class ProgressIndicatorApp extends StatelessWidget { @@ -27,8 +27,7 @@ class ProgressIndicatorExample extends StatefulWidget { State createState() => _ProgressIndicatorExampleState(); } -class _ProgressIndicatorExampleState extends State - with TickerProviderStateMixin { +class _ProgressIndicatorExampleState extends State with TickerProviderStateMixin { late AnimationController controller; bool determinate = false; @@ -86,7 +85,9 @@ class _ProgressIndicatorExampleState extends State if (determinate) { controller.stop(); } else { - controller..forward(from: controller.value)..repeat(); + controller + ..forward(from: controller.value) + ..repeat(); } }); }, diff --git a/examples/api/lib/material/radio/radio.0.dart b/examples/api/lib/material/radio/radio.0.dart index f0374c5dba..4797a6f7d9 100644 --- a/examples/api/lib/material/radio/radio.0.dart +++ b/examples/api/lib/material/radio/radio.0.dart @@ -2,25 +2,22 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [Radio]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [Radio]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const RadioExampleApp()); - static const String _title = 'Flutter Code Sample'; +class RadioExampleApp extends StatelessWidget { + const RadioExampleApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( - title: _title, home: Scaffold( - appBar: AppBar(title: const Text(_title)), + appBar: AppBar(title: const Text('Radio Sample')), body: const Center( - child: MyStatefulWidget(), + child: RadioExample(), ), ), ); @@ -29,14 +26,14 @@ class MyApp extends StatelessWidget { enum SingingCharacter { lafayette, jefferson } -class MyStatefulWidget extends StatefulWidget { - const MyStatefulWidget({super.key}); +class RadioExample extends StatefulWidget { + const RadioExample({super.key}); @override - State createState() => _MyStatefulWidgetState(); + State createState() => _RadioExampleState(); } -class _MyStatefulWidgetState extends State { +class _RadioExampleState extends State { SingingCharacter? _character = SingingCharacter.lafayette; @override diff --git a/examples/api/lib/material/radio/radio.toggleable.0.dart b/examples/api/lib/material/radio/radio.toggleable.0.dart index 3ae99d1917..fbe38a677f 100644 --- a/examples/api/lib/material/radio/radio.toggleable.0.dart +++ b/examples/api/lib/material/radio/radio.toggleable.0.dart @@ -2,37 +2,34 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [Radio.toggleable]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [Radio.toggleable]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const ToggleableExampleApp()); - static const String _title = 'Flutter Code Sample'; +class ToggleableExampleApp extends StatelessWidget { + const ToggleableExampleApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( - title: _title, home: Scaffold( - appBar: AppBar(title: const Text(_title)), - body: const MyStatefulWidget(), + appBar: AppBar(title: const Text('Radio Sample')), + body: const ToggleableExample(), ), ); } } -class MyStatefulWidget extends StatefulWidget { - const MyStatefulWidget({super.key}); +class ToggleableExample extends StatefulWidget { + const ToggleableExample({super.key}); @override - State createState() => _MyStatefulWidgetState(); + State createState() => _ToggleableExampleState(); } -class _MyStatefulWidgetState extends State { +class _ToggleableExampleState extends State { int? groupValue; static const List selections = [ 'Hercules Mulligan', diff --git a/examples/api/lib/material/radio_list_tile/custom_labeled_radio.0.dart b/examples/api/lib/material/radio_list_tile/custom_labeled_radio.0.dart index 4080992c0d..80061a3713 100644 --- a/examples/api/lib/material/radio_list_tile/custom_labeled_radio.0.dart +++ b/examples/api/lib/material/radio_list_tile/custom_labeled_radio.0.dart @@ -2,12 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for custom labeled radio. - import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; +/// Flutter code sample for custom labeled radio. + void main() => runApp(const LabeledRadioApp()); class LabeledRadioApp extends StatelessWidget { diff --git a/examples/api/lib/material/radio_list_tile/custom_labeled_radio.1.dart b/examples/api/lib/material/radio_list_tile/custom_labeled_radio.1.dart index 4ca903a3b1..1eaabbc809 100644 --- a/examples/api/lib/material/radio_list_tile/custom_labeled_radio.1.dart +++ b/examples/api/lib/material/radio_list_tile/custom_labeled_radio.1.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for custom labeled radio. - import 'package:flutter/material.dart'; +/// Flutter code sample for custom labeled radio. + void main() => runApp(const LabeledRadioApp()); class LabeledRadioApp extends StatelessWidget { diff --git a/examples/api/lib/material/radio_list_tile/radio_list_tile.0.dart b/examples/api/lib/material/radio_list_tile/radio_list_tile.0.dart index 01ed63968b..f54f252666 100644 --- a/examples/api/lib/material/radio_list_tile/radio_list_tile.0.dart +++ b/examples/api/lib/material/radio_list_tile/radio_list_tile.0.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [RadioListTile]. - import 'package:flutter/material.dart'; +/// Flutter code sample for [RadioListTile]. + void main() => runApp(const RadioListTileApp()); class RadioListTileApp extends StatelessWidget { diff --git a/examples/api/lib/material/radio_list_tile/radio_list_tile.1.dart b/examples/api/lib/material/radio_list_tile/radio_list_tile.1.dart index dc0db0ab61..116655320c 100644 --- a/examples/api/lib/material/radio_list_tile/radio_list_tile.1.dart +++ b/examples/api/lib/material/radio_list_tile/radio_list_tile.1.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [RadioListTile]. - import 'package:flutter/material.dart'; +/// Flutter code sample for [RadioListTile]. + void main() => runApp(const RadioListTileApp()); class RadioListTileApp extends StatelessWidget { @@ -58,7 +58,8 @@ class _RadioListTileExampleState extends State { }); }, title: const Text('Tomato'), - subtitle: const Text('Longer supporting text to demonstrate how the text wraps and the radio is centered vertically with the text.'), + subtitle: const Text( + 'Longer supporting text to demonstrate how the text wraps and the radio is centered vertically with the text.'), ), RadioListTile( value: Groceries.lettuce, @@ -69,7 +70,8 @@ class _RadioListTileExampleState extends State { }); }, title: const Text('Lettuce'), - subtitle: const Text("Longer supporting text to demonstrate how the text wraps and how setting 'RadioListTile.isThreeLine = true' aligns the radio to the top vertically with the text."), + subtitle: const Text( + "Longer supporting text to demonstrate how the text wraps and how setting 'RadioListTile.isThreeLine = true' aligns the radio to the top vertically with the text."), isThreeLine: true, ), ], diff --git a/examples/api/lib/material/radio_list_tile/radio_list_tile.toggleable.0.dart b/examples/api/lib/material/radio_list_tile/radio_list_tile.toggleable.0.dart index 70ada4ffac..6fdb158243 100644 --- a/examples/api/lib/material/radio_list_tile/radio_list_tile.toggleable.0.dart +++ b/examples/api/lib/material/radio_list_tile/radio_list_tile.toggleable.0.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [RadioListTile.toggleable]. - import 'package:flutter/material.dart'; +/// Flutter code sample for [RadioListTile.toggleable]. + void main() => runApp(const RadioListTileApp()); class RadioListTileApp extends StatelessWidget { diff --git a/examples/api/lib/material/range_slider/range_slider.0.dart b/examples/api/lib/material/range_slider/range_slider.0.dart index 3d7ecc9b27..31301e3aa3 100644 --- a/examples/api/lib/material/range_slider/range_slider.0.dart +++ b/examples/api/lib/material/range_slider/range_slider.0.dart @@ -2,37 +2,34 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [RangeSlider]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [RangeSlider]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const RangeSliderExampleApp()); - static const String _title = 'Flutter Code Sample'; +class RangeSliderExampleApp extends StatelessWidget { + const RangeSliderExampleApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( - title: _title, home: Scaffold( - appBar: AppBar(title: const Text(_title)), - body: const MyStatefulWidget(), + appBar: AppBar(title: const Text('RangeSlider Sample')), + body: const RangeSliderExample(), ), ); } } -class MyStatefulWidget extends StatefulWidget { - const MyStatefulWidget({super.key}); +class RangeSliderExample extends StatefulWidget { + const RangeSliderExample({super.key}); @override - State createState() => _MyStatefulWidgetState(); + State createState() => _RangeSliderExampleState(); } -class _MyStatefulWidgetState extends State { +class _RangeSliderExampleState extends State { RangeValues _currentRangeValues = const RangeValues(40, 80); @override diff --git a/examples/api/lib/material/refresh_indicator/refresh_indicator.0.dart b/examples/api/lib/material/refresh_indicator/refresh_indicator.0.dart index 8db00f32ae..78d6fb5fdc 100644 --- a/examples/api/lib/material/refresh_indicator/refresh_indicator.0.dart +++ b/examples/api/lib/material/refresh_indicator/refresh_indicator.0.dart @@ -2,14 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [RefreshIndicator]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [RefreshIndicator]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const RefreshIndicatorExampleApp()); + +class RefreshIndicatorExampleApp extends StatelessWidget { + const RefreshIndicatorExampleApp({super.key}); @override Widget build(BuildContext context) { @@ -27,8 +27,7 @@ class RefreshIndicatorExample extends StatefulWidget { } class _RefreshIndicatorExampleState extends State { - final GlobalKey _refreshIndicatorKey = - GlobalKey(); + final GlobalKey _refreshIndicatorKey = GlobalKey(); @override Widget build(BuildContext context) { diff --git a/examples/api/lib/material/refresh_indicator/refresh_indicator.1.dart b/examples/api/lib/material/refresh_indicator/refresh_indicator.1.dart index 6f0172210f..aec46093c8 100644 --- a/examples/api/lib/material/refresh_indicator/refresh_indicator.1.dart +++ b/examples/api/lib/material/refresh_indicator/refresh_indicator.1.dart @@ -2,14 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [RefreshIndicator]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [RefreshIndicator]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const RefreshIndicatorExampleApp()); + +class RefreshIndicatorExampleApp extends StatelessWidget { + const RefreshIndicatorExampleApp({super.key}); @override Widget build(BuildContext context) { diff --git a/examples/api/lib/material/reorderable_list/reorderable_list_view.0.dart b/examples/api/lib/material/reorderable_list/reorderable_list_view.0.dart index 60b0a9caff..e5a798eb7a 100644 --- a/examples/api/lib/material/reorderable_list/reorderable_list_view.0.dart +++ b/examples/api/lib/material/reorderable_list/reorderable_list_view.0.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [ReorderableListView]. - import 'package:flutter/material.dart'; +/// Flutter code sample for [ReorderableListView]. + void main() => runApp(const ReorderableApp()); class ReorderableApp extends StatelessWidget { @@ -26,10 +26,10 @@ class ReorderableExample extends StatefulWidget { const ReorderableExample({super.key}); @override - State createState() => _MyStatefulWidgetState(); + State createState() => _ReorderableListViewExampleState(); } -class _MyStatefulWidgetState extends State { +class _ReorderableListViewExampleState extends State { final List _items = List.generate(50, (int index) => index); @override diff --git a/examples/api/lib/material/reorderable_list/reorderable_list_view.1.dart b/examples/api/lib/material/reorderable_list/reorderable_list_view.1.dart index 3ad16a75af..9f48920371 100644 --- a/examples/api/lib/material/reorderable_list/reorderable_list_view.1.dart +++ b/examples/api/lib/material/reorderable_list/reorderable_list_view.1.dart @@ -2,11 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [ReorderableListView]. import 'dart:ui'; import 'package:flutter/material.dart'; +/// Flutter code sample for [ReorderableListView]. + void main() => runApp(const ReorderableApp()); class ReorderableApp extends StatelessWidget { diff --git a/examples/api/lib/material/reorderable_list/reorderable_list_view.build_default_drag_handles.0.dart b/examples/api/lib/material/reorderable_list/reorderable_list_view.build_default_drag_handles.0.dart index 1701325f50..6fa001366f 100644 --- a/examples/api/lib/material/reorderable_list/reorderable_list_view.build_default_drag_handles.0.dart +++ b/examples/api/lib/material/reorderable_list/reorderable_list_view.build_default_drag_handles.0.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [ReorderableListView.buildDefaultDragHandles]. - import 'package:flutter/material.dart'; +/// Flutter code sample for [ReorderableListView.buildDefaultDragHandles]. + void main() => runApp(const ReorderableApp()); class ReorderableApp extends StatelessWidget { diff --git a/examples/api/lib/material/reorderable_list/reorderable_list_view.reorderable_list_view_builder.0.dart b/examples/api/lib/material/reorderable_list/reorderable_list_view.reorderable_list_view_builder.0.dart index 3df8bc128e..2647a754a0 100644 --- a/examples/api/lib/material/reorderable_list/reorderable_list_view.reorderable_list_view_builder.0.dart +++ b/examples/api/lib/material/reorderable_list/reorderable_list_view.reorderable_list_view_builder.0.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [ReorderableListView.ReorderableListView.builder]. - import 'package:flutter/material.dart'; +/// Flutter code sample for [ReorderableListView.ReorderableListView.builder]. + void main() => runApp(const ReorderableApp()); class ReorderableApp extends StatelessWidget { diff --git a/examples/api/lib/material/scaffold/scaffold.0.dart b/examples/api/lib/material/scaffold/scaffold.0.dart index edc73ec39d..6513333709 100644 --- a/examples/api/lib/material/scaffold/scaffold.0.dart +++ b/examples/api/lib/material/scaffold/scaffold.0.dart @@ -2,34 +2,31 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [Scaffold]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [Scaffold]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const ScaffoldExampleApp()); - static const String _title = 'Flutter Code Sample'; +class ScaffoldExampleApp extends StatelessWidget { + const ScaffoldExampleApp({super.key}); @override Widget build(BuildContext context) { return const MaterialApp( - title: _title, - home: MyStatefulWidget(), + home: ScaffoldExample(), ); } } -class MyStatefulWidget extends StatefulWidget { - const MyStatefulWidget({super.key}); +class ScaffoldExample extends StatefulWidget { + const ScaffoldExample({super.key}); @override - State createState() => _MyStatefulWidgetState(); + State createState() => _ScaffoldExampleState(); } -class _MyStatefulWidgetState extends State { +class _ScaffoldExampleState extends State { int _count = 0; @override diff --git a/examples/api/lib/material/scaffold/scaffold.1.dart b/examples/api/lib/material/scaffold/scaffold.1.dart index 74cb69509f..c0cadf7a0f 100644 --- a/examples/api/lib/material/scaffold/scaffold.1.dart +++ b/examples/api/lib/material/scaffold/scaffold.1.dart @@ -2,34 +2,31 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [Scaffold]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [Scaffold]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const ScaffoldExampleApp()); - static const String _title = 'Flutter Code Sample'; +class ScaffoldExampleApp extends StatelessWidget { + const ScaffoldExampleApp({super.key}); @override Widget build(BuildContext context) { return const MaterialApp( - title: _title, - home: MyStatefulWidget(), + home: ScaffoldExample(), ); } } -class MyStatefulWidget extends StatefulWidget { - const MyStatefulWidget({super.key}); +class ScaffoldExample extends StatefulWidget { + const ScaffoldExample({super.key}); @override - State createState() => _MyStatefulWidgetState(); + State createState() => _ScaffoldExampleState(); } -class _MyStatefulWidgetState extends State { +class _ScaffoldExampleState extends State { int _count = 0; @override diff --git a/examples/api/lib/material/scaffold/scaffold.2.dart b/examples/api/lib/material/scaffold/scaffold.2.dart index 98caab4513..147628b716 100644 --- a/examples/api/lib/material/scaffold/scaffold.2.dart +++ b/examples/api/lib/material/scaffold/scaffold.2.dart @@ -2,34 +2,31 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [Scaffold]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [Scaffold]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const ScaffoldExampleApp()); - static const String _title = 'Flutter Code Sample'; +class ScaffoldExampleApp extends StatelessWidget { + const ScaffoldExampleApp({super.key}); @override Widget build(BuildContext context) { return const MaterialApp( - title: _title, - home: MyStatefulWidget(), + home: ScaffoldExample(), ); } } -class MyStatefulWidget extends StatefulWidget { - const MyStatefulWidget({super.key}); +class ScaffoldExample extends StatefulWidget { + const ScaffoldExample({super.key}); @override - State createState() => _MyStatefulWidgetState(); + State createState() => _ScaffoldExampleState(); } -class _MyStatefulWidgetState extends State { +class _ScaffoldExampleState extends State { int _count = 0; @override diff --git a/examples/api/lib/material/scaffold/scaffold.drawer.0.dart b/examples/api/lib/material/scaffold/scaffold.drawer.0.dart index 38e48f8733..2731f47723 100644 --- a/examples/api/lib/material/scaffold/scaffold.drawer.0.dart +++ b/examples/api/lib/material/scaffold/scaffold.drawer.0.dart @@ -2,34 +2,31 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [Scaffold.drawer]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [Scaffold.drawer]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const DrawerExampleApp()); - static const String _title = 'Flutter Code Sample'; +class DrawerExampleApp extends StatelessWidget { + const DrawerExampleApp({super.key}); @override Widget build(BuildContext context) { return const MaterialApp( - title: _title, - home: MyStatefulWidget(), + home: DrawerExample(), ); } } -class MyStatefulWidget extends StatefulWidget { - const MyStatefulWidget({super.key}); +class DrawerExample extends StatefulWidget { + const DrawerExample({super.key}); @override - State createState() => _MyStatefulWidgetState(); + State createState() => _DrawerExampleState(); } -class _MyStatefulWidgetState extends State { +class _DrawerExampleState extends State { final GlobalKey _scaffoldKey = GlobalKey(); void _openDrawer() { diff --git a/examples/api/lib/material/scaffold/scaffold.end_drawer.0.dart b/examples/api/lib/material/scaffold/scaffold.end_drawer.0.dart index 76862e016c..8d3cbe140e 100644 --- a/examples/api/lib/material/scaffold/scaffold.end_drawer.0.dart +++ b/examples/api/lib/material/scaffold/scaffold.end_drawer.0.dart @@ -2,34 +2,31 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [Scaffold.endDrawer]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [Scaffold.endDrawer]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const EndDrawerExampleApp()); - static const String _title = 'Flutter Code Sample'; +class EndDrawerExampleApp extends StatelessWidget { + const EndDrawerExampleApp({super.key}); @override Widget build(BuildContext context) { return const MaterialApp( - title: _title, - home: MyStatefulWidget(), + home: EndDrawerExample(), ); } } -class MyStatefulWidget extends StatefulWidget { - const MyStatefulWidget({super.key}); +class EndDrawerExample extends StatefulWidget { + const EndDrawerExample({super.key}); @override - State createState() => _MyStatefulWidgetState(); + State createState() => _EndDrawerExampleState(); } -class _MyStatefulWidgetState extends State { +class _EndDrawerExampleState extends State { final GlobalKey _scaffoldKey = GlobalKey(); void _openEndDrawer() { diff --git a/examples/api/lib/material/scaffold/scaffold.of.0.dart b/examples/api/lib/material/scaffold/scaffold.of.0.dart index 6b7ed6604c..88eb72ff35 100644 --- a/examples/api/lib/material/scaffold/scaffold.of.0.dart +++ b/examples/api/lib/material/scaffold/scaffold.of.0.dart @@ -2,20 +2,19 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [Scaffold.of]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [Scaffold.of]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const OfExampleApp()); + +class OfExampleApp extends StatelessWidget { + const OfExampleApp({super.key}); // This widget is the root of your application. @override Widget build(BuildContext context) { return MaterialApp( - title: 'Flutter Code Sample for Scaffold.of.', theme: ThemeData( primarySwatch: Colors.blue, ), diff --git a/examples/api/lib/material/scaffold/scaffold.of.1.dart b/examples/api/lib/material/scaffold/scaffold.of.1.dart index 7dee0f8c83..10fd675df6 100644 --- a/examples/api/lib/material/scaffold/scaffold.of.1.dart +++ b/examples/api/lib/material/scaffold/scaffold.of.1.dart @@ -2,28 +2,25 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [Scaffold.of]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [Scaffold.of]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const OfExampleApp()); - static const String _title = 'Flutter Code Sample'; +class OfExampleApp extends StatelessWidget { + const OfExampleApp({super.key}); @override Widget build(BuildContext context) { return const MaterialApp( - title: _title, - home: MyStatelessWidget(), + home: OfExample(), ); } } -class MyStatelessWidget extends StatelessWidget { - const MyStatelessWidget({super.key}); +class OfExample extends StatelessWidget { + const OfExample({super.key}); @override Widget build(BuildContext context) { diff --git a/examples/api/lib/material/scaffold/scaffold_messenger.0.dart b/examples/api/lib/material/scaffold/scaffold_messenger.0.dart index bf52cc68b3..2e003a0438 100644 --- a/examples/api/lib/material/scaffold/scaffold_messenger.0.dart +++ b/examples/api/lib/material/scaffold/scaffold_messenger.0.dart @@ -2,33 +2,30 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [ScaffoldMessenger]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [ScaffoldMessenger]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const ScaffoldMessengerExampleApp()); - static const String _title = 'Flutter Code Sample'; +class ScaffoldMessengerExampleApp extends StatelessWidget { + const ScaffoldMessengerExampleApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( - title: _title, home: Scaffold( - appBar: AppBar(title: const Text(_title)), + appBar: AppBar(title: const Text('ScaffoldMessenger Sample')), body: const Center( - child: MyStatelessWidget(), + child: ScaffoldMessengerExample(), ), ), ); } } -class MyStatelessWidget extends StatelessWidget { - const MyStatelessWidget({super.key}); +class ScaffoldMessengerExample extends StatelessWidget { + const ScaffoldMessengerExample({super.key}); @override Widget build(BuildContext context) { diff --git a/examples/api/lib/material/scaffold/scaffold_messenger.of.0.dart b/examples/api/lib/material/scaffold/scaffold_messenger.of.0.dart index 51644425e8..7c951f1c98 100644 --- a/examples/api/lib/material/scaffold/scaffold_messenger.of.0.dart +++ b/examples/api/lib/material/scaffold/scaffold_messenger.of.0.dart @@ -2,33 +2,30 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [ScaffoldMessenger.of]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [ScaffoldMessenger.of]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const OfExampleApp()); - static const String _title = 'Flutter Code Sample'; +class OfExampleApp extends StatelessWidget { + const OfExampleApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( - title: _title, home: Scaffold( - appBar: AppBar(title: const Text(_title)), + appBar: AppBar(title: const Text('ScaffoldMessenger.of Sample')), body: const Center( - child: MyStatelessWidget(), + child: OfExample(), ), ), ); } } -class MyStatelessWidget extends StatelessWidget { - const MyStatelessWidget({super.key}); +class OfExample extends StatelessWidget { + const OfExample({super.key}); @override Widget build(BuildContext context) { diff --git a/examples/api/lib/material/scaffold/scaffold_messenger.of.1.dart b/examples/api/lib/material/scaffold/scaffold_messenger.of.1.dart index bcd59be48e..f0b04db36c 100644 --- a/examples/api/lib/material/scaffold/scaffold_messenger.of.1.dart +++ b/examples/api/lib/material/scaffold/scaffold_messenger.of.1.dart @@ -2,22 +2,21 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [ScaffoldMessenger.of]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [ScaffoldMessenger.of]. -class MyApp extends StatefulWidget { - const MyApp({super.key}); +void main() => runApp(const OfExampleApp()); + +class OfExampleApp extends StatefulWidget { + const OfExampleApp({super.key}); @override - State createState() => _MyAppState(); + State createState() => _OfExampleAppState(); } -class _MyAppState extends State { - final GlobalKey _scaffoldMessengerKey = - GlobalKey(); +class _OfExampleAppState extends State { + final GlobalKey _scaffoldMessengerKey = GlobalKey(); int _counter = 0; void _incrementCounter() { diff --git a/examples/api/lib/material/scaffold/scaffold_messenger_state.show_material_banner.0.dart b/examples/api/lib/material/scaffold/scaffold_messenger_state.show_material_banner.0.dart index dd801d4116..e98de5d6db 100644 --- a/examples/api/lib/material/scaffold/scaffold_messenger_state.show_material_banner.0.dart +++ b/examples/api/lib/material/scaffold/scaffold_messenger_state.show_material_banner.0.dart @@ -2,33 +2,30 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [ScaffoldMessengerState.showMaterialBanner]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [ScaffoldMessengerState.showMaterialBanner]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const ShowMaterialBannerExampleApp()); - static const String _title = 'Flutter Code Sample'; +class ShowMaterialBannerExampleApp extends StatelessWidget { + const ShowMaterialBannerExampleApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( - title: _title, home: Scaffold( - appBar: AppBar(title: const Text(_title)), + appBar: AppBar(title: const Text('ScaffoldMessengerState Sample')), body: const Center( - child: MyStatelessWidget(), + child: ShowMaterialBannerExample(), ), ), ); } } -class MyStatelessWidget extends StatelessWidget { - const MyStatelessWidget({super.key}); +class ShowMaterialBannerExample extends StatelessWidget { + const ShowMaterialBannerExample({super.key}); @override Widget build(BuildContext context) { diff --git a/examples/api/lib/material/scaffold/scaffold_messenger_state.show_snack_bar.0.dart b/examples/api/lib/material/scaffold/scaffold_messenger_state.show_snack_bar.0.dart index b522c4bf1e..2f98624e83 100644 --- a/examples/api/lib/material/scaffold/scaffold_messenger_state.show_snack_bar.0.dart +++ b/examples/api/lib/material/scaffold/scaffold_messenger_state.show_snack_bar.0.dart @@ -2,33 +2,30 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [ScaffoldMessengerState.showSnackBar]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [ScaffoldMessengerState.showSnackBar]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const ShowSnackBarExampleApp()); - static const String _title = 'Flutter Code Sample'; +class ShowSnackBarExampleApp extends StatelessWidget { + const ShowSnackBarExampleApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( - title: _title, home: Scaffold( - appBar: AppBar(title: const Text(_title)), + appBar: AppBar(title: const Text('ScaffoldMessengerState Sample')), body: const Center( - child: MyStatelessWidget(), + child: ShowSnackBarExample(), ), ), ); } } -class MyStatelessWidget extends StatelessWidget { - const MyStatelessWidget({super.key}); +class ShowSnackBarExample extends StatelessWidget { + const ShowSnackBarExample({super.key}); @override Widget build(BuildContext context) { diff --git a/examples/api/lib/material/scaffold/scaffold_messenger_state.show_snack_bar.1.dart b/examples/api/lib/material/scaffold/scaffold_messenger_state.show_snack_bar.1.dart index e242a68b55..2f4229f446 100644 --- a/examples/api/lib/material/scaffold/scaffold_messenger_state.show_snack_bar.1.dart +++ b/examples/api/lib/material/scaffold/scaffold_messenger_state.show_snack_bar.1.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [SnackBar]. - import 'package:flutter/material.dart'; +/// Flutter code sample for [SnackBar]. + void main() => runApp(const SnackBarApp()); class SnackBarApp extends StatelessWidget { diff --git a/examples/api/lib/material/scaffold/scaffold_state.show_bottom_sheet.0.dart b/examples/api/lib/material/scaffold/scaffold_state.show_bottom_sheet.0.dart index f77f60973b..c84cd0e6d2 100644 --- a/examples/api/lib/material/scaffold/scaffold_state.show_bottom_sheet.0.dart +++ b/examples/api/lib/material/scaffold/scaffold_state.show_bottom_sheet.0.dart @@ -2,31 +2,28 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [ScaffoldState.showBottomSheet]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [ScaffoldState.showBottomSheet]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const ShowBottomSheetExampleApp()); - static const String _title = 'Flutter Code Sample'; +class ShowBottomSheetExampleApp extends StatelessWidget { + const ShowBottomSheetExampleApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( - title: _title, home: Scaffold( - appBar: AppBar(title: const Text(_title)), - body: const MyStatelessWidget(), + appBar: AppBar(title: const Text('ScaffoldState Sample')), + body: const ShowBottomSheetExample(), ), ); } } -class MyStatelessWidget extends StatelessWidget { - const MyStatelessWidget({super.key}); +class ShowBottomSheetExample extends StatelessWidget { + const ShowBottomSheetExample({super.key}); @override Widget build(BuildContext context) { diff --git a/examples/api/lib/material/scaffold/scaffold_state.show_snack_bar.0.dart b/examples/api/lib/material/scaffold/scaffold_state.show_snack_bar.0.dart index d3cc78da11..0f077982b9 100644 --- a/examples/api/lib/material/scaffold/scaffold_state.show_snack_bar.0.dart +++ b/examples/api/lib/material/scaffold/scaffold_state.show_snack_bar.0.dart @@ -2,33 +2,30 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [ScaffoldState.showSnackBar]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [ScaffoldState.showSnackBar]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const ShowSnackBarExampleApp()); - static const String _title = 'Flutter Code Sample'; +class ShowSnackBarExampleApp extends StatelessWidget { + const ShowSnackBarExampleApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( - title: _title, home: Scaffold( - appBar: AppBar(title: const Text(_title)), + appBar: AppBar(title: const Text('ScaffoldState Sample')), body: const Center( - child: MyStatelessWidget(), + child: ShowSnackBarExample(), ), ), ); } } -class MyStatelessWidget extends StatelessWidget { - const MyStatelessWidget({super.key}); +class ShowSnackBarExample extends StatelessWidget { + const ShowSnackBarExample({super.key}); @override Widget build(BuildContext context) { diff --git a/examples/api/lib/material/scrollbar/scrollbar.0.dart b/examples/api/lib/material/scrollbar/scrollbar.0.dart index 0ba5d0ecd6..d8a09486b6 100644 --- a/examples/api/lib/material/scrollbar/scrollbar.0.dart +++ b/examples/api/lib/material/scrollbar/scrollbar.0.dart @@ -2,39 +2,35 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [Scrollbar]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [Scrollbar]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const ScrollbarExampleApp()); - static const String _title = 'Flutter Code Sample'; +class ScrollbarExampleApp extends StatelessWidget { + const ScrollbarExampleApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( - title: _title, home: Scaffold( - appBar: AppBar(title: const Text(_title)), - body: const MyStatelessWidget(), + appBar: AppBar(title: const Text('Scrollbar Sample')), + body: const ScrollbarExample(), ), ); } } -class MyStatelessWidget extends StatelessWidget { - const MyStatelessWidget({super.key}); +class ScrollbarExample extends StatelessWidget { + const ScrollbarExample({super.key}); @override Widget build(BuildContext context) { return Scrollbar( child: GridView.builder( itemCount: 120, - gridDelegate: - const SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 3), + gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 3), itemBuilder: (BuildContext context, int index) { return Center( child: Text('item $index'), diff --git a/examples/api/lib/material/scrollbar/scrollbar.1.dart b/examples/api/lib/material/scrollbar/scrollbar.1.dart index 2b70362554..52491ca999 100644 --- a/examples/api/lib/material/scrollbar/scrollbar.1.dart +++ b/examples/api/lib/material/scrollbar/scrollbar.1.dart @@ -2,37 +2,34 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [Scrollbar]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [Scrollbar]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const ScrollbarExampleApp()); - static const String _title = 'Flutter Code Sample'; +class ScrollbarExampleApp extends StatelessWidget { + const ScrollbarExampleApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( - title: _title, home: Scaffold( - appBar: AppBar(title: const Text(_title)), - body: const MyStatefulWidget(), + appBar: AppBar(title: const Text('Scrollbar Sample')), + body: const ScrollbarExample(), ), ); } } -class MyStatefulWidget extends StatefulWidget { - const MyStatefulWidget({super.key}); +class ScrollbarExample extends StatefulWidget { + const ScrollbarExample({super.key}); @override - State createState() => _MyStatefulWidgetState(); + State createState() => _ScrollbarExampleState(); } -class _MyStatefulWidgetState extends State { +class _ScrollbarExampleState extends State { final ScrollController _controllerOne = ScrollController(); @override @@ -43,8 +40,7 @@ class _MyStatefulWidgetState extends State { child: GridView.builder( controller: _controllerOne, itemCount: 120, - gridDelegate: - const SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 3), + gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 3), itemBuilder: (BuildContext context, int index) { return Center( child: Text('item $index'), diff --git a/examples/api/lib/material/search_anchor/search_anchor.0.dart b/examples/api/lib/material/search_anchor/search_anchor.0.dart index 6512817c6c..262befcabb 100644 --- a/examples/api/lib/material/search_anchor/search_anchor.0.dart +++ b/examples/api/lib/material/search_anchor/search_anchor.0.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [SearchAnchor.bar]. - import 'package:flutter/material.dart'; +/// Flutter code sample for [SearchAnchor.bar]. + void main() => runApp(const SearchBarApp()); class SearchBarApp extends StatefulWidget { @@ -20,32 +20,40 @@ class _SearchBarAppState extends State { List searchHistory = []; Iterable getHistoryList(SearchController controller) { - return searchHistory.map((ColorLabel color) => ListTile( - leading: const Icon(Icons.history), - title: Text(color.label), - trailing: IconButton(icon: const Icon(Icons.call_missed), onPressed: () { - controller.text = color.label; - controller.selection = TextSelection.collapsed(offset: controller.text.length); - }), - )); + return searchHistory.map( + (ColorLabel color) => ListTile( + leading: const Icon(Icons.history), + title: Text(color.label), + trailing: IconButton( + icon: const Icon(Icons.call_missed), + onPressed: () { + controller.text = color.label; + controller.selection = TextSelection.collapsed(offset: controller.text.length); + }, + ), + ), + ); } Iterable getSuggestions(SearchController controller) { final String input = controller.value.text; - return ColorLabel.values.where((ColorLabel color) => color.label.contains(input)) - .map((ColorLabel filteredColor) => - ListTile( - leading: CircleAvatar(backgroundColor: filteredColor.color), - title: Text(filteredColor.label), - trailing: IconButton(icon: const Icon(Icons.call_missed), onPressed: () { - controller.text = filteredColor.label; - controller.selection = TextSelection.collapsed(offset: controller.text.length); - }), - onTap: () { - controller.closeView(filteredColor.label); - handleSelection(filteredColor); - }, - )); + return ColorLabel.values.where((ColorLabel color) => color.label.contains(input)).map( + (ColorLabel filteredColor) => ListTile( + leading: CircleAvatar(backgroundColor: filteredColor.color), + title: Text(filteredColor.label), + trailing: IconButton( + icon: const Icon(Icons.call_missed), + onPressed: () { + controller.text = filteredColor.label; + controller.selection = TextSelection.collapsed(offset: controller.text.length); + }, + ), + onTap: () { + controller.closeView(filteredColor.label); + handleSelection(filteredColor); + }, + ), + ); } void handleSelection(ColorLabel selectedColor) { @@ -78,7 +86,7 @@ class _SearchBarAppState extends State { if (searchHistory.isNotEmpty) { return getHistoryList(controller); } - return [ Center(child: Text('No search history.', style: TextStyle(color: colors.outline))) ]; + return [Center(child: Text('No search history.', style: TextStyle(color: colors.outline)))]; } return getSuggestions(controller); }, @@ -98,7 +106,10 @@ class _SearchBarAppState extends State { } } -SizedBox cardSize = const SizedBox(width: 80, height: 30,); +SizedBox cardSize = const SizedBox( + width: 80, + height: 30, +); enum ColorLabel { red('red', Colors.red), diff --git a/examples/api/lib/material/search_anchor/search_anchor.1.dart b/examples/api/lib/material/search_anchor/search_anchor.1.dart index 977c3dbd1e..aaf004080d 100644 --- a/examples/api/lib/material/search_anchor/search_anchor.1.dart +++ b/examples/api/lib/material/search_anchor/search_anchor.1.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for pinned [SearchAnchor] while scrolling. - import 'package:flutter/material.dart'; +/// Flutter code sample for pinned [SearchAnchor] while scrolling. + void main() { runApp(const PinnedSearchBarApp()); } @@ -21,10 +21,7 @@ class _PinnedSearchBarAppState extends State { @override Widget build(BuildContext context) { return MaterialApp( - theme: ThemeData( - useMaterial3: true, - colorSchemeSeed: const Color(0xff6750a4) - ), + theme: ThemeData(useMaterial3: true, colorSchemeSeed: const Color(0xff6750a4)), home: Scaffold( body: SafeArea( child: CustomScrollView( @@ -38,13 +35,16 @@ class _PinnedSearchBarAppState extends State { floating: true, // We can also uncomment this line and set `pinned` to true to see a pinned search bar. title: SearchAnchor.bar( suggestionsBuilder: (BuildContext context, SearchController controller) { - return List.generate(5, (int index) { - return ListTile( - titleAlignment: ListTileTitleAlignment.center, - title: Text('Initial list item $index'), - ); - }); - } + return List.generate( + 5, + (int index) { + return ListTile( + titleAlignment: ListTileTitleAlignment.center, + title: Text('Initial list item $index'), + ); + }, + ); + }, ), ), // The listed items below are just for filling the screen diff --git a/examples/api/lib/material/search_anchor/search_anchor.2.dart b/examples/api/lib/material/search_anchor/search_anchor.2.dart index 69827c0853..a5a28682cb 100644 --- a/examples/api/lib/material/search_anchor/search_anchor.2.dart +++ b/examples/api/lib/material/search_anchor/search_anchor.2.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [SearchAnchor]. - import 'package:flutter/material.dart'; +/// Flutter code sample for [SearchAnchor]. + void main() => runApp(const SearchBarApp()); class SearchBarApp extends StatefulWidget { @@ -29,7 +29,7 @@ class _SearchBarAppState extends State { body: Column( children: [ SearchAnchor( - searchController: controller, + searchController: controller, builder: (BuildContext context, SearchController controller) { return IconButton( icon: const Icon(Icons.search), @@ -50,12 +50,11 @@ class _SearchBarAppState extends State { }, ); }); - } - ), + }), Center( child: controller.text.isEmpty - ? const Text('No item selected') - : Text('Selected item: ${controller.value.text}'), + ? const Text('No item selected') + : Text('Selected item: ${controller.value.text}'), ), ], ), diff --git a/examples/api/lib/material/segmented_button/segmented_button.0.dart b/examples/api/lib/material/segmented_button/segmented_button.0.dart index 97770ddf03..c9ea2dd0b5 100644 --- a/examples/api/lib/material/segmented_button/segmented_button.0.dart +++ b/examples/api/lib/material/segmented_button/segmented_button.0.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [SegmentedButton]. - import 'package:flutter/material.dart'; +/// Flutter code sample for [SegmentedButton]. + void main() { runApp(const SegmentedButtonApp()); } @@ -47,7 +47,6 @@ class SingleChoice extends StatefulWidget { } class _SingleChoiceState extends State { - Calendar calendarView = Calendar.day; @override @@ -91,7 +90,10 @@ class _MultipleChoiceState extends State { ButtonSegment(value: Sizes.extraSmall, label: Text('XS')), ButtonSegment(value: Sizes.small, label: Text('S')), ButtonSegment(value: Sizes.medium, label: Text('M')), - ButtonSegment(value: Sizes.large, label: Text('L'),), + ButtonSegment( + value: Sizes.large, + label: Text('L'), + ), ButtonSegment(value: Sizes.extraLarge, label: Text('XL')), ], selected: selection, diff --git a/examples/api/lib/material/selectable_region/selectable_region.0.dart b/examples/api/lib/material/selectable_region/selectable_region.0.dart index bbb95f92b0..276cfd23a1 100644 --- a/examples/api/lib/material/selectable_region/selectable_region.0.dart +++ b/examples/api/lib/material/selectable_region/selectable_region.0.dart @@ -2,25 +2,22 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [SelectableRegion]. - import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [SelectableRegion]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const SelectableRegionExampleApp()); - static const String _title = 'Flutter Code Sample'; +class SelectableRegionExampleApp extends StatelessWidget { + const SelectableRegionExampleApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( - title: _title, home: SelectionArea( child: Scaffold( - appBar: AppBar(title: const Text(_title)), + appBar: AppBar(title: const Text('SelectableRegion Sample')), body: const Center( child: Column( mainAxisAlignment: MainAxisAlignment.center, @@ -86,8 +83,8 @@ class _RenderSelectableAdapter extends RenderProxyBox with Selectable, Selection _RenderSelectableAdapter( Color selectionColor, SelectionRegistrar registrar, - ) : _selectionColor = selectionColor, - _geometry = ValueNotifier(_noSelection) { + ) : _selectionColor = selectionColor, + _geometry = ValueNotifier(_noSelection) { this.registrar = registrar; _geometry.addListener(markNeedsPaint); } @@ -121,12 +118,7 @@ class _RenderSelectableAdapter extends RenderProxyBox with Selectable, Selection // Adjust this value to enlarge or shrink the selection highlight. static const double _padding = 10.0; Rect _getSelectionHighlightRect() { - return Rect.fromLTWH( - 0 - _padding, - 0 - _padding, - size.width + _padding * 2, - size.height + _padding * 2 - ); + return Rect.fromLTWH(0 - _padding, 0 - _padding, size.width + _padding * 2, size.height + _padding * 2); } Offset? _start; @@ -222,7 +214,7 @@ class _RenderSelectableAdapter extends RenderProxyBox with Selectable, Selection final double horizontalBaseLine = globalToLocal(Offset(event.dx, 0)).dx; final Offset newOffset; final bool forward; - switch(extendSelectionEvent.direction) { + switch (extendSelectionEvent.direction) { case SelectionExtendDirection.backward: case SelectionExtendDirection.previousLine: forward = false; @@ -244,7 +236,8 @@ class _RenderSelectableAdapter extends RenderProxyBox with Selectable, Selection _start = _end = Offset.zero; } // Move the corresponding selection edge. - if (extendSelectionEvent.direction == SelectionExtendDirection.nextLine || horizontalBaseLine > size.width) { + if (extendSelectionEvent.direction == SelectionExtendDirection.nextLine || + horizontalBaseLine > size.width) { newOffset = Offset.infinite; } else { newOffset = Offset.zero; @@ -305,7 +298,7 @@ class _RenderSelectableAdapter extends RenderProxyBox with Selectable, Selection link: _startHandle!, offset: offset + value.startSelectionPoint!.localPosition, ), - (PaintingContext context, Offset offset) { }, + (PaintingContext context, Offset offset) {}, Offset.zero, ); } @@ -315,7 +308,7 @@ class _RenderSelectableAdapter extends RenderProxyBox with Selectable, Selection link: _endHandle!, offset: offset + value.endSelectionPoint!.localPosition, ), - (PaintingContext context, Offset offset) { }, + (PaintingContext context, Offset offset) {}, Offset.zero, ); } diff --git a/examples/api/lib/material/selection_area/selection_area.0.dart b/examples/api/lib/material/selection_area/selection_area.0.dart index 3f538d7b69..69f6e73b48 100644 --- a/examples/api/lib/material/selection_area/selection_area.0.dart +++ b/examples/api/lib/material/selection_area/selection_area.0.dart @@ -2,24 +2,21 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [SelectionArea]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [SelectionArea]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const SelectionAreaExampleApp()); - static const String _title = 'Flutter Code Sample'; +class SelectionAreaExampleApp extends StatelessWidget { + const SelectionAreaExampleApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( - title: _title, home: SelectionArea( child: Scaffold( - appBar: AppBar(title: const Text(_title)), + appBar: AppBar(title: const Text('SelectionArea Sample')), body: const Center( child: Column( mainAxisAlignment: MainAxisAlignment.center, diff --git a/examples/api/lib/material/selection_container/selection_container.0.dart b/examples/api/lib/material/selection_container/selection_container.0.dart index cd8a5034ce..a4f52b32eb 100644 --- a/examples/api/lib/material/selection_container/selection_container.0.dart +++ b/examples/api/lib/material/selection_container/selection_container.0.dart @@ -2,25 +2,22 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [SelectionContainer]. - import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [SelectionContainer]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const SelectionContainerExampleApp()); - static const String _title = 'Flutter Code Sample'; +class SelectionContainerExampleApp extends StatelessWidget { + const SelectionContainerExampleApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( - title: _title, home: SelectionArea( child: Scaffold( - appBar: AppBar(title: const Text(_title)), + appBar: AppBar(title: const Text('SelectionContainer Sample')), body: const Center( child: SelectionAllOrNoneContainer( child: Column( @@ -40,10 +37,7 @@ class MyApp extends StatelessWidget { } class SelectionAllOrNoneContainer extends StatefulWidget { - const SelectionAllOrNoneContainer({ - super.key, - required this.child - }); + const SelectionAllOrNoneContainer({super.key, required this.child}); final Widget child; diff --git a/examples/api/lib/material/selection_container/selection_container_disabled.0.dart b/examples/api/lib/material/selection_container/selection_container_disabled.0.dart index 8dd160ded5..79aa1d7a02 100644 --- a/examples/api/lib/material/selection_container/selection_container_disabled.0.dart +++ b/examples/api/lib/material/selection_container/selection_container_disabled.0.dart @@ -6,19 +6,16 @@ import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +void main() => runApp(const SelectionContainerDisabledExampleApp()); -class MyApp extends StatelessWidget { - const MyApp({super.key}); - - static const String _title = 'Flutter Code Sample'; +class SelectionContainerDisabledExampleApp extends StatelessWidget { + const SelectionContainerDisabledExampleApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( - title: _title, home: Scaffold( - appBar: AppBar(title: const Text(_title)), + appBar: AppBar(title: const Text('SelectionContainer.disabled Sample')), body: const Center( child: SelectionArea( child: Column( diff --git a/examples/api/lib/material/slider/slider.0.dart b/examples/api/lib/material/slider/slider.0.dart index cbbe332ab3..f73efb81c4 100644 --- a/examples/api/lib/material/slider/slider.0.dart +++ b/examples/api/lib/material/slider/slider.0.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [Slider]. - import 'package:flutter/material.dart'; +/// Flutter code sample for [Slider]. + void main() => runApp(const SliderApp()); class SliderApp extends StatelessWidget { diff --git a/examples/api/lib/material/slider/slider.1.dart b/examples/api/lib/material/slider/slider.1.dart index 1d9a312b92..f5c791fa11 100644 --- a/examples/api/lib/material/slider/slider.1.dart +++ b/examples/api/lib/material/slider/slider.1.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [Slider]. - import 'package:flutter/material.dart'; +/// Flutter code sample for [Slider]. + void main() => runApp(const SliderApp()); class SliderApp extends StatelessWidget { diff --git a/examples/api/lib/material/slider/slider.2.dart b/examples/api/lib/material/slider/slider.2.dart index c6d5bdcf00..b5716712cc 100644 --- a/examples/api/lib/material/slider/slider.2.dart +++ b/examples/api/lib/material/slider/slider.2.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [Slider]. - import 'package:flutter/material.dart'; +/// Flutter code sample for [Slider]. + void main() => runApp(const SliderApp()); class SliderApp extends StatelessWidget { diff --git a/examples/api/lib/material/snack_bar/snack_bar.0.dart b/examples/api/lib/material/snack_bar/snack_bar.0.dart index edc2884b8d..3736dc93d8 100644 --- a/examples/api/lib/material/snack_bar/snack_bar.0.dart +++ b/examples/api/lib/material/snack_bar/snack_bar.0.dart @@ -2,33 +2,30 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [SnackBar]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [SnackBar]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const SnackBarExampleApp()); - static const String _title = 'Flutter Code Sample'; +class SnackBarExampleApp extends StatelessWidget { + const SnackBarExampleApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( - title: _title, home: Scaffold( - appBar: AppBar(title: const Text(_title)), + appBar: AppBar(title: const Text('SnackBar Sample')), body: const Center( - child: MyStatelessWidget(), + child: SnackBarExample(), ), ), ); } } -class MyStatelessWidget extends StatelessWidget { - const MyStatelessWidget({super.key}); +class SnackBarExample extends StatelessWidget { + const SnackBarExample({super.key}); @override Widget build(BuildContext context) { diff --git a/examples/api/lib/material/snack_bar/snack_bar.1.dart b/examples/api/lib/material/snack_bar/snack_bar.1.dart index 581db9b2dd..2294e1d8a3 100644 --- a/examples/api/lib/material/snack_bar/snack_bar.1.dart +++ b/examples/api/lib/material/snack_bar/snack_bar.1.dart @@ -2,33 +2,30 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [SnackBar]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [SnackBar]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const SnackBarExampleApp()); - static const String _title = 'Flutter Code Sample'; +class SnackBarExampleApp extends StatelessWidget { + const SnackBarExampleApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( - title: _title, home: Scaffold( - appBar: AppBar(title: const Text(_title)), + appBar: AppBar(title: const Text('SnackBar Sample')), body: const Center( - child: MyStatelessWidget(), + child: SnackBarExample(), ), ), ); } } -class MyStatelessWidget extends StatelessWidget { - const MyStatelessWidget({super.key}); +class SnackBarExample extends StatelessWidget { + const SnackBarExample({super.key}); @override Widget build(BuildContext context) { diff --git a/examples/api/lib/material/snack_bar/snack_bar.2.dart b/examples/api/lib/material/snack_bar/snack_bar.2.dart index ba1ac5d0fe..7a211be207 100644 --- a/examples/api/lib/material/snack_bar/snack_bar.2.dart +++ b/examples/api/lib/material/snack_bar/snack_bar.2.dart @@ -2,26 +2,23 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [SnackBar] with Material 3 specifications. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [SnackBar] with Material 3 specifications. + +void main() => runApp(const SnackBarExampleApp()); // A Material 3 [SnackBar] demonstrating an optional icon, in either floating // or fixed format. -class MyApp extends StatelessWidget { - const MyApp({super.key}); - - static const String _title = 'Flutter Code Sample'; +class SnackBarExampleApp extends StatelessWidget { + const SnackBarExampleApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( - title: _title, theme: ThemeData(useMaterial3: true), home: Scaffold( - appBar: AppBar(title: const Text(_title)), + appBar: AppBar(title: const Text('SnackBar Sample')), body: const Center( child: SnackBarExample(), ), @@ -46,119 +43,122 @@ class _SnackBarExampleState extends State { double _sliderValue = 0.25; Padding _padRow(List children) => Padding( - padding: const EdgeInsets.all(8.0), - child: Row(children: children), - ); + padding: const EdgeInsets.all(8.0), + child: Row(children: children), + ); @override Widget build(BuildContext context) { - return Padding(padding: const EdgeInsets.only(left: 50.0), child: Column( - children: [ - _padRow([ - Text('Snack Bar configuration', - style: Theme.of(context).textTheme.bodyLarge), - ]), - _padRow( - [ - const Text('Fixed'), - Radio( - value: SnackBarBehavior.fixed, - groupValue: _snackBarBehavior, - onChanged: (SnackBarBehavior? value) { - setState(() { - _snackBarBehavior = value; - }); - }, - ), - const Text('Floating'), - Radio( - value: SnackBarBehavior.floating, - groupValue: _snackBarBehavior, - onChanged: (SnackBarBehavior? value) { - setState(() { - _snackBarBehavior = value; - }); - }, - ), - ], - ), - _padRow( - [ - const Text('Include Icon '), - Switch( - value: _withIcon, - onChanged: (bool value) { - setState(() { - _withIcon = !_withIcon; - }); - }, - ), - ], - ), - _padRow( - [ - const Text('Include Action '), - Switch( - value: _withAction, - onChanged: (bool value) { - setState(() { - _withAction = !_withAction; - }); - }, - ), - const SizedBox(width: 16.0), - const Text('Long Action Label '), - Switch( - value: _longActionLabel, - onChanged: !_withAction - ? null - : (bool value) { - setState(() { - _longActionLabel = !_longActionLabel; - }); - }, - ), - ], - ), - _padRow( - [ - const Text('Multi Line Text'), - Switch( - value: _multiLine, - onChanged: _snackBarBehavior == SnackBarBehavior.fixed ? null : (bool value) { - setState(() { - _multiLine = !_multiLine; - }); - }, - ), - ], - ), - _padRow( - [ + return Padding( + padding: const EdgeInsets.only(left: 50.0), + child: Column( + children: [ + _padRow([ + Text('Snack Bar configuration', style: Theme.of(context).textTheme.bodyLarge), + ]), + _padRow( + [ + const Text('Fixed'), + Radio( + value: SnackBarBehavior.fixed, + groupValue: _snackBarBehavior, + onChanged: (SnackBarBehavior? value) { + setState(() { + _snackBarBehavior = value; + }); + }, + ), + const Text('Floating'), + Radio( + value: SnackBarBehavior.floating, + groupValue: _snackBarBehavior, + onChanged: (SnackBarBehavior? value) { + setState(() { + _snackBarBehavior = value; + }); + }, + ), + ], + ), + _padRow( + [ + const Text('Include Icon '), + Switch( + value: _withIcon, + onChanged: (bool value) { + setState(() { + _withIcon = !_withIcon; + }); + }, + ), + ], + ), + _padRow( + [ + const Text('Include Action '), + Switch( + value: _withAction, + onChanged: (bool value) { + setState(() { + _withAction = !_withAction; + }); + }, + ), + const SizedBox(width: 16.0), + const Text('Long Action Label '), + Switch( + value: _longActionLabel, + onChanged: !_withAction + ? null + : (bool value) { + setState(() { + _longActionLabel = !_longActionLabel; + }); + }, + ), + ], + ), + _padRow( + [ + const Text('Multi Line Text'), + Switch( + value: _multiLine, + onChanged: _snackBarBehavior == SnackBarBehavior.fixed + ? null + : (bool value) { + setState(() { + _multiLine = !_multiLine; + }); + }, + ), + ], + ), + _padRow([ const Text('Action new-line overflow threshold'), Slider( value: _sliderValue, divisions: 20, label: _sliderValue.toStringAsFixed(2), - onChanged: _snackBarBehavior == SnackBarBehavior.fixed ? null : (double value) { - setState(() { - _sliderValue = value; - }); - }, + onChanged: _snackBarBehavior == SnackBarBehavior.fixed + ? null + : (double value) { + setState(() { + _sliderValue = value; + }); + }, ), - ] - ), - const SizedBox(height: 16.0), - ElevatedButton( - child: const Text('Show Snackbar'), - onPressed: () { - ScaffoldMessenger.of(context).showSnackBar(_snackBar()); - } - ), - ], - ), - ); -} + ]), + const SizedBox(height: 16.0), + ElevatedButton( + child: const Text('Show Snackbar'), + onPressed: () { + ScaffoldMessenger.of(context).showSnackBar(_snackBar()); + }, + ), + ], + ), + ); + } SnackBar _snackBar() { final SnackBarAction? action = _withAction @@ -169,11 +169,9 @@ class _SnackBarExampleState extends State { }, ) : null; - final double? width = - _snackBarBehavior == SnackBarBehavior.floating && _multiLine ? 400.0 : null; - final String label = _multiLine - ? 'A Snack Bar with quite a lot of text which spans across multiple lines' - : 'Single Line Snack Bar'; + final double? width = _snackBarBehavior == SnackBarBehavior.floating && _multiLine ? 400.0 : null; + final String label = + _multiLine ? 'A Snack Bar with quite a lot of text which spans across multiple lines' : 'Single Line Snack Bar'; return SnackBar( content: Text(label), showCloseIcon: _withIcon, diff --git a/examples/api/lib/material/stepper/stepper.0.dart b/examples/api/lib/material/stepper/stepper.0.dart index d16f32a0dd..b8b15d692c 100644 --- a/examples/api/lib/material/stepper/stepper.0.dart +++ b/examples/api/lib/material/stepper/stepper.0.dart @@ -2,39 +2,36 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [Stepper]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [Stepper]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const StepperExampleApp()); - static const String _title = 'Flutter Code Sample'; +class StepperExampleApp extends StatelessWidget { + const StepperExampleApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( - title: _title, home: Scaffold( - appBar: AppBar(title: const Text(_title)), + appBar: AppBar(title: const Text('Stepper Sample')), body: const Center( - child: MyStatefulWidget(), + child: StepperExample(), ), ), ); } } -class MyStatefulWidget extends StatefulWidget { - const MyStatefulWidget({super.key}); +class StepperExample extends StatefulWidget { + const StepperExample({super.key}); @override - State createState() => _MyStatefulWidgetState(); + State createState() => _StepperExampleState(); } -class _MyStatefulWidgetState extends State { +class _StepperExampleState extends State { int _index = 0; @override @@ -64,8 +61,9 @@ class _MyStatefulWidgetState extends State { Step( title: const Text('Step 1 title'), content: Container( - alignment: Alignment.centerLeft, - child: const Text('Content for Step 1')), + alignment: Alignment.centerLeft, + child: const Text('Content for Step 1'), + ), ), const Step( title: Text('Step 2 title'), diff --git a/examples/api/lib/material/stepper/stepper.controls_builder.0.dart b/examples/api/lib/material/stepper/stepper.controls_builder.0.dart index 05afa69234..069e2c1c5c 100644 --- a/examples/api/lib/material/stepper/stepper.controls_builder.0.dart +++ b/examples/api/lib/material/stepper/stepper.controls_builder.0.dart @@ -2,31 +2,28 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [Stepper.controlsBuilder]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [Stepper.controlsBuilder]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const ControlsBuilderExampleApp()); - static const String _title = 'Flutter Code Sample'; +class ControlsBuilderExampleApp extends StatelessWidget { + const ControlsBuilderExampleApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( - title: _title, home: Scaffold( - appBar: AppBar(title: const Text(_title)), - body: const MyStatelessWidget(), + appBar: AppBar(title: const Text('Stepper Sample')), + body: const ControlsBuilderExample(), ), ); } } -class MyStatelessWidget extends StatelessWidget { - const MyStatelessWidget({super.key}); +class ControlsBuilderExample extends StatelessWidget { + const ControlsBuilderExample({super.key}); @override Widget build(BuildContext context) { diff --git a/examples/api/lib/material/switch/switch.0.dart b/examples/api/lib/material/switch/switch.0.dart index 8fe620b66f..9a92dd39b2 100644 --- a/examples/api/lib/material/switch/switch.0.dart +++ b/examples/api/lib/material/switch/switch.0.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [Switch]. - import 'package:flutter/material.dart'; +/// Flutter code sample for [Switch]. + void main() => runApp(const SwitchApp()); class SwitchApp extends StatelessWidget { diff --git a/examples/api/lib/material/switch/switch.1.dart b/examples/api/lib/material/switch/switch.1.dart index 59d28f4d0f..0fbe72dead 100644 --- a/examples/api/lib/material/switch/switch.1.dart +++ b/examples/api/lib/material/switch/switch.1.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [Switch]. - import 'package:flutter/material.dart'; +/// Flutter code sample for [Switch]. + void main() => runApp(const SwitchApp()); class SwitchApp extends StatelessWidget { diff --git a/examples/api/lib/material/switch/switch.2.dart b/examples/api/lib/material/switch/switch.2.dart index 08fbf99623..8c47d5235f 100644 --- a/examples/api/lib/material/switch/switch.2.dart +++ b/examples/api/lib/material/switch/switch.2.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [Switch]. - import 'package:flutter/material.dart'; +/// Flutter code sample for [Switch]. + void main() => runApp(const SwitchApp()); class SwitchApp extends StatelessWidget { diff --git a/examples/api/lib/material/switch/switch.3.dart b/examples/api/lib/material/switch/switch.3.dart index 3ed57f2397..023c3387d0 100644 --- a/examples/api/lib/material/switch/switch.3.dart +++ b/examples/api/lib/material/switch/switch.3.dart @@ -2,11 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [Switch]. - import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +/// Flutter code sample for [Switch]. + void main() => runApp(const SwitchApp()); class SwitchApp extends StatelessWidget { diff --git a/examples/api/lib/material/switch_list_tile/custom_labeled_switch.0.dart b/examples/api/lib/material/switch_list_tile/custom_labeled_switch.0.dart index 4ad4282436..6b3d5ff526 100644 --- a/examples/api/lib/material/switch_list_tile/custom_labeled_switch.0.dart +++ b/examples/api/lib/material/switch_list_tile/custom_labeled_switch.0.dart @@ -2,12 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for custom labeled switch. - import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; +/// Flutter code sample for custom labeled switch. + void main() => runApp(const LabeledSwitchApp()); class LabeledSwitchApp extends StatelessWidget { diff --git a/examples/api/lib/material/switch_list_tile/custom_labeled_switch.1.dart b/examples/api/lib/material/switch_list_tile/custom_labeled_switch.1.dart index baa7ca97f7..3c33361468 100644 --- a/examples/api/lib/material/switch_list_tile/custom_labeled_switch.1.dart +++ b/examples/api/lib/material/switch_list_tile/custom_labeled_switch.1.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for custom labeled switch. - import 'package:flutter/material.dart'; +/// Flutter code sample for custom labeled switch. + void main() => runApp(const LabeledSwitchApp()); class LabeledSwitchApp extends StatelessWidget { diff --git a/examples/api/lib/material/switch_list_tile/switch_list_tile.0.dart b/examples/api/lib/material/switch_list_tile/switch_list_tile.0.dart index 7d2acb11e8..339b3a79a6 100644 --- a/examples/api/lib/material/switch_list_tile/switch_list_tile.0.dart +++ b/examples/api/lib/material/switch_list_tile/switch_list_tile.0.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [SwitchListTile]. - import 'package:flutter/material.dart'; +/// Flutter code sample for [SwitchListTile]. + void main() => runApp(const SwitchListTileApp()); class SwitchListTileApp extends StatelessWidget { diff --git a/examples/api/lib/material/switch_list_tile/switch_list_tile.1.dart b/examples/api/lib/material/switch_list_tile/switch_list_tile.1.dart index 0349987fe7..4c5d55b660 100644 --- a/examples/api/lib/material/switch_list_tile/switch_list_tile.1.dart +++ b/examples/api/lib/material/switch_list_tile/switch_list_tile.1.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [SwitchListTile]. - import 'package:flutter/material.dart'; +/// Flutter code sample for [SwitchListTile]. + void main() => runApp(const SwitchListTileApp()); class SwitchListTileApp extends StatelessWidget { @@ -15,9 +15,7 @@ class SwitchListTileApp extends StatelessWidget { Widget build(BuildContext context) { return MaterialApp( theme: ThemeData(useMaterial3: true), - home: Scaffold( - appBar: AppBar(title: const Text('SwitchListTile Sample')), - body: const SwitchListTileExample()), + home: Scaffold(appBar: AppBar(title: const Text('SwitchListTile Sample')), body: const SwitchListTileExample()), ); } } @@ -58,7 +56,8 @@ class _SwitchListTileExampleState extends State { }); }, title: const Text('Headline'), - subtitle: const Text('Longer supporting text to demonstrate how the text wraps and the switch is centered vertically with the text.'), + subtitle: const Text( + 'Longer supporting text to demonstrate how the text wraps and the switch is centered vertically with the text.'), ), const Divider(height: 0), SwitchListTile( @@ -69,7 +68,8 @@ class _SwitchListTileExampleState extends State { }); }, title: const Text('Headline'), - subtitle: const Text("Longer supporting text to demonstrate how the text wraps and how setting 'SwitchListTile.isThreeLine = true' aligns the switch to the top vertically with the text."), + subtitle: const Text( + "Longer supporting text to demonstrate how the text wraps and how setting 'SwitchListTile.isThreeLine = true' aligns the switch to the top vertically with the text."), isThreeLine: true, ), const Divider(height: 0), diff --git a/examples/api/lib/material/tab_controller/tab_controller.1.dart b/examples/api/lib/material/tab_controller/tab_controller.1.dart index cfee433cfa..691980da68 100644 --- a/examples/api/lib/material/tab_controller/tab_controller.1.dart +++ b/examples/api/lib/material/tab_controller/tab_controller.1.dart @@ -2,22 +2,19 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [TabController]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [TabController]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const TabControllerExampleApp()); - static const String _title = 'Flutter Code Sample'; +class TabControllerExampleApp extends StatelessWidget { + const TabControllerExampleApp({super.key}); @override Widget build(BuildContext context) { return const MaterialApp( - title: _title, - home: MyStatelessWidget(), + home: TabControllerExample(), ); } } @@ -28,8 +25,8 @@ const List tabs = [ Tab(text: 'Second'), ]; -class MyStatelessWidget extends StatelessWidget { - const MyStatelessWidget({super.key}); +class TabControllerExample extends StatelessWidget { + const TabControllerExample({super.key}); @override Widget build(BuildContext context) { diff --git a/examples/api/lib/material/tabs/tab_bar.0.dart b/examples/api/lib/material/tabs/tab_bar.0.dart index 68e899ae2d..09d6dd64ff 100644 --- a/examples/api/lib/material/tabs/tab_bar.0.dart +++ b/examples/api/lib/material/tabs/tab_bar.0.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [TabBar]. - import 'package:flutter/material.dart'; +/// Flutter code sample for [TabBar]. + void main() => runApp(const TabBarApp()); class TabBarApp extends StatelessWidget { diff --git a/examples/api/lib/material/tabs/tab_bar.1.dart b/examples/api/lib/material/tabs/tab_bar.1.dart index e9ea194937..954742a1a2 100644 --- a/examples/api/lib/material/tabs/tab_bar.1.dart +++ b/examples/api/lib/material/tabs/tab_bar.1.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [TabBar]. - import 'package:flutter/material.dart'; +/// Flutter code sample for [TabBar]. + void main() => runApp(const TabBarApp()); class TabBarApp extends StatelessWidget { diff --git a/examples/api/lib/material/tabs/tab_bar.2.dart b/examples/api/lib/material/tabs/tab_bar.2.dart index dd39f73494..d15eb4f1ae 100644 --- a/examples/api/lib/material/tabs/tab_bar.2.dart +++ b/examples/api/lib/material/tabs/tab_bar.2.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [TabBar]. - import 'package:flutter/material.dart'; +/// Flutter code sample for [TabBar]. + void main() => runApp(const TabBarApp()); class TabBarApp extends StatelessWidget { diff --git a/examples/api/lib/material/text_button/text_button.0.dart b/examples/api/lib/material/text_button/text_button.0.dart index d0a31e211c..98fa6bc770 100644 --- a/examples/api/lib/material/text_button/text_button.0.dart +++ b/examples/api/lib/material/text_button/text_button.0.dart @@ -2,31 +2,28 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [TextButton]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [TextButton]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const TextButtonExampleApp()); - static const String _title = 'Flutter Code Sample'; +class TextButtonExampleApp extends StatelessWidget { + const TextButtonExampleApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( - title: _title, home: Scaffold( - appBar: AppBar(title: const Text(_title)), - body: const MyStatelessWidget(), + appBar: AppBar(title: const Text('TextButton Sample')), + body: const TextButtonExample(), ), ); } } -class MyStatelessWidget extends StatelessWidget { - const MyStatelessWidget({super.key}); +class TextButtonExample extends StatelessWidget { + const TextButtonExample({super.key}); @override Widget build(BuildContext context) { diff --git a/examples/api/lib/material/text_button/text_button.1.dart b/examples/api/lib/material/text_button/text_button.1.dart index b33b6a1326..f72630a65c 100644 --- a/examples/api/lib/material/text_button/text_button.1.dart +++ b/examples/api/lib/material/text_button/text_button.1.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [TextButton]. - import 'package:flutter/material.dart'; +/// Flutter code sample for [TextButton]. + void main() { runApp(const MaterialApp(home: Home())); } @@ -26,7 +26,6 @@ class SelectableButton extends StatefulWidget { @override State createState() => _SelectableButtonState(); - } class _SelectableButtonState extends State { @@ -35,9 +34,7 @@ class _SelectableButtonState extends State { @override void initState() { super.initState(); - statesController = MaterialStatesController({ - if (widget.selected) MaterialState.selected - }); + statesController = MaterialStatesController({if (widget.selected) MaterialState.selected}); } @override @@ -60,7 +57,7 @@ class _SelectableButtonState extends State { } class Home extends StatefulWidget { - const Home({ super.key }); + const Home({super.key}); @override State createState() => _HomeState(); @@ -94,7 +91,9 @@ class _HomeState extends State { ), ), onPressed: () { - setState(() { selected = !selected; }); + setState(() { + selected = !selected; + }); }, child: const Text('toggle selected'), ), diff --git a/examples/api/lib/material/text_field/text_field.0.dart b/examples/api/lib/material/text_field/text_field.0.dart index 06b3bc9a97..87e5335869 100644 --- a/examples/api/lib/material/text_field/text_field.0.dart +++ b/examples/api/lib/material/text_field/text_field.0.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for TextField - import 'package:flutter/material.dart'; +/// Flutter code sample for [TextField]. + class ObscuredTextFieldSample extends StatelessWidget { const ObscuredTextFieldSample({super.key}); @@ -24,8 +24,8 @@ class ObscuredTextFieldSample extends StatelessWidget { } } -class MyApp extends StatelessWidget { - const MyApp({super.key}); +class TextFieldExampleApp extends StatelessWidget { + const TextFieldExampleApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( @@ -39,4 +39,4 @@ class MyApp extends StatelessWidget { } } -void main() => runApp(const MyApp()); +void main() => runApp(const TextFieldExampleApp()); diff --git a/examples/api/lib/material/text_field/text_field.1.dart b/examples/api/lib/material/text_field/text_field.1.dart index 2b09139ba0..cf3bde3ce0 100644 --- a/examples/api/lib/material/text_field/text_field.1.dart +++ b/examples/api/lib/material/text_field/text_field.1.dart @@ -2,34 +2,31 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [TextField]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [TextField]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const TextFieldExampleApp()); - static const String _title = 'Flutter Code Sample'; +class TextFieldExampleApp extends StatelessWidget { + const TextFieldExampleApp({super.key}); @override Widget build(BuildContext context) { return const MaterialApp( - title: _title, - home: MyStatefulWidget(), + home: TextFieldExample(), ); } } -class MyStatefulWidget extends StatefulWidget { - const MyStatefulWidget({super.key}); +class TextFieldExample extends StatefulWidget { + const TextFieldExample({super.key}); @override - State createState() => _MyStatefulWidgetState(); + State createState() => _TextFieldExampleState(); } -class _MyStatefulWidgetState extends State { +class _TextFieldExampleState extends State { late TextEditingController _controller; @override @@ -56,8 +53,7 @@ class _MyStatefulWidgetState extends State { builder: (BuildContext context) { return AlertDialog( title: const Text('Thanks!'), - content: Text( - 'You typed "$value", which has length ${value.characters.length}.'), + content: Text('You typed "$value", which has length ${value.characters.length}.'), actions: [ TextButton( onPressed: () { diff --git a/examples/api/lib/material/text_field/text_field.2.dart b/examples/api/lib/material/text_field/text_field.2.dart index f94f8a7895..a00487fe27 100644 --- a/examples/api/lib/material/text_field/text_field.2.dart +++ b/examples/api/lib/material/text_field/text_field.2.dart @@ -2,11 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for Material Design 3 [TextField]s. - import 'package:flutter/material.dart'; -void main() { runApp(const TextFieldExamplesApp()); } +/// Flutter code sample for Material Design 3 [TextField]s. + +void main() { + runApp(const TextFieldExamplesApp()); +} class TextFieldExamplesApp extends StatelessWidget { const TextFieldExamplesApp({super.key}); @@ -35,7 +37,7 @@ class TextFieldExamplesApp extends StatelessWidget { /// A filled [TextField] with default settings matching the spec: /// https://m3.material.io/components/text-fields/specs#6d654d1d-262e-4697-858c-9a75e8e7c81d class FilledTextFieldExample extends StatelessWidget { - const FilledTextFieldExample({ super.key }); + const FilledTextFieldExample({super.key}); @override Widget build(BuildContext context) { @@ -47,7 +49,7 @@ class FilledTextFieldExample extends StatelessWidget { hintText: 'hint text', helperText: 'supporting text', filled: true, - ) + ), ); } } @@ -57,7 +59,7 @@ class FilledTextFieldExample extends StatelessWidget { /// A Outlined [TextField] with default settings matching the spec: /// https://m3.material.io/components/text-fields/specs#68b00bd6-ab40-4b4f-93d9-ed1fbbc5d06e class OutlinedTextFieldExample extends StatelessWidget { - const OutlinedTextFieldExample({ super.key }); + const OutlinedTextFieldExample({super.key}); @override Widget build(BuildContext context) { diff --git a/examples/api/lib/material/text_form_field/text_form_field.1.dart b/examples/api/lib/material/text_form_field/text_form_field.1.dart index bdbb12438c..8ff9dfce6f 100644 --- a/examples/api/lib/material/text_form_field/text_form_field.1.dart +++ b/examples/api/lib/material/text_form_field/text_form_field.1.dart @@ -2,35 +2,32 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [TextFormField]. - import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [TextFormField]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const TextFormFieldExampleApp()); - static const String _title = 'Flutter Code Sample'; +class TextFormFieldExampleApp extends StatelessWidget { + const TextFormFieldExampleApp({super.key}); @override Widget build(BuildContext context) { return const MaterialApp( - title: _title, - home: MyStatefulWidget(), + home: TextFormFieldExample(), ); } } -class MyStatefulWidget extends StatefulWidget { - const MyStatefulWidget({super.key}); +class TextFormFieldExample extends StatefulWidget { + const TextFormFieldExample({super.key}); @override - State createState() => _MyStatefulWidgetState(); + State createState() => _TextFormFieldExampleState(); } -class _MyStatefulWidgetState extends State { +class _TextFormFieldExampleState extends State { @override Widget build(BuildContext context) { return Material( diff --git a/examples/api/lib/material/theme/theme_extension.1.dart b/examples/api/lib/material/theme/theme_extension.1.dart index 9cc0be84c8..d6b2f38803 100644 --- a/examples/api/lib/material/theme/theme_extension.1.dart +++ b/examples/api/lib/material/theme/theme_extension.1.dart @@ -2,11 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [ThemeExtension]. - import 'package:flutter/material.dart'; import 'package:flutter/scheduler.dart'; +/// Flutter code sample for [ThemeExtension]. + @immutable class MyColors extends ThemeExtension { const MyColors({ @@ -44,19 +44,17 @@ class MyColors extends ThemeExtension { void main() { // Slow down time to see lerping. timeDilation = 5.0; - runApp(const MyApp()); + runApp(const ThemeExtensionExampleApp()); } -class MyApp extends StatefulWidget { - const MyApp({super.key}); - - static const String _title = 'Flutter Code Sample'; +class ThemeExtensionExampleApp extends StatefulWidget { + const ThemeExtensionExampleApp({super.key}); @override - State createState() => _MyAppState(); + State createState() => _ThemeExtensionExampleAppState(); } -class _MyAppState extends State { +class _ThemeExtensionExampleAppState extends State { bool isLightTheme = true; void toggleTheme() { @@ -66,7 +64,6 @@ class _MyAppState extends State { @override Widget build(BuildContext context) { return MaterialApp( - title: MyApp._title, theme: ThemeData.light().copyWith( extensions: >[ const MyColors( @@ -119,7 +116,7 @@ class Home extends StatelessWidget { onPressed: toggleTheme, ), ], - ) + ), ), ); } diff --git a/examples/api/lib/material/time_picker/show_time_picker.0.dart b/examples/api/lib/material/time_picker/show_time_picker.0.dart index aa30b42869..6e7b9cfee9 100644 --- a/examples/api/lib/material/time_picker/show_time_picker.0.dart +++ b/examples/api/lib/material/time_picker/show_time_picker.0.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [showTimePicker]. - import 'package:flutter/material.dart'; +/// Flutter code sample for [showTimePicker]. + void main() { runApp(const ShowTimePickerApp()); } diff --git a/examples/api/lib/material/toggle_buttons/toggle_buttons.0.dart b/examples/api/lib/material/toggle_buttons/toggle_buttons.0.dart index 578ae48a02..e903fbbac3 100644 --- a/examples/api/lib/material/toggle_buttons/toggle_buttons.0.dart +++ b/examples/api/lib/material/toggle_buttons/toggle_buttons.0.dart @@ -2,21 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [ToggleButtons]. - import 'package:flutter/material.dart'; -const List fruits = [ - Text('Apple'), - Text('Banana'), - Text('Orange') -]; +/// Flutter code sample for [ToggleButtons]. -const List vegetables = [ - Text('Tomatoes'), - Text('Potatoes'), - Text('Carrots') -]; +const List fruits = [Text('Apple'), Text('Banana'), Text('Orange')]; + +const List vegetables = [Text('Tomatoes'), Text('Potatoes'), Text('Carrots')]; const List icons = [ Icon(Icons.sunny), @@ -24,18 +16,15 @@ const List icons = [ Icon(Icons.ac_unit), ]; -void main() => runApp(const MyApp()); +void main() => runApp(const ToggleButtonsExampleApp()); -class MyApp extends StatelessWidget { - const MyApp({super.key}); - - static const String _title = 'ToggleButtons Sample'; +class ToggleButtonsExampleApp extends StatelessWidget { + const ToggleButtonsExampleApp({super.key}); @override Widget build(BuildContext context) { return const MaterialApp( - title: _title, - home: ToggleButtonsSample(title: _title), + home: ToggleButtonsSample(title: 'ToggleButtons Sample'), ); } } @@ -101,8 +90,7 @@ class _ToggleButtonsSampleState extends State { onPressed: (int index) { // All buttons are selectable. setState(() { - _selectedVegetables[index] = - !_selectedVegetables[index]; + _selectedVegetables[index] = !_selectedVegetables[index]; }); }, borderRadius: const BorderRadius.all(Radius.circular(8)), diff --git a/examples/api/lib/material/tooltip/tooltip.0.dart b/examples/api/lib/material/tooltip/tooltip.0.dart index 3da1cd83fe..80c717b88b 100644 --- a/examples/api/lib/material/tooltip/tooltip.0.dart +++ b/examples/api/lib/material/tooltip/tooltip.0.dart @@ -2,23 +2,20 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [Tooltip]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [Tooltip]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const TooltipExampleApp()); - static const String _title = 'Tooltip Sample'; +class TooltipExampleApp extends StatelessWidget { + const TooltipExampleApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( - title: _title, home: Scaffold( - appBar: AppBar(title: const Text(_title)), + appBar: AppBar(title: const Text('Tooltip Sample')), body: const Center( child: TooltipSample(), ), diff --git a/examples/api/lib/material/tooltip/tooltip.1.dart b/examples/api/lib/material/tooltip/tooltip.1.dart index 9e551a4fd2..579851ce77 100644 --- a/examples/api/lib/material/tooltip/tooltip.1.dart +++ b/examples/api/lib/material/tooltip/tooltip.1.dart @@ -2,23 +2,20 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [Tooltip]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [Tooltip]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const TooltipExampleApp()); - static const String _title = 'Tooltip Sample'; +class TooltipExampleApp extends StatelessWidget { + const TooltipExampleApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( - title: _title, home: Scaffold( - appBar: AppBar(title: const Text(_title)), + appBar: AppBar(title: const Text('Tooltip Sample')), body: const Center( child: TooltipSample(), ), @@ -36,8 +33,7 @@ class TooltipSample extends StatelessWidget { message: 'I am a Tooltip', decoration: BoxDecoration( borderRadius: BorderRadius.circular(25), - gradient: - const LinearGradient(colors: [Colors.amber, Colors.red]), + gradient: const LinearGradient(colors: [Colors.amber, Colors.red]), ), height: 50, padding: const EdgeInsets.all(8.0), diff --git a/examples/api/lib/material/tooltip/tooltip.2.dart b/examples/api/lib/material/tooltip/tooltip.2.dart index 8fd5740381..91ca0f4ddd 100644 --- a/examples/api/lib/material/tooltip/tooltip.2.dart +++ b/examples/api/lib/material/tooltip/tooltip.2.dart @@ -2,23 +2,20 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [Tooltip]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [Tooltip]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const TooltipExampleApp()); - static const String _title = 'Tooltip Sample'; +class TooltipExampleApp extends StatelessWidget { + const TooltipExampleApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( - title: _title, home: Scaffold( - appBar: AppBar(title: const Text(_title)), + appBar: AppBar(title: const Text('Tooltip Sample')), body: const Center( child: TooltipSample(), ), diff --git a/examples/api/lib/material/tooltip/tooltip.3.dart b/examples/api/lib/material/tooltip/tooltip.3.dart index adad13653d..0062cf2900 100644 --- a/examples/api/lib/material/tooltip/tooltip.3.dart +++ b/examples/api/lib/material/tooltip/tooltip.3.dart @@ -2,22 +2,19 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [Tooltip]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [Tooltip]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const TooltipExampleApp()); - static const String _title = 'Tooltip Sample'; +class TooltipExampleApp extends StatelessWidget { + const TooltipExampleApp({super.key}); @override Widget build(BuildContext context) { return const MaterialApp( - title: _title, - home: TooltipSample(title: _title), + home: TooltipSample(title: 'Tooltip Sample'), ); } } diff --git a/examples/api/lib/painting/axis_direction/axis_direction.0.dart b/examples/api/lib/painting/axis_direction/axis_direction.0.dart index 8a4e1f2c7f..e48fd0918e 100644 --- a/examples/api/lib/painting/axis_direction/axis_direction.0.dart +++ b/examples/api/lib/painting/axis_direction/axis_direction.0.dart @@ -2,28 +2,25 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [AxisDirection]s. - import 'package:flutter/material.dart'; +/// Flutter code sample for [AxisDirection]s. + void main() => runApp(const ExampleApp()); class ExampleApp extends StatelessWidget { const ExampleApp({super.key}); - static const String _title = 'Flutter Code Sample'; - @override Widget build(BuildContext context) { return const MaterialApp( - title: _title, home: MyWidget(), ); } } class MyWidget extends StatefulWidget { - const MyWidget({ super.key }); + const MyWidget({super.key}); @override State createState() => _MyWidgetState(); @@ -39,30 +36,30 @@ class _MyWidgetState extends State { Widget _getArrows() { final Widget arrow; - switch(_axisDirection) { + switch (_axisDirection) { case AxisDirection.up: arrow = const Icon(Icons.arrow_upward_rounded); return Row( mainAxisAlignment: MainAxisAlignment.center, - children: [ arrow, arrow ], + children: [arrow, arrow], ); case AxisDirection.down: arrow = const Icon(Icons.arrow_downward_rounded); return Row( mainAxisAlignment: MainAxisAlignment.center, - children: [ arrow, arrow ], + children: [arrow, arrow], ); case AxisDirection.left: arrow = const Icon(Icons.arrow_back_rounded); return Column( mainAxisAlignment: MainAxisAlignment.center, - children: [ arrow, arrow ], + children: [arrow, arrow], ); case AxisDirection.right: arrow = const Icon(Icons.arrow_forward_rounded); return Column( mainAxisAlignment: MainAxisAlignment.center, - children: [ arrow, arrow ], + children: [arrow, arrow], ); } } @@ -182,7 +179,7 @@ class _MyWidgetState extends State { padding: const EdgeInsets.all(8.0), child: child, ); - } + }, ), ], ), diff --git a/examples/api/lib/painting/borders/border_side.stroke_align.0.dart b/examples/api/lib/painting/borders/border_side.stroke_align.0.dart index 821a88fd3a..1ba11404c7 100644 --- a/examples/api/lib/painting/borders/border_side.stroke_align.0.dart +++ b/examples/api/lib/painting/borders/border_side.stroke_align.0.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [BorderSide.strokeAlign]. - import 'package:flutter/material.dart'; +/// Flutter code sample for [BorderSide.strokeAlign]. + void main() => runApp(const StrokeAlignApp()); class StrokeAlignApp extends StatelessWidget { @@ -24,15 +24,13 @@ class StrokeAlignExample extends StatefulWidget { State createState() => _StrokeAlignExampleState(); } -class _StrokeAlignExampleState extends State - with TickerProviderStateMixin { +class _StrokeAlignExampleState extends State with TickerProviderStateMixin { late final AnimationController animation; @override void initState() { super.initState(); - animation = - AnimationController(vsync: this, duration: const Duration(seconds: 1)); + animation = AnimationController(vsync: this, duration: const Duration(seconds: 1)); animation.repeat(reverse: true); animation.addListener(_markDirty); } diff --git a/examples/api/lib/painting/gradient/linear_gradient.0.dart b/examples/api/lib/painting/gradient/linear_gradient.0.dart index 22afe76515..503bdaeb34 100644 --- a/examples/api/lib/painting/gradient/linear_gradient.0.dart +++ b/examples/api/lib/painting/gradient/linear_gradient.0.dart @@ -2,14 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [LinearGradient]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [LinearGradient]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const LinearGradientExampleApp()); + +class LinearGradientExampleApp extends StatelessWidget { + const LinearGradientExampleApp({super.key}); @override Widget build(BuildContext context) { diff --git a/examples/api/lib/painting/linear_border/linear_border.0.dart b/examples/api/lib/painting/linear_border/linear_border.0.dart index 4ca28e349b..991fa0fa02 100644 --- a/examples/api/lib/painting/linear_border/linear_border.0.dart +++ b/examples/api/lib/painting/linear_border/linear_border.0.dart @@ -4,7 +4,6 @@ // Examples of LinearBorder and LinearBorderEdge. - import 'package:flutter/material.dart'; void main() { @@ -12,7 +11,7 @@ void main() { } class ExampleApp extends StatelessWidget { - const ExampleApp({ super.key }); + const ExampleApp({super.key}); @override Widget build(BuildContext context) { @@ -27,7 +26,7 @@ class ExampleApp extends StatelessWidget { } class SampleCard extends StatelessWidget { - const SampleCard({ super.key, required this.title, required this.subtitle, required this.children }); + const SampleCard({super.key, required this.title, required this.subtitle, required this.children}); final String title; final String subtitle; @@ -51,7 +50,7 @@ class SampleCard extends StatelessWidget { const SizedBox(height: 16), Row( children: List.generate(children.length * 2 - 1, (int index) { - return index.isEven ? children[index ~/2] : const SizedBox(width: 16); + return index.isEven ? children[index ~/ 2] : const SizedBox(width: 16); }), ), ], @@ -62,7 +61,7 @@ class SampleCard extends StatelessWidget { } class Home extends StatefulWidget { - const Home({ super.key }); + const Home({super.key}); @override State createState() => _HomeState(); @@ -104,7 +103,7 @@ class _HomeState extends State { side: primarySide3, shape: LinearBorder.bottom(), ), - onPressed: () { }, + onPressed: () {}, child: const Text('Text'), ), OutlinedButton( @@ -112,7 +111,7 @@ class _HomeState extends State { side: primarySide3, shape: LinearBorder.bottom(), ), - onPressed: () { }, + onPressed: () {}, child: const Text('Outlined'), ), ElevatedButton( @@ -120,7 +119,7 @@ class _HomeState extends State { side: primarySide3, shape: LinearBorder.bottom(), ), - onPressed: () { }, + onPressed: () {}, child: const Text('Elevated'), ), ], @@ -140,7 +139,7 @@ class _HomeState extends State { side: primarySide0, shape: LinearBorder.start(), ), - onPressed: () { }, + onPressed: () {}, child: const Text('Start()'), ), TextButton( @@ -148,7 +147,7 @@ class _HomeState extends State { side: primarySide0, shape: LinearBorder.end(), ), - onPressed: () { }, + onPressed: () {}, child: const Text('End()'), ), TextButton( @@ -156,7 +155,7 @@ class _HomeState extends State { side: primarySide0, shape: LinearBorder.top(), ), - onPressed: () { }, + onPressed: () {}, child: const Text('Top()'), ), TextButton( @@ -164,7 +163,7 @@ class _HomeState extends State { side: primarySide0, shape: LinearBorder.bottom(), ), - onPressed: () { }, + onPressed: () {}, child: const Text('Bottom()'), ), ], @@ -186,7 +185,7 @@ class _HomeState extends State { size: 0.5, ), ), - onPressed: () { }, + onPressed: () {}, child: const Text('Center'), ), TextButton( @@ -197,7 +196,7 @@ class _HomeState extends State { alignment: -1, ), ), - onPressed: () { }, + onPressed: () {}, child: const Text('Start'), ), TextButton( @@ -208,7 +207,7 @@ class _HomeState extends State { alignment: 1, ), ), - onPressed: () { }, + onPressed: () {}, child: const Text('End'), ), ], @@ -229,7 +228,7 @@ class _HomeState extends State { bottom: LinearBorderEdge(), ), ), - onPressed: () { }, + onPressed: () {}, child: const Text('Horizontal'), ), TextButton( @@ -240,7 +239,7 @@ class _HomeState extends State { end: LinearBorderEdge(), ), ), - onPressed: () { }, + onPressed: () {}, child: const Text('Vertical'), ), TextButton( @@ -251,7 +250,7 @@ class _HomeState extends State { bottom: LinearBorderEdge(), ), ), - onPressed: () { }, + onPressed: () {}, child: const Text('Corner'), ), ], @@ -276,20 +275,19 @@ class _HomeState extends State { side: primarySide3, shape: shape, ), - onPressed: () { }, + onPressed: () {}, child: const Text('Press Play'), ), TextButton( style: ButtonStyle( - side: MaterialStateProperty.resolveWith((Set states) { + side: MaterialStateProperty.resolveWith((Set states) { return states.contains(MaterialState.hovered) ? primarySide3 : null; }), - shape: MaterialStateProperty.resolveWith((Set states) { + shape: MaterialStateProperty.resolveWith((Set states) { return states.contains(MaterialState.hovered) ? shape0 : shape1; }), - ), - onPressed: () { }, + onPressed: () {}, child: const Text('Hover'), ), ], diff --git a/examples/api/lib/rendering/growth_direction/growth_direction.0.dart b/examples/api/lib/rendering/growth_direction/growth_direction.0.dart index b58c9fc9bb..d5ca03e434 100644 --- a/examples/api/lib/rendering/growth_direction/growth_direction.0.dart +++ b/examples/api/lib/rendering/growth_direction/growth_direction.0.dart @@ -2,29 +2,26 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [GrowthDirection]s. - import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; +/// Flutter code sample for [GrowthDirection]s. + void main() => runApp(const ExampleApp()); class ExampleApp extends StatelessWidget { const ExampleApp({super.key}); - static const String _title = 'Flutter Code Sample'; - @override Widget build(BuildContext context) { return const MaterialApp( - title: _title, home: MyWidget(), ); } } class MyWidget extends StatefulWidget { - const MyWidget({ super.key }); + const MyWidget({super.key}); @override State createState() => _MyWidgetState(); @@ -41,30 +38,30 @@ class _MyWidgetState extends State { Widget _getArrows(AxisDirection axisDirection) { final Widget arrow; - switch(axisDirection) { + switch (axisDirection) { case AxisDirection.up: arrow = const Icon(Icons.arrow_upward_rounded); return Row( mainAxisAlignment: MainAxisAlignment.center, - children: [ arrow, arrow ], + children: [arrow, arrow], ); case AxisDirection.down: arrow = const Icon(Icons.arrow_downward_rounded); return Row( mainAxisAlignment: MainAxisAlignment.center, - children: [ arrow, arrow ], + children: [arrow, arrow], ); case AxisDirection.left: arrow = const Icon(Icons.arrow_back_rounded); return Column( mainAxisAlignment: MainAxisAlignment.center, - children: [ arrow, arrow ], + children: [arrow, arrow], ); case AxisDirection.right: arrow = const Icon(Icons.arrow_forward_rounded); return Column( mainAxisAlignment: MainAxisAlignment.center, - children: [ arrow, arrow ], + children: [arrow, arrow], ); } } @@ -91,11 +88,12 @@ class _MyWidgetState extends State { _spacer, Text(constraints.growthDirection.toString()), _spacer, - _getArrows(isForward - ? _axisDirection - // This method is available to conveniently flip an AxisDirection - // into its opposite direction. - : flipAxisDirection(_axisDirection), + _getArrows( + isForward + ? _axisDirection + // This method is available to conveniently flip an AxisDirection + // into its opposite direction. + : flipAxisDirection(_axisDirection), ), ], ), @@ -149,7 +147,7 @@ class _MyWidgetState extends State { ); } - Widget _getList({ required bool isForward }) { + Widget _getList({required bool isForward}) { // The SliverLayoutBuilder is not necessary, and is here to allow us to see // the SliverConstraints & directional information that is provided to the // SliverList when laying out. @@ -164,8 +162,8 @@ class _MyWidgetState extends State { } else { child = Container( color: isForward - ? (index.isEven ? Colors.amber[100] : Colors.amberAccent) - : (index.isEven ? Colors.green[100] : Colors.lightGreen), + ? (index.isEven ? Colors.amber[100] : Colors.amberAccent) + : (index.isEven ? Colors.green[100] : Colors.lightGreen), padding: const EdgeInsets.all(8.0), child: Center(child: Text(_alphabet[index - 1])), ); diff --git a/examples/api/lib/rendering/scroll_direction/scroll_direction.0.dart b/examples/api/lib/rendering/scroll_direction/scroll_direction.0.dart index 211157d760..6eb3c9c913 100644 --- a/examples/api/lib/rendering/scroll_direction/scroll_direction.0.dart +++ b/examples/api/lib/rendering/scroll_direction/scroll_direction.0.dart @@ -2,29 +2,26 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [ScrollDirection]. - import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; +/// Flutter code sample for [ScrollDirection]. + void main() => runApp(const ExampleApp()); class ExampleApp extends StatelessWidget { const ExampleApp({super.key}); - static const String _title = 'Flutter Code Sample'; - @override Widget build(BuildContext context) { return const MaterialApp( - title: _title, home: MyWidget(), ); } } class MyWidget extends StatefulWidget { - const MyWidget({ super.key }); + const MyWidget({super.key}); @override State createState() => _MyWidgetState(); @@ -41,30 +38,30 @@ class _MyWidgetState extends State { Widget _getArrows() { final Widget arrow; - switch(_axisDirection) { + switch (_axisDirection) { case AxisDirection.up: arrow = const Icon(Icons.arrow_upward_rounded); return Row( mainAxisAlignment: MainAxisAlignment.center, - children: [ arrow, arrow ], + children: [arrow, arrow], ); case AxisDirection.down: arrow = const Icon(Icons.arrow_downward_rounded); return Row( mainAxisAlignment: MainAxisAlignment.center, - children: [ arrow, arrow ], + children: [arrow, arrow], ); case AxisDirection.left: arrow = const Icon(Icons.arrow_back_rounded); return Column( mainAxisAlignment: MainAxisAlignment.center, - children: [ arrow, arrow ], + children: [arrow, arrow], ); case AxisDirection.right: arrow = const Icon(Icons.arrow_forward_rounded); return Column( mainAxisAlignment: MainAxisAlignment.center, - children: [ arrow, arrow ], + children: [arrow, arrow], ); } } @@ -148,7 +145,7 @@ class _MyWidgetState extends State { bool _handleNotification(UserScrollNotification notification) { if (notification.direction != scrollDirection) { - setState((){ + setState(() { scrollDirection = notification.direction; }); } @@ -197,7 +194,7 @@ class _MyWidgetState extends State { padding: const EdgeInsets.all(8.0), child: child, ); - } + }, ), ], ), diff --git a/examples/api/lib/rendering/sliver_grid/sliver_grid_delegate_with_fixed_cross_axis_count.0.dart b/examples/api/lib/rendering/sliver_grid/sliver_grid_delegate_with_fixed_cross_axis_count.0.dart index fec0c816e9..e35b2d9202 100644 --- a/examples/api/lib/rendering/sliver_grid/sliver_grid_delegate_with_fixed_cross_axis_count.0.dart +++ b/examples/api/lib/rendering/sliver_grid/sliver_grid_delegate_with_fixed_cross_axis_count.0.dart @@ -2,31 +2,28 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [SliverGridDelegateWithFixedCrossAxisCount]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [SliverGridDelegateWithFixedCrossAxisCount]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const SliverGridDelegateWithFixedCrossAxisCountExampleApp()); - static const String _title = 'Flutter Code Sample'; +class SliverGridDelegateWithFixedCrossAxisCountExampleApp extends StatelessWidget { + const SliverGridDelegateWithFixedCrossAxisCountExampleApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( - title: _title, home: Scaffold( - appBar: AppBar(title: const Text(_title)), - body: const MyStatelessWidget(), + appBar: AppBar(title: const Text('SliverGridDelegateWithFixedCrossAxisCount Sample')), + body: const SliverGridDelegateWithFixedCrossAxisCountExample(), ), ); } } -class MyStatelessWidget extends StatelessWidget { - const MyStatelessWidget({super.key}); +class SliverGridDelegateWithFixedCrossAxisCountExample extends StatelessWidget { + const SliverGridDelegateWithFixedCrossAxisCountExample({super.key}); @override Widget build(BuildContext context) { diff --git a/examples/api/lib/rendering/sliver_grid/sliver_grid_delegate_with_fixed_cross_axis_count.1.dart b/examples/api/lib/rendering/sliver_grid/sliver_grid_delegate_with_fixed_cross_axis_count.1.dart index 4f460e84b0..399cc64ff4 100644 --- a/examples/api/lib/rendering/sliver_grid/sliver_grid_delegate_with_fixed_cross_axis_count.1.dart +++ b/examples/api/lib/rendering/sliver_grid/sliver_grid_delegate_with_fixed_cross_axis_count.1.dart @@ -2,31 +2,28 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [SliverGridDelegateWithFixedCrossAxisCount]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [SliverGridDelegateWithFixedCrossAxisCount]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const SliverGridDelegateWithFixedCrossAxisCountExampleApp()); - static const String _title = 'Flutter Code Sample'; +class SliverGridDelegateWithFixedCrossAxisCountExampleApp extends StatelessWidget { + const SliverGridDelegateWithFixedCrossAxisCountExampleApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( - title: _title, home: Scaffold( - appBar: AppBar(title: const Text(_title)), - body: const MyStatelessWidget(), + appBar: AppBar(title: const Text('SliverGridDelegateWithFixedCrossAxisCount Sample')), + body: const SliverGridDelegateWithFixedCrossAxisCountExample(), ), ); } } -class MyStatelessWidget extends StatelessWidget { - const MyStatelessWidget({super.key}); +class SliverGridDelegateWithFixedCrossAxisCountExample extends StatelessWidget { + const SliverGridDelegateWithFixedCrossAxisCountExample({super.key}); @override Widget build(BuildContext context) { diff --git a/examples/api/lib/sample_templates/cupertino.0.dart b/examples/api/lib/sample_templates/cupertino.0.dart index e8b32cf098..174ddfd5e4 100644 --- a/examples/api/lib/sample_templates/cupertino.0.dart +++ b/examples/api/lib/sample_templates/cupertino.0.dart @@ -29,10 +29,10 @@ // is referenced more than once, link back to the instance the example file is // named for. -// Flutter code sample for [Placeholder]. - import 'package:flutter/cupertino.dart'; +/// Flutter code sample for [Placeholder]. + void main() { runApp(const SampleApp()); } diff --git a/examples/api/lib/sample_templates/material.0.dart b/examples/api/lib/sample_templates/material.0.dart index 15a94a958d..83252cf666 100644 --- a/examples/api/lib/sample_templates/material.0.dart +++ b/examples/api/lib/sample_templates/material.0.dart @@ -29,10 +29,10 @@ // is referenced more than once, link back to the instance the example file is // named for. -// Flutter code sample for [Placeholder]. - import 'package:flutter/material.dart'; +/// Flutter code sample for [Placeholder]. + void main() { runApp(const SampleApp()); } diff --git a/examples/api/lib/sample_templates/widgets.0.dart b/examples/api/lib/sample_templates/widgets.0.dart index 6da96deac0..2bc5dd343a 100644 --- a/examples/api/lib/sample_templates/widgets.0.dart +++ b/examples/api/lib/sample_templates/widgets.0.dart @@ -29,10 +29,10 @@ // is referenced more than once, link back to the instance the example file is // named for. -// Flutter code sample for [Placeholder]. - import 'package:flutter/widgets.dart'; +/// Flutter code sample for [Placeholder]. + void main() { runApp(const SampleApp()); } diff --git a/examples/api/lib/services/keyboard_key/logical_keyboard_key.0.dart b/examples/api/lib/services/keyboard_key/logical_keyboard_key.0.dart index 1cbd13cb07..3be60f244d 100644 --- a/examples/api/lib/services/keyboard_key/logical_keyboard_key.0.dart +++ b/examples/api/lib/services/keyboard_key/logical_keyboard_key.0.dart @@ -2,12 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [LogicalKeyboardKey]. - import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; +/// Flutter code sample for [LogicalKeyboardKey]. + void main() => runApp(const KeyExampleApp()); class KeyExampleApp extends StatelessWidget { diff --git a/examples/api/lib/services/keyboard_key/physical_keyboard_key.0.dart b/examples/api/lib/services/keyboard_key/physical_keyboard_key.0.dart index 6d8f7993ae..c5eaf1cd25 100644 --- a/examples/api/lib/services/keyboard_key/physical_keyboard_key.0.dart +++ b/examples/api/lib/services/keyboard_key/physical_keyboard_key.0.dart @@ -2,12 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [PhysicalKeyboardKey]. - import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; +/// Flutter code sample for [PhysicalKeyboardKey]. + void main() => runApp(const KeyExampleApp()); class KeyExampleApp extends StatelessWidget { diff --git a/examples/api/lib/services/mouse_cursor/mouse_cursor.0.dart b/examples/api/lib/services/mouse_cursor/mouse_cursor.0.dart index ba2d1edc66..e5db8fe766 100644 --- a/examples/api/lib/services/mouse_cursor/mouse_cursor.0.dart +++ b/examples/api/lib/services/mouse_cursor/mouse_cursor.0.dart @@ -2,31 +2,28 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [MouseCursor]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [MouseCursor]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const MouseCursorExampleApp()); - static const String _title = 'MouseCursor Code Sample'; +class MouseCursorExampleApp extends StatelessWidget { + const MouseCursorExampleApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( - title: _title, home: Scaffold( - appBar: AppBar(title: const Text(_title)), - body: const MyStatelessWidget(), + appBar: AppBar(title: const Text('MouseCursor Code Sample')), + body: const MouseCursorExample(), ), ); } } -class MyStatelessWidget extends StatelessWidget { - const MyStatelessWidget({super.key}); +class MouseCursorExample extends StatelessWidget { + const MouseCursorExample({super.key}); @override Widget build(BuildContext context) { diff --git a/examples/api/lib/services/system_chrome/system_chrome.set_system_u_i_overlay_style.0.dart b/examples/api/lib/services/system_chrome/system_chrome.set_system_u_i_overlay_style.0.dart index a146fce40f..4aaca41f3f 100644 --- a/examples/api/lib/services/system_chrome/system_chrome.set_system_u_i_overlay_style.0.dart +++ b/examples/api/lib/services/system_chrome/system_chrome.set_system_u_i_overlay_style.0.dart @@ -2,13 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [AppBar.systemOverlayStyle]. - import 'dart:math' as math; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; +/// Flutter code sample for [AppBar.systemOverlayStyle]. + void main() => runApp(const SystemOverlayStyleApp()); class SystemOverlayStyleApp extends StatelessWidget { diff --git a/examples/api/lib/services/system_chrome/system_chrome.set_system_u_i_overlay_style.1.dart b/examples/api/lib/services/system_chrome/system_chrome.set_system_u_i_overlay_style.1.dart index c5eb2f715a..6cb5fca2cc 100644 --- a/examples/api/lib/services/system_chrome/system_chrome.set_system_u_i_overlay_style.1.dart +++ b/examples/api/lib/services/system_chrome/system_chrome.set_system_u_i_overlay_style.1.dart @@ -2,13 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for setting the [SystemUiOverlayStyle] with an [AnnotatedRegion]. - import 'dart:math' as math; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; +/// Flutter code sample for setting the [SystemUiOverlayStyle] with an [AnnotatedRegion]. + void main() => runApp(const SystemOverlayStyleApp()); class SystemOverlayStyleApp extends StatelessWidget { diff --git a/examples/api/lib/services/text_input/text_input_control.0.dart b/examples/api/lib/services/text_input/text_input_control.0.dart index 112ba35ba8..64c508dd35 100644 --- a/examples/api/lib/services/text_input/text_input_control.0.dart +++ b/examples/api/lib/services/text_input/text_input_control.0.dart @@ -2,33 +2,33 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for TextInputControl - import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [TextInputControl]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const TextInputControlExampleApp()); + +class TextInputControlExampleApp extends StatelessWidget { + const TextInputControlExampleApp({super.key}); @override Widget build(BuildContext context) { return const MaterialApp( - home: MyStatefulWidget(), - ); + home: TextInputControlExample(), + ); } } -class MyStatefulWidget extends StatefulWidget { - const MyStatefulWidget({super.key}); +class TextInputControlExample extends StatefulWidget { + const TextInputControlExample({super.key}); @override MyStatefulWidgetState createState() => MyStatefulWidgetState(); } -class MyStatefulWidgetState extends State { +class MyStatefulWidgetState extends State { final TextEditingController _controller = TextEditingController(); final FocusNode _focusNode = FocusNode(); diff --git a/examples/api/lib/ui/text/font_feature.0.dart b/examples/api/lib/ui/text/font_feature.0.dart index a24a86d45b..5ef2f863a9 100644 --- a/examples/api/lib/ui/text/font_feature.0.dart +++ b/examples/api/lib/ui/text/font_feature.0.dart @@ -2,11 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [FontFeature]. import 'dart:ui'; import 'package:flutter/material.dart'; +/// Flutter code sample for [FontFeature]. + void main() => runApp(const ExampleApp()); class ExampleApp extends StatelessWidget { diff --git a/examples/api/lib/ui/text/font_feature.font_feature_alternative.0.dart b/examples/api/lib/ui/text/font_feature.font_feature_alternative.0.dart index 932e3cd2c3..5207173d79 100644 --- a/examples/api/lib/ui/text/font_feature.font_feature_alternative.0.dart +++ b/examples/api/lib/ui/text/font_feature.font_feature_alternative.0.dart @@ -2,11 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [FontFeature.FontFeature.alternative]. import 'dart:ui'; import 'package:flutter/widgets.dart'; +/// Flutter code sample for [FontFeature.FontFeature.alternative]. + void main() => runApp(const ExampleApp()); class ExampleApp extends StatelessWidget { diff --git a/examples/api/lib/ui/text/font_feature.font_feature_alternative_fractions.0.dart b/examples/api/lib/ui/text/font_feature.font_feature_alternative_fractions.0.dart index f59fb68fb7..2ca48e219f 100644 --- a/examples/api/lib/ui/text/font_feature.font_feature_alternative_fractions.0.dart +++ b/examples/api/lib/ui/text/font_feature.font_feature_alternative_fractions.0.dart @@ -2,11 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [FontFeature.FontFeature.alternativeFractions]. import 'dart:ui'; import 'package:flutter/widgets.dart'; +/// Flutter code sample for [FontFeature.FontFeature.alternativeFractions]. + void main() => runApp(const ExampleApp()); class ExampleApp extends StatelessWidget { diff --git a/examples/api/lib/ui/text/font_feature.font_feature_case_sensitive_forms.0.dart b/examples/api/lib/ui/text/font_feature.font_feature_case_sensitive_forms.0.dart index 1d99d3d3b9..52df814417 100644 --- a/examples/api/lib/ui/text/font_feature.font_feature_case_sensitive_forms.0.dart +++ b/examples/api/lib/ui/text/font_feature.font_feature_case_sensitive_forms.0.dart @@ -2,11 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [FontFeature.FontFeature.caseSensitiveForms]. import 'dart:ui'; import 'package:flutter/widgets.dart'; +/// Flutter code sample for [FontFeature.FontFeature.caseSensitiveForms]. + void main() => runApp(const ExampleApp()); class ExampleApp extends StatelessWidget { diff --git a/examples/api/lib/ui/text/font_feature.font_feature_character_variant.0.dart b/examples/api/lib/ui/text/font_feature.font_feature_character_variant.0.dart index ff8a2c0f1b..f746d50b32 100644 --- a/examples/api/lib/ui/text/font_feature.font_feature_character_variant.0.dart +++ b/examples/api/lib/ui/text/font_feature.font_feature_character_variant.0.dart @@ -2,11 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [FontFeature.FontFeature.characterVariant]. import 'dart:ui'; import 'package:flutter/widgets.dart'; +/// Flutter code sample for [FontFeature.FontFeature.characterVariant]. + void main() => runApp(const ExampleApp()); class ExampleApp extends StatelessWidget { diff --git a/examples/api/lib/ui/text/font_feature.font_feature_contextual_alternates.0.dart b/examples/api/lib/ui/text/font_feature.font_feature_contextual_alternates.0.dart index e2378411d1..cd3654b10a 100644 --- a/examples/api/lib/ui/text/font_feature.font_feature_contextual_alternates.0.dart +++ b/examples/api/lib/ui/text/font_feature.font_feature_contextual_alternates.0.dart @@ -2,11 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [FontFeature.FontFeature.contextualAlternates]. import 'dart:ui'; import 'package:flutter/widgets.dart'; +/// Flutter code sample for [FontFeature.FontFeature.contextualAlternates]. + void main() => runApp(const ExampleApp()); class ExampleApp extends StatelessWidget { diff --git a/examples/api/lib/ui/text/font_feature.font_feature_denominator.0.dart b/examples/api/lib/ui/text/font_feature.font_feature_denominator.0.dart index 0d01028da3..9097b25949 100644 --- a/examples/api/lib/ui/text/font_feature.font_feature_denominator.0.dart +++ b/examples/api/lib/ui/text/font_feature.font_feature_denominator.0.dart @@ -2,11 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [FontFeature.FontFeature.denominator]. import 'dart:ui'; import 'package:flutter/widgets.dart'; +/// Flutter code sample for [FontFeature.FontFeature.denominator]. + void main() => runApp(const ExampleApp()); class ExampleApp extends StatelessWidget { diff --git a/examples/api/lib/ui/text/font_feature.font_feature_fractions.0.dart b/examples/api/lib/ui/text/font_feature.font_feature_fractions.0.dart index 23aab9506a..01433db86a 100644 --- a/examples/api/lib/ui/text/font_feature.font_feature_fractions.0.dart +++ b/examples/api/lib/ui/text/font_feature.font_feature_fractions.0.dart @@ -2,11 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [FontFeature.FontFeature.fractions]. import 'dart:ui'; import 'package:flutter/widgets.dart'; +/// Flutter code sample for [FontFeature.FontFeature.fractions]. + void main() => runApp(const ExampleApp()); class ExampleApp extends StatelessWidget { diff --git a/examples/api/lib/ui/text/font_feature.font_feature_historical_forms.0.dart b/examples/api/lib/ui/text/font_feature.font_feature_historical_forms.0.dart index e88262dcd0..a821dcce95 100644 --- a/examples/api/lib/ui/text/font_feature.font_feature_historical_forms.0.dart +++ b/examples/api/lib/ui/text/font_feature.font_feature_historical_forms.0.dart @@ -2,11 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [FontFeature.FontFeature.historicalForms]. import 'dart:ui'; import 'package:flutter/widgets.dart'; +/// Flutter code sample for [FontFeature.FontFeature.historicalForms]. + void main() => runApp(const ExampleApp()); class ExampleApp extends StatelessWidget { diff --git a/examples/api/lib/ui/text/font_feature.font_feature_historical_ligatures.0.dart b/examples/api/lib/ui/text/font_feature.font_feature_historical_ligatures.0.dart index 5a689b3567..039dbca3bd 100644 --- a/examples/api/lib/ui/text/font_feature.font_feature_historical_ligatures.0.dart +++ b/examples/api/lib/ui/text/font_feature.font_feature_historical_ligatures.0.dart @@ -2,12 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [FontFeature.FontFeature.historicalLigatures]. - import 'dart:ui'; import 'package:flutter/widgets.dart'; +/// Flutter code sample for [FontFeature.FontFeature.historicalLigatures]. + void main() => runApp(const ExampleApp()); class ExampleApp extends StatelessWidget { diff --git a/examples/api/lib/ui/text/font_feature.font_feature_lining_figures.0.dart b/examples/api/lib/ui/text/font_feature.font_feature_lining_figures.0.dart index f225e863ad..88515101e1 100644 --- a/examples/api/lib/ui/text/font_feature.font_feature_lining_figures.0.dart +++ b/examples/api/lib/ui/text/font_feature.font_feature_lining_figures.0.dart @@ -2,12 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [FontFeature.FontFeature.liningFigures]. - import 'dart:ui'; import 'package:flutter/widgets.dart'; +/// Flutter code sample for [FontFeature.FontFeature.liningFigures]. + void main() => runApp(const ExampleApp()); class ExampleApp extends StatelessWidget { diff --git a/examples/api/lib/ui/text/font_feature.font_feature_locale_aware.0.dart b/examples/api/lib/ui/text/font_feature.font_feature_locale_aware.0.dart index 8ef16e55e8..ca34cd4281 100644 --- a/examples/api/lib/ui/text/font_feature.font_feature_locale_aware.0.dart +++ b/examples/api/lib/ui/text/font_feature.font_feature_locale_aware.0.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [FontFeature.FontFeature.localeAware]. - import 'package:flutter/widgets.dart'; +/// Flutter code sample for [FontFeature.FontFeature.localeAware]. + void main() => runApp(const ExampleApp()); class ExampleApp extends StatelessWidget { diff --git a/examples/api/lib/ui/text/font_feature.font_feature_notational_forms.0.dart b/examples/api/lib/ui/text/font_feature.font_feature_notational_forms.0.dart index d4f5aa380e..562e5e0bb4 100644 --- a/examples/api/lib/ui/text/font_feature.font_feature_notational_forms.0.dart +++ b/examples/api/lib/ui/text/font_feature.font_feature_notational_forms.0.dart @@ -2,11 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [FontFeature.FontFeature.notationalForms]. import 'dart:ui'; import 'package:flutter/widgets.dart'; +/// Flutter code sample for [FontFeature.FontFeature.notationalForms]. + void main() => runApp(const ExampleApp()); class ExampleApp extends StatelessWidget { diff --git a/examples/api/lib/ui/text/font_feature.font_feature_numerators.0.dart b/examples/api/lib/ui/text/font_feature.font_feature_numerators.0.dart index b68128a2e2..213bf8e9cf 100644 --- a/examples/api/lib/ui/text/font_feature.font_feature_numerators.0.dart +++ b/examples/api/lib/ui/text/font_feature.font_feature_numerators.0.dart @@ -2,11 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [FontFeature.FontFeature.numerators]. import 'dart:ui'; import 'package:flutter/widgets.dart'; +/// Flutter code sample for [FontFeature.FontFeature.numerators]. + void main() => runApp(const ExampleApp()); class ExampleApp extends StatelessWidget { diff --git a/examples/api/lib/ui/text/font_feature.font_feature_oldstyle_figures.0.dart b/examples/api/lib/ui/text/font_feature.font_feature_oldstyle_figures.0.dart index b9c13b29be..7de9126044 100644 --- a/examples/api/lib/ui/text/font_feature.font_feature_oldstyle_figures.0.dart +++ b/examples/api/lib/ui/text/font_feature.font_feature_oldstyle_figures.0.dart @@ -2,11 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [FontFeature.FontFeature.oldstyleFigures]. import 'dart:ui'; import 'package:flutter/widgets.dart'; +/// Flutter code sample for [FontFeature.FontFeature.oldstyleFigures]. + void main() => runApp(const ExampleApp()); class ExampleApp extends StatelessWidget { diff --git a/examples/api/lib/ui/text/font_feature.font_feature_ordinal_forms.0.dart b/examples/api/lib/ui/text/font_feature.font_feature_ordinal_forms.0.dart index 87e6c5c46b..20b6720c93 100644 --- a/examples/api/lib/ui/text/font_feature.font_feature_ordinal_forms.0.dart +++ b/examples/api/lib/ui/text/font_feature.font_feature_ordinal_forms.0.dart @@ -2,11 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [FontFeature.FontFeature.ordinalForms]. import 'dart:ui'; import 'package:flutter/widgets.dart'; +/// Flutter code sample for [FontFeature.FontFeature.ordinalForms]. + void main() => runApp(const ExampleApp()); class ExampleApp extends StatelessWidget { diff --git a/examples/api/lib/ui/text/font_feature.font_feature_proportional_figures.0.dart b/examples/api/lib/ui/text/font_feature.font_feature_proportional_figures.0.dart index 3e2721e999..aaa15f5524 100644 --- a/examples/api/lib/ui/text/font_feature.font_feature_proportional_figures.0.dart +++ b/examples/api/lib/ui/text/font_feature.font_feature_proportional_figures.0.dart @@ -2,11 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [FontFeature.FontFeature.proportionalFigures]. import 'dart:ui'; import 'package:flutter/widgets.dart'; +/// Flutter code sample for [FontFeature.FontFeature.proportionalFigures]. + void main() => runApp(const ExampleApp()); class ExampleApp extends StatelessWidget { diff --git a/examples/api/lib/ui/text/font_feature.font_feature_scientific_inferiors.0.dart b/examples/api/lib/ui/text/font_feature.font_feature_scientific_inferiors.0.dart index 87a02094ce..b17115dfe8 100644 --- a/examples/api/lib/ui/text/font_feature.font_feature_scientific_inferiors.0.dart +++ b/examples/api/lib/ui/text/font_feature.font_feature_scientific_inferiors.0.dart @@ -2,11 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [FontFeature.FontFeature.scientificInferiors]. import 'dart:ui'; import 'package:flutter/widgets.dart'; +/// Flutter code sample for [FontFeature.FontFeature.scientificInferiors]. + void main() => runApp(const ExampleApp()); class ExampleApp extends StatelessWidget { diff --git a/examples/api/lib/ui/text/font_feature.font_feature_slashed_zero.0.dart b/examples/api/lib/ui/text/font_feature.font_feature_slashed_zero.0.dart index d023e056ce..105a1f494c 100644 --- a/examples/api/lib/ui/text/font_feature.font_feature_slashed_zero.0.dart +++ b/examples/api/lib/ui/text/font_feature.font_feature_slashed_zero.0.dart @@ -2,11 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [FontFeature.FontFeature.slashedZero]. import 'dart:ui'; import 'package:flutter/widgets.dart'; +/// Flutter code sample for [FontFeature.FontFeature.slashedZero]. + void main() => runApp(const ExampleApp()); class ExampleApp extends StatelessWidget { diff --git a/examples/api/lib/ui/text/font_feature.font_feature_stylistic_alternates.0.dart b/examples/api/lib/ui/text/font_feature.font_feature_stylistic_alternates.0.dart index c9b5333263..b9f5e67e86 100644 --- a/examples/api/lib/ui/text/font_feature.font_feature_stylistic_alternates.0.dart +++ b/examples/api/lib/ui/text/font_feature.font_feature_stylistic_alternates.0.dart @@ -2,11 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [FontFeature.FontFeature.stylisticAlternates]. import 'dart:ui'; import 'package:flutter/widgets.dart'; +/// Flutter code sample for [FontFeature.FontFeature.stylisticAlternates]. + void main() => runApp(const ExampleApp()); class ExampleApp extends StatelessWidget { diff --git a/examples/api/lib/ui/text/font_feature.font_feature_stylistic_set.0.dart b/examples/api/lib/ui/text/font_feature.font_feature_stylistic_set.0.dart index aca5674039..812c55900d 100644 --- a/examples/api/lib/ui/text/font_feature.font_feature_stylistic_set.0.dart +++ b/examples/api/lib/ui/text/font_feature.font_feature_stylistic_set.0.dart @@ -2,11 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [FontFeature.FontFeature.stylisticSet]. import 'dart:ui'; import 'package:flutter/widgets.dart'; +/// Flutter code sample for [FontFeature.FontFeature.stylisticSet]. + void main() => runApp(const ExampleApp()); class ExampleApp extends StatelessWidget { diff --git a/examples/api/lib/ui/text/font_feature.font_feature_stylistic_set.1.dart b/examples/api/lib/ui/text/font_feature.font_feature_stylistic_set.1.dart index adcb2c5f65..a419bf3b03 100644 --- a/examples/api/lib/ui/text/font_feature.font_feature_stylistic_set.1.dart +++ b/examples/api/lib/ui/text/font_feature.font_feature_stylistic_set.1.dart @@ -2,11 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [FontFeature.FontFeature.stylisticSet]. import 'dart:ui'; import 'package:flutter/widgets.dart'; +/// Flutter code sample for [FontFeature.FontFeature.stylisticSet]. + void main() => runApp(const ExampleApp()); class ExampleApp extends StatelessWidget { diff --git a/examples/api/lib/ui/text/font_feature.font_feature_subscripts.0.dart b/examples/api/lib/ui/text/font_feature.font_feature_subscripts.0.dart index 1687d06f90..ab1b6121ae 100644 --- a/examples/api/lib/ui/text/font_feature.font_feature_subscripts.0.dart +++ b/examples/api/lib/ui/text/font_feature.font_feature_subscripts.0.dart @@ -2,11 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [FontFeature.FontFeature.subscripts]. import 'dart:ui'; import 'package:flutter/widgets.dart'; +/// Flutter code sample for [FontFeature.FontFeature.subscripts]. + void main() => runApp(const ExampleApp()); class ExampleApp extends StatelessWidget { diff --git a/examples/api/lib/ui/text/font_feature.font_feature_superscripts.0.dart b/examples/api/lib/ui/text/font_feature.font_feature_superscripts.0.dart index 75a65f6227..490955d18b 100644 --- a/examples/api/lib/ui/text/font_feature.font_feature_superscripts.0.dart +++ b/examples/api/lib/ui/text/font_feature.font_feature_superscripts.0.dart @@ -2,12 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [FontFeature.FontFeature.superscripts]. - import 'dart:ui'; import 'package:flutter/widgets.dart'; +/// Flutter code sample for [FontFeature.FontFeature.superscripts]. + void main() => runApp(const ExampleApp()); class ExampleApp extends StatelessWidget { diff --git a/examples/api/lib/ui/text/font_feature.font_feature_swash.0.dart b/examples/api/lib/ui/text/font_feature.font_feature_swash.0.dart index d39e9be58c..986981a709 100644 --- a/examples/api/lib/ui/text/font_feature.font_feature_swash.0.dart +++ b/examples/api/lib/ui/text/font_feature.font_feature_swash.0.dart @@ -2,11 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [FontFeature.FontFeature.swash]. import 'dart:ui'; import 'package:flutter/widgets.dart'; +/// Flutter code sample for [FontFeature.FontFeature.swash]. + void main() => runApp(const ExampleApp()); class ExampleApp extends StatelessWidget { diff --git a/examples/api/lib/ui/text/font_feature.font_feature_tabular_figures.0.dart b/examples/api/lib/ui/text/font_feature.font_feature_tabular_figures.0.dart index 13ea07a672..c2055ca366 100644 --- a/examples/api/lib/ui/text/font_feature.font_feature_tabular_figures.0.dart +++ b/examples/api/lib/ui/text/font_feature.font_feature_tabular_figures.0.dart @@ -2,11 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [dart]:ui FontFeature.FontFeature.tabularFigures. import 'dart:ui'; import 'package:flutter/widgets.dart'; +/// Flutter code sample for [dart]:ui FontFeature.FontFeature.tabularFigures. + void main() => runApp(const ExampleApp()); class ExampleApp extends StatelessWidget { diff --git a/examples/api/lib/widgets/actions/action.action_overridable.0.dart b/examples/api/lib/widgets/actions/action.action_overridable.0.dart index ec7a0b43e4..3304e0f245 100644 --- a/examples/api/lib/widgets/actions/action.action_overridable.0.dart +++ b/examples/api/lib/widgets/actions/action.action_overridable.0.dart @@ -2,11 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [Action.Action.overridable]. - import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; +/// Flutter code sample for [Action.Action.overridable]. + void main() { runApp( const MaterialApp( @@ -18,12 +18,13 @@ void main() { } const CopyTextIntent copyTextIntent = CopyTextIntent._(); + class CopyTextIntent extends Intent { const CopyTextIntent._(); } class CopyableText extends StatelessWidget { - const CopyableText({ super.key, required this.text }); + const CopyableText({super.key, required this.text}); final String text; @@ -33,9 +34,11 @@ class CopyableText extends StatelessWidget { Widget build(BuildContext context) { final Action defaultCopyAction = CallbackAction(onInvoke: _copy); return Shortcuts( - shortcuts: const { SingleActivator(LogicalKeyboardKey.keyC, control: true) : copyTextIntent }, + shortcuts: const { + SingleActivator(LogicalKeyboardKey.keyC, control: true): copyTextIntent + }, child: Actions( - actions: > { + actions: >{ // The Action is made overridable so the VerificationCodeGenerator // widget can override how copying is handled. CopyTextIntent: Action.overridable(defaultAction: defaultCopyAction, context: context), @@ -53,7 +56,7 @@ class CopyableText extends StatelessWidget { } class VerificationCodeGenerator extends StatelessWidget { - const VerificationCodeGenerator({ super.key }); + const VerificationCodeGenerator({super.key}); void _copy(CopyTextIntent intent) { debugPrint('Content copied'); @@ -63,7 +66,7 @@ class VerificationCodeGenerator extends StatelessWidget { @override Widget build(BuildContext context) { return Actions( - actions: > { CopyTextIntent: CallbackAction(onInvoke: _copy) }, + actions: >{CopyTextIntent: CallbackAction(onInvoke: _copy)}, child: const Column( mainAxisAlignment: MainAxisAlignment.center, children: [ @@ -73,9 +76,9 @@ class VerificationCodeGenerator extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.center, children: [ CopyableText(text: '111'), - SizedBox(width: 5,), + SizedBox(width: 5), CopyableText(text: '222'), - SizedBox(width: 5,), + SizedBox(width: 5), CopyableText(text: '333'), ], ), diff --git a/examples/api/lib/widgets/actions/action_listener.0.dart b/examples/api/lib/widgets/actions/action_listener.0.dart index 98f7a15cd5..d4866a60e3 100644 --- a/examples/api/lib/widgets/actions/action_listener.0.dart +++ b/examples/api/lib/widgets/actions/action_listener.0.dart @@ -2,25 +2,22 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [ActionListener]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [ActionListener]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const ActionListenerExampleApp()); - static const String _title = 'Flutter Code Sample'; +class ActionListenerExampleApp extends StatelessWidget { + const ActionListenerExampleApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( - title: _title, home: Scaffold( - appBar: AppBar(title: const Text(_title)), + appBar: AppBar(title: const Text('ActionListener Sample')), body: const Center( - child: MyStatefulWidget(), + child: ActionListenerExample(), ), ), ); @@ -75,8 +72,7 @@ class _ActionListenerExampleState extends State { }, action: _myAction, child: ElevatedButton( - onPressed: () => const ActionDispatcher() - .invokeAction(_myAction, const MyIntent()), + onPressed: () => const ActionDispatcher().invokeAction(_myAction, const MyIntent()), child: const Text('Call Action Listener'), ), ), @@ -109,17 +105,3 @@ class MyAction extends Action { class MyIntent extends Intent { const MyIntent(); } - -class MyStatefulWidget extends StatefulWidget { - const MyStatefulWidget({super.key}); - - @override - State createState() => _MyStatefulWidgetState(); -} - -class _MyStatefulWidgetState extends State { - @override - Widget build(BuildContext context) { - return const ActionListenerExample(); - } -} diff --git a/examples/api/lib/widgets/actions/actions.0.dart b/examples/api/lib/widgets/actions/actions.0.dart index 8fbeaf16e7..e8f3366e22 100644 --- a/examples/api/lib/widgets/actions/actions.0.dart +++ b/examples/api/lib/widgets/actions/actions.0.dart @@ -2,25 +2,22 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [Actions]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [Actions]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const ActionsExampleApp()); - static const String _title = 'Flutter Code Sample'; +class ActionsExampleApp extends StatelessWidget { + const ActionsExampleApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( - title: _title, home: Scaffold( - appBar: AppBar(title: const Text(_title)), + appBar: AppBar(title: const Text('Actions Sample')), body: const Center( - child: MyStatefulWidget(), + child: ActionsExample(), ), ), ); @@ -116,14 +113,14 @@ class _SaveButtonState extends State { } } -class MyStatefulWidget extends StatefulWidget { - const MyStatefulWidget({super.key}); +class ActionsExample extends StatefulWidget { + const ActionsExample({super.key}); @override - State createState() => _MyStatefulWidgetState(); + State createState() => _ActionsExampleState(); } -class _MyStatefulWidgetState extends State { +class _ActionsExampleState extends State { Model model = Model(); int count = 0; @@ -154,8 +151,7 @@ class _MyStatefulWidgetState extends State { builder: (BuildContext context, Widget? child) { return Padding( padding: const EdgeInsets.all(8.0), - child: Text('${model.data.value}', - style: Theme.of(context).textTheme.headlineMedium), + child: Text('${model.data.value}', style: Theme.of(context).textTheme.headlineMedium), ); }), IconButton( diff --git a/examples/api/lib/widgets/actions/focusable_action_detector.0.dart b/examples/api/lib/widgets/actions/focusable_action_detector.0.dart index 019d39984d..1043b0fa8b 100644 --- a/examples/api/lib/widgets/actions/focusable_action_detector.0.dart +++ b/examples/api/lib/widgets/actions/focusable_action_detector.0.dart @@ -2,23 +2,20 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [FocusableActionDetector]. - import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [FocusableActionDetector]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const FocusableActionDetectorExampleApp()); - static const String _title = 'Flutter Code Sample'; +class FocusableActionDetectorExampleApp extends StatelessWidget { + const FocusableActionDetectorExampleApp({super.key}); @override Widget build(BuildContext context) { return const MaterialApp( - title: _title, - home: MyStatefulWidget(), + home: FocusableActionDetectorExample(), ); } } @@ -42,8 +39,7 @@ class _FadButtonState extends State { bool _hovering = false; bool _on = false; late final Map> _actionMap; - final Map _shortcutMap = - const { + final Map _shortcutMap = const { SingleActivator(LogicalKeyboardKey.keyX): ActivateIntent(), }; @@ -115,14 +111,14 @@ class _FadButtonState extends State { } } -class MyStatefulWidget extends StatefulWidget { - const MyStatefulWidget({super.key}); +class FocusableActionDetectorExample extends StatefulWidget { + const FocusableActionDetectorExample({super.key}); @override - State createState() => _MyStatefulWidgetState(); + State createState() => _FocusableActionDetectorExampleState(); } -class _MyStatefulWidgetState extends State { +class _FocusableActionDetectorExampleState extends State { @override Widget build(BuildContext context) { return Scaffold( @@ -135,8 +131,7 @@ class _MyStatefulWidgetState extends State { children: [ Padding( padding: const EdgeInsets.all(8.0), - child: - TextButton(onPressed: () {}, child: const Text('Press Me')), + child: TextButton(onPressed: () {}, child: const Text('Press Me')), ), Padding( padding: const EdgeInsets.all(8.0), diff --git a/examples/api/lib/widgets/animated_grid/animated_grid.0.dart b/examples/api/lib/widgets/animated_grid/animated_grid.0.dart index b09c821725..3f2b55d699 100644 --- a/examples/api/lib/widgets/animated_grid/animated_grid.0.dart +++ b/examples/api/lib/widgets/animated_grid/animated_grid.0.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [AnimatedGrid]. - import 'package:flutter/material.dart'; +/// Flutter code sample for [AnimatedGrid]. + void main() { runApp(const AnimatedGridSample()); } diff --git a/examples/api/lib/widgets/animated_grid/sliver_animated_grid.0.dart b/examples/api/lib/widgets/animated_grid/sliver_animated_grid.0.dart index 34af8c01e4..65c9a0ee61 100644 --- a/examples/api/lib/widgets/animated_grid/sliver_animated_grid.0.dart +++ b/examples/api/lib/widgets/animated_grid/sliver_animated_grid.0.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [SliverAnimatedGrid]. - import 'package:flutter/material.dart'; +/// Flutter code sample for [SliverAnimatedGrid]. + void main() => runApp(const SliverAnimatedGridSample()); class SliverAnimatedGridSample extends StatefulWidget { diff --git a/examples/api/lib/widgets/animated_list/animated_list.0.dart b/examples/api/lib/widgets/animated_list/animated_list.0.dart index 2b195a0931..c59a2435a5 100644 --- a/examples/api/lib/widgets/animated_list/animated_list.0.dart +++ b/examples/api/lib/widgets/animated_list/animated_list.0.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [AnimatedList]. - import 'package:flutter/material.dart'; +/// Flutter code sample for [AnimatedList]. + void main() { runApp(const AnimatedListSample()); } @@ -21,8 +21,7 @@ class _AnimatedListSampleState extends State { final GlobalKey _listKey = GlobalKey(); late ListModel _list; int? _selectedItem; - late int - _nextItem; // The next item inserted when the user presses the '+' button. + late int _nextItem; // The next item inserted when the user presses the '+' button. @override void initState() { @@ -36,8 +35,7 @@ class _AnimatedListSampleState extends State { } // Used to build list items that haven't been removed. - Widget _buildItem( - BuildContext context, int index, Animation animation) { + Widget _buildItem(BuildContext context, int index, Animation animation) { return CardItem( animation: animation, item: _list[index], @@ -57,8 +55,7 @@ class _AnimatedListSampleState extends State { /// completed (even though it's gone as far as this ListModel is concerned). /// The widget will be used by the [AnimatedListState.removeItem] method's /// [AnimatedRemovedItemBuilder] parameter. - Widget _buildRemovedItem( - int item, BuildContext context, Animation animation) { + Widget _buildRemovedItem(int item, BuildContext context, Animation animation) { return CardItem( animation: animation, item: item, @@ -68,8 +65,7 @@ class _AnimatedListSampleState extends State { // Insert the "next item" into the list model. void _insert() { - final int index = - _selectedItem == null ? _list.length : _list.indexOf(_selectedItem!); + final int index = _selectedItem == null ? _list.length : _list.indexOf(_selectedItem!); _list.insert(index, _nextItem++); } @@ -115,8 +111,7 @@ class _AnimatedListSampleState extends State { } } -typedef RemovedItemBuilder = Widget Function( - T item, BuildContext context, Animation animation); +typedef RemovedItemBuilder = Widget Function(T item, BuildContext context, Animation animation); /// Keeps a Dart [List] in sync with an [AnimatedList]. /// @@ -178,7 +173,7 @@ class CardItem extends StatelessWidget { this.selected = false, required this.animation, required this.item, - }) : assert(item >= 0); + }) : assert(item >= 0); final Animation animation; final VoidCallback? onTap; diff --git a/examples/api/lib/widgets/animated_list/sliver_animated_list.0.dart b/examples/api/lib/widgets/animated_list/sliver_animated_list.0.dart index 34677e5417..182b24b8f6 100644 --- a/examples/api/lib/widgets/animated_list/sliver_animated_list.0.dart +++ b/examples/api/lib/widgets/animated_list/sliver_animated_list.0.dart @@ -2,30 +2,26 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [SliverAnimatedList]. - import 'package:flutter/material.dart'; +/// Flutter code sample for [SliverAnimatedList]. + void main() => runApp(const SliverAnimatedListSample()); class SliverAnimatedListSample extends StatefulWidget { const SliverAnimatedListSample({super.key}); @override - State createState() => - _SliverAnimatedListSampleState(); + State createState() => _SliverAnimatedListSampleState(); } class _SliverAnimatedListSampleState extends State { - final GlobalKey _listKey = - GlobalKey(); + final GlobalKey _listKey = GlobalKey(); final GlobalKey _scaffoldKey = GlobalKey(); - final GlobalKey _scaffoldMessengerKey = - GlobalKey(); + final GlobalKey _scaffoldMessengerKey = GlobalKey(); late ListModel _list; int? _selectedItem; - late int - _nextItem; // The next item inserted when the user presses the '+' button. + late int _nextItem; // The next item inserted when the user presses the '+' button. @override void initState() { @@ -39,8 +35,7 @@ class _SliverAnimatedListSampleState extends State { } // Used to build list items that haven't been removed. - Widget _buildItem( - BuildContext context, int index, Animation animation) { + Widget _buildItem(BuildContext context, int index, Animation animation) { return CardItem( animation: animation, item: _list[index], @@ -60,8 +55,7 @@ class _SliverAnimatedListSampleState extends State { /// completed (even though it's gone as far this ListModel is concerned). The /// widget will be used by the [AnimatedListState.removeItem] method's /// [AnimatedRemovedItemBuilder] parameter. - Widget _buildRemovedItem( - int item, BuildContext context, Animation animation) { + Widget _buildRemovedItem(int item, BuildContext context, Animation animation) { return CardItem( animation: animation, item: item, @@ -70,8 +64,7 @@ class _SliverAnimatedListSampleState extends State { // Insert the "next item" into the list model. void _insert() { - final int index = - _selectedItem == null ? _list.length : _list.indexOf(_selectedItem!); + final int index = _selectedItem == null ? _list.length : _list.indexOf(_selectedItem!); _list.insert(index, _nextItem++); } @@ -135,8 +128,7 @@ class _SliverAnimatedListSampleState extends State { } } -typedef RemovedItemBuilder = Widget Function( - E item, BuildContext context, Animation animation); +typedef RemovedItemBuilder = Widget Function(E item, BuildContext context, Animation animation); // Keeps a Dart [List] in sync with an [AnimatedList]. // @@ -170,8 +162,7 @@ class ListModel { if (removedItem != null) { _animatedList.removeItem( index, - (BuildContext context, Animation animation) => - removedItemBuilder(removedItem, context, animation), + (BuildContext context, Animation animation) => removedItemBuilder(removedItem, context, animation), ); } return removedItem; @@ -219,9 +210,7 @@ class CardItem extends StatelessWidget { child: SizedBox( height: 80.0, child: Card( - color: selected - ? Colors.black12 - : Colors.primaries[item % Colors.primaries.length], + color: selected ? Colors.black12 : Colors.primaries[item % Colors.primaries.length], child: Center( child: Text( 'Item $item', diff --git a/examples/api/lib/widgets/animated_size/animated_size.0.dart b/examples/api/lib/widgets/animated_size/animated_size.0.dart index 915eae05c8..76f53b359a 100644 --- a/examples/api/lib/widgets/animated_size/animated_size.0.dart +++ b/examples/api/lib/widgets/animated_size/animated_size.0.dart @@ -2,39 +2,36 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [AnimatedSize]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [AnimatedSize]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const AnimatedSizeExampleApp()); - static const String _title = 'Flutter Code Sample'; +class AnimatedSizeExampleApp extends StatelessWidget { + const AnimatedSizeExampleApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( - title: _title, home: Scaffold( - appBar: AppBar(title: const Text(_title)), + appBar: AppBar(title: const Text('AnimatedSize Sample')), body: const Center( - child: MyStatefulWidget(), + child: AnimatedSizeExample(), ), ), ); } } -class MyStatefulWidget extends StatefulWidget { - const MyStatefulWidget({super.key}); +class AnimatedSizeExample extends StatefulWidget { + const AnimatedSizeExample({super.key}); @override - State createState() => _MyStatefulWidgetState(); + State createState() => _AnimatedSizeExampleState(); } -class _MyStatefulWidgetState extends State { +class _AnimatedSizeExampleState extends State { double _size = 50.0; bool _large = false; diff --git a/examples/api/lib/widgets/animated_switcher/animated_switcher.0.dart b/examples/api/lib/widgets/animated_switcher/animated_switcher.0.dart index 208759cd5e..14055674a7 100644 --- a/examples/api/lib/widgets/animated_switcher/animated_switcher.0.dart +++ b/examples/api/lib/widgets/animated_switcher/animated_switcher.0.dart @@ -2,34 +2,31 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [AnimatedSwitcher]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [AnimatedSwitcher]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const AnimatedSwitcherExampleApp()); - static const String _title = 'Flutter Code Sample'; +class AnimatedSwitcherExampleApp extends StatelessWidget { + const AnimatedSwitcherExampleApp({super.key}); @override Widget build(BuildContext context) { return const MaterialApp( - title: _title, - home: MyStatefulWidget(), + home: AnimatedSwitcherExample(), ); } } -class MyStatefulWidget extends StatefulWidget { - const MyStatefulWidget({super.key}); +class AnimatedSwitcherExample extends StatefulWidget { + const AnimatedSwitcherExample({super.key}); @override - State createState() => _MyStatefulWidgetState(); + State createState() => _AnimatedSwitcherExampleState(); } -class _MyStatefulWidgetState extends State { +class _AnimatedSwitcherExampleState extends State { int _count = 0; @override diff --git a/examples/api/lib/widgets/app/widgets_app.widgets_app.0.dart b/examples/api/lib/widgets/app/widgets_app.widgets_app.0.dart index f09e72c6df..82a8d00e86 100644 --- a/examples/api/lib/widgets/app/widgets_app.widgets_app.0.dart +++ b/examples/api/lib/widgets/app/widgets_app.widgets_app.0.dart @@ -2,14 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [WidgetsApp]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [WidgetsApp]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const WidgetsAppExampleApp()); + +class WidgetsAppExampleApp extends StatelessWidget { + const WidgetsAppExampleApp({super.key}); @override Widget build(BuildContext context) { @@ -19,7 +19,8 @@ class MyApp extends StatelessWidget { home: const Center(child: Text('Hello World')), pageRouteBuilder: (RouteSettings settings, WidgetBuilder builder) => PageRouteBuilder( settings: settings, - pageBuilder: (BuildContext context, Animation animation, Animation secondaryAnimation) => builder(context), + pageBuilder: (BuildContext context, Animation animation, Animation secondaryAnimation) => + builder(context), ), ); } diff --git a/examples/api/lib/widgets/async/future_builder.0.dart b/examples/api/lib/widgets/async/future_builder.0.dart index ed9b5f7071..5684432725 100644 --- a/examples/api/lib/widgets/async/future_builder.0.dart +++ b/examples/api/lib/widgets/async/future_builder.0.dart @@ -2,34 +2,31 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [FutureBuilder]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [FutureBuilder]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const FutureBuilderExampleApp()); - static const String _title = 'Flutter Code Sample'; +class FutureBuilderExampleApp extends StatelessWidget { + const FutureBuilderExampleApp({super.key}); @override Widget build(BuildContext context) { return const MaterialApp( - title: _title, - home: MyStatefulWidget(), + home: FutureBuilderExample(), ); } } -class MyStatefulWidget extends StatefulWidget { - const MyStatefulWidget({super.key}); +class FutureBuilderExample extends StatefulWidget { + const FutureBuilderExample({super.key}); @override - State createState() => _MyStatefulWidgetState(); + State createState() => _FutureBuilderExampleState(); } -class _MyStatefulWidgetState extends State { +class _FutureBuilderExampleState extends State { final Future _calculation = Future.delayed( const Duration(seconds: 2), () => 'Data Loaded', diff --git a/examples/api/lib/widgets/async/stream_builder.0.dart b/examples/api/lib/widgets/async/stream_builder.0.dart index 0456aa27fc..552763aaaf 100644 --- a/examples/api/lib/widgets/async/stream_builder.0.dart +++ b/examples/api/lib/widgets/async/stream_builder.0.dart @@ -2,36 +2,33 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [StreamBuilder]. - import 'dart:async'; import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [StreamBuilder]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const StreamBuilderExampleApp()); - static const String _title = 'Flutter Code Sample'; +class StreamBuilderExampleApp extends StatelessWidget { + const StreamBuilderExampleApp({super.key}); @override Widget build(BuildContext context) { return const MaterialApp( - title: _title, - home: MyStatefulWidget(), + home: StreamBuilderExample(), ); } } -class MyStatefulWidget extends StatefulWidget { - const MyStatefulWidget({super.key}); +class StreamBuilderExample extends StatefulWidget { + const StreamBuilderExample({super.key}); @override - State createState() => _MyStatefulWidgetState(); + State createState() => _StreamBuilderExampleState(); } -class _MyStatefulWidgetState extends State { +class _StreamBuilderExampleState extends State { final Stream _bids = (() { late final StreamController controller; controller = StreamController( diff --git a/examples/api/lib/widgets/autocomplete/raw_autocomplete.0.dart b/examples/api/lib/widgets/autocomplete/raw_autocomplete.0.dart index d2ae2ae997..1cf37060a1 100644 --- a/examples/api/lib/widgets/autocomplete/raw_autocomplete.0.dart +++ b/examples/api/lib/widgets/autocomplete/raw_autocomplete.0.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [RawAutocomplete]. - import 'package:flutter/material.dart'; +/// Flutter code sample for [RawAutocomplete]. + void main() => runApp(const AutocompleteExampleApp()); class AutocompleteExampleApp extends StatelessWidget { @@ -43,10 +43,12 @@ class AutocompleteBasicExample extends StatelessWidget { return option.contains(textEditingValue.text.toLowerCase()); }); }, - fieldViewBuilder: (BuildContext context, - TextEditingController textEditingController, - FocusNode focusNode, - VoidCallback onFieldSubmitted) { + fieldViewBuilder: ( + BuildContext context, + TextEditingController textEditingController, + FocusNode focusNode, + VoidCallback onFieldSubmitted, + ) { return TextFormField( controller: textEditingController, focusNode: focusNode, @@ -55,8 +57,11 @@ class AutocompleteBasicExample extends StatelessWidget { }, ); }, - optionsViewBuilder: (BuildContext context, - AutocompleteOnSelected onSelected, Iterable options) { + optionsViewBuilder: ( + BuildContext context, + AutocompleteOnSelected onSelected, + Iterable options, + ) { return Align( alignment: Alignment.topLeft, child: Material( diff --git a/examples/api/lib/widgets/autocomplete/raw_autocomplete.1.dart b/examples/api/lib/widgets/autocomplete/raw_autocomplete.1.dart index 1bb54d5b1c..2d6a68691b 100644 --- a/examples/api/lib/widgets/autocomplete/raw_autocomplete.1.dart +++ b/examples/api/lib/widgets/autocomplete/raw_autocomplete.1.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [RawAutocomplete]. - import 'package:flutter/material.dart'; +/// Flutter code sample for [RawAutocomplete]. + void main() => runApp(const AutocompleteExampleApp()); class AutocompleteExampleApp extends StatelessWidget { @@ -72,16 +72,16 @@ class AutocompleteCustomTypeExample extends StatelessWidget { return _userOptions.where((User option) { // Search based on User.toString, which includes both name and // email, even though the display string is just the name. - return option - .toString() - .contains(textEditingValue.text.toLowerCase()); + return option.toString().contains(textEditingValue.text.toLowerCase()); }); }, displayStringForOption: _displayStringForOption, - fieldViewBuilder: (BuildContext context, - TextEditingController textEditingController, - FocusNode focusNode, - VoidCallback onFieldSubmitted) { + fieldViewBuilder: ( + BuildContext context, + TextEditingController textEditingController, + FocusNode focusNode, + VoidCallback onFieldSubmitted, + ) { return TextFormField( controller: textEditingController, focusNode: focusNode, @@ -90,8 +90,7 @@ class AutocompleteCustomTypeExample extends StatelessWidget { }, ); }, - optionsViewBuilder: (BuildContext context, - AutocompleteOnSelected onSelected, Iterable options) { + optionsViewBuilder: (BuildContext context, AutocompleteOnSelected onSelected, Iterable options) { return Align( alignment: Alignment.topLeft, child: Material( diff --git a/examples/api/lib/widgets/autocomplete/raw_autocomplete.2.dart b/examples/api/lib/widgets/autocomplete/raw_autocomplete.2.dart index 12bb6dc8bb..8d64360d5a 100644 --- a/examples/api/lib/widgets/autocomplete/raw_autocomplete.2.dart +++ b/examples/api/lib/widgets/autocomplete/raw_autocomplete.2.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [RawAutocomplete]. - import 'package:flutter/material.dart'; +/// Flutter code sample for [RawAutocomplete]. + void main() => runApp(const AutocompleteExampleApp()); class AutocompleteExampleApp extends StatelessWidget { @@ -62,8 +62,7 @@ class AutocompleteFormExampleState extends State { _dropdownValue = newValue; }); }, - items: ['One', 'Two', 'Free', 'Four'] - .map>((String value) { + items: ['One', 'Two', 'Free', 'Four'].map>((String value) { return DropdownMenuItem( value: value, child: Text(value), @@ -99,10 +98,12 @@ class AutocompleteFormExampleState extends State { _autocompleteSelection = selection; }); }, - fieldViewBuilder: (BuildContext context, - TextEditingController textEditingController, - FocusNode focusNode, - VoidCallback onFieldSubmitted) { + fieldViewBuilder: ( + BuildContext context, + TextEditingController textEditingController, + FocusNode focusNode, + VoidCallback onFieldSubmitted, + ) { return TextFormField( controller: textEditingController, decoration: const InputDecoration( @@ -120,9 +121,11 @@ class AutocompleteFormExampleState extends State { }, ); }, - optionsViewBuilder: (BuildContext context, - AutocompleteOnSelected onSelected, - Iterable options) { + optionsViewBuilder: ( + BuildContext context, + AutocompleteOnSelected onSelected, + Iterable options, + ) { return Align( alignment: Alignment.topLeft, child: Material( @@ -164,8 +167,7 @@ class AutocompleteFormExampleState extends State { child: ListBody( children: [ Text('DropdownButtonFormField: "$_dropdownValue"'), - Text( - 'TextFormField: "${_textEditingController.text}"'), + Text('TextFormField: "${_textEditingController.text}"'), Text('RawAutocomplete: "$_autocompleteSelection"'), ], ), diff --git a/examples/api/lib/widgets/autocomplete/raw_autocomplete.focus_node.0.dart b/examples/api/lib/widgets/autocomplete/raw_autocomplete.focus_node.0.dart index 8a30c81e59..c8d5d27cc0 100644 --- a/examples/api/lib/widgets/autocomplete/raw_autocomplete.focus_node.0.dart +++ b/examples/api/lib/widgets/autocomplete/raw_autocomplete.focus_node.0.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [RawAutocomplete.focusNode]. - import 'package:flutter/material.dart'; +/// Flutter code sample for [RawAutocomplete.focusNode]. + void main() => runApp(const AutocompleteExampleApp()); class AutocompleteExampleApp extends StatelessWidget { @@ -64,9 +64,11 @@ class RawAutocompleteSplitState extends State { return option.contains(textEditingValue.text.toLowerCase()); }).toList(); }, - optionsViewBuilder: (BuildContext context, - AutocompleteOnSelected onSelected, - Iterable options) { + optionsViewBuilder: ( + BuildContext context, + AutocompleteOnSelected onSelected, + Iterable options, + ) { return Material( elevation: 4.0, child: ListView( diff --git a/examples/api/lib/widgets/autofill/autofill_group.0.dart b/examples/api/lib/widgets/autofill/autofill_group.0.dart index 61b1f406ac..3b0c397c3b 100644 --- a/examples/api/lib/widgets/autofill/autofill_group.0.dart +++ b/examples/api/lib/widgets/autofill/autofill_group.0.dart @@ -2,37 +2,34 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [AutofillGroup]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [AutofillGroup]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const AutofillGroupExampleApp()); - static const String _title = 'Flutter Code Sample'; +class AutofillGroupExampleApp extends StatelessWidget { + const AutofillGroupExampleApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( - title: _title, home: Scaffold( - appBar: AppBar(title: const Text(_title)), - body: const MyStatefulWidget(), + appBar: AppBar(title: const Text('AutofillGroup Sample')), + body: const AutofillGroupExample(), ), ); } } -class MyStatefulWidget extends StatefulWidget { - const MyStatefulWidget({super.key}); +class AutofillGroupExample extends StatefulWidget { + const AutofillGroupExample({super.key}); @override - State createState() => _MyStatefulWidgetState(); + State createState() => _AutofillGroupExampleState(); } -class _MyStatefulWidgetState extends State { +class _AutofillGroupExampleState extends State { bool isSameAddress = true; final TextEditingController shippingAddress1 = TextEditingController(); final TextEditingController shippingAddress2 = TextEditingController(); diff --git a/examples/api/lib/widgets/basic/absorb_pointer.0.dart b/examples/api/lib/widgets/basic/absorb_pointer.0.dart index 421bb57d6c..d18c36bd87 100644 --- a/examples/api/lib/widgets/basic/absorb_pointer.0.dart +++ b/examples/api/lib/widgets/basic/absorb_pointer.0.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [AbsorbPointer]. - import 'package:flutter/material.dart'; +/// Flutter code sample for [AbsorbPointer]. + void main() => runApp(const AbsorbPointerApp()); class AbsorbPointerApp extends StatelessWidget { diff --git a/examples/api/lib/widgets/basic/aspect_ratio.0.dart b/examples/api/lib/widgets/basic/aspect_ratio.0.dart index bde5a3b09e..4c4e56a51a 100644 --- a/examples/api/lib/widgets/basic/aspect_ratio.0.dart +++ b/examples/api/lib/widgets/basic/aspect_ratio.0.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [AspectRatio]. - import 'package:flutter/material.dart'; +/// Flutter code sample for [AspectRatio]. + void main() => runApp(const AspectRatioApp()); class AspectRatioApp extends StatelessWidget { diff --git a/examples/api/lib/widgets/basic/aspect_ratio.1.dart b/examples/api/lib/widgets/basic/aspect_ratio.1.dart index 500032e68a..a7c823edc1 100644 --- a/examples/api/lib/widgets/basic/aspect_ratio.1.dart +++ b/examples/api/lib/widgets/basic/aspect_ratio.1.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [AspectRatio]. - import 'package:flutter/material.dart'; +/// Flutter code sample for [AspectRatio]. + void main() => runApp(const AspectRatioApp()); class AspectRatioApp extends StatelessWidget { diff --git a/examples/api/lib/widgets/basic/aspect_ratio.2.dart b/examples/api/lib/widgets/basic/aspect_ratio.2.dart index 7d65983e90..23ec8e6d26 100644 --- a/examples/api/lib/widgets/basic/aspect_ratio.2.dart +++ b/examples/api/lib/widgets/basic/aspect_ratio.2.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [AspectRatio]. - import 'package:flutter/material.dart'; +/// Flutter code sample for [AspectRatio]. + void main() => runApp(const AspectRatioApp()); class AspectRatioApp extends StatelessWidget { diff --git a/examples/api/lib/widgets/basic/clip_rrect.0.dart b/examples/api/lib/widgets/basic/clip_rrect.0.dart index 6b7bbd9aa0..da55a5d941 100644 --- a/examples/api/lib/widgets/basic/clip_rrect.0.dart +++ b/examples/api/lib/widgets/basic/clip_rrect.0.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [ClipRRect]. - import 'package:flutter/material.dart'; +/// Flutter code sample for [ClipRRect]. + void main() => runApp(const ClipRRectApp()); class ClipRRectApp extends StatelessWidget { diff --git a/examples/api/lib/widgets/basic/clip_rrect.1.dart b/examples/api/lib/widgets/basic/clip_rrect.1.dart index 829f37cb90..686115a8d8 100644 --- a/examples/api/lib/widgets/basic/clip_rrect.1.dart +++ b/examples/api/lib/widgets/basic/clip_rrect.1.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [ClipRRect]. - import 'package:flutter/material.dart'; +/// Flutter code sample for [ClipRRect]. + void main() => runApp(const ClipRRectApp()); class ClipRRectApp extends StatelessWidget { diff --git a/examples/api/lib/widgets/basic/custom_multi_child_layout.0.dart b/examples/api/lib/widgets/basic/custom_multi_child_layout.0.dart index 570b871813..334cb5ef37 100644 --- a/examples/api/lib/widgets/basic/custom_multi_child_layout.0.dart +++ b/examples/api/lib/widgets/basic/custom_multi_child_layout.0.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [CustomMultiChildLayout]. - import 'package:flutter/material.dart'; +/// Flutter code sample for [CustomMultiChildLayout]. + void main() => runApp(const ExampleApp()); class ExampleApp extends StatelessWidget { @@ -78,8 +78,7 @@ class _CascadeLayoutDelegate extends MultiChildLayoutDelegate { // automatically cause a relayout, like any other widget. @override bool shouldRelayout(_CascadeLayoutDelegate oldDelegate) { - return oldDelegate.textDirection != textDirection - || oldDelegate.overlap != overlap; + return oldDelegate.textDirection != textDirection || oldDelegate.overlap != overlap; } } diff --git a/examples/api/lib/widgets/basic/expanded.0.dart b/examples/api/lib/widgets/basic/expanded.0.dart index df3c4dc75a..e705d4b325 100644 --- a/examples/api/lib/widgets/basic/expanded.0.dart +++ b/examples/api/lib/widgets/basic/expanded.0.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [Expanded]. - import 'package:flutter/material.dart'; +/// Flutter code sample for [Expanded]. + void main() => runApp(const ExpandedApp()); class ExpandedApp extends StatelessWidget { @@ -19,7 +19,7 @@ class ExpandedApp extends StatelessWidget { title: const Text('Expanded Column Sample'), ), body: const ExpandedExample(), - ) + ), ); } } diff --git a/examples/api/lib/widgets/basic/expanded.1.dart b/examples/api/lib/widgets/basic/expanded.1.dart index f0cf2d6236..ed0dbececa 100644 --- a/examples/api/lib/widgets/basic/expanded.1.dart +++ b/examples/api/lib/widgets/basic/expanded.1.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [Expanded]. - import 'package:flutter/material.dart'; +/// Flutter code sample for [Expanded]. + void main() => runApp(const ExpandedApp()); class ExpandedApp extends StatelessWidget { diff --git a/examples/api/lib/widgets/basic/flow.0.dart b/examples/api/lib/widgets/basic/flow.0.dart index a31a42c13b..8a7c600ac6 100644 --- a/examples/api/lib/widgets/basic/flow.0.dart +++ b/examples/api/lib/widgets/basic/flow.0.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [Flow]. - import 'package:flutter/material.dart'; +/// Flutter code sample for [Flow]. + void main() => runApp(const FlowApp()); class FlowApp extends StatelessWidget { @@ -31,8 +31,7 @@ class FlowMenu extends StatefulWidget { State createState() => _FlowMenuState(); } -class _FlowMenuState extends State - with SingleTickerProviderStateMixin { +class _FlowMenuState extends State with SingleTickerProviderStateMixin { late AnimationController menuAnimation; IconData lastTapped = Icons.notifications; final List menuItems = [ @@ -59,8 +58,7 @@ class _FlowMenuState extends State } Widget flowMenuItem(IconData icon) { - final double buttonDiameter = - MediaQuery.of(context).size.width / menuItems.length; + final double buttonDiameter = MediaQuery.of(context).size.width / menuItems.length; return Padding( padding: const EdgeInsets.symmetric(vertical: 8.0), child: RawMaterialButton( @@ -70,9 +68,7 @@ class _FlowMenuState extends State constraints: BoxConstraints.tight(Size(buttonDiameter, buttonDiameter)), onPressed: () { _updateMenu(icon); - menuAnimation.status == AnimationStatus.completed - ? menuAnimation.reverse() - : menuAnimation.forward(); + menuAnimation.status == AnimationStatus.completed ? menuAnimation.reverse() : menuAnimation.forward(); }, child: Icon( icon, @@ -87,15 +83,13 @@ class _FlowMenuState extends State Widget build(BuildContext context) { return Flow( delegate: FlowMenuDelegate(menuAnimation: menuAnimation), - children: - menuItems.map((IconData icon) => flowMenuItem(icon)).toList(), + children: menuItems.map((IconData icon) => flowMenuItem(icon)).toList(), ); } } class FlowMenuDelegate extends FlowDelegate { - FlowMenuDelegate({required this.menuAnimation}) - : super(repaint: menuAnimation); + FlowMenuDelegate({required this.menuAnimation}) : super(repaint: menuAnimation); final Animation menuAnimation; diff --git a/examples/api/lib/widgets/basic/fractionally_sized_box.0.dart b/examples/api/lib/widgets/basic/fractionally_sized_box.0.dart index 95c5d85011..34e357fd31 100644 --- a/examples/api/lib/widgets/basic/fractionally_sized_box.0.dart +++ b/examples/api/lib/widgets/basic/fractionally_sized_box.0.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [FractionallySizedBox]. - import 'package:flutter/material.dart'; +/// Flutter code sample for [FractionallySizedBox]. + void main() => runApp(const FractionallySizedBoxApp()); class FractionallySizedBoxApp extends StatelessWidget { diff --git a/examples/api/lib/widgets/basic/ignore_pointer.0.dart b/examples/api/lib/widgets/basic/ignore_pointer.0.dart index cd6452ce27..5c9b2c3db6 100644 --- a/examples/api/lib/widgets/basic/ignore_pointer.0.dart +++ b/examples/api/lib/widgets/basic/ignore_pointer.0.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [IgnorePointer]. - import 'package:flutter/material.dart'; +/// Flutter code sample for [IgnorePointer]. + void main() => runApp(const IgnorePointerApp()); class IgnorePointerApp extends StatelessWidget { @@ -13,7 +13,7 @@ class IgnorePointerApp extends StatelessWidget { @override Widget build(BuildContext context) { - return MaterialApp( + return MaterialApp( home: Scaffold( appBar: AppBar( centerTitle: true, diff --git a/examples/api/lib/widgets/basic/indexed_stack.0.dart b/examples/api/lib/widgets/basic/indexed_stack.0.dart index bd5ec386e8..f88ab1f470 100644 --- a/examples/api/lib/widgets/basic/indexed_stack.0.dart +++ b/examples/api/lib/widgets/basic/indexed_stack.0.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [IndexedStack]. - import 'package:flutter/material.dart'; +/// Flutter code sample for [IndexedStack]. + void main() => runApp(const IndexedStackApp()); class IndexedStackApp extends StatelessWidget { @@ -76,9 +76,7 @@ class _IndexedStackExampleState extends State { children: [ IndexedStack( index: index, - children: [ - for (String name in names) PersonTracker(name: name) - ], + children: [for (String name in names) PersonTracker(name: name)], ) ], ), diff --git a/examples/api/lib/widgets/basic/listener.0.dart b/examples/api/lib/widgets/basic/listener.0.dart index 32a454afc9..1bddd9b875 100644 --- a/examples/api/lib/widgets/basic/listener.0.dart +++ b/examples/api/lib/widgets/basic/listener.0.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [Listener]. - import 'package:flutter/material.dart'; +/// Flutter code sample for [Listener]. + void main() => runApp(const ListenerApp()); class ListenerApp extends StatelessWidget { @@ -71,8 +71,7 @@ class _ListenerExampleState extends State { child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ - const Text( - 'You have pressed or released in this area this many times:'), + const Text('You have pressed or released in this area this many times:'), Text( '$_downCounter presses\n$_upCounter releases', style: Theme.of(context).textTheme.headlineMedium, diff --git a/examples/api/lib/widgets/basic/mouse_region.0.dart b/examples/api/lib/widgets/basic/mouse_region.0.dart index 1164ae33f9..253eeffc0b 100644 --- a/examples/api/lib/widgets/basic/mouse_region.0.dart +++ b/examples/api/lib/widgets/basic/mouse_region.0.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [MouseRegion]. - import 'package:flutter/material.dart'; +/// Flutter code sample for [MouseRegion]. + void main() => runApp(const MouseRegionApp()); class MouseRegionApp extends StatelessWidget { @@ -69,8 +69,7 @@ class _MouseRegionExampleState extends State { child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ - const Text( - 'You have entered or exited this box this many times:'), + const Text('You have entered or exited this box this many times:'), Text( '$_enterCounter Entries\n$_exitCounter Exits', style: Theme.of(context).textTheme.headlineMedium, diff --git a/examples/api/lib/widgets/basic/mouse_region.on_exit.0.dart b/examples/api/lib/widgets/basic/mouse_region.on_exit.0.dart index bbfe0ac8ce..2ee0b41a1c 100644 --- a/examples/api/lib/widgets/basic/mouse_region.on_exit.0.dart +++ b/examples/api/lib/widgets/basic/mouse_region.on_exit.0.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [MouseRegion.onExit]. - import 'package:flutter/material.dart'; +/// Flutter code sample for [MouseRegion.onExit]. + void main() => runApp(const MouseRegionApp()); class MouseRegionApp extends StatelessWidget { diff --git a/examples/api/lib/widgets/basic/mouse_region.on_exit.1.dart b/examples/api/lib/widgets/basic/mouse_region.on_exit.1.dart index 1a3773b105..4c067817ee 100644 --- a/examples/api/lib/widgets/basic/mouse_region.on_exit.1.dart +++ b/examples/api/lib/widgets/basic/mouse_region.on_exit.1.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [MouseRegion.onExit]. - import 'package:flutter/material.dart'; +/// Flutter code sample for [MouseRegion.onExit]. + void main() => runApp(const MouseRegionApp()); class MouseRegionApp extends StatelessWidget { @@ -26,8 +26,7 @@ class MouseRegionApp extends StatelessWidget { // A region that hides its content one second after being hovered. class MyTimedButton extends StatefulWidget { - const MyTimedButton( - {super.key, required this.onEnterButton, required this.onExitButton}); + const MyTimedButton({super.key, required this.onEnterButton, required this.onExitButton}); final VoidCallback onEnterButton; final VoidCallback onExitButton; @@ -62,23 +61,23 @@ class _MyTimedButton extends State { height: 100, child: MouseRegion( child: regionIsHidden - ? null - : MouseRegion( - onEnter: (_) { - widget.onEnterButton(); - setState(() { - hovered = true; - }); - startCountdown(); - }, - onExit: (_) { - setState(() { - hovered = false; - }); - widget.onExitButton(); - }, - child: Container(color: Colors.red), - ), + ? null + : MouseRegion( + onEnter: (_) { + widget.onEnterButton(); + setState(() { + hovered = true; + }); + startCountdown(); + }, + onExit: (_) { + setState(() { + hovered = false; + }); + widget.onExitButton(); + }, + child: Container(color: Colors.red), + ), ), ); } diff --git a/examples/api/lib/widgets/basic/offstage.0.dart b/examples/api/lib/widgets/basic/offstage.0.dart index dc843ca2a8..ee9e333d4a 100644 --- a/examples/api/lib/widgets/basic/offstage.0.dart +++ b/examples/api/lib/widgets/basic/offstage.0.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [Offstage]. - import 'package:flutter/material.dart'; +/// Flutter code sample for [Offstage]. + void main() => runApp(const OffstageApp()); class OffstageApp extends StatelessWidget { @@ -36,8 +36,7 @@ class _OffstageExampleState extends State { bool _offstage = true; Size _getFlutterLogoSize() { - final RenderBox renderLogo = - _key.currentContext!.findRenderObject()! as RenderBox; + final RenderBox renderLogo = _key.currentContext!.findRenderObject()! as RenderBox; return renderLogo.size; } @@ -68,8 +67,7 @@ class _OffstageExampleState extends State { onPressed: () { ScaffoldMessenger.of(context).showSnackBar( SnackBar( - content: - Text('Flutter Logo size is ${_getFlutterLogoSize()}'), + content: Text('Flutter Logo size is ${_getFlutterLogoSize()}'), ), ); }), diff --git a/examples/api/lib/widgets/basic/overflowbox.0.dart b/examples/api/lib/widgets/basic/overflowbox.0.dart index 626ebabd15..3d4c7bfbe4 100644 --- a/examples/api/lib/widgets/basic/overflowbox.0.dart +++ b/examples/api/lib/widgets/basic/overflowbox.0.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [OverflowBox]. - import 'package:flutter/material.dart'; +/// Flutter code sample for [OverflowBox]. + void main() => runApp(const OverflowBoxApp()); class OverflowBoxApp extends StatelessWidget { diff --git a/examples/api/lib/widgets/basic/physical_shape.0.dart b/examples/api/lib/widgets/basic/physical_shape.0.dart index aaf0bd41d6..e9ec1433ee 100644 --- a/examples/api/lib/widgets/basic/physical_shape.0.dart +++ b/examples/api/lib/widgets/basic/physical_shape.0.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [PhysicalShape]. - import 'package:flutter/material.dart'; +/// Flutter code sample for [PhysicalShape]. + void main() => runApp(const PhysicalShapeApp()); class PhysicalShapeApp extends StatelessWidget { diff --git a/examples/api/lib/widgets/binding/widget_binding_observer.0.dart b/examples/api/lib/widgets/binding/widget_binding_observer.0.dart index 0a2f6061c3..e7076c22c8 100644 --- a/examples/api/lib/widgets/binding/widget_binding_observer.0.dart +++ b/examples/api/lib/widgets/binding/widget_binding_observer.0.dart @@ -2,14 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [WidgetBindingsObserver]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [WidgetBindingsObserver]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const WidgetBindingObserverExampleApp()); + +class WidgetBindingObserverExampleApp extends StatelessWidget { + const WidgetBindingObserverExampleApp({super.key}); @override Widget build(BuildContext context) { @@ -30,20 +30,22 @@ class WidgetBindingsObserverSample extends StatefulWidget { } class _WidgetBindingsObserverSampleState extends State with WidgetsBindingObserver { - final List _stateHistoryList = []; + final List _stateHistoryList = []; @override void initState() { super.initState(); WidgetsBinding.instance.addObserver(this); - if(WidgetsBinding.instance.lifecycleState != null) { + if (WidgetsBinding.instance.lifecycleState != null) { _stateHistoryList.add(WidgetsBinding.instance.lifecycleState!); } } @override void didChangeAppLifecycleState(AppLifecycleState state) { - setState(() { _stateHistoryList.add(state); }); + setState(() { + _stateHistoryList.add(state); + }); } @override @@ -59,9 +61,9 @@ class _WidgetBindingsObserverSampleState extends State('stateHistoryList'), itemCount: _stateHistoryList.length, itemBuilder: (BuildContext context, int index) { - return Text('state is: ${_stateHistoryList[index]}'); - }, - ); + return Text('state is: ${_stateHistoryList[index]}'); + }, + ); } return const Center(child: Text('There are no AppLifecycleStates to show.')); diff --git a/examples/api/lib/widgets/color_filter/color_filtered.0.dart b/examples/api/lib/widgets/color_filter/color_filtered.0.dart index 50158de983..59d8203d0b 100644 --- a/examples/api/lib/widgets/color_filter/color_filtered.0.dart +++ b/examples/api/lib/widgets/color_filter/color_filtered.0.dart @@ -2,31 +2,28 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [ColorFiltered]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [ColorFiltered]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const ColorFilteredExampleApp()); - static const String _title = 'Flutter Code Sample'; +class ColorFilteredExampleApp extends StatelessWidget { + const ColorFilteredExampleApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( - title: _title, home: Scaffold( - appBar: AppBar(title: const Text(_title)), - body: const MyStatelessWidget(), + appBar: AppBar(title: const Text('ColorFiltered Sample')), + body: const ColorFilteredExample(), ), ); } } -class MyStatelessWidget extends StatelessWidget { - const MyStatelessWidget({super.key}); +class ColorFilteredExample extends StatelessWidget { + const ColorFilteredExample({super.key}); @override Widget build(BuildContext context) { diff --git a/examples/api/lib/widgets/dismissible/dismissible.0.dart b/examples/api/lib/widgets/dismissible/dismissible.0.dart index 5cb896e0f6..c148063a54 100644 --- a/examples/api/lib/widgets/dismissible/dismissible.0.dart +++ b/examples/api/lib/widgets/dismissible/dismissible.0.dart @@ -2,37 +2,34 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [Dismissible]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [Dismissible]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const DismissibleExampleApp()); - static const String _title = 'Flutter Code Sample'; +class DismissibleExampleApp extends StatelessWidget { + const DismissibleExampleApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( - title: _title, home: Scaffold( - appBar: AppBar(title: const Text(_title)), - body: const MyStatefulWidget(), + appBar: AppBar(title: const Text('Dismissible Sample')), + body: const DismissibleExample(), ), ); } } -class MyStatefulWidget extends StatefulWidget { - const MyStatefulWidget({super.key}); +class DismissibleExample extends StatefulWidget { + const DismissibleExample({super.key}); @override - State createState() => _MyStatefulWidgetState(); + State createState() => _DismissibleExampleState(); } -class _MyStatefulWidgetState extends State { +class _DismissibleExampleState extends State { List items = List.generate(100, (int index) => index); @override diff --git a/examples/api/lib/widgets/drag_target/draggable.0.dart b/examples/api/lib/widgets/drag_target/draggable.0.dart index 641beafc8d..2d8914a2c0 100644 --- a/examples/api/lib/widgets/drag_target/draggable.0.dart +++ b/examples/api/lib/widgets/drag_target/draggable.0.dart @@ -2,37 +2,34 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [Draggable]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [Draggable]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const DraggableExampleApp()); - static const String _title = 'Flutter Code Sample'; +class DraggableExampleApp extends StatelessWidget { + const DraggableExampleApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( - title: _title, home: Scaffold( - appBar: AppBar(title: const Text(_title)), - body: const MyStatefulWidget(), + appBar: AppBar(title: const Text('Draggable Sample')), + body: const DraggableExample(), ), ); } } -class MyStatefulWidget extends StatefulWidget { - const MyStatefulWidget({super.key}); +class DraggableExample extends StatefulWidget { + const DraggableExample({super.key}); @override - State createState() => _MyStatefulWidgetState(); + State createState() => _DraggableExampleState(); } -class _MyStatefulWidgetState extends State { +class _DraggableExampleState extends State { int acceptedData = 0; @override diff --git a/examples/api/lib/widgets/editable_text/editable_text.on_changed.0.dart b/examples/api/lib/widgets/editable_text/editable_text.on_changed.0.dart index eef91e98f4..9c12a0e3d4 100644 --- a/examples/api/lib/widgets/editable_text/editable_text.on_changed.0.dart +++ b/examples/api/lib/widgets/editable_text/editable_text.on_changed.0.dart @@ -2,34 +2,31 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [EditableText.onChanged]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [EditableText.onChanged]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const OnChangedExampleApp()); - static const String _title = 'Flutter Code Sample'; +class OnChangedExampleApp extends StatelessWidget { + const OnChangedExampleApp({super.key}); @override Widget build(BuildContext context) { return const MaterialApp( - title: _title, - home: MyStatefulWidget(), + home: OnChangedExample(), ); } } -class MyStatefulWidget extends StatefulWidget { - const MyStatefulWidget({super.key}); +class OnChangedExample extends StatefulWidget { + const OnChangedExample({super.key}); @override - State createState() => _MyStatefulWidgetState(); + State createState() => _OnChangedExampleState(); } -class _MyStatefulWidgetState extends State { +class _OnChangedExampleState extends State { final TextEditingController _controller = TextEditingController(); @override diff --git a/examples/api/lib/widgets/editable_text/editable_text.on_content_inserted.0.dart b/examples/api/lib/widgets/editable_text/editable_text.on_content_inserted.0.dart index 73346216be..86ca154488 100644 --- a/examples/api/lib/widgets/editable_text/editable_text.on_content_inserted.0.dart +++ b/examples/api/lib/widgets/editable_text/editable_text.on_content_inserted.0.dart @@ -2,23 +2,20 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for EditableText.onContentInserted - import 'dart:typed_data'; import 'package:flutter/material.dart'; +/// Flutter code sample for [EditableText.onContentInserted]. + void main() => runApp(const KeyboardInsertedContentApp()); class KeyboardInsertedContentApp extends StatelessWidget { const KeyboardInsertedContentApp({super.key}); - static const String _title = 'Keyboard Inserted Content Sample'; - @override Widget build(BuildContext context) { return const MaterialApp( - title: _title, home: KeyboardInsertedContentDemo(), ); } @@ -62,10 +59,8 @@ class _KeyboardInsertedContentDemoState extends State runApp(const MyApp()); +/// Flutter code sample for [TextEditingController]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const TextEditingControllerExampleApp()); - static const String _title = 'Flutter Code Sample'; +class TextEditingControllerExampleApp extends StatelessWidget { + const TextEditingControllerExampleApp({super.key}); @override Widget build(BuildContext context) { return const MaterialApp( - title: _title, - home: MyStatefulWidget(), + home: TextEditingControllerExample(), ); } } -class MyStatefulWidget extends StatefulWidget { - const MyStatefulWidget({super.key}); +class TextEditingControllerExample extends StatefulWidget { + const TextEditingControllerExample({super.key}); @override - State createState() => _MyStatefulWidgetState(); + State createState() => _TextEditingControllerExampleState(); } -class _MyStatefulWidgetState extends State { +class _TextEditingControllerExampleState extends State { final TextEditingController _controller = TextEditingController(); @override @@ -39,8 +36,7 @@ class _MyStatefulWidgetState extends State { final String text = _controller.text.toLowerCase(); _controller.value = _controller.value.copyWith( text: text, - selection: - TextSelection(baseOffset: text.length, extentOffset: text.length), + selection: TextSelection(baseOffset: text.length, extentOffset: text.length), composing: TextRange.empty, ); }); diff --git a/examples/api/lib/widgets/focus_manager/focus_node.0.dart b/examples/api/lib/widgets/focus_manager/focus_node.0.dart index aaaf2a9b0d..8069a7e071 100644 --- a/examples/api/lib/widgets/focus_manager/focus_node.0.dart +++ b/examples/api/lib/widgets/focus_manager/focus_node.0.dart @@ -2,25 +2,22 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [FocusNode]. - import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [FocusNode]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const FocusNodeExampleApp()); - static const String _title = 'Flutter Code Sample'; +class FocusNodeExampleApp extends StatelessWidget { + const FocusNodeExampleApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( - title: _title, home: Scaffold( - appBar: AppBar(title: const Text(_title)), - body: const MyStatelessWidget(), + appBar: AppBar(title: const Text('FocusNode Sample')), + body: const FocusNodeExample(), ), ); } @@ -106,16 +103,15 @@ class _ColorfulButtonState extends State { height: 100, color: _focused ? _color : Colors.white, alignment: Alignment.center, - child: - Text(_focused ? "I'm in color! Press R,G,B!" : 'Press to focus'), + child: Text(_focused ? "I'm in color! Press R,G,B!" : 'Press to focus'), ), ), ); } } -class MyStatelessWidget extends StatelessWidget { - const MyStatelessWidget({super.key}); +class FocusNodeExample extends StatelessWidget { + const FocusNodeExample({super.key}); @override Widget build(BuildContext context) { diff --git a/examples/api/lib/widgets/focus_manager/focus_node.unfocus.0.dart b/examples/api/lib/widgets/focus_manager/focus_node.unfocus.0.dart index 8e57aca418..e568bc2101 100644 --- a/examples/api/lib/widgets/focus_manager/focus_node.unfocus.0.dart +++ b/examples/api/lib/widgets/focus_manager/focus_node.unfocus.0.dart @@ -2,35 +2,31 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [FocusNode.unfocus]. - - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [FocusNode.unfocus]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const UnfocusExampleApp()); - static const String _title = 'Flutter Code Sample'; +class UnfocusExampleApp extends StatelessWidget { + const UnfocusExampleApp({super.key}); @override Widget build(BuildContext context) { return const MaterialApp( - title: _title, - home: MyStatefulWidget(), + home: UnfocusExample(), ); } } -class MyStatefulWidget extends StatefulWidget { - const MyStatefulWidget({super.key}); +class UnfocusExample extends StatefulWidget { + const UnfocusExample({super.key}); @override - State createState() => _MyStatefulWidgetState(); + State createState() => _UnfocusExampleState(); } -class _MyStatefulWidgetState extends State { +class _UnfocusExampleState extends State { UnfocusDisposition disposition = UnfocusDisposition.scope; @override @@ -57,8 +53,7 @@ class _MyStatefulWidgetState extends State { Row( mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ - ...List.generate(UnfocusDisposition.values.length, - (int index) { + ...List.generate(UnfocusDisposition.values.length, (int index) { return Row( mainAxisSize: MainAxisSize.min, children: [ diff --git a/examples/api/lib/widgets/focus_scope/focus.0.dart b/examples/api/lib/widgets/focus_scope/focus.0.dart index 4defbdfe3d..f62d5de6ea 100644 --- a/examples/api/lib/widgets/focus_scope/focus.0.dart +++ b/examples/api/lib/widgets/focus_scope/focus.0.dart @@ -2,38 +2,35 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [Focus]. - import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [Focus]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const FocusExampleApp()); - static const String _title = 'Flutter Code Sample'; +class FocusExampleApp extends StatelessWidget { + const FocusExampleApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( - title: _title, home: Scaffold( - appBar: AppBar(title: const Text(_title)), - body: const MyStatefulWidget(), + appBar: AppBar(title: const Text('Focus Sample')), + body: const FocusExample(), ), ); } } -class MyStatefulWidget extends StatefulWidget { - const MyStatefulWidget({super.key}); +class FocusExample extends StatefulWidget { + const FocusExample({super.key}); @override - State createState() => _MyStatefulWidgetState(); + State createState() => _FocusExampleState(); } -class _MyStatefulWidgetState extends State { +class _FocusExampleState extends State { Color _color = Colors.white; KeyEventResult _handleKeyPress(FocusNode node, RawKeyEvent event) { @@ -91,9 +88,7 @@ class _MyStatefulWidgetState extends State { height: 100, alignment: Alignment.center, color: hasFocus ? _color : Colors.white, - child: Text(hasFocus - ? "I'm in color! Press R,G,B!" - : 'Press to focus'), + child: Text(hasFocus ? "I'm in color! Press R,G,B!" : 'Press to focus'), ), ), ); diff --git a/examples/api/lib/widgets/focus_scope/focus.1.dart b/examples/api/lib/widgets/focus_scope/focus.1.dart index ed6f46e721..8bbe09092f 100644 --- a/examples/api/lib/widgets/focus_scope/focus.1.dart +++ b/examples/api/lib/widgets/focus_scope/focus.1.dart @@ -2,22 +2,19 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [Focus]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [Focus]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const FocusExampleApp()); - static const String _title = 'Flutter Code Sample'; +class FocusExampleApp extends StatelessWidget { + const FocusExampleApp({super.key}); @override Widget build(BuildContext context) { return const MaterialApp( - title: _title, - home: MyStatelessWidget(), + home: FocusExample(), ); } } @@ -58,8 +55,8 @@ class FocusableText extends StatelessWidget { } } -class MyStatelessWidget extends StatelessWidget { - const MyStatelessWidget({super.key}); +class FocusExample extends StatelessWidget { + const FocusExample({super.key}); @override Widget build(BuildContext context) { diff --git a/examples/api/lib/widgets/focus_scope/focus.2.dart b/examples/api/lib/widgets/focus_scope/focus.2.dart index 53876c5b7e..4451b3db07 100644 --- a/examples/api/lib/widgets/focus_scope/focus.2.dart +++ b/examples/api/lib/widgets/focus_scope/focus.2.dart @@ -2,34 +2,31 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [Focus]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [Focus]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const FocusExampleApp()); - static const String _title = 'Flutter Code Sample'; +class FocusExampleApp extends StatelessWidget { + const FocusExampleApp({super.key}); @override Widget build(BuildContext context) { return const MaterialApp( - title: _title, - home: MyStatefulWidget(), + home: FocusExample(), ); } } -class MyStatefulWidget extends StatefulWidget { - const MyStatefulWidget({super.key}); +class FocusExample extends StatefulWidget { + const FocusExample({super.key}); @override - State createState() => _MyStatefulWidgetState(); + State createState() => _FocusExampleState(); } -class _MyStatefulWidgetState extends State { +class _FocusExampleState extends State { int focusedChild = 0; List children = []; List childFocusNodes = []; @@ -52,8 +49,7 @@ class _MyStatefulWidgetState extends State { void _addChild() { // Calling requestFocus here creates a deferred request for focus, since the // node is not yet part of the focus tree. - childFocusNodes - .add(FocusNode(debugLabel: 'Child ${children.length}')..requestFocus()); + childFocusNodes.add(FocusNode(debugLabel: 'Child ${children.length}')..requestFocus()); children.add(Padding( padding: const EdgeInsets.all(2.0), diff --git a/examples/api/lib/widgets/focus_scope/focus_scope.0.dart b/examples/api/lib/widgets/focus_scope/focus_scope.0.dart index 5383d68b1f..20f4c900ae 100644 --- a/examples/api/lib/widgets/focus_scope/focus_scope.0.dart +++ b/examples/api/lib/widgets/focus_scope/focus_scope.0.dart @@ -2,22 +2,19 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [FocusScope]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [FocusScope]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const FocusScopeExampleApp()); - static const String _title = 'Flutter Code Sample'; +class FocusScopeExampleApp extends StatelessWidget { + const FocusScopeExampleApp({super.key}); @override Widget build(BuildContext context) { return const MaterialApp( - title: _title, - home: MyStatefulWidget(), + home: FocusScopeExample(), ); } } @@ -66,14 +63,14 @@ class Pane extends StatelessWidget { } } -class MyStatefulWidget extends StatefulWidget { - const MyStatefulWidget({super.key}); +class FocusScopeExample extends StatefulWidget { + const FocusScopeExample({super.key}); @override - State createState() => _MyStatefulWidgetState(); + State createState() => _FocusScopeExampleState(); } -class _MyStatefulWidgetState extends State { +class _FocusScopeExampleState extends State { bool backdropIsVisible = false; FocusNode backdropNode = FocusNode(debugLabel: 'Close Backdrop Button'); FocusNode foregroundNode = FocusNode(debugLabel: 'Option Button'); @@ -119,8 +116,9 @@ class _MyStatefulWidgetState extends State { child: const Text('ANOTHER BUTTON TO FOCUS'), ), DefaultTextStyle( - style: Theme.of(context).textTheme.displayMedium!, - child: const Text('BACKDROP')), + style: Theme.of(context).textTheme.displayMedium!, + child: const Text('BACKDROP'), + ), ], ), ), @@ -144,12 +142,11 @@ class _MyStatefulWidgetState extends State { // TRY THIS: Try changing this to Colors.green.withOpacity(0.8) to see for // yourself that the hidden components do/don't get focus. backgroundColor: Colors.green, - onPressed: backdropIsVisible - ? null - : () => setState(() => backdropIsVisible = true), + onPressed: backdropIsVisible ? null : () => setState(() => backdropIsVisible = true), child: DefaultTextStyle( - style: Theme.of(context).textTheme.displayMedium!, - child: const Text('FOREGROUND')), + style: Theme.of(context).textTheme.displayMedium!, + child: const Text('FOREGROUND'), + ), ), ), ], diff --git a/examples/api/lib/widgets/focus_traversal/focus_traversal_group.0.dart b/examples/api/lib/widgets/focus_traversal/focus_traversal_group.0.dart index cf9770a081..818eb2ac1f 100644 --- a/examples/api/lib/widgets/focus_traversal/focus_traversal_group.0.dart +++ b/examples/api/lib/widgets/focus_traversal/focus_traversal_group.0.dart @@ -2,22 +2,19 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [FocusTraversalGroup]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [FocusTraversalGroup]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const FocusTraversalGroupExampleApp()); - static const String _title = 'Flutter Code Sample'; +class FocusTraversalGroupExampleApp extends StatelessWidget { + const FocusTraversalGroupExampleApp({super.key}); @override Widget build(BuildContext context) { return const MaterialApp( - title: _title, - home: MyStatelessWidget(), + home: FocusTraversalGroupExample(), ); } } @@ -92,8 +89,7 @@ class _OrderedButtonState extends State> { } Color? foregroundColor(Set states) { - if (states.contains(MaterialState.focused) || - states.contains(MaterialState.hovered)) { + if (states.contains(MaterialState.focused) || states.contains(MaterialState.hovered)) { return Colors.white; } return null; // defer to the default foregroundColor @@ -107,10 +103,8 @@ class _OrderedButtonState extends State> { focusNode: focusNode, autofocus: widget.autofocus, style: ButtonStyle( - overlayColor: - MaterialStateProperty.resolveWith(overlayColor), - foregroundColor: - MaterialStateProperty.resolveWith(foregroundColor), + overlayColor: MaterialStateProperty.resolveWith(overlayColor), + foregroundColor: MaterialStateProperty.resolveWith(foregroundColor), ), onPressed: () => _handleOnPressed(), child: Text(widget.name), @@ -120,8 +114,8 @@ class _OrderedButtonState extends State> { } } -class MyStatelessWidget extends StatelessWidget { - const MyStatelessWidget({super.key}); +class FocusTraversalGroupExample extends StatelessWidget { + const FocusTraversalGroupExample({super.key}); @override Widget build(BuildContext context) { @@ -153,8 +147,7 @@ class MyStatelessWidget extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.center, children: List.generate(3, (int index) { // Order as "C" "B", "A". - final String order = - String.fromCharCode('A'.codeUnitAt(0) + (2 - index)); + final String order = String.fromCharCode('A'.codeUnitAt(0) + (2 - index)); return OrderedButton( name: 'String: $order', order: order, diff --git a/examples/api/lib/widgets/focus_traversal/ordered_traversal_policy.0.dart b/examples/api/lib/widgets/focus_traversal/ordered_traversal_policy.0.dart index b9e0c0290c..62f14f12c0 100644 --- a/examples/api/lib/widgets/focus_traversal/ordered_traversal_policy.0.dart +++ b/examples/api/lib/widgets/focus_traversal/ordered_traversal_policy.0.dart @@ -2,25 +2,22 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [OrderedTraversalPolicy]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [OrderedTraversalPolicy]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const OrderedTraversalPolicyExampleApp()); - static const String _title = 'Flutter Code Sample'; +class OrderedTraversalPolicyExampleApp extends StatelessWidget { + const OrderedTraversalPolicyExampleApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( - title: _title, home: Scaffold( - appBar: AppBar(title: const Text(_title)), + appBar: AppBar(title: const Text('OrderedTraversalPolicy Sample')), body: const Center( - child: MyStatelessWidget(), + child: OrderedTraversalPolicyExample(), ), ), ); @@ -57,8 +54,8 @@ class DemoButton extends StatelessWidget { } } -class MyStatelessWidget extends StatelessWidget { - const MyStatelessWidget({super.key}); +class OrderedTraversalPolicyExample extends StatelessWidget { + const OrderedTraversalPolicyExample({super.key}); @override Widget build(BuildContext context) { diff --git a/examples/api/lib/widgets/form/form.0.dart b/examples/api/lib/widgets/form/form.0.dart index e82291dc10..18b50c94b7 100644 --- a/examples/api/lib/widgets/form/form.0.dart +++ b/examples/api/lib/widgets/form/form.0.dart @@ -2,37 +2,34 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [Form]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [Form]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const FormExampleApp()); - static const String _title = 'Flutter Code Sample'; +class FormExampleApp extends StatelessWidget { + const FormExampleApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( - title: _title, home: Scaffold( - appBar: AppBar(title: const Text(_title)), - body: const MyStatefulWidget(), + appBar: AppBar(title: const Text('Form Sample')), + body: const FormExample(), ), ); } } -class MyStatefulWidget extends StatefulWidget { - const MyStatefulWidget({super.key}); +class FormExample extends StatefulWidget { + const FormExample({super.key}); @override - State createState() => _MyStatefulWidgetState(); + State createState() => _FormExampleState(); } -class _MyStatefulWidgetState extends State { +class _FormExampleState extends State { final GlobalKey _formKey = GlobalKey(); @override diff --git a/examples/api/lib/widgets/framework/build_owner.0.dart b/examples/api/lib/widgets/framework/build_owner.0.dart index 1bca301de9..ab173907c3 100644 --- a/examples/api/lib/widgets/framework/build_owner.0.dart +++ b/examples/api/lib/widgets/framework/build_owner.0.dart @@ -2,11 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [BuildOwner]. - import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; +/// Flutter code sample for [BuildOwner]. + void main() { WidgetsFlutterBinding.ensureInitialized(); final Size size = measureWidget(const SizedBox(width: 640, height: 480)); diff --git a/examples/api/lib/widgets/framework/error_widget.0.dart b/examples/api/lib/widgets/framework/error_widget.0.dart index 73ef0fff58..3be9ff88cb 100644 --- a/examples/api/lib/widgets/framework/error_widget.0.dart +++ b/examples/api/lib/widgets/framework/error_widget.0.dart @@ -2,11 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [ErrorWidget]. - import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; +/// Flutter code sample for [ErrorWidget]. + void main() { // Set the ErrorWidget's builder before the app is started. ErrorWidget.builder = (FlutterErrorDetails details) { @@ -28,19 +28,17 @@ void main() { }; // Start the app. - runApp(const MyApp()); + runApp(const ErrorWidgetExampleApp()); } -class MyApp extends StatefulWidget { - const MyApp({super.key}); - - static const String _title = 'ErrorWidget Sample'; +class ErrorWidgetExampleApp extends StatefulWidget { + const ErrorWidgetExampleApp({super.key}); @override - State createState() => _MyAppState(); + State createState() => _ErrorWidgetExampleAppState(); } -class _MyAppState extends State { +class _ErrorWidgetExampleAppState extends State { bool throwError = false; @override @@ -55,13 +53,14 @@ class _MyAppState extends State { ); } else { return MaterialApp( - title: MyApp._title, home: Scaffold( - appBar: AppBar(title: const Text(MyApp._title)), + appBar: AppBar(title: const Text('ErrorWidget Sample')), body: Center( child: TextButton( onPressed: () { - setState(() { throwError = true; }); + setState(() { + throwError = true; + }); }, child: const Text('Error Prone')), ), diff --git a/examples/api/lib/widgets/gesture_detector/gesture_detector.0.dart b/examples/api/lib/widgets/gesture_detector/gesture_detector.0.dart index f6010ac504..21b1ff98d5 100644 --- a/examples/api/lib/widgets/gesture_detector/gesture_detector.0.dart +++ b/examples/api/lib/widgets/gesture_detector/gesture_detector.0.dart @@ -2,34 +2,31 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [GestureDetector]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [GestureDetector]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const GestureDetectorExampleApp()); - static const String _title = 'Flutter Code Sample'; +class GestureDetectorExampleApp extends StatelessWidget { + const GestureDetectorExampleApp({super.key}); @override Widget build(BuildContext context) { return const MaterialApp( - title: _title, - home: MyStatefulWidget(), + home: GestureDetectorExample(), ); } } -class MyStatefulWidget extends StatefulWidget { - const MyStatefulWidget({super.key}); +class GestureDetectorExample extends StatefulWidget { + const GestureDetectorExample({super.key}); @override - State createState() => _MyStatefulWidgetState(); + State createState() => _GestureDetectorExampleState(); } -class _MyStatefulWidgetState extends State { +class _GestureDetectorExampleState extends State { bool _lightIsOn = false; @override diff --git a/examples/api/lib/widgets/gesture_detector/gesture_detector.1.dart b/examples/api/lib/widgets/gesture_detector/gesture_detector.1.dart index fd0606bde2..11212d1423 100644 --- a/examples/api/lib/widgets/gesture_detector/gesture_detector.1.dart +++ b/examples/api/lib/widgets/gesture_detector/gesture_detector.1.dart @@ -2,34 +2,31 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [GestureDetector]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [GestureDetector]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const GestureDetectorExampleApp()); - static const String _title = 'Flutter Code Sample'; +class GestureDetectorExampleApp extends StatelessWidget { + const GestureDetectorExampleApp({super.key}); @override Widget build(BuildContext context) { return const MaterialApp( - title: _title, - home: MyStatefulWidget(), + home: GestureDetectorExample(), ); } } -class MyStatefulWidget extends StatefulWidget { - const MyStatefulWidget({super.key}); +class GestureDetectorExample extends StatefulWidget { + const GestureDetectorExample({super.key}); @override - State createState() => _MyStatefulWidgetState(); + State createState() => _GestureDetectorExampleState(); } -class _MyStatefulWidgetState extends State { +class _GestureDetectorExampleState extends State { Color _color = Colors.white; @override @@ -41,9 +38,7 @@ class _MyStatefulWidgetState extends State { child: GestureDetector( onTap: () { setState(() { - _color == Colors.yellow - ? _color = Colors.white - : _color = Colors.yellow; + _color == Colors.yellow ? _color = Colors.white : _color = Colors.yellow; }); }, ), diff --git a/examples/api/lib/widgets/gesture_detector/gesture_detector.2.dart b/examples/api/lib/widgets/gesture_detector/gesture_detector.2.dart index 6017ffb4c3..594545301c 100644 --- a/examples/api/lib/widgets/gesture_detector/gesture_detector.2.dart +++ b/examples/api/lib/widgets/gesture_detector/gesture_detector.2.dart @@ -2,11 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [GestureDetector]. - import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; +/// Flutter code sample for [GestureDetector]. + void main() { debugPrintGestureArenaDiagnostics = true; runApp(const NestedGestureDetectorsApp()); @@ -35,8 +35,7 @@ class NestedGestureDetectorsExample extends StatefulWidget { State createState() => _NestedGestureDetectorsExampleState(); } -class _NestedGestureDetectorsExampleState - extends State { +class _NestedGestureDetectorsExampleState extends State { bool _isYellowTranslucent = false; _OnTapWinner _winner = _OnTapWinner.none; final Border highlightBorder = Border.all(color: Colors.red, width: 5); @@ -66,9 +65,7 @@ class _NestedGestureDetectorsExampleState // parent-child hit testing. A tap on 'Yellow' is also in // 'Green' bounds. Both enter the gesture arena, 'Yellow' wins // because it is in front. - behavior: _isYellowTranslucent - ? HitTestBehavior.translucent - : HitTestBehavior.opaque, + behavior: _isYellowTranslucent ? HitTestBehavior.translucent : HitTestBehavior.opaque, onTap: () { debugPrint('Yellow onTap'); setState(() { diff --git a/examples/api/lib/widgets/hardware_keyboard/key_event_manager.0.dart b/examples/api/lib/widgets/hardware_keyboard/key_event_manager.0.dart index e899078f03..9c5fd5150c 100644 --- a/examples/api/lib/widgets/hardware_keyboard/key_event_manager.0.dart +++ b/examples/api/lib/widgets/hardware_keyboard/key_event_manager.0.dart @@ -2,20 +2,22 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [KeyEventManager.keyMessageHandler]. - import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; -void main() => runApp( - const MaterialApp( - home: Scaffold( - body: Center( - child: FallbackDemo(), - ) +/// Flutter code sample for [KeyEventManager.keyMessageHandler]. + +void main() { + runApp( + const MaterialApp( + home: Scaffold( + body: Center( + child: FallbackDemo(), + ), + ), ), - ), -); + ); +} class FallbackDemo extends StatefulWidget { const FallbackDemo({super.key}); @@ -38,7 +40,7 @@ class FallbackDemoState extends State { // to type text, because these key events will no longer be sent to the // text input system. return false; - } + }, ); @override @@ -52,7 +54,7 @@ class FallbackDemoState extends State { child: Column( children: [ const Text('This area handles key presses that are unhandled by any shortcuts, by ' - 'displaying them below. Try text shortcuts such as Ctrl-A!'), + 'displaying them below. Try text shortcuts such as Ctrl-A!'), Text(_capture == null ? '' : '$_capture is not handled by shortcuts.'), const TextField(decoration: InputDecoration(label: Text('Text field 1'))), Shortcuts( @@ -67,7 +69,7 @@ class FallbackDemoState extends State { ), ], ), - ) + ), ); } } @@ -113,6 +115,7 @@ class FallbackKeyEventRegistrar { } return _instance; } + static bool _initialized = false; static final FallbackKeyEventRegistrar _instance = FallbackKeyEventRegistrar._(); diff --git a/examples/api/lib/widgets/heroes/hero.0.dart b/examples/api/lib/widgets/heroes/hero.0.dart index c81cfbe88f..2c6772ee28 100644 --- a/examples/api/lib/widgets/heroes/hero.0.dart +++ b/examples/api/lib/widgets/heroes/hero.0.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [Hero]. - import 'package:flutter/material.dart'; +/// Flutter code sample for [Hero]. + void main() => runApp(const HeroApp()); class HeroApp extends StatelessWidget { diff --git a/examples/api/lib/widgets/heroes/hero.1.dart b/examples/api/lib/widgets/heroes/hero.1.dart index 51685ce6cf..f71686208c 100644 --- a/examples/api/lib/widgets/heroes/hero.1.dart +++ b/examples/api/lib/widgets/heroes/hero.1.dart @@ -2,11 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [Hero]. - import 'package:flutter/material.dart'; import 'package:flutter/scheduler.dart'; +/// Flutter code sample for [Hero]. + void main() { // Slow down time to see Hero flight animation. timeDilation = 15.0; @@ -38,7 +38,7 @@ class HeroExample extends StatelessWidget { tag: 'hero-default-tween', child: BoxWidget( size: const Size(50.0, 50.0), - color:Colors.red[700]!.withOpacity(0.5), + color: Colors.red[700]!.withOpacity(0.5), ), ), title: const Text( @@ -54,7 +54,7 @@ class HeroExample extends StatelessWidget { }, child: BoxWidget( size: const Size(50.0, 50.0), - color:Colors.blue[700]!.withOpacity(0.5), + color: Colors.blue[700]!.withOpacity(0.5), ), ), title: const Text( diff --git a/examples/api/lib/widgets/image/image.error_builder.0.dart b/examples/api/lib/widgets/image/image.error_builder.0.dart index be1aa826d1..e076c45b8f 100644 --- a/examples/api/lib/widgets/image/image.error_builder.0.dart +++ b/examples/api/lib/widgets/image/image.error_builder.0.dart @@ -2,32 +2,29 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [Image.errorBuilder]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [Image.errorBuilder]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const ErrorBuilderExampleApp()); - static const String _title = 'Flutter Code Sample'; +class ErrorBuilderExampleApp extends StatelessWidget { + const ErrorBuilderExampleApp({super.key}); @override Widget build(BuildContext context) { return const MaterialApp( - title: _title, home: Scaffold( body: Center( - child: MyStatelessWidget(), + child: ErrorBuilderExample(), ), ), ); } } -class MyStatelessWidget extends StatelessWidget { - const MyStatelessWidget({super.key}); +class ErrorBuilderExample extends StatelessWidget { + const ErrorBuilderExample({super.key}); @override Widget build(BuildContext context) { @@ -39,8 +36,7 @@ class MyStatelessWidget extends StatelessWidget { ), child: Image.network( 'https://example.does.not.exist/image.jpg', - errorBuilder: - (BuildContext context, Object exception, StackTrace? stackTrace) { + errorBuilder: (BuildContext context, Object exception, StackTrace? stackTrace) { // Appropriate logging or analytics, e.g. // myAnalytics.recordError( // 'An error occurred loading "https://example.does.not.exist/image.jpg"', diff --git a/examples/api/lib/widgets/image/image.frame_builder.0.dart b/examples/api/lib/widgets/image/image.frame_builder.0.dart index b04d6f8805..809fd6319e 100644 --- a/examples/api/lib/widgets/image/image.frame_builder.0.dart +++ b/examples/api/lib/widgets/image/image.frame_builder.0.dart @@ -2,28 +2,25 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [Image.frameBuilder]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [Image.frameBuilder]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const FrameBuilderExampleApp()); - static const String _title = 'Flutter Code Sample'; +class FrameBuilderExampleApp extends StatelessWidget { + const FrameBuilderExampleApp({super.key}); @override Widget build(BuildContext context) { return const MaterialApp( - title: _title, - home: MyStatelessWidget(), + home: FrameBuilderExample(), ); } } -class MyStatelessWidget extends StatelessWidget { - const MyStatelessWidget({super.key}); +class FrameBuilderExample extends StatelessWidget { + const FrameBuilderExample({super.key}); @override @override @@ -36,8 +33,7 @@ class MyStatelessWidget extends StatelessWidget { ), child: Image.network( 'https://flutter.github.io/assets-for-api-docs/assets/widgets/puffin.jpg', - frameBuilder: (BuildContext context, Widget child, int? frame, - bool wasSynchronouslyLoaded) { + frameBuilder: (BuildContext context, Widget child, int? frame, bool wasSynchronouslyLoaded) { if (wasSynchronouslyLoaded) { return child; } diff --git a/examples/api/lib/widgets/image/image.loading_builder.0.dart b/examples/api/lib/widgets/image/image.loading_builder.0.dart index 6e9b97f1fe..3005bf0c0a 100644 --- a/examples/api/lib/widgets/image/image.loading_builder.0.dart +++ b/examples/api/lib/widgets/image/image.loading_builder.0.dart @@ -2,28 +2,25 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [Image.loadingBuilder]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [Image.loadingBuilder]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const LoadingBuilderExampleApp()); - static const String _title = 'Flutter Code Sample'; +class LoadingBuilderExampleApp extends StatelessWidget { + const LoadingBuilderExampleApp({super.key}); @override Widget build(BuildContext context) { return const MaterialApp( - title: _title, - home: MyStatelessWidget(), + home: LoadingBuilderExample(), ); } } -class MyStatelessWidget extends StatelessWidget { - const MyStatelessWidget({super.key}); +class LoadingBuilderExample extends StatelessWidget { + const LoadingBuilderExample({super.key}); @override Widget build(BuildContext context) { @@ -35,16 +32,14 @@ class MyStatelessWidget extends StatelessWidget { ), child: Image.network( 'https://flutter.github.io/assets-for-api-docs/assets/widgets/falcon.jpg', - loadingBuilder: (BuildContext context, Widget child, - ImageChunkEvent? loadingProgress) { + loadingBuilder: (BuildContext context, Widget child, ImageChunkEvent? loadingProgress) { if (loadingProgress == null) { return child; } return Center( child: CircularProgressIndicator( value: loadingProgress.expectedTotalBytes != null - ? loadingProgress.cumulativeBytesLoaded / - loadingProgress.expectedTotalBytes! + ? loadingProgress.cumulativeBytesLoaded / loadingProgress.expectedTotalBytes! : null, ), ); diff --git a/examples/api/lib/widgets/implicit_animations/animated_align.0.dart b/examples/api/lib/widgets/implicit_animations/animated_align.0.dart index 3a73a99ccf..6f73cf704b 100644 --- a/examples/api/lib/widgets/implicit_animations/animated_align.0.dart +++ b/examples/api/lib/widgets/implicit_animations/animated_align.0.dart @@ -2,37 +2,34 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [AnimatedAlign]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [AnimatedAlign]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const AnimatedAlignExampleApp()); - static const String _title = 'Flutter Code Sample'; +class AnimatedAlignExampleApp extends StatelessWidget { + const AnimatedAlignExampleApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( - title: _title, home: Scaffold( - appBar: AppBar(title: const Text(_title)), - body: const MyStatefulWidget(), + appBar: AppBar(title: const Text('AnimatedAlign Sample')), + body: const AnimatedAlignExample(), ), ); } } -class MyStatefulWidget extends StatefulWidget { - const MyStatefulWidget({super.key}); +class AnimatedAlignExample extends StatefulWidget { + const AnimatedAlignExample({super.key}); @override - State createState() => _MyStatefulWidgetState(); + State createState() => _AnimatedAlignExampleState(); } -class _MyStatefulWidgetState extends State { +class _AnimatedAlignExampleState extends State { bool selected = false; @override diff --git a/examples/api/lib/widgets/implicit_animations/animated_container.0.dart b/examples/api/lib/widgets/implicit_animations/animated_container.0.dart index a374cd0865..a9706e56e2 100644 --- a/examples/api/lib/widgets/implicit_animations/animated_container.0.dart +++ b/examples/api/lib/widgets/implicit_animations/animated_container.0.dart @@ -2,37 +2,34 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [AnimatedContainer]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [AnimatedContainer]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const AnimatedContainerExampleApp()); - static const String _title = 'Flutter Code Sample'; +class AnimatedContainerExampleApp extends StatelessWidget { + const AnimatedContainerExampleApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( - title: _title, home: Scaffold( - appBar: AppBar(title: const Text(_title)), - body: const MyStatefulWidget(), + appBar: AppBar(title: const Text('AnimatedContainer Sample')), + body: const AnimatedContainerExample(), ), ); } } -class MyStatefulWidget extends StatefulWidget { - const MyStatefulWidget({super.key}); +class AnimatedContainerExample extends StatefulWidget { + const AnimatedContainerExample({super.key}); @override - State createState() => _MyStatefulWidgetState(); + State createState() => _AnimatedContainerExampleState(); } -class _MyStatefulWidgetState extends State { +class _AnimatedContainerExampleState extends State { bool selected = false; @override @@ -48,8 +45,7 @@ class _MyStatefulWidgetState extends State { width: selected ? 200.0 : 100.0, height: selected ? 100.0 : 200.0, color: selected ? Colors.red : Colors.blue, - alignment: - selected ? Alignment.center : AlignmentDirectional.topCenter, + alignment: selected ? Alignment.center : AlignmentDirectional.topCenter, duration: const Duration(seconds: 2), curve: Curves.fastOutSlowIn, child: const FlutterLogo(size: 75), diff --git a/examples/api/lib/widgets/implicit_animations/animated_fractionally_sized_box.0.dart b/examples/api/lib/widgets/implicit_animations/animated_fractionally_sized_box.0.dart index a3d6c25233..8efa516318 100644 --- a/examples/api/lib/widgets/implicit_animations/animated_fractionally_sized_box.0.dart +++ b/examples/api/lib/widgets/implicit_animations/animated_fractionally_sized_box.0.dart @@ -2,37 +2,34 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [AnimatedFractionallySizedBox]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [AnimatedFractionallySizedBox]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const AnimatedFractionallySizedBoxExampleApp()); - static const String _title = 'Flutter Code Sample'; +class AnimatedFractionallySizedBoxExampleApp extends StatelessWidget { + const AnimatedFractionallySizedBoxExampleApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( - title: _title, home: Scaffold( - appBar: AppBar(title: const Text(_title)), - body: const MyStatefulWidget(), + appBar: AppBar(title: const Text('AnimatedFractionallySizedBox Sample')), + body: const AnimatedFractionallySizedBoxExample(), ), ); } } -class MyStatefulWidget extends StatefulWidget { - const MyStatefulWidget({super.key}); +class AnimatedFractionallySizedBoxExample extends StatefulWidget { + const AnimatedFractionallySizedBoxExample({super.key}); @override - State createState() => _MyStatefulWidgetState(); + State createState() => _AnimatedFractionallySizedBoxExampleState(); } -class _MyStatefulWidgetState extends State { +class _AnimatedFractionallySizedBoxExampleState extends State { bool selected = false; @override diff --git a/examples/api/lib/widgets/implicit_animations/animated_padding.0.dart b/examples/api/lib/widgets/implicit_animations/animated_padding.0.dart index 2d42480358..eebf76e065 100644 --- a/examples/api/lib/widgets/implicit_animations/animated_padding.0.dart +++ b/examples/api/lib/widgets/implicit_animations/animated_padding.0.dart @@ -2,37 +2,34 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [AnimatedPadding]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [AnimatedPadding]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const AnimatedPaddingExampleApp()); - static const String _title = 'Flutter Code Sample'; +class AnimatedPaddingExampleApp extends StatelessWidget { + const AnimatedPaddingExampleApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( - title: _title, home: Scaffold( - appBar: AppBar(title: const Text(_title)), - body: const MyStatefulWidget(), + appBar: AppBar(title: const Text('AnimatedPadding Sample')), + body: const AnimatedPaddingExample(), ), ); } } -class MyStatefulWidget extends StatefulWidget { - const MyStatefulWidget({super.key}); +class AnimatedPaddingExample extends StatefulWidget { + const AnimatedPaddingExample({super.key}); @override - State createState() => _MyStatefulWidgetState(); + State createState() => _AnimatedPaddingExampleState(); } -class _MyStatefulWidgetState extends State { +class _AnimatedPaddingExampleState extends State { double padValue = 0.0; void _updatePadding(double value) { setState(() { diff --git a/examples/api/lib/widgets/implicit_animations/animated_positioned.0.dart b/examples/api/lib/widgets/implicit_animations/animated_positioned.0.dart index 55478c8552..bc0a2948cb 100644 --- a/examples/api/lib/widgets/implicit_animations/animated_positioned.0.dart +++ b/examples/api/lib/widgets/implicit_animations/animated_positioned.0.dart @@ -2,39 +2,36 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [AnimatedPositioned]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [AnimatedPositioned]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const AnimatedPositionedExampleApp()); - static const String _title = 'Flutter Code Sample'; +class AnimatedPositionedExampleApp extends StatelessWidget { + const AnimatedPositionedExampleApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( - title: _title, home: Scaffold( - appBar: AppBar(title: const Text(_title)), + appBar: AppBar(title: const Text('AnimatedPositioned Sample')), body: const Center( - child: MyStatefulWidget(), + child: AnimatedPositionedExample(), ), ), ); } } -class MyStatefulWidget extends StatefulWidget { - const MyStatefulWidget({super.key}); +class AnimatedPositionedExample extends StatefulWidget { + const AnimatedPositionedExample({super.key}); @override - State createState() => _MyStatefulWidgetState(); + State createState() => _AnimatedPositionedExampleState(); } -class _MyStatefulWidgetState extends State { +class _AnimatedPositionedExampleState extends State { bool selected = false; @override diff --git a/examples/api/lib/widgets/implicit_animations/animated_slide.0.dart b/examples/api/lib/widgets/implicit_animations/animated_slide.0.dart index ed742adda7..8f6b94f827 100644 --- a/examples/api/lib/widgets/implicit_animations/animated_slide.0.dart +++ b/examples/api/lib/widgets/implicit_animations/animated_slide.0.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [AnimatedSlide]. - import 'package:flutter/material.dart'; +/// Flutter code sample for [AnimatedSlide]. + void main() => runApp(const AnimatedSlideApp()); class AnimatedSlideApp extends StatelessWidget { diff --git a/examples/api/lib/widgets/implicit_animations/sliver_animated_opacity.0.dart b/examples/api/lib/widgets/implicit_animations/sliver_animated_opacity.0.dart index cdadf62c48..35df561f66 100644 --- a/examples/api/lib/widgets/implicit_animations/sliver_animated_opacity.0.dart +++ b/examples/api/lib/widgets/implicit_animations/sliver_animated_opacity.0.dart @@ -2,39 +2,36 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [SliverAnimatedOpacity]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [SliverAnimatedOpacity]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const SliverAnimatedOpacityExampleApp()); - static const String _title = 'Flutter Code Sample'; +class SliverAnimatedOpacityExampleApp extends StatelessWidget { + const SliverAnimatedOpacityExampleApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( - title: _title, home: Scaffold( - appBar: AppBar(title: const Text(_title)), + appBar: AppBar(title: const Text('SliverAnimatedOpacity Sample')), body: const Center( - child: MyStatefulWidget(), + child: SliverAnimatedOpacityExample(), ), ), ); } } -class MyStatefulWidget extends StatefulWidget { - const MyStatefulWidget({super.key}); +class SliverAnimatedOpacityExample extends StatefulWidget { + const SliverAnimatedOpacityExample({super.key}); @override - State createState() => _MyStatefulWidgetState(); + State createState() => _SliverAnimatedOpacityExampleState(); } -class _MyStatefulWidgetState extends State +class _SliverAnimatedOpacityExampleState extends State with SingleTickerProviderStateMixin { bool _visible = true; diff --git a/examples/api/lib/widgets/inherited_model/inherited_model.0.dart b/examples/api/lib/widgets/inherited_model/inherited_model.0.dart index 512edc1d89..dcc92ae477 100644 --- a/examples/api/lib/widgets/inherited_model/inherited_model.0.dart +++ b/examples/api/lib/widgets/inherited_model/inherited_model.0.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [InheritedModel]. - import 'package:flutter/material.dart'; +/// Flutter code sample for [InheritedModel]. + enum LogoAspect { backgroundColor, large } void main() => runApp(const InheritedModelApp()); @@ -42,8 +42,7 @@ class LogoModel extends InheritedModel { @override bool updateShouldNotify(LogoModel oldWidget) { - return backgroundColor != oldWidget.backgroundColor || - large != oldWidget.large; + return backgroundColor != oldWidget.backgroundColor || large != oldWidget.large; } @override @@ -97,7 +96,7 @@ class _InheritedModelExampleState extends State { ), ); setState(() { - if (color == Colors.blue){ + if (color == Colors.blue) { color = Colors.red; } else { color = Colors.blue; diff --git a/examples/api/lib/widgets/inherited_notifier/inherited_notifier.0.dart b/examples/api/lib/widgets/inherited_notifier/inherited_notifier.0.dart index 08736bb0b5..938ac06dc2 100644 --- a/examples/api/lib/widgets/inherited_notifier/inherited_notifier.0.dart +++ b/examples/api/lib/widgets/inherited_notifier/inherited_notifier.0.dart @@ -2,24 +2,21 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [InheritedNotifier]. - import 'dart:math' as math; import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [InheritedNotifier]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const InheritedNotifierExampleApp()); - static const String _title = 'Flutter Code Sample'; +class InheritedNotifierExampleApp extends StatelessWidget { + const InheritedNotifierExampleApp({super.key}); @override Widget build(BuildContext context) { return const MaterialApp( - title: _title, - home: MyStatefulWidget(), + home: InheritedNotifierExample(), ); } } @@ -32,10 +29,7 @@ class SpinModel extends InheritedNotifier { }); static double of(BuildContext context) { - return context - .dependOnInheritedWidgetOfExactType()! - .notifier! - .value; + return context.dependOnInheritedWidgetOfExactType()!.notifier!.value; } } @@ -58,17 +52,16 @@ class Spinner extends StatelessWidget { } } -class MyStatefulWidget extends StatefulWidget { - const MyStatefulWidget({super.key}); +class InheritedNotifierExample extends StatefulWidget { + const InheritedNotifierExample({super.key}); @override - State createState() => _MyStatefulWidgetState(); + State createState() => _InheritedNotifierExampleState(); } /// [AnimationController]s can be created with `vsync: this` because of /// [TickerProviderStateMixin]. -class _MyStatefulWidgetState extends State - with TickerProviderStateMixin { +class _InheritedNotifierExampleState extends State with TickerProviderStateMixin { late AnimationController _controller; @override diff --git a/examples/api/lib/widgets/inherited_theme/inherited_theme.0.dart b/examples/api/lib/widgets/inherited_theme/inherited_theme.0.dart index 67b12549f1..6786db11b7 100644 --- a/examples/api/lib/widgets/inherited_theme/inherited_theme.0.dart +++ b/examples/api/lib/widgets/inherited_theme/inherited_theme.0.dart @@ -2,12 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [InheritedTheme]. - import 'package:flutter/material.dart'; +/// Flutter code sample for [InheritedTheme]. + void main() { - runApp(const MyApp()); + runApp(const InheritedThemeExampleApp()); } class MyAppBody extends StatelessWidget { @@ -23,8 +23,7 @@ class MyAppBody extends StatelessWidget { // the new route pushed onto said navigator. // Themes are captured outside of the route's builder because when the // builder executes, the context may not be valid anymore. - final CapturedThemes themes = - InheritedTheme.capture(from: context, to: navigator.context); + final CapturedThemes themes = InheritedTheme.capture(from: context, to: navigator.context); return GestureDetector( onTap: () { Navigator.of(context).push( @@ -48,8 +47,8 @@ class MyAppBody extends StatelessWidget { } } -class MyApp extends StatelessWidget { - const MyApp({super.key}); +class InheritedThemeExampleApp extends StatelessWidget { + const InheritedThemeExampleApp({super.key}); @override Widget build(BuildContext context) { diff --git a/examples/api/lib/widgets/interactive_viewer/interactive_viewer.0.dart b/examples/api/lib/widgets/interactive_viewer/interactive_viewer.0.dart index f02786bced..eaae7baa4e 100644 --- a/examples/api/lib/widgets/interactive_viewer/interactive_viewer.0.dart +++ b/examples/api/lib/widgets/interactive_viewer/interactive_viewer.0.dart @@ -2,31 +2,28 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [InteractiveViewer]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [InteractiveViewer]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const InteractiveViewerExampleApp()); - static const String _title = 'Flutter Code Sample'; +class InteractiveViewerExampleApp extends StatelessWidget { + const InteractiveViewerExampleApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( - title: _title, home: Scaffold( - appBar: AppBar(title: const Text(_title)), - body: const MyStatelessWidget(), + appBar: AppBar(title: const Text('InteractiveViewer Sample')), + body: const InteractiveViewerExample(), ), ); } } -class MyStatelessWidget extends StatelessWidget { - const MyStatelessWidget({super.key}); +class InteractiveViewerExample extends StatelessWidget { + const InteractiveViewerExample({super.key}); @override Widget build(BuildContext context) { diff --git a/examples/api/lib/widgets/interactive_viewer/interactive_viewer.builder.0.dart b/examples/api/lib/widgets/interactive_viewer/interactive_viewer.builder.0.dart index 0337029bce..99faf50a89 100644 --- a/examples/api/lib/widgets/interactive_viewer/interactive_viewer.builder.0.dart +++ b/examples/api/lib/widgets/interactive_viewer/interactive_viewer.builder.0.dart @@ -2,11 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [InteractiveViewer.builder]. - import 'package:flutter/material.dart'; import 'package:vector_math/vector_math_64.dart' show Quad, Vector3; +/// Flutter code sample for [InteractiveViewer.builder]. + void main() => runApp(const IVBuilderExampleApp()); class IVBuilderExampleApp extends StatelessWidget { @@ -80,9 +80,7 @@ class _IVBuilderExampleState extends State<_IVBuilderExample> { return Container( height: _cellHeight, width: _cellWidth, - color: row % 2 + column % 2 == 1 - ? Colors.white - : Colors.grey.withOpacity(0.1), + color: row % 2 + column % 2 == 1 ? Colors.white : Colors.grey.withOpacity(0.1), child: Align( child: Text('$row x $column'), ), @@ -97,8 +95,7 @@ class _IVBuilderExampleState extends State<_IVBuilderExample> { } } -typedef _CellBuilder = Widget Function( - BuildContext context, int row, int column); +typedef _CellBuilder = Widget Function(BuildContext context, int row, int column); class _TableBuilder extends StatelessWidget { const _TableBuilder({ diff --git a/examples/api/lib/widgets/interactive_viewer/interactive_viewer.constrained.0.dart b/examples/api/lib/widgets/interactive_viewer/interactive_viewer.constrained.0.dart index 5b4868921e..be4aa44087 100644 --- a/examples/api/lib/widgets/interactive_viewer/interactive_viewer.constrained.0.dart +++ b/examples/api/lib/widgets/interactive_viewer/interactive_viewer.constrained.0.dart @@ -2,31 +2,28 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [InteractiveViewer.constrained]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [InteractiveViewer.constrained]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const ConstrainedExampleApp()); - static const String _title = 'Flutter Code Sample'; +class ConstrainedExampleApp extends StatelessWidget { + const ConstrainedExampleApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( - title: _title, home: Scaffold( - appBar: AppBar(title: const Text(_title)), - body: const MyStatelessWidget(), + appBar: AppBar(title: const Text('Constrained Sample')), + body: const ConstrainedExample(), ), ); } } -class MyStatelessWidget extends StatelessWidget { - const MyStatelessWidget({super.key}); +class ConstrainedExample extends StatelessWidget { + const ConstrainedExample({super.key}); @override Widget build(BuildContext context) { @@ -39,8 +36,7 @@ class MyStatelessWidget extends StatelessWidget { scaleEnabled: false, child: Table( columnWidths: { - for (int column = 0; column < columnCount; column += 1) - column: const FixedColumnWidth(200.0), + for (int column = 0; column < columnCount; column += 1) column: const FixedColumnWidth(200.0), }, children: [ for (int row = 0; row < rowCount; row += 1) @@ -49,9 +45,7 @@ class MyStatelessWidget extends StatelessWidget { for (int column = 0; column < columnCount; column += 1) Container( height: 26, - color: row % 2 + column % 2 == 1 - ? Colors.white - : Colors.grey.withOpacity(0.1), + color: row % 2 + column % 2 == 1 ? Colors.white : Colors.grey.withOpacity(0.1), child: Align( alignment: Alignment.centerLeft, child: Text('$row x $column'), diff --git a/examples/api/lib/widgets/interactive_viewer/interactive_viewer.transformation_controller.0.dart b/examples/api/lib/widgets/interactive_viewer/interactive_viewer.transformation_controller.0.dart index 78797178bc..135f72e46a 100644 --- a/examples/api/lib/widgets/interactive_viewer/interactive_viewer.transformation_controller.0.dart +++ b/examples/api/lib/widgets/interactive_viewer/interactive_viewer.transformation_controller.0.dart @@ -2,39 +2,35 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [InteractiveViewer.transformationController]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [InteractiveViewer.transformationController]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const TransformationControllerExampleApp()); - static const String _title = 'Flutter Code Sample'; +class TransformationControllerExampleApp extends StatelessWidget { + const TransformationControllerExampleApp({super.key}); @override Widget build(BuildContext context) { return const MaterialApp( - title: _title, - home: MyStatefulWidget(), + home: TransformationControllerExample(), ); } } -class MyStatefulWidget extends StatefulWidget { - const MyStatefulWidget({super.key}); +class TransformationControllerExample extends StatefulWidget { + const TransformationControllerExample({super.key}); @override - State createState() => _MyStatefulWidgetState(); + State createState() => _TransformationControllerExampleState(); } /// [AnimationController]s can be created with `vsync: this` because of /// [TickerProviderStateMixin]. -class _MyStatefulWidgetState extends State +class _TransformationControllerExampleState extends State with TickerProviderStateMixin { - final TransformationController _transformationController = - TransformationController(); + final TransformationController _transformationController = TransformationController(); Animation? _animationReset; late final AnimationController _controllerReset; diff --git a/examples/api/lib/widgets/layout_builder/layout_builder.0.dart b/examples/api/lib/widgets/layout_builder/layout_builder.0.dart index 07dbaadbc6..b0254f7ed1 100644 --- a/examples/api/lib/widgets/layout_builder/layout_builder.0.dart +++ b/examples/api/lib/widgets/layout_builder/layout_builder.0.dart @@ -2,28 +2,25 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [LayoutBuilder]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [LayoutBuilder]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const LayoutBuilderExampleApp()); - static const String _title = 'Flutter Code Sample'; +class LayoutBuilderExampleApp extends StatelessWidget { + const LayoutBuilderExampleApp({super.key}); @override Widget build(BuildContext context) { return const MaterialApp( - title: _title, - home: MyStatelessWidget(), + home: LayoutBuilderExample(), ); } } -class MyStatelessWidget extends StatelessWidget { - const MyStatelessWidget({super.key}); +class LayoutBuilderExample extends StatelessWidget { + const LayoutBuilderExample({super.key}); @override Widget build(BuildContext context) { diff --git a/examples/api/lib/widgets/magnifier/magnifier.0.dart b/examples/api/lib/widgets/magnifier/magnifier.0.dart index 8603a23624..87e3f98658 100644 --- a/examples/api/lib/widgets/magnifier/magnifier.0.dart +++ b/examples/api/lib/widgets/magnifier/magnifier.0.dart @@ -4,17 +4,17 @@ import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +void main() => runApp(const MagnifierExampleApp()); -class MyApp extends StatefulWidget { - const MyApp({super.key}); +class MagnifierExampleApp extends StatefulWidget { + const MagnifierExampleApp({super.key}); static const Size loupeSize = Size(200, 200); @override - State createState() => _MyAppState(); + State createState() => _MagnifierExampleAppState(); } -class _MyAppState extends State { +class _MagnifierExampleAppState extends State { Offset dragGesturePosition = Offset.zero; @override diff --git a/examples/api/lib/widgets/media_query/media_query_data.system_gesture_insets.0.dart b/examples/api/lib/widgets/media_query/media_query_data.system_gesture_insets.0.dart index 5603970e9f..d41df331a9 100644 --- a/examples/api/lib/widgets/media_query/media_query_data.system_gesture_insets.0.dart +++ b/examples/api/lib/widgets/media_query/media_query_data.system_gesture_insets.0.dart @@ -2,43 +2,38 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [MediaQueryData.systemGestureInsets]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [MediaQueryData.systemGestureInsets]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const SystemGestureInsetsExampleApp()); - static const String _title = 'Flutter Code Sample'; +class SystemGestureInsetsExampleApp extends StatelessWidget { + const SystemGestureInsetsExampleApp({super.key}); @override Widget build(BuildContext context) { return const MaterialApp( - title: _title, - home: MyStatefulWidget(), + home: SystemGestureInsetsExample(), ); } } -class MyStatefulWidget extends StatefulWidget { - const MyStatefulWidget({super.key}); +class SystemGestureInsetsExample extends StatefulWidget { + const SystemGestureInsetsExample({super.key}); @override - State createState() => _MyStatefulWidgetState(); + State createState() => _SystemGestureInsetsExampleState(); } -class _MyStatefulWidgetState extends State { +class _SystemGestureInsetsExampleState extends State { double _currentValue = 0.2; @override Widget build(BuildContext context) { - final EdgeInsets systemGestureInsets = - MediaQuery.of(context).systemGestureInsets; + final EdgeInsets systemGestureInsets = MediaQuery.of(context).systemGestureInsets; return Scaffold( - appBar: - AppBar(title: const Text('Pad Slider to avoid systemGestureInsets')), + appBar: AppBar(title: const Text('Pad Slider to avoid systemGestureInsets')), body: Padding( padding: EdgeInsets.only( // only left and right padding are needed here diff --git a/examples/api/lib/widgets/navigator/navigator.0.dart b/examples/api/lib/widgets/navigator/navigator.0.dart index 201fe08337..0f19ecb92e 100644 --- a/examples/api/lib/widgets/navigator/navigator.0.dart +++ b/examples/api/lib/widgets/navigator/navigator.0.dart @@ -2,19 +2,18 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [Navigator]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [Navigator]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const NavigatorExampleApp()); + +class NavigatorExampleApp extends StatelessWidget { + const NavigatorExampleApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( - title: 'Flutter Code Sample for Navigator', // MaterialApp contains our top-level Navigator initialRoute: '/', routes: { @@ -52,8 +51,7 @@ class CollectPersonalInfoPage extends StatelessWidget { onTap: () { // This moves from the personal info page to the credentials page, // replacing this page with that one. - Navigator.of(context) - .pushReplacementNamed('signup/choose_credentials'); + Navigator.of(context).pushReplacementNamed('signup/choose_credentials'); }, child: Container( color: Colors.lightBlue, diff --git a/examples/api/lib/widgets/navigator/navigator.restorable_push.0.dart b/examples/api/lib/widgets/navigator/navigator.restorable_push.0.dart index f44ff6efd7..1e292f58b6 100644 --- a/examples/api/lib/widgets/navigator/navigator.restorable_push.0.dart +++ b/examples/api/lib/widgets/navigator/navigator.restorable_push.0.dart @@ -2,38 +2,35 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [Navigator.restorablePush]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [Navigator.restorablePush]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const RestorablePushExampleApp()); - static const String _title = 'Flutter Code Sample'; +class RestorablePushExampleApp extends StatelessWidget { + const RestorablePushExampleApp({super.key}); @override Widget build(BuildContext context) { return const MaterialApp( - title: _title, - home: MyStatefulWidget(), + home: RestorablePushExample(), ); } } -class MyStatefulWidget extends StatefulWidget { - const MyStatefulWidget({super.key}); +class RestorablePushExample extends StatefulWidget { + const RestorablePushExample({super.key}); @override - State createState() => _MyStatefulWidgetState(); + State createState() => _RestorablePushExampleState(); } -class _MyStatefulWidgetState extends State { +class _RestorablePushExampleState extends State { @pragma('vm:entry-point') static Route _myRouteBuilder(BuildContext context, Object? arguments) { return MaterialPageRoute( - builder: (BuildContext context) => const MyStatefulWidget(), + builder: (BuildContext context) => const RestorablePushExample(), ); } diff --git a/examples/api/lib/widgets/navigator/navigator.restorable_push_and_remove_until.0.dart b/examples/api/lib/widgets/navigator/navigator.restorable_push_and_remove_until.0.dart index 3e7c7551be..eaf34b3e19 100644 --- a/examples/api/lib/widgets/navigator/navigator.restorable_push_and_remove_until.0.dart +++ b/examples/api/lib/widgets/navigator/navigator.restorable_push_and_remove_until.0.dart @@ -2,38 +2,35 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [Navigator.restorablePushAndRemoveUntil]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [Navigator.restorablePushAndRemoveUntil]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const RestorablePushAndRemoveUntilExampleApp()); - static const String _title = 'Flutter Code Sample'; +class RestorablePushAndRemoveUntilExampleApp extends StatelessWidget { + const RestorablePushAndRemoveUntilExampleApp({super.key}); @override Widget build(BuildContext context) { return const MaterialApp( - title: _title, - home: MyStatefulWidget(), + home: RestorablePushAndRemoveUntilExample(), ); } } -class MyStatefulWidget extends StatefulWidget { - const MyStatefulWidget({super.key}); +class RestorablePushAndRemoveUntilExample extends StatefulWidget { + const RestorablePushAndRemoveUntilExample({super.key}); @override - State createState() => _MyStatefulWidgetState(); + State createState() => _RestorablePushAndRemoveUntilExampleState(); } -class _MyStatefulWidgetState extends State { +class _RestorablePushAndRemoveUntilExampleState extends State { @pragma('vm:entry-point') static Route _myRouteBuilder(BuildContext context, Object? arguments) { return MaterialPageRoute( - builder: (BuildContext context) => const MyStatefulWidget(), + builder: (BuildContext context) => const RestorablePushAndRemoveUntilExample(), ); } diff --git a/examples/api/lib/widgets/navigator/navigator.restorable_push_replacement.0.dart b/examples/api/lib/widgets/navigator/navigator.restorable_push_replacement.0.dart index a210aefa72..7d5df60795 100644 --- a/examples/api/lib/widgets/navigator/navigator.restorable_push_replacement.0.dart +++ b/examples/api/lib/widgets/navigator/navigator.restorable_push_replacement.0.dart @@ -2,38 +2,35 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [Navigator.restorablePushReplacement]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [Navigator.restorablePushReplacement]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const RestorablePushReplacementExampleApp()); - static const String _title = 'Flutter Code Sample'; +class RestorablePushReplacementExampleApp extends StatelessWidget { + const RestorablePushReplacementExampleApp({super.key}); @override Widget build(BuildContext context) { return const MaterialApp( - title: _title, - home: MyStatefulWidget(), + home: RestorablePushReplacementExample(), ); } } -class MyStatefulWidget extends StatefulWidget { - const MyStatefulWidget({super.key}); +class RestorablePushReplacementExample extends StatefulWidget { + const RestorablePushReplacementExample({super.key}); @override - State createState() => _MyStatefulWidgetState(); + State createState() => _RestorablePushReplacementExampleState(); } -class _MyStatefulWidgetState extends State { +class _RestorablePushReplacementExampleState extends State { @pragma('vm:entry-point') static Route _myRouteBuilder(BuildContext context, Object? arguments) { return MaterialPageRoute( - builder: (BuildContext context) => const MyStatefulWidget(), + builder: (BuildContext context) => const RestorablePushReplacementExample(), ); } @@ -44,8 +41,7 @@ class _MyStatefulWidgetState extends State { title: const Text('Sample Code'), ), floatingActionButton: FloatingActionButton( - onPressed: () => - Navigator.restorablePushReplacement(context, _myRouteBuilder), + onPressed: () => Navigator.restorablePushReplacement(context, _myRouteBuilder), tooltip: 'Increment Counter', child: const Icon(Icons.add), ), diff --git a/examples/api/lib/widgets/navigator/navigator_state.restorable_push.0.dart b/examples/api/lib/widgets/navigator/navigator_state.restorable_push.0.dart index 3305144028..cb45abe8ba 100644 --- a/examples/api/lib/widgets/navigator/navigator_state.restorable_push.0.dart +++ b/examples/api/lib/widgets/navigator/navigator_state.restorable_push.0.dart @@ -2,38 +2,35 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [NavigatorState.restorablePush]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [NavigatorState.restorablePush]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const RestorablePushExampleApp()); - static const String _title = 'Flutter Code Sample'; +class RestorablePushExampleApp extends StatelessWidget { + const RestorablePushExampleApp({super.key}); @override Widget build(BuildContext context) { return const MaterialApp( - title: _title, - home: MyStatefulWidget(), + home: RestorablePushExample(), ); } } -class MyStatefulWidget extends StatefulWidget { - const MyStatefulWidget({super.key}); +class RestorablePushExample extends StatefulWidget { + const RestorablePushExample({super.key}); @override - State createState() => _MyStatefulWidgetState(); + State createState() => _RestorablePushExampleState(); } -class _MyStatefulWidgetState extends State { +class _RestorablePushExampleState extends State { @pragma('vm:entry-point') static Route _myRouteBuilder(BuildContext context, Object? arguments) { return MaterialPageRoute( - builder: (BuildContext context) => const MyStatefulWidget(), + builder: (BuildContext context) => const RestorablePushExample(), ); } diff --git a/examples/api/lib/widgets/navigator/navigator_state.restorable_push_and_remove_until.0.dart b/examples/api/lib/widgets/navigator/navigator_state.restorable_push_and_remove_until.0.dart index 7634cee902..0567ad4ac2 100644 --- a/examples/api/lib/widgets/navigator/navigator_state.restorable_push_and_remove_until.0.dart +++ b/examples/api/lib/widgets/navigator/navigator_state.restorable_push_and_remove_until.0.dart @@ -2,38 +2,35 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [NavigatorState.restorablePushAndRemoveUntil]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [NavigatorState.restorablePushAndRemoveUntil]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const RestorablePushAndRemoveUntilExampleApp()); - static const String _title = 'Flutter Code Sample'; +class RestorablePushAndRemoveUntilExampleApp extends StatelessWidget { + const RestorablePushAndRemoveUntilExampleApp({super.key}); @override Widget build(BuildContext context) { return const MaterialApp( - title: _title, - home: MyStatefulWidget(), + home: RestorablePushAndRemoveUntilExample(), ); } } -class MyStatefulWidget extends StatefulWidget { - const MyStatefulWidget({super.key}); +class RestorablePushAndRemoveUntilExample extends StatefulWidget { + const RestorablePushAndRemoveUntilExample({super.key}); @override - State createState() => _MyStatefulWidgetState(); + State createState() => _RestorablePushAndRemoveUntilExampleState(); } -class _MyStatefulWidgetState extends State { +class _RestorablePushAndRemoveUntilExampleState extends State { @pragma('vm:entry-point') static Route _myRouteBuilder(BuildContext context, Object? arguments) { return MaterialPageRoute( - builder: (BuildContext context) => const MyStatefulWidget(), + builder: (BuildContext context) => const RestorablePushAndRemoveUntilExample(), ); } diff --git a/examples/api/lib/widgets/navigator/navigator_state.restorable_push_replacement.0.dart b/examples/api/lib/widgets/navigator/navigator_state.restorable_push_replacement.0.dart index 15827da47b..b22315a2f5 100644 --- a/examples/api/lib/widgets/navigator/navigator_state.restorable_push_replacement.0.dart +++ b/examples/api/lib/widgets/navigator/navigator_state.restorable_push_replacement.0.dart @@ -2,38 +2,35 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [NavigatorState.restorablePushReplacement]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [NavigatorState.restorablePushReplacement]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const RestorablePushReplacementExampleApp()); - static const String _title = 'Flutter Code Sample'; +class RestorablePushReplacementExampleApp extends StatelessWidget { + const RestorablePushReplacementExampleApp({super.key}); @override Widget build(BuildContext context) { return const MaterialApp( - title: _title, - home: MyStatefulWidget(), + home: RestorablePushReplacementExample(), ); } } -class MyStatefulWidget extends StatefulWidget { - const MyStatefulWidget({super.key}); +class RestorablePushReplacementExample extends StatefulWidget { + const RestorablePushReplacementExample({super.key}); @override - State createState() => _MyStatefulWidgetState(); + State createState() => _RestorablePushReplacementExampleState(); } -class _MyStatefulWidgetState extends State { +class _RestorablePushReplacementExampleState extends State { @pragma('vm:entry-point') static Route _myRouteBuilder(BuildContext context, Object? arguments) { return MaterialPageRoute( - builder: (BuildContext context) => const MyStatefulWidget(), + builder: (BuildContext context) => const RestorablePushReplacementExample(), ); } diff --git a/examples/api/lib/widgets/navigator/restorable_route_future.0.dart b/examples/api/lib/widgets/navigator/restorable_route_future.0.dart index 7318bfbb89..ddf8efc6ac 100644 --- a/examples/api/lib/widgets/navigator/restorable_route_future.0.dart +++ b/examples/api/lib/widgets/navigator/restorable_route_future.0.dart @@ -2,14 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [RestorableRouteFuture]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [RestorableRouteFuture]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const RestorableRouteFutureExampleApp()); + +class RestorableRouteFutureExampleApp extends StatelessWidget { + const RestorableRouteFutureExampleApp({super.key}); @override Widget build(BuildContext context) { @@ -40,8 +40,7 @@ class _MyHomeState extends State with RestorationMixin { @override void initState() { super.initState(); - _counterRoute = RestorableRouteFuture( - onPresent: (NavigatorState navigator, Object? arguments) { + _counterRoute = RestorableRouteFuture(onPresent: (NavigatorState navigator, Object? arguments) { // Defines what route should be shown (and how it should be added // to the navigator) when `RestorableRouteFuture.present` is called. return navigator.restorablePush( @@ -74,8 +73,7 @@ class _MyHomeState extends State with RestorationMixin { // A static `RestorableRouteBuilder` that can re-create the route during // state restoration. @pragma('vm:entry-point') - static Route _counterRouteBuilder( - BuildContext context, Object? arguments) { + static Route _counterRouteBuilder(BuildContext context, Object? arguments) { return MaterialPageRoute( builder: (BuildContext context) => MyCounter( title: arguments!.toString(), diff --git a/examples/api/lib/widgets/nested_scroll_view/nested_scroll_view.0.dart b/examples/api/lib/widgets/nested_scroll_view/nested_scroll_view.0.dart index 7c165b7f57..1d49cb67bc 100644 --- a/examples/api/lib/widgets/nested_scroll_view/nested_scroll_view.0.dart +++ b/examples/api/lib/widgets/nested_scroll_view/nested_scroll_view.0.dart @@ -2,28 +2,25 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [NestedScrollView]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [NestedScrollView]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const NestedScrollViewExampleApp()); - static const String _title = 'Flutter Code Sample'; +class NestedScrollViewExampleApp extends StatelessWidget { + const NestedScrollViewExampleApp({super.key}); @override Widget build(BuildContext context) { return const MaterialApp( - title: _title, - home: MyStatelessWidget(), + home: NestedScrollViewExample(), ); } } -class MyStatelessWidget extends StatelessWidget { - const MyStatelessWidget({super.key}); +class NestedScrollViewExample extends StatelessWidget { + const NestedScrollViewExample({super.key}); @override Widget build(BuildContext context) { @@ -43,11 +40,9 @@ class MyStatelessWidget extends StatelessWidget { // scroll view thinks it has not been scrolled. // This is not necessary if the "headerSliverBuilder" only builds // widgets that do not overlap the next sliver. - handle: - NestedScrollView.sliverOverlapAbsorberHandleFor(context), + handle: NestedScrollView.sliverOverlapAbsorberHandleFor(context), sliver: SliverAppBar( - title: - const Text('Books'), // This is the title in the app bar. + title: const Text('Books'), // This is the title in the app bar. pinned: true, expandedHeight: 150.0, // The "forceElevated" property causes the SliverAppBar to show @@ -93,9 +88,7 @@ class MyStatelessWidget extends StatelessWidget { SliverOverlapInjector( // This is the flip side of the SliverOverlapAbsorber // above. - handle: - NestedScrollView.sliverOverlapAbsorberHandleFor( - context), + handle: NestedScrollView.sliverOverlapAbsorberHandleFor(context), ), SliverPadding( padding: const EdgeInsets.all(8.0), diff --git a/examples/api/lib/widgets/nested_scroll_view/nested_scroll_view.1.dart b/examples/api/lib/widgets/nested_scroll_view/nested_scroll_view.1.dart index c00f2a32e5..560f18c513 100644 --- a/examples/api/lib/widgets/nested_scroll_view/nested_scroll_view.1.dart +++ b/examples/api/lib/widgets/nested_scroll_view/nested_scroll_view.1.dart @@ -2,28 +2,25 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [NestedScrollView]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [NestedScrollView]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const NestedScrollViewExampleApp()); - static const String _title = 'Flutter Code Sample'; +class NestedScrollViewExampleApp extends StatelessWidget { + const NestedScrollViewExampleApp({super.key}); @override Widget build(BuildContext context) { return const MaterialApp( - title: _title, - home: MyStatelessWidget(), + home: NestedScrollViewExample(), ); } } -class MyStatelessWidget extends StatelessWidget { - const MyStatelessWidget({super.key}); +class NestedScrollViewExample extends StatelessWidget { + const NestedScrollViewExample({super.key}); @override Widget build(BuildContext context) { @@ -32,8 +29,7 @@ class MyStatelessWidget extends StatelessWidget { // Setting floatHeaderSlivers to true is required in order to float // the outer slivers over the inner scrollable. floatHeaderSlivers: true, - headerSliverBuilder: - (BuildContext context, bool innerBoxIsScrolled) { + headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) { return [ SliverAppBar( title: const Text('Floating Nested SliverAppBar'), diff --git a/examples/api/lib/widgets/nested_scroll_view/nested_scroll_view.2.dart b/examples/api/lib/widgets/nested_scroll_view/nested_scroll_view.2.dart index f3acbac1dc..9ed8aae49b 100644 --- a/examples/api/lib/widgets/nested_scroll_view/nested_scroll_view.2.dart +++ b/examples/api/lib/widgets/nested_scroll_view/nested_scroll_view.2.dart @@ -2,34 +2,30 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [NestedScrollView]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [NestedScrollView]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const NestedScrollViewExampleApp()); - static const String _title = 'Flutter Code Sample'; +class NestedScrollViewExampleApp extends StatelessWidget { + const NestedScrollViewExampleApp({super.key}); @override Widget build(BuildContext context) { return const MaterialApp( - title: _title, - home: MyStatelessWidget(), + home: NestedScrollViewExample(), ); } } -class MyStatelessWidget extends StatelessWidget { - const MyStatelessWidget({super.key}); +class NestedScrollViewExample extends StatelessWidget { + const NestedScrollViewExample({super.key}); @override Widget build(BuildContext context) { return Scaffold( - body: NestedScrollView(headerSliverBuilder: - (BuildContext context, bool innerBoxIsScrolled) { + body: NestedScrollView(headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) { return [ SliverOverlapAbsorber( handle: NestedScrollView.sliverOverlapAbsorberHandleFor(context), @@ -49,13 +45,11 @@ class MyStatelessWidget extends StatelessWidget { // If the "controller" property is set, then this scroll view will not // be associated with the NestedScrollView. slivers: [ - SliverOverlapInjector( - handle: NestedScrollView.sliverOverlapAbsorberHandleFor(context)), + SliverOverlapInjector(handle: NestedScrollView.sliverOverlapAbsorberHandleFor(context)), SliverFixedExtentList( itemExtent: 48.0, delegate: SliverChildBuilderDelegate( - (BuildContext context, int index) => - ListTile(title: Text('Item $index')), + (BuildContext context, int index) => ListTile(title: Text('Item $index')), childCount: 30, ), ), diff --git a/examples/api/lib/widgets/nested_scroll_view/nested_scroll_view_state.0.dart b/examples/api/lib/widgets/nested_scroll_view/nested_scroll_view_state.0.dart index 4b27c48bce..6de7899b7b 100644 --- a/examples/api/lib/widgets/nested_scroll_view/nested_scroll_view_state.0.dart +++ b/examples/api/lib/widgets/nested_scroll_view/nested_scroll_view_state.0.dart @@ -2,30 +2,27 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [NestedScrollViewState]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [NestedScrollViewState]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const NestedScrollViewStateExampleApp()); - static const String _title = 'Flutter Code Sample'; +class NestedScrollViewStateExampleApp extends StatelessWidget { + const NestedScrollViewStateExampleApp({super.key}); @override Widget build(BuildContext context) { return const MaterialApp( - title: _title, - home: MyStatelessWidget(), + home: NestedScrollViewStateExample(), ); } } final GlobalKey globalKey = GlobalKey(); -class MyStatelessWidget extends StatelessWidget { - const MyStatelessWidget({super.key}); +class NestedScrollViewStateExample extends StatelessWidget { + const NestedScrollViewStateExample({super.key}); @override @override diff --git a/examples/api/lib/widgets/notification_listener/notification.0.dart b/examples/api/lib/widgets/notification_listener/notification.0.dart index bce2018357..40f7040b76 100644 --- a/examples/api/lib/widgets/notification_listener/notification.0.dart +++ b/examples/api/lib/widgets/notification_listener/notification.0.dart @@ -2,28 +2,25 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [Notification]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [Notification]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const NotificationExampleApp()); - static const String _title = 'Flutter Code Sample'; +class NotificationExampleApp extends StatelessWidget { + const NotificationExampleApp({super.key}); @override Widget build(BuildContext context) { return const MaterialApp( - title: _title, - home: MyStatelessWidget(), + home: NotificationExample(), ); } } -class MyStatelessWidget extends StatelessWidget { - const MyStatelessWidget({super.key}); +class NotificationExample extends StatelessWidget { + const NotificationExample({super.key}); static const List _tabs = ['Months', 'Days']; static const List _months = [ @@ -54,11 +51,10 @@ class MyStatelessWidget extends StatelessWidget { return true; }, child: NestedScrollView( - headerSliverBuilder: - (BuildContext context, bool innerBoxIsScrolled) { + headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) { return [ SliverAppBar( - title: const Text('Flutter Code Sample'), + title: const Text('Notification Sample'), pinned: true, floating: true, bottom: TabBar( diff --git a/examples/api/lib/widgets/overflow_bar/overflow_bar.0.dart b/examples/api/lib/widgets/overflow_bar/overflow_bar.0.dart index 338df0da99..e870d72ec3 100644 --- a/examples/api/lib/widgets/overflow_bar/overflow_bar.0.dart +++ b/examples/api/lib/widgets/overflow_bar/overflow_bar.0.dart @@ -2,33 +2,30 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [OverflowBar]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [OverflowBar]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const OverflowBarExampleApp()); - static const String _title = 'Flutter Code Sample'; +class OverflowBarExampleApp extends StatelessWidget { + const OverflowBarExampleApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( - title: _title, home: Scaffold( - appBar: AppBar(title: const Text(_title)), + appBar: AppBar(title: const Text('OverflowBar Sample')), body: const Center( - child: MyStatelessWidget(), + child: OverflowBarExample(), ), ), ); } } -class MyStatelessWidget extends StatelessWidget { - const MyStatelessWidget({super.key}); +class OverflowBarExample extends StatelessWidget { + const OverflowBarExample({super.key}); @override Widget build(BuildContext context) { @@ -39,8 +36,7 @@ class MyStatelessWidget extends StatelessWidget { child: Material( color: Colors.white, elevation: 24, - shape: const RoundedRectangleBorder( - borderRadius: BorderRadius.all(Radius.circular(4))), + shape: const RoundedRectangleBorder(borderRadius: BorderRadius.all(Radius.circular(4))), child: Padding( padding: const EdgeInsets.all(8), child: SingleChildScrollView( @@ -56,9 +52,7 @@ class MyStatelessWidget extends StatelessWidget { overflowAlignment: OverflowBarAlignment.end, children: [ TextButton(child: const Text('Cancel'), onPressed: () {}), - TextButton( - child: const Text('Really Really Cancel'), - onPressed: () {}), + TextButton(child: const Text('Really Really Cancel'), onPressed: () {}), OutlinedButton(child: const Text('OK'), onPressed: () {}), ], ), diff --git a/examples/api/lib/widgets/overlay/overlay.0.dart b/examples/api/lib/widgets/overlay/overlay.0.dart index fa2bab7b21..41a769c9e8 100644 --- a/examples/api/lib/widgets/overlay/overlay.0.dart +++ b/examples/api/lib/widgets/overlay/overlay.0.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [Overlay]. - import 'package:flutter/material.dart'; +/// Flutter code sample for [Overlay]. + void main() => runApp(const OverlayApp()); class OverlayApp extends StatelessWidget { @@ -65,13 +65,13 @@ class _OverlayExampleState extends State { children: [ Text( 'Explore page', - style: TextStyle( - color: Colors.red, - ), + style: TextStyle( + color: Colors.red, ), + ), Icon( Icons.arrow_downward, - color: Colors.red + color: Colors.red, ), ], ); @@ -80,13 +80,13 @@ class _OverlayExampleState extends State { children: [ Text( 'Commute page', - style: TextStyle( - color: Colors.green, - ), + style: TextStyle( + color: Colors.green, ), + ), Icon( Icons.arrow_downward, - color: Colors.green + color: Colors.green, ), ], ); @@ -95,13 +95,13 @@ class _OverlayExampleState extends State { children: [ Text( 'Saved page', - style: TextStyle( - color: Colors.orange, - ), + style: TextStyle( + color: Colors.orange, ), + ), Icon( Icons.arrow_downward, - color: Colors.orange + color: Colors.orange, ), ], ); diff --git a/examples/api/lib/widgets/overlay/overlay_portal.0.dart b/examples/api/lib/widgets/overlay/overlay_portal.0.dart index d0465bcc69..a3fcead662 100644 --- a/examples/api/lib/widgets/overlay/overlay_portal.0.dart +++ b/examples/api/lib/widgets/overlay/overlay_portal.0.dart @@ -2,19 +2,18 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for OverlayPortal - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [OverlayPortal]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const OverlayPortalExampleApp()); + +class OverlayPortalExampleApp extends StatelessWidget { + const OverlayPortalExampleApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( - title: 'Flutter Code Sample', home: Scaffold( appBar: AppBar(title: const Text('OverlayPortal Example')), body: const Center(child: ClickableTooltipWidget()), diff --git a/examples/api/lib/widgets/overscroll_indicator/glowing_overscroll_indicator.0.dart b/examples/api/lib/widgets/overscroll_indicator/glowing_overscroll_indicator.0.dart index ac9705bf7f..fc695e47e5 100644 --- a/examples/api/lib/widgets/overscroll_indicator/glowing_overscroll_indicator.0.dart +++ b/examples/api/lib/widgets/overscroll_indicator/glowing_overscroll_indicator.0.dart @@ -2,36 +2,32 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [GlowingOverscrollIndicator]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [GlowingOverscrollIndicator]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const GlowingOverscrollIndicatorExampleApp()); - static const String _title = 'Flutter Code Sample'; +class GlowingOverscrollIndicatorExampleApp extends StatelessWidget { + const GlowingOverscrollIndicatorExampleApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( - title: _title, home: Scaffold( - appBar: AppBar(title: const Text(_title)), - body: const MyStatelessWidget(), + appBar: AppBar(title: const Text('GlowingOverscrollIndicator Sample')), + body: const GlowingOverscrollIndicatorExample(), ), ); } } -class MyStatelessWidget extends StatelessWidget { - const MyStatelessWidget({super.key}); +class GlowingOverscrollIndicatorExample extends StatelessWidget { + const GlowingOverscrollIndicatorExample({super.key}); @override Widget build(BuildContext context) { - final double leadingPaintOffset = - MediaQuery.of(context).padding.top + AppBar().preferredSize.height; + final double leadingPaintOffset = MediaQuery.of(context).padding.top + AppBar().preferredSize.height; return NotificationListener( onNotification: (OverscrollIndicatorNotification notification) { if (notification.leading) { diff --git a/examples/api/lib/widgets/overscroll_indicator/glowing_overscroll_indicator.1.dart b/examples/api/lib/widgets/overscroll_indicator/glowing_overscroll_indicator.1.dart index 2ad79f979d..a9a5532bf9 100644 --- a/examples/api/lib/widgets/overscroll_indicator/glowing_overscroll_indicator.1.dart +++ b/examples/api/lib/widgets/overscroll_indicator/glowing_overscroll_indicator.1.dart @@ -2,31 +2,28 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [GlowingOverscrollIndicator]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [GlowingOverscrollIndicator]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const GlowingOverscrollIndicatorExampleApp()); - static const String _title = 'Flutter Code Sample'; +class GlowingOverscrollIndicatorExampleApp extends StatelessWidget { + const GlowingOverscrollIndicatorExampleApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( - title: _title, home: Scaffold( - appBar: AppBar(title: const Text(_title)), - body: const MyStatelessWidget(), + appBar: AppBar(title: const Text('GlowingOverscrollIndicator Sample')), + body: const GlowingOverscrollIndicatorExample(), ), ); } } -class MyStatelessWidget extends StatelessWidget { - const MyStatelessWidget({super.key}); +class GlowingOverscrollIndicatorExample extends StatelessWidget { + const GlowingOverscrollIndicatorExample({super.key}); @override Widget build(BuildContext context) { diff --git a/examples/api/lib/widgets/page_storage/page_storage.0.dart b/examples/api/lib/widgets/page_storage/page_storage.0.dart index b6d541e217..78c731981c 100644 --- a/examples/api/lib/widgets/page_storage/page_storage.0.dart +++ b/examples/api/lib/widgets/page_storage/page_storage.0.dart @@ -2,14 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [PageStorage]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [PageStorage]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const PageStorageExampleApp()); + +class PageStorageExampleApp extends StatelessWidget { + const PageStorageExampleApp({super.key}); @override Widget build(BuildContext context) { diff --git a/examples/api/lib/widgets/page_view/page_view.0.dart b/examples/api/lib/widgets/page_view/page_view.0.dart index f21d689291..862aafc2a8 100644 --- a/examples/api/lib/widgets/page_view/page_view.0.dart +++ b/examples/api/lib/widgets/page_view/page_view.0.dart @@ -2,31 +2,28 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [PageView]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [PageView]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const PageViewExampleApp()); - static const String _title = 'Flutter Code Sample'; +class PageViewExampleApp extends StatelessWidget { + const PageViewExampleApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( - title: _title, home: Scaffold( - appBar: AppBar(title: const Text(_title)), - body: const MyStatelessWidget(), + appBar: AppBar(title: const Text('PageView Sample')), + body: const PageViewExample(), ), ); } } -class MyStatelessWidget extends StatelessWidget { - const MyStatelessWidget({super.key}); +class PageViewExample extends StatelessWidget { + const PageViewExample({super.key}); @override Widget build(BuildContext context) { diff --git a/examples/api/lib/widgets/preferred_size/preferred_size.0.dart b/examples/api/lib/widgets/preferred_size/preferred_size.0.dart index e04de9cf4e..8ea542f092 100644 --- a/examples/api/lib/widgets/preferred_size/preferred_size.0.dart +++ b/examples/api/lib/widgets/preferred_size/preferred_size.0.dart @@ -2,22 +2,19 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [PreferredSize]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [PreferredSize]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const PreferredSizeExampleApp()); - static const String _title = 'Flutter Code Sample'; +class PreferredSizeExampleApp extends StatelessWidget { + const PreferredSizeExampleApp({super.key}); @override Widget build(BuildContext context) { return const MaterialApp( - title: _title, - home: MyStatelessWidget(), + home: PreferredSizeExample(), ); } } @@ -63,8 +60,8 @@ class AppBarContent extends StatelessWidget { } } -class MyStatelessWidget extends StatelessWidget { - const MyStatelessWidget({super.key}); +class PreferredSizeExample extends StatelessWidget { + const PreferredSizeExample({super.key}); @override Widget build(BuildContext context) { diff --git a/examples/api/lib/widgets/restoration/restoration_mixin.0.dart b/examples/api/lib/widgets/restoration/restoration_mixin.0.dart index 3a4c9e23ec..5f401a2dbd 100644 --- a/examples/api/lib/widgets/restoration/restoration_mixin.0.dart +++ b/examples/api/lib/widgets/restoration/restoration_mixin.0.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [RestorationMixin]. - import 'package:flutter/material.dart'; +/// Flutter code sample for [RestorationMixin]. + void main() => runApp(const RestorationExampleApp()); class RestorationExampleApp extends StatelessWidget { @@ -32,8 +32,7 @@ class RestorableCounter extends StatefulWidget { // The [State] object uses the [RestorationMixin] to make the current value // of the counter restorable. -class _RestorableCounterState extends State - with RestorationMixin { +class _RestorableCounterState extends State with RestorationMixin { // The current value of the counter is stored in a [RestorableProperty]. // During state restoration it is automatically restored to its old value. // If no restoration data is available to restore the counter from, it is diff --git a/examples/api/lib/widgets/restoration_properties/restorable_value.0.dart b/examples/api/lib/widgets/restoration_properties/restorable_value.0.dart index 1b3316753a..f16a6994f9 100644 --- a/examples/api/lib/widgets/restoration_properties/restorable_value.0.dart +++ b/examples/api/lib/widgets/restoration_properties/restorable_value.0.dart @@ -2,41 +2,40 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [RestorableValue]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [RestorableValue]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const RestorableValueExampleApp()); + +class RestorableValueExampleApp extends StatelessWidget { + const RestorableValueExampleApp({super.key}); @override Widget build(BuildContext context) { return WidgetsApp( - title: 'Flutter Code Sample', + title: 'RestorableValue Sample', color: const Color(0xffffffff), builder: (BuildContext context, Widget? child) { return const Center( - child: MyStatefulWidget(restorationId: 'main'), + child: RestorableValueExample(restorationId: 'main'), ); }, ); } } -class MyStatefulWidget extends StatefulWidget { - const MyStatefulWidget({super.key, this.restorationId}); +class RestorableValueExample extends StatefulWidget { + const RestorableValueExample({super.key, this.restorationId}); final String? restorationId; @override - State createState() => _MyStatefulWidgetState(); + State createState() => _RestorableValueExampleState(); } /// RestorationProperty objects can be used because of RestorationMixin. -class _MyStatefulWidgetState extends State - with RestorationMixin { +class _RestorableValueExampleState extends State with RestorationMixin { // In this example, the restoration ID for the mixin is passed in through // the [StatefulWidget]'s constructor. @override diff --git a/examples/api/lib/widgets/routes/popup_route.0.dart b/examples/api/lib/widgets/routes/popup_route.0.dart index c3b6a82adf..ea1384e729 100644 --- a/examples/api/lib/widgets/routes/popup_route.0.dart +++ b/examples/api/lib/widgets/routes/popup_route.0.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [PopupRoute]. - import 'package:flutter/material.dart'; +/// Flutter code sample for [PopupRoute]. + void main() => runApp(const PopupRouteApp()); class PopupRouteApp extends StatelessWidget { diff --git a/examples/api/lib/widgets/routes/show_general_dialog.0.dart b/examples/api/lib/widgets/routes/show_general_dialog.0.dart index 33073c8e73..339a2ce61d 100644 --- a/examples/api/lib/widgets/routes/show_general_dialog.0.dart +++ b/examples/api/lib/widgets/routes/show_general_dialog.0.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [showGeneralDialog]. - import 'package:flutter/material.dart'; +/// Flutter code sample for [showGeneralDialog]. + void main() => runApp(const GeneralDialogApp()); class GeneralDialogApp extends StatelessWidget { @@ -39,8 +39,7 @@ class GeneralDialogExample extends StatelessWidget { } @pragma('vm:entry-point') - static Route _dialogBuilder( - BuildContext context, Object? arguments) { + static Route _dialogBuilder(BuildContext context, Object? arguments) { return RawDialogRoute( pageBuilder: ( BuildContext context, diff --git a/examples/api/lib/widgets/scroll_position/scroll_metrics_notification.0.dart b/examples/api/lib/widgets/scroll_position/scroll_metrics_notification.0.dart index a6671619f2..cd53ffc13e 100644 --- a/examples/api/lib/widgets/scroll_position/scroll_metrics_notification.0.dart +++ b/examples/api/lib/widgets/scroll_position/scroll_metrics_notification.0.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [ScrollMetricsNotification]. - import 'package:flutter/material.dart'; +/// Flutter code sample for [ScrollMetricsNotification]. + void main() => runApp(const ScrollMetricsDemo()); class ScrollMetricsDemo extends StatefulWidget { diff --git a/examples/api/lib/widgets/scroll_view/custom_scroll_view.1.dart b/examples/api/lib/widgets/scroll_view/custom_scroll_view.1.dart index 2822dad0fe..213175d744 100644 --- a/examples/api/lib/widgets/scroll_view/custom_scroll_view.1.dart +++ b/examples/api/lib/widgets/scroll_view/custom_scroll_view.1.dart @@ -2,34 +2,31 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [CustomScrollView]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [CustomScrollView]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const CustomScrollViewExampleApp()); - static const String _title = 'Flutter Code Sample'; +class CustomScrollViewExampleApp extends StatelessWidget { + const CustomScrollViewExampleApp({super.key}); @override Widget build(BuildContext context) { return const MaterialApp( - title: _title, - home: MyStatefulWidget(), + home: CustomScrollViewExample(), ); } } -class MyStatefulWidget extends StatefulWidget { - const MyStatefulWidget({super.key}); +class CustomScrollViewExample extends StatefulWidget { + const CustomScrollViewExample({super.key}); @override - State createState() => _MyStatefulWidgetState(); + State createState() => _CustomScrollViewExampleState(); } -class _MyStatefulWidgetState extends State { +class _CustomScrollViewExampleState extends State { List top = []; List bottom = [0]; diff --git a/examples/api/lib/widgets/scroll_view/listview_select.1.dart b/examples/api/lib/widgets/scroll_view/list_view.0.dart similarity index 90% rename from examples/api/lib/widgets/scroll_view/listview_select.1.dart rename to examples/api/lib/widgets/scroll_view/list_view.0.dart index d1e915fea5..954995f4b9 100644 --- a/examples/api/lib/widgets/scroll_view/listview_select.1.dart +++ b/examples/api/lib/widgets/scroll_view/list_view.0.dart @@ -2,22 +2,18 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [ListTile] selection in a ListView or GridView. -// Long press any ListTile to enable selection mode. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [ListTile] selection in a [ListView] or [GridView]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const ListViewExampleApp()); - static const String _title = 'Flutter Code Sample'; +class ListViewExampleApp extends StatelessWidget { + const ListViewExampleApp({super.key}); @override Widget build(BuildContext context) { return const MaterialApp( - title: _title, home: ListTileSelectExample(), ); } @@ -104,8 +100,7 @@ class ListTileSelectExampleState extends State { onPressed: () { _selectAll = !_selectAll; setState(() { - _selected = - List.generate(listLength, (_) => _selectAll); + _selected = List.generate(listLength, (_) => _selectAll); }); }), ], @@ -161,8 +156,7 @@ class GridBuilderState extends State { Widget build(BuildContext context) { return GridView.builder( itemCount: widget.selectedList.length, - gridDelegate: - const SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 2), + gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 2), itemBuilder: (_, int index) { return InkWell( onTap: () => _toggle(index), @@ -177,9 +171,7 @@ class GridBuilderState extends State { child: GridTile( child: Container( child: widget.isSelectionMode - ? Checkbox( - onChanged: (bool? x) => _toggle(index), - value: widget.selectedList[index]) + ? Checkbox(onChanged: (bool? x) => _toggle(index), value: widget.selectedList[index]) : const Icon(Icons.image), )), ); diff --git a/examples/api/lib/widgets/scrollbar/raw_scrollbar.0.dart b/examples/api/lib/widgets/scrollbar/raw_scrollbar.0.dart index c8e0ac0a5b..c707aa13f1 100644 --- a/examples/api/lib/widgets/scrollbar/raw_scrollbar.0.dart +++ b/examples/api/lib/widgets/scrollbar/raw_scrollbar.0.dart @@ -2,45 +2,41 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [RawScrollbar]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [RawScrollbar]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const RawScrollbarExampleApp()); - static const String _title = 'Flutter Code Sample'; +class RawScrollbarExampleApp extends StatelessWidget { + const RawScrollbarExampleApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( - title: _title, home: Scaffold( - appBar: AppBar(title: const Text(_title)), + appBar: AppBar(title: const Text('RawScrollbar Sample')), body: const Center( - child: MyStatefulWidget(), + child: RawScrollbarExample(), ), ), ); } } -class MyStatefulWidget extends StatefulWidget { - const MyStatefulWidget({super.key}); +class RawScrollbarExample extends StatefulWidget { + const RawScrollbarExample({super.key}); @override - State createState() => _MyStatefulWidgetState(); + State createState() => _RawScrollbarExampleState(); } -class _MyStatefulWidgetState extends State { +class _RawScrollbarExampleState extends State { final ScrollController _firstController = ScrollController(); @override Widget build(BuildContext context) { - return LayoutBuilder( - builder: (BuildContext context, BoxConstraints constraints) { + return LayoutBuilder(builder: (BuildContext context, BoxConstraints constraints) { return Row( children: [ SizedBox( @@ -78,9 +74,7 @@ class _MyStatefulWidgetState extends State { itemBuilder: (BuildContext context, int index) { return Container( height: 50, - color: index.isEven - ? Colors.amberAccent - : Colors.blueAccent, + color: index.isEven ? Colors.amberAccent : Colors.blueAccent, child: Padding( padding: const EdgeInsets.all(8.0), child: Text('Scrollable 2 : Index $index'), diff --git a/examples/api/lib/widgets/scrollbar/raw_scrollbar.1.dart b/examples/api/lib/widgets/scrollbar/raw_scrollbar.1.dart index 4b5ed249ef..2ff22cf071 100644 --- a/examples/api/lib/widgets/scrollbar/raw_scrollbar.1.dart +++ b/examples/api/lib/widgets/scrollbar/raw_scrollbar.1.dart @@ -2,39 +2,35 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [RawScrollbar]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [RawScrollbar]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const RawScrollbarExampleApp()); - static const String _title = 'Flutter Code Sample'; +class RawScrollbarExampleApp extends StatelessWidget { + const RawScrollbarExampleApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( - title: _title, home: Scaffold( - appBar: AppBar(title: const Text(_title)), - body: const MyStatelessWidget(), + appBar: AppBar(title: const Text('RawScrollbar Sample')), + body: const RawScrollbarExample(), ), ); } } -class MyStatelessWidget extends StatelessWidget { - const MyStatelessWidget({super.key}); +class RawScrollbarExample extends StatelessWidget { + const RawScrollbarExample({super.key}); @override Widget build(BuildContext context) { return RawScrollbar( child: GridView.builder( itemCount: 120, - gridDelegate: - const SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 3), + gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 3), itemBuilder: (BuildContext context, int index) { return Center( child: Text('item $index'), diff --git a/examples/api/lib/widgets/scrollbar/raw_scrollbar.2.dart b/examples/api/lib/widgets/scrollbar/raw_scrollbar.2.dart index 72447b563b..f8aeb105ef 100644 --- a/examples/api/lib/widgets/scrollbar/raw_scrollbar.2.dart +++ b/examples/api/lib/widgets/scrollbar/raw_scrollbar.2.dart @@ -2,37 +2,34 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [RawScrollbar]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [RawScrollbar]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const RawScrollbarExampleApp()); - static const String _title = 'Flutter Code Sample'; +class RawScrollbarExampleApp extends StatelessWidget { + const RawScrollbarExampleApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( - title: _title, home: Scaffold( - appBar: AppBar(title: const Text(_title)), - body: const MyStatefulWidget(), + appBar: AppBar(title: const Text('RawScrollbar Sample')), + body: const RawScrollbarExample(), ), ); } } -class MyStatefulWidget extends StatefulWidget { - const MyStatefulWidget({super.key}); +class RawScrollbarExample extends StatefulWidget { + const RawScrollbarExample({super.key}); @override - State createState() => _MyStatefulWidgetState(); + State createState() => _RawScrollbarExampleState(); } -class _MyStatefulWidgetState extends State { +class _RawScrollbarExampleState extends State { final ScrollController _controllerOne = ScrollController(); @override @@ -43,8 +40,7 @@ class _MyStatefulWidgetState extends State { child: GridView.builder( controller: _controllerOne, itemCount: 120, - gridDelegate: - const SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 3), + gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 3), itemBuilder: (BuildContext context, int index) { return Center( child: Text('item $index'), diff --git a/examples/api/lib/widgets/scrollbar/raw_scrollbar.desktop.0.dart b/examples/api/lib/widgets/scrollbar/raw_scrollbar.desktop.0.dart index 31d231b7b2..b917dace70 100644 --- a/examples/api/lib/widgets/scrollbar/raw_scrollbar.desktop.0.dart +++ b/examples/api/lib/widgets/scrollbar/raw_scrollbar.desktop.0.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [Scrollbar]. - import 'package:flutter/material.dart'; +/// Flutter code sample for [Scrollbar]. + void main() => runApp(const ScrollbarApp()); class ScrollbarApp extends StatelessWidget { @@ -17,27 +17,26 @@ class ScrollbarApp extends StatelessWidget { home: Scaffold( appBar: AppBar(title: const Text('Scrollbar Sample')), body: const Center( - child: MyStatefulWidget(), + child: DesktopExample(), ), ), ); } } -class MyStatefulWidget extends StatefulWidget { - const MyStatefulWidget({super.key}); +class DesktopExample extends StatefulWidget { + const DesktopExample({super.key}); @override - State createState() => _MyStatefulWidgetState(); + State createState() => _DesktopExampleState(); } -class _MyStatefulWidgetState extends State { +class _DesktopExampleState extends State { final ScrollController controller = ScrollController(); @override Widget build(BuildContext context) { - return LayoutBuilder( - builder: (BuildContext context, BoxConstraints constraints) { + return LayoutBuilder(builder: (BuildContext context, BoxConstraints constraints) { return Row( children: [ SizedBox( @@ -73,8 +72,7 @@ class _MyStatefulWidgetState extends State { thickness: 20.0, thumbVisibility: true, child: ScrollConfiguration( - behavior: ScrollConfiguration.of(context) - .copyWith(scrollbars: false), + behavior: ScrollConfiguration.of(context).copyWith(scrollbars: false), child: ListView.builder( primary: true, itemCount: 100, diff --git a/examples/api/lib/widgets/scrollbar/raw_scrollbar.shape.0.dart b/examples/api/lib/widgets/scrollbar/raw_scrollbar.shape.0.dart index dd58df9565..1993cc59b6 100644 --- a/examples/api/lib/widgets/scrollbar/raw_scrollbar.shape.0.dart +++ b/examples/api/lib/widgets/scrollbar/raw_scrollbar.shape.0.dart @@ -2,35 +2,31 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [RawScrollbar.shape]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [RawScrollbar.shape]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const ShapeExampleApp()); - static const String _title = 'Flutter Code Sample'; +class ShapeExampleApp extends StatelessWidget { + const ShapeExampleApp({super.key}); @override Widget build(BuildContext context) { return const MaterialApp( - title: _title, - home: MyStatelessWidget(), + home: ShapeExample(), ); } } -class MyStatelessWidget extends StatelessWidget { - const MyStatelessWidget({super.key}); +class ShapeExample extends StatelessWidget { + const ShapeExample({super.key}); @override Widget build(BuildContext context) { return Scaffold( body: RawScrollbar( - shape: const StadiumBorder( - side: BorderSide(color: Colors.brown, width: 3.0)), + shape: const StadiumBorder(side: BorderSide(color: Colors.brown, width: 3.0)), thickness: 15.0, thumbColor: Colors.blue, thumbVisibility: true, @@ -41,8 +37,7 @@ class MyStatelessWidget extends StatelessWidget { // PrimaryScrollController requires ScrollView.primary be set. primary: true, physics: const BouncingScrollPhysics(), - children: List.generate( - 100, (int index) => Text((index * index).toString())), + children: List.generate(100, (int index) => Text((index * index).toString())), ), ), ); diff --git a/examples/api/lib/widgets/shared_app_data/shared_app_data.0.dart b/examples/api/lib/widgets/shared_app_data/shared_app_data.0.dart index 8063eab763..2a2c698e50 100644 --- a/examples/api/lib/widgets/shared_app_data/shared_app_data.0.dart +++ b/examples/api/lib/widgets/shared_app_data/shared_app_data.0.dart @@ -2,12 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [SharedAppData]. - import 'package:flutter/material.dart'; +/// Flutter code sample for [SharedAppData]. + class ShowSharedValue extends StatelessWidget { - const ShowSharedValue({ super.key, required this.appDataKey }); + const ShowSharedValue({super.key, required this.appDataKey}); final String appDataKey; @@ -25,7 +25,7 @@ class ShowSharedValue extends StatelessWidget { // widgets to be rebuilt. In this case that's the ShowSharedValue widget that's // displaying the value of a key whose value has been updated. class Home extends StatefulWidget { - const Home({ super.key }); + const Home({super.key}); @override State createState() => _HomeState(); @@ -52,7 +52,8 @@ class _HomeState extends State { _fooVersion += 1; // Changing the SharedAppData's value for 'foo' causes the // widgets that depend on 'foo' to be rebuilt. - SharedAppData.setValue(context, 'foo', 'FOO $_fooVersion'); // no need to call setState() + SharedAppData.setValue( + context, 'foo', 'FOO $_fooVersion'); // no need to call setState() }, ), const SizedBox(height: 16), @@ -60,7 +61,8 @@ class _HomeState extends State { child: const Text('change bar'), onPressed: () { _barVersion += 1; - SharedAppData.setValue(context, 'bar', 'BAR $_barVersion'); // no need to call setState() + SharedAppData.setValue( + context, 'bar', 'BAR $_barVersion'); // no need to call setState() }, ), ], diff --git a/examples/api/lib/widgets/shared_app_data/shared_app_data.1.dart b/examples/api/lib/widgets/shared_app_data/shared_app_data.1.dart index 123e2bc9e4..76b081e895 100644 --- a/examples/api/lib/widgets/shared_app_data/shared_app_data.1.dart +++ b/examples/api/lib/widgets/shared_app_data/shared_app_data.1.dart @@ -2,11 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [SharedAppData]. - import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; +/// Flutter code sample for [SharedAppData]. + // A single lazily-constructed object that's shared with the entire application // via `SharedObject.of(context)`. The value of the object can be changed with // `SharedObject.reset(context)`. Resetting the value will cause all of the @@ -34,7 +34,7 @@ class SharedObject { // An example of a widget which depends on the SharedObject's value, which might // be provided - along with SharedObject - in a Dart package. class CustomWidget extends StatelessWidget { - const CustomWidget({ super.key }); + const CustomWidget({super.key}); @override Widget build(BuildContext context) { @@ -49,14 +49,12 @@ class CustomWidget extends StatelessWidget { } class Home extends StatelessWidget { - const Home({ super.key }); + const Home({super.key}); @override Widget build(BuildContext context) { return const Scaffold( - body: Center( - child: CustomWidget() - ), + body: Center(child: CustomWidget()), ); } } diff --git a/examples/api/lib/widgets/shortcuts/character_activator.0.dart b/examples/api/lib/widgets/shortcuts/character_activator.0.dart index 56ed8a4c66..08e703c398 100644 --- a/examples/api/lib/widgets/shortcuts/character_activator.0.dart +++ b/examples/api/lib/widgets/shortcuts/character_activator.0.dart @@ -2,25 +2,22 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [CharacterActivator]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [CharacterActivator]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const CharacterActivatorExampleApp()); - static const String _title = 'Flutter Code Sample'; +class CharacterActivatorExampleApp extends StatelessWidget { + const CharacterActivatorExampleApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( - title: _title, home: Scaffold( - appBar: AppBar(title: const Text(_title)), + appBar: AppBar(title: const Text('CharacterActivator Sample')), body: const Center( - child: MyStatefulWidget(), + child: CharacterActivatorExample(), ), ), ); @@ -31,14 +28,14 @@ class HelpMenuIntent extends Intent { const HelpMenuIntent(); } -class MyStatefulWidget extends StatefulWidget { - const MyStatefulWidget({super.key}); +class CharacterActivatorExample extends StatefulWidget { + const CharacterActivatorExample({super.key}); @override - State createState() => _MyStatefulWidgetState(); + State createState() => _CharacterActivatorExampleState(); } -class _MyStatefulWidgetState extends State { +class _CharacterActivatorExampleState extends State { @override Widget build(BuildContext context) { return Shortcuts( diff --git a/examples/api/lib/widgets/shortcuts/logical_key_set.0.dart b/examples/api/lib/widgets/shortcuts/logical_key_set.0.dart index 6a35565426..e784c72a8c 100644 --- a/examples/api/lib/widgets/shortcuts/logical_key_set.0.dart +++ b/examples/api/lib/widgets/shortcuts/logical_key_set.0.dart @@ -2,26 +2,23 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [LogicalKeySet]. - import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [LogicalKeySet]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const LogicalKeySetExampleApp()); - static const String _title = 'Flutter Code Sample'; +class LogicalKeySetExampleApp extends StatelessWidget { + const LogicalKeySetExampleApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( - title: _title, home: Scaffold( - appBar: AppBar(title: const Text(_title)), + appBar: AppBar(title: const Text('LogicalKeySet Sample')), body: const Center( - child: MyStatefulWidget(), + child: LogicalKeySetExample(), ), ), ); @@ -32,22 +29,21 @@ class IncrementIntent extends Intent { const IncrementIntent(); } -class MyStatefulWidget extends StatefulWidget { - const MyStatefulWidget({super.key}); +class LogicalKeySetExample extends StatefulWidget { + const LogicalKeySetExample({super.key}); @override - State createState() => _MyStatefulWidgetState(); + State createState() => _LogicalKeySetExampleState(); } -class _MyStatefulWidgetState extends State { +class _LogicalKeySetExampleState extends State { int count = 0; @override Widget build(BuildContext context) { return Shortcuts( shortcuts: { - LogicalKeySet(LogicalKeyboardKey.keyC, LogicalKeyboardKey.controlLeft): - const IncrementIntent(), + LogicalKeySet(LogicalKeyboardKey.keyC, LogicalKeyboardKey.controlLeft): const IncrementIntent(), }, child: Actions( actions: >{ diff --git a/examples/api/lib/widgets/shortcuts/shortcuts.0.dart b/examples/api/lib/widgets/shortcuts/shortcuts.0.dart index 772ef74d03..d88825cb27 100644 --- a/examples/api/lib/widgets/shortcuts/shortcuts.0.dart +++ b/examples/api/lib/widgets/shortcuts/shortcuts.0.dart @@ -2,26 +2,23 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [Shortcuts]. - import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [Shortcuts]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const ShortcutsExampleApp()); - static const String _title = 'Flutter Code Sample'; +class ShortcutsExampleApp extends StatelessWidget { + const ShortcutsExampleApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( - title: _title, home: Scaffold( - appBar: AppBar(title: const Text(_title)), + appBar: AppBar(title: const Text('Shortcuts Sample')), body: const Center( - child: MyStatefulWidget(), + child: ShortcutsExample(), ), ), ); @@ -36,14 +33,14 @@ class DecrementIntent extends Intent { const DecrementIntent(); } -class MyStatefulWidget extends StatefulWidget { - const MyStatefulWidget({super.key}); +class ShortcutsExample extends StatefulWidget { + const ShortcutsExample({super.key}); @override - State createState() => _MyStatefulWidgetState(); + State createState() => _ShortcutsExampleState(); } -class _MyStatefulWidgetState extends State { +class _ShortcutsExampleState extends State { int count = 0; @override @@ -71,8 +68,7 @@ class _MyStatefulWidgetState extends State { child: Column( children: [ const Text('Add to the counter by pressing the up arrow key'), - const Text( - 'Subtract from the counter by pressing the down arrow key'), + const Text('Subtract from the counter by pressing the down arrow key'), Text('count: $count'), ], ), diff --git a/examples/api/lib/widgets/shortcuts/shortcuts.1.dart b/examples/api/lib/widgets/shortcuts/shortcuts.1.dart index 81964d0479..6f1281d0fc 100644 --- a/examples/api/lib/widgets/shortcuts/shortcuts.1.dart +++ b/examples/api/lib/widgets/shortcuts/shortcuts.1.dart @@ -2,26 +2,23 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [Shortcuts]. - import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [Shortcuts]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const ShortcutsExampleApp()); - static const String _title = 'Flutter Code Sample'; +class ShortcutsExampleApp extends StatelessWidget { + const ShortcutsExampleApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( - title: _title, home: Scaffold( - appBar: AppBar(title: const Text(_title)), + appBar: AppBar(title: const Text('Shortcuts Sample')), body: const Center( - child: MyStatefulWidget(), + child: ShortcutsExample(), ), ), ); @@ -75,14 +72,14 @@ class DecrementAction extends Action { } } -class MyStatefulWidget extends StatefulWidget { - const MyStatefulWidget({super.key}); +class ShortcutsExample extends StatefulWidget { + const ShortcutsExample({super.key}); @override - State createState() => _MyStatefulWidgetState(); + State createState() => _ShortcutsExampleState(); } -class _MyStatefulWidgetState extends State { +class _ShortcutsExampleState extends State { Model model = Model(); @override @@ -102,8 +99,7 @@ class _MyStatefulWidgetState extends State { child: Column( children: [ const Text('Add to the counter by pressing the up arrow key'), - const Text( - 'Subtract from the counter by pressing the down arrow key'), + const Text('Subtract from the counter by pressing the down arrow key'), AnimatedBuilder( animation: model, builder: (BuildContext context, Widget? child) { diff --git a/examples/api/lib/widgets/shortcuts/single_activator.single_activator.0.dart b/examples/api/lib/widgets/shortcuts/single_activator.single_activator.0.dart index 30973a07a2..5cb5eb8b68 100644 --- a/examples/api/lib/widgets/shortcuts/single_activator.single_activator.0.dart +++ b/examples/api/lib/widgets/shortcuts/single_activator.single_activator.0.dart @@ -2,26 +2,23 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [SingleActivator.SingleActivator]. - import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [SingleActivator.SingleActivator]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const SingleActivatorExampleApp()); - static const String _title = 'Flutter Code Sample'; +class SingleActivatorExampleApp extends StatelessWidget { + const SingleActivatorExampleApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( - title: _title, home: Scaffold( - appBar: AppBar(title: const Text(_title)), + appBar: AppBar(title: const Text('SingleActivator Sample')), body: const Center( - child: MyStatefulWidget(), + child: SingleActivatorExample(), ), ), ); @@ -32,22 +29,21 @@ class IncrementIntent extends Intent { const IncrementIntent(); } -class MyStatefulWidget extends StatefulWidget { - const MyStatefulWidget({super.key}); +class SingleActivatorExample extends StatefulWidget { + const SingleActivatorExample({super.key}); @override - State createState() => _MyStatefulWidgetState(); + State createState() => _SingleActivatorExampleState(); } -class _MyStatefulWidgetState extends State { +class _SingleActivatorExampleState extends State { int count = 0; @override Widget build(BuildContext context) { return Shortcuts( shortcuts: const { - SingleActivator(LogicalKeyboardKey.keyC, control: true): - IncrementIntent(), + SingleActivator(LogicalKeyboardKey.keyC, control: true): IncrementIntent(), }, child: Actions( actions: >{ diff --git a/examples/api/lib/widgets/single_child_scroll_view/single_child_scroll_view.0.dart b/examples/api/lib/widgets/single_child_scroll_view/single_child_scroll_view.0.dart index 110c5b1385..c0be195c30 100644 --- a/examples/api/lib/widgets/single_child_scroll_view/single_child_scroll_view.0.dart +++ b/examples/api/lib/widgets/single_child_scroll_view/single_child_scroll_view.0.dart @@ -2,28 +2,25 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [SingleChildScrollView]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [SingleChildScrollView]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const SingleChildScrollViewExampleApp()); - static const String _title = 'Flutter Code Sample'; +class SingleChildScrollViewExampleApp extends StatelessWidget { + const SingleChildScrollViewExampleApp({super.key}); @override Widget build(BuildContext context) { return const MaterialApp( - title: _title, - home: MyStatelessWidget(), + home: SingleChildScrollViewExample(), ); } } -class MyStatelessWidget extends StatelessWidget { - const MyStatelessWidget({super.key}); +class SingleChildScrollViewExample extends StatelessWidget { + const SingleChildScrollViewExample({super.key}); @override Widget build(BuildContext context) { diff --git a/examples/api/lib/widgets/single_child_scroll_view/single_child_scroll_view.1.dart b/examples/api/lib/widgets/single_child_scroll_view/single_child_scroll_view.1.dart index 4a82db2514..9a21cb2cae 100644 --- a/examples/api/lib/widgets/single_child_scroll_view/single_child_scroll_view.1.dart +++ b/examples/api/lib/widgets/single_child_scroll_view/single_child_scroll_view.1.dart @@ -2,28 +2,25 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [SingleChildScrollView]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [SingleChildScrollView]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const SingleChildScrollViewExampleApp()); - static const String _title = 'Flutter Code Sample'; +class SingleChildScrollViewExampleApp extends StatelessWidget { + const SingleChildScrollViewExampleApp({super.key}); @override Widget build(BuildContext context) { return const MaterialApp( - title: _title, - home: MyStatelessWidget(), + home: SingleChildScrollViewExample(), ); } } -class MyStatelessWidget extends StatelessWidget { - const MyStatelessWidget({super.key}); +class SingleChildScrollViewExample extends StatelessWidget { + const SingleChildScrollViewExample({super.key}); @override Widget build(BuildContext context) { diff --git a/examples/api/lib/widgets/sliver/sliver_opacity.1.dart b/examples/api/lib/widgets/sliver/sliver_opacity.1.dart index 64e0434f32..e2ea3492c3 100644 --- a/examples/api/lib/widgets/sliver/sliver_opacity.1.dart +++ b/examples/api/lib/widgets/sliver/sliver_opacity.1.dart @@ -2,34 +2,31 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [SliverOpacity]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [SliverOpacity]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const SliverOpacityExampleApp()); - static const String _title = 'Flutter Code Sample'; +class SliverOpacityExampleApp extends StatelessWidget { + const SliverOpacityExampleApp({super.key}); @override Widget build(BuildContext context) { return const MaterialApp( - title: _title, - home: MyStatefulWidget(), + home: SliverOpacityExample(), ); } } -class MyStatefulWidget extends StatefulWidget { - const MyStatefulWidget({super.key}); +class SliverOpacityExample extends StatefulWidget { + const SliverOpacityExample({super.key}); @override - State createState() => _MyStatefulWidgetState(); + State createState() => _SliverOpacityExampleState(); } -class _MyStatefulWidgetState extends State { +class _SliverOpacityExampleState extends State { static const List _listItems = [ ListTile(title: Text('Now you see me,')), ListTile(title: Text("Now you don't!")), diff --git a/examples/api/lib/widgets/sliver_fill/sliver_fill_remaining.0.dart b/examples/api/lib/widgets/sliver_fill/sliver_fill_remaining.0.dart index bc34e5c4b2..fe5c745330 100644 --- a/examples/api/lib/widgets/sliver_fill/sliver_fill_remaining.0.dart +++ b/examples/api/lib/widgets/sliver_fill/sliver_fill_remaining.0.dart @@ -2,31 +2,28 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [SliverFillRemaining]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [SliverFillRemaining]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const SliverFillRemainingExampleApp()); - static const String _title = 'Flutter Code Sample'; +class SliverFillRemainingExampleApp extends StatelessWidget { + const SliverFillRemainingExampleApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( - title: _title, home: Scaffold( - appBar: AppBar(title: const Text(_title)), - body: const MyStatelessWidget(), + appBar: AppBar(title: const Text('SliverFillRemaining Sample')), + body: const SliverFillRemainingExample(), ), ); } } -class MyStatelessWidget extends StatelessWidget { - const MyStatelessWidget({super.key}); +class SliverFillRemainingExample extends StatelessWidget { + const SliverFillRemainingExample({super.key}); @override Widget build(BuildContext context) { diff --git a/examples/api/lib/widgets/sliver_fill/sliver_fill_remaining.1.dart b/examples/api/lib/widgets/sliver_fill/sliver_fill_remaining.1.dart index b31b70b775..5d0f4c89dd 100644 --- a/examples/api/lib/widgets/sliver_fill/sliver_fill_remaining.1.dart +++ b/examples/api/lib/widgets/sliver_fill/sliver_fill_remaining.1.dart @@ -2,31 +2,28 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [SliverFillRemaining]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [SliverFillRemaining]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const SliverFillRemainingExampleApp()); - static const String _title = 'Flutter Code Sample'; +class SliverFillRemainingExampleApp extends StatelessWidget { + const SliverFillRemainingExampleApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( - title: _title, home: Scaffold( - appBar: AppBar(title: const Text(_title)), - body: const MyStatelessWidget(), + appBar: AppBar(title: const Text('SliverFillRemaining Sample')), + body: const SliverFillRemainingExample(), ), ); } } -class MyStatelessWidget extends StatelessWidget { - const MyStatelessWidget({super.key}); +class SliverFillRemainingExample extends StatelessWidget { + const SliverFillRemainingExample({super.key}); @override Widget build(BuildContext context) { diff --git a/examples/api/lib/widgets/sliver_fill/sliver_fill_remaining.2.dart b/examples/api/lib/widgets/sliver_fill/sliver_fill_remaining.2.dart index fa4a748ab9..5f3fff43d1 100644 --- a/examples/api/lib/widgets/sliver_fill/sliver_fill_remaining.2.dart +++ b/examples/api/lib/widgets/sliver_fill/sliver_fill_remaining.2.dart @@ -2,31 +2,28 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [SliverFillRemaining]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [SliverFillRemaining]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const SliverFillRemainingExampleApp()); - static const String _title = 'Flutter Code Sample'; +class SliverFillRemainingExampleApp extends StatelessWidget { + const SliverFillRemainingExampleApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( - title: _title, home: Scaffold( - appBar: AppBar(title: const Text(_title)), - body: const MyStatelessWidget(), + appBar: AppBar(title: const Text('SliverFillRemaining Sample')), + body: const SliverFillRemainingExample(), ), ); } } -class MyStatelessWidget extends StatelessWidget { - const MyStatelessWidget({super.key}); +class SliverFillRemainingExample extends StatelessWidget { + const SliverFillRemainingExample({super.key}); @override Widget build(BuildContext context) { diff --git a/examples/api/lib/widgets/sliver_fill/sliver_fill_remaining.3.dart b/examples/api/lib/widgets/sliver_fill/sliver_fill_remaining.3.dart index 84db1ee58c..45d8626c1a 100644 --- a/examples/api/lib/widgets/sliver_fill/sliver_fill_remaining.3.dart +++ b/examples/api/lib/widgets/sliver_fill/sliver_fill_remaining.3.dart @@ -2,31 +2,28 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [SliverFillRemaining]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [SliverFillRemaining]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const SliverFillRemainingExampleApp()); - static const String _title = 'Flutter Code Sample'; +class SliverFillRemainingExampleApp extends StatelessWidget { + const SliverFillRemainingExampleApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( - title: _title, home: Scaffold( - appBar: AppBar(title: const Text(_title)), - body: const MyStatelessWidget(), + appBar: AppBar(title: const Text('SliverFillRemaining Sample')), + body: const SliverFillRemainingExample(), ), ); } } -class MyStatelessWidget extends StatelessWidget { - const MyStatelessWidget({super.key}); +class SliverFillRemainingExample extends StatelessWidget { + const SliverFillRemainingExample({super.key}); @override Widget build(BuildContext context) { @@ -38,8 +35,7 @@ class MyStatelessWidget extends StatelessWidget { // example, which are provided by default on the iOS platform. // BouncingScrollPhysics is combined with AlwaysScrollableScrollPhysics to // allow for the overscroll, regardless of the depth of the scrollable. - physics: - const BouncingScrollPhysics(parent: AlwaysScrollableScrollPhysics()), + physics: const BouncingScrollPhysics(parent: AlwaysScrollableScrollPhysics()), slivers: [ SliverToBoxAdapter( child: Container( diff --git a/examples/api/lib/widgets/slotted_render_object_widget/slotted_multi_child_render_object_widget_mixin.0.dart b/examples/api/lib/widgets/slotted_render_object_widget/slotted_multi_child_render_object_widget_mixin.0.dart index f623709881..e93e5f9210 100644 --- a/examples/api/lib/widgets/slotted_render_object_widget/slotted_multi_child_render_object_widget_mixin.0.dart +++ b/examples/api/lib/widgets/slotted_render_object_widget/slotted_multi_child_render_object_widget_mixin.0.dart @@ -2,11 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [SlottedMultiChildRenderObjectWidgetMixin]. - import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; +/// Flutter code sample for [SlottedMultiChildRenderObjectWidgetMixin]. + /// Slots used for the children of [Diagonal] and [RenderDiagonal]. enum DiagonalSlot { topLeft, @@ -69,7 +69,8 @@ class Diagonal extends RenderObjectWidget with SlottedMultiChildRenderObjectWidg /// A render object that demonstrates the usage of /// [SlottedContainerRenderObjectMixin] by providing slots for two children that /// will be arranged diagonally. -class RenderDiagonal extends RenderBox with SlottedContainerRenderObjectMixin, DebugOverflowIndicatorMixin { +class RenderDiagonal extends RenderBox + with SlottedContainerRenderObjectMixin, DebugOverflowIndicatorMixin { RenderDiagonal({Color? backgroundColor}) : _backgroundColor = backgroundColor; // Getters and setters to configure the [RenderObject] with the configuration @@ -100,10 +101,8 @@ class RenderDiagonal extends RenderBox with SlottedContainerRenderObjectMixin get children { return [ - if (_topLeft != null) - _topLeft!, - if (_bottomRight != null) - _bottomRight!, + if (_topLeft != null) _topLeft!, + if (_bottomRight != null) _bottomRight!, ]; } @@ -157,8 +156,7 @@ class RenderDiagonal extends RenderBox with SlottedContainerRenderObjectMixin runApp(const MyApp()); +/// Flutter code sample for [Table]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const TableExampleApp()); - static const String _title = 'Flutter Code Sample'; +class TableExampleApp extends StatelessWidget { + const TableExampleApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( - title: _title, home: Scaffold( - appBar: AppBar(title: const Text(_title)), - body: const MyStatelessWidget(), + appBar: AppBar(title: const Text('Table Sample')), + body: const TableExample(), ), ); } } -class MyStatelessWidget extends StatelessWidget { - const MyStatelessWidget({super.key}); +class TableExample extends StatelessWidget { + const TableExample({super.key}); @override Widget build(BuildContext context) { diff --git a/examples/api/lib/widgets/tap_region/text_field_tap_region.0.dart b/examples/api/lib/widgets/tap_region/text_field_tap_region.0.dart index a755ebe253..e4e08a4ace 100644 --- a/examples/api/lib/widgets/tap_region/text_field_tap_region.0.dart +++ b/examples/api/lib/widgets/tap_region/text_field_tap_region.0.dart @@ -2,11 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [TextFieldTapRegion]. - import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; +/// Flutter code sample for [TextFieldTapRegion]. + void main() => runApp(const TapRegionApp()); class TapRegionApp extends StatelessWidget { diff --git a/examples/api/lib/widgets/text/text.0.dart b/examples/api/lib/widgets/text/text.0.dart index 5a97202518..26ea189955 100644 --- a/examples/api/lib/widgets/text/text.0.dart +++ b/examples/api/lib/widgets/text/text.0.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [DefaultTextStyle]. - import 'package:flutter/material.dart'; +/// Flutter code sample for [DefaultTextStyle]. + void main() => runApp(const DefaultTextStyleApp()); class DefaultTextStyleApp extends StatelessWidget { diff --git a/examples/api/lib/widgets/text_magnifier/text_magnifier.0.dart b/examples/api/lib/widgets/text_magnifier/text_magnifier.0.dart index 86501d63cc..4afc7dc1c2 100644 --- a/examples/api/lib/widgets/text_magnifier/text_magnifier.0.dart +++ b/examples/api/lib/widgets/text_magnifier/text_magnifier.0.dart @@ -5,10 +5,10 @@ import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; -void main() => runApp(const MyApp(text: 'Hello world!')); +void main() => runApp(const TextMagnifierExampleApp(text: 'Hello world!')); -class MyApp extends StatelessWidget { - const MyApp({ +class TextMagnifierExampleApp extends StatelessWidget { + const TextMagnifierExampleApp({ super.key, this.textDirection = TextDirection.ltr, required this.text, @@ -62,8 +62,7 @@ class CustomMagnifier extends StatelessWidget { // positioning cases. return ValueListenableBuilder( valueListenable: magnifierInfo, - builder: (BuildContext context, - MagnifierInfo currentMagnifierInfo, _) { + builder: (BuildContext context, MagnifierInfo currentMagnifierInfo, _) { // We want to position the magnifier at the global position of the gesture. Offset magnifierPosition = currentMagnifierInfo.globalGesturePosition; diff --git a/examples/api/lib/widgets/transitions/align_transition.0.dart b/examples/api/lib/widgets/transitions/align_transition.0.dart index a978846b2a..fa7118c82a 100644 --- a/examples/api/lib/widgets/transitions/align_transition.0.dart +++ b/examples/api/lib/widgets/transitions/align_transition.0.dart @@ -2,37 +2,33 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [AlignTransition]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [AlignTransition]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const AlignTransitionExampleApp()); - static const String _title = 'Flutter Code Sample'; +class AlignTransitionExampleApp extends StatelessWidget { + const AlignTransitionExampleApp({super.key}); @override Widget build(BuildContext context) { return const MaterialApp( - title: _title, - home: MyStatefulWidget(), + home: AlignTransitionExample(), ); } } -class MyStatefulWidget extends StatefulWidget { - const MyStatefulWidget({super.key}); +class AlignTransitionExample extends StatefulWidget { + const AlignTransitionExample({super.key}); @override - State createState() => _MyStatefulWidgetState(); + State createState() => _AlignTransitionExampleState(); } /// [AnimationController]s can be created with `vsync: this` because of /// [TickerProviderStateMixin]. -class _MyStatefulWidgetState extends State - with TickerProviderStateMixin { +class _AlignTransitionExampleState extends State with TickerProviderStateMixin { // Using `late final` for lazy initialization. See // https://dart.dev/null-safety/understanding-null-safety#lazy-initialization. late final AnimationController _controller = AnimationController( diff --git a/examples/api/lib/widgets/transitions/animated_builder.0.dart b/examples/api/lib/widgets/transitions/animated_builder.0.dart index 49d4d81b63..89abd21292 100644 --- a/examples/api/lib/widgets/transitions/animated_builder.0.dart +++ b/examples/api/lib/widgets/transitions/animated_builder.0.dart @@ -2,39 +2,35 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [AnimatedBuilder]. - import 'dart:math' as math; import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [AnimatedBuilder]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const AnimatedBuilderExampleApp()); - static const String _title = 'Flutter Code Sample'; +class AnimatedBuilderExampleApp extends StatelessWidget { + const AnimatedBuilderExampleApp({super.key}); @override Widget build(BuildContext context) { return const MaterialApp( - title: _title, - home: MyStatefulWidget(), + home: AnimatedBuilderExample(), ); } } -class MyStatefulWidget extends StatefulWidget { - const MyStatefulWidget({super.key}); +class AnimatedBuilderExample extends StatefulWidget { + const AnimatedBuilderExample({super.key}); @override - State createState() => _MyStatefulWidgetState(); + State createState() => _AnimatedBuilderExampleState(); } /// AnimationControllers can be created with `vsync: this` because of /// TickerProviderStateMixin. -class _MyStatefulWidgetState extends State - with TickerProviderStateMixin { +class _AnimatedBuilderExampleState extends State with TickerProviderStateMixin { late final AnimationController _controller = AnimationController( duration: const Duration(seconds: 10), vsync: this, diff --git a/examples/api/lib/widgets/transitions/animated_widget.0.dart b/examples/api/lib/widgets/transitions/animated_widget.0.dart index 1ab888ee63..93c98bc43f 100644 --- a/examples/api/lib/widgets/transitions/animated_widget.0.dart +++ b/examples/api/lib/widgets/transitions/animated_widget.0.dart @@ -2,24 +2,21 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [AnimatedWidget]. - import 'dart:math' as math; import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [AnimatedWidget]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const AnimatedWidgetExampleApp()); - static const String _title = 'Flutter Code Sample'; +class AnimatedWidgetExampleApp extends StatelessWidget { + const AnimatedWidgetExampleApp({super.key}); @override Widget build(BuildContext context) { return const MaterialApp( - title: _title, - home: MyStatefulWidget(), + home: AnimatedWidgetExample(), ); } } @@ -41,17 +38,16 @@ class SpinningContainer extends AnimatedWidget { } } -class MyStatefulWidget extends StatefulWidget { - const MyStatefulWidget({super.key}); +class AnimatedWidgetExample extends StatefulWidget { + const AnimatedWidgetExample({super.key}); @override - State createState() => _MyStatefulWidgetState(); + State createState() => _AnimatedWidgetExampleState(); } /// [AnimationController]s can be created with `vsync: this` because of /// [TickerProviderStateMixin]. -class _MyStatefulWidgetState extends State - with TickerProviderStateMixin { +class _AnimatedWidgetExampleState extends State with TickerProviderStateMixin { late final AnimationController _controller = AnimationController( duration: const Duration(seconds: 10), vsync: this, diff --git a/examples/api/lib/widgets/transitions/decorated_box_transition.0.dart b/examples/api/lib/widgets/transitions/decorated_box_transition.0.dart index 703b44f0af..2ff7ef3ea5 100644 --- a/examples/api/lib/widgets/transitions/decorated_box_transition.0.dart +++ b/examples/api/lib/widgets/transitions/decorated_box_transition.0.dart @@ -2,37 +2,33 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [DecoratedBoxTransition]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [DecoratedBoxTransition]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const DecoratedBoxTransitionExampleApp()); - static const String _title = 'Flutter Code Sample'; +class DecoratedBoxTransitionExampleApp extends StatelessWidget { + const DecoratedBoxTransitionExampleApp({super.key}); @override Widget build(BuildContext context) { return const MaterialApp( - title: _title, - home: MyStatefulWidget(), + home: DecoratedBoxTransitionExample(), ); } } -class MyStatefulWidget extends StatefulWidget { - const MyStatefulWidget({super.key}); +class DecoratedBoxTransitionExample extends StatefulWidget { + const DecoratedBoxTransitionExample({super.key}); @override - State createState() => _MyStatefulWidgetState(); + State createState() => _DecoratedBoxTransitionExampleState(); } /// [AnimationController]s can be created with `vsync: this` because of /// [TickerProviderStateMixin]. -class _MyStatefulWidgetState extends State - with TickerProviderStateMixin { +class _DecoratedBoxTransitionExampleState extends State with TickerProviderStateMixin { final DecorationTween decorationTween = DecorationTween( begin: BoxDecoration( color: const Color(0xFFFFFFFF), diff --git a/examples/api/lib/widgets/transitions/default_text_style_transition.0.dart b/examples/api/lib/widgets/transitions/default_text_style_transition.0.dart index 92185eb647..bd62f97dc3 100644 --- a/examples/api/lib/widgets/transitions/default_text_style_transition.0.dart +++ b/examples/api/lib/widgets/transitions/default_text_style_transition.0.dart @@ -2,36 +2,33 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [DefaultTextStyleTransition]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [DefaultTextStyleTransition]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const DefaultTextStyleTransitionExampleApp()); - static const String _title = 'Flutter Code Sample'; +class DefaultTextStyleTransitionExampleApp extends StatelessWidget { + const DefaultTextStyleTransitionExampleApp({super.key}); @override Widget build(BuildContext context) { return const MaterialApp( - title: _title, - home: MyStatefulWidget(), + home: DefaultTextStyleTransitionExample(), ); } } -class MyStatefulWidget extends StatefulWidget { - const MyStatefulWidget({super.key}); +class DefaultTextStyleTransitionExample extends StatefulWidget { + const DefaultTextStyleTransitionExample({super.key}); @override - State createState() => _MyStatefulWidgetState(); + State createState() => _DefaultTextStyleTransitionExampleState(); } /// [AnimationController]s can be created with `vsync: this` because of /// [TickerProviderStateMixin]. -class _MyStatefulWidgetState extends State +class _DefaultTextStyleTransitionExampleState extends State with TickerProviderStateMixin { late AnimationController _controller; late TextStyleTween _styleTween; @@ -45,10 +42,8 @@ class _MyStatefulWidgetState extends State vsync: this, )..repeat(reverse: true); _styleTween = TextStyleTween( - begin: const TextStyle( - fontSize: 50, color: Colors.blue, fontWeight: FontWeight.w900), - end: const TextStyle( - fontSize: 50, color: Colors.red, fontWeight: FontWeight.w100), + begin: const TextStyle(fontSize: 50, color: Colors.blue, fontWeight: FontWeight.w900), + end: const TextStyle(fontSize: 50, color: Colors.red, fontWeight: FontWeight.w100), ); _curvedAnimation = CurvedAnimation( parent: _controller, diff --git a/examples/api/lib/widgets/transitions/fade_transition.0.dart b/examples/api/lib/widgets/transitions/fade_transition.0.dart index fbe97f5a78..a6dd324641 100644 --- a/examples/api/lib/widgets/transitions/fade_transition.0.dart +++ b/examples/api/lib/widgets/transitions/fade_transition.0.dart @@ -2,37 +2,33 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [FadeTransition]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [FadeTransition]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const FadeTransitionExampleApp()); - static const String _title = 'Flutter Code Sample'; +class FadeTransitionExampleApp extends StatelessWidget { + const FadeTransitionExampleApp({super.key}); @override Widget build(BuildContext context) { return const MaterialApp( - title: _title, - home: MyStatefulWidget(), + home: FadeTransitionExample(), ); } } -class MyStatefulWidget extends StatefulWidget { - const MyStatefulWidget({super.key}); +class FadeTransitionExample extends StatefulWidget { + const FadeTransitionExample({super.key}); @override - State createState() => _MyStatefulWidgetState(); + State createState() => _FadeTransitionExampleState(); } /// [AnimationController]s can be created with `vsync: this` because of /// [TickerProviderStateMixin]. -class _MyStatefulWidgetState extends State - with TickerProviderStateMixin { +class _FadeTransitionExampleState extends State with TickerProviderStateMixin { late final AnimationController _controller = AnimationController( duration: const Duration(seconds: 2), vsync: this, diff --git a/examples/api/lib/widgets/transitions/listenable_builder.0.dart b/examples/api/lib/widgets/transitions/listenable_builder.0.dart index 26e9eed0fb..e0cd2eff3f 100644 --- a/examples/api/lib/widgets/transitions/listenable_builder.0.dart +++ b/examples/api/lib/widgets/transitions/listenable_builder.0.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [ListenableBuilder]. - import 'package:flutter/material.dart'; +/// Flutter code sample for [ListenableBuilder]. + void main() => runApp(const ListenableBuilderExample()); /// This widget listens for changes in the focus state of the subtree defined by diff --git a/examples/api/lib/widgets/transitions/listenable_builder.1.dart b/examples/api/lib/widgets/transitions/listenable_builder.1.dart index eb737a7234..4d83badcdb 100644 --- a/examples/api/lib/widgets/transitions/listenable_builder.1.dart +++ b/examples/api/lib/widgets/transitions/listenable_builder.1.dart @@ -2,11 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for a [ValueNotifier] with a [ListenableBuilder]. - import 'package:flutter/material.dart'; -void main() { runApp(const ListenableBuilderExample()); } +/// Flutter code sample for a [ValueNotifier] with a [ListenableBuilder]. + +void main() { + runApp(const ListenableBuilderExample()); +} class ListenableBuilderExample extends StatefulWidget { const ListenableBuilderExample({super.key}); diff --git a/examples/api/lib/widgets/transitions/listenable_builder.2.dart b/examples/api/lib/widgets/transitions/listenable_builder.2.dart index d9c2e795aa..f417bfc46f 100644 --- a/examples/api/lib/widgets/transitions/listenable_builder.2.dart +++ b/examples/api/lib/widgets/transitions/listenable_builder.2.dart @@ -2,11 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for a [ChangeNotifier] with a [ListenableBuilder]. - import 'package:flutter/material.dart'; -void main() { runApp(const ListenableBuilderExample()); } +/// Flutter code sample for a [ChangeNotifier] with a [ListenableBuilder]. + +void main() { + runApp(const ListenableBuilderExample()); +} class CounterModel with ChangeNotifier { int _count = 0; diff --git a/examples/api/lib/widgets/transitions/listenable_builder.3.dart b/examples/api/lib/widgets/transitions/listenable_builder.3.dart index 518c331062..9d65da22a6 100644 --- a/examples/api/lib/widgets/transitions/listenable_builder.3.dart +++ b/examples/api/lib/widgets/transitions/listenable_builder.3.dart @@ -2,12 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for a [ChangeNotifier] with a [ListenableBuilder]. - import 'dart:math' as math; import 'package:flutter/material.dart'; -void main() { runApp(const ListenableBuilderExample()); } +/// Flutter code sample for a [ChangeNotifier] with a [ListenableBuilder]. + +void main() { + runApp(const ListenableBuilderExample()); +} class ListModel with ChangeNotifier { final List _values = []; diff --git a/examples/api/lib/widgets/transitions/positioned_transition.0.dart b/examples/api/lib/widgets/transitions/positioned_transition.0.dart index ef8f6ee6a6..5adf8b161f 100644 --- a/examples/api/lib/widgets/transitions/positioned_transition.0.dart +++ b/examples/api/lib/widgets/transitions/positioned_transition.0.dart @@ -2,37 +2,33 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [PositionedTransition]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [PositionedTransition]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const PositionedTransitionExampleApp()); - static const String _title = 'Flutter Code Sample'; +class PositionedTransitionExampleApp extends StatelessWidget { + const PositionedTransitionExampleApp({super.key}); @override Widget build(BuildContext context) { return const MaterialApp( - title: _title, - home: MyStatefulWidget(), + home: PositionedTransitionExample(), ); } } -class MyStatefulWidget extends StatefulWidget { - const MyStatefulWidget({super.key}); +class PositionedTransitionExample extends StatefulWidget { + const PositionedTransitionExample({super.key}); @override - State createState() => _MyStatefulWidgetState(); + State createState() => _PositionedTransitionExampleState(); } /// [AnimationController]s can be created with `vsync: this` because of /// [TickerProviderStateMixin]. -class _MyStatefulWidgetState extends State - with TickerProviderStateMixin { +class _PositionedTransitionExampleState extends State with TickerProviderStateMixin { late final AnimationController _controller = AnimationController( duration: const Duration(seconds: 2), vsync: this, @@ -57,17 +53,21 @@ class _MyStatefulWidgetState extends State PositionedTransition( rect: RelativeRectTween( begin: RelativeRect.fromSize( - const Rect.fromLTWH(0, 0, smallLogo, smallLogo), biggest), + const Rect.fromLTWH(0, 0, smallLogo, smallLogo), + biggest, + ), end: RelativeRect.fromSize( - Rect.fromLTWH(biggest.width - bigLogo, - biggest.height - bigLogo, bigLogo, bigLogo), - biggest), + Rect.fromLTWH(biggest.width - bigLogo, biggest.height - bigLogo, bigLogo, bigLogo), + biggest, + ), ).animate(CurvedAnimation( parent: _controller, curve: Curves.elasticInOut, )), child: const Padding( - padding: EdgeInsets.all(8), child: FlutterLogo()), + padding: EdgeInsets.all(8), + child: FlutterLogo(), + ), ), ], ); diff --git a/examples/api/lib/widgets/transitions/relative_positioned_transition.0.dart b/examples/api/lib/widgets/transitions/relative_positioned_transition.0.dart index aad99c7ec3..3b5f57c053 100644 --- a/examples/api/lib/widgets/transitions/relative_positioned_transition.0.dart +++ b/examples/api/lib/widgets/transitions/relative_positioned_transition.0.dart @@ -2,36 +2,33 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [RelativePositionedTransition]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [RelativePositionedTransition]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const RelativePositionedTransitionExampleApp()); - static const String _title = 'Flutter Code Sample'; +class RelativePositionedTransitionExampleApp extends StatelessWidget { + const RelativePositionedTransitionExampleApp({super.key}); @override Widget build(BuildContext context) { return const MaterialApp( - title: _title, - home: MyStatefulWidget(), + home: RelativePositionedTransitionExample(), ); } } -class MyStatefulWidget extends StatefulWidget { - const MyStatefulWidget({super.key}); +class RelativePositionedTransitionExample extends StatefulWidget { + const RelativePositionedTransitionExample({super.key}); @override - State createState() => _MyStatefulWidgetState(); + State createState() => _RelativePositionedTransitionExampleState(); } /// [AnimationController]s can be created with `vsync: this` because of /// [TickerProviderStateMixin]. -class _MyStatefulWidgetState extends State +class _RelativePositionedTransitionExampleState extends State with TickerProviderStateMixin { late final AnimationController _controller = AnimationController( duration: const Duration(seconds: 2), @@ -58,14 +55,20 @@ class _MyStatefulWidgetState extends State size: biggest, rect: RectTween( begin: const Rect.fromLTWH(0, 0, bigLogo, bigLogo), - end: Rect.fromLTWH(biggest.width - smallLogo, - biggest.height - smallLogo, smallLogo, smallLogo), + end: Rect.fromLTWH( + biggest.width - smallLogo, + biggest.height - smallLogo, + smallLogo, + smallLogo, + ), ).animate(CurvedAnimation( parent: _controller, curve: Curves.elasticInOut, )), child: const Padding( - padding: EdgeInsets.all(8), child: FlutterLogo()), + padding: EdgeInsets.all(8), + child: FlutterLogo(), + ), ), ], ); diff --git a/examples/api/lib/widgets/transitions/rotation_transition.0.dart b/examples/api/lib/widgets/transitions/rotation_transition.0.dart index aa554b484f..58001daf30 100644 --- a/examples/api/lib/widgets/transitions/rotation_transition.0.dart +++ b/examples/api/lib/widgets/transitions/rotation_transition.0.dart @@ -2,37 +2,33 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [RotationTransition]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [RotationTransition]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const RotationTransitionExampleApp()); - static const String _title = 'Flutter Code Sample'; +class RotationTransitionExampleApp extends StatelessWidget { + const RotationTransitionExampleApp({super.key}); @override Widget build(BuildContext context) { return const MaterialApp( - title: _title, - home: MyStatefulWidget(), + home: RotationTransitionExample(), ); } } -class MyStatefulWidget extends StatefulWidget { - const MyStatefulWidget({super.key}); +class RotationTransitionExample extends StatefulWidget { + const RotationTransitionExample({super.key}); @override - State createState() => _MyStatefulWidgetState(); + State createState() => _RotationTransitionExampleState(); } /// [AnimationController]s can be created with `vsync: this` because of /// [TickerProviderStateMixin]. -class _MyStatefulWidgetState extends State - with TickerProviderStateMixin { +class _RotationTransitionExampleState extends State with TickerProviderStateMixin { late final AnimationController _controller = AnimationController( duration: const Duration(seconds: 2), vsync: this, diff --git a/examples/api/lib/widgets/transitions/scale_transition.0.dart b/examples/api/lib/widgets/transitions/scale_transition.0.dart index d1eeed84e0..34b3527354 100644 --- a/examples/api/lib/widgets/transitions/scale_transition.0.dart +++ b/examples/api/lib/widgets/transitions/scale_transition.0.dart @@ -2,37 +2,33 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [ScaleTransition]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [ScaleTransition]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const ScaleTransitionExampleApp()); - static const String _title = 'Flutter Code Sample'; +class ScaleTransitionExampleApp extends StatelessWidget { + const ScaleTransitionExampleApp({super.key}); @override Widget build(BuildContext context) { return const MaterialApp( - title: _title, - home: MyStatefulWidget(), + home: ScaleTransitionExample(), ); } } -class MyStatefulWidget extends StatefulWidget { - const MyStatefulWidget({super.key}); +class ScaleTransitionExample extends StatefulWidget { + const ScaleTransitionExample({super.key}); @override - State createState() => _MyStatefulWidgetState(); + State createState() => _ScaleTransitionExampleState(); } /// [AnimationController]s can be created with `vsync: this` because of /// [TickerProviderStateMixin]. -class _MyStatefulWidgetState extends State - with TickerProviderStateMixin { +class _ScaleTransitionExampleState extends State with TickerProviderStateMixin { late final AnimationController _controller = AnimationController( duration: const Duration(seconds: 2), vsync: this, diff --git a/examples/api/lib/widgets/transitions/size_transition.0.dart b/examples/api/lib/widgets/transitions/size_transition.0.dart index 5358f362e0..cfd9525c78 100644 --- a/examples/api/lib/widgets/transitions/size_transition.0.dart +++ b/examples/api/lib/widgets/transitions/size_transition.0.dart @@ -2,37 +2,33 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [SizeTransition]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [SizeTransition]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const SizeTransitionExampleApp()); - static const String _title = 'Flutter Code Sample'; +class SizeTransitionExampleApp extends StatelessWidget { + const SizeTransitionExampleApp({super.key}); @override Widget build(BuildContext context) { return const MaterialApp( - title: _title, - home: MyStatefulWidget(), + home: SizeTransitionExample(), ); } } -class MyStatefulWidget extends StatefulWidget { - const MyStatefulWidget({super.key}); +class SizeTransitionExample extends StatefulWidget { + const SizeTransitionExample({super.key}); @override - State createState() => _MyStatefulWidgetState(); + State createState() => _SizeTransitionExampleState(); } /// [AnimationController]s can be created with `vsync: this` because of /// [TickerProviderStateMixin]. -class _MyStatefulWidgetState extends State - with TickerProviderStateMixin { +class _SizeTransitionExampleState extends State with TickerProviderStateMixin { late final AnimationController _controller = AnimationController( duration: const Duration(seconds: 3), vsync: this, diff --git a/examples/api/lib/widgets/transitions/slide_transition.0.dart b/examples/api/lib/widgets/transitions/slide_transition.0.dart index 767b969901..861dc7f5d4 100644 --- a/examples/api/lib/widgets/transitions/slide_transition.0.dart +++ b/examples/api/lib/widgets/transitions/slide_transition.0.dart @@ -2,40 +2,36 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [SlideTransition]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [SlideTransition]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const SlideTransitionExampleApp()); - static const String _title = 'Flutter Code Sample'; +class SlideTransitionExampleApp extends StatelessWidget { + const SlideTransitionExampleApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( - title: _title, home: Scaffold( - appBar: AppBar(title: const Text(_title)), + appBar: AppBar(title: const Text('SlideTransition Sample')), body: const Center( - child: MyStatefulWidget(), + child: SlideTransitionExample(), ), ), ); } } -class MyStatefulWidget extends StatefulWidget { - const MyStatefulWidget({super.key}); +class SlideTransitionExample extends StatefulWidget { + const SlideTransitionExample({super.key}); @override - State createState() => _MyStatefulWidgetState(); + State createState() => _SlideTransitionExampleState(); } -class _MyStatefulWidgetState extends State - with SingleTickerProviderStateMixin { +class _SlideTransitionExampleState extends State with SingleTickerProviderStateMixin { late final AnimationController _controller = AnimationController( duration: const Duration(seconds: 2), vsync: this, diff --git a/examples/api/lib/widgets/transitions/sliver_fade_transition.0.dart b/examples/api/lib/widgets/transitions/sliver_fade_transition.0.dart index b7db200482..bdd364b859 100644 --- a/examples/api/lib/widgets/transitions/sliver_fade_transition.0.dart +++ b/examples/api/lib/widgets/transitions/sliver_fade_transition.0.dart @@ -2,40 +2,36 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [SliverFadeTransition]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [SliverFadeTransition]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const SliverFadeTransitionExampleApp()); - static const String _title = 'Flutter Code Sample'; +class SliverFadeTransitionExampleApp extends StatelessWidget { + const SliverFadeTransitionExampleApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( - title: _title, home: Scaffold( - appBar: AppBar(title: const Text(_title)), + appBar: AppBar(title: const Text('SliverFadeTransition Sample')), body: const Center( - child: MyStatefulWidget(), + child: SliverFadeTransitionExample(), ), ), ); } } -class MyStatefulWidget extends StatefulWidget { - const MyStatefulWidget({super.key}); +class SliverFadeTransitionExample extends StatefulWidget { + const SliverFadeTransitionExample({super.key}); @override - State createState() => _MyStatefulWidgetState(); + State createState() => _SliverFadeTransitionExampleState(); } -class _MyStatefulWidgetState extends State - with SingleTickerProviderStateMixin { +class _SliverFadeTransitionExampleState extends State with SingleTickerProviderStateMixin { late final AnimationController controller = AnimationController( duration: const Duration(milliseconds: 1000), vsync: this, diff --git a/examples/api/lib/widgets/tween_animation_builder/tween_animation_builder.0.dart b/examples/api/lib/widgets/tween_animation_builder/tween_animation_builder.0.dart index b8b487760a..65d9587818 100644 --- a/examples/api/lib/widgets/tween_animation_builder/tween_animation_builder.0.dart +++ b/examples/api/lib/widgets/tween_animation_builder/tween_animation_builder.0.dart @@ -2,39 +2,36 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [TweenAnimationBuilder]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [TweenAnimationBuilder]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const TweenAnimationBuilderExampleApp()); - static const String _title = 'Flutter Code Sample'; +class TweenAnimationBuilderExampleApp extends StatelessWidget { + const TweenAnimationBuilderExampleApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( - title: _title, home: Scaffold( - appBar: AppBar(title: const Text(_title)), + appBar: AppBar(title: const Text('TweenAnimationBuilder Sample')), body: const Center( - child: MyStatefulWidget(), + child: TweenAnimationBuilderExample(), ), ), ); } } -class MyStatefulWidget extends StatefulWidget { - const MyStatefulWidget({super.key}); +class TweenAnimationBuilderExample extends StatefulWidget { + const TweenAnimationBuilderExample({super.key}); @override - State createState() => _MyStatefulWidgetState(); + State createState() => _TweenAnimationBuilderExampleState(); } -class _MyStatefulWidgetState extends State { +class _TweenAnimationBuilderExampleState extends State { double targetValue = 24.0; @override diff --git a/examples/api/lib/widgets/undo_history/undo_history_controller.0.dart b/examples/api/lib/widgets/undo_history/undo_history_controller.0.dart index 55cd50dac2..33a0dfec05 100644 --- a/examples/api/lib/widgets/undo_history/undo_history_controller.0.dart +++ b/examples/api/lib/widgets/undo_history/undo_history_controller.0.dart @@ -2,23 +2,20 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for UndoHistoryController. - import 'package:flutter/material.dart'; +/// Flutter code sample for [UndoHistoryController]. + void main() { - runApp(const MyApp()); + runApp(const UndoHistoryControllerExampleApp()); } -class MyApp extends StatelessWidget { - const MyApp({super.key}); - - static const String _title = 'Flutter Code Sample'; +class UndoHistoryControllerExampleApp extends StatelessWidget { + const UndoHistoryControllerExampleApp({super.key}); @override Widget build(BuildContext context) { return const MaterialApp( - title: _title, home: MyHomePage(), ); } diff --git a/examples/api/lib/widgets/will_pop_scope/will_pop_scope.0.dart b/examples/api/lib/widgets/will_pop_scope/will_pop_scope.0.dart index 74efd94636..46dafa57b9 100644 --- a/examples/api/lib/widgets/will_pop_scope/will_pop_scope.0.dart +++ b/examples/api/lib/widgets/will_pop_scope/will_pop_scope.0.dart @@ -2,34 +2,31 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flutter code sample for [WillPopScope]. - import 'package:flutter/material.dart'; -void main() => runApp(const MyApp()); +/// Flutter code sample for [WillPopScope]. -class MyApp extends StatelessWidget { - const MyApp({super.key}); +void main() => runApp(const WillPopScopeExampleApp()); - static const String _title = 'Flutter Code Sample'; +class WillPopScopeExampleApp extends StatelessWidget { + const WillPopScopeExampleApp({super.key}); @override Widget build(BuildContext context) { return const MaterialApp( - title: _title, - home: MyStatefulWidget(), + home: WillPopScopeExample(), ); } } -class MyStatefulWidget extends StatefulWidget { - const MyStatefulWidget({super.key}); +class WillPopScopeExample extends StatefulWidget { + const WillPopScopeExample({super.key}); @override - State createState() => _MyStatefulWidgetState(); + State createState() => _WillPopScopeExampleState(); } -class _MyStatefulWidgetState extends State { +class _WillPopScopeExampleState extends State { bool shouldPop = true; @override Widget build(BuildContext context) { @@ -51,7 +48,7 @@ class _MyStatefulWidgetState extends State { Navigator.of(context).push( MaterialPageRoute( builder: (BuildContext context) { - return const MyStatefulWidget(); + return const WillPopScopeExample(); }, ), ); diff --git a/examples/api/test/material/action_buttons/action_icon_theme.0_test.dart b/examples/api/test/material/action_buttons/action_icon_theme.0_test.dart index 3a7249064c..a8cedc3002 100644 --- a/examples/api/test/material/action_buttons/action_icon_theme.0_test.dart +++ b/examples/api/test/material/action_buttons/action_icon_theme.0_test.dart @@ -11,7 +11,7 @@ void main() { await tester.pumpWidget( const MaterialApp( home: Scaffold( - body: example.MyApp(), + body: example.ActionIconThemeExampleApp(), ), ), ); diff --git a/examples/api/test/material/bottom_navigation_bar/bottom_navigation_bar.2_test.dart b/examples/api/test/material/bottom_navigation_bar/bottom_navigation_bar.2_test.dart index 726698b699..4607d7a22e 100644 --- a/examples/api/test/material/bottom_navigation_bar/bottom_navigation_bar.2_test.dart +++ b/examples/api/test/material/bottom_navigation_bar/bottom_navigation_bar.2_test.dart @@ -9,7 +9,7 @@ import 'package:flutter_test/flutter_test.dart'; void main() { testWidgets('BottomNavigationBar Updates Screen Content', (WidgetTester tester) async { await tester.pumpWidget( - const example.MyApp(), + const example.BottomNavigationBarExampleApp(), ); expect(find.widgetWithText(AppBar, 'BottomNavigationBar Sample'), findsOneWidget); diff --git a/examples/api/test/material/card/card.1_test.dart b/examples/api/test/material/card/card.1_test.dart index a107a42ef5..6bdf1cb437 100644 --- a/examples/api/test/material/card/card.1_test.dart +++ b/examples/api/test/material/card/card.1_test.dart @@ -8,7 +8,7 @@ import 'package:flutter_test/flutter_test.dart'; void main() { testWidgets('Card has clip applied', (WidgetTester tester) async { - await tester.pumpWidget(const example.MyApp()); + await tester.pumpWidget(const example.CardExampleApp()); final Card card = tester.firstWidget(find.byType(Card)); expect(card.clipBehavior, Clip.hardEdge); diff --git a/examples/api/test/material/context_menu/context_menu_controller.0_test.dart b/examples/api/test/material/context_menu/context_menu_controller.0_test.dart index a22cc69e49..a2d717767b 100644 --- a/examples/api/test/material/context_menu/context_menu_controller.0_test.dart +++ b/examples/api/test/material/context_menu/context_menu_controller.0_test.dart @@ -12,7 +12,7 @@ import 'package:flutter_test/flutter_test.dart'; void main() { testWidgets('showing and hiding the custom context menu in the whole app', (WidgetTester tester) async { await tester.pumpWidget( - const example.MyApp(), + const example.ContextMenuControllerExampleApp(), ); expect(BrowserContextMenu.enabled, !kIsWeb); diff --git a/examples/api/test/material/context_menu/editable_text_toolbar_builder.0_test.dart b/examples/api/test/material/context_menu/editable_text_toolbar_builder.0_test.dart index c49730090d..b7b7adfe24 100644 --- a/examples/api/test/material/context_menu/editable_text_toolbar_builder.0_test.dart +++ b/examples/api/test/material/context_menu/editable_text_toolbar_builder.0_test.dart @@ -12,7 +12,7 @@ import 'package:flutter_test/flutter_test.dart'; void main() { testWidgets('showing and hiding the context menu in TextField with custom buttons', (WidgetTester tester) async { await tester.pumpWidget( - const example.MyApp(), + const example.EditableTextToolbarBuilderExampleApp(), ); expect(BrowserContextMenu.enabled, !kIsWeb); diff --git a/examples/api/test/material/context_menu/editable_text_toolbar_builder.1_test.dart b/examples/api/test/material/context_menu/editable_text_toolbar_builder.1_test.dart index 4b2b42adb4..ed7e432927 100644 --- a/examples/api/test/material/context_menu/editable_text_toolbar_builder.1_test.dart +++ b/examples/api/test/material/context_menu/editable_text_toolbar_builder.1_test.dart @@ -12,7 +12,7 @@ import 'package:flutter_test/flutter_test.dart'; void main() { testWidgets('showing and hiding the custom context menu in TextField with a specific selection', (WidgetTester tester) async { await tester.pumpWidget( - const example.MyApp(), + const example.EditableTextToolbarBuilderExampleApp(), ); expect(BrowserContextMenu.enabled, !kIsWeb); diff --git a/examples/api/test/material/context_menu/editable_text_toolbar_builder.2_test.dart b/examples/api/test/material/context_menu/editable_text_toolbar_builder.2_test.dart index bd91cd043f..2bcf2ea61d 100644 --- a/examples/api/test/material/context_menu/editable_text_toolbar_builder.2_test.dart +++ b/examples/api/test/material/context_menu/editable_text_toolbar_builder.2_test.dart @@ -12,7 +12,7 @@ import 'package:flutter_test/flutter_test.dart'; void main() { testWidgets('showing and hiding the context menu in TextField with a custom toolbar', (WidgetTester tester) async { await tester.pumpWidget( - const example.MyApp(), + const example.EditableTextToolbarBuilderExampleApp(), ); expect(BrowserContextMenu.enabled, !kIsWeb); diff --git a/examples/api/test/material/context_menu/selectable_region_toolbar_builder.0_test.dart b/examples/api/test/material/context_menu/selectable_region_toolbar_builder.0_test.dart index 59be9cc37b..dd07306e1d 100644 --- a/examples/api/test/material/context_menu/selectable_region_toolbar_builder.0_test.dart +++ b/examples/api/test/material/context_menu/selectable_region_toolbar_builder.0_test.dart @@ -12,7 +12,7 @@ import 'package:flutter_test/flutter_test.dart'; void main() { testWidgets('showing and hiding the custom context menu on SelectionArea', (WidgetTester tester) async { await tester.pumpWidget( - const example.MyApp(), + const example.SelectableRegionToolbarBuilderExampleApp(), ); expect(BrowserContextMenu.enabled, !kIsWeb); diff --git a/examples/api/test/material/dialog/alert_dialog.0_test.dart b/examples/api/test/material/dialog/alert_dialog.0_test.dart index 4a3bb34fca..550487b2fe 100644 --- a/examples/api/test/material/dialog/alert_dialog.0_test.dart +++ b/examples/api/test/material/dialog/alert_dialog.0_test.dart @@ -12,7 +12,7 @@ void main() { await tester.pumpWidget( const MaterialApp( home: Scaffold( - body: example.MyApp(), + body: example.AlertDialogExampleApp(), ), ), ); diff --git a/examples/api/test/material/dialog/alert_dialog.1_test.dart b/examples/api/test/material/dialog/alert_dialog.1_test.dart index 1f90174c62..6bf829e660 100644 --- a/examples/api/test/material/dialog/alert_dialog.1_test.dart +++ b/examples/api/test/material/dialog/alert_dialog.1_test.dart @@ -12,7 +12,7 @@ void main() { await tester.pumpWidget( const MaterialApp( home: Scaffold( - body: example.MyApp(), + body: example.AlertDialogExampleApp(), ), ), ); diff --git a/examples/api/test/material/dialog/dialog.0_test.dart b/examples/api/test/material/dialog/dialog.0_test.dart index b6fb588eaf..617c54667e 100644 --- a/examples/api/test/material/dialog/dialog.0_test.dart +++ b/examples/api/test/material/dialog/dialog.0_test.dart @@ -13,7 +13,7 @@ void main() { await tester.pumpWidget( const MaterialApp( home: Scaffold( - body: example.MyApp(), + body: example.DialogExampleApp(), ), ), ); @@ -35,7 +35,7 @@ void main() { await tester.pumpWidget( const MaterialApp( home: Scaffold( - body: example.MyApp(), + body: example.DialogExampleApp(), ), ), ); diff --git a/examples/api/test/material/dialog/show_dialog.0_test.dart b/examples/api/test/material/dialog/show_dialog.0_test.dart index b56a1218b2..5bd4b3626b 100644 --- a/examples/api/test/material/dialog/show_dialog.0_test.dart +++ b/examples/api/test/material/dialog/show_dialog.0_test.dart @@ -12,7 +12,7 @@ void main() { await tester.pumpWidget( const MaterialApp( home: Scaffold( - body: example.MyApp(), + body: example.ShowDialogExampleApp(), ), ), ); diff --git a/examples/api/test/material/dialog/show_dialog.1_test.dart b/examples/api/test/material/dialog/show_dialog.1_test.dart index be2b4fd8d0..0cc8e83409 100644 --- a/examples/api/test/material/dialog/show_dialog.1_test.dart +++ b/examples/api/test/material/dialog/show_dialog.1_test.dart @@ -12,7 +12,7 @@ void main() { await tester.pumpWidget( const MaterialApp( home: Scaffold( - body: example.MyApp(), + body: example.ShowDialogExampleApp(), ), ), ); diff --git a/examples/api/test/material/dialog/show_dialog.2_test.dart b/examples/api/test/material/dialog/show_dialog.2_test.dart index d234b59d28..06fe8ca4e2 100644 --- a/examples/api/test/material/dialog/show_dialog.2_test.dart +++ b/examples/api/test/material/dialog/show_dialog.2_test.dart @@ -12,7 +12,7 @@ void main() { await tester.pumpWidget( const MaterialApp( home: Scaffold( - body: example.MyApp(), + body: example.ShowDialogExampleApp(), ), ), ); diff --git a/examples/api/test/material/divider/divider.0_test.dart b/examples/api/test/material/divider/divider.0_test.dart index 9234d5445a..ac135a18ca 100644 --- a/examples/api/test/material/divider/divider.0_test.dart +++ b/examples/api/test/material/divider/divider.0_test.dart @@ -11,7 +11,7 @@ void main() { await tester.pumpWidget( const MaterialApp( home: Scaffold( - body: example.MyApp(), + body: example.DividerExampleApp(), ), ), ); diff --git a/examples/api/test/material/divider/divider.1_test.dart b/examples/api/test/material/divider/divider.1_test.dart index a0cedbbe45..afd441ae64 100644 --- a/examples/api/test/material/divider/divider.1_test.dart +++ b/examples/api/test/material/divider/divider.1_test.dart @@ -11,7 +11,7 @@ void main() { await tester.pumpWidget( const MaterialApp( home: Scaffold( - body: example.MyApp(), + body: example.DividerExampleApp(), ), ), ); diff --git a/examples/api/test/material/divider/vertical_divider.0_test.dart b/examples/api/test/material/divider/vertical_divider.0_test.dart index 41e0b988a9..3b61173784 100644 --- a/examples/api/test/material/divider/vertical_divider.0_test.dart +++ b/examples/api/test/material/divider/vertical_divider.0_test.dart @@ -11,7 +11,7 @@ void main() { await tester.pumpWidget( const MaterialApp( home: Scaffold( - body: example.MyApp(), + body: example.VerticalDividerExampleApp(), ), ), ); diff --git a/examples/api/test/material/divider/vertical_divider.1_test.dart b/examples/api/test/material/divider/vertical_divider.1_test.dart index 8840fee58b..8dbe5c1ac4 100644 --- a/examples/api/test/material/divider/vertical_divider.1_test.dart +++ b/examples/api/test/material/divider/vertical_divider.1_test.dart @@ -11,7 +11,7 @@ void main() { await tester.pumpWidget( const MaterialApp( home: Scaffold( - body: example.MyApp(), + body: example.VerticalDividerExampleApp(), ), ), ); diff --git a/examples/api/test/material/floating_action_button/floating_action_button.0_test.dart b/examples/api/test/material/floating_action_button/floating_action_button.0_test.dart index a6bfce51b0..9fa5b6c497 100644 --- a/examples/api/test/material/floating_action_button/floating_action_button.0_test.dart +++ b/examples/api/test/material/floating_action_button/floating_action_button.0_test.dart @@ -10,7 +10,7 @@ import 'package:flutter_test/flutter_test.dart'; void main() { testWidgets('FloatingActionButton', (WidgetTester tester) async { await tester.pumpWidget( - const example.MyApp(), + const example.FloatingActionButtonExampleApp(), ); expect(find.byType(FloatingActionButton), findsOneWidget); diff --git a/examples/api/test/material/floating_action_button/floating_action_button.1_test.dart b/examples/api/test/material/floating_action_button/floating_action_button.1_test.dart index e055b1d009..049d63576b 100644 --- a/examples/api/test/material/floating_action_button/floating_action_button.1_test.dart +++ b/examples/api/test/material/floating_action_button/floating_action_button.1_test.dart @@ -10,7 +10,7 @@ import 'package:flutter_test/flutter_test.dart'; void main() { testWidgets('FloatingActionButton.extended', (WidgetTester tester) async { await tester.pumpWidget( - const example.MyApp(), + const example.FloatingActionButtonExampleApp(), ); expect(find.byType(FloatingActionButton), findsOneWidget); diff --git a/examples/api/test/material/floating_action_button/floating_action_button.2_test.dart b/examples/api/test/material/floating_action_button/floating_action_button.2_test.dart index 66062967bf..d7cd0edd95 100644 --- a/examples/api/test/material/floating_action_button/floating_action_button.2_test.dart +++ b/examples/api/test/material/floating_action_button/floating_action_button.2_test.dart @@ -13,7 +13,7 @@ void main() { return tester.widget(finder); } await tester.pumpWidget( - const example.MyApp(), + const example.FloatingActionButtonExampleApp(), ); expect(find.byType(FloatingActionButton), findsOneWidget); diff --git a/examples/api/test/material/floating_action_button/floating_action_button.3_test.dart b/examples/api/test/material/floating_action_button/floating_action_button.3_test.dart index c3fcb054a1..173ef748d0 100644 --- a/examples/api/test/material/floating_action_button/floating_action_button.3_test.dart +++ b/examples/api/test/material/floating_action_button/floating_action_button.3_test.dart @@ -14,7 +14,7 @@ void main() { } await tester.pumpWidget( - const example.MyApp(), + const example.FloatingActionButtonExampleApp(), ); final ThemeData theme = ThemeData(colorSchemeSeed: const Color(0xff6750a4), useMaterial3: true); diff --git a/examples/api/test/material/ink/ink.image_clip.0_test.dart b/examples/api/test/material/ink/ink.image_clip.0_test.dart index 474fa09abc..233b56fd85 100644 --- a/examples/api/test/material/ink/ink.image_clip.0_test.dart +++ b/examples/api/test/material/ink/ink.image_clip.0_test.dart @@ -21,7 +21,7 @@ void main() { await tester.pumpWidget( MaterialApp( home: Scaffold( - body: example.MyStatelessWidget( + body: example.ImageClipExample( image: MemoryImage(Uint8List.fromList(kTransparentImage)), ), ), diff --git a/examples/api/test/material/ink/ink.image_clip.1_test.dart b/examples/api/test/material/ink/ink.image_clip.1_test.dart index 0428c3603a..a1a19aeca6 100644 --- a/examples/api/test/material/ink/ink.image_clip.1_test.dart +++ b/examples/api/test/material/ink/ink.image_clip.1_test.dart @@ -21,7 +21,7 @@ void main() { await tester.pumpWidget( MaterialApp( home: Scaffold( - body: example.MyStatelessWidget( + body: example.ImageClipExample( image: MemoryImage(Uint8List.fromList(kTransparentImage)), ), ), diff --git a/examples/api/test/material/input_decorator/input_decoration.floating_label_style_error.0_test.dart b/examples/api/test/material/input_decorator/input_decoration.floating_label_style_error.0_test.dart index 4e1d913885..0ee58183e4 100644 --- a/examples/api/test/material/input_decorator/input_decoration.floating_label_style_error.0_test.dart +++ b/examples/api/test/material/input_decorator/input_decoration.floating_label_style_error.0_test.dart @@ -9,7 +9,7 @@ import 'package:flutter_test/flutter_test.dart'; void main() { testWidgets('InputDecorator label uses error color', (WidgetTester tester) async { await tester.pumpWidget( - const example.MyApp(), + const example.FloatingLabelStyleErrorExampleApp(), ); final Theme theme = tester.firstWidget(find.byType(Theme)); diff --git a/examples/api/test/material/input_decorator/input_decoration.label_style_error.0_test.dart b/examples/api/test/material/input_decorator/input_decoration.label_style_error.0_test.dart index 95238b1412..640b8fd228 100644 --- a/examples/api/test/material/input_decorator/input_decoration.label_style_error.0_test.dart +++ b/examples/api/test/material/input_decorator/input_decoration.label_style_error.0_test.dart @@ -9,7 +9,7 @@ import 'package:flutter_test/flutter_test.dart'; void main() { testWidgets('InputDecorator label uses error color', (WidgetTester tester) async { await tester.pumpWidget( - const example.MyApp(), + const example.LabelStyleErrorExampleApp(), ); final Theme theme = tester.firstWidget(find.byType(Theme)); diff --git a/examples/api/test/material/input_decorator/input_decoration.prefix_icon.0_test.dart b/examples/api/test/material/input_decorator/input_decoration.prefix_icon.0_test.dart index aeb791da4e..fcfa9a1007 100644 --- a/examples/api/test/material/input_decorator/input_decoration.prefix_icon.0_test.dart +++ b/examples/api/test/material/input_decorator/input_decoration.prefix_icon.0_test.dart @@ -9,7 +9,7 @@ import 'package:flutter_test/flutter_test.dart'; void main() { testWidgets('InputDecorator prefixIcon alignment', (WidgetTester tester) async { await tester.pumpWidget( - const example.MyApp(), + const example.PrefixIconExampleApp(), ); expect(tester.getCenter(find.byIcon(Icons.person)).dy, 28.0); }); diff --git a/examples/api/test/material/input_decorator/input_decoration.suffix_icon.0_test.dart b/examples/api/test/material/input_decorator/input_decoration.suffix_icon.0_test.dart index 15d8a9069c..7dd5538eaa 100644 --- a/examples/api/test/material/input_decorator/input_decoration.suffix_icon.0_test.dart +++ b/examples/api/test/material/input_decorator/input_decoration.suffix_icon.0_test.dart @@ -9,7 +9,7 @@ import 'package:flutter_test/flutter_test.dart'; void main() { testWidgets('InputDecorator suffixIcon alignment', (WidgetTester tester) async { await tester.pumpWidget( - const example.MyApp(), + const example.SuffixIconExampleApp(), ); expect(tester.getCenter(find.byIcon(Icons.remove_red_eye)).dy, 28.0); }); diff --git a/examples/api/test/material/navigation_rail/navigation_rail.0_test.dart b/examples/api/test/material/navigation_rail/navigation_rail.0_test.dart index 165c0c0874..afe0ac9f54 100644 --- a/examples/api/test/material/navigation_rail/navigation_rail.0_test.dart +++ b/examples/api/test/material/navigation_rail/navigation_rail.0_test.dart @@ -11,7 +11,7 @@ void main() { testWidgets('Navigation rail updates destination on tap', (WidgetTester tester) async { await tester.pumpWidget( - const example.MyApp(), + const example.NavigationRailExampleApp(), ); final NavigationRail navigationRailWidget = tester.firstWidget(find.byType(NavigationRail)); @@ -37,7 +37,7 @@ void main() { testWidgets('Navigation rail updates label type', (WidgetTester tester) async { await tester.pumpWidget( - const example.MyApp(), + const example.NavigationRailExampleApp(), ); // initial label type set to all. @@ -56,7 +56,7 @@ void main() { testWidgets('Navigation rail updates group alignment', (WidgetTester tester) async { await tester.pumpWidget( - const example.MyApp(), + const example.NavigationRailExampleApp(), ); // initial group alignment set top top. @@ -75,7 +75,7 @@ void main() { testWidgets('Navigation rail shows leading/trailing widgets', (WidgetTester tester) async { await tester.pumpWidget( - const example.MyApp(), + const example.NavigationRailExampleApp(), ); // Initially leading/trailing widgets are hidden. diff --git a/examples/api/test/material/navigation_rail/navigation_rail.1_test.dart b/examples/api/test/material/navigation_rail/navigation_rail.1_test.dart index ea266fbba0..1c3eee1482 100644 --- a/examples/api/test/material/navigation_rail/navigation_rail.1_test.dart +++ b/examples/api/test/material/navigation_rail/navigation_rail.1_test.dart @@ -11,7 +11,7 @@ void main() { testWidgets('Navigation rail updates destination on tap', (WidgetTester tester) async { await tester.pumpWidget( - const example.MyApp(), + const example.NavigationRailExampleApp(), ); final NavigationRail navigationRailWidget = tester.firstWidget(find.byType(NavigationRail)); @@ -37,7 +37,7 @@ void main() { testWidgets('Navigation rail updates label type', (WidgetTester tester) async { await tester.pumpWidget( - const example.MyApp(), + const example.NavigationRailExampleApp(), ); // initial label type set to all. @@ -56,7 +56,7 @@ void main() { testWidgets('Navigation rail updates group alignment', (WidgetTester tester) async { await tester.pumpWidget( - const example.MyApp(), + const example.NavigationRailExampleApp(), ); // initial group alignment set top top. @@ -75,7 +75,7 @@ void main() { testWidgets('Navigation rail shows leading/trailing widgets', (WidgetTester tester) async { await tester.pumpWidget( - const example.MyApp(), + const example.NavigationRailExampleApp(), ); // Initially leading/trailing widgets are hidden. diff --git a/examples/api/test/material/refresh_indicator/refresh_indicator.0_test.dart b/examples/api/test/material/refresh_indicator/refresh_indicator.0_test.dart index d7e42e7010..418f7468e5 100644 --- a/examples/api/test/material/refresh_indicator/refresh_indicator.0_test.dart +++ b/examples/api/test/material/refresh_indicator/refresh_indicator.0_test.dart @@ -9,7 +9,7 @@ import 'package:flutter_test/flutter_test.dart'; void main() { testWidgets('Trigger RefreshIndicator - Pull from top', (WidgetTester tester) async { await tester.pumpWidget( - const example.MyApp(), + const example.RefreshIndicatorExampleApp(), ); await tester.fling(find.text('Item 1'), const Offset(0.0, 300.0), 1000.0); @@ -22,7 +22,7 @@ void main() { testWidgets('Trigger RefreshIndicator - Button', (WidgetTester tester) async { await tester.pumpWidget( - const example.MyApp(), + const example.RefreshIndicatorExampleApp(), ); await tester.tap(find.byType(FloatingActionButton)); diff --git a/examples/api/test/material/refresh_indicator/refresh_indicator.1_test.dart b/examples/api/test/material/refresh_indicator/refresh_indicator.1_test.dart index 452c3db6ad..9a97fe8763 100644 --- a/examples/api/test/material/refresh_indicator/refresh_indicator.1_test.dart +++ b/examples/api/test/material/refresh_indicator/refresh_indicator.1_test.dart @@ -9,7 +9,7 @@ import 'package:flutter_test/flutter_test.dart'; void main() { testWidgets('Pulling from nested scroll view triggers refresh indicator', (WidgetTester tester) async { await tester.pumpWidget( - const example.MyApp(), + const example.RefreshIndicatorExampleApp(), ); // Pull from the upper scroll view. diff --git a/examples/api/test/material/text_field/text_field.0_test.dart b/examples/api/test/material/text_field/text_field.0_test.dart index d013fbf3e4..ebaa998e5c 100644 --- a/examples/api/test/material/text_field/text_field.0_test.dart +++ b/examples/api/test/material/text_field/text_field.0_test.dart @@ -8,7 +8,7 @@ import 'package:flutter_test/flutter_test.dart'; void main() { testWidgets('TextField is obscured and has "Password" as labelText', (WidgetTester tester) async { - await tester.pumpWidget(const example.MyApp()); + await tester.pumpWidget(const example.TextFieldExampleApp()); expect(find.byType(TextField), findsOneWidget); diff --git a/examples/api/test/material/toggle_buttons/toggle_buttons.0_test.dart b/examples/api/test/material/toggle_buttons/toggle_buttons.0_test.dart index d1d15e653a..e183031b41 100644 --- a/examples/api/test/material/toggle_buttons/toggle_buttons.0_test.dart +++ b/examples/api/test/material/toggle_buttons/toggle_buttons.0_test.dart @@ -15,7 +15,7 @@ void main() { await tester.pumpWidget( const MaterialApp( home: Scaffold( - body: example.MyApp(), + body: example.ToggleButtonsExampleApp(), ), ), ); @@ -50,7 +50,7 @@ void main() { await tester.pumpWidget( const MaterialApp( home: Scaffold( - body: example.MyApp(), + body: example.ToggleButtonsExampleApp(), ), ), ); @@ -86,7 +86,7 @@ void main() { await tester.pumpWidget( const MaterialApp( home: Scaffold( - body: example.MyApp(), + body: example.ToggleButtonsExampleApp(), ), ), ); diff --git a/examples/api/test/material/tooltip/tooltip.0_test.dart b/examples/api/test/material/tooltip/tooltip.0_test.dart index 316bafe46b..599b938751 100644 --- a/examples/api/test/material/tooltip/tooltip.0_test.dart +++ b/examples/api/test/material/tooltip/tooltip.0_test.dart @@ -12,7 +12,7 @@ void main() { const String tooltipText = 'I am a Tooltip'; await tester.pumpWidget( - const example.MyApp(), + const example.TooltipExampleApp(), ); TestGesture? gesture = await tester.createGesture(kind: PointerDeviceKind.mouse); diff --git a/examples/api/test/material/tooltip/tooltip.1_test.dart b/examples/api/test/material/tooltip/tooltip.1_test.dart index 6116f2c08f..f6894784f2 100644 --- a/examples/api/test/material/tooltip/tooltip.1_test.dart +++ b/examples/api/test/material/tooltip/tooltip.1_test.dart @@ -12,7 +12,7 @@ void main() { const String tooltipText = 'I am a Tooltip'; await tester.pumpWidget( - const example.MyApp(), + const example.TooltipExampleApp(), ); TestGesture? gesture = await tester.createGesture(kind: PointerDeviceKind.mouse); diff --git a/examples/api/test/material/tooltip/tooltip.2_test.dart b/examples/api/test/material/tooltip/tooltip.2_test.dart index 8aa1411df2..ba35b02320 100644 --- a/examples/api/test/material/tooltip/tooltip.2_test.dart +++ b/examples/api/test/material/tooltip/tooltip.2_test.dart @@ -12,7 +12,7 @@ void main() { const String tooltipText = 'I am a rich tooltip. I am another span of this rich tooltip'; await tester.pumpWidget( - const example.MyApp(), + const example.TooltipExampleApp(), ); TestGesture? gesture = await tester.createGesture(kind: PointerDeviceKind.mouse); diff --git a/examples/api/test/material/tooltip/tooltip.3_test.dart b/examples/api/test/material/tooltip/tooltip.3_test.dart index 24e528df69..7ef639bdeb 100644 --- a/examples/api/test/material/tooltip/tooltip.3_test.dart +++ b/examples/api/test/material/tooltip/tooltip.3_test.dart @@ -11,7 +11,7 @@ void main() { const String tooltipText = 'I am a Tooltip'; await tester.pumpWidget( - const example.MyApp(), + const example.TooltipExampleApp(), ); // Tooltip is not visible before tapping the button. diff --git a/examples/api/test/services/mouse_cursor/mouse_cursor.0_test.dart b/examples/api/test/services/mouse_cursor/mouse_cursor.0_test.dart index 5ed743d597..456bad45ad 100644 --- a/examples/api/test/services/mouse_cursor/mouse_cursor.0_test.dart +++ b/examples/api/test/services/mouse_cursor/mouse_cursor.0_test.dart @@ -9,7 +9,7 @@ import 'package:flutter_test/flutter_test.dart'; void main() { testWidgets('Uses Text Cursor', (WidgetTester tester) async { await tester.pumpWidget( - const example.MyApp(), + const example.MouseCursorExampleApp(), ); expect(find.byType(MouseRegion), findsNWidgets(2)); // There's one in the MaterialApp diff --git a/examples/api/test/services/text_input/text_input_control.0_test.dart b/examples/api/test/services/text_input/text_input_control.0_test.dart index da933c8404..0f162389da 100644 --- a/examples/api/test/services/text_input/text_input_control.0_test.dart +++ b/examples/api/test/services/text_input/text_input_control.0_test.dart @@ -10,7 +10,7 @@ import 'package:flutter_test/flutter_test.dart'; void main() { testWidgets('Enter text using the VKB', (WidgetTester tester) async { - await tester.pumpWidget(const example.MyApp()); + await tester.pumpWidget(const example.TextInputControlExampleApp()); await tester.pumpAndSettle(); await tester.tap(find.descendant( diff --git a/examples/api/test/widgets/app/widgets_app.widgets_app.0_test.dart b/examples/api/test/widgets/app/widgets_app.widgets_app.0_test.dart index 603e88f83f..6412fc14b4 100644 --- a/examples/api/test/widgets/app/widgets_app.widgets_app.0_test.dart +++ b/examples/api/test/widgets/app/widgets_app.widgets_app.0_test.dart @@ -8,7 +8,7 @@ import 'package:flutter_test/flutter_test.dart'; void main() { testWidgets('WidgetsApp test', (WidgetTester tester) async { await tester.pumpWidget( - const example.MyApp(), + const example.WidgetsAppExampleApp(), ); expect(find.text('Hello World'), findsOneWidget); diff --git a/examples/api/test/widgets/binding/widget_binding_observer.0_test.dart b/examples/api/test/widgets/binding/widget_binding_observer.0_test.dart index 759463f348..f3f7764d40 100644 --- a/examples/api/test/widgets/binding/widget_binding_observer.0_test.dart +++ b/examples/api/test/widgets/binding/widget_binding_observer.0_test.dart @@ -18,7 +18,7 @@ void main() { } await tester.pumpWidget( - const example.MyApp(), + const example.WidgetBindingObserverExampleApp(), ); expect(find.text('There are no AppLifecycleStates to show.'), findsOneWidget); diff --git a/examples/api/test/widgets/layout_builder/layout_builder.0_test.dart b/examples/api/test/widgets/layout_builder/layout_builder.0_test.dart index 51c0ac6af8..c2c954ba56 100644 --- a/examples/api/test/widgets/layout_builder/layout_builder.0_test.dart +++ b/examples/api/test/widgets/layout_builder/layout_builder.0_test.dart @@ -9,7 +9,7 @@ import 'package:flutter_test/flutter_test.dart'; void main() { testWidgets('has two containers when wide', (WidgetTester tester) async { await tester.pumpWidget( - const example.MyApp(), + const example.LayoutBuilderExampleApp(), ); final Finder containerFinder = find.byType(Container); @@ -19,7 +19,7 @@ void main() { await tester.pumpWidget( ConstrainedBox( constraints: const BoxConstraints(maxWidth: 400), - child: const example.MyApp(), + child: const example.LayoutBuilderExampleApp(), ), ); diff --git a/examples/api/test/widgets/magnifier/magnifier.0_test.dart b/examples/api/test/widgets/magnifier/magnifier.0_test.dart index b488b31655..75702af3da 100644 --- a/examples/api/test/widgets/magnifier/magnifier.0_test.dart +++ b/examples/api/test/widgets/magnifier/magnifier.0_test.dart @@ -9,7 +9,7 @@ import 'package:flutter_test/flutter_test.dart'; void main() { testWidgets('should update magnifier position on drag', (WidgetTester tester) async { - await tester.pumpWidget(const example.MyApp()); + await tester.pumpWidget(const example.MagnifierExampleApp()); Matcher isPositionedAt(Offset at) { return isA().having( @@ -40,7 +40,7 @@ void main() { }); testWidgets('should match golden', (WidgetTester tester) async { - await tester.pumpWidget(const example.MyApp()); + await tester.pumpWidget(const example.MagnifierExampleApp()); final Offset centerOfFlutterLogo = tester.getCenter(find.byType(Positioned)); const Offset dragDistance = Offset(10, 10); diff --git a/examples/api/test/widgets/overlay/overlay_portal.0_test.dart b/examples/api/test/widgets/overlay/overlay_portal.0_test.dart index 4a79cdfec3..2f104aff30 100644 --- a/examples/api/test/widgets/overlay/overlay_portal.0_test.dart +++ b/examples/api/test/widgets/overlay/overlay_portal.0_test.dart @@ -9,7 +9,7 @@ import 'package:flutter_test/flutter_test.dart'; void main() { const String tooltipText = 'tooltip'; testWidgets('Tooltip is shown on press', (WidgetTester tester) async { - await tester.pumpWidget(const example.MyApp()); + await tester.pumpWidget(const example.OverlayPortalExampleApp()); expect(find.text(tooltipText), findsNothing); await tester.tap(find.byType(example.ClickableTooltipWidget)); @@ -22,11 +22,11 @@ void main() { }); testWidgets('Tooltip is shown at the right location', (WidgetTester tester) async { - await tester.pumpWidget(const example.MyApp()); + await tester.pumpWidget(const example.OverlayPortalExampleApp()); await tester.tap(find.byType(example.ClickableTooltipWidget)); await tester.pump(); - final Size canvasSize = tester.getSize(find.byType(example.MyApp)); + final Size canvasSize = tester.getSize(find.byType(example.OverlayPortalExampleApp)); expect( tester.getBottomRight(find.text(tooltipText)), canvasSize - const Size(50, 50), @@ -34,7 +34,7 @@ void main() { }); testWidgets('Tooltip is shown with the right font size', (WidgetTester tester) async { - await tester.pumpWidget(const example.MyApp()); + await tester.pumpWidget(const example.OverlayPortalExampleApp()); await tester.tap(find.byType(example.ClickableTooltipWidget)); await tester.pump(); diff --git a/examples/api/test/widgets/scrollview/listview_select_test.1.dart b/examples/api/test/widgets/scroll_view/list_view.0_test.dart similarity index 92% rename from examples/api/test/widgets/scrollview/listview_select_test.1.dart rename to examples/api/test/widgets/scroll_view/list_view.0_test.dart index 11087ceb97..1515492e56 100644 --- a/examples/api/test/widgets/scrollview/listview_select_test.1.dart +++ b/examples/api/test/widgets/scroll_view/list_view.0_test.dart @@ -3,7 +3,7 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/widgets/scroll_view/listview_select.1.dart' +import 'package:flutter_api_samples/widgets/scroll_view/list_view.0.dart' as example; import 'package:flutter_test/flutter_test.dart'; @@ -11,7 +11,7 @@ void main() { testWidgets('long press ListTile should enable edit mode', (WidgetTester tester) async { await tester.pumpWidget( - const example.MyApp(), + const example.ListViewExampleApp(), ); final Finder listView = find.byType(ListView); @@ -29,7 +29,7 @@ void main() { testWidgets('Pressing cross button should disable edit mode', (WidgetTester tester) async { await tester.pumpWidget( - const example.MyApp(), + const example.ListViewExampleApp(), ); final Finder listView = find.byType(ListView); @@ -52,7 +52,7 @@ void main() { testWidgets('tapping ListTile or checkBox should toggle ListTile state', (WidgetTester tester) async { await tester.pumpWidget( - const example.MyApp(), + const example.ListViewExampleApp(), ); final Finder listView = find.byType(ListView); diff --git a/examples/api/test/widgets/sliver/sliver_opacity.1_test.dart b/examples/api/test/widgets/sliver/sliver_opacity.1_test.dart index 08ea90697c..3c72f5ef3d 100644 --- a/examples/api/test/widgets/sliver/sliver_opacity.1_test.dart +++ b/examples/api/test/widgets/sliver/sliver_opacity.1_test.dart @@ -10,7 +10,7 @@ import 'package:flutter_test/flutter_test.dart'; void main() { testWidgets('SliverOpacity example', (WidgetTester tester) async { await tester.pumpWidget( - const example.MyApp(), + const example.SliverOpacityExampleApp(), ); final Finder button = find.byType(FloatingActionButton); diff --git a/examples/api/test/widgets/text_magnifier/text_magnifier.0_test.dart b/examples/api/test/widgets/text_magnifier/text_magnifier.0_test.dart index c7c9a54a83..9d94d9373b 100644 --- a/examples/api/test/widgets/text_magnifier/text_magnifier.0_test.dart +++ b/examples/api/test/widgets/text_magnifier/text_magnifier.0_test.dart @@ -84,13 +84,13 @@ void main() { } testWidgets('should show custom magnifier on drag', (WidgetTester tester) async { - await tester.pumpWidget(const example.MyApp(text: defaultText)); + await tester.pumpWidget(const example.TextMagnifierExampleApp(text: defaultText)); await showMagnifier(tester, 'e'); expect(find.byType(example.CustomMagnifier), findsOneWidget); await expectLater( - find.byType(example.MyApp), + find.byType(example.TextMagnifierExampleApp), matchesGoldenFile('text_magnifier.0_test.png'), ); }, variant: const TargetPlatformVariant({ TargetPlatform.iOS, TargetPlatform.android })); @@ -101,7 +101,7 @@ void main() { final String text = textDirection == TextDirection.rtl ? 'أثارت زر' : defaultText; final String textToTapOn = textDirection == TextDirection.rtl ? 'ت' : 'e'; - await tester.pumpWidget(example.MyApp(textDirection: textDirection, text: text)); + await tester.pumpWidget(example.TextMagnifierExampleApp(textDirection: textDirection, text: text)); await showMagnifier(tester, textToTapOn); diff --git a/examples/api/test/widgets/will_pop_scope/will_pop_scope.0_test.dart b/examples/api/test/widgets/will_pop_scope/will_pop_scope.0_test.dart index 1a0720df6d..ad05943108 100644 --- a/examples/api/test/widgets/will_pop_scope/will_pop_scope.0_test.dart +++ b/examples/api/test/widgets/will_pop_scope/will_pop_scope.0_test.dart @@ -8,7 +8,7 @@ import 'package:flutter_test/flutter_test.dart'; void main() { testWidgets('pressing shouldPop button changes shouldPop', (WidgetTester tester) async { await tester.pumpWidget( - const example.MyApp(), + const example.WillPopScopeExampleApp(), ); final Finder buttonFinder = find.text('shouldPop: true'); @@ -19,14 +19,14 @@ void main() { }); testWidgets('pressing Push button pushes route', (WidgetTester tester) async { await tester.pumpWidget( - const example.MyApp(), + const example.WillPopScopeExampleApp(), ); final Finder buttonFinder = find.text('Push'); expect(buttonFinder, findsOneWidget); - expect(find.byType(example.MyStatefulWidget), findsOneWidget); + expect(find.byType(example.WillPopScopeExample), findsOneWidget); await tester.tap(buttonFinder); await tester.pumpAndSettle(); - expect(find.byType(example.MyStatefulWidget, skipOffstage: false), findsNWidgets(2)); + expect(find.byType(example.WillPopScopeExample, skipOffstage: false), findsNWidgets(2)); }); } diff --git a/packages/flutter/lib/src/widgets/scroll_view.dart b/packages/flutter/lib/src/widgets/scroll_view.dart index 0e518cf42e..e95a53153a 100644 --- a/packages/flutter/lib/src/widgets/scroll_view.dart +++ b/packages/flutter/lib/src/widgets/scroll_view.dart @@ -1154,9 +1154,9 @@ abstract class BoxScrollView extends ScrollView { /// /// {@tool dartpad} /// This example shows a custom implementation of [ListTile] selection in a [ListView] or [GridView]. -/// Long press any ListTile to enable selection mode. +/// Long press any [ListTile] to enable selection mode. /// -/// ** See code in examples/api/lib/widgets/scroll_view/listview_select.1.dart ** +/// ** See code in examples/api/lib/widgets/scroll_view/list_view.0.dart ** /// {@end-tool} /// /// {@macro flutter.widgets.BoxScroll.scrollBehaviour} @@ -1803,7 +1803,7 @@ class ListView extends BoxScrollView { /// This example shows a custom implementation of [ListTile] selection in a [GridView] or [ListView]. /// Long press any ListTile to enable selection mode. /// -/// ** See code in examples/api/lib/widgets/scroll_view/listview_select.1.dart ** +/// ** See code in examples/api/lib/widgets/scroll_view/list_view.0.dart ** /// {@end-tool} /// /// See also: