├── .DS_Store ├── .gitignore ├── .vscode └── launch.json ├── LICENSE ├── README.md ├── example ├── .DS_Store ├── mobile │ ├── .gitignore │ ├── .metadata │ ├── README.md │ ├── android │ │ ├── app │ │ │ ├── build.gradle │ │ │ └── src │ │ │ │ ├── debug │ │ │ │ └── AndroidManifest.xml │ │ │ │ ├── main │ │ │ │ ├── AndroidManifest.xml │ │ │ │ ├── java │ │ │ │ │ └── com │ │ │ │ │ │ └── example │ │ │ │ │ │ └── mobile │ │ │ │ │ │ └── MainActivity.java │ │ │ │ └── res │ │ │ │ │ ├── drawable │ │ │ │ │ └── launch_background.xml │ │ │ │ │ ├── mipmap-hdpi │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ ├── mipmap-mdpi │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ ├── mipmap-xhdpi │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ ├── mipmap-xxhdpi │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ ├── mipmap-xxxhdpi │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ └── values │ │ │ │ │ └── styles.xml │ │ │ │ └── profile │ │ │ │ └── AndroidManifest.xml │ │ ├── build.gradle │ │ ├── gradle.properties │ │ ├── gradle │ │ │ └── wrapper │ │ │ │ └── gradle-wrapper.properties │ │ └── settings.gradle │ ├── ios │ │ ├── Flutter │ │ │ ├── AppFrameworkInfo.plist │ │ │ ├── Debug.xcconfig │ │ │ └── Release.xcconfig │ │ ├── Runner.xcodeproj │ │ │ ├── project.pbxproj │ │ │ ├── project.xcworkspace │ │ │ │ └── contents.xcworkspacedata │ │ │ └── xcshareddata │ │ │ │ └── xcschemes │ │ │ │ └── Runner.xcscheme │ │ ├── Runner.xcworkspace │ │ │ └── contents.xcworkspacedata │ │ └── Runner │ │ │ ├── AppDelegate.h │ │ │ ├── AppDelegate.m │ │ │ ├── Assets.xcassets │ │ │ ├── AppIcon.appiconset │ │ │ │ ├── Contents.json │ │ │ │ ├── Icon-App-1024x1024@1x.png │ │ │ │ ├── Icon-App-20x20@1x.png │ │ │ │ ├── Icon-App-20x20@2x.png │ │ │ │ ├── Icon-App-20x20@3x.png │ │ │ │ ├── Icon-App-29x29@1x.png │ │ │ │ ├── Icon-App-29x29@2x.png │ │ │ │ ├── Icon-App-29x29@3x.png │ │ │ │ ├── Icon-App-40x40@1x.png │ │ │ │ ├── Icon-App-40x40@2x.png │ │ │ │ ├── Icon-App-40x40@3x.png │ │ │ │ ├── Icon-App-60x60@2x.png │ │ │ │ ├── Icon-App-60x60@3x.png │ │ │ │ ├── Icon-App-76x76@1x.png │ │ │ │ ├── Icon-App-76x76@2x.png │ │ │ │ └── Icon-App-83.5x83.5@2x.png │ │ │ └── LaunchImage.imageset │ │ │ │ ├── Contents.json │ │ │ │ ├── LaunchImage.png │ │ │ │ ├── LaunchImage@2x.png │ │ │ │ ├── LaunchImage@3x.png │ │ │ │ └── README.md │ │ │ ├── Base.lproj │ │ │ ├── LaunchScreen.storyboard │ │ │ └── Main.storyboard │ │ │ ├── Info.plist │ │ │ └── main.m │ ├── lib │ │ └── main.dart │ └── pubspec.yaml ├── shared_ui │ ├── .gitignore │ ├── CHANGELOG.md │ ├── README.md │ ├── analysis_options.yaml │ ├── android │ │ ├── app │ │ │ └── src │ │ │ │ └── main │ │ │ │ └── java │ │ │ │ └── io │ │ │ │ └── flutter │ │ │ │ └── plugins │ │ │ │ └── GeneratedPluginRegistrant.java │ │ └── local.properties │ ├── ios │ │ ├── Flutter │ │ │ └── Generated.xcconfig │ │ └── Runner │ │ │ ├── GeneratedPluginRegistrant.h │ │ │ └── GeneratedPluginRegistrant.m │ ├── lib │ │ ├── home_page.dart │ │ └── main.dart │ └── pubspec.yaml └── webapp │ ├── .DS_Store │ ├── .gitignore │ ├── CHANGELOG.md │ ├── README.md │ ├── analysis_options.yaml │ ├── android │ └── app │ │ └── src │ │ └── main │ │ └── java │ │ └── io │ │ └── flutter │ │ └── plugins │ │ └── GeneratedPluginRegistrant.java │ ├── ios │ └── Runner │ │ ├── GeneratedPluginRegistrant.h │ │ └── GeneratedPluginRegistrant.m │ ├── pubspec.yaml │ └── web │ ├── index.html │ └── main.dart └── packages ├── flutter_cross ├── android │ └── app │ │ └── src │ │ └── main │ │ └── java │ │ └── io │ │ └── flutter │ │ └── plugins │ │ └── GeneratedPluginRegistrant.java ├── ios │ └── Runner │ │ ├── GeneratedPluginRegistrant.h │ │ └── GeneratedPluginRegistrant.m ├── lib │ ├── animation.dart │ ├── cupertino.dart │ ├── foundation.dart │ ├── gestures.dart │ ├── material.dart │ ├── painting.dart │ ├── physics.dart │ ├── rendering.dart │ ├── scheduler.dart │ ├── semantics.dart │ ├── services.dart │ ├── ui.dart │ └── widgets.dart └── pubspec.yaml ├── flutter_stub ├── .DS_Store ├── .gitignore ├── CHANGELOG.md ├── README.md ├── android │ ├── app │ │ └── src │ │ │ └── main │ │ │ └── java │ │ │ └── io │ │ │ └── flutter │ │ │ └── plugins │ │ │ └── GeneratedPluginRegistrant.java │ └── local.properties ├── ios │ ├── Flutter │ │ └── Generated.xcconfig │ └── Runner │ │ ├── GeneratedPluginRegistrant.h │ │ └── GeneratedPluginRegistrant.m ├── lib │ ├── .DS_Store │ ├── animation.dart │ ├── cupertino.dart │ ├── foundation.dart │ ├── gestures.dart │ ├── io.dart │ ├── material.dart │ ├── painting.dart │ ├── physics.dart │ ├── rendering.dart │ ├── scheduler.dart │ ├── semantics.dart │ ├── services.dart │ ├── src │ │ ├── animation │ │ │ ├── animation.dart │ │ │ ├── animation_controller.dart │ │ │ ├── animations.dart │ │ │ ├── curves.dart │ │ │ ├── listener_helpers.dart │ │ │ ├── tween.dart │ │ │ └── tween_sequence.dart │ │ ├── cupertino │ │ │ ├── action_sheet.dart │ │ │ ├── activity_indicator.dart │ │ │ ├── app.dart │ │ │ ├── button.dart │ │ │ ├── colors.dart │ │ │ ├── icons.dart │ │ │ ├── localizations.dart │ │ │ ├── nav_bar.dart │ │ │ ├── page_scaffold.dart │ │ │ ├── route.dart │ │ │ ├── scrollbar.dart │ │ │ ├── text_theme.dart │ │ │ └── theme.dart │ │ ├── foundation │ │ │ ├── assertions.dart │ │ │ ├── basic_types.dart │ │ │ ├── binding.dart │ │ │ ├── bitfield.dart │ │ │ ├── change_notifier.dart │ │ │ ├── collections.dart │ │ │ ├── constants.dart │ │ │ ├── debug.dart │ │ │ ├── diagnostics.dart │ │ │ ├── isolates.dart │ │ │ ├── key.dart │ │ │ ├── licenses.dart │ │ │ ├── node.dart │ │ │ ├── observer_list.dart │ │ │ ├── platform.dart │ │ │ ├── print.dart │ │ │ ├── profile.dart │ │ │ ├── serialization.dart │ │ │ ├── synchronous_future.dart │ │ │ └── unicode.dart │ │ ├── gestures │ │ │ ├── arena.dart │ │ │ ├── binding.dart │ │ │ ├── constants.dart │ │ │ ├── converter.dart │ │ │ ├── debug.dart │ │ │ ├── drag.dart │ │ │ ├── drag_details.dart │ │ │ ├── eager.dart │ │ │ ├── events.dart │ │ │ ├── force_press.dart │ │ │ ├── hit_test.dart │ │ │ ├── long_press.dart │ │ │ ├── lsq_solver.dart │ │ │ ├── monodrag.dart │ │ │ ├── mouse_tracking.dart │ │ │ ├── multidrag.dart │ │ │ ├── multitap.dart │ │ │ ├── pointer_router.dart │ │ │ ├── pointer_signal_resolver.dart │ │ │ ├── recognizer.dart │ │ │ ├── scale.dart │ │ │ ├── tap.dart │ │ │ ├── team.dart │ │ │ └── velocity_tracker.dart │ │ ├── material │ │ │ ├── about.dart │ │ │ ├── animated_icons.dart │ │ │ ├── animated_icons │ │ │ │ ├── animated_icons.dart │ │ │ │ ├── animated_icons_data.dart │ │ │ │ └── data │ │ │ │ │ ├── add_event.g.dart │ │ │ │ │ ├── arrow_menu.g.dart │ │ │ │ │ ├── close_menu.g.dart │ │ │ │ │ ├── ellipsis_search.g.dart │ │ │ │ │ ├── event_add.g.dart │ │ │ │ │ ├── home_menu.g.dart │ │ │ │ │ ├── list_view.g.dart │ │ │ │ │ ├── menu_arrow.g.dart │ │ │ │ │ ├── menu_close.g.dart │ │ │ │ │ ├── menu_home.g.dart │ │ │ │ │ ├── pause_play.g.dart │ │ │ │ │ ├── play_pause.g.dart │ │ │ │ │ ├── search_ellipsis.g.dart │ │ │ │ │ └── view_list.g.dart │ │ │ ├── app.dart │ │ │ ├── app_bar.dart │ │ │ ├── app_bar_theme.dart │ │ │ ├── arc.dart │ │ │ ├── back_button.dart │ │ │ ├── bottom_app_bar.dart │ │ │ ├── bottom_app_bar_theme.dart │ │ │ ├── bottom_navigation_bar.dart │ │ │ ├── bottom_sheet.dart │ │ │ ├── bottom_sheet_theme.dart │ │ │ ├── button.dart │ │ │ ├── button_bar.dart │ │ │ ├── button_theme.dart │ │ │ ├── card.dart │ │ │ ├── card_theme.dart │ │ │ ├── checkbox.dart │ │ │ ├── checkbox_list_tile.dart │ │ │ ├── chip.dart │ │ │ ├── chip_theme.dart │ │ │ ├── circle_avatar.dart │ │ │ ├── color_scheme.dart │ │ │ ├── colors.dart │ │ │ ├── constants.dart │ │ │ ├── data_table.dart │ │ │ ├── data_table_source.dart │ │ │ ├── date_picker.dart │ │ │ ├── debug.dart │ │ │ ├── dialog.dart │ │ │ ├── dialog_theme.dart │ │ │ ├── divider.dart │ │ │ ├── drawer.dart │ │ │ ├── drawer_header.dart │ │ │ ├── dropdown.dart │ │ │ ├── expand_icon.dart │ │ │ ├── expansion_panel.dart │ │ │ ├── expansion_tile.dart │ │ │ ├── feedback.dart │ │ │ ├── flat_button.dart │ │ │ ├── flexible_space_bar.dart │ │ │ ├── floating_action_button.dart │ │ │ ├── floating_action_button_location.dart │ │ │ ├── floating_action_button_theme.dart │ │ │ ├── flutter_logo.dart │ │ │ ├── grid_tile.dart │ │ │ ├── grid_tile_bar.dart │ │ │ ├── icon_button.dart │ │ │ ├── icons.dart │ │ │ ├── ink_decoration.dart │ │ │ ├── ink_highlight.dart │ │ │ ├── ink_ripple.dart │ │ │ ├── ink_splash.dart │ │ │ ├── ink_well.dart │ │ │ ├── input_border.dart │ │ │ ├── input_decorator.dart │ │ │ ├── list_tile.dart │ │ │ ├── material.dart │ │ │ ├── material_button.dart │ │ │ ├── material_localizations.dart │ │ │ ├── mergeable_material.dart │ │ │ ├── outline_button.dart │ │ │ ├── page.dart │ │ │ ├── page_transitions_theme.dart │ │ │ ├── paginated_data_table.dart │ │ │ ├── popup_menu.dart │ │ │ ├── progress_indicator.dart │ │ │ ├── radio.dart │ │ │ ├── radio_list_tile.dart │ │ │ ├── raised_button.dart │ │ │ ├── refresh_indicator.dart │ │ │ ├── reorderable_list.dart │ │ │ ├── scaffold.dart │ │ │ ├── scrollbar.dart │ │ │ ├── search.dart │ │ │ ├── shadows.dart │ │ │ ├── slider.dart │ │ │ ├── slider_theme.dart │ │ │ ├── snack_bar.dart │ │ │ ├── snack_bar_theme.dart │ │ │ ├── stepper.dart │ │ │ ├── switch.dart │ │ │ ├── switch_list_tile.dart │ │ │ ├── tab_bar_theme.dart │ │ │ ├── tab_controller.dart │ │ │ ├── tab_indicator.dart │ │ │ ├── tabs.dart │ │ │ ├── text_field.dart │ │ │ ├── text_form_field.dart │ │ │ ├── text_selection.dart │ │ │ ├── text_theme.dart │ │ │ ├── theme.dart │ │ │ ├── theme_data.dart │ │ │ ├── time.dart │ │ │ ├── time_picker.dart │ │ │ ├── toggleable.dart │ │ │ ├── tooltip.dart │ │ │ ├── two_level_list.dart │ │ │ ├── typography.dart │ │ │ └── user_accounts_drawer_header.dart │ │ ├── painting │ │ │ ├── alignment.dart │ │ │ ├── basic_types.dart │ │ │ ├── beveled_rectangle_border.dart │ │ │ ├── binding.dart │ │ │ ├── border_radius.dart │ │ │ ├── borders.dart │ │ │ ├── box_border.dart │ │ │ ├── box_decoration.dart │ │ │ ├── box_fit.dart │ │ │ ├── box_shadow.dart │ │ │ ├── circle_border.dart │ │ │ ├── clip.dart │ │ │ ├── colors.dart │ │ │ ├── debug.dart │ │ │ ├── decoration.dart │ │ │ ├── decoration_image.dart │ │ │ ├── edge_insets.dart │ │ │ ├── flutter_logo.dart │ │ │ ├── fractional_offset.dart │ │ │ ├── geometry.dart │ │ │ ├── gradient.dart │ │ │ ├── image_cache.dart │ │ │ ├── image_decoder.dart │ │ │ ├── image_provider.dart │ │ │ ├── image_resolution.dart │ │ │ ├── image_stream.dart │ │ │ ├── matrix_utils.dart │ │ │ ├── notched_shapes.dart │ │ │ ├── paint_utilities.dart │ │ │ ├── rounded_rectangle_border.dart │ │ │ ├── shape_decoration.dart │ │ │ ├── stadium_border.dart │ │ │ ├── strut_style.dart │ │ │ ├── text_painter.dart │ │ │ ├── text_span.dart │ │ │ └── text_style.dart │ │ ├── physics │ │ │ ├── clamped_simulation.dart │ │ │ ├── friction_simulation.dart │ │ │ ├── gravity_simulation.dart │ │ │ ├── simulation.dart │ │ │ ├── spring_simulation.dart │ │ │ ├── tolerance.dart │ │ │ └── utils.dart │ │ ├── rendering │ │ │ ├── animated_size.dart │ │ │ ├── binding.dart │ │ │ ├── box.dart │ │ │ ├── custom_layout.dart │ │ │ ├── custom_paint.dart │ │ │ ├── debug.dart │ │ │ ├── debug_overflow_indicator.dart │ │ │ ├── editable.dart │ │ │ ├── error.dart │ │ │ ├── flex.dart │ │ │ ├── flow.dart │ │ │ ├── image.dart │ │ │ ├── layer.dart │ │ │ ├── list_body.dart │ │ │ ├── list_wheel_viewport.dart │ │ │ ├── object.dart │ │ │ ├── paragraph.dart │ │ │ ├── performance_overlay.dart │ │ │ ├── platform_view.dart │ │ │ ├── proxy_box.dart │ │ │ ├── rotated_box.dart │ │ │ ├── shifted_box.dart │ │ │ ├── sliver.dart │ │ │ ├── sliver_fill.dart │ │ │ ├── sliver_fixed_extent_list.dart │ │ │ ├── sliver_grid.dart │ │ │ ├── sliver_list.dart │ │ │ ├── sliver_multi_box_adaptor.dart │ │ │ ├── sliver_padding.dart │ │ │ ├── sliver_persistent_header.dart │ │ │ ├── stack.dart │ │ │ ├── table.dart │ │ │ ├── table_border.dart │ │ │ ├── tweens.dart │ │ │ ├── view.dart │ │ │ ├── viewport.dart │ │ │ ├── viewport_offset.dart │ │ │ └── wrap.dart │ │ ├── scheduler │ │ │ ├── binding.dart │ │ │ ├── debug.dart │ │ │ ├── priority.dart │ │ │ └── ticker.dart │ │ ├── semantics │ │ │ ├── binding.dart │ │ │ ├── debug.dart │ │ │ ├── semantics.dart │ │ │ ├── semantics_event.dart │ │ │ └── semantics_service.dart │ │ ├── services │ │ │ ├── asset_bundle.dart │ │ │ ├── binding.dart │ │ │ ├── clipboard.dart │ │ │ ├── haptic_feedback.dart │ │ │ ├── keyboard_key.dart │ │ │ ├── keyboard_maps.dart │ │ │ ├── message_codec.dart │ │ │ ├── message_codecs.dart │ │ │ ├── platform_channel.dart │ │ │ ├── platform_messages.dart │ │ │ ├── platform_views.dart │ │ │ ├── raw_keyboard.dart │ │ │ ├── raw_keyboard_android.dart │ │ │ ├── raw_keyboard_fuchsia.dart │ │ │ ├── raw_keyboard_linux.dart │ │ │ ├── raw_keyboard_macos.dart │ │ │ ├── system_channels.dart │ │ │ ├── system_chrome.dart │ │ │ ├── system_navigator.dart │ │ │ ├── system_sound.dart │ │ │ ├── text_editing.dart │ │ │ ├── text_formatter.dart │ │ │ └── text_input.dart │ │ ├── util.dart │ │ └── widgets │ │ │ ├── animated_cross_fade.dart │ │ │ ├── animated_list.dart │ │ │ ├── animated_size.dart │ │ │ ├── animated_switcher.dart │ │ │ ├── annotated_region.dart │ │ │ ├── app.dart │ │ │ ├── async.dart │ │ │ ├── automatic_keep_alive.dart │ │ │ ├── banner.dart │ │ │ ├── basic.dart │ │ │ ├── binding.dart │ │ │ ├── bottom_navigation_bar_item.dart │ │ │ ├── container.dart │ │ │ ├── debug.dart │ │ │ ├── dismissible.dart │ │ │ ├── drag_target.dart │ │ │ ├── editable_text.dart │ │ │ ├── fade_in_image.dart │ │ │ ├── focus_manager.dart │ │ │ ├── focus_scope.dart │ │ │ ├── focus_traversal.dart │ │ │ ├── form.dart │ │ │ ├── framework.dart │ │ │ ├── gesture_detector.dart │ │ │ ├── grid_paper.dart │ │ │ ├── heroes.dart │ │ │ ├── icon.dart │ │ │ ├── icon_data.dart │ │ │ ├── icon_theme.dart │ │ │ ├── icon_theme_data.dart │ │ │ ├── image.dart │ │ │ ├── image_icon.dart │ │ │ ├── implicit_animations.dart │ │ │ ├── inherited_model.dart │ │ │ ├── inherited_notifier.dart │ │ │ ├── layout_builder.dart │ │ │ ├── list_wheel_scroll_view.dart │ │ │ ├── localizations.dart │ │ │ ├── media_query.dart │ │ │ ├── modal_barrier.dart │ │ │ ├── navigation_toolbar.dart │ │ │ ├── navigator.dart │ │ │ ├── nested_scroll_view.dart │ │ │ ├── notification_listener.dart │ │ │ ├── orientation_builder.dart │ │ │ ├── overlay.dart │ │ │ ├── overscroll_indicator.dart │ │ │ ├── page_storage.dart │ │ │ ├── page_view.dart │ │ │ ├── pages.dart │ │ │ ├── performance_overlay.dart │ │ │ ├── placeholder.dart │ │ │ ├── platform_view.dart │ │ │ ├── preferred_size.dart │ │ │ ├── primary_scroll_controller.dart │ │ │ ├── raw_keyboard_listener.dart │ │ │ ├── routes.dart │ │ │ ├── safe_area.dart │ │ │ ├── scroll_activity.dart │ │ │ ├── scroll_configuration.dart │ │ │ ├── scroll_context.dart │ │ │ ├── scroll_controller.dart │ │ │ ├── scroll_metrics.dart │ │ │ ├── scroll_notification.dart │ │ │ ├── scroll_physics.dart │ │ │ ├── scroll_position.dart │ │ │ ├── scroll_position_with_single_context.dart │ │ │ ├── scroll_simulation.dart │ │ │ ├── scroll_view.dart │ │ │ ├── scrollable.dart │ │ │ ├── scrollbar.dart │ │ │ ├── semantics_debugger.dart │ │ │ ├── single_child_scroll_view.dart │ │ │ ├── size_changed_layout_notifier.dart │ │ │ ├── sliver.dart │ │ │ ├── sliver_persistent_header.dart │ │ │ ├── sliver_prototype_extent_list.dart │ │ │ ├── spacer.dart │ │ │ ├── status_transitions.dart │ │ │ ├── table.dart │ │ │ ├── text.dart │ │ │ ├── text_selection.dart │ │ │ ├── ticker_provider.dart │ │ │ ├── title.dart │ │ │ ├── transitions.dart │ │ │ ├── unique_widget.dart │ │ │ ├── value_listenable_builder.dart │ │ │ ├── viewport.dart │ │ │ ├── visibility.dart │ │ │ ├── web_navigator.dart │ │ │ ├── widget_inspector.dart │ │ │ └── will_pop_scope.dart │ └── widgets.dart └── pubspec.yaml ├── flutter_stub_ui ├── .DS_Store ├── lib │ ├── src │ │ └── ui │ │ │ ├── canvas.dart │ │ │ ├── compositing.dart │ │ │ ├── geometry.dart │ │ │ ├── hash_codes.dart │ │ │ ├── lerp.dart │ │ │ ├── natives.dart │ │ │ ├── painting.dart │ │ │ ├── pointer.dart │ │ │ ├── semantics.dart │ │ │ ├── test_embedding.dart │ │ │ ├── text.dart │ │ │ ├── tile_mode.dart │ │ │ └── window.dart │ └── ui.dart └── pubspec.yaml └── provider_cross ├── .gitignore ├── CHANGELOG.md ├── LICENSE ├── README.md ├── lib ├── provider.dart └── src │ ├── async_provider.dart │ ├── change_notifier_provider.dart │ ├── consumer.dart │ ├── delegate_widget.dart │ ├── listenable_provider.dart │ ├── provider.dart │ ├── provider_cross.dart │ ├── proxy_provider.dart │ └── value_listenable_provider.dart └── pubspec.yaml /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aloisdeniel/flutter_shared_ui_poc/a8edd9005707ef1fd76ef1f2acf97355b8dd3777/.DS_Store -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # See https://www.dartlang.org/guides/libraries/private-files 2 | 3 | # Files and directories created by pub 4 | .dart_tool/ 5 | .packages 6 | .pub/ 7 | build/ 8 | # If you're building an application, you may want to check-in your pubspec.lock 9 | pubspec.lock 10 | 11 | # Directory created by dartdoc 12 | # If you don't generate documentation locally you can remove this line. 13 | doc/api/ 14 | -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // Use IntelliSense to learn about possible attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | "version": "0.2.0", 6 | "configurations": [ 7 | { 8 | "name": "Mobile", 9 | "program": "example/mobile/lib/main.dart", 10 | "request": "launch", 11 | "type": "dart" 12 | }, 13 | ] 14 | } -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Aloïs Deniel 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /example/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aloisdeniel/flutter_shared_ui_poc/a8edd9005707ef1fd76ef1f2acf97355b8dd3777/example/.DS_Store -------------------------------------------------------------------------------- /example/mobile/.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | 12 | # IntelliJ related 13 | *.iml 14 | *.ipr 15 | *.iws 16 | .idea/ 17 | 18 | # Visual Studio Code related 19 | .vscode/ 20 | 21 | # Flutter/Dart/Pub related 22 | **/doc/api/ 23 | .dart_tool/ 24 | .flutter-plugins 25 | .packages 26 | .pub-cache/ 27 | .pub/ 28 | /build/ 29 | 30 | # Android related 31 | **/android/**/gradle-wrapper.jar 32 | **/android/.gradle 33 | **/android/captures/ 34 | **/android/gradlew 35 | **/android/gradlew.bat 36 | **/android/local.properties 37 | **/android/**/GeneratedPluginRegistrant.java 38 | 39 | # iOS/XCode related 40 | **/ios/**/*.mode1v3 41 | **/ios/**/*.mode2v3 42 | **/ios/**/*.moved-aside 43 | **/ios/**/*.pbxuser 44 | **/ios/**/*.perspectivev3 45 | **/ios/**/*sync/ 46 | **/ios/**/.sconsign.dblite 47 | **/ios/**/.tags* 48 | **/ios/**/.vagrant/ 49 | **/ios/**/DerivedData/ 50 | **/ios/**/Icon? 51 | **/ios/**/Pods/ 52 | **/ios/**/.symlinks/ 53 | **/ios/**/profile 54 | **/ios/**/xcuserdata 55 | **/ios/.generated/ 56 | **/ios/Flutter/App.framework 57 | **/ios/Flutter/Flutter.framework 58 | **/ios/Flutter/Generated.xcconfig 59 | **/ios/Flutter/app.flx 60 | **/ios/Flutter/app.zip 61 | **/ios/Flutter/flutter_assets/ 62 | **/ios/ServiceDefinitions.json 63 | **/ios/Runner/GeneratedPluginRegistrant.* 64 | 65 | # Exceptions to above rules. 66 | !**/ios/**/default.mode1v3 67 | !**/ios/**/default.mode2v3 68 | !**/ios/**/default.pbxuser 69 | !**/ios/**/default.perspectivev3 70 | !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages 71 | -------------------------------------------------------------------------------- /example/mobile/.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled and should not be manually edited. 5 | 6 | version: 7 | revision: 7a4c33425ddd78c54aba07d86f3f9a4a0051769b 8 | channel: stable 9 | 10 | project_type: app 11 | -------------------------------------------------------------------------------- /example/mobile/README.md: -------------------------------------------------------------------------------- 1 | # mobile 2 | 3 | A new Flutter project. 4 | 5 | ## Getting Started 6 | 7 | This project is a starting point for a Flutter application. 8 | 9 | A few resources to get you started if this is your first Flutter project: 10 | 11 | - [Lab: Write your first Flutter app](https://flutter.dev/docs/get-started/codelab) 12 | - [Cookbook: Useful Flutter samples](https://flutter.dev/docs/cookbook) 13 | 14 | For help getting started with Flutter, view our 15 | [online documentation](https://flutter.dev/docs), which offers tutorials, 16 | samples, guidance on mobile development, and a full API reference. 17 | -------------------------------------------------------------------------------- /example/mobile/android/app/build.gradle: -------------------------------------------------------------------------------- 1 | def localProperties = new Properties() 2 | def localPropertiesFile = rootProject.file('local.properties') 3 | if (localPropertiesFile.exists()) { 4 | localPropertiesFile.withReader('UTF-8') { reader -> 5 | localProperties.load(reader) 6 | } 7 | } 8 | 9 | def flutterRoot = localProperties.getProperty('flutter.sdk') 10 | if (flutterRoot == null) { 11 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") 12 | } 13 | 14 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode') 15 | if (flutterVersionCode == null) { 16 | flutterVersionCode = '1' 17 | } 18 | 19 | def flutterVersionName = localProperties.getProperty('flutter.versionName') 20 | if (flutterVersionName == null) { 21 | flutterVersionName = '1.0' 22 | } 23 | 24 | apply plugin: 'com.android.application' 25 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" 26 | 27 | android { 28 | compileSdkVersion 28 29 | 30 | lintOptions { 31 | disable 'InvalidPackage' 32 | } 33 | 34 | defaultConfig { 35 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 36 | applicationId "com.example.mobile" 37 | minSdkVersion 16 38 | targetSdkVersion 28 39 | versionCode flutterVersionCode.toInteger() 40 | versionName flutterVersionName 41 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 42 | } 43 | 44 | buildTypes { 45 | release { 46 | // TODO: Add your own signing config for the release build. 47 | // Signing with the debug keys for now, so `flutter run --release` works. 48 | signingConfig signingConfigs.debug 49 | } 50 | } 51 | } 52 | 53 | flutter { 54 | source '../..' 55 | } 56 | 57 | dependencies { 58 | testImplementation 'junit:junit:4.12' 59 | androidTestImplementation 'com.android.support.test:runner:1.0.2' 60 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' 61 | } 62 | -------------------------------------------------------------------------------- /example/mobile/android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/mobile/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 9 | 13 | 20 | 24 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /example/mobile/android/app/src/main/java/com/example/mobile/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.example.mobile; 2 | 3 | import android.os.Bundle; 4 | import io.flutter.app.FlutterActivity; 5 | import io.flutter.plugins.GeneratedPluginRegistrant; 6 | 7 | public class MainActivity extends FlutterActivity { 8 | @Override 9 | protected void onCreate(Bundle savedInstanceState) { 10 | super.onCreate(savedInstanceState); 11 | GeneratedPluginRegistrant.registerWith(this); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /example/mobile/android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /example/mobile/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aloisdeniel/flutter_shared_ui_poc/a8edd9005707ef1fd76ef1f2acf97355b8dd3777/example/mobile/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/mobile/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aloisdeniel/flutter_shared_ui_poc/a8edd9005707ef1fd76ef1f2acf97355b8dd3777/example/mobile/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/mobile/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aloisdeniel/flutter_shared_ui_poc/a8edd9005707ef1fd76ef1f2acf97355b8dd3777/example/mobile/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/mobile/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aloisdeniel/flutter_shared_ui_poc/a8edd9005707ef1fd76ef1f2acf97355b8dd3777/example/mobile/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/mobile/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aloisdeniel/flutter_shared_ui_poc/a8edd9005707ef1fd76ef1f2acf97355b8dd3777/example/mobile/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/mobile/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | -------------------------------------------------------------------------------- /example/mobile/android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/mobile/android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | repositories { 3 | google() 4 | jcenter() 5 | } 6 | 7 | dependencies { 8 | classpath 'com.android.tools.build:gradle:3.2.1' 9 | } 10 | } 11 | 12 | allprojects { 13 | repositories { 14 | google() 15 | jcenter() 16 | } 17 | } 18 | 19 | rootProject.buildDir = '../build' 20 | subprojects { 21 | project.buildDir = "${rootProject.buildDir}/${project.name}" 22 | } 23 | subprojects { 24 | project.evaluationDependsOn(':app') 25 | } 26 | 27 | task clean(type: Delete) { 28 | delete rootProject.buildDir 29 | } 30 | -------------------------------------------------------------------------------- /example/mobile/android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | -------------------------------------------------------------------------------- /example/mobile/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Fri Jun 23 08:50:38 CEST 2017 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip 7 | -------------------------------------------------------------------------------- /example/mobile/android/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | 3 | def flutterProjectRoot = rootProject.projectDir.parentFile.toPath() 4 | 5 | def plugins = new Properties() 6 | def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins') 7 | if (pluginsFile.exists()) { 8 | pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) } 9 | } 10 | 11 | plugins.each { name, path -> 12 | def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile() 13 | include ":$name" 14 | project(":$name").projectDir = pluginDirectory 15 | } 16 | -------------------------------------------------------------------------------- /example/mobile/ios/Flutter/AppFrameworkInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | App 9 | CFBundleIdentifier 10 | io.flutter.flutter.app 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | App 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1.0 23 | MinimumOSVersion 24 | 8.0 25 | 26 | 27 | -------------------------------------------------------------------------------- /example/mobile/ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /example/mobile/ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /example/mobile/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/mobile/ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/mobile/ios/Runner/AppDelegate.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | @interface AppDelegate : FlutterAppDelegate 5 | 6 | @end 7 | -------------------------------------------------------------------------------- /example/mobile/ios/Runner/AppDelegate.m: -------------------------------------------------------------------------------- 1 | #include "AppDelegate.h" 2 | #include "GeneratedPluginRegistrant.h" 3 | 4 | @implementation AppDelegate 5 | 6 | - (BOOL)application:(UIApplication *)application 7 | didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 8 | [GeneratedPluginRegistrant registerWithRegistry:self]; 9 | // Override point for customization after application launch. 10 | return [super application:application didFinishLaunchingWithOptions:launchOptions]; 11 | } 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /example/mobile/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "20x20", 5 | "idiom" : "iphone", 6 | "filename" : "Icon-App-20x20@2x.png", 7 | "scale" : "2x" 8 | }, 9 | { 10 | "size" : "20x20", 11 | "idiom" : "iphone", 12 | "filename" : "Icon-App-20x20@3x.png", 13 | "scale" : "3x" 14 | }, 15 | { 16 | "size" : "29x29", 17 | "idiom" : "iphone", 18 | "filename" : "Icon-App-29x29@1x.png", 19 | "scale" : "1x" 20 | }, 21 | { 22 | "size" : "29x29", 23 | "idiom" : "iphone", 24 | "filename" : "Icon-App-29x29@2x.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "29x29", 29 | "idiom" : "iphone", 30 | "filename" : "Icon-App-29x29@3x.png", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "size" : "40x40", 35 | "idiom" : "iphone", 36 | "filename" : "Icon-App-40x40@2x.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "40x40", 41 | "idiom" : "iphone", 42 | "filename" : "Icon-App-40x40@3x.png", 43 | "scale" : "3x" 44 | }, 45 | { 46 | "size" : "60x60", 47 | "idiom" : "iphone", 48 | "filename" : "Icon-App-60x60@2x.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "60x60", 53 | "idiom" : "iphone", 54 | "filename" : "Icon-App-60x60@3x.png", 55 | "scale" : "3x" 56 | }, 57 | { 58 | "size" : "20x20", 59 | "idiom" : "ipad", 60 | "filename" : "Icon-App-20x20@1x.png", 61 | "scale" : "1x" 62 | }, 63 | { 64 | "size" : "20x20", 65 | "idiom" : "ipad", 66 | "filename" : "Icon-App-20x20@2x.png", 67 | "scale" : "2x" 68 | }, 69 | { 70 | "size" : "29x29", 71 | "idiom" : "ipad", 72 | "filename" : "Icon-App-29x29@1x.png", 73 | "scale" : "1x" 74 | }, 75 | { 76 | "size" : "29x29", 77 | "idiom" : "ipad", 78 | "filename" : "Icon-App-29x29@2x.png", 79 | "scale" : "2x" 80 | }, 81 | { 82 | "size" : "40x40", 83 | "idiom" : "ipad", 84 | "filename" : "Icon-App-40x40@1x.png", 85 | "scale" : "1x" 86 | }, 87 | { 88 | "size" : "40x40", 89 | "idiom" : "ipad", 90 | "filename" : "Icon-App-40x40@2x.png", 91 | "scale" : "2x" 92 | }, 93 | { 94 | "size" : "76x76", 95 | "idiom" : "ipad", 96 | "filename" : "Icon-App-76x76@1x.png", 97 | "scale" : "1x" 98 | }, 99 | { 100 | "size" : "76x76", 101 | "idiom" : "ipad", 102 | "filename" : "Icon-App-76x76@2x.png", 103 | "scale" : "2x" 104 | }, 105 | { 106 | "size" : "83.5x83.5", 107 | "idiom" : "ipad", 108 | "filename" : "Icon-App-83.5x83.5@2x.png", 109 | "scale" : "2x" 110 | }, 111 | { 112 | "size" : "1024x1024", 113 | "idiom" : "ios-marketing", 114 | "filename" : "Icon-App-1024x1024@1x.png", 115 | "scale" : "1x" 116 | } 117 | ], 118 | "info" : { 119 | "version" : 1, 120 | "author" : "xcode" 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /example/mobile/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aloisdeniel/flutter_shared_ui_poc/a8edd9005707ef1fd76ef1f2acf97355b8dd3777/example/mobile/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png -------------------------------------------------------------------------------- /example/mobile/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aloisdeniel/flutter_shared_ui_poc/a8edd9005707ef1fd76ef1f2acf97355b8dd3777/example/mobile/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png -------------------------------------------------------------------------------- /example/mobile/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aloisdeniel/flutter_shared_ui_poc/a8edd9005707ef1fd76ef1f2acf97355b8dd3777/example/mobile/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png -------------------------------------------------------------------------------- /example/mobile/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aloisdeniel/flutter_shared_ui_poc/a8edd9005707ef1fd76ef1f2acf97355b8dd3777/example/mobile/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png -------------------------------------------------------------------------------- /example/mobile/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aloisdeniel/flutter_shared_ui_poc/a8edd9005707ef1fd76ef1f2acf97355b8dd3777/example/mobile/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png -------------------------------------------------------------------------------- /example/mobile/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aloisdeniel/flutter_shared_ui_poc/a8edd9005707ef1fd76ef1f2acf97355b8dd3777/example/mobile/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png -------------------------------------------------------------------------------- /example/mobile/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aloisdeniel/flutter_shared_ui_poc/a8edd9005707ef1fd76ef1f2acf97355b8dd3777/example/mobile/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png -------------------------------------------------------------------------------- /example/mobile/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aloisdeniel/flutter_shared_ui_poc/a8edd9005707ef1fd76ef1f2acf97355b8dd3777/example/mobile/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png -------------------------------------------------------------------------------- /example/mobile/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aloisdeniel/flutter_shared_ui_poc/a8edd9005707ef1fd76ef1f2acf97355b8dd3777/example/mobile/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png -------------------------------------------------------------------------------- /example/mobile/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aloisdeniel/flutter_shared_ui_poc/a8edd9005707ef1fd76ef1f2acf97355b8dd3777/example/mobile/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png -------------------------------------------------------------------------------- /example/mobile/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aloisdeniel/flutter_shared_ui_poc/a8edd9005707ef1fd76ef1f2acf97355b8dd3777/example/mobile/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png -------------------------------------------------------------------------------- /example/mobile/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aloisdeniel/flutter_shared_ui_poc/a8edd9005707ef1fd76ef1f2acf97355b8dd3777/example/mobile/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png -------------------------------------------------------------------------------- /example/mobile/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aloisdeniel/flutter_shared_ui_poc/a8edd9005707ef1fd76ef1f2acf97355b8dd3777/example/mobile/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png -------------------------------------------------------------------------------- /example/mobile/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aloisdeniel/flutter_shared_ui_poc/a8edd9005707ef1fd76ef1f2acf97355b8dd3777/example/mobile/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png -------------------------------------------------------------------------------- /example/mobile/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aloisdeniel/flutter_shared_ui_poc/a8edd9005707ef1fd76ef1f2acf97355b8dd3777/example/mobile/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /example/mobile/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "LaunchImage.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "LaunchImage@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "LaunchImage@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /example/mobile/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aloisdeniel/flutter_shared_ui_poc/a8edd9005707ef1fd76ef1f2acf97355b8dd3777/example/mobile/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /example/mobile/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aloisdeniel/flutter_shared_ui_poc/a8edd9005707ef1fd76ef1f2acf97355b8dd3777/example/mobile/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /example/mobile/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aloisdeniel/flutter_shared_ui_poc/a8edd9005707ef1fd76ef1f2acf97355b8dd3777/example/mobile/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /example/mobile/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md: -------------------------------------------------------------------------------- 1 | # Launch Screen Assets 2 | 3 | You can customize the launch screen with your own desired assets by replacing the image files in this directory. 4 | 5 | You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images. -------------------------------------------------------------------------------- /example/mobile/ios/Runner/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /example/mobile/ios/Runner/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /example/mobile/ios/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | mobile 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | $(FLUTTER_BUILD_NAME) 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | $(FLUTTER_BUILD_NUMBER) 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UISupportedInterfaceOrientations 30 | 31 | UIInterfaceOrientationPortrait 32 | UIInterfaceOrientationLandscapeLeft 33 | UIInterfaceOrientationLandscapeRight 34 | 35 | UISupportedInterfaceOrientations~ipad 36 | 37 | UIInterfaceOrientationPortrait 38 | UIInterfaceOrientationPortraitUpsideDown 39 | UIInterfaceOrientationLandscapeLeft 40 | UIInterfaceOrientationLandscapeRight 41 | 42 | UIViewControllerBasedStatusBarAppearance 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /example/mobile/ios/Runner/main.m: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | #import "AppDelegate.h" 4 | 5 | int main(int argc, char* argv[]) { 6 | @autoreleasepool { 7 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /example/mobile/lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:shared_ui/main.dart' as app; 2 | 3 | void main() => app.main(); -------------------------------------------------------------------------------- /example/mobile/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: mobile 2 | description: A new Flutter project. 3 | 4 | version: 1.0.0+1 5 | 6 | environment: 7 | sdk: ">=2.1.0 <3.0.0" 8 | 9 | dependencies: 10 | shared_ui: 11 | path: ../shared_ui 12 | flutter: 13 | sdk: flutter 14 | 15 | # The following adds the Cupertino Icons font to your application. 16 | # Use with the CupertinoIcons class for iOS style icons. 17 | cupertino_icons: ^0.1.2 18 | 19 | dev_dependencies: 20 | flutter_test: 21 | sdk: flutter 22 | 23 | 24 | # For information on the generic Dart part of this file, see the 25 | # following page: https://www.dartlang.org/tools/pub/pubspec 26 | 27 | # The following section is specific to Flutter. 28 | flutter: 29 | 30 | # The following line ensures that the Material Icons font is 31 | # included with your application, so that you can use the icons in 32 | # the material Icons class. 33 | uses-material-design: true 34 | 35 | # To add assets to your application, add an assets section, like this: 36 | # assets: 37 | # - images/a_dot_burr.jpeg 38 | # - images/a_dot_ham.jpeg 39 | 40 | # An image asset can refer to one or more resolution-specific "variants", see 41 | # https://flutter.dev/assets-and-images/#resolution-aware. 42 | 43 | # For details regarding adding assets from package dependencies, see 44 | # https://flutter.dev/assets-and-images/#from-packages 45 | 46 | # To add custom fonts to your application, add a fonts section here, 47 | # in this "flutter" section. Each entry in this list should have a 48 | # "family" key with the font family name, and a "fonts" key with a 49 | # list giving the asset and other descriptors for the font. For 50 | # example: 51 | # fonts: 52 | # - family: Schyler 53 | # fonts: 54 | # - asset: fonts/Schyler-Regular.ttf 55 | # - asset: fonts/Schyler-Italic.ttf 56 | # style: italic 57 | # - family: Trajan Pro 58 | # fonts: 59 | # - asset: fonts/TrajanPro.ttf 60 | # - asset: fonts/TrajanPro_Bold.ttf 61 | # weight: 700 62 | # 63 | # For details regarding fonts from package dependencies, 64 | # see https://flutter.dev/custom-fonts/#from-packages 65 | -------------------------------------------------------------------------------- /example/shared_ui/.gitignore: -------------------------------------------------------------------------------- 1 | # Files and directories created by pub 2 | .dart_tool/ 3 | .packages 4 | # Remove the following pattern if you wish to check in your lock file 5 | pubspec.lock 6 | 7 | # Conventional directory for build outputs 8 | build/ 9 | 10 | # Directory created by dartdoc 11 | doc/api/ 12 | -------------------------------------------------------------------------------- /example/shared_ui/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## 1.0.0 2 | 3 | - Initial version, created by Stagehand 4 | -------------------------------------------------------------------------------- /example/shared_ui/README.md: -------------------------------------------------------------------------------- 1 | A library for Dart developers. 2 | 3 | Created from templates made available by Stagehand under a BSD-style 4 | [license](https://github.com/dart-lang/stagehand/blob/master/LICENSE). 5 | 6 | ## Usage 7 | 8 | A simple usage example: 9 | 10 | ```dart 11 | import 'package:shared_ui/shared_ui.dart'; 12 | 13 | main() { 14 | var awesome = new Awesome(); 15 | } 16 | ``` 17 | 18 | ## Features and bugs 19 | 20 | Please file feature requests and bugs at the [issue tracker][tracker]. 21 | 22 | [tracker]: http://example.com/issues/replaceme 23 | -------------------------------------------------------------------------------- /example/shared_ui/analysis_options.yaml: -------------------------------------------------------------------------------- 1 | # Defines a default set of lint rules enforced for 2 | # projects at Google. For details and rationale, 3 | # see https://github.com/dart-lang/pedantic#enabled-lints. 4 | include: package:pedantic/analysis_options.yaml 5 | 6 | # For lint rules and documentation, see http://dart-lang.github.io/linter/lints. 7 | # Uncomment to specify additional rules. 8 | # linter: 9 | # rules: 10 | # - camel_case_types 11 | 12 | analyzer: 13 | # exclude: 14 | # - path/to/excluded/files/** 15 | -------------------------------------------------------------------------------- /example/shared_ui/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java: -------------------------------------------------------------------------------- 1 | package io.flutter.plugins; 2 | 3 | import io.flutter.plugin.common.PluginRegistry; 4 | 5 | /** 6 | * Generated file. Do not edit. 7 | */ 8 | public final class GeneratedPluginRegistrant { 9 | public static void registerWith(PluginRegistry registry) { 10 | if (alreadyRegisteredWith(registry)) { 11 | return; 12 | } 13 | } 14 | 15 | private static boolean alreadyRegisteredWith(PluginRegistry registry) { 16 | final String key = GeneratedPluginRegistrant.class.getCanonicalName(); 17 | if (registry.hasPlugin(key)) { 18 | return true; 19 | } 20 | registry.registrarFor(key); 21 | return false; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /example/shared_ui/android/local.properties: -------------------------------------------------------------------------------- 1 | sdk.dir=/Users/alois/Library/Android/sdk 2 | flutter.sdk=/Users/alois/flutter -------------------------------------------------------------------------------- /example/shared_ui/ios/Flutter/Generated.xcconfig: -------------------------------------------------------------------------------- 1 | // This is a generated file; do not edit or check into version control. 2 | FLUTTER_ROOT=/Users/alois/flutter 3 | FLUTTER_APPLICATION_PATH=/Users/alois/Documents/GitHub/flutter_shared_ui_poc/example/shared_ui 4 | FLUTTER_TARGET=lib/main.dart 5 | FLUTTER_BUILD_DIR=build 6 | SYMROOT=${SOURCE_ROOT}/../build/ios 7 | FLUTTER_FRAMEWORK_DIR=/Users/alois/flutter/bin/cache/artifacts/engine/ios 8 | -------------------------------------------------------------------------------- /example/shared_ui/ios/Runner/GeneratedPluginRegistrant.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | #ifndef GeneratedPluginRegistrant_h 6 | #define GeneratedPluginRegistrant_h 7 | 8 | #import 9 | 10 | @interface GeneratedPluginRegistrant : NSObject 11 | + (void)registerWithRegistry:(NSObject*)registry; 12 | @end 13 | 14 | #endif /* GeneratedPluginRegistrant_h */ 15 | -------------------------------------------------------------------------------- /example/shared_ui/ios/Runner/GeneratedPluginRegistrant.m: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | #import "GeneratedPluginRegistrant.h" 6 | 7 | @implementation GeneratedPluginRegistrant 8 | 9 | + (void)registerWithRegistry:(NSObject*)registry { 10 | } 11 | 12 | @end 13 | -------------------------------------------------------------------------------- /example/shared_ui/lib/home_page.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_cross/material.dart'; 2 | import 'package:flutter_cross/ui.dart'; 3 | 4 | class HomePage extends StatefulWidget { 5 | HomePage({Key key, this.title}) : super(key: key); 6 | 7 | final String title; 8 | 9 | @override 10 | _HomePageState createState() => _HomePageState(); 11 | } 12 | 13 | class _HomePageState extends State { 14 | int _counter = 0; 15 | 16 | void _incrementCounter() { 17 | setState(() { 18 | _counter++; 19 | }); 20 | } 21 | 22 | @override 23 | Widget build(BuildContext context) { 24 | return Scaffold( 25 | appBar: AppBar( 26 | title: Text(widget.title), 27 | ), 28 | backgroundColor: Color(0xFFEEEEEE), 29 | body: Center( 30 | child: Text( 31 | 'You have pushed the button this many times: $_counter', 32 | ), 33 | ), 34 | floatingActionButton: FloatingActionButton( 35 | onPressed: _incrementCounter, 36 | tooltip: 'Increment', 37 | child: Text("+"), 38 | ), 39 | ); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /example/shared_ui/lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_cross/material.dart'; 2 | 3 | import 'home_page.dart'; 4 | 5 | void main() => runApp(MyApp() as dynamic); 6 | 7 | class MyApp extends StatelessWidget { 8 | @override 9 | Widget build(BuildContext context) { 10 | return MaterialApp( 11 | title: 'Flutter Demo', 12 | theme: ThemeData( 13 | primarySwatch: Colors.blue, 14 | ), 15 | home: HomePage(title: 'Flutter Demo Home Page') as dynamic, // Casted as dynamic 16 | ); 17 | } 18 | } -------------------------------------------------------------------------------- /example/shared_ui/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: shared_ui 2 | description: A starting point for Dart libraries or applications. 3 | # version: 1.0.0 4 | # homepage: https://www.example.com 5 | # author: aloisdeniel 6 | 7 | environment: 8 | sdk: '>=2.2.0 <3.0.0' 9 | 10 | dependencies: 11 | flutter_cross: 12 | path: ../../packages/flutter_cross 13 | 14 | dev_dependencies: 15 | pedantic: ^1.0.0 16 | test: ^1.0.0 17 | -------------------------------------------------------------------------------- /example/webapp/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aloisdeniel/flutter_shared_ui_poc/a8edd9005707ef1fd76ef1f2acf97355b8dd3777/example/webapp/.DS_Store -------------------------------------------------------------------------------- /example/webapp/.gitignore: -------------------------------------------------------------------------------- 1 | # Files and directories created by pub 2 | .dart_tool/ 3 | .packages 4 | # Remove the following pattern if you wish to check in your lock file 5 | pubspec.lock 6 | 7 | # Conventional directory for build outputs 8 | build/ 9 | 10 | # Directory created by dartdoc 11 | doc/api/ 12 | -------------------------------------------------------------------------------- /example/webapp/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## 1.0.0 2 | 3 | - Initial version, created by Stagehand 4 | -------------------------------------------------------------------------------- /example/webapp/README.md: -------------------------------------------------------------------------------- 1 | A library for Dart developers. 2 | 3 | Created from templates made available by Stagehand under a BSD-style 4 | [license](https://github.com/dart-lang/stagehand/blob/master/LICENSE). 5 | 6 | ## Usage 7 | 8 | A simple usage example: 9 | 10 | ```dart 11 | import 'package:webapp/webapp.dart'; 12 | 13 | main() { 14 | var awesome = new Awesome(); 15 | } 16 | ``` 17 | 18 | ## Features and bugs 19 | 20 | Please file feature requests and bugs at the [issue tracker][tracker]. 21 | 22 | [tracker]: http://example.com/issues/replaceme 23 | -------------------------------------------------------------------------------- /example/webapp/analysis_options.yaml: -------------------------------------------------------------------------------- 1 | # Defines a default set of lint rules enforced for 2 | # projects at Google. For details and rationale, 3 | # see https://github.com/dart-lang/pedantic#enabled-lints. 4 | include: package:pedantic/analysis_options.yaml 5 | 6 | # For lint rules and documentation, see http://dart-lang.github.io/linter/lints. 7 | # Uncomment to specify additional rules. 8 | # linter: 9 | # rules: 10 | # - camel_case_types 11 | 12 | analyzer: 13 | # exclude: 14 | # - path/to/excluded/files/** 15 | -------------------------------------------------------------------------------- /example/webapp/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java: -------------------------------------------------------------------------------- 1 | package io.flutter.plugins; 2 | 3 | import io.flutter.plugin.common.PluginRegistry; 4 | 5 | /** 6 | * Generated file. Do not edit. 7 | */ 8 | public final class GeneratedPluginRegistrant { 9 | public static void registerWith(PluginRegistry registry) { 10 | if (alreadyRegisteredWith(registry)) { 11 | return; 12 | } 13 | } 14 | 15 | private static boolean alreadyRegisteredWith(PluginRegistry registry) { 16 | final String key = GeneratedPluginRegistrant.class.getCanonicalName(); 17 | if (registry.hasPlugin(key)) { 18 | return true; 19 | } 20 | registry.registrarFor(key); 21 | return false; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /example/webapp/ios/Runner/GeneratedPluginRegistrant.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | #ifndef GeneratedPluginRegistrant_h 6 | #define GeneratedPluginRegistrant_h 7 | 8 | #import 9 | 10 | @interface GeneratedPluginRegistrant : NSObject 11 | + (void)registerWithRegistry:(NSObject*)registry; 12 | @end 13 | 14 | #endif /* GeneratedPluginRegistrant_h */ 15 | -------------------------------------------------------------------------------- /example/webapp/ios/Runner/GeneratedPluginRegistrant.m: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | #import "GeneratedPluginRegistrant.h" 6 | 7 | @implementation GeneratedPluginRegistrant 8 | 9 | + (void)registerWithRegistry:(NSObject*)registry { 10 | } 11 | 12 | @end 13 | -------------------------------------------------------------------------------- /example/webapp/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: webapp 2 | 3 | environment: 4 | sdk: '>=2.2.0 <3.0.0' 5 | 6 | dependencies: 7 | flutter_web: any 8 | flutter_web_ui: any 9 | shared_ui: 10 | path: ../shared_ui 11 | 12 | dev_dependencies: 13 | # Enables the `pub run build_runner` command 14 | build_runner: ^1.1.2 15 | # Includes the JavaScript compilers 16 | build_web_compilers: ^1.0.0 17 | 18 | # flutter_web packages are not published to pub.dartlang.org 19 | # These overrides tell the package tools to get them from GitHub 20 | dependency_overrides: 21 | flutter_web: 22 | git: 23 | url: https://github.com/flutter/flutter_web 24 | path: packages/flutter_web 25 | flutter_web_ui: 26 | git: 27 | url: https://github.com/flutter/flutter_web 28 | path: packages/flutter_web_ui -------------------------------------------------------------------------------- /example/webapp/web/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /example/webapp/web/main.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | import 'package:flutter_web_ui/ui.dart' as ui; 5 | import 'package:shared_ui/main.dart' as app; 6 | 7 | main() async { 8 | await ui.webOnlyInitializePlatform(); 9 | app.main(); 10 | } -------------------------------------------------------------------------------- /packages/flutter_cross/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java: -------------------------------------------------------------------------------- 1 | package io.flutter.plugins; 2 | 3 | import io.flutter.plugin.common.PluginRegistry; 4 | 5 | /** 6 | * Generated file. Do not edit. 7 | */ 8 | public final class GeneratedPluginRegistrant { 9 | public static void registerWith(PluginRegistry registry) { 10 | if (alreadyRegisteredWith(registry)) { 11 | return; 12 | } 13 | } 14 | 15 | private static boolean alreadyRegisteredWith(PluginRegistry registry) { 16 | final String key = GeneratedPluginRegistrant.class.getCanonicalName(); 17 | if (registry.hasPlugin(key)) { 18 | return true; 19 | } 20 | registry.registrarFor(key); 21 | return false; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /packages/flutter_cross/ios/Runner/GeneratedPluginRegistrant.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | #ifndef GeneratedPluginRegistrant_h 6 | #define GeneratedPluginRegistrant_h 7 | 8 | #import 9 | 10 | @interface GeneratedPluginRegistrant : NSObject 11 | + (void)registerWithRegistry:(NSObject*)registry; 12 | @end 13 | 14 | #endif /* GeneratedPluginRegistrant_h */ 15 | -------------------------------------------------------------------------------- /packages/flutter_cross/ios/Runner/GeneratedPluginRegistrant.m: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | #import "GeneratedPluginRegistrant.h" 6 | 7 | @implementation GeneratedPluginRegistrant 8 | 9 | + (void)registerWithRegistry:(NSObject*)registry { 10 | } 11 | 12 | @end 13 | -------------------------------------------------------------------------------- /packages/flutter_cross/lib/animation.dart: -------------------------------------------------------------------------------- 1 | export 'package:flutter_stub/animation.dart' 2 | // ignore: uri_does_not_exist 3 | if (dart.library.html) 'package:flutter_web/animation.dart' 4 | // ignore: uri_does_not_exist 5 | if (dart.library.io) 'package:flutter/animation.dart'; -------------------------------------------------------------------------------- /packages/flutter_cross/lib/cupertino.dart: -------------------------------------------------------------------------------- 1 | export 'package:flutter_stub/cupertino.dart' 2 | // ignore: uri_does_not_exist 3 | if (dart.library.html) 'package:flutter_web/cupertino.dart' 4 | // ignore: uri_does_not_exist 5 | if (dart.library.io) 'package:flutter/cupertino.dart'; -------------------------------------------------------------------------------- /packages/flutter_cross/lib/foundation.dart: -------------------------------------------------------------------------------- 1 | export 'package:flutter_stub/foundation.dart' 2 | // ignore: uri_does_not_exist 3 | if (dart.library.html) 'package:flutter_web/foundation.dart' 4 | // ignore: uri_does_not_exist 5 | if (dart.library.io) 'package:flutter/foundation.dart'; -------------------------------------------------------------------------------- /packages/flutter_cross/lib/gestures.dart: -------------------------------------------------------------------------------- 1 | export 'package:flutter_stub/gestures.dart' 2 | // ignore: uri_does_not_exist 3 | if (dart.library.html) 'package:flutter_web/gestures.dart' 4 | // ignore: uri_does_not_exist 5 | if (dart.library.io) 'package:flutter/gestures.dart'; -------------------------------------------------------------------------------- /packages/flutter_cross/lib/material.dart: -------------------------------------------------------------------------------- 1 | export 'package:flutter_stub/material.dart' 2 | // ignore: uri_does_not_exist 3 | if (dart.library.html) 'package:flutter_web/material.dart' 4 | // ignore: uri_does_not_exist 5 | if (dart.library.io) 'package:flutter/material.dart'; -------------------------------------------------------------------------------- /packages/flutter_cross/lib/painting.dart: -------------------------------------------------------------------------------- 1 | export 'package:flutter_stub/painting.dart' 2 | // ignore: uri_does_not_exist 3 | if (dart.library.html) 'package:flutter_web/painting.dart' 4 | // ignore: uri_does_not_exist 5 | if (dart.library.io) 'package:flutter/painting.dart'; -------------------------------------------------------------------------------- /packages/flutter_cross/lib/physics.dart: -------------------------------------------------------------------------------- 1 | export 'package:flutter_stub/physics.dart' 2 | // ignore: uri_does_not_exist 3 | if (dart.library.html) 'package:flutter_web/physics.dart' 4 | // ignore: uri_does_not_exist 5 | if (dart.library.io) 'package:flutter/physics.dart'; -------------------------------------------------------------------------------- /packages/flutter_cross/lib/rendering.dart: -------------------------------------------------------------------------------- 1 | export 'package:flutter_stub/rendering.dart' 2 | // ignore: uri_does_not_exist 3 | if (dart.library.html) 'package:flutter_web/rendering.dart' 4 | // ignore: uri_does_not_exist 5 | if (dart.library.io) 'package:flutter/rendering.dart'; -------------------------------------------------------------------------------- /packages/flutter_cross/lib/scheduler.dart: -------------------------------------------------------------------------------- 1 | export 'package:flutter_stub/scheduler.dart' 2 | // ignore: uri_does_not_exist 3 | if (dart.library.html) 'package:flutter_web/scheduler.dart' 4 | // ignore: uri_does_not_exist 5 | if (dart.library.io) 'package:flutter/scheduler.dart'; -------------------------------------------------------------------------------- /packages/flutter_cross/lib/semantics.dart: -------------------------------------------------------------------------------- 1 | export 'package:flutter_stub/semantics.dart' 2 | // ignore: uri_does_not_exist 3 | if (dart.library.html) 'package:flutter_web/semantics.dart' 4 | // ignore: uri_does_not_exist 5 | if (dart.library.io) 'package:flutter/semantics.dart'; -------------------------------------------------------------------------------- /packages/flutter_cross/lib/services.dart: -------------------------------------------------------------------------------- 1 | export 'package:flutter_stub/services.dart' 2 | // ignore: uri_does_not_exist 3 | if (dart.library.html) 'package:flutter_web/services.dart' 4 | // ignore: uri_does_not_exist 5 | if (dart.library.io) 'package:flutter/services.dart'; -------------------------------------------------------------------------------- /packages/flutter_cross/lib/ui.dart: -------------------------------------------------------------------------------- 1 | export 'package:flutter_stub_ui/ui.dart' 2 | // ignore: uri_does_not_exist 3 | if (dart.library.html) 'package:flutter_web_ui/ui.dart' 4 | // ignore: uri_does_not_exist 5 | if (dart.library.io) 'dart:ui'; -------------------------------------------------------------------------------- /packages/flutter_cross/lib/widgets.dart: -------------------------------------------------------------------------------- 1 | export 'package:flutter_stub/widgets.dart' 2 | // ignore: uri_does_not_exist 3 | if (dart.library.html) 'package:flutter_web/widgets.dart' 4 | // ignore: uri_does_not_exist 5 | if (dart.library.io) 'package:flutter/widgets.dart'; -------------------------------------------------------------------------------- /packages/flutter_cross/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: flutter_cross 2 | description: A starting point for Dart libraries or applications. 3 | # version: 1.0.0 4 | # homepage: https://www.example.com 5 | # author: aloisdeniel 6 | 7 | environment: 8 | sdk: '>=2.2.0 <3.0.0' 9 | 10 | dependencies: 11 | flutter_stub: 12 | git: 13 | url: https://github.com/aloisdeniel/flutter_shared_ui_poc 14 | path: packages/flutter_stub 15 | 16 | dev_dependencies: 17 | pedantic: ^1.0.0 18 | test: ^1.0.0 19 | -------------------------------------------------------------------------------- /packages/flutter_stub/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aloisdeniel/flutter_shared_ui_poc/a8edd9005707ef1fd76ef1f2acf97355b8dd3777/packages/flutter_stub/.DS_Store -------------------------------------------------------------------------------- /packages/flutter_stub/.gitignore: -------------------------------------------------------------------------------- 1 | # Files and directories created by pub 2 | .dart_tool/ 3 | .packages 4 | # Remove the following pattern if you wish to check in your lock file 5 | pubspec.lock 6 | 7 | # Conventional directory for build outputs 8 | build/ 9 | 10 | # Directory created by dartdoc 11 | doc/api/ 12 | -------------------------------------------------------------------------------- /packages/flutter_stub/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## 1.0.0 2 | 3 | - Initial version, created by Stagehand 4 | -------------------------------------------------------------------------------- /packages/flutter_stub/README.md: -------------------------------------------------------------------------------- 1 | A library for Dart developers. 2 | 3 | Created from templates made available by Stagehand under a BSD-style 4 | [license](https://github.com/dart-lang/stagehand/blob/master/LICENSE). 5 | 6 | ## Usage 7 | 8 | A simple usage example: 9 | 10 | ```dart 11 | import 'package:flutter_stub/flutter_stub.dart'; 12 | 13 | main() { 14 | var awesome = new Awesome(); 15 | } 16 | ``` 17 | 18 | ## Features and bugs 19 | 20 | Please file feature requests and bugs at the [issue tracker][tracker]. 21 | 22 | [tracker]: http://example.com/issues/replaceme 23 | -------------------------------------------------------------------------------- /packages/flutter_stub/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java: -------------------------------------------------------------------------------- 1 | package io.flutter.plugins; 2 | 3 | import io.flutter.plugin.common.PluginRegistry; 4 | 5 | /** 6 | * Generated file. Do not edit. 7 | */ 8 | public final class GeneratedPluginRegistrant { 9 | public static void registerWith(PluginRegistry registry) { 10 | if (alreadyRegisteredWith(registry)) { 11 | return; 12 | } 13 | } 14 | 15 | private static boolean alreadyRegisteredWith(PluginRegistry registry) { 16 | final String key = GeneratedPluginRegistrant.class.getCanonicalName(); 17 | if (registry.hasPlugin(key)) { 18 | return true; 19 | } 20 | registry.registrarFor(key); 21 | return false; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /packages/flutter_stub/android/local.properties: -------------------------------------------------------------------------------- 1 | sdk.dir=/Users/alois/Library/Android/sdk 2 | flutter.sdk=/Users/alois/flutter -------------------------------------------------------------------------------- /packages/flutter_stub/ios/Flutter/Generated.xcconfig: -------------------------------------------------------------------------------- 1 | // This is a generated file; do not edit or check into version control. 2 | FLUTTER_ROOT=/Users/alois/flutter 3 | FLUTTER_APPLICATION_PATH=/Users/alois/Documents/GitHub/flutter_shared_ui_poc/packages/flutter_stub 4 | FLUTTER_TARGET=lib/main.dart 5 | FLUTTER_BUILD_DIR=build 6 | SYMROOT=${SOURCE_ROOT}/../build/ios 7 | FLUTTER_FRAMEWORK_DIR=/Users/alois/flutter/bin/cache/artifacts/engine/ios 8 | -------------------------------------------------------------------------------- /packages/flutter_stub/ios/Runner/GeneratedPluginRegistrant.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | #ifndef GeneratedPluginRegistrant_h 6 | #define GeneratedPluginRegistrant_h 7 | 8 | #import 9 | 10 | @interface GeneratedPluginRegistrant : NSObject 11 | + (void)registerWithRegistry:(NSObject*)registry; 12 | @end 13 | 14 | #endif /* GeneratedPluginRegistrant_h */ 15 | -------------------------------------------------------------------------------- /packages/flutter_stub/ios/Runner/GeneratedPluginRegistrant.m: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | #import "GeneratedPluginRegistrant.h" 6 | 7 | @implementation GeneratedPluginRegistrant 8 | 9 | + (void)registerWithRegistry:(NSObject*)registry { 10 | } 11 | 12 | @end 13 | -------------------------------------------------------------------------------- /packages/flutter_stub/lib/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aloisdeniel/flutter_shared_ui_poc/a8edd9005707ef1fd76ef1f2acf97355b8dd3777/packages/flutter_stub/lib/.DS_Store -------------------------------------------------------------------------------- /packages/flutter_stub/lib/animation.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | // Synced 2019-05-31T15:14:36.262065. 5 | 6 | /// The Flutter animation system. 7 | /// 8 | /// To use, import `package:flutter/animation.dart`. 9 | /// 10 | /// See [flutter.dev/animations](https://flutter.dev/animations/) for an overview. 11 | /// 12 | /// This library depends only on core Dart libraries and the `physics.dart` library. 13 | library animation; 14 | 15 | export 'src/animation/animation.dart'; 16 | export 'src/animation/animation_controller.dart'; 17 | export 'src/animation/animations.dart'; 18 | export 'src/animation/curves.dart'; 19 | export 'src/animation/listener_helpers.dart'; 20 | export 'src/animation/tween.dart'; 21 | export 'src/animation/tween_sequence.dart'; 22 | -------------------------------------------------------------------------------- /packages/flutter_stub/lib/cupertino.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | /// Flutter widgets implementing the current iOS design language. 6 | /// 7 | /// To use, import `package:flutter_stub/cupertino.dart`. 8 | library cupertino; 9 | 10 | export 'src/cupertino/action_sheet.dart'; 11 | export 'src/cupertino/activity_indicator.dart'; 12 | export 'src/cupertino/app.dart'; 13 | // export 'src/cupertino/bottom_tab_bar.dart'; 14 | export 'src/cupertino/button.dart'; 15 | export 'src/cupertino/colors.dart'; 16 | // export 'src/cupertino/date_picker.dart'; 17 | // export 'src/cupertino/dialog.dart'; 18 | export 'src/cupertino/icons.dart'; 19 | export 'src/cupertino/localizations.dart'; 20 | export 'src/cupertino/nav_bar.dart'; 21 | export 'src/cupertino/page_scaffold.dart'; 22 | // export 'src/cupertino/picker.dart'; 23 | // export 'src/cupertino/refresh.dart'; 24 | export 'src/cupertino/route.dart'; 25 | // export 'src/cupertino/scrollbar.dart'; 26 | // export 'src/cupertino/segmented_control.dart'; 27 | // export 'src/cupertino/slider.dart'; 28 | // export 'src/cupertino/switch.dart'; 29 | // export 'src/cupertino/tab_scaffold.dart'; 30 | // export 'src/cupertino/tab_view.dart'; 31 | // export 'src/cupertino/text_field.dart'; 32 | // export 'src/cupertino/text_selection.dart'; 33 | export 'src/cupertino/text_theme.dart'; 34 | export 'src/cupertino/theme.dart'; 35 | // export 'src/cupertino/thumb_painter.dart'; 36 | export 'widgets.dart'; 37 | -------------------------------------------------------------------------------- /packages/flutter_stub/lib/foundation.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | // Synced 2019-05-30T14:20:56.103588. 5 | 6 | /// Core Flutter framework primitives. 7 | /// 8 | /// The features defined in this library are the lowest-level utility 9 | /// classes and functions used by all the other layers of the Flutter 10 | /// framework. 11 | library foundation; 12 | 13 | export 'package:meta/meta.dart' 14 | show 15 | immutable, 16 | mustCallSuper, 17 | optionalTypeArgs, 18 | protected, 19 | required, 20 | visibleForTesting; 21 | 22 | export 'src/foundation/assertions.dart'; 23 | export 'src/foundation/basic_types.dart'; 24 | export 'src/foundation/binding.dart'; 25 | export 'src/foundation/bitfield.dart'; 26 | export 'src/foundation/constants.dart'; 27 | export 'src/foundation/change_notifier.dart'; 28 | export 'src/foundation/collections.dart'; 29 | export 'src/foundation/debug.dart'; 30 | export 'src/foundation/diagnostics.dart'; 31 | export 'src/foundation/key.dart'; 32 | export 'src/foundation/isolates.dart'; 33 | export 'src/foundation/licenses.dart'; 34 | export 'src/foundation/node.dart'; 35 | export 'src/foundation/observer_list.dart'; 36 | export 'src/foundation/platform.dart'; 37 | export 'src/foundation/print.dart'; 38 | export 'src/foundation/profile.dart'; 39 | export 'src/foundation/serialization.dart'; 40 | export 'src/foundation/synchronous_future.dart'; 41 | export 'src/foundation/unicode.dart'; 42 | -------------------------------------------------------------------------------- /packages/flutter_stub/lib/gestures.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | /// The Flutter gesture recognizers. 6 | /// 7 | /// To use, import `package:flutter/gestures.dart`. 8 | library gestures; 9 | 10 | export 'src/gestures/arena.dart'; 11 | export 'src/gestures/binding.dart'; 12 | export 'src/gestures/constants.dart'; 13 | export 'src/gestures/converter.dart'; 14 | export 'src/gestures/debug.dart'; 15 | export 'src/gestures/drag.dart'; 16 | export 'src/gestures/drag_details.dart'; 17 | export 'src/gestures/eager.dart'; 18 | export 'src/gestures/events.dart'; 19 | export 'src/gestures/force_press.dart'; 20 | export 'src/gestures/hit_test.dart'; 21 | export 'src/gestures/long_press.dart'; 22 | export 'src/gestures/lsq_solver.dart'; 23 | export 'src/gestures/monodrag.dart'; 24 | export 'src/gestures/mouse_tracking.dart'; 25 | export 'src/gestures/multidrag.dart'; 26 | export 'src/gestures/multitap.dart'; 27 | export 'src/gestures/pointer_router.dart'; 28 | export 'src/gestures/pointer_signal_resolver.dart'; 29 | export 'src/gestures/recognizer.dart'; 30 | export 'src/gestures/scale.dart'; 31 | export 'src/gestures/tap.dart'; 32 | export 'src/gestures/team.dart'; 33 | export 'src/gestures/velocity_tracker.dart'; 34 | -------------------------------------------------------------------------------- /packages/flutter_stub/lib/painting.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | /// The Flutter painting library. 6 | /// 7 | /// To use, import `package:flutter/painting.dart`. 8 | /// 9 | /// This library includes a variety of classes that wrap the Flutter 10 | /// engine's painting API for more specialized purposes, such as painting scaled 11 | /// images, interpolating between shadows, painting borders around boxes, etc. 12 | /// 13 | /// In particular: 14 | /// 15 | /// * Use the [TextPainter] class for painting text. 16 | /// * Use [Decoration] (and more concretely [BoxDecoration]) for 17 | /// painting boxes. 18 | library painting; 19 | 20 | export 'package:flutter_stub_ui/ui.dart' show Shadow; 21 | 22 | export 'src/painting/alignment.dart'; 23 | export 'src/painting/basic_types.dart'; 24 | export 'src/painting/beveled_rectangle_border.dart'; 25 | export 'src/painting/binding.dart'; 26 | export 'src/painting/border_radius.dart'; 27 | export 'src/painting/borders.dart'; 28 | export 'src/painting/box_border.dart'; 29 | export 'src/painting/box_decoration.dart'; 30 | export 'src/painting/box_fit.dart'; 31 | export 'src/painting/box_shadow.dart'; 32 | export 'src/painting/circle_border.dart'; 33 | export 'src/painting/clip.dart'; 34 | export 'src/painting/colors.dart'; 35 | //export 'src/painting/continuous_rectangle_border.dart'; 36 | export 'src/painting/debug.dart'; 37 | export 'src/painting/decoration.dart'; 38 | export 'src/painting/decoration_image.dart'; 39 | export 'src/painting/edge_insets.dart'; 40 | export 'src/painting/flutter_logo.dart'; 41 | export 'src/painting/fractional_offset.dart'; 42 | export 'src/painting/geometry.dart'; 43 | export 'src/painting/gradient.dart'; 44 | export 'src/painting/image_cache.dart'; 45 | export 'src/painting/image_decoder.dart'; 46 | export 'src/painting/image_provider.dart'; 47 | export 'src/painting/image_resolution.dart'; 48 | export 'src/painting/image_stream.dart'; 49 | export 'src/painting/matrix_utils.dart'; 50 | export 'src/painting/notched_shapes.dart'; 51 | export 'src/painting/paint_utilities.dart'; 52 | export 'src/painting/rounded_rectangle_border.dart'; 53 | //export 'src/painting/shader_warm_up.dart'; 54 | export 'src/painting/shape_decoration.dart'; 55 | export 'src/painting/stadium_border.dart'; 56 | export 'src/painting/strut_style.dart'; 57 | export 'src/painting/text_painter.dart'; 58 | export 'src/painting/text_span.dart'; 59 | export 'src/painting/text_style.dart'; 60 | -------------------------------------------------------------------------------- /packages/flutter_stub/lib/physics.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | library physics; 6 | 7 | export 'src/physics/clamped_simulation.dart'; 8 | export 'src/physics/friction_simulation.dart'; 9 | export 'src/physics/gravity_simulation.dart'; 10 | export 'src/physics/simulation.dart'; 11 | export 'src/physics/spring_simulation.dart'; 12 | export 'src/physics/tolerance.dart'; 13 | export 'src/physics/utils.dart'; 14 | -------------------------------------------------------------------------------- /packages/flutter_stub/lib/rendering.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | export 'package:flutter_stub/foundation.dart' 6 | show VoidCallback, ValueChanged, ValueGetter, ValueSetter, DiagnosticLevel; 7 | export 'package:flutter_stub/semantics.dart'; 8 | export 'package:vector_math/vector_math_64.dart' show Matrix4; 9 | 10 | export 'src/rendering/animated_size.dart'; 11 | export 'src/rendering/binding.dart'; 12 | export 'src/rendering/box.dart'; 13 | export 'src/rendering/custom_layout.dart'; 14 | export 'src/rendering/custom_paint.dart'; 15 | export 'src/rendering/debug.dart'; 16 | export 'src/rendering/editable.dart'; 17 | export 'src/rendering/error.dart'; 18 | export 'src/rendering/flex.dart'; 19 | export 'src/rendering/flow.dart'; 20 | export 'src/rendering/image.dart'; 21 | export 'src/rendering/layer.dart'; 22 | export 'src/rendering/list_body.dart'; 23 | export 'src/rendering/list_wheel_viewport.dart'; 24 | export 'src/rendering/object.dart'; 25 | export 'src/rendering/paragraph.dart'; 26 | export 'src/rendering/performance_overlay.dart'; 27 | export 'src/rendering/platform_view.dart'; 28 | export 'src/rendering/proxy_box.dart'; 29 | export 'src/rendering/rotated_box.dart'; 30 | export 'src/rendering/shifted_box.dart'; 31 | export 'src/rendering/sliver.dart'; 32 | export 'src/rendering/sliver_fill.dart'; 33 | export 'src/rendering/sliver_fixed_extent_list.dart'; 34 | export 'src/rendering/sliver_grid.dart'; 35 | export 'src/rendering/sliver_list.dart'; 36 | export 'src/rendering/sliver_multi_box_adaptor.dart'; 37 | export 'src/rendering/sliver_padding.dart'; 38 | export 'src/rendering/sliver_persistent_header.dart'; 39 | export 'src/rendering/stack.dart'; 40 | export 'src/rendering/table.dart'; 41 | export 'src/rendering/table_border.dart'; 42 | export 'src/rendering/tweens.dart'; 43 | export 'src/rendering/view.dart'; 44 | export 'src/rendering/viewport.dart'; 45 | export 'src/rendering/viewport_offset.dart'; 46 | export 'src/rendering/wrap.dart'; 47 | -------------------------------------------------------------------------------- /packages/flutter_stub/lib/scheduler.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | export 'src/scheduler/binding.dart'; 6 | export 'src/scheduler/debug.dart'; 7 | export 'src/scheduler/priority.dart'; 8 | export 'src/scheduler/ticker.dart'; 9 | -------------------------------------------------------------------------------- /packages/flutter_stub/lib/semantics.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | /// The Flutter semantics package. 6 | /// 7 | /// To use, import `package:flutter_stub/semantics.dart`. 8 | /// 9 | /// The [SemanticsEvent] classes define the protocol for sending semantic events 10 | /// to the platform. 11 | /// 12 | /// The [SemanticsNode] hierarchy represents the semantic structure of the UI 13 | /// and is used by the platform-specific accessibility services. 14 | library semantics; 15 | 16 | export 'src/semantics/binding.dart'; 17 | export 'src/semantics/semantics.dart'; 18 | export 'src/semantics/debug.dart'; 19 | export 'src/semantics/semantics_service.dart'; 20 | -------------------------------------------------------------------------------- /packages/flutter_stub/lib/services.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | // Synced 2019-05-30T14:20:56.115631. 5 | 6 | export 'src/services/asset_bundle.dart'; 7 | export 'src/services/binding.dart'; 8 | export 'src/services/clipboard.dart'; 9 | export 'src/services/haptic_feedback.dart'; 10 | export 'src/services/keyboard_key.dart'; 11 | export 'src/services/message_codec.dart'; 12 | export 'src/services/message_codecs.dart'; 13 | export 'src/services/platform_channel.dart'; 14 | export 'src/services/platform_messages.dart'; 15 | export 'src/services/platform_views.dart'; 16 | export 'src/services/raw_keyboard.dart'; 17 | export 'src/services/raw_keyboard_android.dart'; 18 | export 'src/services/raw_keyboard_fuchsia.dart'; 19 | export 'src/services/system_channels.dart'; 20 | export 'src/services/system_chrome.dart'; 21 | export 'src/services/system_navigator.dart'; 22 | export 'src/services/system_sound.dart'; 23 | export 'src/services/text_editing.dart'; 24 | export 'src/services/text_formatter.dart'; 25 | export 'src/services/text_input.dart'; 26 | -------------------------------------------------------------------------------- /packages/flutter_stub/lib/src/cupertino/colors.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | import 'package:flutter_stub_ui/ui.dart' show Color; 6 | 7 | /// A palette of [Color] constants that describe colors commonly used when 8 | /// matching the iOS platform aesthetics. 9 | class CupertinoColors { 10 | CupertinoColors._(); 11 | 12 | /// iOS 10's default blue color. Used to indicate active elements such as 13 | /// buttons, selected tabs and your own chat bubbles. 14 | /// 15 | /// This is SystemBlue in the iOS palette. 16 | static const Color activeBlue = Color(0xFF007AFF); 17 | 18 | /// iOS 10's default green color. Used to indicate active accents such as 19 | /// the switch in its on state and some accent buttons such as the call button 20 | /// and Apple Map's 'Go' button. 21 | /// 22 | /// This is SystemGreen in the iOS palette. 23 | static const Color activeGreen = Color(0xFF4CD964); 24 | 25 | /// iOS 12's default dark mode color. Used in place of the [activeBlue] color 26 | /// as the default active elements' color when the theme's brightness is dark. 27 | /// 28 | /// This is SystemOrange in the iOS palette. 29 | static const Color activeOrange = Color(0xFFFF9500); 30 | 31 | /// Opaque white color. Used for backgrounds and fonts against dark backgrounds. 32 | /// 33 | /// This is SystemWhiteColor in the iOS palette. 34 | /// 35 | /// See also: 36 | /// 37 | /// * [material.Colors.white], the same color, in the material design palette. 38 | /// * [black], opaque black in the [CupertinoColors] palette. 39 | static const Color white = Color(0xFFFFFFFF); 40 | 41 | /// Opaque black color. Used for texts against light backgrounds. 42 | /// 43 | /// This is SystemBlackColor in the iOS palette. 44 | /// 45 | /// See also: 46 | /// 47 | /// * [material.Colors.black], the same color, in the material design palette. 48 | /// * [white], opaque white in the [CupertinoColors] palette. 49 | static const Color black = Color(0xFF000000); 50 | 51 | /// Used in iOS 10 for light background fills such as the chat bubble background. 52 | /// 53 | /// This is SystemLightGrayColor in the iOS palette. 54 | static const Color lightBackgroundGray = Color(0xFFE5E5EA); 55 | 56 | /// Used in iOS 12 for very light background fills in tables between cell groups. 57 | /// 58 | /// This is SystemExtraLightGrayColor in the iOS palette. 59 | static const Color extraLightBackgroundGray = Color(0xFFEFEFF4); 60 | 61 | /// Used in iOS 12 for very dark background fills in tables between cell groups 62 | /// in dark mode. 63 | // Value derived from screenshot from the dark themed Apple Watch app. 64 | static const Color darkBackgroundGray = Color(0xFF171717); 65 | 66 | /// Used in iOS 11 for unselected selectables such as tab bar items in their 67 | /// inactive state or de-emphasized subtitles and details text. 68 | /// 69 | /// Not the same gray as disabled buttons etc. 70 | /// 71 | /// This is SystemGrayColor in the iOS palette. 72 | static const Color inactiveGray = Color(0xFF8E8E93); 73 | 74 | /// Used for iOS 10 for destructive actions such as the delete actions in 75 | /// table view cells and dialogs. 76 | /// 77 | /// Not the same red as the camera shutter or springboard icon notifications 78 | /// or the foreground red theme in various native apps such as HealthKit. 79 | /// 80 | /// This is SystemRed in the iOS palette. 81 | static const Color destructiveRed = Color(0xFFFF3B30); 82 | } 83 | -------------------------------------------------------------------------------- /packages/flutter_stub/lib/src/foundation/bitfield.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | import 'package:flutter_stub_ui/ui.dart' as ui show kMaxUnsignedSMI; 6 | 7 | /// The largest SMI value. 8 | /// 9 | /// See 10 | /// 11 | /// When compiling to JavaScript, this value is not supported since it is 12 | /// larger than the maximum safe 32bit integer. 13 | // The value of this const in Flutter is commented out below. JavaScript has a 14 | // different maximum integer that we are now pulling from dart:ui. 15 | // TODO(b/128337555): Upstream this change to Flutter. 16 | const int kMaxUnsignedSMI = ui.kMaxUnsignedSMI; 17 | //const int kMaxUnsignedSMI = 0x3FFFFFFFFFFFFFFF; 18 | 19 | /// A BitField over an enum (or other class whose values implement "index"). 20 | /// Only the first 62 values of the enum can be used as indices. 21 | /// 22 | /// When compiling to JavaScript, this class is not supported. 23 | class BitField { 24 | /// Creates a bit field of all zeros. 25 | /// 26 | /// The given length must be at most 62. 27 | BitField(this._length) 28 | : assert(_length <= _smiBits), 29 | _bits = _allZeros; 30 | 31 | /// Creates a bit field filled with a particular value. 32 | /// 33 | /// If the value argument is true, the bits are filled with ones. Otherwise, 34 | /// the bits are filled with zeros. 35 | /// 36 | /// The given length must be at most 62. 37 | BitField.filled(this._length, bool value) 38 | : assert(_length <= _smiBits), 39 | _bits = value ? _allOnes : _allZeros; 40 | 41 | final int _length; 42 | int _bits; 43 | 44 | static const int _smiBits = 45 | 62; // see https://www.dartlang.org/articles/numeric-computation/#smis-and-mints 46 | static const int _allZeros = 0; 47 | static const int _allOnes = kMaxUnsignedSMI; // 2^(_kSMIBits+1)-1 48 | 49 | /// Returns whether the bit with the given index is set to one. 50 | bool operator [](T index) { 51 | assert(index.index < _length); 52 | return (_bits & 1 << index.index) > 0; 53 | } 54 | 55 | /// Sets the bit with the given index to the given value. 56 | /// 57 | /// If value is true, the bit with the given index is set to one. Otherwise, 58 | /// the bit is set to zero. 59 | void operator []=(T index, bool value) { 60 | assert(index.index < _length); 61 | if (value) 62 | _bits = _bits | (1 << index.index); 63 | else 64 | _bits = _bits & ~(1 << index.index); 65 | } 66 | 67 | /// Sets all the bits to the given value. 68 | /// 69 | /// If the value is true, the bits are all set to one. Otherwise, the bits are 70 | /// all set to zero. Defaults to setting all the bits to zero. 71 | void reset([bool value = false]) { 72 | _bits = value ? _allOnes : _allZeros; 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /packages/flutter_stub/lib/src/foundation/collections.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | // TODO(ianh): These should be on the Set and List classes themselves. 6 | 7 | /// Compares two sets for deep equality. 8 | /// 9 | /// Returns true if the sets are both null, or if they are both non-null, have 10 | /// the same length, and contain the same members. Returns false otherwise. 11 | /// Order is not compared. 12 | /// 13 | /// See also: 14 | /// 15 | /// * [listEquals], which does something similar for lists. 16 | bool setEquals(Set a, Set b) { 17 | if (a == null) return b == null; 18 | if (b == null || a.length != b.length) return false; 19 | for (T value in a) { 20 | if (!b.contains(value)) return false; 21 | } 22 | return true; 23 | } 24 | 25 | /// Compares two lists for deep equality. 26 | /// 27 | /// Returns true if the lists are both null, or if they are both non-null, have 28 | /// the same length, and contain the same members in the same order. Returns 29 | /// false otherwise. 30 | /// 31 | /// See also: 32 | /// 33 | /// * [setEquals], which does something similar for sets. 34 | bool listEquals(List a, List b) { 35 | if (a == null) return b == null; 36 | if (b == null || a.length != b.length) return false; 37 | for (int index = 0; index < a.length; index += 1) { 38 | if (a[index] != b[index]) return false; 39 | } 40 | return true; 41 | } 42 | -------------------------------------------------------------------------------- /packages/flutter_stub/lib/src/foundation/constants.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | // Synced 2019-05-30T16:11:53.690365. 5 | 6 | /// A constant that is true if the application was compiled in release mode. 7 | /// 8 | /// More specifically, this is a constant that is true if the application was 9 | /// compiled in Dart with the '-Ddart.vm.product=true' flag. 10 | /// 11 | /// Since this is a const value, it can be used to indicate to the compiler that 12 | /// a particular block of code will not be executed in release mode, and hence 13 | /// can be removed. 14 | const bool kReleaseMode = 15 | bool.fromEnvironment('dart.vm.product', defaultValue: false); 16 | 17 | /// A constant that is true if the application was compiled in profile mode. 18 | /// 19 | /// More specifically, this is a constant that is true if the application was 20 | /// compiled in Dart with the '-Ddart.vm.profile=true' flag. 21 | /// 22 | /// Since this is a const value, it can be used to indicate to the compiler that 23 | /// a particular block of code will not be executed in profle mode, an hence 24 | /// can be removed. 25 | const bool kProfileMode = 26 | bool.fromEnvironment('dart.vm.profile', defaultValue: false); 27 | 28 | /// A constant that is true if the application was compiled in debug mode. 29 | /// 30 | /// More specifically, this is a constant that is true if the application was 31 | /// not compiled with '-Ddart.vm.product=true' and '-Ddart.vm.profile=true'. 32 | /// 33 | /// Since this is a const value, it can be used to indicate to the compiler that 34 | /// a particular block of code will not be executed in debug mode, and hence 35 | /// can be removed. 36 | const bool kDebugMode = !kReleaseMode && !kProfileMode; 37 | 38 | /// The epsilon of tolerable double precision error. 39 | /// 40 | /// This is used in various places in the framework to allow for floating point 41 | /// precision loss in calculations. Differences below this threshold are safe to 42 | /// disregard. 43 | const double precisionErrorTolerance = 1e-10; 44 | -------------------------------------------------------------------------------- /packages/flutter_stub/lib/src/foundation/isolates.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | // webOnly: we do not use actual isolates on the web. 6 | 7 | /// Signature for the callback passed to [compute]. 8 | /// 9 | /// {@macro flutter.foundation.compute.types} 10 | /// 11 | /// Instances of [ComputeCallback] must be top-level functions or static methods 12 | /// of classes, not closures or instance methods of objects. 13 | /// 14 | /// {@macro flutter.foundation.compute.limitations} 15 | typedef ComputeCallback = R Function(Q message); 16 | 17 | /// Spawn an isolate, run `callback` on that isolate, passing it `message`, and 18 | /// (eventually) return the value returned by `callback`. 19 | /// 20 | /// This is useful for operations that take longer than a few milliseconds, and 21 | /// which would therefore risk skipping frames. For tasks that will only take a 22 | /// few milliseconds, consider [scheduleTask] instead. 23 | /// 24 | /// {@template flutter.foundation.compute.types} 25 | /// `Q` is the type of the message that kicks off the computation. 26 | /// 27 | /// `R` is the type of the value returned. 28 | /// {@endtemplate} 29 | /// 30 | /// The `callback` argument must be a top-level function, not a closure or an 31 | /// instance or static method of a class. 32 | /// 33 | /// {@template flutter.foundation.compute.limitations} 34 | /// There are limitations on the values that can be sent and received to and 35 | /// from isolates. These limitations constrain the values of `Q` and `R` that 36 | /// are possible. See the discussion at [SendPort.send]. 37 | /// {@endtemplate} 38 | /// 39 | /// The `debugLabel` argument can be specified to provide a name to add to the 40 | /// [Timeline]. This is useful when profiling an application. 41 | Future compute(ComputeCallback callback, Q message, 42 | {String debugLabel}) async { 43 | return callback(message); 44 | } 45 | -------------------------------------------------------------------------------- /packages/flutter_stub/lib/src/foundation/key.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | import 'package:meta/meta.dart'; 6 | import 'package:flutter_stub_ui/ui.dart' show hashValues; 7 | 8 | /// A Key is an identifier for [Widget]s and [Element]s. A new Widget will only 9 | /// be used to reconfigure an existing Element if its Key is the same as its 10 | /// original Widget's Key. 11 | /// 12 | /// Keys must be unique amongst the Elements with the same parent. 13 | abstract class Key { 14 | /// Construct a ValueKey with the given String. 15 | /// This is the simplest way to create keys. 16 | const factory Key(String value) = ValueKey; 17 | 18 | /// Default constructor, used by subclasses. 19 | /// 20 | /// Useful so that subclasses can call us, because the [new Key] factory 21 | /// constructor shadows the implicit constructor. 22 | @protected 23 | const Key.empty(); 24 | } 25 | 26 | /// A key that is not a [GlobalKey]. 27 | /// 28 | /// Keys must be unique amongst the [Element]s with the same parent. By 29 | /// contrast, [GlobalKey]s must be unique across the entire app. 30 | /// 31 | /// See also the discussion at [Widget.key]. 32 | abstract class LocalKey extends Key { 33 | /// Default constructor, used by subclasses. 34 | const LocalKey() : super.empty(); 35 | } 36 | 37 | /// A key that uses a value of a particular type to identify itself. 38 | /// 39 | /// A [ValueKey] is equal to another [ValueKey] if, and only if, their 40 | /// values are [operator==]. 41 | /// 42 | /// This class can be subclassed to create value keys that will not be equal to 43 | /// other value keys that happen to use the same value. If the subclass is 44 | /// private, this results in a value key type that cannot collide with keys from 45 | /// other sources, which could be useful, for example, if the keys are being 46 | /// used as fallbacks in the same scope as keys supplied from another widget. 47 | /// 48 | /// See also the discussion at [Widget.key]. 49 | class ValueKey extends LocalKey { 50 | /// Creates a key that delegates its [operator==] to the given value. 51 | const ValueKey(this.value); 52 | 53 | /// The value to which this key delegates its [operator==] 54 | final T value; 55 | 56 | @override 57 | bool operator ==(dynamic other) { 58 | if (other.runtimeType != runtimeType) return false; 59 | final ValueKey typedOther = other; 60 | return value == typedOther.value; 61 | } 62 | 63 | @override 64 | int get hashCode => hashValues(runtimeType, value); 65 | 66 | @override 67 | String toString() { 68 | final String valueString = T == String ? '<\'$value\'>' : '<$value>'; 69 | // The crazy on the next line is a workaround for 70 | // https://github.com/dart-lang/sdk/issues/28548 71 | if (runtimeType == new _TypeLiteral>().type) 72 | return '[$valueString]'; 73 | return '[$T $valueString]'; 74 | } 75 | } 76 | 77 | class _TypeLiteral { 78 | Type get type => T; 79 | } 80 | -------------------------------------------------------------------------------- /packages/flutter_stub/lib/src/foundation/observer_list.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | import 'dart:collection'; 6 | 7 | /// A list optimized for containment queries. 8 | /// 9 | /// Consider using an [ObserverList] instead of a [List] when the number of 10 | /// [contains] calls dominates the number of [add] and [remove] calls. 11 | // TODO(ianh): Use DelegatingIterable, possibly moving it from the collection 12 | // package to foundation, or to dart:collection. 13 | class ObserverList extends Iterable { 14 | final List _list = []; 15 | bool _isDirty = false; 16 | HashSet _set; 17 | 18 | /// Adds an item to the end of this list. 19 | void add(T item) { 20 | _isDirty = true; 21 | _list.add(item); 22 | } 23 | 24 | /// Removes an item from the list. 25 | /// 26 | /// This is O(N) in the number of items in the list. 27 | /// 28 | /// Returns whether the item was present in the list. 29 | bool remove(T item) { 30 | _isDirty = true; 31 | return _list.remove(item); 32 | } 33 | 34 | @override 35 | bool contains(Object element) { 36 | if (_list.length < 15) { 37 | return _list.contains(element); 38 | } 39 | 40 | if (_isDirty) { 41 | if (_set == null) { 42 | _set = new HashSet.from(_list); 43 | } else { 44 | _set.clear(); 45 | _set.addAll(_list); 46 | } 47 | _isDirty = false; 48 | } 49 | 50 | return _set.contains(element); 51 | } 52 | 53 | @override 54 | Iterator get iterator => _list.iterator; 55 | 56 | @override 57 | bool get isEmpty => _list.isEmpty; 58 | 59 | @override 60 | bool get isNotEmpty => _list.isNotEmpty; 61 | } 62 | -------------------------------------------------------------------------------- /packages/flutter_stub/lib/src/foundation/platform.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | // TODO(flutter_web): this file differs from that of Flutter. We should provide 6 | // a proper implementation for the Web. 7 | 8 | /// The platform that user interaction should adapt to target. 9 | /// 10 | /// The [defaultTargetPlatform] getter returns the current platform. 11 | enum TargetPlatform { 12 | /// Android: 13 | android, 14 | 15 | /// Fuchsia: 16 | fuchsia, 17 | 18 | /// iOS: 19 | iOS, 20 | } 21 | 22 | /// The [TargetPlatform] that matches the platform on which the framework is 23 | /// currently executing. 24 | /// 25 | /// In a test environment, the platform returned is [TargetPlatform.android] 26 | /// regardless of the host platform. (Android was chosen because the tests were 27 | /// originally written assuming Android-like behavior, and we added platform 28 | /// adaptations for iOS later). Tests can check iOS behavior by using the 29 | /// platform override APIs (such as [ThemeData.platform] in the material 30 | /// library) or by setting [debugDefaultTargetPlatformOverride]. The value 31 | /// can only be explicitly set in debug mode. 32 | TargetPlatform get defaultTargetPlatform { 33 | if (debugDefaultTargetPlatformOverride != null) 34 | return debugDefaultTargetPlatformOverride; 35 | return TargetPlatform.android; 36 | } 37 | 38 | /// Override the [defaultTargetPlatform]. 39 | /// 40 | /// Setting this to null returns the [defaultTargetPlatform] to its original 41 | /// value (based on the actual current platform). 42 | /// 43 | /// This setter is only available intended for debugging purposes. To change the 44 | /// target platform in release builds, use the platform override APIs (such as 45 | /// [ThemeData.platform] in the material library). 46 | TargetPlatform debugDefaultTargetPlatformOverride; 47 | -------------------------------------------------------------------------------- /packages/flutter_stub/lib/src/foundation/profile.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | import 'package:flutter_stub_ui/ui.dart' show VoidCallback; 6 | 7 | /// Whether we've been built in release mode. 8 | const bool _kReleaseMode = bool.fromEnvironment('dart.vm.product'); 9 | 10 | /// When running in profile mode (or debug mode), invoke the given function. 11 | /// 12 | /// In release mode, the function is not invoked. 13 | // TODO(devoncarew): Going forward, we'll want the call to profile() to be tree-shaken out. 14 | void profile(VoidCallback function) { 15 | if (_kReleaseMode) return; 16 | function(); 17 | } 18 | -------------------------------------------------------------------------------- /packages/flutter_stub/lib/src/foundation/synchronous_future.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | import 'dart:async'; 6 | 7 | /// A [Future] whose [then] implementation calls the callback immediately. 8 | /// 9 | /// This is similar to [new Future.value], except that the value is available in 10 | /// the same event-loop iteration. 11 | /// 12 | /// ⚠ This class is useful in cases where you want to expose a single API, where 13 | /// you normally want to have everything execute synchronously, but where on 14 | /// rare occasions you want the ability to switch to an asynchronous model. **In 15 | /// general use of this class should be avoided as it is very difficult to debug 16 | /// such bimodal behavior.** 17 | class SynchronousFuture implements Future { 18 | /// Creates a synchronous future. 19 | /// 20 | /// See also [new Future.value]. 21 | SynchronousFuture(this._value); 22 | 23 | final T _value; 24 | 25 | @override 26 | Stream asStream() { 27 | final StreamController controller = new StreamController(); 28 | controller.add(_value); 29 | controller.close(); 30 | return controller.stream; 31 | } 32 | 33 | @override 34 | Future catchError(Function onError, {bool test(dynamic error)}) => 35 | new Completer().future; 36 | 37 | @override 38 | Future then(dynamic f(T value), {Function onError}) { 39 | final dynamic result = f(_value); 40 | if (result is Future) return result; 41 | return new SynchronousFuture(result); 42 | } 43 | 44 | @override 45 | Future timeout(Duration timeLimit, {dynamic onTimeout()}) { 46 | return new Future.value(_value).timeout(timeLimit, onTimeout: onTimeout); 47 | } 48 | 49 | @override 50 | Future whenComplete(dynamic action()) { 51 | try { 52 | final dynamic result = action(); 53 | if (result is Future) return result.then((dynamic value) => _value); 54 | return this; 55 | } catch (e, stack) { 56 | return new Future.error(e, stack); 57 | } 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /packages/flutter_stub/lib/src/foundation/unicode.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | /// Constants for useful Unicode characters. 6 | /// 7 | /// Currently, these characters are all related to bidirectional text. 8 | /// 9 | /// See also: 10 | /// 11 | /// * , which describes the Unicode 12 | /// bidirectional text algorithm. 13 | class Unicode { 14 | Unicode._(); 15 | 16 | /// U+202A LEFT-TO-RIGHT EMBEDDING 17 | /// 18 | /// Treat the following text as embedded left-to-right. 19 | /// 20 | /// Use [PDF] to end the embedding. 21 | static const String LRE = '\u202A'; 22 | 23 | /// U+202B RIGHT-TO-LEFT EMBEDDING 24 | /// 25 | /// Treat the following text as embedded right-to-left. 26 | /// 27 | /// Use [PDF] to end the embedding. 28 | static const String RLE = '\u202B'; 29 | 30 | /// U+202C POP DIRECTIONAL FORMATTING 31 | /// 32 | /// End the scope of the last [LRE], [RLE], [RLO], or [LRO]. 33 | static const String PDF = '\u202C'; 34 | 35 | /// U+202A LEFT-TO-RIGHT OVERRIDE 36 | /// 37 | /// Force following characters to be treated as strong left-to-right characters. 38 | /// 39 | /// For example, this causes Hebrew text to render backwards. 40 | /// 41 | /// Use [PDF] to end the override. 42 | static const String LRO = '\u202D'; 43 | 44 | /// U+202B RIGHT-TO-LEFT OVERRIDE 45 | /// 46 | /// Force following characters to be treated as strong right-to-left characters. 47 | /// 48 | /// For example, this causes English text to render backwards. 49 | /// 50 | /// Use [PDF] to end the override. 51 | static const String RLO = '\u202E'; 52 | 53 | /// U+2066 LEFT-TO-RIGHT ISOLATE 54 | /// 55 | /// Treat the following text as isolated and left-to-right. 56 | /// 57 | /// Use [PDI] to end the isolated scope. 58 | static const String LRI = '\u2066'; 59 | 60 | /// U+2067 RIGHT-TO-LEFT ISOLATE 61 | /// 62 | /// Treat the following text as isolated and right-to-left. 63 | /// 64 | /// Use [PDI] to end the isolated scope. 65 | static const String RLI = '\u2067'; 66 | 67 | /// U+2068 FIRST STRONG ISOLATE 68 | /// 69 | /// Treat the following text as isolated and in the direction of its first 70 | /// strong directional character that is not inside a nested isolate. 71 | /// 72 | /// This essentially "autodetects" the directionality of the text. It is not 73 | /// 100% reliable. For example, Arabic text that starts with an English quote 74 | /// will be detected as LTR, not RTL, which will lead to the text being in a 75 | /// weird order. 76 | /// 77 | /// Use [PDI] to end the isolated scope. 78 | static const String FSI = '\u2068'; 79 | 80 | /// U+2069 POP DIRECTIONAL ISOLATE 81 | /// 82 | /// End the scope of the last [LRI], [RLI], or [FSI]. 83 | static const String PDI = '\u2069'; 84 | 85 | /// U+200E LEFT-TO-RIGHT MARK 86 | /// 87 | /// Left-to-right zero-width character. 88 | static const String LRM = '\u200E'; 89 | 90 | /// U+200F RIGHT-TO-LEFT MARK 91 | /// 92 | /// Right-to-left zero-width non-Arabic character. 93 | static const String RLM = '\u200F'; 94 | 95 | /// U+061C ARABIC LETTER MARK 96 | /// 97 | /// Right-to-left zero-width Arabic character. 98 | static const String ALM = '\u061C'; 99 | } 100 | -------------------------------------------------------------------------------- /packages/flutter_stub/lib/src/gestures/debug.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | // Synced 2019-06-03T11:09:26.946639. 5 | 6 | import 'package:flutter_stub/foundation.dart'; 7 | 8 | // Any changes to this file should be reflected in the debugAssertAllGesturesVarsUnset() 9 | // function below. 10 | 11 | /// Whether to print the results of each hit test to the console. 12 | /// 13 | /// When this is set, in debug mode, any time a hit test is triggered by the 14 | /// [GestureBinding] the results are dumped to the console. 15 | /// 16 | /// This has no effect in release builds. 17 | bool debugPrintHitTestResults = false; 18 | 19 | /// Whether to print the details of each mouse hover event to the console. 20 | /// 21 | /// When this is set, in debug mode, any time a mouse hover event is triggered 22 | /// by the [GestureBinding], the results are dumped to the console. 23 | /// 24 | /// This has no effect in release builds, and only applies to mouse hover 25 | /// events. 26 | bool debugPrintMouseHoverEvents = false; 27 | 28 | /// Prints information about gesture recognizers and gesture arenas. 29 | /// 30 | /// This flag only has an effect in debug mode. 31 | /// 32 | /// See also: 33 | /// 34 | /// * [GestureArenaManager], the class that manages gesture arenas. 35 | /// * [debugPrintRecognizerCallbacksTrace], for debugging issues with 36 | /// gesture recognizers. 37 | bool debugPrintGestureArenaDiagnostics = false; 38 | 39 | /// Logs a message every time a gesture recognizer callback is invoked. 40 | /// 41 | /// This flag only has an effect in debug mode. 42 | /// 43 | /// This is specifically used by [GestureRecognizer.invokeCallback]. Gesture 44 | /// recognizers that do not use this method to invoke callbacks may not honor 45 | /// the [debugPrintRecognizerCallbacksTrace] flag. 46 | /// 47 | /// See also: 48 | /// 49 | /// * [debugPrintGestureArenaDiagnostics], for debugging issues with gesture 50 | /// arenas. 51 | bool debugPrintRecognizerCallbacksTrace = false; 52 | 53 | /// Returns true if none of the gestures library debug variables have been changed. 54 | /// 55 | /// This function is used by the test framework to ensure that debug variables 56 | /// haven't been inadvertently changed. 57 | /// 58 | /// See [the gestures library](gestures/gestures-library.html) for a complete 59 | /// list. 60 | bool debugAssertAllGesturesVarsUnset(String reason) { 61 | assert(() { 62 | if (debugPrintHitTestResults || 63 | debugPrintGestureArenaDiagnostics || 64 | debugPrintRecognizerCallbacksTrace) throw FlutterError(reason); 65 | return true; 66 | }()); 67 | return true; 68 | } 69 | -------------------------------------------------------------------------------- /packages/flutter_stub/lib/src/gestures/drag.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | // Synced 2019-06-03T11:09:26.949607. 5 | 6 | import 'drag_details.dart'; 7 | 8 | /// Interface for objects that receive updates about drags. 9 | /// 10 | /// This interface is used in various ways. For example, 11 | /// [MultiDragGestureRecognizer] uses it to update its clients when it 12 | /// recognizes a gesture. Similarly, the scrolling infrastructure in the widgets 13 | /// library uses it to notify the [DragScrollActivity] when the user drags the 14 | /// scrollable. 15 | abstract class Drag { 16 | /// The pointer has moved. 17 | void update(DragUpdateDetails details) {} 18 | 19 | /// The pointer is no longer in contact with the screen. 20 | /// 21 | /// The velocity at which the pointer was moving when it stopped contacting 22 | /// the screen is available in the `details`. 23 | void end(DragEndDetails details) {} 24 | 25 | /// The input from the pointer is no longer directed towards this receiver. 26 | /// 27 | /// For example, the user might have been interrupted by a system-modal dialog 28 | /// in the middle of the drag. 29 | void cancel() {} 30 | } 31 | -------------------------------------------------------------------------------- /packages/flutter_stub/lib/src/gestures/eager.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | // Synced 2019-06-03T11:09:26.955527. 5 | 6 | import 'arena.dart'; 7 | import 'events.dart'; 8 | import 'recognizer.dart'; 9 | 10 | /// A gesture recognizer that eagerly claims victory in all gesture arenas. 11 | /// 12 | /// This is typically passed in [AndroidView.gestureRecognizers] in order to immediately dispatch 13 | /// all touch events inside the view bounds to the embedded Android view. 14 | /// See [AndroidView.gestureRecognizers] for more details. 15 | class EagerGestureRecognizer extends OneSequenceGestureRecognizer { 16 | /// Create an eager gesture recognizer. 17 | /// 18 | /// {@macro flutter.gestures.gestureRecognizer.kind} 19 | EagerGestureRecognizer({PointerDeviceKind kind}) : super(kind: kind); 20 | 21 | @override 22 | void addAllowedPointer(PointerDownEvent event) { 23 | // We call startTrackingPointer as this is where OneSequenceGestureRecognizer joins the arena. 24 | startTrackingPointer(event.pointer); 25 | resolve(GestureDisposition.accepted); 26 | stopTrackingPointer(event.pointer); 27 | } 28 | 29 | @override 30 | String get debugDescription => 'eager'; 31 | 32 | @override 33 | void didStopTrackingLastPointer(int pointer) {} 34 | 35 | @override 36 | void handleEvent(PointerEvent event) {} 37 | } 38 | -------------------------------------------------------------------------------- /packages/flutter_stub/lib/src/gestures/pointer_signal_resolver.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | // Synced 2019-05-30T14:20:56.217457. 5 | 6 | import 'package:flutter_stub/foundation.dart'; 7 | 8 | import 'events.dart'; 9 | 10 | /// The callback to register with a [PointerSignalResolver] to express 11 | /// interest in a pointer signal event. 12 | typedef PointerSignalResolvedCallback = void Function(PointerSignalEvent event); 13 | 14 | /// An resolver for pointer signal events. 15 | /// 16 | /// Objects interested in a [PointerSignalEvent] should register a callback to 17 | /// be called if they should handle the event. The resolver's purpose is to 18 | /// ensure that the same pointer signal is not handled by multiple objects in 19 | /// a hierarchy. 20 | /// 21 | /// Pointer signals are immediate, so unlike a gesture arena it always resolves 22 | /// at the end of event dispatch. The first callback registered will be the one 23 | /// that is called. 24 | class PointerSignalResolver { 25 | PointerSignalResolvedCallback _firstRegisteredCallback; 26 | 27 | PointerSignalEvent _currentEvent; 28 | 29 | /// Registers interest in handling [event]. 30 | void register( 31 | PointerSignalEvent event, PointerSignalResolvedCallback callback) { 32 | assert(event != null); 33 | assert(callback != null); 34 | assert(_currentEvent == null || _currentEvent == event); 35 | if (_firstRegisteredCallback != null) { 36 | return; 37 | } 38 | _currentEvent = event; 39 | _firstRegisteredCallback = callback; 40 | } 41 | 42 | /// Resolves the event, calling the first registered callback if there was 43 | /// one. 44 | /// 45 | /// Called after the framework has finished dispatching the pointer signal 46 | /// event. 47 | void resolve(PointerSignalEvent event) { 48 | if (_firstRegisteredCallback == null) { 49 | assert(_currentEvent == null); 50 | return; 51 | } 52 | assert(_currentEvent == event); 53 | try { 54 | _firstRegisteredCallback(event); 55 | } catch (exception, stack) { 56 | FlutterError.reportError(FlutterErrorDetails( 57 | exception: exception, 58 | stack: stack, 59 | library: 'gesture library', 60 | context: ErrorDescription('while resolving a PointerSignalEvent'), 61 | informationCollector: () sync* { 62 | yield DiagnosticsProperty('Event', event, 63 | style: DiagnosticsTreeStyle.errorProperty); 64 | }, 65 | )); 66 | } 67 | _firstRegisteredCallback = null; 68 | _currentEvent = null; 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /packages/flutter_stub/lib/src/material/animated_icons.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | library material_animated_icons; 6 | 7 | import 'dart:math' as math show pi; 8 | import 'package:flutter_stub_ui/ui.dart' as ui show Paint, Path, Canvas; 9 | import 'package:flutter_stub_ui/ui.dart' show lerpDouble; 10 | import 'package:flutter_stub/widgets.dart'; 11 | 12 | // This package is split into multiple parts to enable a private API that is 13 | // testable. 14 | 15 | // Public API. 16 | part 'animated_icons/animated_icons.dart'; 17 | // Provides a public interface for referring to the private icon 18 | // implementations. 19 | part 'animated_icons/animated_icons_data.dart'; 20 | 21 | // Animated icons data files. 22 | part 'animated_icons/data/add_event.g.dart'; 23 | part 'animated_icons/data/arrow_menu.g.dart'; 24 | part 'animated_icons/data/close_menu.g.dart'; 25 | part 'animated_icons/data/ellipsis_search.g.dart'; 26 | part 'animated_icons/data/event_add.g.dart'; 27 | part 'animated_icons/data/home_menu.g.dart'; 28 | part 'animated_icons/data/list_view.g.dart'; 29 | part 'animated_icons/data/menu_arrow.g.dart'; 30 | part 'animated_icons/data/menu_close.g.dart'; 31 | part 'animated_icons/data/menu_home.g.dart'; 32 | part 'animated_icons/data/pause_play.g.dart'; 33 | part 'animated_icons/data/play_pause.g.dart'; 34 | part 'animated_icons/data/search_ellipsis.g.dart'; 35 | part 'animated_icons/data/view_list.g.dart'; 36 | -------------------------------------------------------------------------------- /packages/flutter_stub/lib/src/material/button_bar.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | import 'package:flutter_stub/widgets.dart'; 6 | 7 | import 'button_theme.dart'; 8 | import 'dialog.dart'; 9 | import 'flat_button.dart'; 10 | import 'raised_button.dart'; 11 | 12 | /// A horizontal arrangement of buttons. 13 | /// 14 | /// Places the buttons horizontally according to the padding in the current 15 | /// [ButtonTheme]. 16 | /// 17 | /// Used by [Dialog] to arrange the actions at the bottom of the dialog. 18 | /// 19 | /// See also: 20 | /// 21 | /// * [RaisedButton], a kind of button. 22 | /// * [FlatButton], another kind of button. 23 | /// * [Card], at the bottom of which it is common to place a [ButtonBar]. 24 | /// * [Dialog], which uses a [ButtonBar] for its actions. 25 | /// * [ButtonTheme], which configures the [ButtonBar]. 26 | class ButtonBar extends StatelessWidget { 27 | /// Creates a button bar. 28 | /// 29 | /// The alignment argument defaults to [MainAxisAlignment.end]. 30 | const ButtonBar({ 31 | Key key, 32 | this.alignment = MainAxisAlignment.end, 33 | this.mainAxisSize = MainAxisSize.max, 34 | this.children = const [], 35 | }) : super(key: key); 36 | 37 | /// How the children should be placed along the horizontal axis. 38 | final MainAxisAlignment alignment; 39 | 40 | /// How much horizontal space is available. See [Row.mainAxisSize]. 41 | final MainAxisSize mainAxisSize; 42 | 43 | /// The buttons to arrange horizontally. 44 | /// 45 | /// Typically [RaisedButton] or [FlatButton] widgets. 46 | final List children; 47 | 48 | @override 49 | Widget build(BuildContext context) { 50 | final ButtonThemeData buttonTheme = ButtonTheme.of(context); 51 | // We divide by 4.0 because we want half of the average of the left and right padding. 52 | final double paddingUnit = buttonTheme.padding.horizontal / 4.0; 53 | final Widget child = Row( 54 | mainAxisAlignment: alignment, 55 | mainAxisSize: mainAxisSize, 56 | children: children.map((Widget child) { 57 | return Padding( 58 | padding: EdgeInsets.symmetric(horizontal: paddingUnit), 59 | child: child); 60 | }).toList()); 61 | switch (buttonTheme.layoutBehavior) { 62 | case ButtonBarLayoutBehavior.padded: 63 | return Padding( 64 | padding: EdgeInsets.symmetric( 65 | vertical: 2.0 * paddingUnit, horizontal: paddingUnit), 66 | child: child, 67 | ); 68 | case ButtonBarLayoutBehavior.constrained: 69 | return Container( 70 | padding: EdgeInsets.symmetric(horizontal: paddingUnit), 71 | constraints: const BoxConstraints(minHeight: 52.0), 72 | alignment: Alignment.center, 73 | child: child, 74 | ); 75 | } 76 | assert(false); 77 | return null; 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /packages/flutter_stub/lib/src/material/constants.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | import 'package:flutter_stub/painting.dart'; 6 | 7 | /// The height of the toolbar component of the [AppBar]. 8 | const double kToolbarHeight = 56.0; 9 | 10 | /// The height of the bottom navigation bar. 11 | const double kBottomNavigationBarHeight = 56.0; 12 | 13 | /// The height of a tab bar containing text. 14 | const double kTextTabBarHeight = 48.0; 15 | 16 | /// The amount of time theme change animations should last. 17 | const Duration kThemeChangeDuration = const Duration(milliseconds: 200); 18 | 19 | /// The radius of a circular material ink response in logical pixels. 20 | const double kRadialReactionRadius = 20.0; 21 | 22 | /// The amount of time a circular material ink response should take to expand to its full size. 23 | const Duration kRadialReactionDuration = const Duration(milliseconds: 100); 24 | 25 | /// The value of the alpha channel to use when drawing a circular material ink response. 26 | const int kRadialReactionAlpha = 0x1F; 27 | 28 | /// The duration of the horizontal scroll animation that occurs when a tab is tapped. 29 | const Duration kTabScrollDuration = const Duration(milliseconds: 300); 30 | 31 | /// The horizontal padding included by [Tab]s. 32 | const EdgeInsets kTabLabelPadding = EdgeInsets.symmetric(horizontal: 16.0); 33 | 34 | /// The padding added around material list items. 35 | const EdgeInsets kMaterialListPadding = 36 | const EdgeInsets.symmetric(vertical: 8.0); 37 | -------------------------------------------------------------------------------- /packages/flutter_stub/lib/src/material/data_table_source.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | import 'package:flutter_stub/foundation.dart'; 6 | import 'data_table.dart'; 7 | 8 | /// A data source for obtaining row data for [PaginatedDataTable] objects. 9 | /// 10 | /// A data table source provides two main pieces of information: 11 | /// 12 | /// * The number of rows in the data table ([rowCount]). 13 | /// * The data for each row (indexed from `0` to `rowCount - 1`). 14 | /// 15 | /// It also provides a listener API ([addListener]/[removeListener]) so that 16 | /// consumers of the data can be notified when it changes. When the data 17 | /// changes, call [notifyListeners] to send the notifications. 18 | /// 19 | /// DataTableSource objects are expected to be long-lived, not recreated with 20 | /// each build. 21 | abstract class DataTableSource extends ChangeNotifier { 22 | /// Called to obtain the data about a particular row. 23 | /// 24 | /// The [new DataRow.byIndex] constructor provides a convenient way to construct 25 | /// [DataRow] objects for this callback's purposes without having to worry about 26 | /// independently keying each row. 27 | /// 28 | /// If the given index does not correspond to a row, or if no data is yet 29 | /// available for a row, then return null. The row will be left blank and a 30 | /// loading indicator will be displayed over the table. Once data is available 31 | /// or once it is firmly established that the row index in question is beyond 32 | /// the end of the table, call [notifyListeners]. 33 | /// 34 | /// Data returned from this method must be consistent for the lifetime of the 35 | /// object. If the row count changes, then a new delegate must be provided. 36 | DataRow getRow(int index); 37 | 38 | /// Called to obtain the number of rows to tell the user are available. 39 | /// 40 | /// If [isRowCountApproximate] is false, then this must be an accurate number, 41 | /// and [getRow] must return a non-null value for all indices in the range 0 42 | /// to one less than the row count. 43 | /// 44 | /// If [isRowCountApproximate] is true, then the user will be allowed to 45 | /// attempt to display rows up to this [rowCount], and the display will 46 | /// indicate that the count is approximate. The row count should therefore be 47 | /// greater than the actual number of rows if at all possible. 48 | /// 49 | /// If the row count changes, call [notifyListeners]. 50 | int get rowCount; 51 | 52 | /// Called to establish if [rowCount] is a precise number or might be an 53 | /// over-estimate. If this returns true (i.e. the count is approximate), and 54 | /// then later the exact number becomes available, then call 55 | /// [notifyListeners]. 56 | bool get isRowCountApproximate; 57 | 58 | /// Called to obtain the number of rows that are currently selected. 59 | /// 60 | /// If the selected row count changes, call [notifyListeners]. 61 | int get selectedRowCount; 62 | } 63 | -------------------------------------------------------------------------------- /packages/flutter_stub/lib/src/material/flutter_logo.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | import 'package:flutter_stub/widgets.dart'; 6 | 7 | import 'colors.dart'; 8 | 9 | /// The Flutter logo, in widget form. This widget respects the [IconTheme]. 10 | /// 11 | /// See also: 12 | /// 13 | /// * [IconTheme], which provides ambient configuration for icons. 14 | /// * [Icon], for showing icons the Material design icon library. 15 | /// * [ImageIcon], for showing icons from [AssetImage]s or other [ImageProvider]s. 16 | class FlutterLogo extends StatelessWidget { 17 | /// Creates a widget that paints the Flutter logo. 18 | /// 19 | /// The [size] defaults to the value given by the current [IconTheme]. 20 | const FlutterLogo({ 21 | Key key, 22 | this.size, 23 | this.colors, 24 | this.textColor = const Color(0xFF616161), 25 | this.style = FlutterLogoStyle.markOnly, 26 | this.duration = const Duration(milliseconds: 750), 27 | this.curve = Curves.fastOutSlowIn, 28 | }) : super(key: key); 29 | 30 | /// The size of the logo in logical pixels. 31 | /// 32 | /// The logo will be fit into a square this size. 33 | /// 34 | /// Defaults to the current [IconTheme] size, if any. If there is no 35 | /// [IconTheme], or it does not specify an explicit size, then it defaults to 36 | /// 24.0. 37 | final double size; 38 | 39 | /// The color swatch to use to paint the logo, [Colors.blue] by default. 40 | /// 41 | /// If for some reason the default colors are impractical, then one 42 | /// of [Colors.amber], [Colors.red], or [Colors.indigo] swatches can be used. 43 | /// These are Flutter's secondary colors. 44 | /// 45 | /// In extreme cases where none of those four color schemes will work, 46 | /// [Colors.pink], [Colors.purple], or [Colors.cyan] swatches can be used. 47 | /// These are Flutter's tertiary colors. 48 | final MaterialColor colors; 49 | 50 | /// The color used to paint the "Flutter" text on the logo, if [style] is 51 | /// [FlutterLogoStyle.horizontal] or [FlutterLogoStyle.stacked]. The 52 | /// appropriate color is `const Color(0xFF616161)` (a medium gray), against a 53 | /// white background. 54 | final Color textColor; 55 | 56 | /// Whether and where to draw the "Flutter" text. By default, only the logo 57 | /// itself is drawn. 58 | final FlutterLogoStyle style; 59 | 60 | /// The length of time for the animation if the [style], [colors], or 61 | /// [textColor] properties are changed. 62 | final Duration duration; 63 | 64 | /// The curve for the logo animation if the [style], [colors], or [textColor] 65 | /// change. 66 | final Curve curve; 67 | 68 | @override 69 | Widget build(BuildContext context) { 70 | final IconThemeData iconTheme = IconTheme.of(context); 71 | final double iconSize = size ?? iconTheme.size; 72 | final MaterialColor logoColors = colors ?? Colors.blue; 73 | return AnimatedContainer( 74 | width: iconSize, 75 | height: iconSize, 76 | duration: duration, 77 | curve: curve, 78 | decoration: FlutterLogoDecoration( 79 | lightColor: logoColors.shade400, 80 | darkColor: logoColors.shade900, 81 | style: style, 82 | textColor: textColor, 83 | ), 84 | ); 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /packages/flutter_stub/lib/src/material/grid_tile.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | import 'package:flutter_stub/widgets.dart'; 6 | 7 | /// A tile in a material design grid list. 8 | /// 9 | /// A grid list is a [GridView] of tiles in a vertical and horizontal 10 | /// array. Each tile typically contains some visually rich content (e.g., an 11 | /// image) together with a [GridTileBar] in either a [header] or a [footer]. 12 | /// 13 | /// See also: 14 | /// 15 | /// * [GridView], which is a scrollable grid of tiles. 16 | /// * [GridTileBar], which is typically used in either the [header] or 17 | /// [footer]. 18 | /// * 19 | class GridTile extends StatelessWidget { 20 | /// Creates a grid tile. 21 | /// 22 | /// Must have a child. Does not typically have both a header and a footer. 23 | const GridTile({ 24 | Key key, 25 | this.header, 26 | this.footer, 27 | @required this.child, 28 | }) : assert(child != null), 29 | super(key: key); 30 | 31 | /// The widget to show over the top of this grid tile. 32 | /// 33 | /// Typically a [GridTileBar]. 34 | final Widget header; 35 | 36 | /// The widget to show over the bottom of this grid tile. 37 | /// 38 | /// Typically a [GridTileBar]. 39 | final Widget footer; 40 | 41 | /// The widget that fills the tile. 42 | /// 43 | /// {@macro flutter.widgets.child} 44 | final Widget child; 45 | 46 | @override 47 | Widget build(BuildContext context) { 48 | if (header == null && footer == null) return child; 49 | 50 | final List children = [ 51 | Positioned.fill( 52 | child: child, 53 | ), 54 | ]; 55 | if (header != null) { 56 | children.add(Positioned( 57 | top: 0.0, 58 | left: 0.0, 59 | right: 0.0, 60 | child: header, 61 | )); 62 | } 63 | if (footer != null) { 64 | children.add(Positioned( 65 | left: 0.0, 66 | bottom: 0.0, 67 | right: 0.0, 68 | child: footer, 69 | )); 70 | } 71 | return Stack(children: children); 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /packages/flutter_stub/lib/src/painting/circle_border.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | // Synced 2019-06-12T10:31:55.345158. 5 | 6 | import 'dart:math' as math; 7 | 8 | import 'basic_types.dart'; 9 | import 'borders.dart'; 10 | import 'edge_insets.dart'; 11 | 12 | /// A border that fits a circle within the available space. 13 | /// 14 | /// Typically used with [ShapeDecoration] to draw a circle. 15 | /// 16 | /// The [dimensions] assume that the border is being used in a square space. 17 | /// When applied to a rectangular space, the border paints in the center of the 18 | /// rectangle. 19 | /// 20 | /// See also: 21 | /// 22 | /// * [BorderSide], which is used to describe each side of the box. 23 | /// * [Border], which, when used with [BoxDecoration], can also 24 | /// describe a circle. 25 | class CircleBorder extends ShapeBorder { 26 | /// Create a circle border. 27 | /// 28 | /// The [side] argument must not be null. 29 | const CircleBorder({this.side = BorderSide.none}) : assert(side != null); 30 | 31 | /// The style of this border. 32 | final BorderSide side; 33 | 34 | @override 35 | EdgeInsetsGeometry get dimensions { 36 | return EdgeInsets.all(side.width); 37 | } 38 | 39 | @override 40 | ShapeBorder scale(double t) => CircleBorder(side: side.scale(t)); 41 | 42 | @override 43 | ShapeBorder lerpFrom(ShapeBorder a, double t) { 44 | if (a is CircleBorder) 45 | return CircleBorder(side: BorderSide.lerp(a.side, side, t)); 46 | return super.lerpFrom(a, t); 47 | } 48 | 49 | @override 50 | ShapeBorder lerpTo(ShapeBorder b, double t) { 51 | if (b is CircleBorder) 52 | return CircleBorder(side: BorderSide.lerp(side, b.side, t)); 53 | return super.lerpTo(b, t); 54 | } 55 | 56 | @override 57 | Path getInnerPath(Rect rect, {TextDirection textDirection}) { 58 | return Path() 59 | ..addOval(Rect.fromCircle( 60 | center: rect.center, 61 | radius: math.max(0.0, rect.shortestSide / 2.0 - side.width), 62 | )); 63 | } 64 | 65 | @override 66 | Path getOuterPath(Rect rect, {TextDirection textDirection}) { 67 | return Path() 68 | ..addOval(Rect.fromCircle( 69 | center: rect.center, 70 | radius: rect.shortestSide / 2.0, 71 | )); 72 | } 73 | 74 | @override 75 | void paint(Canvas canvas, Rect rect, {TextDirection textDirection}) { 76 | switch (side.style) { 77 | case BorderStyle.none: 78 | break; 79 | case BorderStyle.solid: 80 | canvas.drawCircle(rect.center, (rect.shortestSide - side.width) / 2.0, 81 | side.toPaint()); 82 | } 83 | } 84 | 85 | @override 86 | bool operator ==(dynamic other) { 87 | if (runtimeType != other.runtimeType) return false; 88 | final CircleBorder typedOther = other; 89 | return side == typedOther.side; 90 | } 91 | 92 | @override 93 | int get hashCode => side.hashCode; 94 | 95 | @override 96 | String toString() { 97 | return '$runtimeType($side)'; 98 | } 99 | } 100 | -------------------------------------------------------------------------------- /packages/flutter_stub/lib/src/painting/clip.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | import 'package:flutter_stub_ui/ui.dart'; 6 | 7 | /// Clip utilities used by [PaintingContext] and [TestRecordingPaintingContext]. 8 | abstract class ClipContext { 9 | /// The canvas on which to paint. 10 | Canvas get canvas; 11 | 12 | void _clipAndPaint(void canvasClipCall(bool doAntiAlias), Clip clipBehavior, 13 | Rect bounds, void painter()) { 14 | assert(canvasClipCall != null); 15 | canvas.save(); 16 | switch (clipBehavior) { 17 | case Clip.none: 18 | break; 19 | case Clip.hardEdge: 20 | canvasClipCall(false); 21 | break; 22 | case Clip.antiAlias: 23 | canvasClipCall(true); 24 | break; 25 | case Clip.antiAliasWithSaveLayer: 26 | canvasClipCall(true); 27 | canvas.saveLayer(bounds, Paint()); 28 | break; 29 | } 30 | painter(); 31 | if (clipBehavior == Clip.antiAliasWithSaveLayer) { 32 | canvas.restore(); 33 | } 34 | canvas.restore(); 35 | } 36 | 37 | /// Clip [canvas] with [Path] according to [Clip] and then paint. [canvas] is 38 | /// restored to the pre-clip status afterwards. 39 | /// 40 | /// `bounds` is the saveLayer bounds used for [Clip.antiAliasWithSaveLayer]. 41 | void clipPathAndPaint( 42 | Path path, Clip clipBehavior, Rect bounds, void painter()) { 43 | _clipAndPaint( 44 | (bool doAntiAias) => canvas.clipPath(path, doAntiAlias: doAntiAias), 45 | clipBehavior, 46 | bounds, 47 | painter); 48 | } 49 | 50 | /// Clip [canvas] with [Path] according to [RRect] and then paint. [canvas] is 51 | /// restored to the pre-clip status afterwards. 52 | /// 53 | /// `bounds` is the saveLayer bounds used for [Clip.antiAliasWithSaveLayer]. 54 | void clipRRectAndPaint( 55 | RRect rrect, Clip clipBehavior, Rect bounds, void painter()) { 56 | _clipAndPaint( 57 | (bool doAntiAias) => canvas.clipRRect(rrect, doAntiAlias: doAntiAias), 58 | clipBehavior, 59 | bounds, 60 | painter); 61 | } 62 | 63 | /// Clip [canvas] with [Path] according to [Rect] and then paint. [canvas] is 64 | /// restored to the pre-clip status afterwards. 65 | /// 66 | /// `bounds` is the saveLayer bounds used for [Clip.antiAliasWithSaveLayer]. 67 | void clipRectAndPaint( 68 | Rect rect, Clip clipBehavior, Rect bounds, void painter()) { 69 | _clipAndPaint( 70 | (bool doAntiAias) => canvas.clipRect(rect, doAntiAlias: doAntiAias), 71 | clipBehavior, 72 | bounds, 73 | painter); 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /packages/flutter_stub/lib/src/painting/debug.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | import 'package:flutter_stub/foundation.dart'; 6 | 7 | /// Whether to replace all shadows with solid color blocks. 8 | /// 9 | /// This is useful when writing golden file tests (see [matchesGoldenFile]) 10 | /// since the rendering of shadows is not guaranteed to be pixel-for-pixel 11 | /// identical from version to version (or even from run to run). 12 | bool debugDisableShadows = false; 13 | 14 | /// Returns true if none of the painting library debug variables have been 15 | /// changed. 16 | /// 17 | /// This function is used by the test framework to ensure that debug variables 18 | /// haven't been inadvertently changed. 19 | /// 20 | /// See for 21 | /// a complete list. 22 | /// 23 | /// The `debugDisableShadowsOverride` argument can be provided to override 24 | /// the expected value for [debugDisableShadows]. (This exists because the 25 | /// test framework itself overrides this value in some cases.) 26 | bool debugAssertAllPaintingVarsUnset(String reason, 27 | {bool debugDisableShadowsOverride = false}) { 28 | assert(() { 29 | if (debugDisableShadows != debugDisableShadowsOverride) { 30 | throw new FlutterError(reason); 31 | } 32 | return true; 33 | }()); 34 | return true; 35 | } 36 | -------------------------------------------------------------------------------- /packages/flutter_stub/lib/src/painting/geometry.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | import 'dart:math' as math; 6 | 7 | import 'package:flutter_stub/foundation.dart'; 8 | 9 | import 'basic_types.dart'; 10 | 11 | /// Position a child box within a container box, either above or below a target 12 | /// point. 13 | /// 14 | /// The container's size is described by `size`. 15 | /// 16 | /// The target point is specified by `target`, as an offset from the top left of 17 | /// the container. 18 | /// 19 | /// The child box's size is given by `childSize`. 20 | /// 21 | /// The return value is the suggested distance from the top left of the 22 | /// container box to the top left of the child box. 23 | /// 24 | /// The suggested position will be above the target point if `preferBelow` is 25 | /// false, and below the target point if it is true, unless it wouldn't fit on 26 | /// the preferred side but would fit on the other side. 27 | /// 28 | /// The suggested position will place the nearest side of the child to the 29 | /// target point `verticalOffset` from the target point (even if it cannot fit 30 | /// given that constraint). 31 | /// 32 | /// The suggested position will be at least `margin` away from the edge of the 33 | /// container. If possible, the child will be positioned so that its center is 34 | /// aligned with the target point. If the child cannot fit horizontally within 35 | /// the container given the margin, then the child will be centered in the 36 | /// container. 37 | /// 38 | /// Used by [Tooltip] to position a tooltip relative to its parent. 39 | /// 40 | /// The arguments must not be null. 41 | Offset positionDependentBox({ 42 | @required Size size, 43 | @required Size childSize, 44 | @required Offset target, 45 | @required bool preferBelow, 46 | double verticalOffset = 0.0, 47 | double margin = 10.0, 48 | }) { 49 | assert(size != null); 50 | assert(childSize != null); 51 | assert(target != null); 52 | assert(verticalOffset != null); 53 | assert(preferBelow != null); 54 | assert(margin != null); 55 | // VERTICAL DIRECTION 56 | final bool fitsBelow = 57 | target.dy + verticalOffset + childSize.height <= size.height - margin; 58 | final bool fitsAbove = 59 | target.dy - verticalOffset - childSize.height >= margin; 60 | final bool tooltipBelow = 61 | preferBelow ? fitsBelow || !fitsAbove : !(fitsAbove || !fitsBelow); 62 | double y; 63 | if (tooltipBelow) 64 | y = math.min(target.dy + verticalOffset, size.height - margin); 65 | else 66 | y = math.max(target.dy - verticalOffset - childSize.height, margin); 67 | // HORIZONTAL DIRECTION 68 | double x; 69 | if (size.width - margin * 2.0 < childSize.width) { 70 | x = (size.width - childSize.width) / 2.0; 71 | } else { 72 | final double normalizedTargetX = 73 | target.dx.clamp(margin, size.width - margin); 74 | final double edge = margin + childSize.width / 2.0; 75 | if (normalizedTargetX < edge) { 76 | x = margin; 77 | } else if (normalizedTargetX > size.width - edge) { 78 | x = size.width - margin - childSize.width; 79 | } else { 80 | x = normalizedTargetX - childSize.width / 2.0; 81 | } 82 | } 83 | return new Offset(x, y); 84 | } 85 | -------------------------------------------------------------------------------- /packages/flutter_stub/lib/src/painting/image_decoder.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | import 'dart:async'; 6 | import 'dart:typed_data'; 7 | import 'package:flutter_stub_ui/ui.dart' as ui show Codec, FrameInfo, Image; 8 | 9 | import 'binding.dart'; 10 | 11 | /// Creates an image from a list of bytes. 12 | /// 13 | /// This function attempts to interpret the given bytes an image. If successful, 14 | /// the returned [Future] resolves to the decoded image. Otherwise, the [Future] 15 | /// resolves to null. 16 | /// 17 | /// If the image is animated, this returns the first frame. Consider 18 | /// [instantiateImageCodec] if support for animated images is necessary. 19 | /// 20 | /// This function differs from [ui.decodeImageFromList] in that it defers to 21 | /// [PaintingBinding.instantiateImageCodec], and therefore can be mocked in 22 | /// tests. 23 | Future decodeImageFromList(Uint8List bytes) async { 24 | final ui.Codec codec = 25 | await PaintingBinding.instance.instantiateImageCodec(bytes); 26 | final ui.FrameInfo frameInfo = await codec.getNextFrame(); 27 | return frameInfo.image; 28 | } 29 | -------------------------------------------------------------------------------- /packages/flutter_stub/lib/src/painting/paint_utilities.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | import 'dart:math' as math; 6 | 7 | import 'basic_types.dart'; 8 | 9 | /// Draw a line between two points, which cuts diagonally back and forth across 10 | /// the line that connects the two points. 11 | /// 12 | /// The line will cross the line `zigs - 1` times. 13 | /// 14 | /// If `zigs` is 1, then this will draw two sides of a triangle from `start` to 15 | /// `end`, with the third point being `width` away from the line, as measured 16 | /// perpendicular to that line. 17 | /// 18 | /// If `width` is positive, the first `zig` will be to the left of the `start` 19 | /// point when facing the `end` point. To reverse the zigging polarity, provide 20 | /// a negative `width`. 21 | /// 22 | /// The line is drawn using the provided `paint` on the provided `canvas`. 23 | void paintZigZag(Canvas canvas, Paint paint, Offset start, Offset end, int zigs, 24 | double width) { 25 | assert(zigs.isFinite); 26 | assert(zigs > 0); 27 | canvas.save(); 28 | canvas.translate(start.dx, start.dy); 29 | end = end - start; 30 | canvas.rotate(math.atan2(end.dy, end.dx)); 31 | final double length = end.distance; 32 | final double spacing = length / (zigs * 2.0); 33 | final Path path = Path()..moveTo(0.0, 0.0); 34 | for (int index = 0; index < zigs; index += 1) { 35 | final double x = (index * 2.0 + 1.0) * spacing; 36 | final double y = width * ((index % 2.0) * 2.0 - 1.0); 37 | path.lineTo(x, y); 38 | } 39 | path.lineTo(length, 0.0); 40 | canvas.drawPath(path, paint); 41 | canvas.restore(); 42 | } 43 | -------------------------------------------------------------------------------- /packages/flutter_stub/lib/src/physics/clamped_simulation.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | // Synced 2019-06-04T10:01:02.507286. 5 | 6 | import 'simulation.dart'; 7 | 8 | /// A simulation that applies limits to another simulation. 9 | /// 10 | /// The limits are only applied to the other simulation's outputs. For example, 11 | /// if a maximum position was applied to a gravity simulation with the 12 | /// particle's initial velocity being up, and the acceleration being down, and 13 | /// the maximum position being between the initial position and the curve's 14 | /// apogee, then the particle would return to its initial position in the same 15 | /// amount of time as it would have if the maximum had not been applied; the 16 | /// difference would just be that the position would be reported as pinned to 17 | /// the maximum value for the times that it would otherwise have been reported 18 | /// as higher. 19 | class ClampedSimulation extends Simulation { 20 | /// Creates a [ClampedSimulation] that clamps the given simulation. 21 | /// 22 | /// The named arguments specify the ranges for the clamping behavior, as 23 | /// applied to [x] and [dx]. 24 | ClampedSimulation( 25 | this.simulation, { 26 | this.xMin = double.negativeInfinity, 27 | this.xMax = double.infinity, 28 | this.dxMin = double.negativeInfinity, 29 | this.dxMax = double.infinity, 30 | }) : assert(simulation != null), 31 | assert(xMax >= xMin), 32 | assert(dxMax >= dxMin); 33 | 34 | /// The simulation being clamped. Calls to [x], [dx], and [isDone] are 35 | /// forwarded to the simulation. 36 | final Simulation simulation; 37 | 38 | /// The minimum to apply to [x]. 39 | final double xMin; 40 | 41 | /// The maximum to apply to [x]. 42 | final double xMax; 43 | 44 | /// The minimum to apply to [dx]. 45 | final double dxMin; 46 | 47 | /// The maximum to apply to [dx]. 48 | final double dxMax; 49 | 50 | @override 51 | double x(double time) => simulation.x(time).clamp(xMin, xMax); 52 | 53 | @override 54 | double dx(double time) => simulation.dx(time).clamp(dxMin, dxMax); 55 | 56 | @override 57 | bool isDone(double time) => simulation.isDone(time); 58 | } 59 | -------------------------------------------------------------------------------- /packages/flutter_stub/lib/src/physics/gravity_simulation.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | import 'simulation.dart'; 6 | 7 | /// A simulation that applies a constant accelerating force. 8 | /// 9 | /// Models a particle that follows Newton's second law of motion. The simulation 10 | /// ends when the position reaches a defined point. 11 | /// 12 | /// ## Sample code 13 | /// 14 | /// This method triggers an [AnimationController] (a previously constructed 15 | /// `_controller` field) to simulate a fall of 300 pixels. 16 | /// 17 | /// ```dart 18 | /// void _startFall() { 19 | /// _controller.animateWith(new GravitySimulation( 20 | /// 10.0, // acceleration, pixels per second per second 21 | /// 0.0, // starting position, pixels 22 | /// 300.0, // ending position, pixels 23 | /// 0.0, // starting velocity, pixels per second 24 | /// )); 25 | /// } 26 | /// ``` 27 | /// 28 | /// This [AnimationController] could be used with an [AnimatedBuilder] to 29 | /// animate the position of a child as if it was falling. 30 | /// 31 | /// See also: 32 | /// 33 | /// * [Curves.bounceOut], a [Curve] that has a similar aesthetics but includes 34 | /// a bouncing effect. 35 | class GravitySimulation extends Simulation { 36 | /// Creates a [GravitySimulation] using the given arguments, which are, 37 | /// respectively: an acceleration that is to be applied continually over time; 38 | /// an initial position relative to an origin; the magnitude of the distance 39 | /// from that origin beyond which (in either direction) to consider the 40 | /// simulation to be "done", which must be positive; and an initial velocity. 41 | /// 42 | /// The initial position and maximum distance are measured in arbitrary length 43 | /// units L from an arbitrary origin. The units will match those used for [x]. 44 | /// 45 | /// The time unit T used for the arguments to [x], [dx], and [isDone], 46 | /// combined with the aforementioned length unit, together determine the units 47 | /// that must be used for the velocity and acceleration arguments: L/T and 48 | /// L/T² respectively. The same units of velocity are used for the velocity 49 | /// obtained from [dx]. 50 | GravitySimulation( 51 | double acceleration, double distance, double endDistance, double velocity) 52 | : assert(acceleration != null), 53 | assert(distance != null), 54 | assert(velocity != null), 55 | assert(endDistance != null), 56 | assert(endDistance >= 0), 57 | _a = acceleration, 58 | _x = distance, 59 | _v = velocity, 60 | _end = endDistance; 61 | 62 | final double _x; 63 | final double _v; 64 | final double _a; 65 | final double _end; 66 | 67 | @override 68 | double x(double time) => _x + _v * time + 0.5 * _a * time * time; 69 | 70 | @override 71 | double dx(double time) => _v + time * _a; 72 | 73 | @override 74 | bool isDone(double time) => x(time).abs() >= _end; 75 | } 76 | -------------------------------------------------------------------------------- /packages/flutter_stub/lib/src/physics/simulation.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | import 'tolerance.dart'; 6 | 7 | /// The base class for all simulations. 8 | /// 9 | /// A simulation models an object, in a one-dimensional space, on which 10 | /// particular forces are being applied, and exposes: 11 | /// 12 | /// * The object's position, [x] 13 | /// * The object's velocity, [dx] 14 | /// * Whether the simulation is "done", [isDone] 15 | /// 16 | /// A simulation is generally "done" if the object has, to a given [tolerance], 17 | /// come to a complete rest. 18 | /// 19 | /// The [x], [dx], and [isDone] functions take a time argument which specifies 20 | /// the time for which they are to be evaluated. In principle, simulations can 21 | /// be stateless, and thus can be queried with arbitrary times. In practice, 22 | /// however, some simulations are not, and calling any of these functions will 23 | /// advance the simulation to the given time. 24 | /// 25 | /// As a general rule, therefore, a simulation should only be queried using 26 | /// times that are equal to or greater than all times previously used for that 27 | /// simulation. 28 | /// 29 | /// Simulations do not specify units for distance, velocity, and time. Client 30 | /// should establish a convention and use that convention consistently with all 31 | /// related objects. 32 | abstract class Simulation { 33 | /// Initializes the [tolerance] field for subclasses. 34 | Simulation({this.tolerance = Tolerance.defaultTolerance}); 35 | 36 | /// The position of the object in the simulation at the given time. 37 | double x(double time); 38 | 39 | /// The velocity of the object in the simulation at the given time. 40 | double dx(double time); 41 | 42 | /// Whether the simulation is "done" at the given time. 43 | bool isDone(double time); 44 | 45 | /// How close to the actual end of the simulation a value at a particular time 46 | /// must be before [isDone] considers the simulation to be "done". 47 | /// 48 | /// A simulation with an asymptotic curve would never technically be "done", 49 | /// but once the difference from the value at a particular time and the 50 | /// asymptote itself could not be seen, it would be pointless to continue. The 51 | /// tolerance defines how to determine if the difference could not be seen. 52 | Tolerance tolerance; 53 | 54 | @override 55 | String toString() => '$runtimeType'; 56 | } 57 | -------------------------------------------------------------------------------- /packages/flutter_stub/lib/src/physics/tolerance.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | /// Structure that specifies maximum allowable magnitudes for distances, 6 | /// durations, and velocity differences to be considered equal. 7 | class Tolerance { 8 | /// Creates a [Tolerance] object. By default, the distance, time, and velocity 9 | /// tolerances are all ±0.001; the constructor arguments override this. 10 | /// 11 | /// The arguments should all be positive values. 12 | const Tolerance( 13 | {this.distance = _epsilonDefault, 14 | this.time = _epsilonDefault, 15 | this.velocity = _epsilonDefault}); 16 | 17 | static const double _epsilonDefault = 1e-3; 18 | 19 | /// A default tolerance of 0.001 for all three values. 20 | static const Tolerance defaultTolerance = const Tolerance(); 21 | 22 | /// The magnitude of the maximum distance between two points for them to be 23 | /// considered within tolerance. 24 | /// 25 | /// The units for the distance tolerance must be the same as the units used 26 | /// for the distances that are to be compared to this tolerance. 27 | final double distance; 28 | 29 | /// The magnitude of the maximum duration between two times for them to be 30 | /// considered within tolerance. 31 | /// 32 | /// The units for the time tolerance must be the same as the units used 33 | /// for the times that are to be compared to this tolerance. 34 | final double time; 35 | 36 | /// The magnitude of the maximum difference between two velocities for them to 37 | /// be considered within tolerance. 38 | /// 39 | /// The units for the velocity tolerance must be the same as the units used 40 | /// for the velocities that are to be compared to this tolerance. 41 | final double velocity; 42 | 43 | @override 44 | String toString() => 45 | 'Tolerance(distance: ±$distance, time: ±$time, velocity: ±$velocity)'; 46 | } 47 | -------------------------------------------------------------------------------- /packages/flutter_stub/lib/src/physics/utils.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | /// Whether two doubles are within a given distance of each other. 6 | /// 7 | /// The `epsilon` argument must be positive and not null. 8 | /// The `a` and `b` arguments may be null. A null value is only considered 9 | /// near-equal to another null value. 10 | bool nearEqual(double a, double b, double epsilon) { 11 | assert(epsilon != null); 12 | assert(epsilon >= 0.0); 13 | if (a == null || b == null) return a == b; 14 | return (a > (b - epsilon)) && (a < (b + epsilon)) || a == b; 15 | } 16 | 17 | /// Whether a double is within a given distance of zero. 18 | /// 19 | /// The epsilon argument must be positive. 20 | bool nearZero(double a, double epsilon) => nearEqual(a, 0.0, epsilon); 21 | -------------------------------------------------------------------------------- /packages/flutter_stub/lib/src/rendering/tweens.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | import 'package:flutter_stub/animation.dart'; 6 | import 'package:flutter_stub/painting.dart'; 7 | 8 | /// An interpolation between two fractional offsets. 9 | /// 10 | /// This class specializes the interpolation of [Tween] to be 11 | /// appropriate for fractional offsets. 12 | /// 13 | /// See [Tween] for a discussion on how to use interpolation objects. 14 | /// 15 | /// See also: 16 | /// 17 | /// * [AlignmentTween], which interpolates between to [Alignment] objects. 18 | class FractionalOffsetTween extends Tween { 19 | /// Creates a fractional offset tween. 20 | /// 21 | /// The [begin] and [end] properties may be null; the null value 22 | /// is treated as meaning the center. 23 | FractionalOffsetTween({FractionalOffset begin, FractionalOffset end}) 24 | : super(begin: begin, end: end); 25 | 26 | /// Returns the value this variable has at the given animation clock value. 27 | @override 28 | FractionalOffset lerp(double t) => FractionalOffset.lerp(begin, end, t); 29 | } 30 | 31 | /// An interpolation between two alignments. 32 | /// 33 | /// This class specializes the interpolation of [Tween] to be 34 | /// appropriate for alignments. 35 | /// 36 | /// See [Tween] for a discussion on how to use interpolation objects. 37 | /// 38 | /// See also: 39 | /// 40 | /// * [AlignmentGeometryTween], which interpolates between two 41 | /// [AlignmentGeometry] objects. 42 | class AlignmentTween extends Tween { 43 | /// Creates a fractional offset tween. 44 | /// 45 | /// The [begin] and [end] properties may be null; the null value 46 | /// is treated as meaning the center. 47 | AlignmentTween({Alignment begin, Alignment end}) 48 | : super(begin: begin, end: end); 49 | 50 | /// Returns the value this variable has at the given animation clock value. 51 | @override 52 | Alignment lerp(double t) => Alignment.lerp(begin, end, t); 53 | } 54 | 55 | /// An interpolation between two [AlignmentGeometry]. 56 | /// 57 | /// This class specializes the interpolation of [Tween] 58 | /// to be appropriate for alignments. 59 | /// 60 | /// See [Tween] for a discussion on how to use interpolation objects. 61 | /// 62 | /// See also: 63 | /// 64 | /// * [AlignmentTween], which interpolates between two [Alignment] objects. 65 | class AlignmentGeometryTween extends Tween { 66 | /// Creates a fractional offset geometry tween. 67 | /// 68 | /// The [begin] and [end] properties may be null; the null value 69 | /// is treated as meaning the center. 70 | AlignmentGeometryTween({ 71 | AlignmentGeometry begin, 72 | AlignmentGeometry end, 73 | }) : super(begin: begin, end: end); 74 | 75 | /// Returns the value this variable has at the given animation clock value. 76 | @override 77 | AlignmentGeometry lerp(double t) => AlignmentGeometry.lerp(begin, end, t); 78 | } 79 | -------------------------------------------------------------------------------- /packages/flutter_stub/lib/src/scheduler/debug.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | import 'package:flutter_stub/foundation.dart'; 6 | 7 | // Any changes to this file should be reflected in the 8 | // debugAssertAllSchedulerVarsUnset() function below. 9 | 10 | /// Print a banner at the beginning of each frame. 11 | /// 12 | /// Frames triggered by the engine and handler by the scheduler binding will 13 | /// have a banner giving the frame number and the time stamp of the frame. 14 | /// 15 | /// Frames triggered eagerly by the widget framework (e.g. when calling 16 | /// [runApp]) will have a label saying "warm-up frame" instead of the time stamp 17 | /// (the time stamp sent to frame callbacks in that case is the time of the last 18 | /// frame, or 0:00 if it is the first frame). 19 | /// 20 | /// To include a banner at the end of each frame as well, to distinguish 21 | /// intra-frame output from inter-frame output, set [debugPrintEndFrameBanner] 22 | /// to true as well. 23 | /// 24 | /// See also: 25 | /// 26 | /// * [debugProfilePaintsEnabled], which does something similar for 27 | /// painting but using the timeline view. 28 | /// 29 | /// * [debugPrintLayouts], which does something similar for layout but using 30 | /// console output. 31 | /// 32 | /// * The discussions at [WidgetsBinding.drawFrame] and at 33 | /// [SchedulerBinding.handleBeginFrame]. 34 | bool debugPrintBeginFrameBanner = false; 35 | 36 | /// Print a banner at the end of each frame. 37 | /// 38 | /// Combined with [debugPrintBeginFrameBanner], this can be helpful for 39 | /// determining if code is running during a frame or between frames. 40 | bool debugPrintEndFrameBanner = false; 41 | 42 | /// Log the call stacks that cause a frame to be scheduled. 43 | /// 44 | /// This is called whenever [SchedulerBinding.scheduleFrame] schedules a frame. 45 | /// This can happen for various reasons, e.g. when a [Ticker] or 46 | /// [AnimationController] is started, or when [RenderObject.markNeedsLayout] is 47 | /// called, or when [State.setState] is called. 48 | /// 49 | /// To get a stack specifically when widgets are scheduled to be built, see 50 | /// [debugPrintScheduleBuildForStacks]. 51 | bool debugPrintScheduleFrameStacks = false; 52 | 53 | /// Returns true if none of the scheduler library debug variables have been 54 | /// changed. 55 | /// 56 | /// This function is used by the test framework to ensure that debug variables 57 | /// haven't been inadvertently changed. 58 | /// 59 | /// See [https://docs.flutter.io/flutter/scheduler/scheduler-library.html] for 60 | /// a complete list. 61 | bool debugAssertAllSchedulerVarsUnset(String reason) { 62 | assert(() { 63 | if (debugPrintBeginFrameBanner || debugPrintEndFrameBanner) { 64 | throw new FlutterError(reason); 65 | } 66 | return true; 67 | }()); 68 | return true; 69 | } 70 | -------------------------------------------------------------------------------- /packages/flutter_stub/lib/src/scheduler/priority.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | import 'package:flutter_stub/foundation.dart'; 6 | 7 | /// A task priority, as passed to [SchedulerBinding.scheduleTask]. 8 | @immutable 9 | class Priority { 10 | const Priority._(this._value); 11 | 12 | /// The integer that describes this Priority value. 13 | int get value => _value; 14 | final int _value; 15 | 16 | /// A task to run after all other tasks, when no animations are running. 17 | static const Priority idle = Priority._(0); 18 | 19 | /// A task to run even when animations are running. 20 | static const Priority animation = Priority._(100000); 21 | 22 | /// A task to run even when the user is interacting with the device. 23 | static const Priority touch = Priority._(200000); 24 | 25 | /// Maximum offset by which to clamp relative priorities. 26 | /// 27 | /// It is still possible to have priorities that are offset by more 28 | /// than this amount by repeatedly taking relative offsets, but that 29 | /// is generally discouraged. 30 | static const int kMaxOffset = 10000; 31 | 32 | /// Returns a priority relative to this priority. 33 | /// 34 | /// A positive [offset] indicates a higher priority. 35 | /// 36 | /// The parameter [offset] is clamped to ±[kMaxOffset]. 37 | Priority operator +(int offset) { 38 | if (offset.abs() > kMaxOffset) { 39 | // Clamp the input offset. 40 | offset = kMaxOffset * offset.sign; 41 | } 42 | return Priority._(_value + offset); 43 | } 44 | 45 | /// Returns a priority relative to this priority. 46 | /// 47 | /// A positive offset indicates a lower priority. 48 | /// 49 | /// The parameter [offset] is clamped to ±[kMaxOffset]. 50 | Priority operator -(int offset) => this + (-offset); 51 | } 52 | -------------------------------------------------------------------------------- /packages/flutter_stub/lib/src/semantics/binding.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | import 'package:flutter_stub_ui/ui.dart' as ui 6 | show AccessibilityFeatures, window; 7 | 8 | import 'package:flutter_stub/foundation.dart'; 9 | 10 | import 'debug.dart'; 11 | 12 | export 'package:flutter_stub_ui/ui.dart' show AccessibilityFeatures; 13 | 14 | /// The glue between the semantics layer and the Flutter engine. 15 | // TODO(jonahwilliams): move the remaining semantic related bindings here. 16 | mixin SemanticsBinding on BindingBase { 17 | /// The current [SemanticsBinding], if one has been created. 18 | static SemanticsBinding get instance => _instance; 19 | static SemanticsBinding _instance; 20 | 21 | @override 22 | void initInstances() { 23 | super.initInstances(); 24 | _instance = this; 25 | _accessibilityFeatures = ui.window.accessibilityFeatures; 26 | } 27 | 28 | /// Called when the platform accessibility features change. 29 | /// 30 | /// See [Window.onAccessibilityFeaturesChanged]. 31 | @protected 32 | void handleAccessibilityFeaturesChanged() { 33 | _accessibilityFeatures = ui.window.accessibilityFeatures; 34 | } 35 | 36 | /// The currently active set of [AccessibilityFeatures]. 37 | /// 38 | /// This is initialized the first time [runApp] is called and updated whenever 39 | /// a flag is changed. 40 | /// 41 | /// To listen to changes to accessibility features, create a 42 | /// [WidgetsBindingObserver] and listen to [didChangeAccessibilityFeatures]. 43 | ui.AccessibilityFeatures get accessibilityFeatures => _accessibilityFeatures; 44 | ui.AccessibilityFeatures _accessibilityFeatures; 45 | 46 | /// The platform is requesting that animations be disabled or simplified. 47 | /// 48 | /// This setting can be overriden for testing or debugging by setting 49 | /// [debugSemanticsDisableAnimations]. 50 | bool get disableAnimations { 51 | bool value = _accessibilityFeatures.disableAnimations; 52 | assert(() { 53 | if (debugSemanticsDisableAnimations != null) 54 | value = debugSemanticsDisableAnimations; 55 | return true; 56 | }()); 57 | return value; 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /packages/flutter_stub/lib/src/semantics/debug.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | /// Overrides the setting of [SemanticsBinding.disableAnimations] for debugging 6 | /// and testing. 7 | /// 8 | /// This value is ignored in non-debug builds. 9 | bool debugSemanticsDisableAnimations; 10 | -------------------------------------------------------------------------------- /packages/flutter_stub/lib/src/semantics/semantics_service.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | import 'dart:async'; 6 | import 'package:flutter_stub_ui/ui.dart' show TextDirection; 7 | 8 | import 'package:flutter_stub/services.dart' show SystemChannels; 9 | 10 | import 'semantics_event.dart' 11 | show AnnounceSemanticsEvent, TooltipSemanticsEvent; 12 | 13 | /// Allows access to the platform's accessibility services. 14 | /// 15 | /// Events sent by this service are handled by the platform-specific 16 | /// accessibility bridge in Flutter's engine. 17 | /// 18 | /// When possible, prefer using mechanisms like [Semantics] to implicitly 19 | /// trigger announcements over using this event. 20 | class SemanticsService { 21 | SemanticsService._(); 22 | 23 | /// Sends a semantic announcement. 24 | /// 25 | /// This should be used for announcement that are not seamlessly announced by 26 | /// the system as a result of a UI state change. 27 | /// 28 | /// For example a camera application can use this method to make accessibility 29 | /// announcements regarding objects in the viewfinder. 30 | static Future announce( 31 | String message, TextDirection textDirection) async { 32 | final AnnounceSemanticsEvent event = 33 | new AnnounceSemanticsEvent(message, textDirection); 34 | await SystemChannels.accessibility.send(event.toMap()); 35 | } 36 | 37 | /// Sends a semantic announcement of a tooltip. 38 | /// 39 | /// Currently only honored on Android. The contents of [message] will be 40 | /// read by TalkBack. 41 | static Future tooltip(String message) async { 42 | final TooltipSemanticsEvent event = new TooltipSemanticsEvent(message); 43 | await SystemChannels.accessibility.send(event.toMap()); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /packages/flutter_stub/lib/src/services/clipboard.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | import 'dart:async'; 6 | 7 | import 'package:flutter_stub/foundation.dart'; 8 | 9 | import 'system_channels.dart'; 10 | 11 | /// Data stored on the system clipboard. 12 | /// 13 | /// The system clipboard can contain data of various media types. This data 14 | /// structure currently supports only plain text data, in the [text] property. 15 | @immutable 16 | class ClipboardData { 17 | /// Creates data for the system clipboard. 18 | const ClipboardData({this.text}); 19 | 20 | /// Plain text variant of this clipboard data. 21 | final String text; 22 | } 23 | 24 | /// Utility methods for interacting with the system's clipboard. 25 | class Clipboard { 26 | Clipboard._(); 27 | 28 | // Constants for common [getData] [format] types. 29 | 30 | /// Plain text data format string. 31 | /// 32 | /// Used with [getData]. 33 | static const String kTextPlain = 'text/plain'; 34 | 35 | /// Stores the given clipboard data on the clipboard. 36 | static Future setData(ClipboardData data) async { 37 | await SystemChannels.platform.invokeMethod( 38 | 'Clipboard.setData', 39 | { 40 | 'text': data.text, 41 | }, 42 | ); 43 | } 44 | 45 | /// Retrieves data from the clipboard that matches the given format. 46 | /// 47 | /// The `format` argument specifies the media type, such as `text/plain`, of 48 | /// the data to obtain. 49 | /// 50 | /// Returns a future which completes to null if the data could not be 51 | /// obtained, and to a [ClipboardData] object if it could. 52 | static Future getData(String format) async { 53 | final Map result = 54 | await SystemChannels.platform.invokeMethod( 55 | 'Clipboard.getData', 56 | format, 57 | ); 58 | if (result == null) return null; 59 | return ClipboardData(text: result['text']); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /packages/flutter_stub/lib/src/services/haptic_feedback.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | import 'dart:async'; 6 | 7 | import 'system_channels.dart'; 8 | 9 | /// Allows access to the haptic feedback interface on the device. 10 | /// 11 | /// This API is intentionally terse since it calls default platform behavior. It 12 | /// is not suitable for precise control of the system's haptic feedback module. 13 | class HapticFeedback { 14 | HapticFeedback._(); 15 | 16 | /// Provides vibration haptic feedback to the user for a short duration. 17 | /// 18 | /// On iOS devices that support haptic feedback, this uses the default system 19 | /// vibration value (`kSystemSoundID_Vibrate`). 20 | /// 21 | /// On Android, this uses the platform haptic feedback API to simulate a 22 | /// response to a long press (`HapticFeedbackConstants.LONG_PRESS`). 23 | static Future vibrate() async { 24 | await SystemChannels.platform.invokeMethod('HapticFeedback.vibrate'); 25 | } 26 | 27 | /// Provides a haptic feedback corresponding a collision impact with a light 28 | /// mass. 29 | /// 30 | /// On iOS versions 10 and above, this uses a `UIImpactFeedbackGenerator` with 31 | /// `UIImpactFeedbackStyleLight`. This call has no effects on iOS versions 32 | /// below 10. 33 | /// 34 | /// On Android, this uses `HapticFeedbackConstants.VIRTUAL_KEY`. 35 | static Future lightImpact() async { 36 | await SystemChannels.platform.invokeMethod( 37 | 'HapticFeedback.vibrate', 38 | 'HapticFeedbackType.lightImpact', 39 | ); 40 | } 41 | 42 | /// Provides a haptic feedback corresponding a collision impact with a medium 43 | /// mass. 44 | /// 45 | /// On iOS versions 10 and above, this uses a `UIImpactFeedbackGenerator` with 46 | /// `UIImpactFeedbackStyleMedium`. This call has no effects on iOS versions 47 | /// below 10. 48 | /// 49 | /// On Android, this uses `HapticFeedbackConstants.KEYBOARD_TAP`. 50 | static Future mediumImpact() async { 51 | await SystemChannels.platform.invokeMethod( 52 | 'HapticFeedback.vibrate', 53 | 'HapticFeedbackType.mediumImpact', 54 | ); 55 | } 56 | 57 | /// Provides a haptic feedback corresponding a collision impact with a heavy 58 | /// mass. 59 | /// 60 | /// On iOS versions 10 and above, this uses a `UIImpactFeedbackGenerator` with 61 | /// `UIImpactFeedbackStyleHeavy`. This call has no effects on iOS versions 62 | /// below 10. 63 | /// 64 | /// On Android, this uses `HapticFeedbackConstants.CONTEXT_CLICK` on API 65 | /// levels 23 and above. This call has no effects on Android API levels 66 | /// below 23. 67 | static Future heavyImpact() async { 68 | await SystemChannels.platform.invokeMethod( 69 | 'HapticFeedback.vibrate', 70 | 'HapticFeedbackType.heavyImpact', 71 | ); 72 | } 73 | 74 | /// Provides a haptic feedback indication selection changing through discrete 75 | /// values. 76 | /// 77 | /// On iOS versions 10 and above, this uses a `UISelectionFeedbackGenerator`. 78 | /// This call has no effects on iOS versions below 10. 79 | /// 80 | /// On Android, this uses `HapticFeedbackConstants.CLOCK_TICK`. 81 | static Future selectionClick() async { 82 | await SystemChannels.platform.invokeMethod( 83 | 'HapticFeedback.vibrate', 84 | 'HapticFeedbackType.selectionClick', 85 | ); 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /packages/flutter_stub/lib/src/services/system_navigator.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | import 'dart:async'; 6 | 7 | import 'system_channels.dart'; 8 | 9 | /// Controls specific aspects of the system navigation stack. 10 | class SystemNavigator { 11 | SystemNavigator._(); 12 | 13 | /// Instructs the system navigator to remove this activity from the stack and 14 | /// return to the previous activity. 15 | /// 16 | /// On iOS, calls to this method are ignored because Apple's human interface 17 | /// guidelines state that applications should not exit themselves. 18 | /// 19 | /// This method should be preferred over calling `dart:io`'s [exit] method, as 20 | /// the latter may cause the underlying platform to act as if the application 21 | /// had crashed. 22 | static Future pop() async { 23 | await SystemChannels.platform.invokeMethod('SystemNavigator.pop'); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /packages/flutter_stub/lib/src/services/system_sound.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | import 'dart:async'; 6 | 7 | import 'system_channels.dart'; 8 | 9 | /// A sound provided by the system. 10 | enum SystemSoundType { 11 | /// A short indication that a button was pressed. 12 | click, 13 | } 14 | 15 | /// Provides access to the library of short system specific sounds for common 16 | /// tasks. 17 | class SystemSound { 18 | SystemSound._(); 19 | 20 | /// Play the specified system sound. If that sound is not present on the 21 | /// system, the call is ignored. 22 | static Future play(SystemSoundType type) async { 23 | await SystemChannels.platform.invokeMethod( 24 | 'SystemSound.play', 25 | type.toString(), 26 | ); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /packages/flutter_stub/lib/src/util.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | /// Use this function to guard debugging code. When Dart is compiled in 6 | /// production mode, the code guarded using this function will be tree 7 | /// shaken away, reducing code size. 8 | /// 9 | /// WARNING: DO NOT CHANGE THIS METHOD! This method is designed to have no 10 | /// more AST nodes than the maximum allowed by dart2js to inline it. In 11 | /// addition, the use of `assert` allows the compiler to statically compute 12 | /// the value returned by this function and tree shake conditions guarded by 13 | /// it. 14 | /// 15 | /// Example: 16 | /// 17 | /// if (assertionsEnabled) { 18 | /// ...code here is tree shaken away in prod mode... 19 | /// } 20 | bool get assertionsEnabled { 21 | var k = false; 22 | assert(k = true); 23 | return k; 24 | } 25 | 26 | /// Whether this program runs in a WidgetTester test environment. 27 | bool debugIsInTest = false; 28 | -------------------------------------------------------------------------------- /packages/flutter_stub/lib/src/widgets/annotated_region.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | import 'package:flutter_stub/foundation.dart'; 6 | import 'package:flutter_stub/rendering.dart'; 7 | 8 | import 'framework.dart'; 9 | 10 | /// Annotates a region of the layer tree with a value. 11 | /// 12 | /// See also: 13 | /// 14 | /// * [Layer.find], for an example of how this value is retrieved. 15 | /// * [AnnotatedRegionLayer], the layer pushed into the layer tree. 16 | class AnnotatedRegion extends SingleChildRenderObjectWidget { 17 | /// Creates a new annotated region to insert [value] into the layer tree. 18 | /// 19 | /// Neither [child] nor [value] may be null. 20 | /// 21 | /// [sized] defaults to true and controls whether the annotated region will 22 | /// clip its child. 23 | const AnnotatedRegion({ 24 | Key key, 25 | @required Widget child, 26 | @required this.value, 27 | this.sized = true, 28 | }) : assert(value != null), 29 | assert(child != null), 30 | super(key: key, child: child); 31 | 32 | /// A value which can be retrieved using [Layer.find]. 33 | final T value; 34 | 35 | /// If false, the layer pushed into the tree will not be provided with a size. 36 | /// 37 | /// An [AnnotatedRegionLayer] with a size checks that the offset provided in 38 | /// [Layer.find] is within the bounds, returning null otherwise. 39 | /// 40 | /// See also: 41 | /// 42 | /// * [AnnotatedRegionLayer], for a description of this behavior. 43 | final bool sized; 44 | 45 | @override 46 | RenderObject createRenderObject(BuildContext context) { 47 | return RenderAnnotatedRegion(value: value, sized: sized); 48 | } 49 | 50 | @override 51 | void updateRenderObject( 52 | BuildContext context, RenderAnnotatedRegion renderObject) { 53 | renderObject 54 | ..value = value 55 | ..sized = sized; 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /packages/flutter_stub/lib/src/widgets/bottom_navigation_bar_item.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | // Synced 2019-05-30T14:20:56.690027. 5 | 6 | import 'package:flutter_stub_ui/ui.dart' show Color; 7 | 8 | import 'framework.dart'; 9 | 10 | /// An interactive button within either material's [BottomNavigationBar] 11 | /// or the iOS themed [CupertinoTabBar] with an icon and title. 12 | /// 13 | /// This class is rarely used in isolation. It is typically embedded in one of 14 | /// the bottom navigation widgets above. 15 | /// 16 | /// See also: 17 | /// 18 | /// * [BottomNavigationBar] 19 | /// * 20 | /// * [CupertinoTabBar] 21 | /// * 22 | class BottomNavigationBarItem { 23 | /// Creates an item that is used with [BottomNavigationBar.items]. 24 | /// 25 | /// The argument [icon] should not be null and the argument [title] should not be null when used in a Material Design's [BottomNavigationBar]. 26 | const BottomNavigationBarItem({ 27 | @required this.icon, 28 | this.title, 29 | Widget activeIcon, 30 | this.backgroundColor, 31 | }) : activeIcon = activeIcon ?? icon, 32 | assert(icon != null); 33 | 34 | /// The icon of the item. 35 | /// 36 | /// Typically the icon is an [Icon] or an [ImageIcon] widget. If another type 37 | /// of widget is provided then it should configure itself to match the current 38 | /// [IconTheme] size and color. 39 | /// 40 | /// If [activeIcon] is provided, this will only be displayed when the item is 41 | /// not selected. 42 | /// 43 | /// To make the bottom navigation bar more accessible, consider choosing an 44 | /// icon with a stroked and filled version, such as [Icons.cloud] and 45 | /// [Icons.cloud_queue]. [icon] should be set to the stroked version and 46 | /// [activeIcon] to the filled version. 47 | /// 48 | /// If a particular icon doesn't have a stroked or filled version, then don't 49 | /// pair unrelated icons. Instead, make sure to use a 50 | /// [BottomNavigationBarType.shifting]. 51 | final Widget icon; 52 | 53 | /// An alternative icon displayed when this bottom navigation item is 54 | /// selected. 55 | /// 56 | /// If this icon is not provided, the bottom navigation bar will display 57 | /// [icon] in either state. 58 | /// 59 | /// See also: 60 | /// 61 | /// * [BottomNavigationBarItem.icon], for a description of how to pair icons. 62 | final Widget activeIcon; 63 | 64 | /// The title of the item. If the title is not provided only the icon will be shown when not used in a Material Design [BottomNavigationBar]. 65 | final Widget title; 66 | 67 | /// The color of the background radial animation for material [BottomNavigationBar]. 68 | /// 69 | /// If the navigation bar's type is [BottomNavigationBarType.shifting], then 70 | /// the entire bar is flooded with the [backgroundColor] when this item is 71 | /// tapped. This will override [BottomNavigationBar.backgroundColor]. 72 | /// 73 | /// Not used for [CupertinoTabBar]. Control the invariant bar color directly 74 | /// via [CupertinoTabBar.backgroundColor]. 75 | /// 76 | /// See also: 77 | /// 78 | /// * [Icon.color] and [ImageIcon.color] to control the foreground color of 79 | /// the icons themselves. 80 | final Color backgroundColor; 81 | } 82 | -------------------------------------------------------------------------------- /packages/flutter_stub/lib/src/widgets/icon_data.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | import 'package:flutter_stub/src/util.dart'; 6 | import 'package:flutter_stub_ui/ui.dart'; 7 | import 'package:flutter_stub/foundation.dart'; 8 | 9 | /// A description of an icon fulfilled by a font glyph. 10 | /// 11 | /// See [Icons] for a number of predefined icons available for material 12 | /// design applications. 13 | @immutable 14 | class IconData { 15 | /// Creates icon data. 16 | /// 17 | /// Rarely used directly. Instead, consider using one of the predefined icons 18 | /// like the [Icons] collection. 19 | /// 20 | /// The [fontPackage] argument must be non-null when using a font family that 21 | /// is included in a package. This is used when selecting the font. 22 | const IconData( 23 | this.codePoint, { 24 | this.fontFamily, 25 | this.fontPackage, 26 | this.matchTextDirection = false, 27 | }); 28 | 29 | /// The Unicode code point at which this icon is stored in the icon font. 30 | final int codePoint; 31 | 32 | /// The font family from which the glyph for the [codePoint] will be selected. 33 | final String fontFamily; 34 | 35 | /// The name of the package from which the font family is included. 36 | /// 37 | /// The name is used by the [Icon] widget when configuring the [TextStyle] so 38 | /// that the given [fontFamily] is obtained from the appropriate asset. 39 | /// 40 | /// See also: 41 | /// 42 | /// * [TextStyle], which describes how to use fonts from other packages. 43 | final String fontPackage; 44 | 45 | /// Whether this icon should be automatically mirrored in right-to-left 46 | /// environments. 47 | /// 48 | /// The [Icon] widget respects this value by mirroring the icon when the 49 | /// [Directionality] is [TextDirection.rtl]. 50 | final bool matchTextDirection; 51 | 52 | @override 53 | bool operator ==(dynamic other) { 54 | if (runtimeType != other.runtimeType) return false; 55 | final IconData typedOther = other; 56 | return codePoint == typedOther.codePoint && 57 | fontFamily == typedOther.fontFamily && 58 | fontPackage == typedOther.fontPackage && 59 | matchTextDirection == typedOther.matchTextDirection; 60 | } 61 | 62 | @override 63 | int get hashCode => 64 | hashValues(codePoint, fontFamily, fontPackage, matchTextDirection); 65 | 66 | @override 67 | String toString() { 68 | if (assertionsEnabled) { 69 | var data = codePoint.toRadixString(16).toUpperCase().padLeft(5, '0'); 70 | return 'IconData(U+$data)'; 71 | } else { 72 | return super.toString(); 73 | } 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /packages/flutter_stub/lib/src/widgets/icon_theme.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | import 'package:flutter_stub/foundation.dart'; 6 | 7 | import 'basic.dart'; 8 | import 'framework.dart'; 9 | import 'icon_theme_data.dart'; 10 | 11 | /// Controls the default color, opacity, and size of icons in a widget subtree. 12 | /// 13 | /// The icon theme is honored by [Icon] and [ImageIcon] widgets. 14 | class IconTheme extends InheritedWidget { 15 | /// Creates an icon theme that controls the color, opacity, and size of 16 | /// descendant widgets. 17 | /// 18 | /// Both [data] and [child] arguments must not be null. 19 | const IconTheme({ 20 | Key key, 21 | @required this.data, 22 | @required Widget child, 23 | }) : assert(data != null), 24 | assert(child != null), 25 | super(key: key, child: child); 26 | 27 | /// Creates an icon theme that controls the color, opacity, and size of 28 | /// descendant widgets, and merges in the current icon theme, if any. 29 | /// 30 | /// The [data] and [child] arguments must not be null. 31 | static Widget merge({ 32 | Key key, 33 | @required IconThemeData data, 34 | @required Widget child, 35 | }) { 36 | return Builder( 37 | builder: (BuildContext context) { 38 | return IconTheme( 39 | key: key, 40 | data: _getInheritedIconThemeData(context).merge(data), 41 | child: child, 42 | ); 43 | }, 44 | ); 45 | } 46 | 47 | /// The color, opacity, and size to use for icons in this subtree. 48 | final IconThemeData data; 49 | 50 | /// The data from the closest instance of this class that encloses the given 51 | /// context. 52 | /// 53 | /// Defaults to the current [ThemeData.iconTheme]. 54 | /// 55 | /// Typical usage is as follows: 56 | /// 57 | /// ```dart 58 | /// IconThemeData theme = IconTheme.of(context); 59 | /// ``` 60 | static IconThemeData of(BuildContext context) { 61 | final IconThemeData iconThemeData = _getInheritedIconThemeData(context); 62 | return iconThemeData.isConcrete 63 | ? iconThemeData 64 | : const IconThemeData.fallback().merge(iconThemeData); 65 | } 66 | 67 | static IconThemeData _getInheritedIconThemeData(BuildContext context) { 68 | final IconTheme iconTheme = context.inheritFromWidgetOfExactType(IconTheme); 69 | return iconTheme?.data ?? const IconThemeData.fallback(); 70 | } 71 | 72 | @override 73 | bool updateShouldNotify(IconTheme oldWidget) => data != oldWidget.data; 74 | 75 | @override 76 | void debugFillProperties(DiagnosticPropertiesBuilder properties) { 77 | super.debugFillProperties(properties); 78 | properties 79 | .add(DiagnosticsProperty('data', data, showName: false)); 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /packages/flutter_stub/lib/src/widgets/orientation_builder.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | import 'basic.dart'; 6 | import 'framework.dart'; 7 | import 'layout_builder.dart'; 8 | import 'media_query.dart'; 9 | 10 | /// Signature for a function that builds a widget given an [Orientation]. 11 | /// 12 | /// Used by [OrientationBuilder.builder]. 13 | typedef OrientationWidgetBuilder = Widget Function( 14 | BuildContext context, Orientation orientation); 15 | 16 | /// Builds a widget tree that can depend on the parent widget's orientation 17 | /// (distinct from the device orientation). 18 | /// 19 | /// See also: 20 | /// 21 | /// * [LayoutBuilder], which exposes the complete constraints, not just the 22 | /// orientation. 23 | /// * [CustomSingleChildLayout], which positions its child during layout. 24 | /// * [CustomMultiChildLayout], with which you can define the precise layout 25 | /// of a list of children during the layout phase. 26 | class OrientationBuilder extends StatelessWidget { 27 | /// Creates an orientation builder. 28 | /// 29 | /// The [builder] argument must not be null. 30 | const OrientationBuilder({ 31 | Key key, 32 | @required this.builder, 33 | }) : assert(builder != null), 34 | super(key: key); 35 | 36 | /// Builds the widgets below this widget given this widget's orientation. 37 | /// 38 | /// A widget's orientation is simply a factor of its width relative to its 39 | /// height. For example, a [Column] widget will have a landscape orientation 40 | /// if its width exceeds its height, even though it displays its children in 41 | /// a vertical array. 42 | final OrientationWidgetBuilder builder; 43 | 44 | Widget _buildWithConstraints( 45 | BuildContext context, BoxConstraints constraints) { 46 | // If the constraints are fully unbounded (i.e., maxWidth and maxHeight are 47 | // both infinite), we prefer Orientation.portrait because its more common to 48 | // scroll vertically then horizontally. 49 | final Orientation orientation = constraints.maxWidth > constraints.maxHeight 50 | ? Orientation.landscape 51 | : Orientation.portrait; 52 | return builder(context, orientation); 53 | } 54 | 55 | @override 56 | Widget build(BuildContext context) { 57 | return LayoutBuilder(builder: _buildWithConstraints); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /packages/flutter_stub/lib/src/widgets/placeholder.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | import 'package:flutter_stub/rendering.dart'; 6 | import 'basic.dart'; 7 | import 'framework.dart'; 8 | 9 | class _PlaceholderPainter extends CustomPainter { 10 | const _PlaceholderPainter({ 11 | this.color, 12 | this.strokeWidth, 13 | }); 14 | 15 | final Color color; 16 | final double strokeWidth; 17 | 18 | @override 19 | void paint(Canvas canvas, Size size) { 20 | final Paint paint = new Paint() 21 | ..color = color 22 | ..style = PaintingStyle.stroke 23 | ..strokeWidth = strokeWidth; 24 | final Rect rect = Offset.zero & size; 25 | final Path path = new Path() 26 | ..addRect(rect) 27 | ..addPolygon([rect.topRight, rect.bottomLeft], false) 28 | ..addPolygon([rect.topLeft, rect.bottomRight], false); 29 | canvas.drawPath(path, paint); 30 | } 31 | 32 | @override 33 | bool shouldRepaint(_PlaceholderPainter oldPainter) { 34 | return oldPainter.color != color || oldPainter.strokeWidth != strokeWidth; 35 | } 36 | 37 | @override 38 | bool hitTest(Offset position) => false; 39 | } 40 | 41 | /// A widget that draws a box that represents where other widgets will one day 42 | /// be added. 43 | /// 44 | /// This widget is useful during development to indicate that the interface is 45 | /// not yet complete. 46 | /// 47 | /// By default, the placeholder is sized to fit its container. If the 48 | /// placeholder is in an unbounded space, it will size itself according to the 49 | /// given [fallbackWidth] and [fallbackHeight]. 50 | class Placeholder extends StatelessWidget { 51 | /// Creates a widget which draws a box. 52 | const Placeholder({ 53 | Key key, 54 | this.color = const Color(0xFF455A64), // Blue Grey 700 55 | this.strokeWidth = 2.0, 56 | this.fallbackWidth = 400.0, 57 | this.fallbackHeight = 400.0, 58 | }) : super(key: key); 59 | 60 | /// The color to draw the placeholder box. 61 | final Color color; 62 | 63 | /// The width of the lines in the placeholder box. 64 | final double strokeWidth; 65 | 66 | /// The width to use when the placeholder is in a situation with an unbounded 67 | /// width. 68 | /// 69 | /// See also: 70 | /// 71 | /// * [fallbackHeight], the same but vertically. 72 | final double fallbackWidth; 73 | 74 | /// The height to use when the placeholder is in a situation with an unbounded 75 | /// height. 76 | /// 77 | /// See also: 78 | /// 79 | /// * [fallbackWidth], the same but horizontally. 80 | final double fallbackHeight; 81 | 82 | @override 83 | Widget build(BuildContext context) { 84 | return new LimitedBox( 85 | maxWidth: fallbackWidth, 86 | maxHeight: fallbackHeight, 87 | child: new CustomPaint( 88 | size: Size.infinite, 89 | foregroundPainter: new _PlaceholderPainter( 90 | color: color, 91 | strokeWidth: strokeWidth, 92 | ), 93 | ), 94 | ); 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /packages/flutter_stub/lib/src/widgets/preferred_size.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | import 'package:flutter_stub/rendering.dart'; 6 | 7 | import 'basic.dart'; 8 | import 'framework.dart'; 9 | 10 | /// An interface for widgets that can return the size this widget would prefer 11 | /// if it were otherwise unconstrained. 12 | /// 13 | /// There are a few cases, notably [AppBar] and [TabBar], where it would be 14 | /// undesirable for the widget to constrain its own size but where the widget 15 | /// needs to expose a preferred or "default" size. For example a primary 16 | /// [Scaffold] sets its app bar height to the app bar's preferred height 17 | /// plus the height of the system status bar. 18 | /// 19 | /// Use [PreferredSize] to give a preferred size to an arbitrary widget. 20 | abstract class PreferredSizeWidget implements Widget { 21 | /// The size this widget would prefer if it were otherwise unconstrained. 22 | /// 23 | /// In many cases it's only necessary to define one preferred dimension. 24 | /// For example the [Scaffold] only depends on its app bar's preferred 25 | /// height. In that case implementations of this method can just return 26 | /// `new Size.fromHeight(myAppBarHeight)`; 27 | Size get preferredSize; 28 | } 29 | 30 | /// A widget with a preferred size. 31 | /// 32 | /// This widget does not impose any constraints on its child, and it doesn't 33 | /// affect the child's layout in any way. It just advertises a preferred size 34 | /// which can be used by the parent. 35 | /// 36 | /// See also: 37 | /// 38 | /// * [AppBar.bottom] and [Scaffold.appBar], which require preferred size widgets. 39 | /// * [PreferredSizeWidget], the interface which this widget implements to expose 40 | /// its preferred size. 41 | /// * [AppBar] and [TabBar], which implement PreferredSizeWidget. 42 | class PreferredSize extends StatelessWidget implements PreferredSizeWidget { 43 | /// Creates a widget that has a preferred size. 44 | const PreferredSize({ 45 | Key key, 46 | @required this.child, 47 | @required this.preferredSize, 48 | }) : super(key: key); 49 | 50 | /// The widget below this widget in the tree. 51 | /// 52 | /// {@macro flutter.widgets.child} 53 | final Widget child; 54 | 55 | @override 56 | final Size preferredSize; 57 | 58 | @override 59 | Widget build(BuildContext context) => child; 60 | } 61 | -------------------------------------------------------------------------------- /packages/flutter_stub/lib/src/widgets/primary_scroll_controller.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | import 'package:flutter_stub/foundation.dart'; 6 | 7 | import 'framework.dart'; 8 | import 'scroll_controller.dart'; 9 | 10 | /// Associates a [ScrollController] with a subtree. 11 | /// 12 | /// When a [ScrollView] has [ScrollView.primary] set to true and is not given 13 | /// an explicit [ScrollController], the [ScrollView] uses [of] to find the 14 | /// [ScrollController] associated with its subtree. 15 | /// 16 | /// This mechanism can be used to provide default behavior for scroll views in a 17 | /// subtree. For example, the [Scaffold] uses this mechanism to implement the 18 | /// scroll-to-top gesture on iOS. 19 | class PrimaryScrollController extends InheritedWidget { 20 | /// Creates a widget that associates a [ScrollController] with a subtree. 21 | const PrimaryScrollController( 22 | {Key key, @required this.controller, @required Widget child}) 23 | : assert(controller != null), 24 | super(key: key, child: child); 25 | 26 | /// Creates a subtree without an associated [ScrollController]. 27 | const PrimaryScrollController.none({Key key, @required Widget child}) 28 | : controller = null, 29 | super(key: key, child: child); 30 | 31 | /// The [ScrollController] associated with the subtree. 32 | /// 33 | /// See also: 34 | /// 35 | /// * [ScrollView.controller], which discusses the purpose of specifying a 36 | /// scroll controller. 37 | final ScrollController controller; 38 | 39 | /// Returns the [ScrollController] most closely associated with the given 40 | /// context. 41 | /// 42 | /// Returns null if there is no [ScrollController] associated with the given 43 | /// context. 44 | static ScrollController of(BuildContext context) { 45 | final PrimaryScrollController result = 46 | context.inheritFromWidgetOfExactType(PrimaryScrollController); 47 | return result?.controller; 48 | } 49 | 50 | @override 51 | bool updateShouldNotify(PrimaryScrollController oldWidget) => 52 | controller != oldWidget.controller; 53 | } 54 | -------------------------------------------------------------------------------- /packages/flutter_stub/lib/src/widgets/scroll_context.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | import 'package:flutter_stub/scheduler.dart'; 6 | import 'package:flutter_stub/rendering.dart'; 7 | 8 | import 'framework.dart'; 9 | 10 | /// An interface that [Scrollable] widgets implement in order to use 11 | /// [ScrollPosition]. 12 | /// 13 | /// See also: 14 | /// 15 | /// * [ScrollableState], which is the most common implementation of this 16 | /// interface. 17 | /// * [ScrollPosition], which uses this interface to communicate with the 18 | /// scrollable widget. 19 | abstract class ScrollContext { 20 | /// The [BuildContext] that should be used when dispatching 21 | /// [ScrollNotification]s. 22 | /// 23 | /// This context is typically different that the context of the scrollable 24 | /// widget itself. For example, [Scrollable] uses a context outside the 25 | /// [Viewport] but inside the widgets created by 26 | /// [ScrollBehavior.buildViewportChrome]. 27 | BuildContext get notificationContext; 28 | 29 | /// The [BuildContext] that should be used when searching for a [PageStorage]. 30 | /// 31 | /// This context is typically the context of the scrollable widget itself. In 32 | /// particular, it should involve any [GlobalKey]s that are dynamically 33 | /// created as part of creating the scrolling widget, since those would be 34 | /// different each time the widget is created. 35 | BuildContext get storageContext; 36 | 37 | /// A [TickerProvider] to use when animating the scroll position. 38 | TickerProvider get vsync; 39 | 40 | /// The direction in which the widget scrolls. 41 | AxisDirection get axisDirection; 42 | 43 | /// Whether the contents of the widget should ignore [PointerEvent] inputs. 44 | /// 45 | /// Setting this value to true prevents the use from interacting with the 46 | /// contents of the widget with pointer events. The widget itself is still 47 | /// interactive. 48 | /// 49 | /// For example, if the scroll position is being driven by an animation, it 50 | /// might be appropriate to set this value to ignore pointer events to 51 | /// prevent the user from accidentally interacting with the contents of the 52 | /// widget as it animates. The user will still be able to touch the widget, 53 | /// potentially stopping the animation. 54 | void setIgnorePointer(bool value); 55 | 56 | /// Whether the user can drag the widget, for example to initiate a scroll. 57 | void setCanDrag(bool value); 58 | 59 | /// Set the [SemanticsAction]s that should be expose to the semantics tree. 60 | void setSemanticsActions(Set actions); 61 | } 62 | -------------------------------------------------------------------------------- /packages/flutter_stub/lib/src/widgets/spacer.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | import 'package:flutter_stub/rendering.dart'; 6 | 7 | import 'basic.dart'; 8 | import 'framework.dart'; 9 | 10 | /// Spacer creates an adjustable, empty spacer that can be used to tune the 11 | /// spacing between widgets in a [Flex] container, like [Row] or [Column]. 12 | /// 13 | /// The [Spacer] widget will take up any available space, so setting the 14 | /// [Flex.mainAxisAlignment] on a flex container that contains a [Spacer] to 15 | /// [MainAxisAlignment.spaceAround], [MainAxisAlignment.spaceBetween], or 16 | /// [MainAxisAlignment.spaceEvenly] will not have any visible effect: the 17 | /// [Spacer] has taken up all of the additional space, therefore there is none 18 | /// left to redistribute. 19 | /// 20 | /// {@tool sample} 21 | /// 22 | /// ```dart 23 | /// Row( 24 | /// children: [ 25 | /// Text('Begin'), 26 | /// Spacer(), // Defaults to a flex of one. 27 | /// Text('Middle'), 28 | /// // Gives twice the space between Middle and End than Begin and Middle. 29 | /// Spacer(flex: 2), 30 | /// Text('End'), 31 | /// ], 32 | /// ) 33 | /// ``` 34 | /// {@end-tool} 35 | /// 36 | /// See also: 37 | /// 38 | /// * [Row] and [Column], which are the most common containers to use a Spacer 39 | /// in. 40 | /// * [SizedBox], to create a box with a specific size and an optional child. 41 | class Spacer extends StatelessWidget { 42 | /// Creates a flexible space to insert into a [Flexible] widget. 43 | /// 44 | /// The [flex] parameter may not be null or less than one. 45 | const Spacer({Key key, this.flex = 1}) 46 | : assert(flex != null), 47 | assert(flex > 0), 48 | super(key: key); 49 | 50 | /// The flex factor to use in determining how much space to take up. 51 | /// 52 | /// The amount of space the [Spacer] can occupy in the main axis is determined 53 | /// by dividing the free space proportionately, after placing the inflexible 54 | /// children, according to the flex factors of the flexible children. 55 | /// 56 | /// Defaults to one. 57 | final int flex; 58 | 59 | @override 60 | Widget build(BuildContext context) { 61 | return Expanded( 62 | flex: flex, 63 | child: const SizedBox.shrink(), 64 | ); 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /packages/flutter_stub/lib/src/widgets/status_transitions.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | import 'basic.dart'; 6 | import 'framework.dart'; 7 | 8 | /// A widget that rebuilds when the given animation changes status. 9 | abstract class StatusTransitionWidget extends StatefulWidget { 10 | /// Initializes fields for subclasses. 11 | /// 12 | /// The [animation] argument must not be null. 13 | const StatusTransitionWidget({Key key, @required this.animation}) 14 | : assert(animation != null), 15 | super(key: key); 16 | 17 | /// The animation to which this widget is listening. 18 | final Animation animation; 19 | 20 | /// Override this method to build widgets that depend on the current status 21 | /// of the animation. 22 | Widget build(BuildContext context); 23 | 24 | @override 25 | _StatusTransitionState createState() => _StatusTransitionState(); 26 | } 27 | 28 | class _StatusTransitionState extends State { 29 | @override 30 | void initState() { 31 | super.initState(); 32 | widget.animation.addStatusListener(_animationStatusChanged); 33 | } 34 | 35 | @override 36 | void didUpdateWidget(StatusTransitionWidget oldWidget) { 37 | super.didUpdateWidget(oldWidget); 38 | if (widget.animation != oldWidget.animation) { 39 | oldWidget.animation.removeStatusListener(_animationStatusChanged); 40 | widget.animation.addStatusListener(_animationStatusChanged); 41 | } 42 | } 43 | 44 | @override 45 | void dispose() { 46 | widget.animation.removeStatusListener(_animationStatusChanged); 47 | super.dispose(); 48 | } 49 | 50 | void _animationStatusChanged(AnimationStatus status) { 51 | setState(() { 52 | // The animation's state is our build state, and it changed already. 53 | }); 54 | } 55 | 56 | @override 57 | Widget build(BuildContext context) { 58 | return widget.build(context); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /packages/flutter_stub/lib/src/widgets/title.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | import 'package:flutter_stub/foundation.dart'; 6 | import 'package:flutter_stub/services.dart'; 7 | 8 | import 'basic.dart'; 9 | import 'framework.dart'; 10 | 11 | /// A widget that describes this app in the operating system. 12 | class Title extends StatelessWidget { 13 | /// Creates a widget that describes this app to the Android operating system. 14 | /// 15 | /// [title] will default to the empty string if not supplied. 16 | /// [color] must be an opaque color (i.e. color.alpha must be 255 (0xFF)). 17 | /// [color] and [child] are required arguments. 18 | Title({ 19 | Key key, 20 | this.title = '', 21 | @required this.color, 22 | @required this.child, 23 | }) : assert(title != null), 24 | assert(color != null && color.alpha == 0xFF), 25 | super(key: key); 26 | 27 | /// A one-line description of this app for use in the window manager. 28 | /// Must not be null. 29 | final String title; 30 | 31 | /// A color that the window manager should use to identify this app. Must be 32 | /// an opaque color (i.e. color.alpha must be 255 (0xFF)), and must not be 33 | /// null. 34 | final Color color; 35 | 36 | /// The widget below this widget in the tree. 37 | /// 38 | /// {@macro flutter.widgets.child} 39 | final Widget child; 40 | 41 | @override 42 | Widget build(BuildContext context) { 43 | SystemChrome.setApplicationSwitcherDescription( 44 | ApplicationSwitcherDescription( 45 | label: title, 46 | primaryColor: color.value, 47 | )); 48 | return child; 49 | } 50 | 51 | @override 52 | void debugFillProperties(DiagnosticPropertiesBuilder properties) { 53 | super.debugFillProperties(properties); 54 | properties.add(StringProperty('title', title, defaultValue: '')); 55 | properties 56 | .add(DiagnosticsProperty('color', color, defaultValue: null)); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /packages/flutter_stub/lib/src/widgets/unique_widget.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | import 'framework.dart'; 6 | 7 | /// Base class for stateful widgets that have exactly one inflated instance in 8 | /// the tree. 9 | /// 10 | /// Such widgets must be given a [GlobalKey]. This key can be generated by the 11 | /// subclass from its [Type] object, e.g. by calling `super(key: new 12 | /// GlobalObjectKey(MyWidget))` where `MyWidget` is the name of the subclass. 13 | /// 14 | /// Since only one instance can be inflated at a time, there is only ever one 15 | /// corresponding [State] object. That object is exposed, for convenience, via 16 | /// the [currentState] property. 17 | /// 18 | /// When subclassing [UniqueWidget], provide the corresponding [State] subclass 19 | /// as the type argument. 20 | abstract class UniqueWidget> 21 | extends StatefulWidget { 22 | /// Creates a widget that has exactly one inflated instance in the tree. 23 | /// 24 | /// The [key] argument must not be null because it identifies the unique 25 | /// inflated instance of this widget. 26 | const UniqueWidget({ 27 | @required GlobalKey key, 28 | }) : assert(key != null), 29 | super(key: key); 30 | 31 | @override 32 | T createState(); 33 | 34 | /// The state for the unique inflated instance of this widget. 35 | /// 36 | /// Might be null if the widget is not currently in the tree. 37 | T get currentState { 38 | final GlobalKey globalKey = key; 39 | return globalKey.currentState; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /packages/flutter_stub/lib/src/widgets/web_navigator.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | import 'package:flutter_stub/widgets.dart' show NavigatorObserver, Route; 6 | 7 | import 'package:flutter_stub_ui/ui.dart' as ui; 8 | 9 | /// Observes all changes happening in routes and notifies the browser history 10 | /// integration to update the route name. 11 | /// 12 | /// In order to fully activate browser history integration, an instance of 13 | /// [WebOnlyNavigatorObserver] has to be added as an observer to [MaterialApp]. 14 | /// 15 | /// ```dart 16 | /// import 'package:flutter_stub/widgets.dart'; 17 | /// 18 | /// class MyApp extends StatelessWidget { 19 | /// Widget build(BuildContext context) { 20 | /// return MaterialApp( 21 | /// navigatorObservers: [WebOnlyNavigatorObserver()], 22 | /// routes: { 23 | /// '/': (_) => HomePage(), 24 | /// '/page2': (_) => Page2(), 25 | /// }, 26 | /// ); 27 | /// } 28 | /// } 29 | /// ``` 30 | class WebOnlyNavigatorObserver extends NavigatorObserver { 31 | @override 32 | void didPush(Route route, Route previousRoute) { 33 | _webOnlyNotifyRouteName(route); 34 | } 35 | 36 | @override 37 | void didReplace({Route newRoute, Route oldRoute}) { 38 | _webOnlyNotifyRouteName(newRoute); 39 | } 40 | 41 | @override 42 | void didPop(Route route, Route previousRoute) { 43 | _webOnlyNotifyRouteName(previousRoute); 44 | } 45 | 46 | void _webOnlyNotifyRouteName(Route route) { 47 | final String routeName = route?.settings?.name; 48 | if (routeName != null) { 49 | ui.webOnlyRouteName = routeName; 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /packages/flutter_stub/lib/src/widgets/will_pop_scope.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | import 'framework.dart'; 6 | import 'navigator.dart'; 7 | import 'routes.dart'; 8 | 9 | /// Registers a callback to veto attempts by the user to dismiss the enclosing 10 | /// [ModalRoute]. 11 | /// 12 | /// See also: 13 | /// 14 | /// * [ModalRoute.addScopedWillPopCallback] and [ModalRoute.removeScopedWillPopCallback], 15 | /// which this widget uses to register and unregister [onWillPop]. 16 | class WillPopScope extends StatefulWidget { 17 | /// Creates a widget that registers a callback to veto attempts by the user to 18 | /// dismiss the enclosing [ModalRoute]. 19 | /// 20 | /// The [child] argument must not be null. 21 | const WillPopScope({ 22 | Key key, 23 | @required this.child, 24 | @required this.onWillPop, 25 | }) : assert(child != null), 26 | super(key: key); 27 | 28 | /// The widget below this widget in the tree. 29 | /// 30 | /// {@macro flutter.widgets.child} 31 | final Widget child; 32 | 33 | /// Called to veto attempts by the user to dismiss the enclosing [ModalRoute]. 34 | /// 35 | /// If the callback returns a Future that resolves to false, the enclosing 36 | /// route will not be popped. 37 | final WillPopCallback onWillPop; 38 | 39 | @override 40 | _WillPopScopeState createState() => _WillPopScopeState(); 41 | } 42 | 43 | class _WillPopScopeState extends State { 44 | ModalRoute _route; 45 | 46 | @override 47 | void didChangeDependencies() { 48 | super.didChangeDependencies(); 49 | if (widget.onWillPop != null) 50 | _route?.removeScopedWillPopCallback(widget.onWillPop); 51 | _route = ModalRoute.of(context); 52 | if (widget.onWillPop != null) 53 | _route?.addScopedWillPopCallback(widget.onWillPop); 54 | } 55 | 56 | @override 57 | void didUpdateWidget(WillPopScope oldWidget) { 58 | super.didUpdateWidget(oldWidget); 59 | assert(_route == ModalRoute.of(context)); 60 | if (widget.onWillPop != oldWidget.onWillPop && _route != null) { 61 | if (oldWidget.onWillPop != null) 62 | _route.removeScopedWillPopCallback(oldWidget.onWillPop); 63 | if (widget.onWillPop != null) 64 | _route.addScopedWillPopCallback(widget.onWillPop); 65 | } 66 | } 67 | 68 | @override 69 | void dispose() { 70 | if (widget.onWillPop != null) 71 | _route?.removeScopedWillPopCallback(widget.onWillPop); 72 | super.dispose(); 73 | } 74 | 75 | @override 76 | Widget build(BuildContext context) => widget.child; 77 | } 78 | -------------------------------------------------------------------------------- /packages/flutter_stub/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: flutter_stub 2 | description: A starting point for Dart libraries or applications. 3 | # version: 1.0.0 4 | # homepage: https://www.example.com 5 | # author: aloisdeniel 6 | 7 | environment: 8 | sdk: '>=2.2.0 <3.0.0' 9 | 10 | dependencies: 11 | flutter_stub_ui: 12 | git: 13 | url: https://github.com/aloisdeniel/flutter_shared_ui_poc 14 | path: packages/flutter_stub_ui 15 | collection: ^1.0.0 16 | meta: ^1.1.5 17 | vector_math: ^2.0.7 18 | typed_data: ^1.1.6 -------------------------------------------------------------------------------- /packages/flutter_stub_ui/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aloisdeniel/flutter_shared_ui_poc/a8edd9005707ef1fd76ef1f2acf97355b8dd3777/packages/flutter_stub_ui/.DS_Store -------------------------------------------------------------------------------- /packages/flutter_stub_ui/lib/src/ui/lerp.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | part of ui; 6 | 7 | /// Linearly interpolate between two numbers. 8 | double lerpDouble(num a, num b, double t) { 9 | if (a == null && b == null) { 10 | return null; 11 | } 12 | a ??= 0.0; 13 | b ??= 0.0; 14 | return a + (b - a) * t; 15 | } 16 | -------------------------------------------------------------------------------- /packages/flutter_stub_ui/lib/src/ui/natives.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Flutter Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | part of ui; 6 | 7 | /// Returns runtime Dart compilation trace as a UTF-8 encoded memory buffer. 8 | /// 9 | /// The buffer contains a list of symbols compiled by the Dart JIT at runtime up to the point 10 | /// when this function was called. This list can be saved to a text file and passed to tools 11 | /// such as `flutter build` or Dart `gen_snapshot` in order to precompile this code offline. 12 | /// 13 | /// The list has one symbol per line of the following format: `,,\n`. 14 | /// Here are some examples: 15 | /// 16 | /// ``` 17 | /// dart:core,Duration,get:inMilliseconds 18 | /// package:flutter/src/widgets/binding.dart,::,runApp 19 | /// file:///.../my_app.dart,::,main 20 | /// ``` 21 | /// 22 | /// This function is only effective in debug and dynamic modes, and will throw in AOT mode. 23 | List saveCompilationTrace() { 24 | throw UnimplementedError(); 25 | } 26 | -------------------------------------------------------------------------------- /packages/flutter_stub_ui/lib/src/ui/test_embedding.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | // TODO(flutter_web): the Web-only API below need to be cleaned up. 6 | 7 | part of ui; 8 | 9 | /// Used to track when the platform is initialized. This ensures the test fonts 10 | /// are available. 11 | Future _testPlatformInitializedFuture; 12 | 13 | /// If the platform is already initialized (by a previous test), then run the test 14 | /// body immediately. Otherwise, initialize the platform then run the test. 15 | Future ensureTestPlatformInitializedThenRunTest( 16 | dynamic Function() body) => throw UnsupportedError(''); 17 | 18 | /// This setter is used by [WebNavigatorObserver] to update the url to 19 | /// reflect the [Navigator]'s current route name. 20 | set webOnlyRouteName(String routeName) => throw UnsupportedError(''); 21 | 22 | /// Used to track when the platform is initialized. This ensures the test fonts 23 | /// are available. 24 | Future _platformInitializedFuture; 25 | 26 | /// Initializes domRenderer with specific devicePixelRation and physicalSize. 27 | Future webOnlyInitializeTestDomRenderer({double devicePixelRatio = 3.0}) => throw UnsupportedError(''); -------------------------------------------------------------------------------- /packages/flutter_stub_ui/lib/src/ui/tile_mode.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | part of ui; 6 | 7 | /// Defines what happens at the edge of the gradient. 8 | /// 9 | /// A gradient is defined along a finite inner area. In the case of a linear 10 | /// gradient, it's between the parallel lines that are orthogonal to the line 11 | /// drawn between two points. In the case of radial gradients, it's the disc 12 | /// that covers the circle centered on a particular point up to a given radius. 13 | /// 14 | /// This enum is used to define how the gradient should paint the regions 15 | /// outside that defined inner area. 16 | /// 17 | /// See also: 18 | /// 19 | /// * [painting.Gradient], the superclass for [LinearGradient] and 20 | /// [RadialGradient], as used by [BoxDecoration] et al, which works in 21 | /// relative coordinates and can create a [Shader] representing the gradient 22 | /// for a particular [Rect] on demand. 23 | /// * [dart:ui.Gradient], the low-level class used when dealing with the 24 | /// [Paint.shader] property directly, with its [new Gradient.linear] and [new 25 | /// Gradient.radial] constructors. 26 | // These enum values must be kept in sync with SkShader::TileMode. 27 | enum TileMode { 28 | /// Edge is clamped to the final color. 29 | /// 30 | /// The gradient will paint the all the regions outside the inner area with 31 | /// the color of the point closest to that region. 32 | /// 33 | /// ![](https://flutter.github.io/assets-for-api-docs/assets/dart-ui/tile_mode_clamp_radial.png) 34 | clamp, 35 | 36 | /// Edge is repeated from first color to last. 37 | /// 38 | /// This is as if the stop points from 0.0 to 1.0 were then repeated from 1.0 39 | /// to 2.0, 2.0 to 3.0, and so forth (and for linear gradients, similarly from 40 | /// -1.0 to 0.0, -2.0 to -1.0, etc). 41 | /// 42 | /// ![](https://flutter.github.io/assets-for-api-docs/assets/dart-ui/tile_mode_repeated_linear.png) 43 | /// ![](https://flutter.github.io/assets-for-api-docs/assets/dart-ui/tile_mode_repeated_radial.png) 44 | repeated, 45 | 46 | /// Edge is mirrored from last color to first. 47 | /// 48 | /// This is as if the stop points from 0.0 to 1.0 were then repeated backwards 49 | /// from 2.0 to 1.0, then forwards from 2.0 to 3.0, then backwards again from 50 | /// 4.0 to 3.0, and so forth (and for linear gradients, similarly from in the 51 | /// negative direction). 52 | /// 53 | /// ![](https://flutter.github.io/assets-for-api-docs/assets/dart-ui/tile_mode_mirror_linear.png) 54 | /// ![](https://flutter.github.io/assets-for-api-docs/assets/dart-ui/tile_mode_mirror_radial.png) 55 | mirror, 56 | } 57 | -------------------------------------------------------------------------------- /packages/flutter_stub_ui/lib/ui.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | /// This library defines the web equivalent of the native dart:ui. 6 | /// 7 | /// All types in this library are public. 8 | library ui; 9 | 10 | import 'dart:math' as math; 11 | import 'dart:async'; 12 | import 'dart:collection'; 13 | import 'dart:typed_data'; 14 | 15 | part 'src/ui/canvas.dart'; 16 | part 'src/ui/compositing.dart'; 17 | part 'src/ui/geometry.dart'; 18 | part 'src/ui/hash_codes.dart'; 19 | part 'src/ui/lerp.dart'; 20 | part 'src/ui/natives.dart'; 21 | part 'src/ui/painting.dart'; 22 | part 'src/ui/pointer.dart'; 23 | part 'src/ui/semantics.dart'; 24 | part 'src/ui/test_embedding.dart'; 25 | part 'src/ui/text.dart'; 26 | part 'src/ui/tile_mode.dart'; 27 | part 'src/ui/window.dart'; 28 | 29 | /// Provides a compile time constant to customize flutter framework and other 30 | /// users of ui engine for web runtime. 31 | bool get isWeb => throw UnsupportedError(''); 32 | 33 | /// Web specific SMI. Used by bitfield. The 0x3FFFFFFFFFFFFFFF used on VM 34 | /// is not supported on Web platform. 35 | const int kMaxUnsignedSMI = -1; 36 | -------------------------------------------------------------------------------- /packages/flutter_stub_ui/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: flutter_stub_ui 2 | description: A starting point for Dart libraries or applications. 3 | # version: 1.0.0 4 | # homepage: https://www.example.com 5 | # author: aloisdeniel 6 | 7 | environment: 8 | sdk: '>=2.2.0 <3.0.0' 9 | 10 | dependencies: 11 | collection: ^1.0.0 12 | meta: ^1.1.5 13 | vector_math: ^2.0.7 14 | intl: any 15 | -------------------------------------------------------------------------------- /packages/provider_cross/.gitignore: -------------------------------------------------------------------------------- 1 | # Files and directories created by pub 2 | .dart_tool/ 3 | android/ 4 | ios/ 5 | .packages 6 | # Remove the following pattern if you wish to check in your lock file 7 | pubspec.lock 8 | 9 | # Conventional directory for build outputs 10 | build/ 11 | coverage/ 12 | 13 | # Directory created by dartdoc 14 | doc/api/ 15 | -------------------------------------------------------------------------------- /packages/provider_cross/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Remi Rousselet 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /packages/provider_cross/lib/provider.dart: -------------------------------------------------------------------------------- 1 | export 'src/provider_cross.dart' 2 | // ignore: uri_does_not_exist 3 | if (dart.library.io) 'package:provider/provider.dart'; 4 | -------------------------------------------------------------------------------- /packages/provider_cross/lib/src/provider_cross.dart: -------------------------------------------------------------------------------- 1 | library provider; 2 | 3 | export 'async_provider.dart'; 4 | export 'change_notifier_provider.dart'; 5 | export 'consumer.dart'; 6 | export 'delegate_widget.dart'; 7 | export 'listenable_provider.dart'; 8 | export 'provider.dart'; 9 | export 'proxy_provider.dart' 10 | hide NumericProxyProvider, Void, ProxyProviderBase; 11 | export 'value_listenable_provider.dart'; 12 | -------------------------------------------------------------------------------- /packages/provider_cross/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: provider_cross 2 | description: A mixture between dependency injection and state management, built with widgets for widgets. 3 | version: 3.1.0 4 | homepage: https://github.com/rrousselGit/provider 5 | authors: 6 | - Remi Rousselet 7 | - Flutter Team 8 | 9 | environment: 10 | sdk: ">=2.0.0 <3.0.0" 11 | 12 | dependencies: 13 | flutter_cross: 14 | git: 15 | url: https://github.com/aloisdeniel/flutter_shared_ui_poc 16 | path: packages/flutter_cross --------------------------------------------------------------------------------