├── .github ├── FUNDING.yml ├── ISSUE_TEMPLATE │ ├── bug_report.md │ ├── feature_request.md │ └── general-questions.md ├── codecov.yml └── workflows │ ├── audit.yaml │ ├── coverage.yaml │ └── tests.yml ├── .gitignore ├── CHANGELOG.md ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── CONTRIBUTORS.md ├── Cargo.toml ├── LICENSE ├── README.md ├── SECURITY.md ├── TODO.md ├── examples └── main.rs.bak ├── macro ├── CHANGELOG.md ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── CONTRIBUTORS.md ├── Cargo.toml ├── LICENSE ├── README.md ├── SECURITY.md ├── TODO.md └── src │ ├── application │ ├── add_getters_setters.md │ ├── add_getters_setters.rs │ ├── getters.rs │ ├── microservice_main.md │ ├── microservice_main.rs │ ├── mod.rs │ └── run.rs │ └── lib.rs └── src ├── animation ├── animation.rs ├── animation_controller.rs ├── curve.rs ├── enums │ ├── animation_behavior.rs │ ├── animation_status.rs │ └── mod.rs └── mod.rs ├── elements ├── about_list_tile.rs ├── action_chip.rs ├── alert_dialog.rs ├── align.rs ├── app_bar.rs ├── back_button.rs ├── bottom_app_bar.rs ├── bottom_navigation_bar.rs ├── bottom_sheet.rs ├── button.rs ├── button_bar.rs ├── button_style_button.rs ├── calendar_date_picker.rs ├── canvas.rs ├── card.rs ├── center.rs ├── checkbox.rs ├── chip.rs ├── choice_chip.rs ├── circle_avatar.rs ├── circular_progress_indicator.rs ├── clip_oval.rs ├── clip_path.rs ├── close_button.rs ├── column.rs ├── container.rs ├── custom_paint.rs ├── custom_scroll_view.rs ├── data_table.rs ├── date_picker_dialog.rs ├── divider.rs ├── drawer.rs ├── dropdown_button.rs ├── element.rs ├── elevated_button.rs ├── expanded.rs ├── expansion_panel.rs ├── filter_chip.rs ├── fitted_box.rs ├── flat_button.rs ├── flexible.rs ├── flexible_space_bar.rs ├── floating_action_button.rs ├── flow.rs ├── form.rs ├── gesture_detector.rs ├── grid_view.rs ├── icon.rs ├── icon_button.rs ├── image.rs ├── image_icon.rs ├── ink.rs ├── ink_well.rs ├── input_chip.rs ├── label.rs ├── linear_progress_indicator.rs ├── list.rs ├── list_tile.rs ├── list_view.rs ├── material.rs ├── material_app.rs ├── material_button.rs ├── media_query.rs ├── mod.rs ├── modal_bottom_sheet.rs ├── navigation_rail.rs ├── navigation_rail_destination.rs ├── navigation_toolbar.rs ├── offstage.rs ├── opacity.rs ├── outline_button.rs ├── outlined_button.rs ├── panel.rs ├── placeholder.rs ├── popup_menu_button.rs ├── positioned.rs ├── preferred_size.rs ├── progress.rs ├── radio.rs ├── raised_button.rs ├── raw_chip.rs ├── raw_material_button.rs ├── refresh_indicator.rs ├── rich_text.rs ├── row.rs ├── rust_logo.rs ├── safe_area.rs ├── scaffold.rs ├── scroll_view.rs ├── scrollable.rs ├── simple_dialog.rs ├── single_child_scroll_view.rs ├── sized_box.rs ├── slider.rs ├── sliver_app_bar.rs ├── sliver_grid.rs ├── sliver_list.rs ├── snack_bar.rs ├── stack.rs ├── step.rs ├── stepper.rs ├── switch.rs ├── tab_bar.rs ├── tab_bar_view.rs ├── tab_page_selector.rs ├── text.rs ├── text_button.rs ├── text_field.rs ├── textedit.rs ├── theme.rs ├── toggle_buttons.rs ├── transform.rs ├── user_accounts_drawer_header.rs ├── vertical_divider.rs ├── widget_component.rs ├── widgets_app.rs ├── window.rs └── wrap.rs ├── foundation ├── atomic.rs ├── enums │ └── mod.rs ├── events │ └── mod.rs ├── helper.rs ├── key.rs ├── local_key.rs ├── margins.rs ├── material_application.rs ├── material_application_host.rs ├── mod.rs ├── properties │ ├── button.rs │ ├── canvas.rs │ ├── checkbox.rs │ ├── dropdown.rs │ ├── image.rs │ ├── label.rs │ ├── list.rs │ ├── mod.rs │ ├── panel.rs │ ├── progress.rs │ ├── scroll.rs │ ├── slider.rs │ ├── textedit.rs │ └── window.rs ├── signal.rs ├── target_platform.rs ├── value_changed.rs ├── widget.rs └── widget_properties.rs ├── gestures ├── drag_end_details.rs ├── drag_start_behavior.rs ├── drag_start_details.rs ├── drag_update_details.rs ├── gesture_recognizer.rs ├── mod.rs ├── pointer_enter_event.rs ├── pointer_event.rs ├── pointer_exit_event.rs └── velocity.rs ├── lib.rs ├── material ├── about_list_tile.rs ├── action_chip.rs ├── alert_dialog.rs ├── alignment_geometry.rs ├── app_bar.rs ├── app_bar_theme.rs ├── back_button.rs ├── bottom_app_bar.rs ├── bottom_app_bar_theme.rs ├── bottom_navigation_bar.rs ├── bottom_navigation_bar_landscape_layout.rs ├── bottom_navigation_bar_theme_data.rs ├── bottom_navigation_bar_type.rs ├── bottom_sheet.rs ├── bottom_sheet_theme_data.rs ├── button_bar.rs ├── button_bar_layout_behavior.rs ├── button_bar_theme_data.rs ├── button_style.rs ├── button_style_button.rs ├── button_text_theme.rs ├── button_theme_data.rs ├── calendar_date_picker.rs ├── card.rs ├── card_theme.rs ├── checkbox.rs ├── checkbox_theme_data.rs ├── chip.rs ├── chip_theme_data.rs ├── choice_chip.rs ├── circle_avatar.rs ├── circular_progress_indicator.rs ├── close_button.rs ├── color_scheme.rs ├── consts.rs ├── data_table.rs ├── data_table_theme_data.rs ├── date_picker_dialog.rs ├── dialog_theme.rs ├── divider.rs ├── divider_theme_data.rs ├── drawer.rs ├── drawer_callback.rs ├── dropdown_button.rs ├── elevated_button.rs ├── elevated_button_theme_data.rs ├── enums │ ├── collapse_mode.rs │ ├── material_type.rs │ ├── mod.rs │ └── stretch_mode.rs ├── expansion_panel.rs ├── filter_chip.rs ├── flat_button.rs ├── flexible_space_bar.rs ├── floating_action_button.rs ├── floating_action_button_animator.rs ├── floating_action_button_location.rs ├── floating_action_button_theme_data.rs ├── floating_label_alignment.rs ├── floating_label_behavior.rs ├── icon_button.rs ├── icons.rs ├── ink.rs ├── ink_well.rs ├── input_border.rs ├── input_chip.rs ├── input_decoration.rs ├── input_decoration_theme.rs ├── interactive_ink_feature_factory.rs ├── linear_progress_indicator.rs ├── list_tile.rs ├── localizations_delegate.rs ├── material.rs ├── material_app.rs ├── material_banner_theme_data.rs ├── material_button.rs ├── material_color.rs ├── material_page_route.rs ├── material_state_property.rs ├── material_tap_target_size.rs ├── mod.rs ├── modal_bottom_sheet.rs ├── navigation_rail.rs ├── navigation_rail_destination.rs ├── navigation_rail_label_type.rs ├── navigation_rail_theme_data.rs ├── outline_button.rs ├── outline_input_border.rs ├── outlined_button.rs ├── outlined_button_theme_data.rs ├── page_transitions_builder.rs ├── page_transitions_theme.rs ├── popup_menu_button.rs ├── popup_menu_theme_data.rs ├── progress_indicator.rs ├── progress_indicator_theme_data.rs ├── radio.rs ├── radio_theme_data.rs ├── raised_button.rs ├── range_slider_thumb_shape.rs ├── range_slider_tick_mark_shape.rs ├── range_slider_track_shape.rs ├── range_slider_value_indicator_shape.rs ├── range_thumb_selector.rs ├── range_values.rs ├── raw_chip.rs ├── raw_material_button.rs ├── refresh_indicator.rs ├── scaffold.rs ├── scaffold_messenger_state.rs ├── scroll_view.rs ├── scrollable.rs ├── scrollbar_theme_data.rs ├── show_value_indicator.rs ├── simple_dialog.rs ├── slider.rs ├── slider_component_shape.rs ├── slider_theme_data.rs ├── slider_tick_mark_shape.rs ├── slider_track_shape.rs ├── sliver_app_bar.rs ├── snack_bar.rs ├── snack_bar_behavior.rs ├── snack_bar_theme_data.rs ├── step.rs ├── step_state.rs ├── stepper.rs ├── switch.rs ├── switch_theme_data.rs ├── tab_bar.rs ├── tab_bar_indicator_size.rs ├── tab_bar_theme.rs ├── tab_bar_view.rs ├── tab_controller.rs ├── tab_page_selector.rs ├── text_button.rs ├── text_button_theme_data.rs ├── text_field.rs ├── text_selection_theme_data.rs ├── text_theme.rs ├── theme.rs ├── theme_data.rs ├── theme_mode.rs ├── thumb.rs ├── time_picker_theme_data.rs ├── toggle_buttons.rs ├── toggle_buttons_theme_data.rs ├── tooltip_theme_data.rs ├── tooltip_trigger_mode.rs ├── typography.rs ├── user_accounts_drawer_header.rs ├── vertical_divider.rs └── visual_density.rs ├── painting ├── alignment.rs ├── asset_bundle_image_key.rs ├── asset_bundle_image_provider.rs ├── asset_image.rs ├── border.rs ├── border_radius.rs ├── border_radius_geometry.rs ├── border_side.rs ├── box_border.rs ├── box_decoration.rs ├── box_shadow.rs ├── circular_notched_rectangle.rs ├── decoration.rs ├── decoration_image.rs ├── edge_insets.rs ├── edge_insets_geometry.rs ├── enums │ ├── axis.rs │ ├── axis_direction.rs │ ├── border_style.rs │ ├── box_fit.rs │ ├── box_shape.rs │ ├── image_repeat.rs │ ├── mod.rs │ ├── rust_logo_style.rs │ ├── text_overflow.rs │ └── vertical_direction.rs ├── exact_asset_image.rs ├── file_image.rs ├── fractional_offset.rs ├── gradient.rs ├── gradient_transform.rs ├── image_error_listener.rs ├── image_provider.rs ├── inline_span.rs ├── linear_gradient.rs ├── memory_image.rs ├── mod.rs ├── network_image.rs ├── notched_shape.rs ├── outlined_border.rs ├── resize_image.rs ├── rounded_rectangle_border.rs ├── shape_border.rs ├── shape_decoration.rs ├── stadium_border.rs ├── text_span.rs └── text_style.rs ├── rendering ├── backend │ ├── canvas │ │ └── mod.rs │ ├── gles │ │ ├── app_bar.rs │ │ ├── button.rs │ │ ├── canvas.rs │ │ ├── checkbox.rs │ │ ├── divider.rs │ │ ├── dropdown.rs │ │ ├── image.rs │ │ ├── label.rs │ │ ├── list.rs │ │ ├── material_app.rs │ │ ├── material_button.rs │ │ ├── mod.rs │ │ ├── navigation_rail.rs │ │ ├── navigation_rail_destination.rs │ │ ├── panel.rs │ │ ├── progress_indicator.rs │ │ ├── scaffold.rs │ │ ├── scrollable.rs │ │ ├── slider.rs │ │ ├── text.rs │ │ ├── textedit.rs │ │ ├── vertical_divider.rs │ │ └── window.rs │ ├── mod.rs │ ├── native │ │ ├── advanced_widgets │ │ │ ├── alert.rs │ │ │ ├── avatar.rs │ │ │ ├── badge.rs │ │ │ ├── breadcrumb.rs │ │ │ ├── button_group.rs │ │ │ ├── calendar.rs │ │ │ ├── carousel.rs │ │ │ ├── chip_group.rs │ │ │ ├── color_picker.rs │ │ │ ├── expansion_panel.rs │ │ │ ├── grid.rs │ │ │ ├── item_group.rs │ │ │ ├── listitem_group.rs │ │ │ ├── mod.rs │ │ │ ├── overlay.rs │ │ │ ├── pagination.rs │ │ │ ├── parallax.rs │ │ │ ├── rail.rs │ │ │ ├── rating.rs │ │ │ ├── select.rs │ │ │ ├── side_group.rs │ │ │ ├── stepper.rs │ │ │ └── treeview.rs │ │ ├── app_bar.rs │ │ ├── audio_widgets │ │ │ └── mod.rs │ │ ├── backdrop.rs │ │ ├── banner.rs │ │ ├── button.rs │ │ ├── card.rs │ │ ├── chart_widgets │ │ │ └── mod.rs │ │ ├── checkbox.rs │ │ ├── chip.rs │ │ ├── circular_progress.rs │ │ ├── data_table.rs │ │ ├── date_picker.rs │ │ ├── dialog.rs │ │ ├── divider.rs │ │ ├── drawer.rs │ │ ├── effects │ │ │ ├── fade_effect.rs │ │ │ └── mod.rs │ │ ├── fab.rs │ │ ├── formfield.rs │ │ ├── icon.rs │ │ ├── icon_button.rs │ │ ├── image_list.rs │ │ ├── layout │ │ │ ├── box_layout.rs │ │ │ ├── box_layout_child.rs │ │ │ ├── frame.rs │ │ │ ├── kinetic_scroll_view.rs │ │ │ ├── mod.rs │ │ │ ├── scroll_view.rs │ │ │ └── viewport.rs │ │ ├── linear_progress.rs │ │ ├── list.rs │ │ ├── menu.rs │ │ ├── mod.rs │ │ ├── radio.rs │ │ ├── rt.rs │ │ ├── sheet.rs │ │ ├── slider.rs │ │ ├── snackbar.rs │ │ ├── surface.rs │ │ ├── switch.rs │ │ ├── tab.rs │ │ ├── textarea.rs │ │ ├── textfield.rs │ │ ├── time_picker.rs │ │ ├── tooltip.rs │ │ ├── utils │ │ │ ├── actor_manager.rs │ │ │ ├── adjustment.rs │ │ │ ├── clipboard.rs │ │ │ ├── combo_box.rs │ │ │ ├── floating_widget.rs │ │ │ ├── focus_manager.rs │ │ │ ├── focusable.rs │ │ │ ├── icon_theme.rs │ │ │ ├── image.rs │ │ │ ├── item_view.rs │ │ │ ├── label.rs │ │ │ ├── mod.rs │ │ │ ├── notebook.rs │ │ │ ├── pager.rs │ │ │ ├── path_bar.rs │ │ │ ├── push_action.rs │ │ │ ├── scroll_bar.rs │ │ │ ├── settings.rs │ │ │ ├── spinner.rs │ │ │ ├── stack.rs │ │ │ ├── stack_child.rs │ │ │ ├── style.rs │ │ │ ├── table_child.rs │ │ │ ├── texture_cache.rs │ │ │ ├── toggle.rs │ │ │ └── toolbar.rs │ │ ├── video_widgets │ │ │ ├── mod.rs │ │ │ └── video_timeline.rs │ │ ├── widget.rs │ │ └── window.rs │ ├── web │ │ └── mod.rs │ ├── widget_render_factory.rs │ ├── widget_render_holder.rs │ └── widget_renderer.rs ├── box_constraints.rs ├── custom_clipper.rs ├── custom_painter.rs ├── enums │ ├── cross_axis_alignment.rs │ ├── flex_fit.rs │ ├── growth_direction.rs │ ├── main_axis_alignment.rs │ ├── main_axis_size.rs │ ├── mod.rs │ ├── scroll_direction.rs │ ├── stack_fit.rs │ └── wrap_alignment.rs ├── mod.rs ├── render_box.rs ├── sliver_constraints.rs ├── sliver_grid_delegate.rs ├── sliver_grid_delegate_with_fixed_cross_axis_count.rs └── sliver_grid_layout.rs ├── rx ├── mod.rs └── stream_controller.rs ├── services ├── asset_bundle.rs ├── focus.rs ├── layout_system.rs ├── mod.rs ├── mouse_cursor.rs ├── system_ui_overlay_style.rs ├── text_editing_value.rs ├── text_input_type.rs └── text_selection.rs ├── ui ├── canvas.rs ├── codec.rs ├── color_filter.rs ├── enums │ ├── app_lifecycle_state.rs │ ├── blend_mode.rs │ ├── blur_style.rs │ ├── box_height_style.rs │ ├── box_width_style.rs │ ├── brightness.rs │ ├── clip.rs │ ├── clip_op.rs │ ├── filter_quality.rs │ ├── font_style.rs │ ├── frame_phase.rs │ ├── image_byte_format.rs │ ├── key_event_type.rs │ ├── mod.rs │ ├── painting_style.rs │ ├── path_fill_type.rs │ ├── path_operation.rs │ ├── pixel_format.rs │ ├── placeholder_alignment.rs │ ├── point_mode.rs │ ├── pointer_change.rs │ ├── pointer_device_kind.rs │ ├── pointer_signal_kind.rs │ ├── stroke_cap.rs │ ├── stroke_join.rs │ ├── text_affinity.rs │ ├── text_align.rs │ ├── text_baseline.rs │ ├── text_decoration_style.rs │ ├── text_direction.rs │ ├── text_leading_distribution.rs │ ├── tile_mode.rs │ └── vertex_mode.rs ├── font_feature.rs ├── font_weight.rs ├── image_filter.rs ├── locale.rs ├── mask_filter.rs ├── mod.rs ├── offset.rs ├── paint.rs ├── path.rs ├── radius.rs ├── rect.rs ├── shader.rs ├── shadow.rs ├── size.rs ├── text_position.rs ├── text_range.rs ├── void_callback.rs └── window_padding.rs └── widgets ├── action.rs ├── align.rs ├── build_context.rs ├── center.rs ├── clip_oval.rs ├── clip_path.rs ├── column.rs ├── container.rs ├── custom_paint.rs ├── custom_scroll_view.rs ├── enums ├── mod.rs ├── orientation.rs └── route_pop_disposition.rs ├── expanded.rs ├── fitted_box.rs ├── flexible.rs ├── flow.rs ├── focus_node.rs ├── form.rs ├── generate_app_title.rs ├── gesture_detector.rs ├── global_key.rs ├── grid_view.rs ├── icon.rs ├── icon_data.rs ├── icon_theme_data.rs ├── image.rs ├── image_icon.rs ├── initial_route_list_factory.rs ├── intent.rs ├── list_view.rs ├── locale_list_resolution_callback.rs ├── locale_resolution_callback.rs ├── media_query.rs ├── media_query_data.rs ├── mod.rs ├── navigation_toolbar.rs ├── navigator.rs ├── navigator_observer.rs ├── navigator_state.rs ├── offstage.rs ├── opacity.rs ├── padding.rs ├── page.rs ├── placeholder.rs ├── pop_page_callback.rs ├── positioned.rs ├── preferred_size.rs ├── preferred_size_widget.rs ├── rich_text.rs ├── route.rs ├── route_factory.rs ├── route_list_factory.rs ├── route_settings.rs ├── row.rs ├── rust_logo.rs ├── safe_area.rs ├── scroll_behavior.rs ├── scroll_controller.rs ├── scroll_position.rs ├── shortcut_activator.rs ├── single_child_scroll_view.rs ├── sized_box.rs ├── sliver_child_builder_delegate.rs ├── sliver_child_delegate.rs ├── sliver_grid.rs ├── sliver_list.rs ├── stack.rs ├── state.rs ├── stateful_widget.rs ├── stream_builder.rs ├── text.rs ├── text_editing_controller.rs ├── transform.rs ├── transition_builder.rs ├── transition_delegate.rs ├── widget_builder.rs ├── widgets_app.rs └── wrap.rs /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | ko_fi: dudochkin 4 | liberapay: dudochkin 5 | open_collective: dudochkin -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: About unexpected behaviors 4 | title: "[BUG] " 5 | labels: bug 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | Describe what is expected, what you actually get. 12 | It would be nice to have screenshot or result image uploaded 13 | 14 | **To Reproduce** 15 | Some minimal reproduce code is highly recommended 16 | 17 | **Version Information** 18 | Please give us what version you are using. If you are pulling `UX Components` directly from git repo, please mention this as well 19 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea to UX Components maintainers 4 | title: "[Feature Request]" 5 | labels: feature request 6 | assignees: '' 7 | 8 | --- 9 | 10 | ### What is the feature ? 11 | *Detailed feature descrption* 12 | 13 | ### (Optional) Why this feature is useful and how people would use the feature ? 14 | *Explain why this feature is important* 15 | 16 | ### (Optional) Additional Information 17 | *More details are appreciated:)* 18 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/general-questions.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: General Questions 3 | about: Any other issues 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | 11 | -------------------------------------------------------------------------------- /.github/codecov.yml: -------------------------------------------------------------------------------- 1 | comment: 2 | layout: "diff, flags, files" 3 | require_changes: true 4 | 5 | coverage: 6 | status: 7 | project: 8 | default: 9 | informational: true 10 | -------------------------------------------------------------------------------- /.github/workflows/audit.yaml: -------------------------------------------------------------------------------- 1 | name: Security audit 2 | on: 3 | pull_request: 4 | push: 5 | branches: 6 | - master 7 | schedule: 8 | - cron: '0 0 * * 0' 9 | 10 | jobs: 11 | security_audit: 12 | runs-on: ubuntu-latest 13 | steps: 14 | - uses: actions/checkout@v2 15 | - uses: actions-rs/audit-check@v1 16 | with: 17 | token: ${{ secrets.GITHUB_TOKEN }} 18 | -------------------------------------------------------------------------------- /.github/workflows/coverage.yaml: -------------------------------------------------------------------------------- 1 | name: Coverage 2 | 3 | #on: 4 | # push: 5 | # branches: 6 | # - main 7 | # pull_request: 8 | 9 | on: [push, pull_request] 10 | 11 | env: 12 | CARGO_TERM_COLOR: always 13 | RUST_BACKTRACE: full 14 | 15 | jobs: 16 | coverage: 17 | name: Coverage 18 | runs-on: ubuntu-latest 19 | steps: 20 | - name: Checkout repository 21 | uses: actions/checkout@v2 22 | 23 | - name: Install Rust 24 | uses: actions-rs/toolchain@v1 25 | with: 26 | toolchain: nightly 27 | profile: minimal 28 | default: true 29 | 30 | - name: Install udev 31 | run: sudo apt-get install libudev-dev 32 | 33 | - name: Restore cache 34 | uses: Swatinem/rust-cache@v1 35 | 36 | - name: Run cargo-tarpaulin 37 | uses: actions-rs/tarpaulin@v0.1 38 | with: 39 | args: '--run-types Doctests,Tests' 40 | timeout: 120 41 | 42 | - name: Upload to codecov.io 43 | uses: codecov/codecov-action@239febf655bba88b16ff5dea1d3135ea8663a1f9 44 | with: 45 | token: ${{ secrets.CODECOV_TOKEN }} 46 | 47 | - name: Archive code coverage results 48 | uses: actions/upload-artifact@v2 49 | with: 50 | name: code-coverage-report 51 | path: cobertura.xml 52 | retention-days: 30 53 | -------------------------------------------------------------------------------- /.github/workflows/tests.yml: -------------------------------------------------------------------------------- 1 | name: Tests 2 | 3 | on: [push, pull_request] 4 | 5 | jobs: 6 | build: 7 | name: Build and test 8 | runs-on: ubuntu-latest 9 | steps: 10 | - name: Checkout repository 11 | uses: actions/checkout@v2 12 | 13 | - name: Install Rust 14 | uses: actions-rs/toolchain@v1 15 | with: 16 | toolchain: nightly 17 | profile: minimal 18 | default: true 19 | components: rustfmt, clippy 20 | 21 | - name: Install udev 22 | run: sudo apt-get install libudev-dev 23 | 24 | - name: Build 25 | run: cargo build --verbose 26 | - name: Run tests 27 | run: cargo test --verbose 28 | 29 | clippy_check: 30 | name: Clippy check 31 | runs-on: ubuntu-latest 32 | steps: 33 | - name: Checkout repository 34 | uses: actions/checkout@v2 35 | 36 | - name: Install Rust 37 | uses: actions-rs/toolchain@v1 38 | with: 39 | toolchain: nightly 40 | profile: minimal 41 | default: true 42 | components: rustfmt, clippy 43 | 44 | - name: Install udev 45 | run: sudo apt-get install libudev-dev 46 | 47 | - uses: actions-rs/clippy-check@v1 48 | with: 49 | token: ${{ secrets.GITHUB_TOKEN }} 50 | args: --all-features 51 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Generated by Cargo 2 | # will have compiled files and executables 3 | /target/ 4 | 5 | # Remove Cargo.lock from gitignore if creating an executable, leave it for libraries 6 | # More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html 7 | Cargo.lock 8 | 9 | # These are backup files generated by rustfmt 10 | **/*.rs.bk 11 | /refs 12 | /src/bin -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | ## Package vX.X.X (YYYY-MM-DD) 4 | 5 | ### Improved 6 | 7 | - A here your changes 8 | 9 | ### Added 10 | 11 | - A here your changes 12 | 13 | ### Fixed 14 | 15 | - A here your changes 16 | 17 | ### Improvement 18 | 19 | - A here your changes 20 | 21 | ### Removed 22 | 23 | - A here your changes 24 | 25 | -------------------------------------------------------------------------------- /CONTRIBUTORS.md: -------------------------------------------------------------------------------- 1 | UX Components contributors (sorted alphabetically) 2 | ============================================ 3 | 4 | * **[Victor Dudochkin](https://github.com/dudochkin.victor)** 5 | 6 | * Core development 7 | 8 | 9 | 10 | **[Full contributors list](https://github.com/angular-rust/ux-components/contributors).** -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | # Security Policy 2 | 3 | If you believe you have found a security vulnerability in Angular Rust, we encourage you to let us know right away. We will investigate all legitimate reports and do our best to quickly fix the problem. 4 | 5 | ## Reporting a Vulnerability 6 | 7 | To report a security vulnerability, please create a Github issue [here](https://github.com/angular-rust/ux-components/issues/new). 8 | 9 | If you can, please include the following details: 10 | * An MCVE (minimum complete verifiable example) – this is a short code snippet which demonstrates the error in the 11 | the simplest possible (or just a simple) way. 12 | * Which versions of Angular Rust the vulnerability is present in 13 | * What effects the vulnerability has and how serious the vulnerability is -------------------------------------------------------------------------------- /TODO.md: -------------------------------------------------------------------------------- 1 | Curves 2 | GestureDetector 3 | StatelessWidget 4 | DefaultTabController 5 | SingleChildScrollView 6 | BouncingScrollPhysics 7 | SafeArea 8 | TabBarIndicatorSize 9 | UnderlineTabIndicator 10 | ScaffoldState 11 | PopupMenuButton 12 | InputDecoration 13 | InputBorder 14 | TextEditingController 15 | 16 | 17 | # InWork 18 | 19 | # Done 20 | AnimationController 21 | Animation 22 | CircleAvatar 23 | CustomPainter 24 | DragStartDetails 25 | DragUpdateDetails 26 | DragEndDetails 27 | FittedBox 28 | InkWell 29 | Opacity 30 | MediaQuery 31 | RoundedRectangleBorder 32 | Flexible 33 | kToolbarHeight 34 | ClipPath 35 | ClipOval 36 | MaterialPageRoute -------------------------------------------------------------------------------- /examples/main.rs.bak: -------------------------------------------------------------------------------- 1 | use components::prelude::*; 2 | use components::{Spinner, Window}; 3 | 4 | #[derive(Default, Application)] 5 | struct Application { 6 | window: Window, 7 | } 8 | 9 | impl Application { 10 | fn new() -> Self { 11 | let app: Self = Default::default(); 12 | app.window 13 | .set_window_size(512, 512) 14 | .set_title("Sample window") 15 | .show() 16 | .connect_destroy(move |_win| { 17 | println!("GOT {}", _win.test_check()); 18 | Application::quit() 19 | }); 20 | 21 | app.window.set_background_color(Some(color::TEAL_9)); 22 | 23 | let spinner = Spinner::new(); 24 | app.window.set_child(&spinner); 25 | 26 | app 27 | } 28 | } 29 | 30 | fn main() { 31 | Application::run(); 32 | } 33 | -------------------------------------------------------------------------------- /macro/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | ## Package vX.X.X (YYYY-MM-DD) 4 | 5 | ### Improved 6 | 7 | - A here your changes 8 | 9 | ### Added 10 | 11 | - A here your changes 12 | 13 | ### Fixed 14 | 15 | - A here your changes 16 | 17 | ### Improvement 18 | 19 | - A here your changes 20 | 21 | ### Removed 22 | 23 | - A here your changes 24 | 25 | -------------------------------------------------------------------------------- /macro/CONTRIBUTORS.md: -------------------------------------------------------------------------------- 1 | UX Components contributors (sorted alphabetically) 2 | ============================================ 3 | 4 | * **[Victor Dudochkin](https://github.com/dudochkin.victor)** 5 | 6 | * Core development 7 | 8 | 9 | 10 | **[Full contributors list](https://github.com/angular-rust/ux-components/contributors).** -------------------------------------------------------------------------------- /macro/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "ux-macro" 3 | version = "0.1.0" 4 | authors = ["Victor Dudochkin "] 5 | readme = "README.md" 6 | homepage = "https://angular-rust.github.io/ux-components" 7 | repository = "https://github.com/angular-rust/ux-components" 8 | documentation = "https://docs.rs/ux-components" 9 | description = "Backend agnostic GUI framework" 10 | keywords = ["wasm", "web", "material-design", "material-components", "gtk"] 11 | categories = ["development-tools::procedural-macro-helpers"] 12 | edition = "2018" 13 | license = "MPL-2.0" 14 | 15 | [badges] 16 | maintenance = { status = "actively-developed" } 17 | 18 | [lib] 19 | proc-macro = true 20 | 21 | [dependencies] 22 | proc-macro2 = "1.0" 23 | syn = "1.0" 24 | quote = "1.0" 25 | 26 | 27 | [dev-dependencies] 28 | -------------------------------------------------------------------------------- /macro/SECURITY.md: -------------------------------------------------------------------------------- 1 | # Security Policy 2 | 3 | If you believe you have found a security vulnerability in Angular Rust, we encourage you to let us know right away. We will investigate all legitimate reports and do our best to quickly fix the problem. 4 | 5 | ## Reporting a Vulnerability 6 | 7 | To report a security vulnerability, please create a Github issue [here](https://github.com/angular-rust/ux-components/issues/new). 8 | 9 | If you can, please include the following details: 10 | * An MCVE (minimum complete verifiable example) – this is a short code snippet which demonstrates the error in the 11 | the simplest possible (or just a simple) way. 12 | * Which versions of Angular Rust the vulnerability is present in 13 | * What effects the vulnerability has and how serious the vulnerability is -------------------------------------------------------------------------------- /macro/TODO.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/angular-rust/ux-components/5dd19f4640de5807a4b26272ad8675fa52eccbcd/macro/TODO.md -------------------------------------------------------------------------------- /macro/src/application/microservice_main.md: -------------------------------------------------------------------------------- 1 | # microservice-rs 2 | Plumbing for Rust microservices. 3 | 4 | ## Overview 5 | 6 | This crate aims to identify key functionality of good Rust microservices, and provide it with a simple procedural macro, removing the need for boilerplate code. 7 | 8 | Currently, the crate focuses on the following functionality: 9 | 10 | * **Structured Logging**. A `slog::Logger` is configured for JSON output to stdout by default. The user is encouraged to structure their log messages as much as possible. 11 | * **Configuration**: The user can define a configuration type which must implement `Deserialize`. It is automatically loaded from a YAML file, with overrides from environment variables. 12 | * **Signal Handling**: Proper microservices running in Kubernetes or Docker should be able to handle `SIGINT` or `SIGTERM` to shut down gracefully. 13 | 14 | Here is an example of a basic application which makes use of this crate: 15 | 16 | ```rust 17 | use slog::{Logger, info, warn, debug}; 18 | use serde::Deserialize; 19 | 20 | #[derive(Debug)] 21 | struct Error; 22 | 23 | #[derive(Deserialize, Debug)] 24 | struct Config { 25 | iter: usize 26 | } 27 | 28 | #[microservice::main] 29 | fn main(logger: Logger, config: Config, signal: Signal) -> Result<(), Error> { 30 | info!(logger, "Hello World."); 31 | let mut n = 0; 32 | loop { 33 | debug!(logger, "Iteration."; 34 | "n" => n 35 | ); 36 | if signal.check() { 37 | warn!(logger, "Detected signal."); 38 | break; 39 | } 40 | n += 1; 41 | std::thread::sleep(std::time::Duration::from_millis(1000)); 42 | } 43 | Ok(()) 44 | } 45 | ``` 46 | 47 | Logging, configuration parsing, and signal handling are all injected right into your main function. 48 | 49 | 50 | ## Todo 51 | 52 | - [ ] Async main support. 53 | - [ ] Catch panics. 54 | - [ ] Rewrite return error type to include plumbing errors. 55 | 56 | 57 | -------------------------------------------------------------------------------- /macro/src/application/microservice_main.rs: -------------------------------------------------------------------------------- 1 | extern crate proc_macro; 2 | 3 | use syn; 4 | use quote::quote; 5 | use proc_macro::TokenStream; 6 | 7 | #[proc_macro_attribute] 8 | pub fn main(_args: TokenStream, item: TokenStream) -> TokenStream { 9 | let input = syn::parse_macro_input!(item as syn::ItemFn); 10 | let output = input.sig.output; 11 | let block = input.block; 12 | let output = quote! { 13 | fn main() #output { 14 | fn app_main(logger: Logger, config: Config, signal: microservice::Signal) #output { 15 | #block 16 | } 17 | microservice::microservice_run(app_main) 18 | } 19 | }; 20 | output.into() 21 | } 22 | -------------------------------------------------------------------------------- /macro/src/application/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod getters; 2 | pub mod run; -------------------------------------------------------------------------------- /macro/src/application/run.rs: -------------------------------------------------------------------------------- 1 | #![allow(unused_imports)] 2 | 3 | use quote::quote; 4 | 5 | use syn::DeriveInput; 6 | -------------------------------------------------------------------------------- /macro/src/lib.rs: -------------------------------------------------------------------------------- 1 | use proc_macro::TokenStream; 2 | use syn::{parse_macro_input, DeriveInput}; 3 | use quote::quote; 4 | 5 | mod application; 6 | 7 | use application::getters::expand_getters; 8 | 9 | // 10 | // Application related things 11 | // 12 | 13 | #[proc_macro_derive(Getters)] 14 | pub fn getters(input: TokenStream) -> TokenStream { 15 | let input = parse_macro_input!(input as DeriveInput); 16 | expand_getters(input) 17 | .unwrap_or_else(syn::Error::into_compile_error) 18 | .into() 19 | } 20 | 21 | #[proc_macro_derive(Setters)] 22 | pub fn setters(input: TokenStream) -> TokenStream { 23 | let input = parse_macro_input!(input as DeriveInput); 24 | expand_getters(input) 25 | .unwrap_or_else(syn::Error::into_compile_error) 26 | .into() 27 | } 28 | 29 | #[proc_macro_derive(Application)] 30 | pub fn writable_template_derive(input: TokenStream) -> TokenStream { 31 | let input = parse_macro_input!(input as DeriveInput); 32 | 33 | // get the name of the type we want to implement the trait for 34 | let name = &input.ident; 35 | 36 | let expanded = quote! { 37 | impl #name { 38 | fn run() -> #name { 39 | application::init(); 40 | let app = Self::new(); 41 | application::run(); 42 | app 43 | } 44 | 45 | fn quit() { 46 | application::quit() 47 | } 48 | } 49 | }; 50 | 51 | TokenStream::from(expanded) 52 | } 53 | 54 | // 55 | // Inspect related things 56 | // 57 | 58 | #[cfg(test)] 59 | mod tests { 60 | #[test] 61 | fn it_works() { 62 | assert_eq!(2 + 2, 4); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /src/animation/animation.rs: -------------------------------------------------------------------------------- 1 | use super::AnimationStatus; 2 | 3 | pub struct Animation { 4 | // Whether this animation is stopped at the end. 5 | pub is_completed: bool, 6 | 7 | // Whether this animation is stopped at the beginning. 8 | pub is_dismissed: bool, 9 | 10 | // The current status of this animation. 11 | pub status: AnimationStatus, 12 | 13 | // The current value of the animation. 14 | pub value: T, 15 | } 16 | 17 | impl Animation { 18 | // Calls the listener every time the value of the animation changes. 19 | // addListener(VoidCallback listener) → void 20 | 21 | // Calls listener every time the status of the animation changes. 22 | // addStatusListener(AnimationStatusListener listener) → void 23 | 24 | // Chains a Tween (or CurveTween) to this Animation. 25 | // drive(Animatable child) → Animation 26 | 27 | // Stop calling the listener every time the value of the animation changes. 28 | // removeListener(VoidCallback listener) → void 29 | 30 | // Stops calling the listener every time the status of the animation changes. 31 | // removeStatusListener(AnimationStatusListener listener) → void 32 | } -------------------------------------------------------------------------------- /src/animation/curve.rs: -------------------------------------------------------------------------------- 1 | pub trait Curve { 2 | // // Returns a new curve that is the reversed inversion of this one. [...] 3 | // flipped: Curve, 4 | 5 | // Returns the value of the curve at point t. 6 | fn transform(&self, t: f32) -> f32; 7 | } 8 | 9 | #[derive(Default)] 10 | pub struct NoneCurve; 11 | 12 | impl Curve for NoneCurve { 13 | fn transform(&self, t: f32) -> f32 { 14 | todo!() 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/animation/enums/animation_behavior.rs: -------------------------------------------------------------------------------- 1 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] 2 | pub enum AnimationBehavior { 3 | // The AnimationController will reduce its duration when AccessibilityFeatures.disableAnimations is true. 4 | Normal = 0, 5 | // The AnimationController will preserve its behavior. 6 | // This is the default for repeating animations in order to prevent them from flashing rapidly on the screen 7 | // if the widget does not take the AccessibilityFeatures.disableAnimations flag into account. 8 | Preserve = 1, 9 | } 10 | 11 | impl Default for AnimationBehavior { 12 | fn default() -> Self { 13 | Self::Normal 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/animation/enums/animation_status.rs: -------------------------------------------------------------------------------- 1 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] 2 | pub enum AnimationStatus { 3 | // The animation is stopped at the beginning. 4 | Dismissed = 0, 5 | // The animation is running from beginning to end. 6 | Forward = 1, 7 | // The animation is running backwards, from end to beginning. 8 | Reverse = 2, 9 | // The animation is stopped at the end. 10 | Completed = 3, 11 | } 12 | 13 | impl Default for AnimationStatus { 14 | fn default() -> Self { 15 | Self::Dismissed 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/animation/enums/mod.rs: -------------------------------------------------------------------------------- 1 | mod animation_behavior; 2 | pub use self::animation_behavior::*; 3 | 4 | mod animation_status; 5 | pub use self::animation_status::*; -------------------------------------------------------------------------------- /src/animation/mod.rs: -------------------------------------------------------------------------------- 1 | mod enums; 2 | pub use self::enums::*; 3 | 4 | mod animation_controller; 5 | pub use self::animation_controller::*; 6 | 7 | mod animation; 8 | pub use self::animation::*; 9 | 10 | mod curve; 11 | pub use self::curve::*; -------------------------------------------------------------------------------- /src/foundation/atomic.rs: -------------------------------------------------------------------------------- 1 | use super::Id; 2 | 3 | #[derive(Default, Debug, Copy, Clone, PartialEq, Hash)] 4 | pub struct Parent(pub Id); 5 | 6 | #[derive(Default, Debug, Copy, Clone)] 7 | pub struct Visibility(pub bool); 8 | 9 | #[derive(Default, Debug, Copy, Clone)] 10 | pub struct Position(pub f32, pub f32); 11 | 12 | #[derive(Default, Debug, Copy, Clone)] 13 | pub struct Size(pub f32, pub f32); 14 | 15 | /// Immutable layout constraints. 16 | /// Similar as Flutter implementation 17 | /// 18 | #[derive(Default, Debug, Copy, Clone)] 19 | pub struct BoxConstraints { 20 | pub min: Option, 21 | pub max: Option, 22 | } 23 | -------------------------------------------------------------------------------- /src/foundation/helper.rs: -------------------------------------------------------------------------------- 1 | use std::char; 2 | 3 | /// A simple set of static helper functions for mint controls to use 4 | pub struct Helper {} 5 | 6 | impl Helper { 7 | // static 8 | pub fn sign(x: f32) -> i32 { 9 | if x < 0.0 { 10 | -1 11 | } else if x > 0.0 { 12 | 1 13 | } else { 14 | 0 15 | } 16 | } 17 | 18 | // static 19 | pub fn in_rect(x: f32, y: f32, rx: f32, ry: f32, rw: f32, rh: f32) -> bool { 20 | if x < rx { 21 | return false; 22 | } 23 | 24 | if y < ry { 25 | return false; 26 | } 27 | 28 | if x > rx + rw { 29 | return false; 30 | } 31 | 32 | if y > ry + rh { 33 | return false; 34 | } 35 | 36 | true 37 | } 38 | 39 | // static 40 | // ?val:Option 41 | pub fn uniqueid(val: Option) -> String { 42 | let val = val.unwrap_or_else(rand::random); 43 | 44 | fn to_char(value: u32) -> char { 45 | if value > 9 { 46 | let mut ascii = 65 + (value - 10); 47 | if ascii > 90 { 48 | ascii += 6; 49 | } 50 | char::from_u32(ascii).unwrap() 51 | } else { 52 | format!("{}", value).chars().next().unwrap() 53 | } 54 | } //to_char 55 | 56 | let r = (val % 62) as u32; 57 | let q = (val / 62) as u32; 58 | if q > 0 { 59 | return format!("{}{}", Self::uniqueid(Some(q)), to_char(r)); 60 | } else { 61 | return format!("{}", to_char(r)); 62 | } 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /src/foundation/local_key.rs: -------------------------------------------------------------------------------- 1 | // inherited Key 2 | pub struct LocalKey; 3 | -------------------------------------------------------------------------------- /src/foundation/mod.rs: -------------------------------------------------------------------------------- 1 | pub use dx::foundation::*; 2 | 3 | mod enums; 4 | pub use self::enums::*; 5 | 6 | mod events; 7 | pub use self::events::*; 8 | 9 | pub mod properties; 10 | 11 | // 12 | 13 | mod atomic; 14 | pub use self::atomic::*; 15 | 16 | mod helper; 17 | pub use self::helper::*; 18 | 19 | mod key; 20 | pub use self::key::*; 21 | 22 | mod local_key; 23 | pub use self::local_key::*; 24 | 25 | mod margins; 26 | pub use self::margins::*; 27 | 28 | mod signal; 29 | pub use self::signal::*; 30 | 31 | mod target_platform; 32 | pub use self::target_platform::*; 33 | 34 | mod value_changed; 35 | pub use self::value_changed::*; 36 | 37 | mod material_application_host; 38 | pub use self::material_application_host::*; 39 | 40 | mod material_application; 41 | pub use self::material_application::*; 42 | 43 | mod widget_properties; 44 | pub use self::widget_properties::*; 45 | 46 | mod widget; 47 | pub use self::widget::*; 48 | -------------------------------------------------------------------------------- /src/foundation/properties/mod.rs: -------------------------------------------------------------------------------- 1 | mod button; 2 | pub use button::*; 3 | 4 | mod canvas; 5 | pub use canvas::*; 6 | 7 | mod checkbox; 8 | pub use checkbox::*; 9 | 10 | mod dropdown; 11 | pub use dropdown::*; 12 | 13 | mod image; 14 | pub use self::image::*; 15 | 16 | mod label; 17 | pub use label::*; 18 | 19 | mod list; 20 | pub use list::*; 21 | 22 | mod panel; 23 | pub use panel::*; 24 | 25 | mod progress; 26 | pub use progress::*; 27 | 28 | mod scroll; 29 | pub use scroll::*; 30 | 31 | mod slider; 32 | pub use slider::*; 33 | 34 | mod textedit; 35 | pub use textedit::*; 36 | 37 | mod window; 38 | pub use window::*; 39 | -------------------------------------------------------------------------------- /src/foundation/signal.rs: -------------------------------------------------------------------------------- 1 | use std::{cell::RefCell, fmt, rc::Rc}; 2 | 3 | use intmap::IntMap; 4 | 5 | use super::{KeyEvent, MouseEvent, TextEvent}; 6 | 7 | #[derive(Default, Debug, Copy, Clone, PartialEq, Hash)] 8 | pub struct Slot(pub u64); 9 | 10 | impl Slot { 11 | pub fn id(&self) -> u64 { 12 | self.0 13 | } 14 | } 15 | 16 | /// A signal for mouse input events 17 | pub type MouseSignal = Signal; 18 | /// A signal for key input events 19 | pub type KeySignal = Signal; 20 | /// A signal for text input events 21 | pub type TextSignal = Signal; 22 | 23 | #[derive(Clone)] 24 | pub struct Signal { 25 | listeners: Rc>>>, 26 | } 27 | 28 | impl Default for Signal { 29 | fn default() -> Self { 30 | Self { 31 | listeners: Rc::new(RefCell::new(IntMap::new())), 32 | } 33 | } 34 | } 35 | 36 | impl fmt::Debug for Signal { 37 | fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { 38 | write!(f, "Signal") 39 | } 40 | } 41 | 42 | impl Signal { 43 | pub fn new() -> Self { 44 | Self::default() 45 | } 46 | 47 | pub fn listen(&self, handler: Box) -> Slot { 48 | let slot = Slot(rand::random()); 49 | let mut listeners = self.listeners.borrow_mut(); 50 | listeners.insert(slot.id(), handler); 51 | 52 | slot 53 | } 54 | 55 | pub fn remove(&self, slot: Slot) -> Option> { 56 | let mut listeners = self.listeners.borrow_mut(); 57 | listeners.remove(slot.id()) 58 | } 59 | 60 | pub fn has(&self, slot: Slot) -> bool { 61 | let listeners = self.listeners.borrow(); 62 | listeners.contains_key(slot.id()) 63 | } 64 | 65 | pub fn clear(&self) { 66 | let mut listeners = self.listeners.borrow_mut(); 67 | listeners.clear(); 68 | } 69 | 70 | pub fn emit(&self, arg: &T) { 71 | let listeners = self.listeners.borrow(); 72 | for (_, handler) in listeners.iter() { 73 | handler.as_ref()(arg); 74 | } 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /src/foundation/target_platform.rs: -------------------------------------------------------------------------------- 1 | pub enum TargetPlatform { 2 | Android = 0, 3 | Fuchsia = 1, 4 | Ios = 2, 5 | Linux = 3, 6 | MacOs = 4, 7 | Windows = 5, 8 | } 9 | 10 | impl Default for TargetPlatform { 11 | fn default() -> Self { 12 | Self::Android 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/foundation/value_changed.rs: -------------------------------------------------------------------------------- 1 | pub type ValueChanged = Box; 2 | -------------------------------------------------------------------------------- /src/foundation/widget.rs: -------------------------------------------------------------------------------- 1 | // use crate::elements::Element; 2 | 3 | #[derive(Default, Debug, Copy, Clone, PartialEq, Eq, Hash, PartialOrd, Ord)] 4 | pub struct Id(pub u64); 5 | 6 | impl Id { 7 | // pub fn widget(&self) -> Option<&Box> { 8 | // todo!() 9 | // } 10 | } 11 | 12 | #[derive(Default, Debug, Clone, Copy)] 13 | pub struct ChildBounds { 14 | pub x: f32, 15 | pub y: f32, 16 | pub w: f32, 17 | pub h: f32, 18 | 19 | pub x_local: f32, 20 | pub y_local: f32, 21 | } 22 | -------------------------------------------------------------------------------- /src/foundation/widget_properties.rs: -------------------------------------------------------------------------------- 1 | use super::{Id, Key}; 2 | 3 | /// Options for constructing a control 4 | pub trait WidgetProperties { 5 | // /// Generic framework/user specific options, 6 | // /// which can be strong typed on the receiving end. 7 | // fn options(&self) -> &HashMap; 8 | 9 | // /// Generic framework/user specific data to store on the control `user` property, 10 | // /// which can be strong typed on the receiving end. 11 | // fn user(&self) -> &HashMap; 12 | 13 | /// The widdget key 14 | fn key(&self) -> &Key; 15 | 16 | /// The control x position, relative to its container 17 | fn x(&self) -> f32; 18 | /// The control y position, relative to its container 19 | fn y(&self) -> f32; 20 | 21 | /// The control width 22 | fn w(&self) -> f32; 23 | /// The control height 24 | fn h(&self) -> f32; 25 | 26 | /// The control minimum width 27 | fn w_min(&self) -> f32; 28 | /// The control minimum height 29 | fn h_min(&self) -> f32; 30 | 31 | /// The control maximum width 32 | fn w_max(&self) -> f32; 33 | /// The control maximum height 34 | fn h_max(&self) -> f32; 35 | 36 | /// The control parent, if any 37 | fn parent(&self) -> Option; // should used to fetch WidgetComponent 38 | 39 | /// The control depth. Usually set internally 40 | fn depth(&self) -> f32; 41 | /// Whether or not the control is visible at creation 42 | fn visible(&self) -> bool; 43 | /// Whether or not the control responds to mouse input 44 | fn mouse_input(&self) -> bool; 45 | /// Whether or not the control responds to key input 46 | fn key_input(&self) -> bool; 47 | /// Whether or not the control emits render signals from the canvas render call 48 | fn renderable(&self) -> bool; 49 | /// Internal. Internal parent visibility for creating sub controls. 50 | fn internal_visible(&self) -> bool; 51 | } 52 | -------------------------------------------------------------------------------- /src/gestures/drag_end_details.rs: -------------------------------------------------------------------------------- 1 | use super::Velocity; 2 | 3 | pub struct DragEndDetails { 4 | // The velocity the pointer was moving along the primary axis when it 5 | // stopped contacting the screen, in logical pixels per second. 6 | pub primary_velocity: Option, 7 | 8 | // The velocity the pointer was moving when it stopped contacting the screen. 9 | pub velocity: Velocity, 10 | } 11 | -------------------------------------------------------------------------------- /src/gestures/drag_start_behavior.rs: -------------------------------------------------------------------------------- 1 | pub enum DragStartBehavior { 2 | Down = 0, 3 | Start = 1, 4 | } 5 | 6 | impl Default for DragStartBehavior { 7 | fn default() -> Self { 8 | Self::Down 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/gestures/drag_start_details.rs: -------------------------------------------------------------------------------- 1 | use std::time::Duration; 2 | 3 | use crate::ui::{Offset, PointerDeviceKind}; 4 | 5 | pub struct DragStartDetails { 6 | // The global position at which the pointer contacted the screen. 7 | pub global_position: Offset, 8 | 9 | // The kind of the device that initiated the event. 10 | pub kind: Option, 11 | 12 | // The local position in the coordinate system of the event receiver at which the pointer contacted the screen. 13 | pub local_position: Offset, 14 | 15 | // Recorded timestamp of the source pointer event that triggered the drag event. 16 | pub source_time_stamp: Option, 17 | } 18 | -------------------------------------------------------------------------------- /src/gestures/drag_update_details.rs: -------------------------------------------------------------------------------- 1 | use std::time::Duration; 2 | 3 | use crate::ui::Offset; 4 | 5 | pub struct DragUpdateDetails { 6 | // The amount the pointer has moved in the coordinate space of 7 | // the event receiver since the previous update. 8 | pub delta: Offset, 9 | 10 | // The pointer's global position when it triggered this update. 11 | pub global_position: Offset, 12 | 13 | // The local position in the coordinate system of the event receiver 14 | // at which the pointer contacted the screen. 15 | pub local_position: Offset, 16 | 17 | // The amount the pointer has moved along the primary axis in the coordinate 18 | // space of the event receiver since the previous update. 19 | pub primary_delta: Option, 20 | 21 | // Recorded timestamp of the source pointer event that triggered the drag event. 22 | pub source_time_stamp: Option, 23 | } 24 | -------------------------------------------------------------------------------- /src/gestures/mod.rs: -------------------------------------------------------------------------------- 1 | mod drag_end_details; 2 | pub use self::drag_end_details::*; 3 | 4 | mod drag_start_behavior; 5 | pub use self::drag_start_behavior::*; 6 | 7 | mod drag_start_details; 8 | pub use self::drag_start_details::*; 9 | 10 | mod drag_update_details; 11 | pub use self::drag_update_details::*; 12 | 13 | mod gesture_recognizer; 14 | pub use self::gesture_recognizer::*; 15 | 16 | mod pointer_enter_event; 17 | pub use self::pointer_enter_event::*; 18 | 19 | mod pointer_event; 20 | pub use self::pointer_event::*; 21 | 22 | mod pointer_exit_event; 23 | pub use self::pointer_exit_event::*; 24 | 25 | mod velocity; 26 | pub use self::velocity::*; -------------------------------------------------------------------------------- /src/gestures/velocity.rs: -------------------------------------------------------------------------------- 1 | use crate::ui::Offset; 2 | 3 | pub struct Velocity { 4 | // The number of pixels per second of velocity in the x and y directions. 5 | pub pixels_per_second: Offset, 6 | } 7 | -------------------------------------------------------------------------------- /src/material/alignment_geometry.rs: -------------------------------------------------------------------------------- 1 | pub trait AlignmentGeometry { 2 | // Returns the sum of two AlignmentGeometry objects. 3 | // add(AlignmentGeometry other) -> AlignmentGeometry 4 | 5 | // Convert this instance into an Alignment, which uses literal coordinates (the x coordinate being explicitly a distance from the left).// 6 | // resolve(TextDirection? direction) -> Alignment 7 | } 8 | 9 | pub struct NoneAlignmentGeometry; 10 | 11 | impl AlignmentGeometry for NoneAlignmentGeometry { 12 | 13 | } 14 | -------------------------------------------------------------------------------- /src/material/bottom_app_bar_theme.rs: -------------------------------------------------------------------------------- 1 | use crate::{foundation::colorspace::Color, painting::NotchedShape}; 2 | 3 | pub struct BottomAppBarTheme { 4 | pub color: Color, 5 | pub elevation: f32, 6 | pub shape: NotchedShape, 7 | } 8 | 9 | impl Default for BottomAppBarTheme { 10 | fn default() -> Self { 11 | Self { 12 | color: Default::default(), 13 | elevation: Default::default(), 14 | shape: Default::default(), 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/material/bottom_navigation_bar_landscape_layout.rs: -------------------------------------------------------------------------------- 1 | pub enum BottomNavigationBarLandscapeLayout { 2 | Spread = 0, 3 | Centered = 1, 4 | Linear = 2, 5 | } 6 | 7 | impl Default for BottomNavigationBarLandscapeLayout { 8 | fn default() -> Self { 9 | Self::Spread 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/material/bottom_navigation_bar_theme_data.rs: -------------------------------------------------------------------------------- 1 | use crate::{foundation::colorspace::Color, painting::TextStyle, widgets::IconThemeData}; 2 | 3 | use super::{BottomNavigationBarLandscapeLayout, BottomNavigationBarType}; 4 | 5 | pub struct BottomNavigationBarThemeData { 6 | pub background_color: Color, 7 | pub elevation: f32, 8 | pub selected_icon_theme: IconThemeData, 9 | pub unselected_icon_theme: IconThemeData, 10 | pub selected_item_color: Color, 11 | pub unselected_item_color: Color, 12 | pub selected_label_style: TextStyle, 13 | pub unselected_label_style: TextStyle, 14 | pub show_selected_labels: bool, 15 | pub show_unselected_labels: bool, 16 | pub bar_type: BottomNavigationBarType, 17 | pub enable_feedback: bool, 18 | pub landscape_layout: BottomNavigationBarLandscapeLayout, 19 | } 20 | 21 | impl Default for BottomNavigationBarThemeData { 22 | fn default() -> Self { 23 | Self { 24 | background_color: Default::default(), 25 | elevation: Default::default(), 26 | selected_icon_theme: Default::default(), 27 | unselected_icon_theme: Default::default(), 28 | selected_item_color: Default::default(), 29 | unselected_item_color: Default::default(), 30 | selected_label_style: Default::default(), 31 | unselected_label_style: Default::default(), 32 | show_selected_labels: Default::default(), 33 | show_unselected_labels: Default::default(), 34 | bar_type: Default::default(), 35 | enable_feedback: Default::default(), 36 | landscape_layout: Default::default(), 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/material/bottom_navigation_bar_type.rs: -------------------------------------------------------------------------------- 1 | pub enum BottomNavigationBarType { 2 | Fixed = 0, 3 | Shifting = 1, 4 | } 5 | 6 | impl Default for BottomNavigationBarType { 7 | fn default() -> Self { 8 | Self::Fixed 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/material/bottom_sheet_theme_data.rs: -------------------------------------------------------------------------------- 1 | use crate::{ 2 | foundation::colorspace::Color, 3 | painting::{NoneShapeBorder, ShapeBorder}, 4 | rendering::BoxConstraints, 5 | ui::Clip, 6 | }; 7 | pub struct BottomSheetThemeData { 8 | pub background_color: Color, 9 | pub elevation: f32, 10 | pub modal_background_color: Color, 11 | pub modal_elevation: f32, 12 | pub shape: Box, 13 | pub clip_behavior: Clip, 14 | pub constraints: BoxConstraints, 15 | } 16 | 17 | impl Default for BottomSheetThemeData { 18 | fn default() -> Self { 19 | Self { 20 | background_color: Default::default(), 21 | elevation: Default::default(), 22 | modal_background_color: Default::default(), 23 | modal_elevation: Default::default(), 24 | shape: box NoneShapeBorder, 25 | clip_behavior: Default::default(), 26 | constraints: Default::default(), 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/material/button_bar_layout_behavior.rs: -------------------------------------------------------------------------------- 1 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] 2 | pub enum ButtonBarLayoutBehavior { 3 | Constrained = 0, 4 | Padded = 1, 5 | } 6 | 7 | impl Default for ButtonBarLayoutBehavior { 8 | fn default() -> Self { 9 | Self::Constrained 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/material/button_bar_theme_data.rs: -------------------------------------------------------------------------------- 1 | use crate::{ 2 | painting::{EdgeInsetsGeometry, VerticalDirection, NoneEdgeInsetsGeometry}, 3 | rendering::{MainAxisAlignment, MainAxisSize}, 4 | }; 5 | 6 | use super::{ButtonBarLayoutBehavior, ButtonTextTheme}; 7 | 8 | pub struct ButtonBarThemeData { 9 | pub alignment: MainAxisAlignment, 10 | pub main_axis_size: MainAxisSize, 11 | pub button_text_theme: ButtonTextTheme, 12 | pub button_min_width: f32, 13 | pub button_height: f32, 14 | pub button_padding: Box, 15 | pub button_aligned_dropdown: bool, 16 | pub layout_behavior: ButtonBarLayoutBehavior, 17 | pub overflow_direction: VerticalDirection, 18 | } 19 | 20 | impl Default for ButtonBarThemeData { 21 | fn default() -> Self { 22 | Self { 23 | alignment: Default::default(), 24 | main_axis_size: Default::default(), 25 | button_text_theme: Default::default(), 26 | button_min_width: Default::default(), 27 | button_height: Default::default(), 28 | button_padding: box NoneEdgeInsetsGeometry, 29 | button_aligned_dropdown: Default::default(), 30 | layout_behavior: Default::default(), 31 | overflow_direction: Default::default(), 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/material/button_text_theme.rs: -------------------------------------------------------------------------------- 1 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] 2 | pub enum ButtonTextTheme { 3 | Normal = 0, 4 | Accent = 1, 5 | Primary = 2, 6 | } 7 | 8 | impl Default for ButtonTextTheme { 9 | fn default() -> Self { 10 | Self::Normal 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/material/card_theme.rs: -------------------------------------------------------------------------------- 1 | use crate::{ 2 | foundation::colorspace::Color, 3 | painting::{EdgeInsetsGeometry, NoneEdgeInsetsGeometry, NoneShapeBorder, ShapeBorder}, 4 | ui::Clip, 5 | }; 6 | 7 | pub struct CardTheme { 8 | pub clip_behavior: Clip, 9 | pub color: Color, 10 | pub shadow_color: Color, 11 | pub elevation: f32, 12 | pub margin: Box, 13 | pub shape: Box, 14 | } 15 | 16 | impl Default for CardTheme { 17 | fn default() -> Self { 18 | Self { 19 | clip_behavior: Default::default(), 20 | color: Default::default(), 21 | shadow_color: Default::default(), 22 | elevation: Default::default(), 23 | margin: box NoneEdgeInsetsGeometry, 24 | shape: box NoneShapeBorder, 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/material/checkbox_theme_data.rs: -------------------------------------------------------------------------------- 1 | use crate::{ 2 | foundation::colorspace::Color, 3 | painting::{BorderSide, NoneOutlinedBorder, OutlinedBorder}, 4 | services::MouseCursor, 5 | }; 6 | 7 | use super::{MaterialStateProperty, MaterialTapTargetSize, VisualDensity}; 8 | pub struct CheckboxThemeData { 9 | pub mouse_cursor: MaterialStateProperty, 10 | pub fill_color: MaterialStateProperty, 11 | pub check_color: MaterialStateProperty, 12 | pub overlay_color: MaterialStateProperty, 13 | pub splash_radius: f32, 14 | pub material_tap_target_size: MaterialTapTargetSize, 15 | pub visual_density: VisualDensity, 16 | pub shape: Box, 17 | pub side: BorderSide, 18 | } 19 | 20 | impl Default for CheckboxThemeData { 21 | fn default() -> Self { 22 | Self { 23 | mouse_cursor: Default::default(), 24 | fill_color: Default::default(), 25 | check_color: Default::default(), 26 | overlay_color: Default::default(), 27 | splash_radius: Default::default(), 28 | material_tap_target_size: Default::default(), 29 | visual_density: Default::default(), 30 | shape: box NoneOutlinedBorder, 31 | side: Default::default(), 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/material/chip_theme_data.rs: -------------------------------------------------------------------------------- 1 | use crate::{ 2 | foundation::colorspace::Color, 3 | painting::{ 4 | BorderSide, EdgeInsetsGeometry, NoneEdgeInsetsGeometry, NoneOutlinedBorder, OutlinedBorder, 5 | TextStyle, 6 | }, 7 | ui::Brightness, 8 | }; 9 | 10 | pub struct ChipThemeData { 11 | pub background_color: Color, 12 | pub delete_icon_color: Color, 13 | pub disabled_color: Color, 14 | pub selected_color: Color, 15 | pub secondary_selected_color: Color, 16 | pub shadow_color: Color, 17 | pub selected_shadow_color: Color, 18 | pub show_checkmark: bool, 19 | pub checkmark_color: Color, 20 | pub label_padding: Box, 21 | pub padding: Box, 22 | pub side: BorderSide, 23 | pub shape: Box, 24 | pub label_style: TextStyle, 25 | pub secondary_label_style: TextStyle, 26 | pub brightness: Brightness, 27 | pub elevation: f32, 28 | pub press_elevation: f32, 29 | } 30 | 31 | impl Default for ChipThemeData { 32 | fn default() -> Self { 33 | Self { 34 | background_color: Default::default(), 35 | delete_icon_color: Default::default(), 36 | disabled_color: Default::default(), 37 | selected_color: Default::default(), 38 | secondary_selected_color: Default::default(), 39 | shadow_color: Default::default(), 40 | selected_shadow_color: Default::default(), 41 | show_checkmark: Default::default(), 42 | checkmark_color: Default::default(), 43 | label_padding: box NoneEdgeInsetsGeometry, 44 | padding: box NoneEdgeInsetsGeometry, 45 | side: Default::default(), 46 | shape: box NoneOutlinedBorder, 47 | label_style: Default::default(), 48 | secondary_label_style: Default::default(), 49 | brightness: Default::default(), 50 | elevation: Default::default(), 51 | press_elevation: Default::default(), 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/material/color_scheme.rs: -------------------------------------------------------------------------------- 1 | use crate::{foundation::colorspace::Color, ui::Brightness}; 2 | 3 | /* 4 | copyWith({Color? primary, Color? primaryVariant, Color? secondary, Color? secondaryVariant, Color? surface, Color? background, Color? error, Color? onPrimary, Color? onSecondary, Color? onSurface, Color? onBackground, Color? onError, Brightness? brightness}) -> ColorScheme 5 | Creates a copy of this color scheme with the given fields replaced by the non-null parameter values. 6 | 7 | debugFillProperties(DiagnosticPropertiesBuilder properties) -> void 8 | Add additional properties associated with the node. 9 | */ 10 | 11 | pub struct ColorScheme { 12 | pub primary: Color, 13 | pub primary_variant: Color, 14 | pub secondary: Color, 15 | pub secondary_variant: Color, 16 | pub surface: Color, 17 | pub background: Color, 18 | pub error: Color, 19 | pub on_primary: Color, 20 | pub on_secondary: Color, 21 | pub on_surface: Color, 22 | pub on_background: Color, 23 | pub on_error: Color, 24 | pub brightness: Brightness, 25 | } 26 | 27 | impl Default for ColorScheme { 28 | fn default() -> Self { 29 | Self { 30 | primary: Default::default(), 31 | primary_variant: Default::default(), 32 | secondary: Default::default(), 33 | secondary_variant: Default::default(), 34 | surface: Default::default(), 35 | background: Default::default(), 36 | error: Default::default(), 37 | on_primary: Default::default(), 38 | on_secondary: Default::default(), 39 | on_surface: Default::default(), 40 | on_background: Default::default(), 41 | on_error: Default::default(), 42 | brightness: Default::default(), 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/material/data_table_theme_data.rs: -------------------------------------------------------------------------------- 1 | use crate::{ 2 | foundation::colorspace::Color, 3 | painting::{Decoration, NoneDecoration, TextStyle}, 4 | }; 5 | 6 | use super::MaterialStateProperty; 7 | 8 | pub struct DataTableThemeData { 9 | pub decoration: Box, 10 | pub data_row_color: MaterialStateProperty, 11 | pub data_row_height: f32, 12 | pub data_text_style: TextStyle, 13 | pub heading_row_color: MaterialStateProperty, 14 | pub heading_row_height: f32, 15 | pub heading_text_style: TextStyle, 16 | pub horizontal_margin: f32, 17 | pub column_spacing: f32, 18 | pub divider_thickness: f32, 19 | pub checkbox_horizontal_margin: f32, 20 | } 21 | 22 | impl Default for DataTableThemeData { 23 | fn default() -> Self { 24 | Self { 25 | decoration: box NoneDecoration, 26 | data_row_color: Default::default(), 27 | data_row_height: Default::default(), 28 | data_text_style: Default::default(), 29 | heading_row_color: Default::default(), 30 | heading_row_height: Default::default(), 31 | heading_text_style: Default::default(), 32 | horizontal_margin: Default::default(), 33 | column_spacing: Default::default(), 34 | divider_thickness: Default::default(), 35 | checkbox_horizontal_margin: Default::default(), 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/material/dialog_theme.rs: -------------------------------------------------------------------------------- 1 | use crate::{ 2 | foundation::colorspace::Color, 3 | painting::{NoneShapeBorder, ShapeBorder, TextStyle}, 4 | }; 5 | 6 | pub struct DialogTheme { 7 | pub background_color: Color, 8 | pub elevation: f32, 9 | pub shape: Box, 10 | pub title_text_style: TextStyle, 11 | pub content_text_style: TextStyle, 12 | } 13 | 14 | impl Default for DialogTheme { 15 | fn default() -> Self { 16 | Self { 17 | background_color: Default::default(), 18 | elevation: Default::default(), 19 | shape: box NoneShapeBorder, 20 | title_text_style: Default::default(), 21 | content_text_style: Default::default(), 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/material/divider_theme_data.rs: -------------------------------------------------------------------------------- 1 | use crate::foundation::colorspace::Color; 2 | 3 | pub struct DividerThemeData { 4 | pub color: Color, 5 | pub space: f32, 6 | pub thickness: f32, 7 | pub indent: f32, 8 | pub end_indent: f32, 9 | } 10 | 11 | impl Default for DividerThemeData { 12 | fn default() -> Self { 13 | Self { 14 | color: Default::default(), 15 | space: Default::default(), 16 | thickness: Default::default(), 17 | indent: Default::default(), 18 | end_indent: Default::default(), 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/material/drawer_callback.rs: -------------------------------------------------------------------------------- 1 | pub trait DrawerCallback { 2 | fn on_drawer(&self, is_opened: bool); 3 | } 4 | -------------------------------------------------------------------------------- /src/material/elevated_button_theme_data.rs: -------------------------------------------------------------------------------- 1 | use super::ButtonStyle; 2 | 3 | pub struct ElevatedButtonThemeData { 4 | pub style: ButtonStyle, 5 | } 6 | 7 | impl Default for ElevatedButtonThemeData { 8 | fn default() -> Self { 9 | Self { 10 | style: Default::default(), 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/material/enums/collapse_mode.rs: -------------------------------------------------------------------------------- 1 | pub enum CollapseMode { 2 | // The background widget will scroll in a parallax fashion. 3 | Parallax = 0, 4 | // The background widget pin in place until it reaches the min extent. 5 | Pin = 1, 6 | // The background widget will act as normal with no collapsing effect. 7 | None = 2, 8 | } 9 | 10 | impl Default for CollapseMode { 11 | fn default() -> Self { 12 | Self::Parallax 13 | } 14 | } -------------------------------------------------------------------------------- /src/material/enums/material_type.rs: -------------------------------------------------------------------------------- 1 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] 2 | pub enum MaterialType { 3 | // Rectangle using default theme canvas color. 4 | Canvas = 0, 5 | // Rounded edges, card theme color. 6 | Card = 1, 7 | // A circle, no color by default (used for floating action buttons). 8 | Circle = 2, 9 | // Rounded edges, no color by default (used for MaterialButton buttons). 10 | Button = 3, 11 | // A transparent piece of material that draws ink splashes and highlights. 12 | // While the material metaphor describes child widgets as printed on the material 13 | // itself and do not hide ink effects, in practice the Material widget draws 14 | // child widgets on top of the ink effects. A Material with type transparency 15 | // can be placed on top of opaque widgets to show ink effects on top of them. 16 | // Prefer using the Ink widget for showing ink effects on top of opaque widgets. 17 | Transparency = 4, 18 | } 19 | 20 | impl Default for MaterialType { 21 | fn default() -> Self { 22 | Self::Canvas 23 | } 24 | } -------------------------------------------------------------------------------- /src/material/enums/mod.rs: -------------------------------------------------------------------------------- 1 | mod collapse_mode; 2 | pub use self::collapse_mode::*; 3 | 4 | mod material_type; 5 | pub use self::material_type::*; 6 | 7 | mod stretch_mode; 8 | pub use self::stretch_mode::*; -------------------------------------------------------------------------------- /src/material/enums/stretch_mode.rs: -------------------------------------------------------------------------------- 1 | pub enum StretchMode { 2 | // The background widget will expand to fill the extra space. 3 | ZoomBackground = 0, 4 | 5 | // The background will blur using a ImageFilter.blur effect. 6 | BlurBackground = 1, 7 | 8 | // The title will fade away as the user over-scrolls. 9 | FadeTitle = 2, 10 | } 11 | 12 | impl Default for StretchMode { 13 | fn default() -> Self { 14 | Self::ZoomBackground 15 | } 16 | } -------------------------------------------------------------------------------- /src/material/floating_action_button_animator.rs: -------------------------------------------------------------------------------- 1 | /* 2 | getAnimationRestart(double previousValue) -> double 3 | Gets the progress value to restart a motion animation from when the animation is interrupted. 4 | getOffset({required Offset begin, required Offset end, required double progress}) -> Offset 5 | Gets the FloatingActionButton's position relative to the origin of the Scaffold based on progress. 6 | getRotationAnimation({required Animation parent}) -> Animation 7 | Animates the rotation of Scaffold.floatingActionButton. 8 | getScaleAnimation({required Animation parent}) -> Animation 9 | Animates the scale of the FloatingActionButton. 10 | */ 11 | pub struct FloatingActionButtonAnimator; 12 | 13 | impl Default for FloatingActionButtonAnimator { 14 | fn default() -> Self { 15 | Self {} 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/material/floating_action_button_location.rs: -------------------------------------------------------------------------------- 1 | /* 2 | getOffset(ScaffoldPrelayoutGeometry scaffoldGeometry) -> Offset 3 | Places the FloatingActionButton based on the Scaffold's layout. 4 | */ 5 | 6 | pub struct FloatingActionButtonLocation; 7 | 8 | impl Default for FloatingActionButtonLocation { 9 | fn default() -> Self { 10 | Self {} 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/material/floating_label_alignment.rs: -------------------------------------------------------------------------------- 1 | pub struct FloatingLabelAlignment(pub f32); 2 | 3 | impl FloatingLabelAlignment { 4 | // Aligns the floating label to the center of an InputDecorator. 5 | pub const CENTER: FloatingLabelAlignment = FloatingLabelAlignment(0.0); 6 | 7 | // Align the floating label on the leading edge of the InputDecorator. 8 | pub const START: FloatingLabelAlignment = FloatingLabelAlignment(-1.0); 9 | 10 | } -------------------------------------------------------------------------------- /src/material/floating_label_behavior.rs: -------------------------------------------------------------------------------- 1 | pub enum FloatingLabelBehavior { 2 | Never = 0, 3 | Auto = 1, 4 | Always = 2, 5 | } 6 | 7 | impl Default for FloatingLabelBehavior { 8 | fn default() -> Self { 9 | Self::Auto 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/material/input_border.rs: -------------------------------------------------------------------------------- 1 | use crate::painting::BorderSide; 2 | 3 | // paint(Canvas canvas, Rect rect, {double? gapStart, double gapExtent = 0.0, double gapPercentage = 0.0, TextDirection? textDirection}) -> void 4 | // Paint this input border on canvas. 5 | 6 | pub struct InputBorder { 7 | pub border_side: BorderSide, 8 | } 9 | 10 | impl InputBorder { 11 | pub const NONE: InputBorder = InputBorder { 12 | border_side: BorderSide::NONE, 13 | }; 14 | } 15 | 16 | impl Default for InputBorder { 17 | fn default() -> Self { 18 | Self { 19 | border_side: Default::default(), 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/material/interactive_ink_feature_factory.rs: -------------------------------------------------------------------------------- 1 | /* 2 | create({required MaterialInkController controller, required RenderBox referenceBox, required Offset position, required Color color, required TextDirection textDirection, bool containedInkWell = false, RectCallback? rectCallback, BorderRadius? borderRadius, ShapeBorder? customBorder, double? radius, VoidCallback? onRemoved}) → InteractiveInkFeature 3 | The factory method. 4 | */ 5 | pub struct InteractiveInkFeatureFactory; 6 | 7 | impl Default for InteractiveInkFeatureFactory { 8 | fn default() -> Self { 9 | Self {} 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/material/localizations_delegate.rs: -------------------------------------------------------------------------------- 1 | // isSupported(Locale locale) -> bool 2 | // Whether resources for the given locale can be loaded by this delegate. 3 | // 4 | // load(Locale locale) -> Future 5 | // Start loading the resources for locale. The returned future completes when the resources have finished loading. 6 | // 7 | // shouldReload(covariant LocalizationsDelegate old) -> bool 8 | // Returns true if the resources for this delegate should be loaded again by calling the load method. 9 | // 10 | // toString() -> String 11 | // A string representation of this object. 12 | pub struct LocalizationsDelegate; 13 | -------------------------------------------------------------------------------- /src/material/material_banner_theme_data.rs: -------------------------------------------------------------------------------- 1 | use crate::{ 2 | foundation::colorspace::Color, 3 | painting::{EdgeInsetsGeometry, TextStyle, NoneEdgeInsetsGeometry}, 4 | }; 5 | pub struct MaterialBannerThemeData { 6 | pub background_color: Color, 7 | pub content_text_style: TextStyle, 8 | pub padding: Box, 9 | pub leading_padding: Box, 10 | } 11 | 12 | impl Default for MaterialBannerThemeData { 13 | fn default() -> Self { 14 | Self { 15 | background_color: Default::default(), 16 | content_text_style: Default::default(), 17 | padding: box NoneEdgeInsetsGeometry, 18 | leading_padding: box NoneEdgeInsetsGeometry, 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/material/material_color.rs: -------------------------------------------------------------------------------- 1 | use crate::foundation::colorspace::Color; 2 | 3 | // shade50 → Color 4 | // The lightest shade. 5 | // read-only 6 | // 7 | // shade100 → Color 8 | // The second lightest shade. 9 | // read-only 10 | // 11 | // shade200 → Color 12 | // The third lightest shade. 13 | // read-only 14 | // 15 | // shade300 → Color 16 | // The fourth lightest shade. 17 | // read-only 18 | // 19 | // shade400 → Color 20 | // The fifth lightest shade. 21 | // read-only 22 | // 23 | // shade500 → Color 24 | // The default shade. 25 | // read-only 26 | // 27 | // shade600 → Color 28 | // The fourth darkest shade. 29 | // read-only 30 | // 31 | // shade700 → Color 32 | // The third darkest shade. 33 | // read-only 34 | // 35 | // shade800 → Color 36 | // The second darkest shade. 37 | // read-only 38 | // 39 | // shade900 → Color 40 | // The darkest shade. 41 | // read-only 42 | 43 | /// Defines a single color as well a color swatch with ten shades of the color. 44 | // int primary, Map swatch 45 | pub struct MaterialColor(pub Color); 46 | 47 | impl Default for MaterialColor { 48 | fn default() -> Self { 49 | Self(Default::default()) 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/material/material_state_property.rs: -------------------------------------------------------------------------------- 1 | // resolve(Set states) -> T 2 | // Returns a value of type T that depends on states. 3 | pub struct MaterialStateProperty { 4 | pub val: T, 5 | } 6 | 7 | impl Default for MaterialStateProperty { 8 | fn default() -> Self { 9 | Self { 10 | val: Default::default(), 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/material/material_tap_target_size.rs: -------------------------------------------------------------------------------- 1 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] 2 | pub enum MaterialTapTargetSize { 3 | Padded = 0, 4 | ShrinkWrap = 1, 5 | } 6 | 7 | impl Default for MaterialTapTargetSize { 8 | fn default() -> Self { 9 | Self::Padded 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/material/navigation_rail_label_type.rs: -------------------------------------------------------------------------------- 1 | pub enum NavigationRailLabelType { 2 | None = 0, 3 | Selected = 1, 4 | All = 2, 5 | } 6 | 7 | impl Default for NavigationRailLabelType { 8 | fn default() -> Self { 9 | Self::None 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/material/navigation_rail_theme_data.rs: -------------------------------------------------------------------------------- 1 | use crate::{foundation::colorspace::Color, painting::TextStyle, widgets::IconThemeData}; 2 | 3 | use super::NavigationRailLabelType; 4 | 5 | pub struct NavigationRailThemeData { 6 | pub background_color: Color, 7 | pub elevation: f32, 8 | pub unselected_label_text_style: TextStyle, 9 | pub selected_label_text_style: TextStyle, 10 | pub unselected_icon_theme: IconThemeData, 11 | pub selected_icon_theme: IconThemeData, 12 | pub group_alignment: f32, 13 | pub label_type: NavigationRailLabelType, 14 | } 15 | 16 | impl Default for NavigationRailThemeData { 17 | fn default() -> Self { 18 | Self { 19 | background_color: Default::default(), 20 | elevation: Default::default(), 21 | unselected_label_text_style: Default::default(), 22 | selected_label_text_style: Default::default(), 23 | unselected_icon_theme: Default::default(), 24 | selected_icon_theme: Default::default(), 25 | group_alignment: Default::default(), 26 | label_type: Default::default(), 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/material/outlined_button_theme_data.rs: -------------------------------------------------------------------------------- 1 | use super::ButtonStyle; 2 | 3 | pub struct OutlinedButtonThemeData { 4 | pub style: ButtonStyle, 5 | } 6 | 7 | impl Default for OutlinedButtonThemeData { 8 | fn default() -> Self { 9 | Self { 10 | style: Default::default(), 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/material/page_transitions_builder.rs: -------------------------------------------------------------------------------- 1 | // buildTransitions(PageRoute route, BuildContext context, Animation animation, Animation secondaryAnimation, Widget child) -> Widget 2 | // Wraps the child with one or more transition widgets which define how route arrives on and leaves the screen. 3 | 4 | pub struct PageTransitionsBuilder; 5 | -------------------------------------------------------------------------------- /src/material/page_transitions_theme.rs: -------------------------------------------------------------------------------- 1 | use std::collections::HashMap; 2 | 3 | use crate::foundation::TargetPlatform; 4 | 5 | use super::PageTransitionsBuilder; 6 | 7 | pub struct PageTransitionsTheme { 8 | pub builders: HashMap, // = _defaultBuilders 9 | } 10 | 11 | impl Default for PageTransitionsTheme { 12 | fn default() -> Self { 13 | Self { 14 | builders: Default::default(), 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/material/popup_menu_theme_data.rs: -------------------------------------------------------------------------------- 1 | use crate::{ 2 | foundation::colorspace::Color, 3 | painting::{ShapeBorder, TextStyle, NoneShapeBorder}, 4 | }; 5 | 6 | pub struct PopupMenuThemeData { 7 | pub color: Color, 8 | pub shape: Box, 9 | pub elevation: f32, 10 | pub text_style: TextStyle, 11 | pub enable_feedback: bool, 12 | } 13 | 14 | impl Default for PopupMenuThemeData { 15 | fn default() -> Self { 16 | Self { 17 | color: Default::default(), 18 | shape: box NoneShapeBorder, 19 | elevation: Default::default(), 20 | text_style: Default::default(), 21 | enable_feedback: Default::default(), 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/material/progress_indicator_theme_data.rs: -------------------------------------------------------------------------------- 1 | use crate::foundation::colorspace::Color; 2 | pub struct ProgressIndicatorThemeData { 3 | pub color: Color, 4 | pub linear_track_color: Color, 5 | pub linear_min_height: f32, 6 | pub circular_track_color: Color, 7 | pub refresh_background_color: Color, 8 | } 9 | 10 | impl Default for ProgressIndicatorThemeData { 11 | fn default() -> Self { 12 | Self { 13 | color: Default::default(), 14 | linear_track_color: Default::default(), 15 | linear_min_height: Default::default(), 16 | circular_track_color: Default::default(), 17 | refresh_background_color: Default::default(), 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/material/radio_theme_data.rs: -------------------------------------------------------------------------------- 1 | use crate::{foundation::colorspace::Color, services::MouseCursor}; 2 | 3 | use super::{MaterialStateProperty, MaterialTapTargetSize, VisualDensity}; 4 | pub struct RadioThemeData { 5 | pub mouse_cursor: MaterialStateProperty, 6 | pub fill_color: MaterialStateProperty, 7 | pub overlay_color: MaterialStateProperty, 8 | pub splash_radius: f32, 9 | pub material_tap_target_size: MaterialTapTargetSize, 10 | pub visual_density: VisualDensity, 11 | } 12 | 13 | impl Default for RadioThemeData { 14 | fn default() -> Self { 15 | Self { 16 | mouse_cursor: Default::default(), 17 | fill_color: Default::default(), 18 | overlay_color: Default::default(), 19 | splash_radius: Default::default(), 20 | material_tap_target_size: Default::default(), 21 | visual_density: Default::default(), 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/material/range_slider_thumb_shape.rs: -------------------------------------------------------------------------------- 1 | // getPreferredSize(bool isEnabled, bool isDiscrete) -> Size 2 | // Returns the preferred size of the shape, based on the given conditions. 3 | // 4 | // paint(PaintingContext context, Offset center, {required Animation activationAnimation, required Animation enableAnimation, required bool isDiscrete, required TextPainter labelPainter, required RenderBox parentBox, required SliderThemeData sliderTheme, required TextDirection textDirection, required double value, required double textScaleFactor, required Size sizeWithOverflow}) -> void 5 | // Paints the shape, taking into account the state passed to it. 6 | 7 | pub struct RangeSliderThumbShape; 8 | 9 | impl Default for RangeSliderThumbShape { 10 | fn default() -> Self { 11 | Self {} 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/material/range_slider_tick_mark_shape.rs: -------------------------------------------------------------------------------- 1 | // getPreferredSize(bool isEnabled, bool isDiscrete) -> Size 2 | // Returns the preferred size of the shape, based on the given conditions. 3 | // 4 | // paint(PaintingContext context, Offset center, {required Animation activationAnimation, required Animation enableAnimation, required bool isDiscrete, required TextPainter labelPainter, required RenderBox parentBox, required SliderThemeData sliderTheme, required TextDirection textDirection, required double value, required double textScaleFactor, required Size sizeWithOverflow}) -> void 5 | // Paints the shape, taking into account the state passed to it. 6 | 7 | pub struct RangeSliderTickMarkShape; 8 | 9 | impl Default for RangeSliderTickMarkShape { 10 | fn default() -> Self { 11 | Self {} 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/material/range_slider_track_shape.rs: -------------------------------------------------------------------------------- 1 | // getPreferredSize(bool isEnabled, bool isDiscrete) -> Size 2 | // Returns the preferred size of the shape, based on the given conditions. 3 | // 4 | // paint(PaintingContext context, Offset center, {required Animation activationAnimation, required Animation enableAnimation, required bool isDiscrete, required TextPainter labelPainter, required RenderBox parentBox, required SliderThemeData sliderTheme, required TextDirection textDirection, required double value, required double textScaleFactor, required Size sizeWithOverflow}) -> void 5 | // Paints the shape, taking into account the state passed to it. 6 | 7 | pub struct RangeSliderTrackShape; 8 | 9 | impl Default for RangeSliderTrackShape { 10 | fn default() -> Self { 11 | Self {} 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/material/range_slider_value_indicator_shape.rs: -------------------------------------------------------------------------------- 1 | // getPreferredSize(bool isEnabled, bool isDiscrete) -> Size 2 | // Returns the preferred size of the shape, based on the given conditions. 3 | // 4 | // paint(PaintingContext context, Offset center, {required Animation activationAnimation, required Animation enableAnimation, required bool isDiscrete, required TextPainter labelPainter, required RenderBox parentBox, required SliderThemeData sliderTheme, required TextDirection textDirection, required double value, required double textScaleFactor, required Size sizeWithOverflow}) -> void 5 | // Paints the shape, taking into account the state passed to it. 6 | 7 | pub struct RangeSliderValueIndicatorShape; 8 | 9 | impl Default for RangeSliderValueIndicatorShape { 10 | fn default() -> Self { 11 | Self {} 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/material/range_thumb_selector.rs: -------------------------------------------------------------------------------- 1 | use crate::ui::{Size, TextDirection}; 2 | 3 | use super::{RangeValues, Thumb}; 4 | 5 | pub trait RangeThumbSelector { 6 | fn thumb_selector( 7 | &self, 8 | text_direction: TextDirection, 9 | values: RangeValues, 10 | tap_value: f32, 11 | thumb_size: Size, 12 | track_size: Size, 13 | dx: f32, 14 | ) -> Thumb; 15 | } 16 | -------------------------------------------------------------------------------- /src/material/range_values.rs: -------------------------------------------------------------------------------- 1 | pub struct RangeValues { 2 | pub start: f32, 3 | pub end: f32, 4 | } 5 | -------------------------------------------------------------------------------- /src/material/scaffold_messenger_state.rs: -------------------------------------------------------------------------------- 1 | /* 2 | build(BuildContext context) -> Widget 3 | Describes the part of the user interface represented by this widget. 4 | override 5 | 6 | clearMaterialBanners() -> void 7 | Removes all the materialBanners currently in queue by clearing the queue and running normal exit animation on the current materialBanner. 8 | 9 | clearSnackBars() -> void 10 | Removes all the snackBars currently in queue by clearing the queue and running normal exit animation on the current snackBar. 11 | 12 | didChangeDependencies() -> void 13 | Called when a dependency of this State object changes. 14 | override 15 | 16 | dispose() -> void 17 | Called when this object is removed from the tree permanently. 18 | override 19 | 20 | hideCurrentMaterialBanner({MaterialBannerClosedReason reason = MaterialBannerClosedReason.hide}) -> void 21 | Removes the current MaterialBanner by running its normal exit animation. 22 | 23 | hideCurrentSnackBar({SnackBarClosedReason reason = SnackBarClosedReason.hide}) -> void 24 | Removes the current SnackBar by running its normal exit animation. 25 | 26 | removeCurrentMaterialBanner({MaterialBannerClosedReason reason = MaterialBannerClosedReason.remove}) -> void 27 | Removes the current MaterialBanner (if any) immediately from registered Scaffolds. 28 | 29 | removeCurrentSnackBar({SnackBarClosedReason reason = SnackBarClosedReason.remove}) -> void 30 | Removes the current SnackBar (if any) immediately from registered Scaffolds. 31 | 32 | 33 | showMaterialBanner(MaterialBanner materialBanner) -> ScaffoldFeatureController 34 | Shows a MaterialBanner across all registered Scaffolds. 35 | 36 | showSnackBar(SnackBar snackBar) -> ScaffoldFeatureController 37 | Shows a SnackBar across all registered Scaffolds. 38 | */ 39 | 40 | // inherited from State 41 | pub struct ScaffoldMessengerState; 42 | 43 | impl Default for ScaffoldMessengerState { 44 | fn default() -> Self { 45 | Self {} 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/material/scrollbar_theme_data.rs: -------------------------------------------------------------------------------- 1 | use crate::{foundation::colorspace::Color, ui::Radius}; 2 | 3 | use super::MaterialStateProperty; 4 | 5 | pub struct ScrollbarThemeData { 6 | pub thickness: MaterialStateProperty, 7 | pub show_track_on_hover: bool, 8 | pub is_always_shown: bool, 9 | pub radius: Radius, 10 | pub thumb_color: MaterialStateProperty, 11 | pub track_color: MaterialStateProperty, 12 | pub track_border_color: MaterialStateProperty, 13 | pub cross_axis_margin: f32, 14 | pub main_axis_margin: f32, 15 | pub min_thumb_length: f32, 16 | pub interactive: bool, 17 | } 18 | 19 | impl Default for ScrollbarThemeData { 20 | fn default() -> Self { 21 | Self { 22 | thickness: Default::default(), 23 | show_track_on_hover: Default::default(), 24 | is_always_shown: Default::default(), 25 | radius: Default::default(), 26 | thumb_color: Default::default(), 27 | track_color: Default::default(), 28 | track_border_color: Default::default(), 29 | cross_axis_margin: Default::default(), 30 | main_axis_margin: Default::default(), 31 | min_thumb_length: Default::default(), 32 | interactive: Default::default(), 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/material/show_value_indicator.rs: -------------------------------------------------------------------------------- 1 | pub enum ShowValueIndicator { 2 | OnlyForDiscrete = 0, 3 | OnlyForContinuous = 1, 4 | Always = 2, 5 | Never = 3, 6 | } 7 | 8 | impl Default for ShowValueIndicator { 9 | fn default() -> Self { 10 | Self::OnlyForDiscrete 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/material/slider_component_shape.rs: -------------------------------------------------------------------------------- 1 | // getPreferredSize(bool isEnabled, bool isDiscrete) -> Size 2 | // Returns the preferred size of the shape, based on the given conditions. 3 | // 4 | // paint(PaintingContext context, Offset center, {required Animation activationAnimation, required Animation enableAnimation, required bool isDiscrete, required TextPainter labelPainter, required RenderBox parentBox, required SliderThemeData sliderTheme, required TextDirection textDirection, required double value, required double textScaleFactor, required Size sizeWithOverflow}) -> void 5 | // Paints the shape, taking into account the state passed to it. 6 | 7 | pub struct SliderComponentShape; 8 | 9 | impl Default for SliderComponentShape { 10 | fn default() -> Self { 11 | Self {} 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/material/slider_tick_mark_shape.rs: -------------------------------------------------------------------------------- 1 | // getPreferredSize(bool isEnabled, bool isDiscrete) -> Size 2 | // Returns the preferred size of the shape, based on the given conditions. 3 | // 4 | // paint(PaintingContext context, Offset center, {required Animation activationAnimation, required Animation enableAnimation, required bool isDiscrete, required TextPainter labelPainter, required RenderBox parentBox, required SliderThemeData sliderTheme, required TextDirection textDirection, required double value, required double textScaleFactor, required Size sizeWithOverflow}) -> void 5 | // Paints the shape, taking into account the state passed to it. 6 | 7 | pub struct SliderTickMarkShape; 8 | 9 | impl Default for SliderTickMarkShape { 10 | fn default() -> Self { 11 | Self {} 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/material/slider_track_shape.rs: -------------------------------------------------------------------------------- 1 | // getPreferredSize(bool isEnabled, bool isDiscrete) -> Size 2 | // Returns the preferred size of the shape, based on the given conditions. 3 | // 4 | // paint(PaintingContext context, Offset center, {required Animation activationAnimation, required Animation enableAnimation, required bool isDiscrete, required TextPainter labelPainter, required RenderBox parentBox, required SliderThemeData sliderTheme, required TextDirection textDirection, required double value, required double textScaleFactor, required Size sizeWithOverflow}) -> void 5 | // Paints the shape, taking into account the state passed to it. 6 | 7 | pub struct SliderTrackShape; 8 | 9 | impl Default for SliderTrackShape { 10 | fn default() -> Self { 11 | Self {} 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/material/snack_bar_behavior.rs: -------------------------------------------------------------------------------- 1 | pub enum SnackBarBehavior { 2 | Fixed = 0, 3 | Floating = 1, 4 | } 5 | 6 | impl Default for SnackBarBehavior { 7 | fn default() -> Self { 8 | Self::Fixed 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/material/snack_bar_theme_data.rs: -------------------------------------------------------------------------------- 1 | use crate::{ 2 | foundation::colorspace::Color, 3 | painting::{NoneShapeBorder, ShapeBorder, TextStyle}, 4 | }; 5 | 6 | use super::SnackBarBehavior; 7 | 8 | pub struct SnackBarThemeData { 9 | pub background_color: Color, 10 | pub action_text_color: Color, 11 | pub disabled_action_text_color: Color, 12 | pub content_text_style: TextStyle, 13 | pub elevation: f32, 14 | pub shape: Box, 15 | pub behavior: SnackBarBehavior, 16 | } 17 | 18 | impl Default for SnackBarThemeData { 19 | fn default() -> Self { 20 | Self { 21 | background_color: Default::default(), 22 | action_text_color: Default::default(), 23 | disabled_action_text_color: Default::default(), 24 | content_text_style: Default::default(), 25 | elevation: Default::default(), 26 | shape: box NoneShapeBorder, 27 | behavior: Default::default(), 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/material/step_state.rs: -------------------------------------------------------------------------------- 1 | pub enum StepState { 2 | Indexed = 0, 3 | Editing = 1, 4 | Complete = 2, 5 | Disabled = 3, 6 | Error = 4, 7 | } 8 | 9 | impl Default for StepState { 10 | fn default() -> Self { 11 | Self::Indexed 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/material/switch_theme_data.rs: -------------------------------------------------------------------------------- 1 | use crate::{foundation::colorspace::Color, services::MouseCursor}; 2 | 3 | use super::{MaterialStateProperty, MaterialTapTargetSize}; 4 | pub struct SwitchThemeData { 5 | pub thumb_color: MaterialStateProperty, 6 | pub track_color: MaterialStateProperty, 7 | pub material_tap_target_size: MaterialTapTargetSize, 8 | pub mouse_cursor: MaterialStateProperty, 9 | pub overlay_color: MaterialStateProperty, 10 | pub splash_radius: f32, 11 | } 12 | 13 | impl Default for SwitchThemeData { 14 | fn default() -> Self { 15 | Self { 16 | thumb_color: Default::default(), 17 | track_color: Default::default(), 18 | material_tap_target_size: Default::default(), 19 | mouse_cursor: Default::default(), 20 | overlay_color: Default::default(), 21 | splash_radius: Default::default(), 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/material/tab_bar_indicator_size.rs: -------------------------------------------------------------------------------- 1 | pub enum TabBarIndicatorSize { 2 | Tab = 0, 3 | Label = 1, 4 | } 5 | 6 | impl Default for TabBarIndicatorSize { 7 | fn default() -> Self { 8 | Self::Tab 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/material/tab_bar_theme.rs: -------------------------------------------------------------------------------- 1 | use crate::{ 2 | foundation::colorspace::Color, 3 | painting::{Decoration, EdgeInsetsGeometry, NoneDecoration, NoneEdgeInsetsGeometry, TextStyle}, 4 | }; 5 | 6 | use super::TabBarIndicatorSize; 7 | 8 | pub struct TabBarTheme { 9 | pub indicator: Box, 10 | pub indicator_size: TabBarIndicatorSize, 11 | pub label_color: Color, 12 | pub label_padding: Box, 13 | pub label_style: TextStyle, 14 | pub unselected_label_color: Color, 15 | pub unselected_label_style: TextStyle, 16 | } 17 | 18 | impl Default for TabBarTheme { 19 | fn default() -> Self { 20 | Self { 21 | indicator: box NoneDecoration, 22 | indicator_size: Default::default(), 23 | label_color: Default::default(), 24 | label_padding: box NoneEdgeInsetsGeometry, 25 | label_style: Default::default(), 26 | unselected_label_color: Default::default(), 27 | unselected_label_style: Default::default(), 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/material/text_button_theme_data.rs: -------------------------------------------------------------------------------- 1 | use super::ButtonStyle; 2 | 3 | pub struct TextButtonThemeData { 4 | pub style: ButtonStyle, 5 | } 6 | 7 | impl Default for TextButtonThemeData { 8 | fn default() -> Self { 9 | Self { 10 | style: Default::default(), 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/material/text_selection_theme_data.rs: -------------------------------------------------------------------------------- 1 | use crate::foundation::colorspace::Color; 2 | 3 | pub struct TextSelectionThemeData { 4 | pub cursor_color: Color, 5 | pub selection_color: Color, 6 | pub selection_handle_color: Color, 7 | } 8 | 9 | impl Default for TextSelectionThemeData { 10 | fn default() -> Self { 11 | Self { 12 | cursor_color: Default::default(), 13 | selection_color: Default::default(), 14 | selection_handle_color: Default::default(), 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/material/theme_mode.rs: -------------------------------------------------------------------------------- 1 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] 2 | pub enum ThemeMode { 3 | System = 0, 4 | Light = 1, 5 | Dark = 2, 6 | } 7 | 8 | impl Default for ThemeMode { 9 | fn default() -> Self { 10 | Self::System 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/material/thumb.rs: -------------------------------------------------------------------------------- 1 | pub enum Thumb { 2 | Start = 0, 3 | End = 1, 4 | } 5 | -------------------------------------------------------------------------------- /src/material/time_picker_theme_data.rs: -------------------------------------------------------------------------------- 1 | use crate::{ 2 | foundation::colorspace::Color, 3 | painting::{ 4 | BorderSide, NoneOutlinedBorder, NoneShapeBorder, OutlinedBorder, ShapeBorder, TextStyle, 5 | }, 6 | }; 7 | 8 | use super::InputDecorationTheme; 9 | 10 | pub struct TimePickerThemeData { 11 | pub background_color: Color, 12 | pub hour_minute_text_color: Color, 13 | pub hour_minute_color: Color, 14 | pub day_period_text_color: Color, 15 | pub day_period_color: Color, 16 | pub dial_hand_color: Color, 17 | pub dial_background_color: Color, 18 | pub dial_text_color: Color, 19 | pub entry_mode_icon_color: Color, 20 | pub hour_minute_text_style: TextStyle, 21 | pub day_period_text_style: TextStyle, 22 | pub help_text_style: TextStyle, 23 | pub shape: Box, 24 | pub hour_minute_shape: Box, 25 | pub day_period_shape: Box, 26 | pub day_period_border_side: BorderSide, 27 | pub input_decoration_theme: InputDecorationTheme, 28 | } 29 | 30 | impl Default for TimePickerThemeData { 31 | fn default() -> Self { 32 | Self { 33 | background_color: Default::default(), 34 | hour_minute_text_color: Default::default(), 35 | hour_minute_color: Default::default(), 36 | day_period_text_color: Default::default(), 37 | day_period_color: Default::default(), 38 | dial_hand_color: Default::default(), 39 | dial_background_color: Default::default(), 40 | dial_text_color: Default::default(), 41 | entry_mode_icon_color: Default::default(), 42 | hour_minute_text_style: Default::default(), 43 | day_period_text_style: Default::default(), 44 | help_text_style: Default::default(), 45 | shape: box NoneShapeBorder, 46 | hour_minute_shape: box NoneShapeBorder, 47 | day_period_shape: box NoneOutlinedBorder, 48 | day_period_border_side: Default::default(), 49 | input_decoration_theme: Default::default(), 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/material/tooltip_theme_data.rs: -------------------------------------------------------------------------------- 1 | use std::time::Duration; 2 | 3 | use crate::painting::{ 4 | Decoration, EdgeInsetsGeometry, NoneDecoration, NoneEdgeInsetsGeometry, TextStyle, 5 | }; 6 | 7 | use super::TooltipTriggerMode; 8 | 9 | pub struct TooltipThemeData { 10 | pub height: f32, 11 | pub padding: Box, 12 | pub margin: Box, 13 | pub vertical_offset: f32, 14 | pub prefer_below: bool, 15 | pub exclude_from_semantics: bool, 16 | pub decoration: Box, 17 | pub text_style: TextStyle, 18 | pub wait_duration: Duration, 19 | pub show_duration: Duration, 20 | pub trigger_mode: TooltipTriggerMode, 21 | pub enable_feedback: bool, 22 | } 23 | 24 | impl Default for TooltipThemeData { 25 | fn default() -> Self { 26 | Self { 27 | height: Default::default(), 28 | padding: box NoneEdgeInsetsGeometry, 29 | margin: box NoneEdgeInsetsGeometry, 30 | vertical_offset: Default::default(), 31 | prefer_below: Default::default(), 32 | exclude_from_semantics: Default::default(), 33 | decoration: box NoneDecoration, 34 | text_style: Default::default(), 35 | wait_duration: Default::default(), 36 | show_duration: Default::default(), 37 | trigger_mode: Default::default(), 38 | enable_feedback: Default::default(), 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/material/tooltip_trigger_mode.rs: -------------------------------------------------------------------------------- 1 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] 2 | pub enum TooltipTriggerMode { 3 | Manual = 0, 4 | LongPress = 1, 5 | Tap = 2, 6 | } 7 | 8 | impl Default for TooltipTriggerMode { 9 | fn default() -> Self { 10 | Self::LongPress 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/material/typography.rs: -------------------------------------------------------------------------------- 1 | use crate::foundation::TargetPlatform; 2 | 3 | use super::TextTheme; 4 | 5 | pub struct Typography { 6 | pub platform: TargetPlatform, 7 | pub black: TextTheme, 8 | pub white: TextTheme, 9 | pub english_like: TextTheme, 10 | pub dense: TextTheme, 11 | pub tall: TextTheme, 12 | } 13 | 14 | impl Default for Typography { 15 | fn default() -> Self { 16 | Self { 17 | platform: Default::default(), 18 | black: Default::default(), 19 | white: Default::default(), 20 | english_like: Default::default(), 21 | dense: Default::default(), 22 | tall: Default::default(), 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/material/visual_density.rs: -------------------------------------------------------------------------------- 1 | // copyWith({double? horizontal, double? vertical}) → VisualDensity 2 | // Copy the current VisualDensity with the given values replacing the current values. 3 | // 4 | // debugFillProperties(DiagnosticPropertiesBuilder properties) → void 5 | // Add additional properties associated with the node. 6 | // override 7 | // 8 | // effectiveConstraints(BoxConstraints constraints) → BoxConstraints 9 | // Return a copy of constraints whose minimum width and height have been updated with the baseSizeAdjustment. 10 | // 11 | // toStringShort() → String 12 | // A brief description of this object, usually just the runtimeType and the hashCode. 13 | // override 14 | 15 | pub struct VisualDensity { 16 | pub horizontal: f32, 17 | pub vertical: f32, 18 | } 19 | 20 | impl Default for VisualDensity { 21 | fn default() -> Self { 22 | Self { 23 | horizontal: Default::default(), 24 | vertical: Default::default(), 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/painting/asset_bundle_image_key.rs: -------------------------------------------------------------------------------- 1 | use crate::services::AssetBundle; 2 | 3 | pub struct AssetBundleImageKey { 4 | // The bundle from which the image will be obtained. 5 | pub bundle: Box, 6 | 7 | // The key to use to obtain the resource from the bundle. This is the argument passed to AssetBundle.load. 8 | pub name: String, 9 | 10 | // The scale to place in the ImageInfo object of the image. 11 | pub scale: f64, 12 | } 13 | 14 | // impl Default for ImageProvider { 15 | // fn default() -> Self { 16 | // Self(Default::default()) 17 | // } 18 | // } 19 | -------------------------------------------------------------------------------- /src/painting/asset_bundle_image_provider.rs: -------------------------------------------------------------------------------- 1 | use std::future::Future; 2 | 3 | use super::{ 4 | DecoderCallback, ImageConfiguration, ImageErrorListener, ImageProvider, ImageStream, 5 | ImageStreamCompleter, AssetBundleImageKey, 6 | }; 7 | 8 | // : ImageProvider 9 | pub trait AssetBundleImageProvider: ImageProvider { 10 | // Converts a key into an ImageStreamCompleter, and begins fetching the image. 11 | fn load(key: AssetBundleImageKey, decode: Box) -> ImageStreamCompleter; 12 | 13 | // Converts an ImageProvider's settings plus an ImageConfiguration to a key that describes the precise image to load. 14 | fn obtain_key( 15 | configuration: ImageConfiguration, 16 | ) -> Box>; 17 | 18 | // Called by resolve with the key returned by obtainKey. 19 | fn resolve_stream_for_key( 20 | configuration: ImageConfiguration, 21 | stream: ImageStream, 22 | key: AssetBundleImageKey, 23 | handle_error: Option>, 24 | ); 25 | } 26 | 27 | // impl Default for ImageProvider { 28 | // fn default() -> Self { 29 | // Self(Default::default()) 30 | // } 31 | // } 32 | -------------------------------------------------------------------------------- /src/painting/border.rs: -------------------------------------------------------------------------------- 1 | use super::{BorderSide, BoxBorder, EdgeInsetsGeometry, ShapeBorder, NoneEdgeInsetsGeometry}; 2 | 3 | pub struct Border { 4 | // The bottom side of this border. 5 | pub bottom: BorderSide, 6 | 7 | // The widths of the sides of this border represented as an EdgeInsets. 8 | pub dimensions: Box, 9 | 10 | // Whether all four sides of the border are identical. Uniform borders are typically more efficient to paint. 11 | pub is_uniform: bool, 12 | 13 | // The left side of this border. 14 | pub left: BorderSide, 15 | 16 | // The right side of this border. 17 | pub right: BorderSide, 18 | 19 | // The top side of this border. 20 | pub top: BorderSide, 21 | } 22 | 23 | impl Default for Border { 24 | fn default() -> Self { 25 | Self { 26 | bottom: Default::default(), 27 | dimensions: box NoneEdgeInsetsGeometry, 28 | is_uniform: Default::default(), 29 | left: Default::default(), 30 | right: Default::default(), 31 | top: Default::default(), 32 | } 33 | } 34 | } 35 | 36 | impl BoxBorder for Border {} 37 | 38 | impl ShapeBorder for Border {} 39 | -------------------------------------------------------------------------------- /src/painting/border_radius_geometry.rs: -------------------------------------------------------------------------------- 1 | use crate::ui::TextDirection; 2 | 3 | use super::BorderRadius; 4 | 5 | pub trait BorderRadiusGeometry { 6 | // Returns the sum of two BorderRadiusGeometry objects. 7 | fn add(&self, other: Box) -> Box; 8 | 9 | // Convert this instance into a BorderRadius, so that the radii are expressed for specific 10 | // physical corners (top-left, top-right, etc) rather than in a direction-dependent manner. 11 | fn resolve(&self, direction: Option) -> BorderRadius; 12 | 13 | // Returns the difference between two BorderRadiusGeometry objects. 14 | fn subtract(&self, other: Box) -> Box; 15 | } 16 | 17 | #[derive(Default)] 18 | pub struct NoneBorderRadiusGeometry; 19 | 20 | impl BorderRadiusGeometry for NoneBorderRadiusGeometry { 21 | fn add(&self, other: Box) -> Box { 22 | todo!() 23 | } 24 | 25 | fn resolve(&self, direction: Option) -> BorderRadius { 26 | todo!() 27 | } 28 | 29 | fn subtract(&self, other: Box) -> Box { 30 | todo!() 31 | } 32 | } -------------------------------------------------------------------------------- /src/painting/border_side.rs: -------------------------------------------------------------------------------- 1 | use crate::prelude::color; 2 | 3 | use crate::foundation::colorspace::Color; 4 | 5 | use super::BorderStyle; 6 | 7 | // scale(double t) -> BorderSide 8 | // Creates a copy of this border side description but with the width scaled by the factor t. 9 | // 10 | // toPaint() -> Paint 11 | // Create a Paint object that, if used to stroke a line, will draw the line in this border's style. 12 | 13 | pub struct BorderSide { 14 | pub color: Color, 15 | pub width: f32, 16 | pub style: BorderStyle, 17 | } 18 | 19 | impl BorderSide { 20 | // A hairline black border that is not rendered. 21 | pub const NONE: BorderSide = BorderSide{ 22 | width: 0.0, 23 | style: BorderStyle::None, 24 | color: color::BLACK, 25 | }; 26 | } 27 | 28 | impl Default for BorderSide { 29 | fn default() -> Self { 30 | Self { 31 | color: Default::default(), 32 | width: Default::default(), 33 | style: Default::default(), 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/painting/box_border.rs: -------------------------------------------------------------------------------- 1 | use super::ShapeBorder; 2 | 3 | pub trait BoxBorder: ShapeBorder { 4 | // The bottom side of this border. 5 | // bottom: BorderSide 6 | 7 | // Whether all four sides of the border are identical. Uniform borders are typically more efficient to paint. 8 | // isUniform: bool 9 | 10 | // The top side of this border. 11 | // top: BorderSide 12 | } -------------------------------------------------------------------------------- /src/painting/box_shadow.rs: -------------------------------------------------------------------------------- 1 | use crate::prelude::Color; 2 | 3 | use crate::ui::{BlurStyle, Offset}; 4 | 5 | //inherited ui::Shadow 6 | pub struct BoxShadow { 7 | // ui::Shadow { 8 | // The standard deviation of the Gaussian to convolve with the shadow's shape. 9 | pub blur_radius: f32, 10 | 11 | // The blurRadius in sigmas instead of logical pixels. 12 | pub blur_sigma: f32, 13 | 14 | // Color that the shadow will be drawn with. 15 | pub color: Color, 16 | 17 | // The displacement of the shadow from the casting element. 18 | pub offset: Offset, 19 | // } 20 | 21 | // The BlurStyle to use for this shadow. 22 | pub blur_style: BlurStyle, 23 | 24 | // The amount the box should be inflated prior to applying the blur. 25 | pub spread_radius: f32, 26 | } 27 | 28 | // impl Shadow for BoxShadow { 29 | // scale(f32 factor) → Shadow 30 | // Returns a new shadow with its offset and blurRadius scaled by the given factor. 31 | // toPaint() → Paint 32 | // Create the Paint object that corresponds to this shadow description. 33 | // } 34 | 35 | 36 | 37 | impl BoxShadow { 38 | 39 | } -------------------------------------------------------------------------------- /src/painting/decoration.rs: -------------------------------------------------------------------------------- 1 | // createBoxPainter([VoidCallback onChanged]) -> BoxPainter 2 | // Returns a BoxPainter that will paint this decoration. 3 | // @factory 4 | // 5 | // debugAssertIsValid() -> bool 6 | // In debug mode, throws an exception if the object is not in a valid configuration. Otherwise, returns true. 7 | // 8 | // getClipPath(Rect rect, TextDirection textDirection) -> Path 9 | // Returns a closed Path that describes the outer edge of this decoration. 10 | // 11 | // hitTest(Size size, Offset position, {TextDirection? textDirection}) -> bool 12 | // Tests whether the given point, on a rectangle of a given size, would be considered to hit the decoration or not. For example, if the decoration only draws a circle, this function might return true if the point was inside the circle and false otherwise. 13 | // 14 | // lerpFrom(Decoration? a, double t) -> Decoration? 15 | // Linearly interpolates from another Decoration (which may be of a different class) to this. 16 | // @protected 17 | // 18 | // lerpTo(Decoration? b, double t) -> Decoration? 19 | // Linearly interpolates from this to another Decoration (which may be of a different class). 20 | // @protected 21 | // 22 | // toStringShort() -> String 23 | // A brief description of this object, usually just the runtimeType and the hashCode. 24 | // override 25 | 26 | pub trait Decoration { 27 | // Whether this decoration is complex enough to benefit from caching its painting. 28 | // isComplex: bool 29 | 30 | // Returns the insets to apply when using this decoration on a box that has contents, 31 | // so that the contents do not overlap the edges of the decoration. For example, if the decoration draws a frame around its edge, 32 | // the padding would return the distance by which to inset the children so as to not overlap the frame. 33 | // padding: EdgeInsetsGeometry? 34 | } 35 | 36 | pub struct NoneDecoration; 37 | 38 | impl Decoration for NoneDecoration {} 39 | 40 | impl Default for NoneDecoration { 41 | fn default() -> Self { 42 | Self 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/painting/decoration_image.rs: -------------------------------------------------------------------------------- 1 | use crate::{ui::{FilterQuality, ColorFilter, Rect}, material::AlignmentGeometry}; 2 | 3 | use super::{BoxFit, ImageProvider, ImageRepeat}; 4 | 5 | pub struct DecorationImage { 6 | // How to align the image within its bounds. 7 | pub alignment: Box, 8 | 9 | // The center slice for a nine-patch image. 10 | pub center_slice: Option, 11 | 12 | // A color filter to apply to the image before painting it. 13 | pub color_filter: Option, 14 | 15 | // Used to set the filterQuality of the image. 16 | pub filter_quality: FilterQuality, 17 | 18 | // How the image should be inscribed into the box. 19 | pub fit: BoxFit, 20 | 21 | // The image to be painted into the decoration. 22 | pub image: Box, 23 | 24 | // Whether the colors of the image are inverted when drawn. 25 | pub invert_colors: bool, 26 | 27 | // Whether to paint the image with anti-aliasing. 28 | pub is_anti_alias: bool, 29 | 30 | // Whether to paint the image in the direction of the TextDirection. 31 | pub match_text_direction: bool, 32 | 33 | // An optional error callback for errors emitted when loading image. 34 | // on_error: ImageErrorListener?, 35 | 36 | // If non-null, the value is multiplied with the opacity of each image pixel before painting onto the canvas. 37 | pub opacity: f32, 38 | 39 | // How to paint any portions of the box that would not otherwise be covered by the image. 40 | pub repeat: ImageRepeat, 41 | 42 | // Defines image pixels to be shown per logical pixels. 43 | pub scale: f32, 44 | } 45 | 46 | impl DecorationImage { 47 | // Creates a DecorationImagePainter for this DecorationImage. 48 | // pub fn create_painter(onChanged: VoidCallback) -> DecorationImagePainter { 49 | // } 50 | } -------------------------------------------------------------------------------- /src/painting/enums/axis.rs: -------------------------------------------------------------------------------- 1 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] 2 | pub enum Axis { 3 | Horizontal = 0, 4 | Vertical = 1, 5 | } 6 | 7 | impl Default for Axis { 8 | fn default() -> Self { 9 | Self::Horizontal 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/painting/enums/axis_direction.rs: -------------------------------------------------------------------------------- 1 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] 2 | pub enum AxisDirection { 3 | Up = 0, 4 | Right = 1, 5 | Down = 2, 6 | Left = 3, 7 | } 8 | 9 | impl Default for AxisDirection { 10 | fn default() -> Self { 11 | Self::Up 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/painting/enums/border_style.rs: -------------------------------------------------------------------------------- 1 | pub enum BorderStyle { 2 | None = 0, 3 | Solid = 1, 4 | } 5 | 6 | impl Default for BorderStyle { 7 | fn default() -> Self { 8 | Self::None 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/painting/enums/box_fit.rs: -------------------------------------------------------------------------------- 1 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] 2 | pub enum BoxFit { 3 | // Fill the target box by distorting the source's aspect ratio. 4 | Fill = 0, 5 | // As large as possible while still containing the source entirely within the target box. 6 | Contain = 1, 7 | // As small as possible while still covering the entire target box. 8 | // To actually clip the content, use clipBehavior: Clip.hardEdge alongside this in a FittedBox. 9 | Cover = 2, 10 | // Make sure the full width of the source is shown, regardless of whether this means the source overflows the target box vertically. 11 | // To actually clip the content, use clipBehavior: Clip.hardEdge alongside this in a FittedBox. 12 | FitWidth = 3, 13 | // Make sure the full height of the source is shown, regardless of whether this means the source overflows the target box horizontally. 14 | // To actually clip the content, use clipBehavior: Clip.hardEdge alongside this in a FittedBox. 15 | FitHeight = 4, 16 | // Align the source within the target box (by default, centering) and discard any portions of the source that lie outside the box. 17 | // The source image is not resized. 18 | // To actually clip the content, use clipBehavior: Clip.hardEdge alongside this in a FittedBox. 19 | None = 5, 20 | // Align the source within the target box (by default, centering) and, if necessary, scale the source down to ensure that the source fits within the box. 21 | // This is the same as contain if that would shrink the image, otherwise it is the same as none. 22 | ScaleDown = 6, 23 | } 24 | 25 | impl Default for BoxFit { 26 | fn default() -> Self { 27 | Self::Fill 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/painting/enums/box_shape.rs: -------------------------------------------------------------------------------- 1 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] 2 | pub enum BoxShape { 3 | // An axis-aligned, 2D rectangle. May have rounded corners (described by a BorderRadius). 4 | // The edges of the rectangle will match the edges of the box into which the Border or BoxDecoration is painte 5 | Rectangle = 0, 6 | // A circle centered in the middle of the box into which the Border or BoxDecoration is painted. 7 | // The diameter of the circle is the shortest dimension of the box, either the width or the height, 8 | // such that the circle touches the edges of the box. 9 | Circle = 1, 10 | } 11 | 12 | impl Default for BoxShape { 13 | fn default() -> Self { 14 | Self::Rectangle 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/painting/enums/image_repeat.rs: -------------------------------------------------------------------------------- 1 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] 2 | pub enum ImageRepeat { 3 | // Repeat the image in both the x and y directions until the box is filled. 4 | Repeat = 0, 5 | // Repeat the image in the x direction until the box is filled horizontally. 6 | RepeatX = 1, 7 | // Repeat the image in the y direction until the box is filled vertically. 8 | RepeatY = 2, 9 | // Leave uncovered portions of the box transparent. 10 | NoRepeat = 3 11 | } 12 | 13 | impl Default for ImageRepeat { 14 | fn default() -> Self { 15 | Self::Repeat 16 | } 17 | } -------------------------------------------------------------------------------- /src/painting/enums/mod.rs: -------------------------------------------------------------------------------- 1 | mod axis_direction; 2 | pub use self::axis_direction::*; 3 | 4 | mod axis; 5 | pub use self::axis::*; 6 | 7 | mod border_style; 8 | pub use self::border_style::*; 9 | 10 | mod box_fit; 11 | pub use self::box_fit::*; 12 | 13 | mod box_shape; 14 | pub use self::box_shape::*; 15 | 16 | mod image_repeat; 17 | pub use self::image_repeat::*; 18 | 19 | mod rust_logo_style; 20 | pub use self::rust_logo_style::*; 21 | 22 | mod text_overflow; 23 | pub use self::text_overflow::*; 24 | 25 | mod vertical_direction; 26 | pub use self::vertical_direction::*; 27 | -------------------------------------------------------------------------------- /src/painting/enums/rust_logo_style.rs: -------------------------------------------------------------------------------- 1 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] 2 | pub enum RustLogoStyle { 3 | // Show only Flutter's logo, not the "Flutter" label. 4 | // This is the default behavior for FlutterLogoDecoration objects. 5 | MarkOnly = 0, 6 | // Show Flutter's logo on the left, and the "Flutter" label to its right. 7 | Horizontal = 1, 8 | // Show Flutter's logo above the "Flutter" label. 9 | Stacked = 2, 10 | } 11 | 12 | impl Default for RustLogoStyle { 13 | fn default() -> Self { 14 | Self::MarkOnly 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/painting/enums/text_overflow.rs: -------------------------------------------------------------------------------- 1 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] 2 | pub enum TextOverflow { 3 | Clip = 0, 4 | Fade = 1, 5 | Ellipsis = 2, 6 | Visible = 3, 7 | } 8 | 9 | impl Default for TextOverflow { 10 | fn default() -> Self { 11 | Self::Clip 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/painting/enums/vertical_direction.rs: -------------------------------------------------------------------------------- 1 | pub enum VerticalDirection { 2 | Up = 0, 3 | Down = 1, 4 | } 5 | 6 | impl Default for VerticalDirection { 7 | fn default() -> Self { 8 | Self::Up 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/painting/gradient.rs: -------------------------------------------------------------------------------- 1 | use crate::ui::{Rect, Shader, TextDirection}; 2 | 3 | pub trait Gradient { 4 | // The colors the gradient should obtain at each of the stops. 5 | // pub colors: Vec, 6 | 7 | // A list of values from 0.0 to 1.0 that denote fractions along the gradient. 8 | // pub stops: Vec, 9 | 10 | // The transform, if any, to apply to the gradient. 11 | // pub transform: Option>, 12 | 13 | // Creates a Shader for this gradient to fill the given rect. 14 | fn create_shader(&self, rect: Rect, text_direction: Option) -> Shader { 15 | todo!() 16 | } 17 | 18 | // Linearly interpolates from another Gradient to this. 19 | fn lerp_from(&self, a: Box, t: f32) -> Box { 20 | todo!() 21 | } 22 | 23 | // Linearly interpolates from this to another Gradient. 24 | fn lerp_to(&self, b: Box, t: f32) -> Box { 25 | todo!() 26 | } 27 | 28 | // Returns a new gradient with its properties scaled by the given factor. 29 | fn scale(&self, factor: f32) -> Box { 30 | todo!() 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/painting/gradient_transform.rs: -------------------------------------------------------------------------------- 1 | use cgmath::Matrix4; 2 | 3 | use crate::ui::{TextDirection, Rect}; 4 | 5 | pub trait GradientTransform { 6 | // When a Gradient creates its Shader, it will call this method to determine what transform 7 | // to apply to the shader for the given Rect and TextDirection. 8 | fn transform(&self, bounds: Rect, text_direction: Option) -> Matrix4; 9 | } 10 | 11 | #[derive(Default, Debug, Copy, Clone)] 12 | pub struct NullGradientTransform; 13 | 14 | impl GradientTransform for NullGradientTransform { 15 | fn transform(&self, bounds: Rect, text_direction: Option) -> Matrix4 { 16 | todo!() 17 | } 18 | } -------------------------------------------------------------------------------- /src/painting/image_error_listener.rs: -------------------------------------------------------------------------------- 1 | pub trait ImageErrorListener { 2 | fn on_error(&self, error: T); 3 | } 4 | -------------------------------------------------------------------------------- /src/painting/linear_gradient.rs: -------------------------------------------------------------------------------- 1 | use crate::ui::{TextDirection, Shader, Rect}; 2 | use crate::{prelude::Color, ui::TileMode}; 3 | 4 | use crate::material::AlignmentGeometry; 5 | 6 | use super::{Gradient, GradientTransform}; 7 | 8 | pub struct LinearGradient { 9 | // The offset at which stop 0.0 of the gradient is placed. 10 | pub begin: Box, 11 | 12 | // The colors the gradient should obtain at each of the stops. 13 | pub colors: Vec, 14 | 15 | // The offset at which stop 1.0 of the gradient is placed. 16 | pub end: Box, 17 | 18 | 19 | // A list of values from 0.0 to 1.0 that denote fractions along the gradient. 20 | pub stops: Vec, 21 | 22 | // How this gradient should tile the plane beyond in the region before begin and after end. 23 | pub tile_mode: TileMode, 24 | 25 | 26 | // The transform, if any, to apply to the gradient. 27 | pub transform: Box, 28 | } 29 | 30 | impl Gradient for LinearGradient { 31 | fn create_shader(&self, rect: Rect, text_direction: Option) -> Shader { 32 | todo!() 33 | } 34 | 35 | fn lerp_from(&self, a: Box, t: f32) -> Box { 36 | todo!() 37 | } 38 | 39 | fn lerp_to(&self, b: Box, t: f32) -> Box { 40 | todo!() 41 | } 42 | 43 | fn scale(&self, factor: f32) -> Box { 44 | todo!() 45 | } 46 | } -------------------------------------------------------------------------------- /src/painting/notched_shape.rs: -------------------------------------------------------------------------------- 1 | // getOuterPath(Rect host, Rect? guest) -> Path 2 | // Creates a Path that describes the outline of the shape. 3 | pub struct NotchedShape; 4 | 5 | impl Default for NotchedShape { 6 | fn default() -> Self { 7 | Self {} 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/painting/outlined_border.rs: -------------------------------------------------------------------------------- 1 | #![allow(unused_imports)] 2 | use super::{BorderSide, ShapeBorder}; 3 | 4 | pub trait OutlinedBorder: ShapeBorder { 5 | // pub side: BorderSide, 6 | 7 | // Returns a copy of this OutlinedBorder that draws its outline with the specified side, if side is non-null. 8 | // fn copy_with(&self, side: Option) -> Box; 9 | } 10 | 11 | #[derive(Default)] 12 | pub struct NoneOutlinedBorder; 13 | 14 | impl OutlinedBorder for NoneOutlinedBorder { 15 | 16 | } 17 | 18 | impl ShapeBorder for NoneOutlinedBorder { 19 | 20 | } 21 | 22 | // impl Default for OutlinedBorder { 23 | // fn default() -> Self { 24 | // Self { 25 | // side: Default::default(), 26 | // } 27 | // } 28 | // } 29 | -------------------------------------------------------------------------------- /src/painting/rounded_rectangle_border.rs: -------------------------------------------------------------------------------- 1 | use super::{BorderRadiusGeometry, BorderSide, EdgeInsetsGeometry, OutlinedBorder, ShapeBorder}; 2 | 3 | pub struct RoundedRectangleBorder { 4 | // The radii for each corner. 5 | pub border_radius: Box, 6 | 7 | // The widths of the sides of this border represented as an EdgeInsets. 8 | pub dimensions: Box, 9 | 10 | // The border outline's color and weight. 11 | pub side: BorderSide, 12 | } 13 | 14 | impl RoundedRectangleBorder { 15 | // add(ShapeBorder other, {bool reversed = false}) → ShapeBorder? 16 | // Attempts to create a new object that represents the amalgamation of this border and the other border. 17 | // @protected, inherited 18 | // copyWith({BorderSide? side, BorderRadiusGeometry? borderRadius}) → RoundedRectangleBorder 19 | // Returns a copy of this RoundedRectangleBorder with the given fields replaced with the new values. 20 | // override 21 | // getInnerPath(Rect rect, {TextDirection? textDirection}) → Path 22 | // Create a Path that describes the inner edge of the border. 23 | // override 24 | // getOuterPath(Rect rect, {TextDirection? textDirection}) → Path 25 | // Create a Path that describes the outer edge of the border. 26 | // override 27 | // lerpFrom(ShapeBorder? a, double t) → ShapeBorder? 28 | // Linearly interpolates from another ShapeBorder (possibly of another class) to this. 29 | // override 30 | // lerpTo(ShapeBorder? b, double t) → ShapeBorder? 31 | // Linearly interpolates from this to another ShapeBorder (possibly of another class). 32 | // override 33 | // paint(Canvas canvas, Rect rect, {TextDirection? textDirection}) → void 34 | // Paints the border within the given Rect on the given Canvas. 35 | // override 36 | // scale(double t) → ShapeBorder 37 | // Creates a copy of this border, scaled by the factor t. 38 | // override 39 | // toString() → String 40 | // A string representation of this object. 41 | // override 42 | } 43 | 44 | impl OutlinedBorder for RoundedRectangleBorder {} 45 | 46 | impl ShapeBorder for RoundedRectangleBorder {} 47 | -------------------------------------------------------------------------------- /src/painting/shape_border.rs: -------------------------------------------------------------------------------- 1 | pub trait ShapeBorder { 2 | // The widths of the sides of this border represented as an EdgeInsets. 3 | // dimensions: EdgeInsetsGeometry 4 | 5 | // Attempts to create a new object that represents the amalgamation of this border and the other border. 6 | // add(ShapeBorder other, {bool reversed = false}) → ShapeBorder? 7 | 8 | // Create a Path that describes the inner edge of the border. 9 | // getInnerPath(Rect rect, {TextDirection? textDirection}) → Path 10 | 11 | // Create a Path that describes the outer edge of the border. 12 | // getOuterPath(Rect rect, {TextDirection? textDirection}) → Path 13 | 14 | // Linearly interpolates from another ShapeBorder (possibly of another class) to this. 15 | // lerpFrom(ShapeBorder? a, double t) → ShapeBorder? 16 | 17 | // Linearly interpolates from this to another ShapeBorder (possibly of another class). 18 | // lerpTo(ShapeBorder? b, double t) → ShapeBorder? 19 | 20 | // Paints the border within the given Rect on the given Canvas. 21 | // paint(Canvas canvas, Rect rect, {TextDirection? textDirection}) → void 22 | 23 | // Creates a copy of this border, scaled by the factor t. 24 | // scale(double t) → ShapeBorder 25 | } 26 | 27 | pub struct NoneShapeBorder; 28 | 29 | impl ShapeBorder for NoneShapeBorder {} 30 | 31 | impl Default for NoneShapeBorder { 32 | fn default() -> Self { 33 | Self 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/painting/stadium_border.rs: -------------------------------------------------------------------------------- 1 | use super::{BorderSide, EdgeInsetsGeometry, OutlinedBorder, ShapeBorder}; 2 | 3 | pub struct StadiumBorder { 4 | // The widths of the sides of this border represented as an EdgeInsets. 5 | pub dimensions: Box, 6 | 7 | // The border outline's color and weight. 8 | pub side: BorderSide, 9 | } 10 | 11 | impl StadiumBorder { 12 | // add(ShapeBorder other, {bool reversed = false}) → ShapeBorder? 13 | // Attempts to create a new object that represents the amalgamation of this border and the other border. 14 | // @protected, inherited 15 | // copyWith({BorderSide? side, BorderRadiusGeometry? borderRadius}) → RoundedRectangleBorder 16 | // Returns a copy of this RoundedRectangleBorder with the given fields replaced with the new values. 17 | // override 18 | // getInnerPath(Rect rect, {TextDirection? textDirection}) → Path 19 | // Create a Path that describes the inner edge of the border. 20 | // override 21 | // getOuterPath(Rect rect, {TextDirection? textDirection}) → Path 22 | // Create a Path that describes the outer edge of the border. 23 | // override 24 | // lerpFrom(ShapeBorder? a, double t) → ShapeBorder? 25 | // Linearly interpolates from another ShapeBorder (possibly of another class) to this. 26 | // override 27 | // lerpTo(ShapeBorder? b, double t) → ShapeBorder? 28 | // Linearly interpolates from this to another ShapeBorder (possibly of another class). 29 | // override 30 | // paint(Canvas canvas, Rect rect, {TextDirection? textDirection}) → void 31 | // Paints the border within the given Rect on the given Canvas. 32 | // override 33 | // scale(double t) → ShapeBorder 34 | // Creates a copy of this border, scaled by the factor t. 35 | // override 36 | // toString() → String 37 | // A string representation of this object. 38 | // override 39 | } 40 | 41 | impl OutlinedBorder for StadiumBorder {} 42 | 43 | impl ShapeBorder for StadiumBorder {} 44 | -------------------------------------------------------------------------------- /src/rendering/backend/canvas/mod.rs: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /src/rendering/backend/gles/app_bar.rs: -------------------------------------------------------------------------------- 1 | use std::{fmt, rc::Rc}; 2 | 3 | use crate::{ 4 | elements::AppBarElement, engine::d2::Painter, prelude::color, 5 | rendering::backend::WidgetRenderer, 6 | }; 7 | 8 | pub struct AppBarRender { 9 | painter: Rc, 10 | } 11 | 12 | impl AppBarRender { 13 | pub fn new(painter: Rc) -> Self { 14 | Self { painter } 15 | } 16 | } 17 | 18 | impl WidgetRenderer for AppBarRender { 19 | fn render(&self, widget: &AppBarElement) { 20 | let comp = widget.as_ref().borrow(); 21 | 22 | // println!("AppBarRender {}x{} {}x{}", comp.x, comp.y, comp.w, comp.h); 23 | 24 | self.painter.set_color(color::WHITE); 25 | 26 | self.painter.fill_rect(comp.x, comp.y, comp.w, comp.h); 27 | } 28 | } 29 | 30 | impl fmt::Debug for AppBarRender { 31 | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { 32 | f.debug_struct("AppBarRender").finish() 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/rendering/backend/gles/button.rs: -------------------------------------------------------------------------------- 1 | use crate::{elements::ButtonElement, rendering::backend::WidgetRenderer}; 2 | 3 | #[derive(Debug)] 4 | pub struct ButtonRender; 5 | 6 | impl WidgetRenderer for ButtonRender { 7 | fn render(&self, widget: &ButtonElement) {} 8 | } 9 | -------------------------------------------------------------------------------- /src/rendering/backend/gles/canvas.rs: -------------------------------------------------------------------------------- 1 | use crate::{elements::CanvasElement, rendering::backend::WidgetRenderer}; 2 | 3 | #[derive(Debug)] 4 | pub struct CanvasRender; 5 | 6 | impl WidgetRenderer for CanvasRender { 7 | fn render(&self, widget: &CanvasElement) {} 8 | } 9 | -------------------------------------------------------------------------------- /src/rendering/backend/gles/checkbox.rs: -------------------------------------------------------------------------------- 1 | use crate::{elements::CheckboxElement, rendering::backend::WidgetRenderer}; 2 | 3 | #[derive(Debug)] 4 | pub struct CheckboxRender; 5 | 6 | impl WidgetRenderer for CheckboxRender { 7 | fn render(&self, widget: &CheckboxElement) {} 8 | } 9 | -------------------------------------------------------------------------------- /src/rendering/backend/gles/divider.rs: -------------------------------------------------------------------------------- 1 | use std::{fmt, rc::Rc}; 2 | 3 | use crate::{ 4 | elements::DividerElement, engine::d2::Painter, prelude::color, rendering::backend::WidgetRenderer, 5 | }; 6 | 7 | pub struct DividerRender { 8 | painter: Rc, 9 | } 10 | 11 | impl DividerRender { 12 | pub fn new(painter: Rc) -> Self { 13 | Self { painter } 14 | } 15 | } 16 | 17 | impl WidgetRenderer for DividerRender { 18 | fn render(&self, widget: &DividerElement) { 19 | let comp = widget.as_ref().borrow(); 20 | 21 | // println!("Node {:?}", widget.node); 22 | // println!("DividerRender {}x{} {}x{}", comp.x, comp.y, comp.w, comp.h); 23 | 24 | self.painter.set_color(widget.color); 25 | 26 | let delta = if widget.height - widget.thickness == 0.0 { 27 | 0.0 28 | } else { 29 | (widget.height - widget.thickness) / 2.0 30 | }; 31 | 32 | let cx = comp.x + widget.indent; 33 | let cw = comp.w - widget.indent - widget.end_indent; 34 | 35 | self.painter.fill_rect(cx, comp.y + delta, cw, comp.h); 36 | } 37 | } 38 | 39 | impl fmt::Debug for DividerRender { 40 | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { 41 | f.debug_struct("DividerRender").finish() 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/rendering/backend/gles/dropdown.rs: -------------------------------------------------------------------------------- 1 | use crate::{elements::DropdownButtonElement, rendering::backend::WidgetRenderer}; 2 | 3 | #[derive(Debug)] 4 | pub struct DropdownRender; 5 | 6 | impl WidgetRenderer for DropdownRender { 7 | fn render(&self, widget: &DropdownButtonElement) {} 8 | } 9 | -------------------------------------------------------------------------------- /src/rendering/backend/gles/image.rs: -------------------------------------------------------------------------------- 1 | use std::{fmt, rc::Rc}; 2 | 3 | use crate::prelude::color; 4 | 5 | use crate::{elements::ImageElement, engine::d2::Painter, rendering::backend::WidgetRenderer}; 6 | 7 | pub struct ImageRender { 8 | painter: Rc, 9 | } 10 | 11 | impl ImageRender { 12 | pub fn new(painter: Rc) -> Self { 13 | Self { painter } 14 | } 15 | } 16 | 17 | impl WidgetRenderer for ImageRender { 18 | fn render(&self, widget: &ImageElement) { 19 | let comp = widget.as_ref().borrow(); 20 | 21 | if let Some(ref image) = widget.image { 22 | let dx = (comp.w - image.width as f32) / 2.0; 23 | let dy = (comp.h - image.height as f32) / 2.0; 24 | 25 | self.painter.set_color(color::WHITE); // clear tint 26 | self.painter.draw_image(image, comp.x + dx, comp.y + dy); 27 | } else { 28 | self.painter.set_color(color::YELLOW_7); 29 | self.painter.fill_rect(comp.x, comp.y, comp.w, comp.h); 30 | } 31 | } 32 | } 33 | 34 | impl fmt::Debug for ImageRender { 35 | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { 36 | f.debug_struct("ImageRender").finish() 37 | } 38 | } -------------------------------------------------------------------------------- /src/rendering/backend/gles/label.rs: -------------------------------------------------------------------------------- 1 | use crate::{elements::LabelElement, rendering::backend::WidgetRenderer}; 2 | 3 | #[derive(Debug)] 4 | pub struct LabelRender; 5 | 6 | impl WidgetRenderer for LabelRender { 7 | fn render(&self, widget: &LabelElement) {} 8 | } 9 | -------------------------------------------------------------------------------- /src/rendering/backend/gles/list.rs: -------------------------------------------------------------------------------- 1 | use crate::{elements::ListElement, rendering::backend::WidgetRenderer}; 2 | 3 | #[derive(Debug)] 4 | pub struct ListRender; 5 | 6 | impl WidgetRenderer for ListRender { 7 | fn render(&self, widget: &ListElement) {} 8 | } 9 | -------------------------------------------------------------------------------- /src/rendering/backend/gles/material_app.rs: -------------------------------------------------------------------------------- 1 | use cgmath::Matrix4; 2 | use std::{fmt, rc::Rc}; 3 | 4 | use crate::{ 5 | elements::MaterialAppElement, 6 | engine::d2::Painter, 7 | platform::gles::{core30::gl, enums::*}, 8 | rendering::backend::WidgetRenderer, 9 | }; 10 | 11 | /// MaterialAppRender primary used to clear surface, 12 | /// set viewport and projection matrix in render pahase 13 | /// and finally to flush paintings in post render phase 14 | pub struct MaterialAppRender { 15 | painter: Rc, 16 | } 17 | 18 | impl MaterialAppRender { 19 | pub fn new(painter: Rc) -> Self { 20 | Self { painter } 21 | } 22 | } 23 | 24 | impl WidgetRenderer for MaterialAppRender { 25 | fn render(&self, widget: &MaterialAppElement) { 26 | let comp = widget.as_ref().borrow(); 27 | gl::viewport(0, 0, comp.w as i32, comp.h as i32); 28 | 29 | gl::clear_color(0.3, 0.3, 0.5, 1.0); 30 | 31 | // Enable auto-conversion from/to sRGB 32 | // gl::enable(GL_FRAMEBUFFER_SRGB); 33 | 34 | // Enable alpha blending 35 | gl::enable(GL_BLEND); 36 | gl::blend_func(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); 37 | 38 | // Disable multisampling by default 39 | // gl::disable(GL_MULTISAMPLE); 40 | 41 | gl::clear(GL_COLOR_BUFFER_BIT); 42 | 43 | // log::debug!( 44 | // "Render MaterialApp {}x{}", 45 | // comp.w, comp.h 46 | // ); 47 | 48 | // painter things 49 | let proj_mat: Matrix4 = cgmath::ortho(0.0, comp.w, comp.h, 0.0, -0.1, 1000.0); 50 | self.painter.set_projection(proj_mat); 51 | self.painter.set_font_size(48.0); 52 | } 53 | 54 | fn post_render(&self, widget: &MaterialAppElement) { 55 | self.painter.end(); 56 | } 57 | } 58 | 59 | impl fmt::Debug for MaterialAppRender { 60 | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { 61 | f.debug_struct("AppBarRender").finish() 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /src/rendering/backend/gles/material_button.rs: -------------------------------------------------------------------------------- 1 | use std::{fmt, rc::Rc}; 2 | 3 | use crate::{ 4 | elements::MaterialButtonElement, engine::d2::Painter, prelude::color, rendering::backend::WidgetRenderer, 5 | }; 6 | 7 | pub struct MaterialButtonRender { 8 | painter: Rc, 9 | } 10 | 11 | impl MaterialButtonRender { 12 | pub fn new(painter: Rc) -> Self { 13 | Self { painter } 14 | } 15 | } 16 | 17 | impl WidgetRenderer for MaterialButtonRender { 18 | fn render(&self, widget: &MaterialButtonElement) { 19 | let comp = widget.as_ref().borrow(); 20 | 21 | // println!("Node {:?}", widget.node); 22 | // println!("MaterialButtonRender {}x{} {}x{}", comp.x, comp.y, comp.w, comp.h); 23 | 24 | self.painter.set_color(color::ORANGE_5); 25 | 26 | self.painter.fill_rect(comp.x, comp.y, comp.w, comp.h); 27 | } 28 | } 29 | 30 | impl fmt::Debug for MaterialButtonRender { 31 | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { 32 | f.debug_struct("MaterialButtonRender").finish() 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/rendering/backend/gles/mod.rs: -------------------------------------------------------------------------------- 1 | #![allow(unused_imports)] 2 | #![allow(unused_variables)] 3 | #![allow(dead_code)] 4 | mod app_bar; 5 | pub use self::app_bar::*; 6 | 7 | mod button; 8 | pub use self::button::*; 9 | 10 | mod canvas; 11 | pub use self::canvas::*; 12 | 13 | mod checkbox; 14 | pub use self::checkbox::*; 15 | 16 | mod divider; 17 | pub use self::divider::*; 18 | 19 | mod dropdown; 20 | pub use self::dropdown::*; 21 | 22 | mod image; 23 | pub use self::image::*; 24 | 25 | mod label; 26 | pub use self::label::*; 27 | 28 | mod list; 29 | pub use self::list::*; 30 | 31 | mod material_app; 32 | pub use self::material_app::*; 33 | 34 | mod material_button; 35 | pub use self::material_button::*; 36 | 37 | mod navigation_rail_destination; 38 | pub use self::navigation_rail_destination::*; 39 | 40 | mod navigation_rail; 41 | pub use self::navigation_rail::*; 42 | 43 | mod panel; 44 | pub use self::panel::*; 45 | 46 | mod progress_indicator; 47 | pub use self::progress_indicator::*; 48 | 49 | mod scaffold; 50 | pub use self::scaffold::*; 51 | 52 | mod scrollable; 53 | pub use self::scrollable::*; 54 | 55 | mod slider; 56 | pub use self::slider::*; 57 | 58 | mod text; 59 | pub use self::text::*; 60 | 61 | mod textedit; 62 | pub use self::textedit::*; 63 | 64 | mod vertical_divider; 65 | pub use self::vertical_divider::*; 66 | 67 | mod window; 68 | pub use self::window::*; 69 | -------------------------------------------------------------------------------- /src/rendering/backend/gles/navigation_rail.rs: -------------------------------------------------------------------------------- 1 | use std::{fmt, rc::Rc}; 2 | 3 | use crate::prelude::color; 4 | 5 | use crate::{ 6 | elements::NavigationRailElement, 7 | engine::d2::Painter, 8 | platform::gles::{core30::gl, enums::*}, 9 | rendering::backend::WidgetRenderer, 10 | }; 11 | 12 | pub struct NavigationRailRender { 13 | painter: Rc, 14 | } 15 | 16 | impl NavigationRailRender { 17 | pub fn new(painter: Rc) -> Self { 18 | Self { painter } 19 | } 20 | } 21 | 22 | impl WidgetRenderer for NavigationRailRender { 23 | fn render(&self, widget: &NavigationRailElement) { 24 | let comp = widget.as_ref().borrow(); 25 | 26 | // println!("Node {:?}", widget.node); 27 | // println!("NavigationRailRender {}x{} {}x{}", comp.x, comp.y, comp.w, comp.h); 28 | 29 | self.painter.set_color(color::GRAY_7); 30 | 31 | self.painter.fill_rect(comp.x, comp.y, comp.w, comp.h); 32 | 33 | self.painter.flush(); 34 | } 35 | } 36 | 37 | impl fmt::Debug for NavigationRailRender { 38 | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { 39 | f.debug_struct("NavigationRailRender").finish() 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/rendering/backend/gles/navigation_rail_destination.rs: -------------------------------------------------------------------------------- 1 | use std::{fmt, rc::Rc}; 2 | 3 | use crate::{ 4 | elements::NavigationRailDestinationElement, engine::d2::Painter, prelude::color, 5 | rendering::backend::WidgetRenderer, 6 | }; 7 | 8 | pub struct NavigationRailDestinationRender { 9 | painter: Rc, 10 | } 11 | 12 | impl NavigationRailDestinationRender { 13 | pub fn new(painter: Rc) -> Self { 14 | Self { painter } 15 | } 16 | } 17 | 18 | impl WidgetRenderer for NavigationRailDestinationRender { 19 | fn render(&self, widget: &NavigationRailDestinationElement) { 20 | // let comp = widget.as_ref().borrow(); 21 | 22 | // self.painter.set_color(color::GREEN_7); 23 | 24 | // self.painter 25 | // .fill_rect(comp.x + 1.0, comp.y + 1.0, comp.w - 2.0, comp.h - 2.0); 26 | 27 | // self.painter.flush(); 28 | } 29 | } 30 | 31 | impl fmt::Debug for NavigationRailDestinationRender { 32 | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { 33 | f.debug_struct("NavigationRailDestinationRender").finish() 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/rendering/backend/gles/panel.rs: -------------------------------------------------------------------------------- 1 | use crate::{elements::PanelElement, rendering::backend::WidgetRenderer}; 2 | 3 | #[derive(Debug)] 4 | pub struct PanelRender; 5 | 6 | impl WidgetRenderer for PanelRender { 7 | fn render(&self, widget: &PanelElement) {} 8 | } 9 | -------------------------------------------------------------------------------- /src/rendering/backend/gles/progress_indicator.rs: -------------------------------------------------------------------------------- 1 | use crate::{elements::ProgressIndicatorElement, rendering::backend::WidgetRenderer}; 2 | 3 | #[derive(Debug)] 4 | pub struct ProgressIndicatorRender; 5 | 6 | impl WidgetRenderer for ProgressIndicatorRender { 7 | fn render(&self, widget: &ProgressIndicatorElement) {} 8 | } 9 | -------------------------------------------------------------------------------- /src/rendering/backend/gles/scaffold.rs: -------------------------------------------------------------------------------- 1 | use std::{fmt, rc::Rc}; 2 | 3 | use crate::prelude::color; 4 | 5 | use crate::{elements::ScaffoldElement, engine::d2::Painter, rendering::backend::WidgetRenderer}; 6 | 7 | /// ScaffoldRender maybe used to fill background of application 8 | pub struct ScaffoldRender { 9 | painter: Rc, 10 | } 11 | 12 | impl ScaffoldRender { 13 | pub fn new(painter: Rc) -> Self { 14 | Self { painter } 15 | } 16 | } 17 | 18 | impl WidgetRenderer for ScaffoldRender { 19 | fn render(&self, widget: &ScaffoldElement) { 20 | let comp = widget.as_ref().borrow(); 21 | 22 | log::info!("Render {}x{} {}x{}", comp.x, comp.y, comp.w, comp.h); 23 | self.painter.set_color(color::GRAY_8); 24 | 25 | self.painter.fill_rect(comp.x, comp.y, comp.w, comp.h); 26 | } 27 | } 28 | 29 | impl fmt::Debug for ScaffoldRender { 30 | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { 31 | f.debug_struct("ScaffoldRender").finish() 32 | } 33 | } -------------------------------------------------------------------------------- /src/rendering/backend/gles/scrollable.rs: -------------------------------------------------------------------------------- 1 | use crate::{elements::ScrollableElement, rendering::backend::WidgetRenderer}; 2 | 3 | #[derive(Debug)] 4 | pub struct ScrollableRender; 5 | 6 | impl WidgetRenderer for ScrollableRender { 7 | fn render(&self, widget: &ScrollableElement) {} 8 | } 9 | -------------------------------------------------------------------------------- /src/rendering/backend/gles/slider.rs: -------------------------------------------------------------------------------- 1 | use crate::{elements::SliderElement, rendering::backend::WidgetRenderer}; 2 | 3 | #[derive(Debug)] 4 | pub struct SliderRender; 5 | 6 | impl WidgetRenderer for SliderRender { 7 | fn render(&self, widget: &SliderElement) {} 8 | } 9 | -------------------------------------------------------------------------------- /src/rendering/backend/gles/text.rs: -------------------------------------------------------------------------------- 1 | use std::{fmt, rc::Rc}; 2 | 3 | use crate::{ 4 | elements::TextElement, engine::d2::Painter, prelude::color, rendering::backend::WidgetRenderer, 5 | }; 6 | 7 | pub struct TextRender { 8 | painter: Rc, 9 | } 10 | 11 | impl TextRender { 12 | pub fn new(painter: Rc) -> Self { 13 | Self { painter } 14 | } 15 | } 16 | 17 | impl WidgetRenderer for TextRender { 18 | fn render(&self, widget: &TextElement) { 19 | let comp = widget.as_ref().borrow(); 20 | 21 | // println!("Node {:?}", widget.node); 22 | // println!("TextRender {}x{} {}x{}", comp.x, comp.y, comp.w, comp.h); 23 | 24 | // self.painter.set_color(color::RED_5); 25 | 26 | // self.painter.fill_rect(comp.x, comp.y, comp.w, comp.h); 27 | 28 | let font_size = 18.0; 29 | self.painter.set_color(color::WHITE); 30 | self.painter.set_font_size(font_size); 31 | 32 | // if let Some((w, h)) = self.painter.measure(widget.text().as_str()) { 33 | // println!("Text {}x{}", w, h); 34 | // } 35 | let dy = (comp.h - font_size) / 2.0; 36 | 37 | self.painter.draw_string(widget.text().as_str(), comp.x, comp.y + dy); 38 | } 39 | } 40 | 41 | impl fmt::Debug for TextRender { 42 | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { 43 | f.debug_struct("TextRender").finish() 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/rendering/backend/gles/textedit.rs: -------------------------------------------------------------------------------- 1 | use crate::{elements::TextEditElement, rendering::backend::WidgetRenderer}; 2 | 3 | #[derive(Debug)] 4 | pub struct TextEditRender; 5 | 6 | impl WidgetRenderer for TextEditRender { 7 | fn render(&self, widget: &TextEditElement) {} 8 | } 9 | -------------------------------------------------------------------------------- /src/rendering/backend/gles/vertical_divider.rs: -------------------------------------------------------------------------------- 1 | use std::{fmt, rc::Rc}; 2 | 3 | use crate::{ 4 | elements::VerticalDividerElement, engine::d2::Painter, prelude::color, rendering::backend::WidgetRenderer, 5 | }; 6 | 7 | pub struct VerticalDividerRender { 8 | painter: Rc, 9 | } 10 | 11 | impl VerticalDividerRender { 12 | pub fn new(painter: Rc) -> Self { 13 | Self { painter } 14 | } 15 | } 16 | 17 | impl WidgetRenderer for VerticalDividerRender { 18 | fn render(&self, widget: &VerticalDividerElement) { 19 | let comp = widget.as_ref().borrow(); 20 | 21 | // println!("Node {:?}", widget.node); 22 | // println!("VerticalDividerRender {}x{} {}x{}", comp.x, comp.y, comp.w, comp.h); 23 | 24 | self.painter.set_color(widget.color); 25 | 26 | let delta = if widget.width - widget.thickness == 0.0 { 27 | 0.0 28 | } else { 29 | (widget.width - widget.thickness) / 2.0 30 | }; 31 | 32 | let cy = comp.y + widget.indent; 33 | let ch = comp.h - widget.indent - widget.end_indent; 34 | 35 | self.painter.fill_rect(comp.x + delta, cy, widget.thickness, ch); 36 | } 37 | } 38 | 39 | impl fmt::Debug for VerticalDividerRender { 40 | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { 41 | f.debug_struct("VerticalDividerRender").finish() 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/rendering/backend/gles/window.rs: -------------------------------------------------------------------------------- 1 | use crate::{elements::WindowElement, rendering::backend::WidgetRenderer}; 2 | 3 | #[derive(Debug)] 4 | pub struct WindowRender; 5 | 6 | impl WidgetRenderer for WindowRender { 7 | fn render(&self, widget: &WindowElement) {} 8 | } 9 | -------------------------------------------------------------------------------- /src/rendering/backend/mod.rs: -------------------------------------------------------------------------------- 1 | // WIP 2 | 3 | // pub mod canvas; 4 | // pub mod native; 5 | // pub mod web; 6 | 7 | pub mod gles; 8 | 9 | mod widget_render_factory; 10 | pub use self::widget_render_factory::*; 11 | 12 | mod widget_render_holder; 13 | pub use self::widget_render_holder::*; 14 | 15 | mod widget_renderer; 16 | pub use self::widget_renderer::*; 17 | -------------------------------------------------------------------------------- /src/rendering/backend/native/advanced_widgets/mod.rs: -------------------------------------------------------------------------------- 1 | mod alert; 2 | pub use self::alert::{Alert, AlertExt}; 3 | 4 | mod avatar; 5 | pub use self::avatar::{Avatar, AvatarExt}; 6 | 7 | mod badge; 8 | pub use self::badge::{Badge, BadgeExt}; 9 | 10 | mod breadcrumb; 11 | pub use self::breadcrumb::{Breadcrumb, BreadcrumbExt}; 12 | 13 | mod button_group; 14 | pub use self::button_group::{ButtonGroup, ButtonGroupExt}; 15 | 16 | mod calendar; 17 | pub use self::calendar::{Calendar, CalendarExt}; 18 | 19 | mod carousel; 20 | pub use self::carousel::{Carousel, CarouselExt}; 21 | 22 | mod chip_group; 23 | pub use self::chip_group::{ChipGroup, ChipGroupExt}; 24 | 25 | mod color_picker; 26 | pub use self::color_picker::{ColorPicker, ColorPickerExt}; 27 | 28 | mod expansion_panel; 29 | pub use self::expansion_panel::{ExpansionPanel, ExpansionPanelExt}; 30 | 31 | mod grid; 32 | pub use self::grid::{Grid, GridExt}; 33 | 34 | mod item_group; 35 | pub use self::item_group::{ItemGroup, ItemGroupExt}; 36 | 37 | mod listitem_group; 38 | pub use self::listitem_group::{ListitemGroup, ListitemGroupExt}; 39 | 40 | mod overlay; 41 | pub use self::overlay::{Overlay, OverlayExt}; 42 | 43 | mod pagination; 44 | pub use self::pagination::{Pagination, PaginationExt}; 45 | 46 | mod parallax; 47 | pub use self::parallax::{Parallax, ParallaxExt}; 48 | 49 | mod rail; 50 | pub use self::rail::{Rail, RailExt}; 51 | 52 | mod rating; 53 | pub use self::rating::{Rating, RatingExt}; 54 | 55 | mod select; 56 | pub use self::select::{Select, SelectExt}; 57 | 58 | mod side_group; 59 | pub use self::side_group::{SideGroup, SideGroupExt}; 60 | 61 | mod stepper; 62 | pub use self::stepper::{Stepper, StepperExt}; 63 | 64 | mod treeview; 65 | pub use self::treeview::{Treeview, TreeviewExt}; 66 | -------------------------------------------------------------------------------- /src/rendering/backend/native/audio_widgets/mod.rs: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /src/rendering/backend/native/chart_widgets/mod.rs: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /src/rendering/backend/native/effects/mod.rs: -------------------------------------------------------------------------------- 1 | mod fade_effect; 2 | pub use self::fade_effect::{FadeEffect, FadeEffectExt}; 3 | -------------------------------------------------------------------------------- /src/rendering/backend/native/layout/frame.rs: -------------------------------------------------------------------------------- 1 | #![allow(unused_variables)] 2 | 3 | use crate::prelude::*; 4 | use crate::{Actor, Widget}; 5 | use std::fmt; 6 | 7 | #[derive(Debug)] 8 | pub struct Frame { 9 | pub child: Option, 10 | widget: Widget, 11 | } 12 | 13 | impl Frame { 14 | pub fn new() -> Frame { 15 | // assert_initialized_main_thread!(); 16 | // unsafe { Actor::from_glib_none(ffi::frame_new()).unsafe_cast() } 17 | unimplemented!() 18 | } 19 | } 20 | 21 | impl Default for Frame { 22 | fn default() -> Self { 23 | Self::new() 24 | } 25 | } 26 | 27 | impl Object for Frame {} 28 | impl Is for Frame {} 29 | 30 | impl AsRef for Frame { 31 | fn as_ref(&self) -> &Frame { 32 | self 33 | } 34 | } 35 | 36 | impl Is for Frame {} 37 | 38 | impl AsRef for Frame { 39 | fn as_ref(&self) -> &Widget { 40 | &self.widget 41 | } 42 | } 43 | 44 | impl Is for Frame {} 45 | 46 | impl AsRef for Frame { 47 | fn as_ref(&self) -> &Actor { 48 | let actor: &Actor = self.widget.as_ref(); 49 | actor 50 | } 51 | } 52 | 53 | impl fmt::Display for Frame { 54 | fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { 55 | write!(f, "Frame") 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/rendering/backend/native/layout/mod.rs: -------------------------------------------------------------------------------- 1 | // mod box_layout; 2 | // pub use self::box_layout::{BoxLayout, BoxLayoutExt}; 3 | 4 | // mod box_layout_child; 5 | // pub use self::box_layout_child::{BoxLayoutChild, BoxLayoutChildExt}; 6 | 7 | mod frame; 8 | pub use self::frame::Frame; 9 | 10 | mod kinetic_scroll_view; 11 | pub use self::kinetic_scroll_view::{KineticScrollView, KineticScrollViewExt}; 12 | 13 | mod scroll_view; 14 | pub use self::scroll_view::{ScrollView, ScrollViewExt}; 15 | 16 | mod viewport; 17 | pub use self::viewport::{Viewport, ViewportExt}; 18 | -------------------------------------------------------------------------------- /src/rendering/backend/native/utils/floating_widget.rs: -------------------------------------------------------------------------------- 1 | #![allow(unused_variables)] 2 | 3 | use crate::prelude::*; 4 | use crate::{Actor, Stage, Widget, platform::core::Matrix}; 5 | use std::{cell::RefCell, fmt}; 6 | 7 | #[derive(Debug)] 8 | pub struct FloatingWidgetProps { 9 | pub stage: Option, 10 | pub paint_matrix: Option, 11 | pub pick_matrix: Option, 12 | pub pick_handler: u64, 13 | pub paint_handler: u64, 14 | } 15 | 16 | #[derive(Debug)] 17 | pub struct FloatingWidget { 18 | props: RefCell, 19 | widget: Widget, 20 | } 21 | 22 | impl FloatingWidget {} 23 | 24 | impl Object for FloatingWidget {} 25 | impl Is for FloatingWidget {} 26 | 27 | impl AsRef for FloatingWidget { 28 | fn as_ref(&self) -> &FloatingWidget { 29 | self 30 | } 31 | } 32 | 33 | impl Is for FloatingWidget {} 34 | 35 | impl AsRef for FloatingWidget { 36 | fn as_ref(&self) -> &Widget { 37 | &self.widget 38 | } 39 | } 40 | 41 | impl Is for FloatingWidget {} 42 | 43 | impl AsRef for FloatingWidget { 44 | fn as_ref(&self) -> &Actor { 45 | let actor: &Actor = self.widget.as_ref(); 46 | actor 47 | } 48 | } 49 | 50 | impl fmt::Display for FloatingWidget { 51 | fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { 52 | write!(f, "FloatingWidget") 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/rendering/backend/native/utils/focusable.rs: -------------------------------------------------------------------------------- 1 | #[derive(Clone, Debug)] 2 | pub struct Focusable; 3 | -------------------------------------------------------------------------------- /src/rendering/backend/native/utils/mod.rs: -------------------------------------------------------------------------------- 1 | mod actor_manager; 2 | pub use self::actor_manager::{ActorManager, ActorManagerExt}; 3 | 4 | mod adjustment; 5 | pub use self::adjustment::{Adjustment, AdjustmentExt}; 6 | 7 | mod clipboard; 8 | pub use self::clipboard::{Clipboard, ClipboardExt}; 9 | 10 | mod combo_box; 11 | pub use self::combo_box::{ComboBox, ComboBoxExt}; 12 | 13 | mod floating_widget; 14 | pub use self::floating_widget::FloatingWidget; 15 | 16 | mod focus_manager; 17 | pub use self::focus_manager::{FocusManager, FocusManagerExt}; 18 | 19 | mod focusable; 20 | pub use self::focusable::Focusable; 21 | 22 | mod icon_theme; 23 | pub use self::icon_theme::{IconTheme, IconThemeExt}; 24 | 25 | mod image; 26 | pub use self::image::{Image, ImageExt}; 27 | 28 | mod item_view; 29 | pub use self::item_view::{ItemView, ItemViewExt}; 30 | 31 | mod label; 32 | pub use self::label::{Label, LabelExt}; 33 | 34 | mod notebook; 35 | pub use self::notebook::{Notebook, NotebookExt}; 36 | 37 | mod pager; 38 | pub use self::pager::{Pager, PagerExt}; 39 | 40 | mod path_bar; 41 | pub use self::path_bar::{PathBar, PathBarExt}; 42 | 43 | mod push_action; 44 | pub use self::push_action::{PushAction, PushActionExt}; 45 | 46 | mod scroll_bar; 47 | pub use self::scroll_bar::{ScrollBar, ScrollBarExt}; 48 | 49 | mod settings; 50 | pub use self::settings::{Settings, SettingsExt}; 51 | 52 | mod spinner; 53 | pub use self::spinner::{Spinner, SpinnerExt}; 54 | 55 | mod stack_child; 56 | pub use self::stack_child::{StackChild, StackChildExt}; 57 | 58 | mod stack; 59 | pub use self::stack::{Stack, StackExt}; 60 | 61 | mod style; 62 | pub use self::style::{Style, StyleExt}; 63 | 64 | mod table_child; 65 | pub use self::table_child::{TableChild, TableChildExt}; 66 | 67 | mod texture_cache; 68 | pub use self::texture_cache::{TextureCache, TextureCacheExt}; 69 | 70 | mod toggle; 71 | pub use self::toggle::{Toggle, ToggleExt}; 72 | 73 | mod toolbar; 74 | pub use self::toolbar::{Toolbar, ToolbarExt}; 75 | -------------------------------------------------------------------------------- /src/rendering/backend/native/video_widgets/mod.rs: -------------------------------------------------------------------------------- 1 | mod video_timeline; 2 | pub use self::video_timeline::{VideoTimeline, VideoTimelineExt}; -------------------------------------------------------------------------------- /src/rendering/backend/web/mod.rs: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /src/rendering/backend/widget_render_holder.rs: -------------------------------------------------------------------------------- 1 | use std::fmt::{Debug, Formatter, Result}; 2 | 3 | use super::WidgetRenderer; 4 | 5 | pub struct WidgetRenderHolder(pub Box>); 6 | 7 | impl WidgetRenderer for WidgetRenderHolder { 8 | fn render(&self, widget: &T) { 9 | self.0.render(widget); 10 | } 11 | 12 | fn post_render(&self, widget: &T) { 13 | self.0.post_render(widget); 14 | } 15 | } 16 | 17 | impl Debug for WidgetRenderHolder { 18 | fn fmt(&self, f: &mut Formatter<'_>) -> Result { 19 | f.debug_tuple("WidgetRenderHolder").field(&self.0).finish() 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/rendering/custom_clipper.rs: -------------------------------------------------------------------------------- 1 | use crate::ui::{Rect, Size, VoidCallback, Path}; 2 | 3 | pub trait CustomClipper { 4 | // Register a closure to be notified when it is time to reclip. 5 | fn add_listener(&self, listener: VoidCallback) { 6 | todo!() 7 | } 8 | 9 | // Returns an approximation of the clip returned by getClip, as an axis-aligned Rect. 10 | // This is used by the semantics layer to determine whether widgets should be excluded. 11 | fn get_approximate_clip_rect(&self, size: Size) -> Rect { 12 | todo!() 13 | } 14 | 15 | // Returns a description of the clip given that the render object being clipped is of the given size. 16 | fn get_clip(&self, size: Size) -> T; 17 | 18 | // Remove a previously registered closure from the list of closures that the object notifies when it is time to reclip. 19 | fn remove_listener(&self, listener: VoidCallback) {} 20 | 21 | // Called whenever a new instance of the custom clipper delegate class is provided to the clip object, 22 | // or any time that a new clip object is created with a new instance of the custom clipper 23 | // delegate class (which amounts to the same thing, because the latter is implemented in terms of the former). 24 | fn should_reclip(&self, old_clipper: Box>) -> bool { 25 | todo!() 26 | } 27 | } 28 | 29 | #[derive(Default)] 30 | pub struct NoneCustomPathClipper; 31 | 32 | impl CustomClipper for NoneCustomPathClipper { 33 | fn get_clip(&self, size: Size) -> Path { 34 | todo!() 35 | } 36 | } 37 | 38 | #[derive(Default)] 39 | pub struct NoneCustomRectClipper; 40 | 41 | impl CustomClipper for NoneCustomRectClipper { 42 | fn get_clip(&self, size: Size) -> Rect { 43 | todo!() 44 | } 45 | } -------------------------------------------------------------------------------- /src/rendering/custom_painter.rs: -------------------------------------------------------------------------------- 1 | pub trait CustomPainter { 2 | 3 | } 4 | 5 | #[derive(Default)] 6 | pub struct NoneCustomPainter; 7 | 8 | impl CustomPainter for NoneCustomPainter { 9 | 10 | } -------------------------------------------------------------------------------- /src/rendering/enums/cross_axis_alignment.rs: -------------------------------------------------------------------------------- 1 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] 2 | pub enum CrossAxisAlignment { 3 | Start = 0, 4 | End = 1, 5 | Center = 2, 6 | Stretch = 3, 7 | Baseline = 4, 8 | } 9 | 10 | impl Default for CrossAxisAlignment { 11 | fn default() -> Self { 12 | Self::Start 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/rendering/enums/flex_fit.rs: -------------------------------------------------------------------------------- 1 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] 2 | pub enum FlexFit { 3 | // The child is forced to fill the available space. 4 | // The Expanded widget assigns this kind of FlexFit to its child. 5 | Tight = 0, 6 | // The child can be at most as large as the available space (but is allowed to be smaller). 7 | // The Flexible widget assigns this kind of FlexFit to its child. 8 | Lose = 1, 9 | } 10 | 11 | impl Default for FlexFit { 12 | fn default() -> Self { 13 | Self::Tight 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/rendering/enums/growth_direction.rs: -------------------------------------------------------------------------------- 1 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] 2 | pub enum GrowthDirection { 3 | // This sliver's contents are ordered in the same direction as the AxisDirection. 4 | Forward = 0, 5 | 6 | // This sliver's contents are ordered in the opposite direction of the AxisDirection. 7 | Reverse = 1, 8 | } 9 | 10 | impl Default for GrowthDirection { 11 | fn default() -> Self { 12 | Self::Forward 13 | } 14 | } -------------------------------------------------------------------------------- /src/rendering/enums/main_axis_alignment.rs: -------------------------------------------------------------------------------- 1 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] 2 | pub enum MainAxisAlignment { 3 | Start = 0, 4 | End = 1, 5 | Center = 2, 6 | SpaceBetween = 3, 7 | SpaceAround = 4, 8 | SpaceEvenly = 5, 9 | } 10 | 11 | impl Default for MainAxisAlignment { 12 | fn default() -> Self { 13 | Self::Start 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/rendering/enums/main_axis_size.rs: -------------------------------------------------------------------------------- 1 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] 2 | pub enum MainAxisSize { 3 | Min = 0, 4 | Max = 1, 5 | } 6 | 7 | impl Default for MainAxisSize { 8 | fn default() -> Self { 9 | Self::Min 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/rendering/enums/mod.rs: -------------------------------------------------------------------------------- 1 | mod cross_axis_alignment; 2 | pub use self::cross_axis_alignment::*; 3 | 4 | mod flex_fit; 5 | pub use self::flex_fit::*; 6 | 7 | mod growth_direction; 8 | pub use self::growth_direction::*; 9 | 10 | mod main_axis_alignment; 11 | pub use self::main_axis_alignment::*; 12 | 13 | mod main_axis_size; 14 | pub use self::main_axis_size::*; 15 | 16 | mod scroll_direction; 17 | pub use self::scroll_direction::*; 18 | 19 | mod stack_fit; 20 | pub use self::stack_fit::*; 21 | 22 | mod wrap_alignment; 23 | pub use self::wrap_alignment::*; 24 | -------------------------------------------------------------------------------- /src/rendering/enums/scroll_direction.rs: -------------------------------------------------------------------------------- 1 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] 2 | pub enum ScrollDirection { 3 | // No scrolling is underway. 4 | Idle = 0, 5 | 6 | // Scrolling is happening in the positive scroll offset direction. 7 | // For example, for the GrowthDirection.forward part of a vertical AxisDirection.down list, 8 | // this means the content is moving up, exposing lower content. 9 | Forward = 1, 10 | // Scrolling is happening in the negative scroll offset direction. 11 | // For example, for the GrowthDirection.forward part of a vertical AxisDirection.down list, 12 | // this means the content is moving down, exposing earlier content. 13 | Reverse = 2 14 | } 15 | 16 | impl Default for ScrollDirection { 17 | fn default() -> Self { 18 | Self::Idle 19 | } 20 | } -------------------------------------------------------------------------------- /src/rendering/enums/stack_fit.rs: -------------------------------------------------------------------------------- 1 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] 2 | pub enum StackFit { 3 | // The constraints passed to the stack from its parent are loosened. 4 | // For example, if the stack has constraints that force it to 350x600, then this would allow the 5 | // non-positioned children of the stack to have any width from zero to 350 and any height from zero to 600. 6 | // See also: 7 | // Center, which loosens the constraints passed to its child and then centers the child in itself. 8 | // BoxConstraints.loosen, which implements the loosening of box constraints. 9 | Loose = 0, 10 | // The constraints passed to the stack from its parent are tightened to the biggest size allowed. 11 | // For example, if the stack has loose constraints with a width in the range 10 to 100 and a 12 | // height in the range 0 to 600, then the non-positioned children of the stack 13 | // would all be sized as 100 pixels wide and 600 high. 14 | Expand = 1, 15 | // The constraints passed to the stack from its parent are passed 16 | // unmodified to the non-positioned children. 17 | // For example, if a Stack is an Expanded child of a Row, the horizontal 18 | // constraints will be tight and the vertical constraints will be loose. 19 | Passthrough = 2, 20 | } 21 | 22 | impl Default for StackFit { 23 | fn default() -> Self { 24 | Self::Loose 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/rendering/enums/wrap_alignment.rs: -------------------------------------------------------------------------------- 1 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] 2 | pub enum WrapAlignment { 3 | // Place the objects as close to the start of the axis as possible. 4 | // If this value is used in a horizontal direction, a TextDirection must be available to determine if the start is the left or the right. 5 | // If this value is used in a vertical direction, a VerticalDirection must be available to determine if the start is the top or the bottom. 6 | Start = 0, 7 | 8 | // Place the objects as close to the end of the axis as possible. 9 | // If this value is used in a horizontal direction, a TextDirection must be available to determine if the end is the left or the right. 10 | // If this value is used in a vertical direction, a VerticalDirection must be available to determine if the end is the top or the bottom. 11 | End = 1, 12 | 13 | // Place the objects as close to the middle of the axis as possible. 14 | Center = 2, 15 | 16 | // Place the free space evenly between the objects. 17 | SpaceBetween = 3, 18 | 19 | // Place the free space evenly between the objects as well as half of that space before and after the first and last objects. 20 | SpaceAround = 4, 21 | 22 | // Place the free space evenly between the objects as well as before and after the first and last objects. 23 | SpaceEvenly = 5, 24 | } 25 | 26 | impl Default for WrapAlignment { 27 | fn default() -> Self { 28 | Self::Start 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/rendering/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod backend; 2 | 3 | mod enums; 4 | pub use self::enums::*; 5 | 6 | mod box_constraints; 7 | pub use self::box_constraints::*; 8 | 9 | mod custom_clipper; 10 | pub use self::custom_clipper::*; 11 | 12 | mod custom_painter; 13 | pub use self::custom_painter::*; 14 | 15 | mod render_box; 16 | pub use self::render_box::*; 17 | 18 | mod sliver_constraints; 19 | pub use self::sliver_constraints::*; 20 | 21 | mod sliver_grid_delegate_with_fixed_cross_axis_count; 22 | pub use self::sliver_grid_delegate_with_fixed_cross_axis_count::*; 23 | 24 | mod sliver_grid_delegate; 25 | pub use self::sliver_grid_delegate::*; 26 | 27 | mod sliver_grid_layout; 28 | pub use self::sliver_grid_layout::*; -------------------------------------------------------------------------------- /src/rendering/render_box.rs: -------------------------------------------------------------------------------- 1 | pub struct RenderBox { 2 | 3 | } -------------------------------------------------------------------------------- /src/rendering/sliver_grid_delegate.rs: -------------------------------------------------------------------------------- 1 | use super::{SliverConstraints, SliverGridLayout}; 2 | 3 | pub trait SliverGridDelegate { 4 | // Returns information about the size and position of the tiles in the grid. 5 | fn get_layout(&self, constraints: SliverConstraints) -> Box { 6 | todo!() 7 | } 8 | 9 | // Override this method to return true when the children need to be laid out. [...] 10 | fn should_relayout(&self, old_delegate: Box) -> bool { 11 | false 12 | } 13 | } 14 | 15 | pub struct NoneSliverGridDelegate; 16 | 17 | impl SliverGridDelegate for NoneSliverGridDelegate { 18 | 19 | } -------------------------------------------------------------------------------- /src/rendering/sliver_grid_delegate_with_fixed_cross_axis_count.rs: -------------------------------------------------------------------------------- 1 | use super::SliverGridDelegate; 2 | 3 | /* 4 | getLayout(SliverConstraints constraints) -> SliverGridLayout 5 | Returns information about the size and position of the tiles in the grid. 6 | override 7 | noSuchMethod(Invocation invocation) -> dynamic 8 | Invoked when a non-existent method or property is accessed. 9 | inherited 10 | shouldRelayout(covariant SliverGridDelegateWithFixedCrossAxisCount oldDelegate) -> bool 11 | Override this method to return true when the children need to be laid out. 12 | override 13 | */ 14 | pub struct SliverGridDelegateWithFixedCrossAxisCount { 15 | // The ratio of the cross-axis to the main-axis extent of each child. 16 | pub child_aspect_ratio: f32, 17 | 18 | // The number of children in the cross axis. 19 | pub cross_axis_count: usize, 20 | 21 | // The number of logical pixels between each child along the cross axis. 22 | pub cross_axis_spacing: f32, 23 | 24 | // The extent of each tile in the main axis. If provided it would define the logical pixels taken by each tile in the main-axis. 25 | pub main_axis_extent: f32, 26 | 27 | // The number of logical pixels between each child along the main axis. 28 | pub main_axis_spacing: f32, 29 | } 30 | 31 | impl Default for SliverGridDelegateWithFixedCrossAxisCount { 32 | fn default() -> Self { 33 | Self { 34 | child_aspect_ratio: Default::default(), 35 | cross_axis_count: Default::default(), 36 | cross_axis_spacing: Default::default(), 37 | main_axis_extent: Default::default(), 38 | main_axis_spacing: Default::default(), 39 | } 40 | } 41 | } 42 | 43 | impl SliverGridDelegate for SliverGridDelegateWithFixedCrossAxisCount { 44 | 45 | } -------------------------------------------------------------------------------- /src/rendering/sliver_grid_layout.rs: -------------------------------------------------------------------------------- 1 | pub trait SliverGridLayout { 2 | // computeMaxScrollOffset(int childCount): f32 3 | // The scroll extent needed to fully display all the tiles if there are childCount children in total. 4 | // getGeometryForChildIndex(int index): SliverGridGeometry 5 | // The size and position of the child with the given index. 6 | // getMaxChildIndexForScrollOffset(f32 scrollOffset): int 7 | // The maximum child index that intersects with (or is before) this scroll offset. 8 | // getMinChildIndexForScrollOffset(f32 scrollOffset): int 9 | // The minimum child index that intersects with (or is after) this scroll offset. 10 | } -------------------------------------------------------------------------------- /src/rx/mod.rs: -------------------------------------------------------------------------------- 1 | mod stream_controller; 2 | pub use self::stream_controller::*; -------------------------------------------------------------------------------- /src/rx/stream_controller.rs: -------------------------------------------------------------------------------- 1 | pub struct StreamController { 2 | pub data: T, 3 | 4 | // done → Future 5 | // A future which is completed when the stream controller is done sending events. [...] 6 | // read-only, override 7 | // hashCode → int 8 | // The hash code for this object. [...] 9 | // read-only, inherited 10 | // hasListener → bool 11 | // Whether there is a subscriber on the Stream. 12 | // read-only 13 | // isClosed → bool 14 | // Whether the stream controller is closed for adding more events. [...] 15 | // read-only 16 | // isPaused → bool 17 | // Whether the subscription would need to buffer events. [...] 18 | // read-only 19 | // onCancel ↔ (FutureOr Function?()?) 20 | // The callback which is called when the stream is canceled. [...] 21 | // read / write 22 | // onListen ↔ (void Function?()?) 23 | // The callback which is called when the stream is listened to. [...] 24 | // read / write 25 | // onPause ↔ (void Function?()?) 26 | // The callback which is called when the stream is paused. [...] 27 | // read / write 28 | // onResume ↔ (void Function?()?) 29 | // The callback which is called when the stream is resumed. [...] 30 | // read / write 31 | // runtimeType → Type 32 | // A representation of the runtime type of the object. 33 | // read-only, inherited 34 | // sink → StreamSink 35 | // Returns a view of this object that only exposes the StreamSink interface. 36 | // read-only 37 | // stream → Stream 38 | // The stream that this controller is controlling. 39 | // read-only 40 | } -------------------------------------------------------------------------------- /src/services/mod.rs: -------------------------------------------------------------------------------- 1 | use crate::gestures::{PointerEnterEvent, PointerExitEvent}; 2 | 3 | mod asset_bundle; 4 | pub use self::asset_bundle::*; 5 | 6 | mod focus; 7 | pub use self::focus::*; 8 | 9 | mod layout_system; 10 | pub use self::layout_system::*; 11 | 12 | mod mouse_cursor; 13 | pub use self::mouse_cursor::*; 14 | 15 | mod system_ui_overlay_style; 16 | pub use self::system_ui_overlay_style::*; 17 | 18 | mod text_editing_value; 19 | pub use self::text_editing_value::*; 20 | 21 | mod text_input_type; 22 | pub use self::text_input_type::*; 23 | 24 | mod text_selection; 25 | pub use self::text_selection::*; 26 | 27 | pub type PointerEnterEventListener = Box; 28 | pub type PointerExitEventListener = Box; 29 | -------------------------------------------------------------------------------- /src/services/mouse_cursor.rs: -------------------------------------------------------------------------------- 1 | pub struct MouseCursor {} 2 | 3 | impl Default for MouseCursor { 4 | fn default() -> Self { 5 | Self {} 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /src/services/system_ui_overlay_style.rs: -------------------------------------------------------------------------------- 1 | use crate::{foundation::colorspace::Color, ui::Brightness}; 2 | 3 | pub struct SystemUiOverlayStyle { 4 | pub system_navigation_bar_color: Color, 5 | pub system_navigation_bar_divider_color: Color, 6 | pub system_navigation_bar_icon_brightness: Brightness, 7 | pub system_navigation_bar_contrast_enforced: bool, 8 | pub status_bar_color: Color, 9 | pub status_bar_brightness: Brightness, 10 | pub status_bar_icon_brightness: Brightness, 11 | pub system_status_bar_contrast_enforced: bool, 12 | } 13 | 14 | impl Default for SystemUiOverlayStyle { 15 | fn default() -> Self { 16 | Self { 17 | system_navigation_bar_color: Default::default(), 18 | system_navigation_bar_divider_color: Default::default(), 19 | system_navigation_bar_icon_brightness: Default::default(), 20 | system_navigation_bar_contrast_enforced: Default::default(), 21 | status_bar_color: Default::default(), 22 | status_bar_brightness: Default::default(), 23 | status_bar_icon_brightness: Default::default(), 24 | system_status_bar_contrast_enforced: Default::default(), 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/services/text_editing_value.rs: -------------------------------------------------------------------------------- 1 | use crate::ui::TextRange; 2 | 3 | use super::TextSelection; 4 | 5 | #[derive(Default)] 6 | pub struct TextEditingValue { 7 | // The range of text that is still being composed. 8 | pub composing: TextRange, 9 | 10 | // Whether the composing range is a valid range within text. 11 | pub is_composing_range_valid: bool, 12 | 13 | // The range of text that is currently selected. 14 | pub selection: TextSelection, 15 | 16 | // The current text being edited. 17 | pub text: String, 18 | } 19 | 20 | impl TextEditingValue { 21 | // copyWith({String? text, TextSelection? selection, TextRange? composing}) → TextEditingValue 22 | // Creates a copy of this value but with the given fields replaced with the new values. 23 | // noSuchMethod(Invocation invocation) → dynamic 24 | // Invoked when a non-existent method or property is accessed. 25 | // inherited 26 | // replaced(TextRange replacementRange, String replacementString) → TextEditingValue 27 | // Returns a new TextEditingValue, which is this TextEditingValue with its text partially replaced by the replacementString. 28 | // toJSON() → Map 29 | // Returns a representation of this object as a JSON object. 30 | // toString() → String 31 | // A string representation of this object. 32 | // override 33 | } -------------------------------------------------------------------------------- /src/ui/canvas.rs: -------------------------------------------------------------------------------- 1 | pub struct Canvas { 2 | 3 | } -------------------------------------------------------------------------------- /src/ui/color_filter.rs: -------------------------------------------------------------------------------- 1 | #[derive(Default, Copy, Clone)] 2 | pub struct ColorFilter; -------------------------------------------------------------------------------- /src/ui/enums/app_lifecycle_state.rs: -------------------------------------------------------------------------------- 1 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] 2 | pub enum AppLifecycleState { 3 | Resumed = 0, 4 | Inactive = 1, 5 | Paused = 2, 6 | Detached = 3, 7 | } 8 | 9 | impl Default for AppLifecycleState { 10 | fn default() -> Self { 11 | Self::Resumed 12 | } 13 | } -------------------------------------------------------------------------------- /src/ui/enums/blend_mode.rs: -------------------------------------------------------------------------------- 1 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] 2 | pub enum BlendMode { 3 | Clear = 0, 4 | Color = 27, 5 | ColorBurn = 19, 6 | ColorDodge = 18, 7 | Darken = 16, 8 | Difference = 22, 9 | Dst = 2, 10 | DstATop = 10, 11 | DstIn = 6, 12 | DstOut = 8, 13 | DstOver = 4, 14 | Exclusion = 23, 15 | HardLight = 20, 16 | Hue = 25, 17 | Lighten = 17, 18 | Luminosity = 28, 19 | Modulate = 13, 20 | Multiply = 24, 21 | Overlay = 15, 22 | Plus = 12, 23 | Saturation = 26, 24 | Screen = 14, 25 | SoftLight = 21, 26 | Src = 1, 27 | SrcATop = 9, 28 | SrcIn = 5, 29 | SrcOut = 7, 30 | SrcOver = 3, 31 | Xor = 11, 32 | } 33 | 34 | impl Default for BlendMode { 35 | fn default() -> Self { 36 | Self::Clear 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/ui/enums/blur_style.rs: -------------------------------------------------------------------------------- 1 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] 2 | pub enum BlurStyle { 3 | Normal = 0, 4 | Solid = 1, 5 | Outer = 2, 6 | Inner = 3, 7 | } 8 | 9 | impl Default for BlurStyle { 10 | fn default() -> Self { 11 | Self::Normal 12 | } 13 | } -------------------------------------------------------------------------------- /src/ui/enums/box_height_style.rs: -------------------------------------------------------------------------------- 1 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] 2 | pub enum BoxHeightStyle { 3 | Tight = 0, 4 | Max = 1, 5 | IncludeLineSpacingMiddle = 2, 6 | IncludeLineSpacingTop = 3, 7 | IncludeLineSpacingBottom = 4, 8 | Strut = 5, 9 | } 10 | 11 | impl Default for BoxHeightStyle { 12 | fn default() -> Self { 13 | Self::Tight 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/ui/enums/box_width_style.rs: -------------------------------------------------------------------------------- 1 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] 2 | pub enum BoxWidthStyle { 3 | Tight = 0, 4 | Max = 1, 5 | } 6 | 7 | impl Default for BoxWidthStyle { 8 | fn default() -> Self { 9 | Self::Tight 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/ui/enums/brightness.rs: -------------------------------------------------------------------------------- 1 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] 2 | pub enum Brightness { 3 | Dark = 0, 4 | Light = 1, 5 | } 6 | 7 | impl Default for Brightness { 8 | fn default() -> Self { 9 | Self::Dark 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/ui/enums/clip.rs: -------------------------------------------------------------------------------- 1 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] 2 | pub enum Clip { 3 | None = 0, 4 | HardEdge = 1, 5 | AntiAlias = 2, 6 | AntiAliasWithSaveLayer = 3, 7 | } 8 | 9 | impl Default for Clip { 10 | fn default() -> Self { 11 | Self::None 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/ui/enums/clip_op.rs: -------------------------------------------------------------------------------- 1 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] 2 | pub enum ClipOp { 3 | Difference = 0, 4 | Intersect = 1, 5 | } 6 | 7 | impl Default for ClipOp { 8 | fn default() -> Self { 9 | Self::Difference 10 | } 11 | } -------------------------------------------------------------------------------- /src/ui/enums/filter_quality.rs: -------------------------------------------------------------------------------- 1 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] 2 | pub enum FilterQuality { 3 | None = 0, 4 | Low = 1, 5 | Medium = 2, 6 | High = 3, 7 | } 8 | 9 | impl Default for FilterQuality { 10 | fn default() -> Self { 11 | Self::None 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/ui/enums/font_style.rs: -------------------------------------------------------------------------------- 1 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] 2 | pub enum FontStyle { 3 | Normal = 0, 4 | Italic = 1, 5 | } 6 | 7 | impl Default for FontStyle { 8 | fn default() -> Self { 9 | Self::Normal 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/ui/enums/frame_phase.rs: -------------------------------------------------------------------------------- 1 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] 2 | pub enum FramePhase { 3 | VsyncStart = 0, 4 | BuildStart = 1, 5 | BildFinish = 2, 6 | RasterStart = 3, 7 | RasterFinish = 4, 8 | RasterFinishWallTime = 5, 9 | } 10 | 11 | impl Default for FramePhase { 12 | fn default() -> Self { 13 | Self::VsyncStart 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/ui/enums/image_byte_format.rs: -------------------------------------------------------------------------------- 1 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] 2 | pub enum ImageByteFormat { 3 | // Raw RGBA format. 4 | // Unencoded bytes, in RGBA row-primary form with premultiplied alpha, 8 bits per channel. 5 | RawRgba = 0, 6 | 7 | 8 | // Raw straight RGBA format. 9 | // Unencoded bytes, in RGBA row-primary form with straight alpha, 8 bits per channel. 10 | RawStraightRgba = 1, 11 | 12 | // Raw unmodified format. 13 | // Unencoded bytes, in the image's existing format. For example, a grayscale image may use a single 8-bit channel for each pixel. 14 | RawUnmodified = 2, 15 | 16 | // PNG format. 17 | // A loss-less compression format for images. This format is well suited for images with hard edges, 18 | // such as screenshots or sprites, and images with text. Transparency is supported. 19 | // The PNG format supports images up to 2,147,483,647 pixels in either dimension, though in practice 20 | // available memory provides a more immediate limitation on maximum image size. 21 | // PNG images normally use the .png file extension and the image/png MIME type. 22 | 23 | // See also: 24 | 25 | // en.wikipedia.org/wiki/Portable_Network_Graphics, the Wikipedia page on PNG. 26 | // tools.ietf.org/rfc/rfc2083.txt, the PNG standard. 27 | Png = 3, 28 | } 29 | 30 | impl Default for ImageByteFormat { 31 | fn default() -> Self { 32 | Self::RawRgba 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/ui/enums/key_event_type.rs: -------------------------------------------------------------------------------- 1 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] 2 | pub enum KeyEventType { 3 | Down = 0, 4 | Up = 1, 5 | Repeat = 2, 6 | } 7 | 8 | impl Default for KeyEventType { 9 | fn default() -> Self { 10 | Self::Down 11 | } 12 | } -------------------------------------------------------------------------------- /src/ui/enums/mod.rs: -------------------------------------------------------------------------------- 1 | mod app_lifecycle_state; 2 | pub use self::app_lifecycle_state::*; 3 | 4 | mod blend_mode; 5 | pub use self::blend_mode::*; 6 | 7 | mod blur_style; 8 | pub use self::blur_style::*; 9 | 10 | mod box_height_style; 11 | pub use self::box_height_style::*; 12 | 13 | mod box_width_style; 14 | pub use self::box_width_style::*; 15 | 16 | mod brightness; 17 | pub use self::brightness::*; 18 | 19 | mod clip_op; 20 | pub use self::clip_op::*; 21 | 22 | mod clip; 23 | pub use self::clip::*; 24 | 25 | mod filter_quality; 26 | pub use self::filter_quality::*; 27 | 28 | mod font_style; 29 | pub use self::font_style::*; 30 | 31 | mod frame_phase; 32 | pub use self::frame_phase::*; 33 | 34 | mod image_byte_format; 35 | pub use self::image_byte_format::*; 36 | 37 | mod key_event_type; 38 | pub use self::key_event_type::*; 39 | 40 | mod painting_style; 41 | pub use self::painting_style::*; 42 | 43 | mod path_fill_type; 44 | pub use self::path_fill_type::*; 45 | 46 | mod path_operation; 47 | pub use self::path_operation::*; 48 | 49 | mod pixel_format; 50 | pub use self::pixel_format::*; 51 | 52 | mod placeholder_alignment; 53 | pub use self::placeholder_alignment::*; 54 | 55 | mod point_mode; 56 | pub use self::point_mode::*; 57 | 58 | mod pointer_change; 59 | pub use self::pointer_change::*; 60 | 61 | mod pointer_device_kind; 62 | pub use self::pointer_device_kind::*; 63 | 64 | mod pointer_signal_kind; 65 | pub use self::pointer_signal_kind::*; 66 | 67 | mod stroke_cap; 68 | pub use self::stroke_cap::*; 69 | 70 | mod stroke_join; 71 | pub use self::stroke_join::*; 72 | 73 | mod text_affinity; 74 | pub use self::text_affinity::*; 75 | 76 | mod text_align; 77 | pub use self::text_align::*; 78 | 79 | mod text_baseline; 80 | pub use self::text_baseline::*; 81 | 82 | mod text_decoration_style; 83 | pub use self::text_decoration_style::*; 84 | 85 | mod text_direction; 86 | pub use self::text_direction::*; 87 | 88 | mod text_leading_distribution; 89 | pub use self::text_leading_distribution::*; 90 | 91 | mod tile_mode; 92 | pub use self::tile_mode::*; 93 | 94 | mod vertex_mode; 95 | pub use self::vertex_mode::*; 96 | -------------------------------------------------------------------------------- /src/ui/enums/painting_style.rs: -------------------------------------------------------------------------------- 1 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] 2 | pub enum PaintingStyle { 3 | Fill = 0, 4 | Stroke = 1, 5 | } 6 | 7 | impl Default for PaintingStyle { 8 | fn default() -> Self { 9 | Self::Fill 10 | } 11 | } -------------------------------------------------------------------------------- /src/ui/enums/path_fill_type.rs: -------------------------------------------------------------------------------- 1 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] 2 | pub enum PathFillType { 3 | NonZero = 0, 4 | EvenOdd = 1, 5 | } 6 | 7 | impl Default for PathFillType { 8 | fn default() -> Self { 9 | Self::NonZero 10 | } 11 | } -------------------------------------------------------------------------------- /src/ui/enums/path_operation.rs: -------------------------------------------------------------------------------- 1 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] 2 | pub enum PathOperation { 3 | Difference = 0, 4 | Intersect = 1, 5 | ReverseDifference = 4, 6 | Union = 2, 7 | Xor = 3, 8 | } 9 | 10 | impl Default for PathOperation { 11 | fn default() -> Self { 12 | Self::Difference 13 | } 14 | } -------------------------------------------------------------------------------- /src/ui/enums/pixel_format.rs: -------------------------------------------------------------------------------- 1 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] 2 | pub enum PixelFormat { 3 | Rgba8888 = 0, 4 | Bgra8888 = 1, 5 | } 6 | 7 | impl Default for PixelFormat { 8 | fn default() -> Self { 9 | Self::Rgba8888 10 | } 11 | } -------------------------------------------------------------------------------- /src/ui/enums/placeholder_alignment.rs: -------------------------------------------------------------------------------- 1 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] 2 | pub enum PlaceholderAlignment { 3 | Baseline = 0, 4 | AboveBaseline = 1, 5 | BelowBaseline = 2, 6 | Top = 3, 7 | Bottom = 4, 8 | Middle = 5, 9 | } 10 | 11 | impl Default for PlaceholderAlignment { 12 | fn default() -> Self { 13 | Self::Baseline 14 | } 15 | } -------------------------------------------------------------------------------- /src/ui/enums/point_mode.rs: -------------------------------------------------------------------------------- 1 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] 2 | pub enum PointMode { 3 | Points = 0, 4 | Lines = 1, 5 | Polygon = 2, 6 | } 7 | 8 | impl Default for PointMode { 9 | fn default() -> Self { 10 | Self::Points 11 | } 12 | } -------------------------------------------------------------------------------- /src/ui/enums/pointer_change.rs: -------------------------------------------------------------------------------- 1 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] 2 | pub enum PointerChange { 3 | Cancel = 0, 4 | Add = 1, 5 | Remove = 2, 6 | Hover = 3, 7 | Down = 4, 8 | Move = 5, 9 | Up = 6, 10 | } 11 | 12 | impl Default for PointerChange { 13 | fn default() -> Self { 14 | Self::Cancel 15 | } 16 | } -------------------------------------------------------------------------------- /src/ui/enums/pointer_device_kind.rs: -------------------------------------------------------------------------------- 1 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] 2 | pub enum PointerDeviceKind { 3 | Touch = 0, 4 | Mouse = 1, 5 | Stylus = 2, 6 | InvertedStylus = 3, 7 | Unknown = 4, 8 | } 9 | 10 | impl Default for PointerDeviceKind { 11 | fn default() -> Self { 12 | Self::Touch 13 | } 14 | } -------------------------------------------------------------------------------- /src/ui/enums/pointer_signal_kind.rs: -------------------------------------------------------------------------------- 1 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] 2 | pub enum PointerSignalKind { 3 | None = 0, 4 | Scroll = 1, 5 | Unknown = 2, 6 | } 7 | 8 | impl Default for PointerSignalKind { 9 | fn default() -> Self { 10 | Self::None 11 | } 12 | } -------------------------------------------------------------------------------- /src/ui/enums/stroke_cap.rs: -------------------------------------------------------------------------------- 1 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] 2 | pub enum StrokeCap { 3 | Butt = 0, 4 | Round = 1, 5 | Square = 2, 6 | } 7 | 8 | impl Default for StrokeCap { 9 | fn default() -> Self { 10 | Self::Butt 11 | } 12 | } -------------------------------------------------------------------------------- /src/ui/enums/stroke_join.rs: -------------------------------------------------------------------------------- 1 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] 2 | pub enum StrokeJoin { 3 | Miter = 0, 4 | Round = 1, 5 | Bevel = 2, 6 | } 7 | 8 | impl Default for StrokeJoin { 9 | fn default() -> Self { 10 | Self::Miter 11 | } 12 | } -------------------------------------------------------------------------------- /src/ui/enums/text_affinity.rs: -------------------------------------------------------------------------------- 1 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] 2 | pub enum TextAffinity { 3 | Upstream = 0, 4 | Downstream = 1, 5 | } 6 | 7 | impl Default for TextAffinity { 8 | fn default() -> Self { 9 | Self::Upstream 10 | } 11 | } -------------------------------------------------------------------------------- /src/ui/enums/text_align.rs: -------------------------------------------------------------------------------- 1 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] 2 | pub enum TextAlign { 3 | Left = 0, 4 | Right = 1, 5 | Center = 2, 6 | Justify = 3, 7 | Start = 4, 8 | End = 5, 9 | } 10 | 11 | impl Default for TextAlign { 12 | fn default() -> Self { 13 | Self::Left 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/ui/enums/text_baseline.rs: -------------------------------------------------------------------------------- 1 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] 2 | pub enum TextBaseline { 3 | Alphabetic = 0, 4 | Ideographic = 1, 5 | } 6 | 7 | impl Default for TextBaseline { 8 | fn default() -> Self { 9 | Self::Alphabetic 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/ui/enums/text_decoration_style.rs: -------------------------------------------------------------------------------- 1 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] 2 | pub enum TextDecorationStyle { 3 | Solid = 0, 4 | Double = 1, 5 | Dotted = 2, 6 | Dashed = 3, 7 | Wavy = 4, 8 | } 9 | 10 | impl Default for TextDecorationStyle { 11 | fn default() -> Self { 12 | Self::Solid 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/ui/enums/text_direction.rs: -------------------------------------------------------------------------------- 1 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] 2 | pub enum TextDirection { 3 | Rtl = 0, 4 | Ltr = 1, 5 | } 6 | 7 | impl Default for TextDirection { 8 | fn default() -> Self { 9 | Self::Ltr 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/ui/enums/text_leading_distribution.rs: -------------------------------------------------------------------------------- 1 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] 2 | pub enum TextLeadingDistribution { 3 | Proportional = 0, 4 | Even = 1, 5 | } 6 | 7 | impl Default for TextLeadingDistribution { 8 | fn default() -> Self { 9 | Self::Proportional 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/ui/enums/tile_mode.rs: -------------------------------------------------------------------------------- 1 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] 2 | pub enum TileMode { 3 | Clamp = 0, 4 | Decal = 3, 5 | Mirror = 2, 6 | Repeated = 1, 7 | } 8 | 9 | impl Default for TileMode { 10 | fn default() -> Self { 11 | Self::Clamp 12 | } 13 | } -------------------------------------------------------------------------------- /src/ui/enums/vertex_mode.rs: -------------------------------------------------------------------------------- 1 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] 2 | pub enum VertexMode { 3 | Triangles = 0, 4 | TriangleStrip = 1, 5 | TriangleFan = 2, 6 | } 7 | 8 | impl Default for VertexMode { 9 | fn default() -> Self { 10 | Self::Triangles 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/ui/font_feature.rs: -------------------------------------------------------------------------------- 1 | pub struct FontFeature { 2 | pub feature: String, 3 | pub value: i32, // = 1 4 | } 5 | 6 | impl Default for FontFeature { 7 | fn default() -> Self { 8 | Self { 9 | feature: Default::default(), 10 | value: Default::default(), 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/ui/font_weight.rs: -------------------------------------------------------------------------------- 1 | pub struct FontWeight(pub usize); 2 | 3 | impl FontWeight { 4 | 5 | // A commonly used font weight that is heavier than normal. 6 | pub const BOLD: FontWeight = Self::W700; 7 | 8 | // The default font weight. 9 | pub const NORMAL: FontWeight = Self::W400; 10 | 11 | // A list of all the font weights. 12 | pub const VALUES: [FontWeight; 9] = [Self::W100, Self::W200, Self::W300, Self::W400, Self::W500, Self::W600, Self::W700, Self::W800, Self::W900]; 13 | 14 | // Thin, the least thick 15 | pub const W100: FontWeight = FontWeight(0); 16 | 17 | // Extra-light 18 | pub const W200: FontWeight = FontWeight(1); 19 | 20 | // Light 21 | pub const W300: FontWeight = FontWeight(2); 22 | 23 | // Normal / regular / plain 24 | pub const W400: FontWeight = FontWeight(3); 25 | 26 | // Medium 27 | pub const W500: FontWeight = FontWeight(4); 28 | 29 | // Semi-bold 30 | pub const W600: FontWeight = FontWeight(5); 31 | 32 | // Bold 33 | pub const W700: FontWeight = FontWeight(6); 34 | 35 | // Extra-bold 36 | pub const W800: FontWeight = FontWeight(7); 37 | 38 | // Black, the most thick 39 | pub const W900: FontWeight = FontWeight(8); 40 | } 41 | 42 | impl Default for FontWeight { 43 | fn default() -> Self { 44 | Self(0) 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/ui/image_filter.rs: -------------------------------------------------------------------------------- 1 | #[derive(Default, Copy, Clone)] 2 | pub struct ImageFilter; -------------------------------------------------------------------------------- /src/ui/locale.rs: -------------------------------------------------------------------------------- 1 | // toLanguageTag() → String 2 | // Returns a syntactically valid Unicode BCP47 Locale Identifier. 3 | // 4 | // toString() → String 5 | // Returns a string representing the locale. 6 | #[derive(Debug, Clone, PartialEq, Hash)] 7 | pub struct Locale { 8 | pub language_code: String, // = "und", 9 | pub script_code: String, 10 | pub country_code: String, 11 | } 12 | 13 | impl Default for Locale { 14 | fn default() -> Self { 15 | Self { 16 | language_code: Default::default(), 17 | script_code: Default::default(), 18 | country_code: Default::default(), 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/ui/mask_filter.rs: -------------------------------------------------------------------------------- 1 | #[derive(Default, Copy, Clone)] 2 | pub struct MaskFilter; -------------------------------------------------------------------------------- /src/ui/mod.rs: -------------------------------------------------------------------------------- 1 | pub use dx::ui::immediate; 2 | 3 | 4 | mod enums; 5 | pub use self::enums::*; 6 | 7 | mod canvas; 8 | pub use self::canvas::*; 9 | 10 | mod codec; 11 | pub use self::codec::*; 12 | 13 | mod color_filter; 14 | pub use self::color_filter::*; 15 | 16 | mod font_feature; 17 | pub use self::font_feature::*; 18 | 19 | mod font_weight; 20 | pub use self::font_weight::*; 21 | 22 | mod image_filter; 23 | pub use self::image_filter::*; 24 | 25 | mod locale; 26 | pub use self::locale::*; 27 | 28 | mod mask_filter; 29 | pub use self::mask_filter::*; 30 | 31 | mod offset; 32 | pub use self::offset::*; 33 | 34 | mod paint; 35 | pub use self::paint::*; 36 | 37 | mod path; 38 | pub use self::path::*; 39 | 40 | mod radius; 41 | pub use self::radius::*; 42 | 43 | mod rect; 44 | pub use self::rect::*; 45 | 46 | mod shader; 47 | pub use self::shader::*; 48 | 49 | mod shadow; 50 | pub use self::shadow::*; 51 | 52 | mod size; 53 | pub use self::size::*; 54 | 55 | mod text_position; 56 | pub use self::text_position::*; 57 | 58 | mod text_range; 59 | pub use self::text_range::*; 60 | 61 | mod void_callback; 62 | pub use self::void_callback::*; 63 | 64 | mod window_padding; 65 | pub use self::window_padding::*; -------------------------------------------------------------------------------- /src/ui/offset.rs: -------------------------------------------------------------------------------- 1 | pub struct Offset { 2 | // // The angle of this offset as radians clockwise from the positive x-axis, 3 | // // in the range -pi to pi, assuming positive values of the x-axis go to the 4 | // // right and positive values of the y-axis go down. 5 | // pub direction: f32, 6 | 7 | // // The magnitude of the offset. 8 | // pub distance: f32, 9 | 10 | // // The square of the magnitude of the offset. 11 | // pub distance_squared: f32, 12 | 13 | // The x component of the offset. 14 | pub dx: f32, 15 | 16 | // The y component of the offset. 17 | pub dy: f32, 18 | 19 | // // Whether both components are finite (neither infinite nor NaN). 20 | // pub is_finite: bool, 21 | 22 | // // Returns true if either component is double.infinity, 23 | // // and false if both are finite (or negative infinity, or NaN). 24 | // pub is_infinite: bool, 25 | } 26 | 27 | impl Offset { 28 | // Creates an offset. The first argument sets dx, the horizontal component, and the second sets dy, the vertical component. 29 | // Offset(double dx, double dy) 30 | 31 | // Creates an offset from its direction and distance. 32 | // Offset.fromDirection(double direction, [double distance = 1.0]) 33 | 34 | } 35 | 36 | impl Default for Offset { 37 | fn default() -> Self { 38 | Self { 39 | // direction: Default::default(), 40 | // distance: Default::default(), 41 | // distance_squared: Default::default(), 42 | dx: Default::default(), 43 | dy: Default::default(), 44 | // is_finite: Default::default(), 45 | // is_infinite: Default::default(), 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/ui/radius.rs: -------------------------------------------------------------------------------- 1 | #[derive(Debug, Clone, PartialEq)] 2 | pub struct Radius(pub f32, pub f32); 3 | 4 | impl Radius { 5 | pub const ZERO: Radius = Radius(0.0, 0.0); 6 | 7 | // Constructs a circular radius. x and y will have the same radius value. 8 | pub fn circular(radius: f32) -> Self { 9 | Self(radius, radius) 10 | } 11 | 12 | // Constructs an elliptical radius with the given radii. 13 | pub fn elliptical(x: f32, y: f32) -> Self { 14 | Self(x, y) 15 | } 16 | 17 | pub fn x(&self) -> f32 { 18 | self.0 19 | } 20 | 21 | pub fn y(&self) -> f32 { 22 | self.0 23 | } 24 | } 25 | 26 | impl Default for Radius { 27 | fn default() -> Self { 28 | Self(Default::default(), Default::default()) 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/ui/shader.rs: -------------------------------------------------------------------------------- 1 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] 2 | pub struct Shader { 3 | 4 | } 5 | -------------------------------------------------------------------------------- /src/ui/shadow.rs: -------------------------------------------------------------------------------- 1 | use crate::foundation::colorspace::Color; 2 | 3 | use super::{Offset, Paint}; 4 | 5 | pub struct Shadow { 6 | // The blurRadius in sigmas instead of logical pixels. 7 | pub blur_sigma: f32, 8 | // Color that the shadow will be drawn with. 9 | pub color: Color, // = const Color(_kColorDefault), 10 | // The displacement of the shadow from the casting element. 11 | pub offset: Offset, // = Offset.zero, 12 | // The standard deviation of the Gaussian to convolve with the shadow's shape. 13 | pub blur_radius: f32, // = 0.0 14 | } 15 | 16 | impl Default for Shadow { 17 | fn default() -> Self { 18 | Self { 19 | blur_sigma: Default::default(), 20 | color: Default::default(), 21 | offset: Default::default(), 22 | blur_radius: Default::default(), 23 | } 24 | } 25 | } 26 | 27 | impl Shadow { 28 | // Returns a new shadow with its offset and blurRadius scaled by the given factor. 29 | pub fn scale(factor: f32) -> Shadow { 30 | todo!() 31 | } 32 | 33 | // Create the Paint object that corresponds to this shadow description. 34 | pub fn to_paint() -> Paint { 35 | todo!() 36 | } 37 | } -------------------------------------------------------------------------------- /src/ui/size.rs: -------------------------------------------------------------------------------- 1 | // width, height 2 | 3 | #[derive(Debug, Clone, PartialEq)] 4 | pub struct Size(pub f32, pub f32); 5 | 6 | impl Size { 7 | // Creates a square Size whose width and height are twice the given dimension. 8 | pub fn from_radius(radius: f32) -> Self { 9 | Self(radius * 2.0, radius * 2.0) 10 | } 11 | 12 | // Creates a Size with the given height and an infinite width. 13 | pub fn from_height(height: f32) -> Self { 14 | Self(f32::INFINITY, height) 15 | } 16 | 17 | // Creates a Size with the given width and an infinite height. 18 | pub fn from_width(width: f32) -> Self { 19 | Self(width, f32::INFINITY) 20 | } 21 | 22 | // Creates a square Size whose width and height are the given dimension. 23 | pub fn square(dimension: f32) -> Self { 24 | Self(dimension, dimension) 25 | } 26 | } 27 | impl Default for Size { 28 | fn default() -> Self { 29 | Self(Default::default(), Default::default()) 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/ui/text_position.rs: -------------------------------------------------------------------------------- 1 | use super::TextAffinity; 2 | 3 | #[derive(Default)] 4 | pub struct TextPosition { 5 | // Disambiguates cases where the position in the string given by offset 6 | // could represent two different visual positions in the rendered text. 7 | // For example, this can happen when text is forced to wrap, or when 8 | // one string of text is rendered with multiple text directions. 9 | pub affinity: TextAffinity, 10 | 11 | // The index of the character that immediately follows the position 12 | // in the string representation of the text. 13 | pub offset: i32, 14 | } -------------------------------------------------------------------------------- /src/ui/text_range.rs: -------------------------------------------------------------------------------- 1 | 2 | #[derive(Default)] 3 | pub struct TextRange { 4 | // The next index after the characters in this range. 5 | pub end: i32, 6 | 7 | // Whether this range is empty (but still potentially placed inside the text). 8 | pub is_collapsed: bool, 9 | 10 | // Whether the start of this range precedes the end. 11 | pub is_normalized: bool, 12 | 13 | // Whether this range represents a valid position in the text. 14 | pub is_valid: bool, 15 | 16 | // The index of the first character in the range. 17 | pub start: i32, 18 | } 19 | 20 | impl TextRange { 21 | // textAfter(String text) → String 22 | // The text after this range. 23 | // textBefore(String text) → String 24 | // The text before this range. 25 | // textInside(String text) → String 26 | // The text inside this range. 27 | // toString() → String 28 | // A string representation of this object. 29 | } -------------------------------------------------------------------------------- /src/ui/void_callback.rs: -------------------------------------------------------------------------------- 1 | pub type VoidCallback = Box; 2 | -------------------------------------------------------------------------------- /src/ui/window_padding.rs: -------------------------------------------------------------------------------- 1 | pub struct WindowPadding { 2 | // The distance from the bottom edge to the first unpadded pixel, in physical pixels. 3 | pub bottom: f32, 4 | 5 | 6 | // The distance from the left edge to the first unpadded pixel, in physical pixels. 7 | pub left: f32, 8 | 9 | // The distance from the right edge to the first unpadded pixel, in physical pixels. 10 | pub right: f32, 11 | 12 | // The distance from the top edge to the first unpadded pixel, in physical pixels. 13 | pub top: f32, 14 | } 15 | 16 | impl WindowPadding { 17 | pub const ZERO: WindowPadding = WindowPadding { 18 | left: 0.0, 19 | top: 0.0, 20 | right: 0.0, 21 | bottom: 0.0 22 | }; 23 | } -------------------------------------------------------------------------------- /src/widgets/action.rs: -------------------------------------------------------------------------------- 1 | use super::Intent; 2 | 3 | /* 4 | addActionListener(ActionListenerCallback listener) -> void 5 | Register a callback to listen for changes to the state of this action. 6 | @mustCallSuper 7 | 8 | consumesKey(covariant T intent) -> bool 9 | Indicates whether this action should treat key events mapped to this action as being "handled" when it is invoked via the key event. 10 | 11 | invoke(covariant T intent) -> Object? 12 | Called when the action is to be performed. 13 | @protected 14 | 15 | isEnabled(covariant T intent) -> bool 16 | Returns true if the action is enabled and is ready to be invoked. 17 | 18 | notifyActionListeners() -> void 19 | Call all the registered listeners. 20 | @protected, @visibleForTesting 21 | 22 | removeActionListener(ActionListenerCallback listener) -> void 23 | Remove a previously registered closure from the list of closures that are notified when the object changes. 24 | */ 25 | 26 | pub struct Action(T); 27 | -------------------------------------------------------------------------------- /src/widgets/enums/mod.rs: -------------------------------------------------------------------------------- 1 | mod route_pop_disposition; 2 | pub use self::route_pop_disposition::*; 3 | 4 | mod orientation; 5 | pub use self::orientation::*; -------------------------------------------------------------------------------- /src/widgets/enums/orientation.rs: -------------------------------------------------------------------------------- 1 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] 2 | pub enum Orientation { 3 | // Taller than wide. 4 | Portrait = 0, 5 | // Wider than tall. 6 | Landscape = 1, 7 | } 8 | 9 | impl Default for Orientation { 10 | fn default() -> Self { 11 | Self::Portrait 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/widgets/enums/route_pop_disposition.rs: -------------------------------------------------------------------------------- 1 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] 2 | pub enum RoutePopDisposition { 3 | // Pop the route. 4 | // If Route.willPop returns pop then the back button will actually pop the current route. 5 | Pop = 0, 6 | // Do not pop the route. 7 | // If Route.willPop returns doNotPop then the back button will be ignored. 8 | DoNotPop = 1, 9 | // Delegate this to the next level of navigation. 10 | // If Route.willPop returns bubble then the back button will be handled by the SystemNavigator, which will usually close the application. 11 | Bubble = 2, 12 | } 13 | 14 | impl Default for RoutePopDisposition { 15 | fn default() -> Self { 16 | Self::Pop 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/widgets/focus_node.rs: -------------------------------------------------------------------------------- 1 | pub struct FocusNode { 2 | pub debug_label: String, 3 | // pub on_key: FocusOnKeyCallback, // TODO: 4 | // pub on_key_event: FocusOnKeyEventCallback, // TODO: 5 | pub skip_traversal: bool, // = false, 6 | pub can_request_focus: bool, // = true, 7 | pub descendants_are_focusable: bool, // = true 8 | } 9 | 10 | impl Default for FocusNode { 11 | fn default() -> Self { 12 | Self { 13 | debug_label: Default::default(), 14 | // on_key: Default::default(), 15 | // on_key_event: Default::default(), 16 | skip_traversal: Default::default(), 17 | can_request_focus: Default::default(), 18 | descendants_are_focusable: Default::default(), 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/widgets/generate_app_title.rs: -------------------------------------------------------------------------------- 1 | use super::BuildContext; 2 | 3 | pub trait GenerateAppTitle { 4 | fn on_generate_title(&self, context: BuildContext) -> String; 5 | } 6 | -------------------------------------------------------------------------------- /src/widgets/global_key.rs: -------------------------------------------------------------------------------- 1 | // use super::{State, StatefulWidget}; 2 | 3 | // TODO: String generic should be fixed 4 | // pub struct GlobalKey>(T); 5 | 6 | pub struct GlobalKey(T); 7 | 8 | impl Default for GlobalKey { 9 | fn default() -> Self { 10 | Self(Default::default()) 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/widgets/icon_data.rs: -------------------------------------------------------------------------------- 1 | /// A description of an icon fulfilled by a font glyph. 2 | /// 3 | /// See Icons for a number of predefined icons available for material design applications. 4 | /// 5 | /// Originally it contain additional fields like a fontFamily, fontPackage and matchTextDirection. 6 | /// We do not use them becouse we use different rendering model 7 | /// 8 | /// Inner is the Unicode code point at which this icon is stored in the icon font. 9 | 10 | #[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash)] 11 | pub struct IconData(pub i32); 12 | 13 | impl IconData { 14 | pub fn code(&self) -> i32 { 15 | self.0 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/widgets/icon_theme_data.rs: -------------------------------------------------------------------------------- 1 | use crate::foundation::colorspace::Color; 2 | 3 | // merge(IconThemeData? other) -> IconThemeData 4 | // Returns a new icon theme that matches this icon theme but with some values replaced by the non-null parameters of the given icon theme. If the given icon theme is null, simply returns this icon theme. 5 | // 6 | // resolve(BuildContext context) -> IconThemeData 7 | // Called by IconTheme.of to convert this instance to an IconThemeData that fits the given BuildContext. 8 | 9 | pub struct IconThemeData { 10 | color: Color, 11 | opacity: f32, 12 | size: f32, 13 | } 14 | 15 | impl Default for IconThemeData { 16 | fn default() -> Self { 17 | Self { 18 | color: Default::default(), 19 | opacity: Default::default(), 20 | size: Default::default(), 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/widgets/initial_route_list_factory.rs: -------------------------------------------------------------------------------- 1 | use super::Route; 2 | 3 | pub trait InitialRouteListFactory { 4 | // TODO: String generic should be fixed 5 | fn on_generate_initial_routes(&self, initial_route: String) -> Vec>; 6 | } 7 | -------------------------------------------------------------------------------- /src/widgets/intent.rs: -------------------------------------------------------------------------------- 1 | pub trait Intent {} 2 | -------------------------------------------------------------------------------- /src/widgets/locale_list_resolution_callback.rs: -------------------------------------------------------------------------------- 1 | use crate::ui::Locale; 2 | 3 | pub trait LocaleListResolutionCallback { 4 | fn resolve( 5 | &self, 6 | locales: Option>, 7 | supported_locales: Vec, 8 | ) -> Option; 9 | } 10 | -------------------------------------------------------------------------------- /src/widgets/locale_resolution_callback.rs: -------------------------------------------------------------------------------- 1 | use crate::ui::Locale; 2 | 3 | pub trait LocaleResolutionCallback { 4 | fn resolve(&self, locale: Option, supported_locales: Vec) -> Option; 5 | } 6 | -------------------------------------------------------------------------------- /src/widgets/media_query_data.rs: -------------------------------------------------------------------------------- 1 | #[derive(Default)] 2 | pub struct MediaQueryData { 3 | 4 | } -------------------------------------------------------------------------------- /src/widgets/navigator_observer.rs: -------------------------------------------------------------------------------- 1 | // didPop(Route route, Route? previousRoute) -> void 2 | // The Navigator popped route. 3 | // 4 | // didPush(Route route, Route? previousRoute) -> void 5 | // The Navigator pushed route. 6 | // 7 | // didRemove(Route route, Route? previousRoute) -> void 8 | // The Navigator removed route. 9 | // 10 | // didReplace({Route? newRoute, Route? oldRoute}) -> void 11 | // The Navigator replaced oldRoute with newRoute. 12 | // 13 | // didStartUserGesture(Route route, Route? previousRoute) -> void 14 | // The Navigator's routes are being moved by a user gesture. 15 | // 16 | // didStopUserGesture() -> void 17 | // User gesture is no longer controlling the Navigator. 18 | 19 | pub struct NavigatorObserver(); 20 | -------------------------------------------------------------------------------- /src/widgets/page.rs: -------------------------------------------------------------------------------- 1 | use crate::foundation::LocalKey; 2 | 3 | // canUpdate(Page other) -> bool 4 | // Whether this page can be updated with the other page. 5 | // 6 | // createRoute(BuildContext context) -> Route 7 | // Creates the Route that corresponds to this page. 8 | 9 | pub struct Page { 10 | key: LocalKey, 11 | name: String, 12 | arguments: String, // TODO: String generic should be fixed 13 | restoration_id: String, 14 | } 15 | -------------------------------------------------------------------------------- /src/widgets/pop_page_callback.rs: -------------------------------------------------------------------------------- 1 | use super::Route; 2 | 3 | pub trait PopPageCallback { 4 | fn on_pop_page(&self, route: Box, result: T) -> bool; 5 | } 6 | -------------------------------------------------------------------------------- /src/widgets/preferred_size_widget.rs: -------------------------------------------------------------------------------- 1 | use crate::{ui::Size, widgets::Widget}; 2 | 3 | pub trait PreferredSizeWidget: Widget { 4 | fn preferred_size(&self) -> Size; 5 | } 6 | -------------------------------------------------------------------------------- /src/widgets/route_factory.rs: -------------------------------------------------------------------------------- 1 | use super::{Route, RouteSettings}; 2 | 3 | pub trait RouteFactory { 4 | fn on_generate_route(&self, settings: RouteSettings) -> Option>; 5 | } 6 | -------------------------------------------------------------------------------- /src/widgets/route_list_factory.rs: -------------------------------------------------------------------------------- 1 | use super::{NavigatorState, Route}; 2 | 3 | pub trait RouteListFactory { 4 | fn on_generate_initial_routes( 5 | &self, 6 | navigator: NavigatorState, 7 | initial_route: String, 8 | ) -> Vec>; 9 | } 10 | -------------------------------------------------------------------------------- /src/widgets/route_settings.rs: -------------------------------------------------------------------------------- 1 | // copyWith({String? name, Object? arguments}) → RouteSettings 2 | // Creates a copy of this route settings object with the given fields replaced with the new values. 3 | // 4 | // toString() -> String 5 | // A string representation of this object. 6 | 7 | pub struct RouteSettings { 8 | name: String, 9 | arguments: Option, 10 | } 11 | -------------------------------------------------------------------------------- /src/widgets/scroll_behavior.rs: -------------------------------------------------------------------------------- 1 | /* 2 | buildOverscrollIndicator(BuildContext context, Widget child, ScrollableDetails details) -> Widget 3 | Applies a GlowingOverscrollIndicator to the child widget on TargetPlatform.android and TargetPlatform.fuchsia. 4 | 5 | buildScrollbar(BuildContext context, Widget child, ScrollableDetails details) -> Widget 6 | Applies a RawScrollbar to the child widget on desktop platforms. 7 | 8 | buildViewportChrome(BuildContext context, Widget child, AxisDirection axisDirection) -> Widget 9 | Wraps the given widget, which scrolls in the given AxisDirection. 10 | 11 | @Deprecated("Migrate to buildOverscrollIndicator. " "This feature was deprecated after v2.1.0-11.0.pre.") 12 | copyWith({bool scrollbars = true, bool overscroll = true, Set? dragDevices, ScrollPhysics? physics, TargetPlatform? platform}) -> ScrollBehavior 13 | Creates a copy of this ScrollBehavior, making it possible to easily toggle scrollbar and overscrollIndicator effects. 14 | 15 | getPlatform(BuildContext context) -> TargetPlatform 16 | The platform whose scroll physics should be implemented. 17 | 18 | getScrollPhysics(BuildContext context) -> ScrollPhysics 19 | The scroll physics to use for the platform given by getPlatform. 20 | 21 | shouldNotify(covariant ScrollBehavior oldDelegate) -> bool 22 | Called whenever a ScrollConfiguration is rebuilt with a new ScrollBehavior of the same runtimeType. 23 | 24 | toString() -> String 25 | A string representation of this object. 26 | override 27 | 28 | velocityTrackerBuilder(BuildContext context) -> GestureVelocityTrackerBuilder 29 | Specifies the type of velocity tracker to use in the descendant Scrollables drag gesture recognizers, for estimating the velocity of a drag gesture. 30 | */ 31 | pub struct ScrollBehavior; 32 | 33 | impl Default for ScrollBehavior { 34 | fn default() -> Self { 35 | Self {} 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/widgets/shortcut_activator.rs: -------------------------------------------------------------------------------- 1 | // accepts(RawKeyEvent event, RawKeyboard state) -> bool 2 | // Whether the triggering event and the keyboard state at the time of the event meet required conditions, providing that the event is a triggering event. 3 | // 4 | // debugDescribeKeys() -> String 5 | // Returns a description of the key set that is short and readable. 6 | 7 | pub struct ShortcutActivator; 8 | -------------------------------------------------------------------------------- /src/widgets/sliver_child_delegate.rs: -------------------------------------------------------------------------------- 1 | use crate::foundation::Key; 2 | 3 | use super::{BuildContext, Widget}; 4 | 5 | pub trait SliverChildDelegate { 6 | // Returns an estimate of the number of children this delegate will build. [...] 7 | // estimatedChildCount → int? 8 | 9 | // Returns the child with the given index. [...] 10 | fn build(&self, context: Option, index: usize) -> Option> { 11 | todo!() 12 | } 13 | 14 | // Called at the end of layout to indicate that layout is now complete. [...] 15 | fn did_finish_layout(&self, first_index: usize, last_index: usize) {} 16 | 17 | // Returns an estimate of the max scroll extent for all the children. [...] 18 | fn estimate_max_scroll_offset( 19 | &self, 20 | first_index: usize, 21 | last_index: usize, 22 | leading_scroll_offset: f32, 23 | trailing_scroll_offset: f32, 24 | ) -> Option { 25 | None 26 | } 27 | 28 | // Find index of child element with associated key. [...] 29 | fn find_index_by_key(&self, key: Key) -> Option { 30 | None 31 | } 32 | 33 | // Called whenever a new instance of the child delegate class is provided to the sliver. [...] 34 | fn should_rebuild(&self, old_delegate: Box) -> bool { 35 | false 36 | } 37 | } 38 | 39 | pub struct NoneSliverChildDelegate; 40 | 41 | impl SliverChildDelegate for NoneSliverChildDelegate {} 42 | -------------------------------------------------------------------------------- /src/widgets/state.rs: -------------------------------------------------------------------------------- 1 | use crate::widgets::Widget; 2 | 3 | use super::{BuildContext, StatefulWidget}; 4 | 5 | // activate() -> void 6 | // Called when this object is reinserted into the tree after having been removed via deactivate. 7 | // @mustCallSuper, @protected 8 | // 9 | // build(BuildContext context) -> Widget 10 | // Describes the part of the user interface represented by this widget. 11 | // @protected 12 | // 13 | // deactivate() -> void 14 | // Called when this object is removed from the tree. 15 | // @mustCallSuper, @protected 16 | // 17 | // debugFillProperties(DiagnosticPropertiesBuilder properties) -> void 18 | // Add additional properties associated with the node. 19 | // override 20 | // 21 | // didChangeDependencies() -> void 22 | // Called when a dependency of this State object changes. 23 | // @mustCallSuper, @protected 24 | // 25 | // didUpdateWidget(covariant T oldWidget) -> void 26 | // Called whenever the widget configuration changes. 27 | // @mustCallSuper, @protected 28 | // 29 | // dispose() -> void 30 | // Called when this object is removed from the tree permanently. 31 | // @mustCallSuper, @protected 32 | // 33 | // initState() -> void 34 | // Called when this object is inserted into the tree. 35 | // 36 | // reassemble() -> void 37 | // Called whenever the application is reassembled during debugging, for example during hot reload. 38 | // @mustCallSuper, @protected 39 | // 40 | // setState(VoidCallback fn) -> void 41 | // Notify the framework that the internal state of this object has changed. 42 | 43 | // pub struct State(T); 44 | 45 | pub trait State { 46 | fn build(&self, context: Option) -> &dyn Widget; 47 | } 48 | -------------------------------------------------------------------------------- /src/widgets/stateful_widget.rs: -------------------------------------------------------------------------------- 1 | use super::State; 2 | 3 | // createElement() → StatefulElement 4 | // Creates a StatefulElement to manage this widget's location in the tree. 5 | // override 6 | // 7 | // createState() → State 8 | // Creates the mutable state for this widget at a given location in the tree. 9 | // @factory, @protected 10 | 11 | pub trait StatefulWidget { 12 | type Out; 13 | 14 | fn create_state(&self) -> Box>; 15 | } 16 | -------------------------------------------------------------------------------- /src/widgets/text_editing_controller.rs: -------------------------------------------------------------------------------- 1 | use crate::services::{TextEditingValue, TextSelection}; 2 | 3 | #[derive(Default)] 4 | pub struct TextEditingController { 5 | // Whether any listeners are currently registered. 6 | pub has_listeners: bool, 7 | 8 | // The currently selected text. 9 | pub selection: TextSelection, 10 | 11 | // The current string the user is editing. 12 | pub text: String, 13 | 14 | // The current value stored in this notifier. 15 | pub value: TextEditingValue, 16 | } 17 | 18 | impl TextEditingController { 19 | // addListener(VoidCallback listener) → void 20 | // Register a closure to be called when the object changes. 21 | // inherited 22 | // buildTextSpan({required BuildContext context, TextStyle? style, required bool withComposing}) → TextSpan 23 | // Builds TextSpan from current editing value. 24 | // clear() → void 25 | // Set the value to empty. 26 | // clearComposing() → void 27 | // Set the composing region to an empty range. 28 | // dispose() → void 29 | // Discards any resources used by the object. After this is called, the object is not in a usable state and should be discarded (calls to addListener and removeListener will throw after the object is disposed). 30 | // @mustCallSuper, inherited 31 | // isSelectionWithinTextBounds(TextSelection selection) → bool 32 | // Check that the selection is inside of the bounds of text. 33 | // noSuchMethod(Invocation invocation) → dynamic 34 | // Invoked when a non-existent method or property is accessed. 35 | // inherited 36 | // notifyListeners() → void 37 | // Call all the registered listeners. 38 | // @protected, @visibleForTesting, inherited 39 | // removeListener(VoidCallback listener) → void 40 | // Remove a previously registered closure from the list of closures that are notified when the object changes. 41 | // inherited 42 | } 43 | -------------------------------------------------------------------------------- /src/widgets/transition_builder.rs: -------------------------------------------------------------------------------- 1 | use crate::widgets::Widget; 2 | 3 | use super::BuildContext; 4 | 5 | pub trait TransitionBuilder { 6 | fn build(&self, context: BuildContext, child: Option<&dyn Widget>) -> Box; 7 | } 8 | -------------------------------------------------------------------------------- /src/widgets/transition_delegate.rs: -------------------------------------------------------------------------------- 1 | // resolve({required List newPageRouteHistory, required Map locationToExitingPageRoute, required Map> pageRouteToPagelessRoutes}) -> Vec 2 | 3 | pub struct TransitionDelegate; 4 | -------------------------------------------------------------------------------- /src/widgets/widget_builder.rs: -------------------------------------------------------------------------------- 1 | use crate::widgets::Widget; 2 | 3 | use super::BuildContext; 4 | 5 | // Box) -> Box> 6 | 7 | pub type WidgetBuilder = Box Box>; 8 | 9 | // pub trait WidgetBuilder { 10 | // fn build(&self, context: Option) -> &dyn Widget; 11 | // } 12 | 13 | // #[derive(Default)] 14 | // pub struct NullWidgetBuilder; 15 | 16 | // impl WidgetBuilder for NullWidgetBuilder { 17 | // fn build(&self, context: Option) -> &dyn Widget { 18 | // todo!() 19 | // } 20 | // } --------------------------------------------------------------------------------