diff --git a/notes/flutter_web/lib/app.dart b/notes/flutter_web/lib/app.dart index ac1a4e4d..d80ea554 100644 --- a/notes/flutter_web/lib/app.dart +++ b/notes/flutter_web/lib/app.dart @@ -5,12 +5,13 @@ import 'package:you_flutter/router.dart'; import 'package:you_note_dart/note.dart'; import 'package:shared_preferences/shared_preferences.dart'; +final routes=Routes(); + final YouRouter router = YouRouter( - root: root, - initial: routes.notes_widgets_specific_widgets_button_overview.toUri(), + root: routes.root, + initial: routes.routes_root.toUri(), navigatorKey: GlobalKey(debugLabel: "mainNavigator"), ); - class App extends StatelessWidget { final NoteSystem noteSystem; final SharedPreferences sharedPreferences; diff --git a/notes/flutter_web/lib/routes.g.dart b/notes/flutter_web/lib/routes.g.dart index 59670cfc..73a75eea 100644 --- a/notes/flutter_web/lib/routes.g.dart +++ b/notes/flutter_web/lib/routes.g.dart @@ -6,224 +6,227 @@ // ignore_for_file: library_prefixes // ignore_for_file: non_constant_identifier_names -import 'package:you_note_dart/note.dart'; +// ignore_for_file: no_leading_underscores_for_library_prefixes import 'package:you_flutter/router.dart'; -import 'package:flutter_web/routes/notes/page.dart' as notes_; -import 'package:flutter_web/routes/notes/research/parameterized/page.dart' as notes_research_parameterized_; -import 'package:flutter_web/routes/notes/research/remote_view/page.dart' as notes_research_remote_view_; -import 'package:flutter_web/routes/notes/env_info/page.dart' as notes_env_info_; -import 'package:flutter_web/routes/notes/layout/page.dart' as notes_layout_; -import 'package:flutter_web/routes/notes/layout/old/layout/page.dart' as notes_layout_old_layout_; -import 'package:flutter_web/routes/notes/layout/box_layout/constraints/page.dart' as notes_layout_box_layout_constraints_; -import 'package:flutter_web/routes/notes/layout/responsive_design/page.dart' as notes_layout_responsive_design_; -import 'package:flutter_web/routes/notes/navigation/page.dart' as notes_navigation_; -import 'package:flutter_web/routes/notes/state/page.dart' as notes_state_; -import 'package:flutter_web/routes/notes/state/1.vanilla_state/page.dart' as notes_state_vanilla_state_; -import 'package:flutter_web/routes/notes/state/StatefulBuilder/page.dart' as notes_state_StatefulBuilder_; -import 'package:flutter_web/routes/notes/media&assets&file/file_desktop/page.dart' as notes_media_assets_file_file_desktop_; -import 'package:flutter_web/routes/notes/media&assets&file/file_web/page.dart' as notes_media_assets_file_file_web_; -import 'package:flutter_web/routes/notes/media&assets&file/assets/page.dart' as notes_media_assets_file_assets_; -import 'package:flutter_web/routes/notes/style&theming/material3/page.dart' as notes_style_theming_material3_; -import 'package:flutter_web/routes/notes/pure_dart/dart3/page.dart' as notes_pure_dart_dart3_; -import 'package:flutter_web/routes/notes/pure_dart/async/page.dart' as notes_pure_dart_async_; -import 'package:flutter_web/routes/notes/pure_dart/safe_interface/page.dart' as notes_pure_dart_safe_interface_; -import 'package:flutter_web/routes/notes/pure_dart/execption/page.dart' as notes_pure_dart_execption_; -import 'package:flutter_web/routes/notes/pure_dart/serialization_json/page.dart' as notes_pure_dart_serialization_json_; -import 'package:flutter_web/routes/notes/pure_dart/analyzer/page.dart' as notes_pure_dart_analyzer_; -import 'package:flutter_web/routes/notes/dev/host_mirror/page.dart' as notes_dev_host_mirror_; -import 'package:flutter_web/routes/notes/dev/macos_config/page.dart' as notes_dev_macos_config_; -import 'package:flutter_web/routes/notes/dev/devtool/page.dart' as notes_dev_devtool_; -import 'package:flutter_web/routes/notes/dev/devtool/vmservice/page.dart' as notes_dev_devtool_vmservice_; -import 'package:flutter_web/routes/notes/dev/debug/page.dart' as notes_dev_debug_; -import 'package:flutter_web/routes/notes/i18n/page.dart' as notes_i18n_; -import 'package:flutter_web/routes/notes/thinking_in_ui/readable_html_vs_dart/page.dart' as notes_thinking_in_ui_readable_html_vs_dart_; -import 'package:flutter_web/routes/notes/x.note_inside/how_note_work/page.dart' as notes_x_note_inside_how_note_work_; -import 'package:flutter_web/routes/notes/x.note_inside/mockup_content/page.dart' as notes_x_note_inside_mockup_content_; -import 'package:flutter_web/routes/notes/x.note_inside/1.welcome/page.dart' as notes_x_note_inside_welcome_; -import 'package:flutter_web/routes/notes/x.note_inside/note_test_self/page.dart' as notes_x_note_inside_note_test_self_; -import 'package:flutter_web/routes/notes/x.note_inside/note_test_self/nobody/page.dart' as notes_x_note_inside_note_test_self_nobody_; -import 'package:flutter_web/routes/notes/widgets/specific_widgets/input/page.dart' as notes_widgets_specific_widgets_input_; -import 'package:flutter_web/routes/notes/widgets/specific_widgets/webview/page.dart' as notes_widgets_specific_widgets_webview_; -import 'package:flutter_web/routes/notes/widgets/specific_widgets/slider/page.dart' as notes_widgets_specific_widgets_slider_; -import 'package:flutter_web/routes/notes/widgets/specific_widgets/selectable/page.dart' as notes_widgets_specific_widgets_selectable_; -import 'package:flutter_web/routes/notes/widgets/specific_widgets/button/ButtonStyleButton/page.dart' as notes_widgets_specific_widgets_button_ButtonStyleButton_; -import 'package:flutter_web/routes/notes/widgets/specific_widgets/button/FloatingActionButton/page.dart' as notes_widgets_specific_widgets_button_FloatingActionButton_; -import 'package:flutter_web/routes/notes/widgets/specific_widgets/button/IconButton/page.dart' as notes_widgets_specific_widgets_button_IconButton_; -import 'package:flutter_web/routes/notes/widgets/specific_widgets/button/overview/page.dart' as notes_widgets_specific_widgets_button_overview_; -import 'package:flutter_web/routes/notes/widgets/specific_widgets/text/RichText/page.dart' as notes_widgets_specific_widgets_text_RichText_; -import 'package:flutter_web/routes/notes/widgets/specific_widgets/text/Text/page.dart' as notes_widgets_specific_widgets_text_Text_; -import 'package:flutter_web/routes/notes/widgets/specific_widgets/icon/page.dart' as notes_widgets_specific_widgets_icon_; -import 'package:flutter_web/routes/notes/widgets/container_widgets/menu/page.dart' as notes_widgets_container_widgets_menu_; -import 'package:flutter_web/routes/notes/widgets/container_widgets/scrollable/Dismissible/page.dart' as notes_widgets_container_widgets_scrollable_Dismissible_; -import 'package:flutter_web/routes/notes/widgets/container_widgets/bar/page.dart' as notes_widgets_container_widgets_bar_; -import 'package:flutter_web/routes/notes/Improve_app/page.dart' as notes_Improve_app_; -import 'package:flutter_web/routes/notes/Improve_app/1.overview/page.dart' as notes_Improve_app_overview_; -import 'package:flutter_web/routes/notes/Improve_app/web_optimization/page.dart' as notes_Improve_app_web_optimization_; -import 'package:flutter_web/routes/notes/Improve_app/RepaintBoundary/page.dart' as notes_Improve_app_RepaintBoundary_; -import 'package:flutter_web/routes/notes/Improve_app/event&listener&lifeycle/page.dart' as notes_Improve_app_event_listener_lifeycle_; -import 'package:flutter_web/routes/notes/layout.dart' as notes__; +import 'package:flutter_web/routes/page.dart'; +import 'package:flutter_web/routes/layout.dart'; +import 'package:you_note_dart/note.dart'; +import 'package:flutter_web/routes/notes/page.dart' as _notes_page; +import 'package:flutter_web/routes/notes/layout.dart' as _notes_layout; +import 'package:flutter_web/routes/notes/research/parameterized/page.dart' as _parameterized_page; +import 'package:flutter_web/routes/notes/research/remote_view/page.dart' as _remote_view_page; +import 'package:flutter_web/routes/notes/env_info/page.dart' as _env_info_page; +import 'package:flutter_web/routes/notes/layout/page.dart' as _layout_page; +import 'package:flutter_web/routes/notes/layout/old/layout/page.dart' as _layout_page2; +import 'package:flutter_web/routes/notes/layout/box_layout/constraints/page.dart' as _constraints_page; +import 'package:flutter_web/routes/notes/layout/responsive_design/page.dart' as _responsive_design_page; +import 'package:flutter_web/routes/notes/navigation/page.dart' as _navigation_page; +import 'package:flutter_web/routes/notes/state/page.dart' as _state_page; +import 'package:flutter_web/routes/notes/state/1.vanilla_state/page.dart' as _1_vanilla_state_page; +import 'package:flutter_web/routes/notes/state/StatefulBuilder/page.dart' as _StatefulBuilder_page; +import 'package:flutter_web/routes/notes/media&assets&file/file_desktop/page.dart' as _file_desktop_page; +import 'package:flutter_web/routes/notes/media&assets&file/file_web/page.dart' as _file_web_page; +import 'package:flutter_web/routes/notes/media&assets&file/assets/page.dart' as _assets_page; +import 'package:flutter_web/routes/notes/style&theming/material3/page.dart' as _material3_page; +import 'package:flutter_web/routes/notes/pure_dart/dart3/page.dart' as _dart3_page; +import 'package:flutter_web/routes/notes/pure_dart/async/page.dart' as _async_page; +import 'package:flutter_web/routes/notes/pure_dart/safe_interface/page.dart' as _safe_interface_page; +import 'package:flutter_web/routes/notes/pure_dart/execption/page.dart' as _execption_page; +import 'package:flutter_web/routes/notes/pure_dart/serialization_json/page.dart' as _serialization_json_page; +import 'package:flutter_web/routes/notes/pure_dart/analyzer/page.dart' as _analyzer_page; +import 'package:flutter_web/routes/notes/dev/host_mirror/page.dart' as _host_mirror_page; +import 'package:flutter_web/routes/notes/dev/macos_config/page.dart' as _macos_config_page; +import 'package:flutter_web/routes/notes/dev/devtool/page.dart' as _devtool_page; +import 'package:flutter_web/routes/notes/dev/devtool/vmservice/page.dart' as _vmservice_page; +import 'package:flutter_web/routes/notes/dev/debug/page.dart' as _debug_page; +import 'package:flutter_web/routes/notes/i18n/page.dart' as _i18n_page; +import 'package:flutter_web/routes/notes/thinking_in_ui/readable_html_vs_dart/page.dart' as _readable_html_vs_dart_page; +import 'package:flutter_web/routes/notes/x.note_inside/how_note_work/page.dart' as _how_note_work_page; +import 'package:flutter_web/routes/notes/x.note_inside/mockup_content/page.dart' as _mockup_content_page; +import 'package:flutter_web/routes/notes/x.note_inside/1.welcome/page.dart' as _1_welcome_page; +import 'package:flutter_web/routes/notes/x.note_inside/note_test_self/page.dart' as _note_test_self_page; +import 'package:flutter_web/routes/notes/x.note_inside/note_test_self/nobody/page.dart' as _nobody_page; +import 'package:flutter_web/routes/notes/widgets/specific_widgets/input/page.dart' as _input_page; +import 'package:flutter_web/routes/notes/widgets/specific_widgets/webview/page.dart' as _webview_page; +import 'package:flutter_web/routes/notes/widgets/specific_widgets/slider/page.dart' as _slider_page; +import 'package:flutter_web/routes/notes/widgets/specific_widgets/selectable/page.dart' as _selectable_page; +import 'package:flutter_web/routes/notes/widgets/specific_widgets/button/ButtonStyleButton/page.dart' as _ButtonStyleButton_page; +import 'package:flutter_web/routes/notes/widgets/specific_widgets/button/FloatingActionButton/page.dart' as _FloatingActionButton_page; +import 'package:flutter_web/routes/notes/widgets/specific_widgets/button/IconButton/page.dart' as _IconButton_page; +import 'package:flutter_web/routes/notes/widgets/specific_widgets/button/overview/page.dart' as _overview_page; +import 'package:flutter_web/routes/notes/widgets/specific_widgets/text/RichText/page.dart' as _RichText_page; +import 'package:flutter_web/routes/notes/widgets/specific_widgets/text/Text/page.dart' as _Text_page; +import 'package:flutter_web/routes/notes/widgets/specific_widgets/icon/page.dart' as _icon_page; +import 'package:flutter_web/routes/notes/widgets/container_widgets/menu/page.dart' as _menu_page; +import 'package:flutter_web/routes/notes/widgets/container_widgets/scrollable/Dismissible/page.dart' as _Dismissible_page; +import 'package:flutter_web/routes/notes/widgets/container_widgets/bar/page.dart' as _bar_page; +import 'package:flutter_web/routes/notes/Improve_app/page.dart' as _Improve_app_page; +import 'package:flutter_web/routes/notes/Improve_app/1.overview/page.dart' as _1_overview_page; +import 'package:flutter_web/routes/notes/Improve_app/web_optimization/page.dart' as _web_optimization_page; +import 'package:flutter_web/routes/notes/Improve_app/RepaintBoundary/page.dart' as _RepaintBoundary_page; +import 'package:flutter_web/routes/notes/Improve_app/event&listener&lifeycle/page.dart' as _event_listener_lifeycle_page; -var root = To("routes", children: [ - ToNote("notes", layout: notes__.layout, builder: notes_.build, children: [ - ToNote("research", children: [ - ToNote("bash_note"), - ToNote("parameterized", builder: notes_research_parameterized_.build), - ToNote("remote_view", builder: notes_research_remote_view_.build), - ]), - ToNote("env_info", builder: notes_env_info_.build), - ToNote("layout", builder: notes_layout_.build, children: [ - ToNote("old", children: [ - ToNote("layout", builder: notes_layout_old_layout_.build), +mixin RoutesMixin { + final To root = To('routes', builder: build, layout: layout, children: [ + ToNote('notes', builder: _notes_page.build, layout: _notes_layout.layout, children: [ + ToNote('research', children: [ + ToNote('bash_note'), + ToNote('parameterized', builder: _parameterized_page.build), + ToNote('remote_view', builder: _remote_view_page.build), ]), - ToNote("box_layout", children: [ - ToNote("constraints", builder: notes_layout_box_layout_constraints_.build), + ToNote('env_info', builder: _env_info_page.build), + ToNote('layout', builder: _layout_page.build, children: [ + ToNote('old', children: [ + ToNote('layout', builder: _layout_page2.build), + ]), + ToNote('box_layout', children: [ + ToNote('constraints', builder: _constraints_page.build), + ]), + ToNote('responsive_design', builder: _responsive_design_page.build), + ToNote('1.welcome'), ]), - ToNote("responsive_design", builder: notes_layout_responsive_design_.build), - ToNote("1.welcome"), - ]), - ToNote("navigation", builder: notes_navigation_.build, children: [ - ToNote("navigator_v1"), - ToNote("navigator_v2"), - ]), - ToNote("state", builder: notes_state_.build, children: [ - ToNote("1.vanilla_state", builder: notes_state_vanilla_state_.build), - ToNote("StatefulBuilder", builder: notes_state_StatefulBuilder_.build), - ]), - ToNote("media&assets&file", children: [ - ToNote("file_desktop", builder: notes_media_assets_file_file_desktop_.build), - ToNote("file_web", builder: notes_media_assets_file_file_web_.build), - ToNote("assets", builder: notes_media_assets_file_assets_.build), - ]), - ToNote("style&theming", children: [ - ToNote("material3", builder: notes_style_theming_material3_.build), - ToNote("Material"), - ]), - ToNote("pure_dart", children: [ - ToNote("dart3", builder: notes_pure_dart_dart3_.build), - ToNote("async", builder: notes_pure_dart_async_.build), - ToNote("safe_interface", builder: notes_pure_dart_safe_interface_.build), - ToNote("execption", builder: notes_pure_dart_execption_.build), - ToNote("serialization_json", builder: notes_pure_dart_serialization_json_.build), - ToNote("analyzer", builder: notes_pure_dart_analyzer_.build), - ]), - ToNote("dev", children: [ - ToNote("host_mirror", builder: notes_dev_host_mirror_.build), - ToNote("macos_config", builder: notes_dev_macos_config_.build), - ToNote("devtool", builder: notes_dev_devtool_.build, children: [ - ToNote("vmservice", builder: notes_dev_devtool_vmservice_.build), + ToNote('navigation', builder: _navigation_page.build, children: [ + ToNote('navigator_v1'), + ToNote('navigator_v2'), ]), - ToNote("debug", builder: notes_dev_debug_.build), - ]), - ToNote("i18n", builder: notes_i18n_.build), - ToNote("thinking_in_ui", children: [ - ToNote("readable_html_vs_dart", builder: notes_thinking_in_ui_readable_html_vs_dart_.build), - ]), - ToNote("x.note_inside", children: [ - ToNote("how_note_work", builder: notes_x_note_inside_how_note_work_.build), - ToNote("note_api_thinking"), - ToNote("mockup_content", builder: notes_x_note_inside_mockup_content_.build), - ToNote("1.welcome", builder: notes_x_note_inside_welcome_.build), - ToNote("note_test_self", builder: notes_x_note_inside_note_test_self_.build, children: [ - ToNote("nobody", builder: notes_x_note_inside_note_test_self_nobody_.build), + ToNote('state', builder: _state_page.build, children: [ + ToNote('1.vanilla_state', builder: _1_vanilla_state_page.build), + ToNote('StatefulBuilder', builder: _StatefulBuilder_page.build), ]), - ]), - ToNote("widgets", children: [ - ToNote("specific_widgets", children: [ - ToNote("input", builder: notes_widgets_specific_widgets_input_.build), - ToNote("webview", builder: notes_widgets_specific_widgets_webview_.build), - ToNote("slider", builder: notes_widgets_specific_widgets_slider_.build), - ToNote("selectable", builder: notes_widgets_specific_widgets_selectable_.build), - ToNote("button", children: [ - ToNote("ButtonStyleButton", builder: notes_widgets_specific_widgets_button_ButtonStyleButton_.build), - ToNote("FloatingActionButton", builder: notes_widgets_specific_widgets_button_FloatingActionButton_.build), - ToNote("IconButton", builder: notes_widgets_specific_widgets_button_IconButton_.build), - ToNote("overview", builder: notes_widgets_specific_widgets_button_overview_.build), + ToNote('media&assets&file', children: [ + ToNote('file_desktop', builder: _file_desktop_page.build), + ToNote('file_web', builder: _file_web_page.build), + ToNote('assets', builder: _assets_page.build), + ]), + ToNote('style&theming', children: [ + ToNote('material3', builder: _material3_page.build), + ToNote('Material'), + ]), + ToNote('pure_dart', children: [ + ToNote('dart3', builder: _dart3_page.build), + ToNote('async', builder: _async_page.build), + ToNote('safe_interface', builder: _safe_interface_page.build), + ToNote('execption', builder: _execption_page.build), + ToNote('serialization_json', builder: _serialization_json_page.build), + ToNote('analyzer', builder: _analyzer_page.build), + ]), + ToNote('dev', children: [ + ToNote('host_mirror', builder: _host_mirror_page.build), + ToNote('macos_config', builder: _macos_config_page.build), + ToNote('devtool', builder: _devtool_page.build, children: [ + ToNote('vmservice', builder: _vmservice_page.build), ]), - ToNote("Divider"), - ToNote("text", children: [ - ToNote("RichText", builder: notes_widgets_specific_widgets_text_RichText_.build), - ToNote("Text", builder: notes_widgets_specific_widgets_text_Text_.build), + ToNote('debug', builder: _debug_page.build), + ]), + ToNote('i18n', builder: _i18n_page.build), + ToNote('thinking_in_ui', children: [ + ToNote('readable_html_vs_dart', builder: _readable_html_vs_dart_page.build), + ]), + ToNote('x.note_inside', children: [ + ToNote('how_note_work', builder: _how_note_work_page.build), + ToNote('note_api_thinking'), + ToNote('mockup_content', builder: _mockup_content_page.build), + ToNote('1.welcome', builder: _1_welcome_page.build), + ToNote('note_test_self', builder: _note_test_self_page.build, children: [ + ToNote('nobody', builder: _nobody_page.build), ]), - ToNote("icon", builder: notes_widgets_specific_widgets_icon_.build), ]), - ToNote("container_widgets", children: [ - ToNote("drawer"), - ToNote("Card"), - ToNote("app"), - ToNote("dialog"), - ToNote("menu", builder: notes_widgets_container_widgets_menu_.build), - ToNote("scrollable", children: [ - ToNote("Dismissible", builder: notes_widgets_container_widgets_scrollable_Dismissible_.build), - ToNote("DraggableScrollableSheet"), + ToNote('widgets', children: [ + ToNote('specific_widgets', children: [ + ToNote('input', builder: _input_page.build), + ToNote('webview', builder: _webview_page.build), + ToNote('slider', builder: _slider_page.build), + ToNote('selectable', builder: _selectable_page.build), + ToNote('button', children: [ + ToNote('ButtonStyleButton', builder: _ButtonStyleButton_page.build), + ToNote('FloatingActionButton', builder: _FloatingActionButton_page.build), + ToNote('IconButton', builder: _IconButton_page.build), + ToNote('overview', builder: _overview_page.build), + ]), + ToNote('Divider'), + ToNote('text', children: [ + ToNote('RichText', builder: _RichText_page.build), + ToNote('Text', builder: _Text_page.build), + ]), + ToNote('icon', builder: _icon_page.build), + ]), + ToNote('container_widgets', children: [ + ToNote('drawer'), + ToNote('Card'), + ToNote('app'), + ToNote('dialog'), + ToNote('menu', builder: _menu_page.build), + ToNote('scrollable', children: [ + ToNote('Dismissible', builder: _Dismissible_page.build), + ToNote('DraggableScrollableSheet'), + ]), + ToNote('page_view'), + ToNote('bar', builder: _bar_page.build), ]), - ToNote("page_view"), - ToNote("bar", builder: notes_widgets_container_widgets_bar_.build), + ]), + ToNote('Improve_app', builder: _Improve_app_page.build, children: [ + ToNote('1.overview', builder: _1_overview_page.build), + ToNote('error_handle'), + ToNote('web_optimization', builder: _web_optimization_page.build), + ToNote('RepaintBoundary', builder: _RepaintBoundary_page.build), + ToNote('event&listener&lifeycle', builder: _event_listener_lifeycle_page.build), ]), ]), - ToNote("Improve_app", builder: notes_Improve_app_.build, children: [ - ToNote("1.overview", builder: notes_Improve_app_overview_.build), - ToNote("error_handle"), - ToNote("web_optimization", builder: notes_Improve_app_web_optimization_.build), - ToNote("RepaintBoundary", builder: notes_Improve_app_RepaintBoundary_.build), - ToNote("event&listener&lifeycle", builder: notes_Improve_app_event_listener_lifeycle_.build), - ]), - ]), -]); - -final Routes routes = Routes(); - -class Routes { - final notes = root.find("/notes")!; - final notes_research_parameterized = root.find("/notes/research/parameterized")!; - final notes_research_remote_view = root.find("/notes/research/remote_view")!; - final notes_env_info = root.find("/notes/env_info")!; - final notes_layout = root.find("/notes/layout")!; - final notes_layout_old_layout = root.find("/notes/layout/old/layout")!; - final notes_layout_box_layout_constraints = root.find("/notes/layout/box_layout/constraints")!; - final notes_layout_responsive_design = root.find("/notes/layout/responsive_design")!; - final notes_navigation = root.find("/notes/navigation")!; - final notes_state = root.find("/notes/state")!; - final notes_state_vanilla_state = root.find("/notes/state/1.vanilla_state")!; - final notes_state_StatefulBuilder = root.find("/notes/state/StatefulBuilder")!; - final notes_media_assets_file_file_desktop = root.find("/notes/media&assets&file/file_desktop")!; - final notes_media_assets_file_file_web = root.find("/notes/media&assets&file/file_web")!; - final notes_media_assets_file_assets = root.find("/notes/media&assets&file/assets")!; - final notes_style_theming_material3 = root.find("/notes/style&theming/material3")!; - final notes_pure_dart_dart3 = root.find("/notes/pure_dart/dart3")!; - final notes_pure_dart_async = root.find("/notes/pure_dart/async")!; - final notes_pure_dart_safe_interface = root.find("/notes/pure_dart/safe_interface")!; - final notes_pure_dart_execption = root.find("/notes/pure_dart/execption")!; - final notes_pure_dart_serialization_json = root.find("/notes/pure_dart/serialization_json")!; - final notes_pure_dart_analyzer = root.find("/notes/pure_dart/analyzer")!; - final notes_dev_host_mirror = root.find("/notes/dev/host_mirror")!; - final notes_dev_macos_config = root.find("/notes/dev/macos_config")!; - final notes_dev_devtool = root.find("/notes/dev/devtool")!; - final notes_dev_devtool_vmservice = root.find("/notes/dev/devtool/vmservice")!; - final notes_dev_debug = root.find("/notes/dev/debug")!; - final notes_i18n = root.find("/notes/i18n")!; - final notes_thinking_in_ui_readable_html_vs_dart = root.find("/notes/thinking_in_ui/readable_html_vs_dart")!; - final notes_x_note_inside_how_note_work = root.find("/notes/x.note_inside/how_note_work")!; - final notes_x_note_inside_mockup_content = root.find("/notes/x.note_inside/mockup_content")!; - final notes_x_note_inside_welcome = root.find("/notes/x.note_inside/1.welcome")!; - final notes_x_note_inside_note_test_self = root.find("/notes/x.note_inside/note_test_self")!; - final notes_x_note_inside_note_test_self_nobody = root.find("/notes/x.note_inside/note_test_self/nobody")!; - final notes_widgets_specific_widgets_input = root.find("/notes/widgets/specific_widgets/input")!; - final notes_widgets_specific_widgets_webview = root.find("/notes/widgets/specific_widgets/webview")!; - final notes_widgets_specific_widgets_slider = root.find("/notes/widgets/specific_widgets/slider")!; - final notes_widgets_specific_widgets_selectable = root.find("/notes/widgets/specific_widgets/selectable")!; - final notes_widgets_specific_widgets_button_ButtonStyleButton = root.find("/notes/widgets/specific_widgets/button/ButtonStyleButton")!; - final notes_widgets_specific_widgets_button_FloatingActionButton = root.find("/notes/widgets/specific_widgets/button/FloatingActionButton")!; - final notes_widgets_specific_widgets_button_IconButton = root.find("/notes/widgets/specific_widgets/button/IconButton")!; - final notes_widgets_specific_widgets_button_overview = root.find("/notes/widgets/specific_widgets/button/overview")!; - final notes_widgets_specific_widgets_text_RichText = root.find("/notes/widgets/specific_widgets/text/RichText")!; - final notes_widgets_specific_widgets_text_Text = root.find("/notes/widgets/specific_widgets/text/Text")!; - final notes_widgets_specific_widgets_icon = root.find("/notes/widgets/specific_widgets/icon")!; - final notes_widgets_container_widgets_menu = root.find("/notes/widgets/container_widgets/menu")!; - final notes_widgets_container_widgets_scrollable_Dismissible = root.find("/notes/widgets/container_widgets/scrollable/Dismissible")!; - final notes_widgets_container_widgets_bar = root.find("/notes/widgets/container_widgets/bar")!; - final notes_Improve_app = root.find("/notes/Improve_app")!; - final notes_Improve_app_overview = root.find("/notes/Improve_app/1.overview")!; - final notes_Improve_app_web_optimization = root.find("/notes/Improve_app/web_optimization")!; - final notes_Improve_app_RepaintBoundary = root.find("/notes/Improve_app/RepaintBoundary")!; - final notes_Improve_app_event_listener_lifeycle = root.find("/notes/Improve_app/event&listener&lifeycle")!; + ]); + late final To routes_root = root.find('/')!; + late final To routes_notes = root.find('/notes')!; + late final To routes_notes_research_parameterized = root.find('/notes/research/parameterized')!; + late final To routes_notes_research_remote_view = root.find('/notes/research/remote_view')!; + late final To routes_notes_env_info = root.find('/notes/env_info')!; + late final To routes_notes_layout = root.find('/notes/layout')!; + late final To routes_notes_layout_old_layout = root.find('/notes/layout/old/layout')!; + late final To routes_notes_layout_box_layout_constraints = root.find('/notes/layout/box_layout/constraints')!; + late final To routes_notes_layout_responsive_design = root.find('/notes/layout/responsive_design')!; + late final To routes_notes_navigation = root.find('/notes/navigation')!; + late final To routes_notes_state = root.find('/notes/state')!; + late final To routes_notes_state_vanilla_state = root.find('/notes/state/1.vanilla_state')!; + late final To routes_notes_state_StatefulBuilder = root.find('/notes/state/StatefulBuilder')!; + late final To routes_notes_media_assets_file_file_desktop = root.find('/notes/media&assets&file/file_desktop')!; + late final To routes_notes_media_assets_file_file_web = root.find('/notes/media&assets&file/file_web')!; + late final To routes_notes_media_assets_file_assets = root.find('/notes/media&assets&file/assets')!; + late final To routes_notes_style_theming_material3 = root.find('/notes/style&theming/material3')!; + late final To routes_notes_pure_dart_dart3 = root.find('/notes/pure_dart/dart3')!; + late final To routes_notes_pure_dart_async = root.find('/notes/pure_dart/async')!; + late final To routes_notes_pure_dart_safe_interface = root.find('/notes/pure_dart/safe_interface')!; + late final To routes_notes_pure_dart_execption = root.find('/notes/pure_dart/execption')!; + late final To routes_notes_pure_dart_serialization_json = root.find('/notes/pure_dart/serialization_json')!; + late final To routes_notes_pure_dart_analyzer = root.find('/notes/pure_dart/analyzer')!; + late final To routes_notes_dev_host_mirror = root.find('/notes/dev/host_mirror')!; + late final To routes_notes_dev_macos_config = root.find('/notes/dev/macos_config')!; + late final To routes_notes_dev_devtool = root.find('/notes/dev/devtool')!; + late final To routes_notes_dev_devtool_vmservice = root.find('/notes/dev/devtool/vmservice')!; + late final To routes_notes_dev_debug = root.find('/notes/dev/debug')!; + late final To routes_notes_i18n = root.find('/notes/i18n')!; + late final To routes_notes_thinking_in_ui_readable_html_vs_dart = root.find('/notes/thinking_in_ui/readable_html_vs_dart')!; + late final To routes_notes_x_note_inside_how_note_work = root.find('/notes/x.note_inside/how_note_work')!; + late final To routes_notes_x_note_inside_mockup_content = root.find('/notes/x.note_inside/mockup_content')!; + late final To routes_notes_x_note_inside_welcome = root.find('/notes/x.note_inside/1.welcome')!; + late final To routes_notes_x_note_inside_note_test_self = root.find('/notes/x.note_inside/note_test_self')!; + late final To routes_notes_x_note_inside_note_test_self_nobody = root.find('/notes/x.note_inside/note_test_self/nobody')!; + late final To routes_notes_widgets_specific_widgets_input = root.find('/notes/widgets/specific_widgets/input')!; + late final To routes_notes_widgets_specific_widgets_webview = root.find('/notes/widgets/specific_widgets/webview')!; + late final To routes_notes_widgets_specific_widgets_slider = root.find('/notes/widgets/specific_widgets/slider')!; + late final To routes_notes_widgets_specific_widgets_selectable = root.find('/notes/widgets/specific_widgets/selectable')!; + late final To routes_notes_widgets_specific_widgets_button_ButtonStyleButton = root.find('/notes/widgets/specific_widgets/button/ButtonStyleButton')!; + late final To routes_notes_widgets_specific_widgets_button_FloatingActionButton = root.find('/notes/widgets/specific_widgets/button/FloatingActionButton')!; + late final To routes_notes_widgets_specific_widgets_button_IconButton = root.find('/notes/widgets/specific_widgets/button/IconButton')!; + late final To routes_notes_widgets_specific_widgets_button_overview = root.find('/notes/widgets/specific_widgets/button/overview')!; + late final To routes_notes_widgets_specific_widgets_text_RichText = root.find('/notes/widgets/specific_widgets/text/RichText')!; + late final To routes_notes_widgets_specific_widgets_text_Text = root.find('/notes/widgets/specific_widgets/text/Text')!; + late final To routes_notes_widgets_specific_widgets_icon = root.find('/notes/widgets/specific_widgets/icon')!; + late final To routes_notes_widgets_container_widgets_menu = root.find('/notes/widgets/container_widgets/menu')!; + late final To routes_notes_widgets_container_widgets_scrollable_Dismissible = root.find('/notes/widgets/container_widgets/scrollable/Dismissible')!; + late final To routes_notes_widgets_container_widgets_bar = root.find('/notes/widgets/container_widgets/bar')!; + late final To routes_notes_Improve_app = root.find('/notes/Improve_app')!; + late final To routes_notes_Improve_app_overview = root.find('/notes/Improve_app/1.overview')!; + late final To routes_notes_Improve_app_web_optimization = root.find('/notes/Improve_app/web_optimization')!; + late final To routes_notes_Improve_app_RepaintBoundary = root.find('/notes/Improve_app/RepaintBoundary')!; + late final To routes_notes_Improve_app_event_listener_lifeycle = root.find('/notes/Improve_app/event&listener&lifeycle')!; } + +class Routes with RoutesMixin {} diff --git a/notes/flutter_web/lib/routes/layout.dart b/notes/flutter_web/lib/routes/layout.dart new file mode 100644 index 00000000..fa8d3684 --- /dev/null +++ b/notes/flutter_web/lib/routes/layout.dart @@ -0,0 +1,60 @@ +import 'package:flutter/foundation.dart'; +import 'package:flutter/material.dart'; +import 'package:you_flutter/router.dart'; + +/// ref: [PageLayoutBuilder] +Widget layout(BuildContext context, ToUri uri, PageBuilder builder) { + // ignore: unnecessary_type_check + assert(layout is PageLayoutBuilder); + return RootLayout( + uri: uri, + builder: builder, + ); +} + +@immutable +final class RootLayout extends StatelessWidget { + final PageBuilder builder; + final ToUri uri; + + const RootLayout({super.key, required this.uri, required this.builder}); + + @override + Widget build(BuildContext context) { + var child = builder(context, uri); + + + NavigationRailDestination rail({required String title, required IconData icon}) { + return NavigationRailDestination( + icon: Tooltip(message: title, child: Icon(icon)), + label: Text(title), + ); + } + + return Scaffold( + primary: true, + // content... + appBar: AppBar(toolbarHeight: 38, title: const Text("widget.title"), actions: [ + IconButton(iconSize: 24, icon: const Icon(Icons.color_lens_outlined), onPressed: () {}), + IconButton(iconSize: 24, icon: const Icon(Icons.settings), onPressed: () {}), + if (kDebugMode) const Text("debug模式"), + ]), + floatingActionButton: FloatingActionButton(onPressed: () {}, tooltip: 'Increment', child: const Icon(Icons.add)), + body: SafeArea( + child: Row(crossAxisAlignment: CrossAxisAlignment.stretch, children: [ + NavigationRail(onDestinationSelected: (index) {}, minWidth: 24, minExtendedWidth: 24, selectedIndex: null, groupAlignment: -1, labelType: NavigationRailLabelType.none, destinations: [ + rail(title: "文件夹", icon: Icons.folder_outlined), + ]), + Drawer( + width: 200, + child: ListView(scrollDirection: Axis.vertical, children: [ + const Divider(), + ListTile(title: const Text('根页面'), subtitle: const Text("xxx"), onTap: () {}), + const Divider(), + ])), + Expanded(child: child), + ]), + ), + ); + } +} diff --git a/notes/flutter_web/lib/routes/page.dart b/notes/flutter_web/lib/routes/page.dart new file mode 100644 index 00000000..1b1d4019 --- /dev/null +++ b/notes/flutter_web/lib/routes/page.dart @@ -0,0 +1,18 @@ +// ignore_for_file: non_constant_identifier_names,camel_case_types +import 'package:flutter/material.dart'; +import 'package:you_flutter/router.dart'; + +RootPage build(BuildContext context, ToUri uri) { + return RootPage(uri: uri); +} + +class RootPage extends StatelessWidget { + final ToUri uri; + + const RootPage({required this.uri, super.key}); + + @override + Widget build(BuildContext context) { + return const Text("/ root page"); + } +} diff --git a/packages/you_cli/bin/cli.dart b/packages/you_cli/bin/cli.dart index e3184bae..7059dd17 100644 --- a/packages/you_cli/bin/cli.dart +++ b/packages/you_cli/bin/cli.dart @@ -1,5 +1,4 @@ import 'package:args/command_runner.dart'; -import 'package:code_builder/code_builder.dart' as code; import 'package:code_builder/code_builder.dart'; import 'package:dart_style/dart_style.dart'; @@ -10,6 +9,8 @@ import 'package:you_cli/src/cli_core.dart'; import 'dart:io' as io; +import 'package:you_cli/src/code_builder_ext.dart'; + main(List args) async { _log("Platform.script : ${io.Platform.script}"); _log("Directory.current: ${io.Directory.current}"); @@ -81,7 +82,7 @@ class Cmd_gen_routes_g_dart extends Command { @override final description = "gen routes.g.dart ."; final FileSystem fs; - final Allocator _allocator=Allocator(); + final CleanPrefixedAllocator _allocator = CleanPrefixedAllocator(); YouCli? _cli; YouCli get cli => _cli != null ? _cli! : _cli = YouCli(projectDir: dir); @@ -92,23 +93,23 @@ class Cmd_gen_routes_g_dart extends Command { // - async layout + page : // notes_layout.layout((context, print) async => await notes_i18n_.loadLibrary().then((_) => notes_i18n_.build(context, print))) @Deprecated("已废弃,待完成重构后删除") - code.Expression? builderExpression(RouteNode node) { + Expression? builderExpression(RouteNode node) { if (!node.file_page_dart.existsSync()) { return null; } - code.Expression builder = code.refer("${node.flatName}_").property("build"); + Expression builder = refer("${node.flatName}_").property("build"); RouteNode? layout = node.findLayoutSync(); if (layout != null) { builder = refer("${layout.flatName}__").property("layout2").call([builder]); } if (async) { - return code.Method((b) => b + return Method((b) => b ..modifier = MethodModifier.async - ..body = code.Block.of( + ..body = Block.of( [ - code.refer("${node.flatName}_").property("loadLibrary").call([]).awaited.statement, - if (layout != null) code.refer("${layout.flatName}__").property("loadLibrary").call([]).awaited.statement, + refer("${node.flatName}_").property("loadLibrary").call([]).awaited.statement, + if (layout != null) refer("${layout.flatName}__").property("loadLibrary").call([]).awaited.statement, builder.returned.statement, ], )).closure; @@ -117,20 +118,16 @@ class Cmd_gen_routes_g_dart extends Command { } } - // 没用code_builder是因为它会格式化换行,很多换行,很乱。 - Future _genRouteTreeCode(RouteNode node) async { - String buildArg = !node.file_page_dart.existsSync() ? "" : ",builder:${node.flatName}_.build"; - String layoutArg = !node.file_layout_dart.existsSync() ? "" : ",layout:${node.flatName}__.layout"; - String padding = "".padLeft(node.level, ' '); - var toType = node.findToType(); - if (node.children.isEmpty) { - return '''$padding${_allocator.allocate(toType)}${async ? ".lazy" : ""}("${node.dir.basename}" $layoutArg $buildArg) '''; - } - List children=await Future.wait(node.children.map((child) async => await _genRouteTreeCode(child))); - return '''$padding${_allocator.allocate(toType)}${async ? ".lazy" : ""}("${node.dir.basename}" $layoutArg $buildArg, children:[ -${children.map((e) => "$e,").join("\n")} -$padding])'''; + Expression _genRouteRootExpression(RouteNode node) { + var toType = node.findToType(); + return toType.newInstance([ + literalString(node.dir.basename) + ], { + if (node.file_page_dart.existsSync()) "builder": refer("build",node.pagePackageUrl), + if (node.file_layout_dart.existsSync()) "layout": refer("layout",node.layoutPackageUrl), + if (node.children.isNotEmpty) "children": literalList(node.children.map((e) => _genRouteRootExpression(e))), + }); } @override @@ -147,17 +144,8 @@ $padding])'''; var rootRoute = await cli.rootRoute; Iterable routes = rootRoute.toList(); - var nameMaxLen = routes.map((e) => e.flatName.length).reduce((value, element) => value > element ? value : element); - // 因我们要自己Padding,所以没用code_builder - var newRoutes = routes.where((e) => e.file_page_dart.existsSync()).map((routeDir) { - var varWithPadding = routeDir.flatName.padRight(nameMaxLen); - return """ final $varWithPadding = root.find("${routeDir.routePath}")! ; """; - }).join("\n"); - - var routeTreeCode=await _genRouteTreeCode(rootRoute); - Library all = Library( - (b) => b + (b) => b ..generatedByComment = """ // Generated by https://github.com/chen56/you // - This file setup routes tree and strong type `routes` reference @@ -167,41 +155,59 @@ $padding])'''; // ignore_for_file: library_prefixes // ignore_for_file: non_constant_identifier_names """ - ..directives.addAll( - routes.where((e) => e.file_page_dart.existsSync()).map((lib) { - if (async) { - return Directive.importDeferredAs(lib.pageImportUri(cli.pubspec.name, cli.dir_lib), "${lib.flatName}_"); - } else { - return Directive.import(lib.pageImportUri(cli.pubspec.name, cli.dir_lib), as: "${lib.flatName}_"); - } - }), - ) - ..directives.addAll( - routes.where((e) => e.file_layout_dart.existsSync()).map((lib) { - if (async) { - return Directive.importDeferredAs(lib.layoutImportUri(cli.pubspec.name, cli.dir_lib), "${lib.flatName}__"); - } else { - return Directive.import(lib.layoutImportUri(cli.pubspec.name, cli.dir_lib), as: "${lib.flatName}__"); - } - }), + // ..directives.addAll( + // routes.where((e) => e.file_page_dart.existsSync()).map((lib) { + // if (async) { + // return Directive.importDeferredAs(lib.pagePackageUrl, "${lib.flatName}_"); + // } else { + // return Directive.import(lib.pagePackageUrl, as: "${lib.flatName}_"); + // } + // }), + // ) + // ..directives.addAll( + // routes.where((e) => e.file_layout_dart.existsSync()).map((lib) { + // if (async) { + // return Directive.importDeferredAs(lib.layoutPackageUrl, "${lib.flatName}__"); + // } else { + // return Directive.import(lib.layoutPackageUrl, as: "${lib.flatName}__"); + // } + // }), + // ) + ..body.add( + Mixin( + (b) => b + ..name = "RoutesMixin" + ..fields.add( + Field((f) => f + ..name = "root" + ..modifier = FieldModifier.final$ + ..type = rootRoute.findToType() + ..assignment = _genRouteRootExpression(rootRoute).code), + ) + ..fields.addAll( + routes.where((e) => e.file_page_dart.existsSync()).map( + (routeDir) => Field((f) => f + ..modifier = FieldModifier.final$ + ..late = true + ..type = YouCli.toTypeDefault + ..name = "routes_${routeDir.flatName}" + ..assignment = refer("root.find").call([literalString(routeDir.routePath)]).nullChecked.code), + ), + ), + ), ) ..body.add( - Code(""" - -var root=$routeTreeCode ; - -final Routes routes=Routes(); - -class Routes{ -$newRoutes -} - """), + Class( + (b) => b + ..name = "Routes" + ..mixins.add(refer("RoutesMixin")) + ), ), ); var fmt = DartFormatter(pageWidth: 200); - var dartEmitter = DartEmitter(allocator: _allocator, orderDirectives: false, useNullSafetySyntax: true); - var allCode ='${all.accept(dartEmitter)}'; + var dartEmitter = DartEmitterForCli(allocator: _allocator, orderDirectives: false, useNullSafetySyntax: true); + var allCode = '${all.accept(dartEmitter)}'; _log("gen: ${cli.file_routes_g_dart.path} : $allCode"); allCode = fmt.format(allCode); await cli.file_routes_g_dart.writeAsString(allCode); diff --git a/packages/you_cli/lib/src/cli_core.dart b/packages/you_cli/lib/src/cli_core.dart index 84eed7ba..761eb4c5 100644 --- a/packages/you_cli/lib/src/cli_core.dart +++ b/packages/you_cli/lib/src/cli_core.dart @@ -43,12 +43,13 @@ class YouCli { Future get rootRoute async { Future from(Directory dir) async { if (!dir.existsSync()) { - return RouteNode(dir: dir, children: []); + return RouteNode(cli: this, dir: dir, children: []); } var children = await Future.wait(dir.listSync(recursive: false).whereType().map((e) async => await from(e))); var (layout: layoutFunction, toType: toType) = await analysisLayout(dir.childFile(layoutDart)); return RouteNode( + cli: this, dir: dir, pageBuild: await analysisPage(dir.childFile(pageDart)), layoutFunction: layoutFunction, @@ -136,6 +137,7 @@ class YouCli { } class RouteNode { + final YouCli cli; final List children; final Directory dir; final Reference? toType; @@ -143,7 +145,7 @@ class RouteNode { final FunctionElement? pageBuild; late RouteNode _parent = this; - RouteNode({required this.dir, this.toType, required this.children, this.layoutFunction, this.pageBuild}) { + RouteNode({required this.dir, this.toType, required this.children, this.layoutFunction, this.pageBuild, required this.cli}) { for (var child in children) { child._parent = this; } @@ -159,16 +161,6 @@ class RouteNode { File get file_layout_dart => dir.childFile("layout.dart"); - String pageImportUri(String pkgName, Directory libDir) { - var pageDartRelativePath = path.relative(file_page_dart.path, from: libDir.path); - return "package:$pkgName/$pageDartRelativePath"; - } - - String layoutImportUri(String pkgName, Directory libDir) { - var pageDartRelativePath = path.relative(file_layout_dart.path, from: libDir.path); - return "package:$pkgName/$pageDartRelativePath"; - } - String get routePath { if (isRoot) { return "/"; @@ -176,6 +168,14 @@ class RouteNode { return "/${path.relative(dir.path, from: root.dir.path)}"; } + String get pagePackageUrl { + return "package:${cli.pubspec.name}/${path.relative(file_page_dart.path, from: cli.dir_lib.path)}"; + } + + String get layoutPackageUrl { + return "package:${cli.pubspec.name}/${path.relative(file_layout_dart.path, from: cli.dir_lib.path)}"; + } + /// note name平整化,可作为变量名: /// lib/routes/1.a/b/page.dart ---> a_b String get flatName { diff --git a/packages/you_cli/test/bin/analyzer_test.dart b/packages/you_cli/test/bin/analyzer_test.dart deleted file mode 100644 index a640c519..00000000 --- a/packages/you_cli/test/bin/analyzer_test.dart +++ /dev/null @@ -1,17 +0,0 @@ -import 'package:checks/checks.dart'; -import 'package:code_builder/code_builder.dart'; -import 'package:file/file.dart'; -import 'package:file/local.dart'; -import 'package:test/test.dart'; -import 'package:you_cli/src/cli_core.dart'; - -void main() { - group("RouteNode", () { - test('ToType', () async { - FileSystem fs=LocalFileSystem(); - YouCli cli = YouCli(projectDir: fs.directory("../../notes/flutter_web/lib")); - var result =await cli.analysisLayout(fs.file("../../notes/flutter_web/lib/routes/notes/layout.dart")); - check(result.toType!.type).equals(refer("ToNote","package:you_note_dart/note.dart")); - }); - }); -} diff --git a/packages/you_cli/test/bin/cli_core_test.dart b/packages/you_cli/test/bin/cli_core_test.dart index f5e12699..7ee751dd 100644 --- a/packages/you_cli/test/bin/cli_core_test.dart +++ b/packages/you_cli/test/bin/cli_core_test.dart @@ -1,7 +1,11 @@ import 'package:checks/checks.dart'; +import 'package:code_builder/code_builder.dart'; +import 'package:file/file.dart'; +import 'package:file/local.dart'; import 'package:file/memory.dart'; import 'package:test/test.dart'; import 'package:you_cli/src/cli_core.dart'; +import 'package:you_cli/src/code_builder_ext.dart'; void main() { group("RouteNode", () { @@ -22,5 +26,34 @@ void main() { ]); }); }); + group("CleanPrefixedAllocator", () { + test('CleanPrefixedAllocator 1', () async { + CleanPrefixedAllocator allocator=CleanPrefixedAllocator(); + checkAllocator(Reference ref, String expectedSymbol, List expectedImports){ + check(allocator.allocate(ref)).equals(expectedSymbol); + allocator.imports.map((e)=>"${e.as},${e.url}"); + } + checkAllocator(refer("A","package:a/a.dart"),"A",[",package:a/a.dart"]); + + //冲突 + checkAllocator(refer("A","package:b/b.dart"),"_b_b.A",["_b_b,package:b/b.dart"]); + + //再冲突 + checkAllocator(refer("A","package:b/c.dart"),"_b_c.A",["_b_c,package:c/c.dart"]); + + //再冲突 + checkAllocator(refer("A","package:a/b/c.dart"),"_b_c2.A",["_b_c2,package:c/c.dart"]); + }); + }); + + group("analyzer_test", () { + test('ToType', () async { + FileSystem fs=LocalFileSystem(); + YouCli cli = YouCli(projectDir: fs.directory("../../notes/flutter_web/lib")); + var result =await cli.analysisLayout(fs.file("../../notes/flutter_web/lib/routes/notes/layout.dart")); + check(result.toType!.type).equals(refer("ToNote","package:you_note_dart/note.dart")); + }); + }); + }