diff --git a/.metadata b/.metadata deleted file mode 100644 index 87b4b9ab..00000000 --- a/.metadata +++ /dev/null @@ -1,30 +0,0 @@ -# This file tracks properties of this Flutter project. -# Used by Flutter tool to assess capabilities and perform upgrades etc. -# -# This file should be version controlled and should not be manually edited. - -version: - revision: "68bfaea224880b488c617afe30ab12091ea8fa4e" - channel: "stable" - -project_type: app - -# Tracks metadata for the flutter migrate command -migration: - platforms: - - platform: root - create_revision: 68bfaea224880b488c617afe30ab12091ea8fa4e - base_revision: 68bfaea224880b488c617afe30ab12091ea8fa4e - - platform: macos - create_revision: 68bfaea224880b488c617afe30ab12091ea8fa4e - base_revision: 68bfaea224880b488c617afe30ab12091ea8fa4e - - # User provided section - - # List of Local paths (relative to this file) that should be - # ignored by the migrate tool. - # - # Files that are not part of the templates will be ignored by default. - unmanaged_files: - - 'lib/main.dart' - - 'ios/Runner.xcodeproj/project.pbxproj' diff --git a/README.md b/README.md index 2bf5f479..bbfc400a 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,6 @@ you can run it local by yourself: ```bash git clone git@github.com:chen56/note.git ./bake install -./bake flutter dev # run as local macos app -./bake flutter dev_web # run as local web app +./bake flutter_web dev # run as local macos app +./bake flutter_web dev_html # run as local web html app ``` diff --git a/bake b/bake index da713e6d..04c0cfe5 100755 --- a/bake +++ b/bake @@ -14,12 +14,13 @@ cd "$_ROOT_DIR" || exit 200 source "packages/you_bake/bake.bash" declare -A _pkgs=( + ["root"]="$_ROOT_DIR" ["bake"]="$_ROOT_DIR/packages/you_bake" ["you_dart"]="$_ROOT_DIR/packages/you_dart" ["you_flutter"]="$_ROOT_DIR/packages/you_flutter" ["you_note_dart"]="$_ROOT_DIR/packages/you_note_dart" + ["you_cli"]="$_ROOT_DIR/packages/you_cli" ["learn_dart"]="$_ROOT_DIR/notes/learn_dart" - ["root"]="$_ROOT_DIR" ["flutter_web"]="$_ROOT_DIR/notes/flutter_web" ["qwik"]="$_ROOT_DIR/notes/qwik" ["shell"]="$_ROOT_DIR/notes/shell" @@ -97,7 +98,7 @@ _run() { local pkg=${1:?required project arg,Usage: _run_at_pkg } shift local cmd="${1}" - [[ "$cmd" != "" ]] # 如果有cmd,去掉第1个cmd,剩余的是它的参数,如果没有,就类似于在控制台上打了个会车一样任他去吧 +# [[ "$cmd" != "" ]] # 如果有cmd,去掉第1个cmd,剩余的是它的参数,如果没有,就类似于在控制台上打了个会车一样任他去吧 # 进入工作目录 local workdir="${_pkgs[$pkg]}" @@ -107,9 +108,9 @@ _run() { caller_line=$(caller 0 | awk '{print $1}') if ! _is_cmd "$cmd" ; then - echo "$_ROOT_BAKE_PATH:$caller_line ⚪️ ▶︎${FUNCNAME[1]}() ▶︎【$workdir$ $*】" + echo "$_ROOT_BAKE_PATH:$caller_line ⚪️ ▶︎${FUNCNAME[1]}() ▶︎【$PWD$ $*】" else - echo "$_ROOT_BAKE_PATH:$caller_line 🔵 ▶︎${FUNCNAME[1]}() ▶︎【$workdir$ $*】" + echo "$_ROOT_BAKE_PATH:$caller_line 🔵 ▶︎${FUNCNAME[1]}() ▶︎【$PWD$ $*】" "$@" fi # 退出工作目录,不弄脏环境,不需要打印popd执行结果 @@ -122,7 +123,7 @@ _run() { ########################################## -ls() { for pkg in ${!_pkgs[*]} ; do echo "$pkg:${_pkgs[$pkg]}"; done; } +pkgs() { for pkg in ${!_pkgs[*]} ; do echo "$pkg:${_pkgs[$pkg]}"; done; } run() { for pkg in ${!_pkgs[*]} ; do _run "$pkg" "$@" ; done } install() { _run_all install; } get() { _run_all install; } @@ -131,17 +132,11 @@ upgrade() { _run_all upgrade; } clean() { _run_all clean; } test() { _run_all test; } gen() { _run_all gen; } - +dart_fix() { run dart fix $@; } # 根项目,主要是bin/辅助工具等 root.run() { _run root "$@"; } -root.install() { _run root dart pub get; } -root.upgrade() { _run root dart pub upgrade ; } -root.test() { _run root dart test; } -root.build() { _run root dart compile exe bin/notecli.dart ; } -root.clean() { _run root rm -rf build; - _run root rm -rf .dart_tool; } -# bash。bash is1 common scri + bake.run() { _run bake "$@"; } bake.test() { _run bake ./test.bash test; } @@ -158,12 +153,15 @@ you_flutter.clean() { _run you_flutter flutter clean; rm -rf build; } you_flutter.upgrade() { _run you_flutter flutter pub upgrade ; } you_flutter.test() { _run you_flutter flutter test; } +you_cli.run() { _run you_cli "$@"; } +you_cli.test() { _run you_cli dart test; } -you_note_dart.run() { _run root_note_dart "$@"; } -you_note_dart.install() { _run root_note_dart flutter pub get; } -you_note_dart.clean() { _run root_note_dart flutter clean; rm -rf build; } -you_note_dart.upgrade() { _run root_note_dart flutter pub upgrade ; } -you_note_dart.test() { _run root_note_dart flutter test; } + +you_note_dart.run() { _run you_note_dart "$@"; } +you_note_dart.install() { _run you_note_dart flutter pub get; } +you_note_dart.clean() { _run you_note_dart flutter clean; rm -rf build; } +you_note_dart.upgrade() { _run you_note_dart flutter pub upgrade ; } +you_note_dart.test() { _run you_note_dart flutter test; } learn_dart.run() { _run learn_dart "$@"; } learn_dart.install() { _run learn_dart dart pub get ; } @@ -184,25 +182,25 @@ flutter_web.install() { _run flutter_web flutter pub get ; } flutter_web.clean() { _run flutter_web flutter clean; rm -rf build; } flutter_web.upgrade() { _run flutter_web flutter pub upgrade ; } -flutter_web.gen() { dart run bin/notecli.dart gen --dir notes/flutter_web/; } -flutter_web.dev() { flutter_web.dev_macos "$@"; } -flutter_web.build() { flutter_web.build_html "$@" ; } +flutter_web.gen() { #_run root dart run packages/you_cli/bin/cli.dart gen all --dir notes/flutter_web/; + _run root dart run packages/you_cli/bin/cli.dart gen routes.g.dart --dir notes/flutter_web/ # --async +} +flutter_web.dev() { flutter_web.dev_html ; } +flutter_web.build() { flutter_web.build_html ;} flutter_web.preview() { flutter_web.build_html; - flutter_web.preview_html_deno; } + flutter_web.server_deno; } -flutter_web.dev_macos() { _run flutter_web flutter run --device-id macos "$@"; } flutter_web.dev_html() { _run flutter_web flutter run --web-port 8888 --web-renderer html --device-id chrome "$@"; } +flutter_web.dev_macos() { _run flutter_web flutter run --device-id macos "$@"; } +flutter_web.build_html() { _run flutter_web flutter build web --release --tree-shake-icons --web-renderer html --source-maps --output build/web/you/flutter_web --base-href "/you/flutter_web/" --no-web-resources-cdn "$@" ;} flutter_web.build_macos() { _run flutter_web flutter build macos --release --tree-shake-icons "$@"; } flutter_web.build_wasm() { _run flutter_web flutter build web --release --tree-shake-icons --wasm "$@" ;} -flutter_web.build_html() { _run flutter_web flutter build web --release --tree-shake-icons --web-renderer html --source-maps --output build/web/you/flutter_web --base-href "/you/flutter_web/" --no-web-resources-cdn "$@" ;} flutter_web.build_web_skwasm() { _run flutter_web flutter build web --release --tree-shake-icons --web-renderer skwasm "$@" ; } flutter_web.build_web_canvaskit() { _run flutter_web flutter build web --release --tree-shake-icons --web-renderer canvaskit "$@" ; } -flutter_web.preview_html_run() { echo "http://localhost:8080/you/flutter_web"; +flutter_web.server_dhttpd() { echo "http://localhost:8080/you/flutter_web"; _run flutter_web dhttpd --path ./build/web --port 8080 '--headers=Cross-Origin-Embedder-Policy=credentialless;Cross-Origin-Opener-Policy=same-origin'; } -flutter_web.preview_html_deno() { echo "http://localhost:8080/you/flutter_web"; +flutter_web.server_deno() { echo "http://localhost:8080/you/flutter_web"; _run flutter_web deno run --allow-env --allow-read --allow-sys --allow-net npm:http-server ./build/web --port 8080 -g --brotli; } -flutter_web.preview_wasm() { echo "http://localhost:8080/you/flutter_web"; - _run flutter_web dhttpd '--headers=Cross-Origin-Embedder-Policy=credentialless;Cross-Origin-Opener-Policy=same-origin'; } # github 发布时使用,参考[.github/workflows/*.yaml] @@ -225,4 +223,23 @@ info() { echo } +temp(){ + + # 指定需要遍历的目录,例如当前目录可以使用 "." + directory="notes/flutter_web/lib" + + # 遍历目录中的所有note.dart文件 + for file in $(find 'notes/flutter_web/lib' -type f -name 'note.json') ; do +# echo "xxx $file" +# # 检查文件是否存在 + if [ -f "$file" ]; then + # 构建新的文件名,即将note.dart替换为page.dart + new_file="${file//note.json/page.json}" + # 执行重命名操作 + git mv "$file" "$new_file" + echo "mv $file to $new_file" + fi + done +} + bake.go "$@" \ No newline at end of file diff --git a/bin/notecli.dart b/bin/notecli.dart deleted file mode 100644 index 59eb3b85..00000000 --- a/bin/notecli.dart +++ /dev/null @@ -1,692 +0,0 @@ -import 'package:analyzer/dart/analysis/features.dart'; -import 'package:analyzer/dart/ast/ast.dart'; -import 'package:analyzer/dart/ast/visitor.dart'; -import 'package:args/command_runner.dart'; -import 'package:code_builder/code_builder.dart' as code; -import 'package:code_builder/code_builder.dart'; -import 'package:collection/collection.dart'; - -import 'package:dart_style/dart_style.dart'; -import 'package:file/file.dart'; -import 'package:file/local.dart'; -import 'package:glob/glob.dart'; -import 'package:you_note_dart/note_conf.dart'; -import 'package:path/path.dart' as path; - -import 'package:analyzer/dart/analysis/utilities.dart' as analyzer_util; -import 'package:watcher/watcher.dart'; -import 'package:yaml_edit/yaml_edit.dart' show YamlEditor; - -import 'package:you_dart/src/core.dart'; - -const String _libRoot = "lib"; -const String _notesRoot = "lib/notes"; -final Glob _noteGlob = Glob("{**/note.dart,note.dart}"); - -/// 新思路,cell 树形 -main(List args) async { - FileSystem fs = const LocalFileSystem(); - - var runner = CommandRunner("note", "A flutter note tools."); - runner.addCommand(GenAllCommand(fs: fs)); - await runner.run(args); -} - -class GenAllCommand extends Command { - // The [name] and [description] properties must be defined by every - // subclass. - GenAllCommand({required this.fs}) { - argParser.addOption("dir", mandatory: true, help: "要生成的flutter note项目根目录"); - } - - final FileSystem fs; - @override - final name = "gen"; - @override - final description = "gen all ."; - - // [run] may also return a Future. - @override - Future run() async { - String dirOpt = argResults?["dir"]!; - var dir = fs.directory(path.absolute(dirOpt)); - if (!dir.existsSync()) { - throw AssertionError("【--dir $dir】 not exists"); - } - - _log("gen: $dir"); - NotesGenerator gen = NotesGenerator(packageBaseName: "flutter_web", fmt: DartFormatter(pageWidth: 500), fs: fs, projectDir: dir); - - await gen.gen(); - } -} - -class NotesGenerator { - final DartFormatter _fmt; - final FileSystem fs; - final String packageBaseName; - final Directory projectDir; - late final Directory libDir; - late final Directory noteRootDir; - - NotesGenerator({ - required this.packageBaseName, - required this.fs, - required this.projectDir, - DartFormatter? fmt, - }) : _fmt = fmt ?? DartFormatter() { - libDir = projectDir.childDirectory(_libRoot); - noteRootDir = projectDir.childDirectory(_notesRoot); - } - - Future gen() async { - // TODO 130 remove - var notes = await _genAll_note_g_dart(); - await _genSpaceJson(notes); - await _genNoteGenConf(notes); - await _gen_notes_g_dart(notes.map((e) => e.noteLib).toList()); - } - - Stream watch() async* { - var watcher = DirectoryWatcher(noteRootDir.path); - await for (WatchEvent e in watcher.events) { - if (!_noteGlob.matches(e.path)) { - yield e; - continue; - } - var file = fs.file(e.path); - var pubspec = await _pubspec(); - NoteLib noteLib = NoteLib(file: file, noteGenerator: this); - - switch (e.type) { - case ChangeType.ADD || ChangeType.MODIFY: - await noteLib.gen(); - pubspec.noteAssetsAdd(noteLib.asset); - case ChangeType.REMOVE: - var noteAsset = path.relative(file.parent.path, from: projectDir.path); - pubspec.noteAssetsRemove(noteAsset); - default: - throw Exception("unknown ChangeType ${e.type}"); - } - - // await _genSpaceJson(_noteLibs); - await _gen_notes_g_dart(await _noteLibs.toList()); - await pubspec.save(); - yield e; - } - } - - // ignore: non_constant_identifier_names - Future<({File file, List notes})> _gen_notes_g_dart(List noteLibs) async { - var nameMaxLen = noteLibs.map((e) => e.asVariableName.length).reduce((value, element) => value > element ? value : element); - var fields = noteLibs.map((noteLib) { - var noteVarNameWithPadding = noteLib.asVariableName.padRight(nameMaxLen); - // final NoteRoute dev_devtool = put("/dev/devtool", (context,print) async => await dev_devtool_.loadLibrary().then((value) => dev_devtool_.build(context,print))); - return """ final $noteVarNameWithPadding = put("${noteLib.noteKey}", (context,print) async => await ${noteLib.asVariableName}_.loadLibrary().then((value) => ${noteLib.asVariableName}_.build(context,print))); """; - }).join("\n"); - Library importCode = Library((b) => b - ..comments.addAll(["Generated by gen_maters.dart, please don't edit! ", "ignore_for_file: library_prefixes, non_constant_identifier_names"]) - ..directives.addAll( - noteLibs.map((lib) { - return code.Directive.importDeferredAs(lib.package, "${lib.asVariableName}_"); - }), - )); - - String importCodeFmt = '${importCode.accept(DartEmitter(allocator: Allocator.none, orderDirectives: true, useNullSafetySyntax: true))}'; - importCodeFmt = _fmt.format(importCodeFmt); - String allCode = """ -import 'package:you_note_dart/note.dart'; - -$importCodeFmt - -abstract class BaseNotes { - static final NoteRoute rootroot = NoteRoute.root(); - static NoteRoute put(String path, LazyNoteBuilder lazyNoteBuilder) { - return rootroot.put(path, lazyNoteBuilder); - } -$fields -} -"""; - - File file = await projectDir.childFile("lib/notes.g.dart").writeAsString(allCode); - // 暂时不格式化,因为要保持变量名后的padding,对齐变量更好看 - // file.writeAsString(_fmt.format(toCode)); - - return (file: file, notes: noteLibs); - } - - File get _noteSpaceJsonFile => projectDir.childFile("notes.g.json"); - - Future _genNoteGenConf(List notes) async { - int maxNoteId = 1; - for (var note in notes) { - NoteGenConf? noteGenConf = note.noteGenConf; - if (noteGenConf != null && noteGenConf.noteId > maxNoteId) { - maxNoteId = noteGenConf.noteId; - } - } - - int nextNoteId = maxNoteId + 1; - for (var note in notes) { - _log("${note.noteGenConf == null ? "🟢create" : "⚪️update"} note.g.json: ${note.noteGenConfFile} "); - NoteGenConf noteGenConf = note.noteGenConf ?? NoteGenConf(noteId: nextNoteId++); - // 每次覆盖 - await noteGenConf.save(note.noteGenConfFile); - } - } - - Future _genSpaceJson(List notes) async { - SpaceConf spaceConf = await SpaceConf.load(_noteSpaceJsonFile); - spaceConf.notes.clear(); - for (var note in notes) { - if (note.noteConf != null) { - spaceConf.notes[note.noteLib.noteKey] = note.noteConf!; - } - } - return await spaceConf.save(_noteSpaceJsonFile); - } - - Stream get _noteLibs => _noteGlob.listFileSystem(fs, root: noteRootDir.path).where((e) => e is File).map((e) => NoteLib(file: e as File, noteGenerator: this)); - - // ignore: non_constant_identifier_names - Future> _genAll_note_g_dart() async { - var result = await _noteLibs.map((e) => e.gen()).asyncExpand((e) => e.asStream()).toList(); - for (var e in result) { - _log("gen note: $e"); - } - - var pubspec = await _pubspec(); - var toUpdate = result.map((e) => e.noteLib.asset).sorted((a, b) => a.compareTo(b)); - pubspec.noteAssetsUpdate(toUpdate); - await pubspec.save(); - return result; - } - - Future _pubspec() async { - return Pubspec.parseFile(projectDir.childFile("pubspec.yaml")); - } - - NoteLib noteOf(String notePath) { - return NoteLib(file: fs.file(notePath), noteGenerator: this); - } -} - -// // Generated by note_dev_gen.dart, please don't edit! -// // ignore_for_file: library_prefixes, non_constant_identifier_names -// -// import 'package:you_note_dart/note.dart'; -// import 'package:flutter_web/1.welcome/page.dart' deferred as welcome_; -// import 'package:flutter_web/1.welcome/page.g.dart' as welcome_g; -// import 'package:flutter_web/note_app.dart'; -// -// mixin PathsMixin { -// final Note welcome = put2( -// "/1.welcome", -// (shortTitle: "welcome",), -// welcome_g.noteInfo, -// () => welcome_ -// .loadLibrary() -// .then((value) => welcome_.page, onError: onError)); -// } - -class NoteLib { - final FileSystem fs; - final NotesGenerator noteGenerator; - final Directory noteRootDir; - final Directory libDir; - final String packageBaseName; - final File file; - final Directory projectDir; - - NoteLib({ - required this.file, - required this.noteGenerator, - }) : fs = noteGenerator.fs, - libDir = noteGenerator.libDir, - packageBaseName = noteGenerator.packageBaseName, - noteRootDir = noteGenerator.noteRootDir, - projectDir = noteGenerator.projectDir; - - String get noteKey { - String result = path.dirname(path.relative(file.path, from: noteRootDir.path)); - return result == "." ? "/" : path.join("/", result); - } - - String get basename => path.basename(noteKey); - - // String get noteName => path.basenameWithoutExtension(file.path); - String get package => "package:$packageBaseName/${path.relative(file.path, from: libDir.path)}"; - - String get asset => "${path.relative(file.parent.path, from: projectDir.path)}/"; - - /// note name平整化,可作为变量名: - /// lib/notes/1.a/b/page.dart ---> a_b - String get asVariableName { - String dir = noteKey; - if (dir == "/") { - return "root"; - } - var names = dir.split(path.separator).where((e) => e.isNotEmpty); - return names - .map((e) => e - // ignore: unnecessary_string_escapes - .replaceAll(RegExp("^\\d+\."), "") // 1.z.about -> note_note-self - .replaceAll(".", "_") - .replaceAll("-", "_") - .replaceAll("&", "_") - .replaceAll("*", "_") - .replaceAll("*", "_") - .replaceAll("@", "_")) - .join("_"); - } - - File get noteConfFile => fs.file(file.parent.childFile("note.json")); - - File get noteGenConfFile => fs.file(file.parent.childFile("note.g.json")); - - String packageOf(String dartFileName) { - String noteLibDir = path.dirname(path.relative(file.path, from: libDir.path)); - return "package:$packageBaseName/$noteLibDir/$dartFileName"; - } - - Future gen() async { - String? noteConf = !await noteConfFile.exists() ? null : await noteConfFile.readAsString(); - String? noteGenConf = !await noteGenConfFile.exists() ? null : await noteGenConfFile.readAsString(); - _log("gen note.g.dart:$noteConfFile"); - var result = NoteParseResult.parse( - noteLib: this, - content: await file.readAsString(), - noteGenConfFile: noteGenConfFile, - noteConf: noteConf == null ? null : NoteConf.decode(noteConf), - noteGenConf: noteGenConf == null ? null : NoteGenConf.decode(noteGenConf), - fmt: noteGenerator._fmt, - ); - return result._gen(result._collectInfo()); - } -} - -enum _CellType { header, body, tail } - -typedef _CellInfo = ({ - String cellType, - int offset, - int end, - List cellStatements, - List< - ({ - String nodeType, - AstNode node, - })> specialNodes, -}); - -typedef _NoteInfo = ({ - String code, - List<_CellInfo> cells, -}); - -class NoteParseResult { - final NoteLib noteLib; - final DartFormatter fmt; - final NoteConf? noteConf; - final NoteGenConf? noteGenConf; - final File noteGenConfFile; - late final CompilationUnit unit; - late final String content; - - NoteParseResult.parse({ - required this.noteLib, - required this.fmt, - this.noteConf, - this.noteGenConf, - required this.noteGenConfFile, - required String content, - }) { - var parseResult = analyzer_util.parseString(content: content, featureSet: FeatureSet.latestLanguageVersion()); - unit = parseResult.unit; - this.content = parseResult.content; - } - - get file => noteLib.file; - - _NoteInfo _collectInfo() { - var buildFunc = unit.declarations.whereType().where((e) => "${e.name}" == "build"); - - if (buildFunc.isEmpty) { - _log(" ${noteLib.file.path} [build] function not found, so it is a empty note"); - return ( - code: content, - cells: [ - ( - cellType: _CellType.header.name, - offset: 0, - end: unit.end, - cellStatements: [], - specialNodes: [], - ) - ], - ); - } - - var buildBody = buildFunc.first.functionExpression.body; - assert(buildBody is BlockFunctionBody, "build() func only support Block Function, but(${buildBody.runtimeType})"); - var buildBodyBlock = (buildBody as BlockFunctionBody).block; - - List<_CellInfo> body = []; - List cellStatements = []; - int offset = buildBodyBlock.offset + 1; - for (var st in buildBodyBlock.statements) { - var statementType = _cellStatementType(st); - - // log("statement runtimeType:${st.runtimeType} - statementType:$statementType - offset:${st.offset} len:${st.length} end:${st.end} file.len:${content.length} ,unit.len:${unit.length} "); - // log("---${content.toString().safeSubstring(st.offset, st.offset + 20)}---"); - - if (statementType == _CellStatementType.normal) { - cellStatements.add(st); - continue; - } - if (statementType == _CellStatementType.line) { - // Submit previously collected statements first - // Cell boundary line without builder : code above line statements - // The line [cellStatementType.line] was ignored - - body.add(( - cellType: _CellType.body.name, - offset: offset, - end: st.offset, - cellStatements: cellStatements, - specialNodes: _collectRunInCellStatements(cellStatements), - )); - //reset collect - cellStatements = []; - - // The starting point of the new cell is located below the line statement - offset = st.end; - continue; - } - - throw Exception("not here! statementType:$statementType statement:$st"); - } - - // Finally, add a collectCellStatements to cell, as the last cell - body.add(( - cellType: _CellType.body.name, - offset: offset, - end: buildBodyBlock.rightBracket.offset, - cellStatements: cellStatements, - specialNodes: _collectRunInCellStatements(cellStatements), - )); - - // build(BuildContext context, Pen pen, MainCell print){ - // ↑_____________________________________________________↑_______________ - // findBuild.offset buildBodyBlock.leftBracket.end - // - // } // build end - // ↑_____________________________________________________ - // buildBodyBlock.rightBracket.offset - // - // } // build end - // _↑_____________________________________________________ - // findBuild.end - - return ( - code: content, - cells: [ - ( - cellType: _CellType.header.name, - offset: 0, - end: buildBodyBlock.leftBracket.end, - cellStatements: [], - specialNodes: [], - ), - ...body, - ( - cellType: _CellType.tail.name, - offset: buildBodyBlock.rightBracket.offset, - end: unit.end, - cellStatements: [], - specialNodes: [], - ) - ], - ); - } - - /// _cellStatementType.line : - /// ```dart - /// print.next(title:const Text("new cell-----------------")); - /// ``` - static _CellStatementType _cellStatementType(Statement statement) { - if (statement is! ExpressionStatement) { - return _CellStatementType.normal; - } - var expression = statement.expression; - - if (expression is! MethodInvocation) { - return _CellStatementType.normal; - } - // print( - // "_cellStatementType expression.target?.staticType: ${expression.target}"); - // print.next(title:const Text("new cell-----------------")) - if (expression.target?.toString() != "print") { - return _CellStatementType.normal; - } - // print( - // "_cellStatementType expression.methodName.name: ${expression.methodName.name}"); - if (expression.methodName.name != "next") { - return _CellStatementType.normal; - } - - return _CellStatementType.line; - } - - /* - // ignore: always_use_package_imports - import 'page.dart'; - - final noteInfo = ( - meta: page, - cells: [ - /// - (cellType: 'header', offset: 0, end: 255), - ], - code: - "" - ); - */ - Future _gen(_NoteInfo source) async { - var cells = source.cells.map((e) { - var comment = e.cellStatements.map((e) => strings.safeSubstring(e.toString().replaceAll("\n", " "), 0, 30)); - - var specialNodes = e.specialNodes.map((e) => """ - ( - nodeType: '${e.nodeType}', - offset: ${e.node.offset}, - end: ${e.node.end}, - ) - """).join(","); - return """ - /// $comment - ( - cellType:'${e.cellType}', - offset:${e.offset}, - end:${e.end}, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[ $specialNodes ] , - ) - """; - }).join(","); - Library lib = Library((b) => b - ..comments.addAll(["Generated by github.com/chen56/note, please don't edit! "]) - ..body.add( - code.Block((b) => b - ..statements.addAll([ - Code(''' - noteInfo() => ( - cells: [ $cells ], - ); - '''), - ])), - )); - - DartEmitter emitter = DartEmitter( - allocator: Allocator.none, - orderDirectives: true, - useNullSafetySyntax: true, - ); - String content = lib.accept(emitter).toString(); - File writeTo = noteLib.file.parent.childFile("note.g.dart"); - // write file - // 写2次文件,方便调试,如果格式化出错,还可以看下上面未格式化的版本看看哪错了 - await writeTo.writeAsString(content); - await writeTo.writeAsString(fmt.format(content)); - return this; - } - - static List<({String nodeType, AstNode node})> _collectRunInCellStatements(List topLevelCellStatements) { - List<({String nodeType, AstNode node})> collected = List.empty(growable: true); - List collectors = [_FindRunInCell(collected), _FindMateSampleStatement(collected)]; - for (var st in topLevelCellStatements) { - for (AstVisitor collector in collectors) { - st.visitChildren(collector); - } - } - return collected; - } - - @override - String toString() { - return "$file"; - } -} - -_log(Object? o) { - // ignore: avoid_print - print("${DateTime.now()} - $o"); -} - -enum _CellStatementType { - /// cell split line statement - line, - - /// normal statement , not a cell split statement - normal, -} - -Statement _findFirstParentStatement(AstNode node) { - if (node is Statement) return node; - return _findFirstParentStatement(node.parent!); -} - -class _FindRunInCell extends GeneralizingAstVisitor { - static const String nodeType = "Pen.runInCurrentCell"; - final List< - ({ - String nodeType, - AstNode node, - })> collect; - - _FindRunInCell(this.collect); - - @override - visitMethodInvocation(MethodInvocation node) { - var targetType = node.target?.staticType?.getDisplayString(withNullability: false); - if (targetType == "Pen" && node.methodName.name == "runInCurrentCell") { - collect.add((nodeType: nodeType, node: _findFirstParentStatement(node))); - } - return super.visitMethodInvocation(node); - } -} - -class _FindMateSampleStatement extends GeneralizingAstVisitor { - static const String nodeType = "MateSample.new.firstParentStatement"; - - final List<({String nodeType, AstNode node})> collect; - - _FindMateSampleStatement(this.collect); - - @override - visitInstanceCreationExpression(InstanceCreationExpression node) { - // todo careful , this api is change from name to name2, not check - if ("${node.constructorName.type.name2}" == "MateSample") { - collect.add((nodeType: nodeType, node: _findFirstParentStatement(node))); - } - return super.visitInstanceCreationExpression(node); - } -} - -class Pubspec { - static const _yamlePathAssets = ["flutter", "assets"]; - late final YamlEditor _yamlEditor; - late List _assetsCache; - - File file; - - static Future parseFile(File file) async { - String content = await file.readAsString(); - return Pubspec._(file, content); - } - - Pubspec._(this.file, String content) { - _yamlEditor = YamlEditor(content); - _assetsCache = assets; - } - - List get assets { - return (_yamlEditor.parseAt(_yamlePathAssets) as List).map((e) => "$e").toList(); - } - - void noteAssetsRemove(String noteAsset) { - _yamlEditor.remove([..._yamlePathAssets, assets.indexOf(noteAsset)]); - } - - void noteAssetsAdd(String noteAsset) { - if (assets.contains(noteAsset)) return; - _yamlEditor.appendToList([..._yamlePathAssets], noteAsset); - } - - /// 1. remove previously Generated - /// 2. add new - void noteAssetsUpdate(List toUpdate) { - var toAdd = List.from(toUpdate, growable: true); - - var oldAssets = assets; - var removed = 0; - for (int i = 0; i < oldAssets.length; i++) { - var oldAsset = oldAssets[i]; - // manual config, leave it - // lib/notes is our Generated - if (!oldAsset.startsWith("lib/notes")) { - continue; - } - // our Generated, no change , no need to repeat add - if (toAdd.contains(oldAsset)) { - toAdd.remove(oldAsset); - continue; - } - - // prefix lib/notes is previously Generated ,and now not exists - _yamlEditor.remove([..._yamlePathAssets, i - removed]); - removed++; - } - for (var add in toAdd) { - _yamlEditor.appendToList(_yamlePathAssets, add); - } - } - - Future save() async { - const ListEquality listEquality = ListEquality(); - // no change , no need to save - if (listEquality.equals(_assetsCache, assets)) { - _log("_assetsCache no change , no need to save"); - return Future.value(file); - } - return file.writeAsString(_yamlEditor.toString()); - } - - @override - String toString() { - return _yamlEditor.toString(); - } -} diff --git a/notes/flutter_web/lib/app.dart b/notes/flutter_web/lib/app.dart new file mode 100644 index 00000000..b01186fc --- /dev/null +++ b/notes/flutter_web/lib/app.dart @@ -0,0 +1,31 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_web/routes.g.dart'; +import 'package:you_flutter/better_ui.dart'; +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: routes.root, + initial: routes.routes_root.toUri(), + navigatorKey: GlobalKey(debugLabel: "mainNavigator"), +); +class App extends StatelessWidget { + final NoteSystem noteSystem; + final SharedPreferences sharedPreferences; + + // ignore: prefer_const_constructors_in_immutables + App({super.key, required this.noteSystem, required this.sharedPreferences}); + + @override + Widget build(BuildContext context) { + return MaterialApp.router( + title: "flutter note", + theme: ThemeData(colorScheme: ColorScheme.fromSeed(seedColor: Colors.tealAccent.shade700, brightness: Brightness.light), useMaterial3: true), + darkTheme: ThemeData(colorScheme: ColorScheme.fromSeed(seedColor: ColorSeed.m3baseline.color, brightness: Brightness.dark), useMaterial3: true), + routerConfig: router.config(), + ); + } +} diff --git a/notes/flutter_web/lib/main.dart b/notes/flutter_web/lib/main.dart index 0750fb67..855ef4f1 100644 --- a/notes/flutter_web/lib/main.dart +++ b/notes/flutter_web/lib/main.dart @@ -1,13 +1,12 @@ import 'package:flutter/material.dart'; -import 'package:flutter_web/notes.g.dart'; -import 'package:you_note_dart/note.dart'; -import 'package:flutter_web/note_app.dart'; import 'package:shared_preferences/shared_preferences.dart'; +import 'package:flutter_web/app.dart'; +import 'package:you_note_dart/note.dart'; + void main() async { WidgetsFlutterBinding.ensureInitialized(); - NoteSystem noteSystem = await NoteSystem.load( - root: BaseNotes.rootroot, - ); - SharedPreferences sharedPreferences = await SharedPreferences.getInstance(); - runApp(NoteApp(noteSystem: noteSystem, sharedPreferences: sharedPreferences)); + runApp(App( + sharedPreferences: await SharedPreferences.getInstance(), + noteSystem: NoteSystem(root: router.root), + )); } diff --git a/notes/flutter_web/lib/note_app.dart b/notes/flutter_web/lib/note_app.dart deleted file mode 100644 index b6712c02..00000000 --- a/notes/flutter_web/lib/note_app.dart +++ /dev/null @@ -1,116 +0,0 @@ -// part of "pages.g.dart"; -import 'package:flutter/material.dart'; -import 'package:you_note_dart/ui.dart'; -import 'package:you_note_dart/note_shell.dart'; -import 'package:you_note_dart/note.dart'; -import 'package:flutter_web/notes.g.dart'; -import 'package:shared_preferences/shared_preferences.dart'; - -// [ +4 ms] Font asset "MaterialIcons-Regular.otf" was tree-shaken, -// reducing it from 1645184 to 10272 bytes (99.4% reduction). -// Tree-shaking can be disabled by providing the --no-tree-shake-icons flag -// import 'package:mate_flutter/mate_icons.g.dart' as flutter_icons; - -// 试用了dart 3 record,没有自省功能,无法替换掉下面的强类型字段树,已提交需求: -// -// DART 3 Records Feature Requirement: Can it provide introspection capabilities similar to enum.values #2826 -// 需求被拒绝,自省会影响到dart的性能策略,只能另想办法, 目前使用代码生成 [tools/note_dev_gen.dart] - -// Path root = Path("/", meta: rootPage, kids: [ -// Path("not_found", meta: notFoundPage), -// Path("note", meta: notePage, kids: [ -// Path("welcome", meta: welcome, kids: [ -// Path("z.about", meta: page), -// ]), -// Path("layout", meta: layoutNote), -// Path("material", kids: [ -// Path("overview", kids: [ -// Path("ElevatedButton", meta: widgetElevatedButtonNote), -// ]), -// Path("text", kids: [ -// Path("RichText", meta: widgetTextNote), -// ]), -// Path("slider", meta: widgetSliderNote), -// ]), -// Path("state", kids: [ -// Path("1.vanilla_state", meta: vanillaStateNote), -// Path("StatefulBuilder", meta: widgetStatefulBuilderNote), -// ]), -// Path("dev", kids: [ -// Path("debug", meta: devDebugNote), -// Path("host_mirror", meta: devMirrorNote), -// ]), -// ]), -// ]); - -@immutable -class Notes extends BaseNotes with Navigable { - final SharedPreferences sharedPreferences; - final NoteSystem noteSystem; - Notes({ - required this.sharedPreferences, - required this.noteSystem, - }) ; - - @override - Screen get initial { - if(Uri.base.isScheme("http")||Uri.base.isScheme("https")){ - // flutter use fragment as navigator path - // http://localhost:8888/you/flutter_web/#/env_info - return switchTo(Uri.base.fragment.toString()); - } - - // 如果最后一个页面卡bug了,按存储恢复时,会卡在这个bug页面上 - // String? last = sharedPreferences.getString("flutter_web.notes.location"); - // if (last == null) { - // return switchTo(widgets_container_widgets_bar.path); - // } - // if (BaseNotes.rootroot.contains(last)) { - // return switchTo(last); - // } - - return switchTo(pure_dart_execption.path); - } - - @override - Screen switchTo(String location) { - assert(BaseNotes.rootroot.contains(location), - "location($location) not found! ${BaseNotes.rootroot.toList()}"); - NoteRoute find = BaseNotes.rootroot.child(location)!; // ?? notFound; - sharedPreferences.setString("flutter_web.notes.location", location); - // sync mode - // return find.createScreen(location); - // async mode - return DeferredScreen(noteRoute: find, noteSystem: noteSystem); - } -} - -class NoteApp extends StatelessWidget { - final NoteSystem noteSystem; - final SharedPreferences sharedPreferences; - // ignore: prefer_const_constructors_in_immutables - NoteApp({super.key, required this.noteSystem, required this.sharedPreferences}); - - @override - Widget build(BuildContext context) { - // BaseNotes.rootroot这个设计临时的,可以改善 - - Notes notes = Notes( - noteSystem: noteSystem, - sharedPreferences: sharedPreferences); - - notes.root.configTree(extendLevel: 2); - - var routerApp = MaterialApp.router( - title: 'Flutter Note', - theme: ThemeData( - primarySwatch: Colors.indigo, - useMaterial3: true, - ), - routerConfig: NavigatorV2.config( - navigable: notes, - ), - ); - return routerApp; - } -} diff --git a/notes/flutter_web/lib/notes.g.dart b/notes/flutter_web/lib/notes.g.dart deleted file mode 100644 index 873e786e..00000000 --- a/notes/flutter_web/lib/notes.g.dart +++ /dev/null @@ -1,119 +0,0 @@ -import 'package:you_note_dart/note.dart'; - -// Generated by gen_maters.dart, please don't edit! -// ignore_for_file: library_prefixes, non_constant_identifier_names - -import 'package:flutter_web/notes/dev/debug/note.dart' deferred as dev_debug_; -import 'package:flutter_web/notes/dev/devtool/note.dart' deferred as dev_devtool_; -import 'package:flutter_web/notes/dev/devtool/vmservice/note.dart' deferred as dev_devtool_vmservice_; -import 'package:flutter_web/notes/dev/host_mirror/note.dart' deferred as dev_host_mirror_; -import 'package:flutter_web/notes/dev/macos_config/note.dart' deferred as dev_macos_config_; -import 'package:flutter_web/notes/env_info/note.dart' deferred as env_info_; -import 'package:flutter_web/notes/i18n/note.dart' deferred as i18n_; -import 'package:flutter_web/notes/Improve_app/1.overview/note.dart' deferred as Improve_app_overview_; -import 'package:flutter_web/notes/Improve_app/event&listener&lifeycle/note.dart' deferred as Improve_app_event_listener_lifeycle_; -import 'package:flutter_web/notes/Improve_app/note.dart' deferred as Improve_app_; -import 'package:flutter_web/notes/Improve_app/RepaintBoundary/note.dart' deferred as Improve_app_RepaintBoundary_; -import 'package:flutter_web/notes/Improve_app/web_optimization/note.dart' deferred as Improve_app_web_optimization_; -import 'package:flutter_web/notes/layout/box_layout/constraints/note.dart' deferred as layout_box_layout_constraints_; -import 'package:flutter_web/notes/layout/note.dart' deferred as layout_; -import 'package:flutter_web/notes/layout/old/layout/note.dart' deferred as layout_old_layout_; -import 'package:flutter_web/notes/layout/responsive_design/note.dart' deferred as layout_responsive_design_; -import 'package:flutter_web/notes/media&assets&file/assets/note.dart' deferred as media_assets_file_assets_; -import 'package:flutter_web/notes/media&assets&file/file_desktop/note.dart' deferred as media_assets_file_file_desktop_; -import 'package:flutter_web/notes/media&assets&file/file_web/note.dart' deferred as media_assets_file_file_web_; -import 'package:flutter_web/notes/navigation/note.dart' deferred as navigation_; -import 'package:flutter_web/notes/note.dart' deferred as root_; -import 'package:flutter_web/notes/pure_dart/analyzer/note.dart' deferred as pure_dart_analyzer_; -import 'package:flutter_web/notes/pure_dart/async/note.dart' deferred as pure_dart_async_; -import 'package:flutter_web/notes/pure_dart/dart3/note.dart' deferred as pure_dart_dart3_; -import 'package:flutter_web/notes/pure_dart/execption/note.dart' deferred as pure_dart_execption_; -import 'package:flutter_web/notes/pure_dart/safe_interface/note.dart' deferred as pure_dart_safe_interface_; -import 'package:flutter_web/notes/pure_dart/serialization_json/note.dart' deferred as pure_dart_serialization_json_; -import 'package:flutter_web/notes/research/remote_view/note.dart' deferred as research_remote_view_; -import 'package:flutter_web/notes/research/research_parameterized_example/note.dart' deferred as research_research_parameterized_example_; -import 'package:flutter_web/notes/state/1.vanilla_state/note.dart' deferred as state_vanilla_state_; -import 'package:flutter_web/notes/state/note.dart' deferred as state_; -import 'package:flutter_web/notes/state/StatefulBuilder/note.dart' deferred as state_StatefulBuilder_; -import 'package:flutter_web/notes/style&theming/material3/note.dart' deferred as style_theming_material3_; -import 'package:flutter_web/notes/thinking_in_ui/readable_html_vs_dart/note.dart' deferred as thinking_in_ui_readable_html_vs_dart_; -import 'package:flutter_web/notes/widgets/container_widgets/bar/note.dart' deferred as widgets_container_widgets_bar_; -import 'package:flutter_web/notes/widgets/container_widgets/menu/note.dart' deferred as widgets_container_widgets_menu_; -import 'package:flutter_web/notes/widgets/container_widgets/scrollable/Dismissible/note.dart' deferred as widgets_container_widgets_scrollable_Dismissible_; -import 'package:flutter_web/notes/widgets/specific_widgets/button/ButtonStyleButton/note.dart' deferred as widgets_specific_widgets_button_ButtonStyleButton_; -import 'package:flutter_web/notes/widgets/specific_widgets/button/FloatingActionButton/note.dart' deferred as widgets_specific_widgets_button_FloatingActionButton_; -import 'package:flutter_web/notes/widgets/specific_widgets/button/IconButton/note.dart' deferred as widgets_specific_widgets_button_IconButton_; -import 'package:flutter_web/notes/widgets/specific_widgets/button/overview/note.dart' deferred as widgets_specific_widgets_button_overview_; -import 'package:flutter_web/notes/widgets/specific_widgets/icon/note.dart' deferred as widgets_specific_widgets_icon_; -import 'package:flutter_web/notes/widgets/specific_widgets/input/note.dart' deferred as widgets_specific_widgets_input_; -import 'package:flutter_web/notes/widgets/specific_widgets/selectable/note.dart' deferred as widgets_specific_widgets_selectable_; -import 'package:flutter_web/notes/widgets/specific_widgets/slider/note.dart' deferred as widgets_specific_widgets_slider_; -import 'package:flutter_web/notes/widgets/specific_widgets/text/RichText/note.dart' deferred as widgets_specific_widgets_text_RichText_; -import 'package:flutter_web/notes/widgets/specific_widgets/text/Text/note.dart' deferred as widgets_specific_widgets_text_Text_; -import 'package:flutter_web/notes/widgets/specific_widgets/webview/note.dart' deferred as widgets_specific_widgets_webview_; -import 'package:flutter_web/notes/x.note_inside/1.welcome/note.dart' deferred as x_note_inside_welcome_; -import 'package:flutter_web/notes/x.note_inside/how_note_work/note.dart' deferred as x_note_inside_how_note_work_; -import 'package:flutter_web/notes/x.note_inside/mockup_content/note.dart' deferred as x_note_inside_mockup_content_; -import 'package:flutter_web/notes/x.note_inside/note_test_self/nobody/note.dart' deferred as x_note_inside_note_test_self_nobody_; -import 'package:flutter_web/notes/x.note_inside/note_test_self/note.dart' deferred as x_note_inside_note_test_self_; - - -abstract class BaseNotes { - static final NoteRoute rootroot = NoteRoute.root(); - static NoteRoute put(String path, LazyNoteBuilder lazyNoteBuilder) { - return rootroot.put(path, lazyNoteBuilder); - } - final research_research_parameterized_example = put("/research/research_parameterized_example", (context,print) async => await research_research_parameterized_example_.loadLibrary().then((value) => research_research_parameterized_example_.build(context,print))); - final research_remote_view = put("/research/remote_view", (context,print) async => await research_remote_view_.loadLibrary().then((value) => research_remote_view_.build(context,print))); - final env_info = put("/env_info", (context,print) async => await env_info_.loadLibrary().then((value) => env_info_.build(context,print))); - final layout_old_layout = put("/layout/old/layout", (context,print) async => await layout_old_layout_.loadLibrary().then((value) => layout_old_layout_.build(context,print))); - final layout_box_layout_constraints = put("/layout/box_layout/constraints", (context,print) async => await layout_box_layout_constraints_.loadLibrary().then((value) => layout_box_layout_constraints_.build(context,print))); - final layout_responsive_design = put("/layout/responsive_design", (context,print) async => await layout_responsive_design_.loadLibrary().then((value) => layout_responsive_design_.build(context,print))); - final layout = put("/layout", (context,print) async => await layout_.loadLibrary().then((value) => layout_.build(context,print))); - final navigation = put("/navigation", (context,print) async => await navigation_.loadLibrary().then((value) => navigation_.build(context,print))); - final state_vanilla_state = put("/state/1.vanilla_state", (context,print) async => await state_vanilla_state_.loadLibrary().then((value) => state_vanilla_state_.build(context,print))); - final state = put("/state", (context,print) async => await state_.loadLibrary().then((value) => state_.build(context,print))); - final state_StatefulBuilder = put("/state/StatefulBuilder", (context,print) async => await state_StatefulBuilder_.loadLibrary().then((value) => state_StatefulBuilder_.build(context,print))); - final media_assets_file_file_desktop = put("/media&assets&file/file_desktop", (context,print) async => await media_assets_file_file_desktop_.loadLibrary().then((value) => media_assets_file_file_desktop_.build(context,print))); - final media_assets_file_file_web = put("/media&assets&file/file_web", (context,print) async => await media_assets_file_file_web_.loadLibrary().then((value) => media_assets_file_file_web_.build(context,print))); - final media_assets_file_assets = put("/media&assets&file/assets", (context,print) async => await media_assets_file_assets_.loadLibrary().then((value) => media_assets_file_assets_.build(context,print))); - final style_theming_material3 = put("/style&theming/material3", (context,print) async => await style_theming_material3_.loadLibrary().then((value) => style_theming_material3_.build(context,print))); - final pure_dart_dart3 = put("/pure_dart/dart3", (context,print) async => await pure_dart_dart3_.loadLibrary().then((value) => pure_dart_dart3_.build(context,print))); - final pure_dart_async = put("/pure_dart/async", (context,print) async => await pure_dart_async_.loadLibrary().then((value) => pure_dart_async_.build(context,print))); - final pure_dart_safe_interface = put("/pure_dart/safe_interface", (context,print) async => await pure_dart_safe_interface_.loadLibrary().then((value) => pure_dart_safe_interface_.build(context,print))); - final pure_dart_execption = put("/pure_dart/execption", (context,print) async => await pure_dart_execption_.loadLibrary().then((value) => pure_dart_execption_.build(context,print))); - final pure_dart_serialization_json = put("/pure_dart/serialization_json", (context,print) async => await pure_dart_serialization_json_.loadLibrary().then((value) => pure_dart_serialization_json_.build(context,print))); - final pure_dart_analyzer = put("/pure_dart/analyzer", (context,print) async => await pure_dart_analyzer_.loadLibrary().then((value) => pure_dart_analyzer_.build(context,print))); - final dev_host_mirror = put("/dev/host_mirror", (context,print) async => await dev_host_mirror_.loadLibrary().then((value) => dev_host_mirror_.build(context,print))); - final dev_macos_config = put("/dev/macos_config", (context,print) async => await dev_macos_config_.loadLibrary().then((value) => dev_macos_config_.build(context,print))); - final dev_devtool_vmservice = put("/dev/devtool/vmservice", (context,print) async => await dev_devtool_vmservice_.loadLibrary().then((value) => dev_devtool_vmservice_.build(context,print))); - final dev_devtool = put("/dev/devtool", (context,print) async => await dev_devtool_.loadLibrary().then((value) => dev_devtool_.build(context,print))); - final dev_debug = put("/dev/debug", (context,print) async => await dev_debug_.loadLibrary().then((value) => dev_debug_.build(context,print))); - final root = put("/", (context,print) async => await root_.loadLibrary().then((value) => root_.build(context,print))); - final i18n = put("/i18n", (context,print) async => await i18n_.loadLibrary().then((value) => i18n_.build(context,print))); - final thinking_in_ui_readable_html_vs_dart = put("/thinking_in_ui/readable_html_vs_dart", (context,print) async => await thinking_in_ui_readable_html_vs_dart_.loadLibrary().then((value) => thinking_in_ui_readable_html_vs_dart_.build(context,print))); - final x_note_inside_how_note_work = put("/x.note_inside/how_note_work", (context,print) async => await x_note_inside_how_note_work_.loadLibrary().then((value) => x_note_inside_how_note_work_.build(context,print))); - final x_note_inside_mockup_content = put("/x.note_inside/mockup_content", (context,print) async => await x_note_inside_mockup_content_.loadLibrary().then((value) => x_note_inside_mockup_content_.build(context,print))); - final x_note_inside_welcome = put("/x.note_inside/1.welcome", (context,print) async => await x_note_inside_welcome_.loadLibrary().then((value) => x_note_inside_welcome_.build(context,print))); - final x_note_inside_note_test_self_nobody = put("/x.note_inside/note_test_self/nobody", (context,print) async => await x_note_inside_note_test_self_nobody_.loadLibrary().then((value) => x_note_inside_note_test_self_nobody_.build(context,print))); - final x_note_inside_note_test_self = put("/x.note_inside/note_test_self", (context,print) async => await x_note_inside_note_test_self_.loadLibrary().then((value) => x_note_inside_note_test_self_.build(context,print))); - final widgets_specific_widgets_input = put("/widgets/specific_widgets/input", (context,print) async => await widgets_specific_widgets_input_.loadLibrary().then((value) => widgets_specific_widgets_input_.build(context,print))); - final widgets_specific_widgets_webview = put("/widgets/specific_widgets/webview", (context,print) async => await widgets_specific_widgets_webview_.loadLibrary().then((value) => widgets_specific_widgets_webview_.build(context,print))); - final widgets_specific_widgets_slider = put("/widgets/specific_widgets/slider", (context,print) async => await widgets_specific_widgets_slider_.loadLibrary().then((value) => widgets_specific_widgets_slider_.build(context,print))); - final widgets_specific_widgets_selectable = put("/widgets/specific_widgets/selectable", (context,print) async => await widgets_specific_widgets_selectable_.loadLibrary().then((value) => widgets_specific_widgets_selectable_.build(context,print))); - final widgets_specific_widgets_button_ButtonStyleButton = put("/widgets/specific_widgets/button/ButtonStyleButton", (context,print) async => await widgets_specific_widgets_button_ButtonStyleButton_.loadLibrary().then((value) => widgets_specific_widgets_button_ButtonStyleButton_.build(context,print))); - final widgets_specific_widgets_button_FloatingActionButton = put("/widgets/specific_widgets/button/FloatingActionButton", (context,print) async => await widgets_specific_widgets_button_FloatingActionButton_.loadLibrary().then((value) => widgets_specific_widgets_button_FloatingActionButton_.build(context,print))); - final widgets_specific_widgets_button_IconButton = put("/widgets/specific_widgets/button/IconButton", (context,print) async => await widgets_specific_widgets_button_IconButton_.loadLibrary().then((value) => widgets_specific_widgets_button_IconButton_.build(context,print))); - final widgets_specific_widgets_button_overview = put("/widgets/specific_widgets/button/overview", (context,print) async => await widgets_specific_widgets_button_overview_.loadLibrary().then((value) => widgets_specific_widgets_button_overview_.build(context,print))); - final widgets_specific_widgets_text_RichText = put("/widgets/specific_widgets/text/RichText", (context,print) async => await widgets_specific_widgets_text_RichText_.loadLibrary().then((value) => widgets_specific_widgets_text_RichText_.build(context,print))); - final widgets_specific_widgets_text_Text = put("/widgets/specific_widgets/text/Text", (context,print) async => await widgets_specific_widgets_text_Text_.loadLibrary().then((value) => widgets_specific_widgets_text_Text_.build(context,print))); - final widgets_specific_widgets_icon = put("/widgets/specific_widgets/icon", (context,print) async => await widgets_specific_widgets_icon_.loadLibrary().then((value) => widgets_specific_widgets_icon_.build(context,print))); - final widgets_container_widgets_menu = put("/widgets/container_widgets/menu", (context,print) async => await widgets_container_widgets_menu_.loadLibrary().then((value) => widgets_container_widgets_menu_.build(context,print))); - final widgets_container_widgets_scrollable_Dismissible = put("/widgets/container_widgets/scrollable/Dismissible", (context,print) async => await widgets_container_widgets_scrollable_Dismissible_.loadLibrary().then((value) => widgets_container_widgets_scrollable_Dismissible_.build(context,print))); - final widgets_container_widgets_bar = put("/widgets/container_widgets/bar", (context,print) async => await widgets_container_widgets_bar_.loadLibrary().then((value) => widgets_container_widgets_bar_.build(context,print))); - final Improve_app_overview = put("/Improve_app/1.overview", (context,print) async => await Improve_app_overview_.loadLibrary().then((value) => Improve_app_overview_.build(context,print))); - final Improve_app_web_optimization = put("/Improve_app/web_optimization", (context,print) async => await Improve_app_web_optimization_.loadLibrary().then((value) => Improve_app_web_optimization_.build(context,print))); - final Improve_app_RepaintBoundary = put("/Improve_app/RepaintBoundary", (context,print) async => await Improve_app_RepaintBoundary_.loadLibrary().then((value) => Improve_app_RepaintBoundary_.build(context,print))); - final Improve_app = put("/Improve_app", (context,print) async => await Improve_app_.loadLibrary().then((value) => Improve_app_.build(context,print))); - final Improve_app_event_listener_lifeycle = put("/Improve_app/event&listener&lifeycle", (context,print) async => await Improve_app_event_listener_lifeycle_.loadLibrary().then((value) => Improve_app_event_listener_lifeycle_.build(context,print))); -} diff --git a/notes/flutter_web/lib/notes/Improve_app/1.overview/note.g.dart b/notes/flutter_web/lib/notes/Improve_app/1.overview/note.g.dart deleted file mode 100644 index 074b54ee..00000000 --- a/notes/flutter_web/lib/notes/Improve_app/1.overview/note.g.dart +++ /dev/null @@ -1,41 +0,0 @@ -// Generated by github.com/chen56/note, please don't edit! - -noteInfo() => ( - children: [ - /// () - ( - cellType: 'header', - offset: 0, - end: 129, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// (print(const MD(r''' # 完善应用概览 ) - ( - cellType: 'body', - offset: 129, - end: 210, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// () - ( - cellType: 'tail', - offset: 210, - end: 212, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ) - ], - ); diff --git a/notes/flutter_web/lib/notes/Improve_app/1.overview/note.g.json b/notes/flutter_web/lib/notes/Improve_app/1.overview/note.g.json deleted file mode 100644 index 6511b978..00000000 --- a/notes/flutter_web/lib/notes/Improve_app/1.overview/note.g.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "/* note.g.json */": { - "zh-CN": "❗重要配置❗,由github.com/chen56/note生成,一个笔记一个目录,每个目录都生成一个note.g.json,用来记录这篇笔记的重要元数据,比如生成note的uri, 文件应被保存在版本控制中,比如git,不应编辑或移动此文件。 ", - "en": "❗ Important configuration ❗, generated by the github.com/chen56/note, one directory for each one note, note.g.json to record the important metadata of the note, for example generate the uri of note , the file should be saved in version control, such as git, and this file should not be edited or moved." - }, - "noteId": 50 -} \ No newline at end of file diff --git a/notes/flutter_web/lib/notes/Improve_app/RepaintBoundary/note.g.dart b/notes/flutter_web/lib/notes/Improve_app/RepaintBoundary/note.g.dart deleted file mode 100644 index 1cc1bcfa..00000000 --- a/notes/flutter_web/lib/notes/Improve_app/RepaintBoundary/note.g.dart +++ /dev/null @@ -1,41 +0,0 @@ -// Generated by github.com/chen56/note, please don't edit! - -noteInfo() => ( - children: [ - /// () - ( - cellType: 'header', - offset: 0, - end: 129, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// (print(const MD(r''' # RepaintB) - ( - cellType: 'body', - offset: 129, - end: 214, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// () - ( - cellType: 'tail', - offset: 214, - end: 216, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ) - ], - ); diff --git a/notes/flutter_web/lib/notes/Improve_app/RepaintBoundary/note.g.json b/notes/flutter_web/lib/notes/Improve_app/RepaintBoundary/note.g.json deleted file mode 100644 index 8b30069d..00000000 --- a/notes/flutter_web/lib/notes/Improve_app/RepaintBoundary/note.g.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "/* note.g.json */": { - "zh-CN": "❗重要配置❗,由github.com/chen56/note生成,一个笔记一个目录,每个目录都生成一个note.g.json,用来记录这篇笔记的重要元数据,比如生成note的uri, 文件应被保存在版本控制中,比如git,不应编辑或移动此文件。 ", - "en": "❗ Important configuration ❗, generated by the github.com/chen56/note, one directory for each one note, note.g.json to record the important metadata of the note, for example generate the uri of note , the file should be saved in version control, such as git, and this file should not be edited or moved." - }, - "noteId": 52 -} \ No newline at end of file diff --git a/notes/flutter_web/lib/notes/Improve_app/event&listener&lifeycle/note.g.dart b/notes/flutter_web/lib/notes/Improve_app/event&listener&lifeycle/note.g.dart deleted file mode 100644 index e620ad67..00000000 --- a/notes/flutter_web/lib/notes/Improve_app/event&listener&lifeycle/note.g.dart +++ /dev/null @@ -1,41 +0,0 @@ -// Generated by github.com/chen56/note, please don't edit! - -noteInfo() => ( - children: [ - /// () - ( - cellType: 'header', - offset: 0, - end: 129, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// (print(const MD(r''' # 事件监听&生命期) - ( - cellType: 'body', - offset: 129, - end: 271, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// () - ( - cellType: 'tail', - offset: 271, - end: 273, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ) - ], - ); diff --git a/notes/flutter_web/lib/notes/Improve_app/event&listener&lifeycle/note.g.json b/notes/flutter_web/lib/notes/Improve_app/event&listener&lifeycle/note.g.json deleted file mode 100644 index cc9167f2..00000000 --- a/notes/flutter_web/lib/notes/Improve_app/event&listener&lifeycle/note.g.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "/* note.g.json */": { - "zh-CN": "❗重要配置❗,由github.com/chen56/note生成,一个笔记一个目录,每个目录都生成一个note.g.json,用来记录这篇笔记的重要元数据,比如生成note的uri, 文件应被保存在版本控制中,比如git,不应编辑或移动此文件。 ", - "en": "❗ Important configuration ❗, generated by the github.com/chen56/note, one directory for each one note, note.g.json to record the important metadata of the note, for example generate the uri of note , the file should be saved in version control, such as git, and this file should not be edited or moved." - }, - "noteId": 54 -} \ No newline at end of file diff --git a/notes/flutter_web/lib/notes/Improve_app/note.g.dart b/notes/flutter_web/lib/notes/Improve_app/note.g.dart deleted file mode 100644 index 423ae444..00000000 --- a/notes/flutter_web/lib/notes/Improve_app/note.g.dart +++ /dev/null @@ -1,41 +0,0 @@ -// Generated by github.com/chen56/note, please don't edit! - -noteInfo() => ( - children: [ - /// () - ( - cellType: 'header', - offset: 0, - end: 129, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// (print(const MD(r''' # 完善应用 基本) - ( - cellType: 'body', - offset: 129, - end: 208, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// () - ( - cellType: 'tail', - offset: 208, - end: 210, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ) - ], - ); diff --git a/notes/flutter_web/lib/notes/Improve_app/note.g.json b/notes/flutter_web/lib/notes/Improve_app/note.g.json deleted file mode 100644 index b76046fb..00000000 --- a/notes/flutter_web/lib/notes/Improve_app/note.g.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "/* note.g.json */": { - "zh-CN": "❗重要配置❗,由github.com/chen56/note生成,一个笔记一个目录,每个目录都生成一个note.g.json,用来记录这篇笔记的重要元数据,比如生成note的uri, 文件应被保存在版本控制中,比如git,不应编辑或移动此文件。 ", - "en": "❗ Important configuration ❗, generated by the github.com/chen56/note, one directory for each one note, note.g.json to record the important metadata of the note, for example generate the uri of note , the file should be saved in version control, such as git, and this file should not be edited or moved." - }, - "noteId": 53 -} \ No newline at end of file diff --git a/notes/flutter_web/lib/notes/Improve_app/web_optimization/note.g.dart b/notes/flutter_web/lib/notes/Improve_app/web_optimization/note.g.dart deleted file mode 100644 index a421cf0e..00000000 --- a/notes/flutter_web/lib/notes/Improve_app/web_optimization/note.g.dart +++ /dev/null @@ -1,41 +0,0 @@ -// Generated by github.com/chen56/note, please don't edit! - -noteInfo() => ( - children: [ - /// () - ( - cellType: 'header', - offset: 0, - end: 161, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// (print(const MD(r''' # web 优化 , print("ss");) - ( - cellType: 'body', - offset: 161, - end: 1326, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// () - ( - cellType: 'tail', - offset: 1326, - end: 1328, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ) - ], - ); diff --git a/notes/flutter_web/lib/notes/Improve_app/web_optimization/note.g.json b/notes/flutter_web/lib/notes/Improve_app/web_optimization/note.g.json deleted file mode 100644 index a29b8964..00000000 --- a/notes/flutter_web/lib/notes/Improve_app/web_optimization/note.g.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "/* note.g.json */": { - "zh-CN": "❗重要配置❗,由github.com/chen56/note生成,一个笔记一个目录,每个目录都生成一个note.g.json,用来记录这篇笔记的重要元数据,比如生成note的uri, 文件应被保存在版本控制中,比如git,不应编辑或移动此文件。 ", - "en": "❗ Important configuration ❗, generated by the github.com/chen56/note, one directory for each one note, note.g.json to record the important metadata of the note, for example generate the uri of note , the file should be saved in version control, such as git, and this file should not be edited or moved." - }, - "noteId": 51 -} \ No newline at end of file diff --git a/notes/flutter_web/lib/notes/dev/debug/note.g.dart b/notes/flutter_web/lib/notes/dev/debug/note.g.dart deleted file mode 100644 index 3bbbfb86..00000000 --- a/notes/flutter_web/lib/notes/dev/debug/note.g.dart +++ /dev/null @@ -1,41 +0,0 @@ -// Generated by github.com/chen56/note, please don't edit! - -noteInfo() => ( - children: [ - /// () - ( - cellType: 'header', - offset: 0, - end: 135, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// (print(const MD(r''' ## 打印组件树 ) - ( - cellType: 'body', - offset: 135, - end: 355, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// () - ( - cellType: 'tail', - offset: 355, - end: 357, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ) - ], - ); diff --git a/notes/flutter_web/lib/notes/dev/debug/note.g.json b/notes/flutter_web/lib/notes/dev/debug/note.g.json deleted file mode 100644 index e31d841f..00000000 --- a/notes/flutter_web/lib/notes/dev/debug/note.g.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "/* note.g.json */": { - "zh-CN": "❗重要配置❗,由github.com/chen56/note生成,一个笔记一个目录,每个目录都生成一个note.g.json,用来记录这篇笔记的重要元数据,比如生成note的uri, 文件应被保存在版本控制中,比如git,不应编辑或移动此文件。 ", - "en": "❗ Important configuration ❗, generated by the github.com/chen56/note, one directory for each one note, note.g.json to record the important metadata of the note, for example generate the uri of note , the file should be saved in version control, such as git, and this file should not be edited or moved." - }, - "noteId": 20 -} \ No newline at end of file diff --git a/notes/flutter_web/lib/notes/dev/devtool/note.g.dart b/notes/flutter_web/lib/notes/dev/devtool/note.g.dart deleted file mode 100644 index eb79790e..00000000 --- a/notes/flutter_web/lib/notes/dev/devtool/note.g.dart +++ /dev/null @@ -1,41 +0,0 @@ -// Generated by github.com/chen56/note, please don't edit! - -noteInfo() => ( - children: [ - /// () - ( - cellType: 'header', - offset: 0, - end: 129, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// (print(const MD(r''' # devtool ) - ( - cellType: 'body', - offset: 129, - end: 227, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// () - ( - cellType: 'tail', - offset: 227, - end: 229, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ) - ], - ); diff --git a/notes/flutter_web/lib/notes/dev/devtool/note.g.json b/notes/flutter_web/lib/notes/dev/devtool/note.g.json deleted file mode 100644 index 2a8b87e1..00000000 --- a/notes/flutter_web/lib/notes/dev/devtool/note.g.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "/* note.g.json */": { - "zh-CN": "❗重要配置❗,由github.com/chen56/note生成,一个笔记一个目录,每个目录都生成一个note.g.json,用来记录这篇笔记的重要元数据,比如生成note的uri, 文件应被保存在版本控制中,比如git,不应编辑或移动此文件。 ", - "en": "❗ Important configuration ❗, generated by the github.com/chen56/note, one directory for each one note, note.g.json to record the important metadata of the note, for example generate the uri of note , the file should be saved in version control, such as git, and this file should not be edited or moved." - }, - "noteId": 19 -} \ No newline at end of file diff --git a/notes/flutter_web/lib/notes/dev/devtool/vmservice/note.g.dart b/notes/flutter_web/lib/notes/dev/devtool/vmservice/note.g.dart deleted file mode 100644 index cae1a5f9..00000000 --- a/notes/flutter_web/lib/notes/dev/devtool/vmservice/note.g.dart +++ /dev/null @@ -1,41 +0,0 @@ -// Generated by github.com/chen56/note, please don't edit! - -noteInfo() => ( - children: [ - /// () - ( - cellType: 'header', - offset: 0, - end: 160, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// (print(const MD(r''' # VM Servi, print = print.next(title: cons, var serviceInfo = await Servic, ..., print("serviceInfo.minorVersio, print('🔥🖼️✗✓🔨💪✏️');) - ( - cellType: 'body', - offset: 160, - end: 1740, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// () - ( - cellType: 'tail', - offset: 1740, - end: 1742, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ) - ], - ); diff --git a/notes/flutter_web/lib/notes/dev/devtool/vmservice/note.g.json b/notes/flutter_web/lib/notes/dev/devtool/vmservice/note.g.json deleted file mode 100644 index 733c60cc..00000000 --- a/notes/flutter_web/lib/notes/dev/devtool/vmservice/note.g.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "/* note.g.json */": { - "zh-CN": "❗重要配置❗,由github.com/chen56/note生成,一个笔记一个目录,每个目录都生成一个note.g.json,用来记录这篇笔记的重要元数据,比如生成note的uri, 文件应被保存在版本控制中,比如git,不应编辑或移动此文件。 ", - "en": "❗ Important configuration ❗, generated by the github.com/chen56/note, one directory for each one note, note.g.json to record the important metadata of the note, for example generate the uri of note , the file should be saved in version control, such as git, and this file should not be edited or moved." - }, - "noteId": 18 -} \ No newline at end of file diff --git a/notes/flutter_web/lib/notes/dev/host_mirror/note.g.dart b/notes/flutter_web/lib/notes/dev/host_mirror/note.g.dart deleted file mode 100644 index c71d5349..00000000 --- a/notes/flutter_web/lib/notes/dev/host_mirror/note.g.dart +++ /dev/null @@ -1,41 +0,0 @@ -// Generated by github.com/chen56/note, please don't edit! - -noteInfo() => ( - children: [ - /// () - ( - cellType: 'header', - offset: 0, - end: 129, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// (print(const MD(r''' ## flutte) - ( - cellType: 'body', - offset: 129, - end: 2961, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// () - ( - cellType: 'tail', - offset: 2961, - end: 2963, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ) - ], - ); diff --git a/notes/flutter_web/lib/notes/dev/host_mirror/note.g.json b/notes/flutter_web/lib/notes/dev/host_mirror/note.g.json deleted file mode 100644 index 8cdda128..00000000 --- a/notes/flutter_web/lib/notes/dev/host_mirror/note.g.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "/* note.g.json */": { - "zh-CN": "❗重要配置❗,由github.com/chen56/note生成,一个笔记一个目录,每个目录都生成一个note.g.json,用来记录这篇笔记的重要元数据,比如生成note的uri, 文件应被保存在版本控制中,比如git,不应编辑或移动此文件。 ", - "en": "❗ Important configuration ❗, generated by the github.com/chen56/note, one directory for each one note, note.g.json to record the important metadata of the note, for example generate the uri of note , the file should be saved in version control, such as git, and this file should not be edited or moved." - }, - "noteId": 16 -} \ No newline at end of file diff --git a/notes/flutter_web/lib/notes/dev/macos_config/note.g.dart b/notes/flutter_web/lib/notes/dev/macos_config/note.g.dart deleted file mode 100644 index f3bddfd7..00000000 --- a/notes/flutter_web/lib/notes/dev/macos_config/note.g.dart +++ /dev/null @@ -1,41 +0,0 @@ -// Generated by github.com/chen56/note, please don't edit! - -noteInfo() => ( - children: [ - /// () - ( - cellType: 'header', - offset: 0, - end: 130, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// (print(const MD(r''' # macos_co) - ( - cellType: 'body', - offset: 130, - end: 600, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// () - ( - cellType: 'tail', - offset: 600, - end: 602, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ) - ], - ); diff --git a/notes/flutter_web/lib/notes/dev/macos_config/note.g.json b/notes/flutter_web/lib/notes/dev/macos_config/note.g.json deleted file mode 100644 index bbeeef28..00000000 --- a/notes/flutter_web/lib/notes/dev/macos_config/note.g.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "/* note.g.json */": { - "zh-CN": "❗重要配置❗,由github.com/chen56/note生成,一个笔记一个目录,每个目录都生成一个note.g.json,用来记录这篇笔记的重要元数据,比如生成note的uri, 文件应被保存在版本控制中,比如git,不应编辑或移动此文件。 ", - "en": "❗ Important configuration ❗, generated by the github.com/chen56/note, one directory for each one note, note.g.json to record the important metadata of the note, for example generate the uri of note , the file should be saved in version control, such as git, and this file should not be edited or moved." - }, - "noteId": 17 -} \ No newline at end of file diff --git a/notes/flutter_web/lib/notes/env_info/note.g.dart b/notes/flutter_web/lib/notes/env_info/note.g.dart deleted file mode 100644 index 2b4d260e..00000000 --- a/notes/flutter_web/lib/notes/env_info/note.g.dart +++ /dev/null @@ -1,41 +0,0 @@ -// Generated by github.com/chen56/note, please don't edit! - -noteInfo() => ( - children: [ - /// () - ( - cellType: 'header', - offset: 0, - end: 250, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// (print(const MD(''' # Platform和, print = print.next(title: cons, ThemeData theme = Theme.of(con, ..., print = print.next(title: cons, if (kIsWeb) {print("web版无法使用环境) - ( - cellType: 'body', - offset: 250, - end: 3157, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// () - ( - cellType: 'tail', - offset: 3157, - end: 3159, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ) - ], - ); diff --git a/notes/flutter_web/lib/notes/env_info/note.g.json b/notes/flutter_web/lib/notes/env_info/note.g.json deleted file mode 100644 index fd5c4a4c..00000000 --- a/notes/flutter_web/lib/notes/env_info/note.g.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "/* note.g.json */": { - "zh-CN": "❗重要配置❗,由github.com/chen56/note生成,一个笔记一个目录,每个目录都生成一个note.g.json,用来记录这篇笔记的重要元数据,比如生成note的uri, 文件应被保存在版本控制中,比如git,不应编辑或移动此文件。 ", - "en": "❗ Important configuration ❗, generated by the github.com/chen56/note, one directory for each one note, note.g.json to record the important metadata of the note, for example generate the uri of note , the file should be saved in version control, such as git, and this file should not be edited or moved." - }, - "noteId": 25 -} \ No newline at end of file diff --git a/notes/flutter_web/lib/notes/i18n/note.g.dart b/notes/flutter_web/lib/notes/i18n/note.g.dart deleted file mode 100644 index 15acda3a..00000000 --- a/notes/flutter_web/lib/notes/i18n/note.g.dart +++ /dev/null @@ -1,41 +0,0 @@ -// Generated by github.com/chen56/note, please don't edit! - -noteInfo() => ( - children: [ - /// () - ( - cellType: 'header', - offset: 0, - end: 129, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// (print(const MD(r''' # 国际化i18n ) - ( - cellType: 'body', - offset: 129, - end: 172, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// () - ( - cellType: 'tail', - offset: 172, - end: 174, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ) - ], - ); diff --git a/notes/flutter_web/lib/notes/i18n/note.g.json b/notes/flutter_web/lib/notes/i18n/note.g.json deleted file mode 100644 index ff546df1..00000000 --- a/notes/flutter_web/lib/notes/i18n/note.g.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "/* note.g.json */": { - "zh-CN": "❗重要配置❗,由github.com/chen56/note生成,一个笔记一个目录,每个目录都生成一个note.g.json,用来记录这篇笔记的重要元数据,比如生成note的uri, 文件应被保存在版本控制中,比如git,不应编辑或移动此文件。 ", - "en": "❗ Important configuration ❗, generated by the github.com/chen56/note, one directory for each one note, note.g.json to record the important metadata of the note, for example generate the uri of note , the file should be saved in version control, such as git, and this file should not be edited or moved." - }, - "noteId": 22 -} \ No newline at end of file diff --git a/notes/flutter_web/lib/notes/layout/1.welcome/note.md b/notes/flutter_web/lib/notes/layout/1.welcome/note.md deleted file mode 100644 index 70a9fa4f..00000000 --- a/notes/flutter_web/lib/notes/layout/1.welcome/note.md +++ /dev/null @@ -1,98 +0,0 @@ -# box_layout layout - -## 常用 - -垂直&水平排列的组件 -- Flex: Flexbox布局模型,Flex(子类Row、Column)和Flexible(子类Expanded)组合 - - **Spacer**: - - Spacer组件内部包装了一个Expanded,在`Row`或`Column`布局中占位,可以根据主轴方向自动拉伸占据剩余空间,辅助调整布局间距。 -- **LayoutBuilder**: - - 它根据父组件提供的布局约束来动态构建其子组件,使子组件能够适应不同尺寸的屏幕或容器。 -- **填充大小相关**: - - **FittedBox**: - `FittedBox`是一个用于调整其子组件尺寸以适应可用空间的小部件。保证内容按比例适应容器。FittedBox提供了几种不同的`fit`模式,例如`BoxFit.contain`、`BoxFit.cover`、`BoxFit.fill`等,每种模式决定了内容如何适应容器的尺寸。 - - `FittedBox`主要作用在于调整内部子组件的尺寸,保证内容按比例适应容器,涉及内容的可视化展示。 - - **Placeholder**: - `Placeholder`小部件通常用于占位,在加载数据或资源尚未准备就绪时显示临时内容。它可以作为一个视觉提示,提醒用户该位置的内容随后会被填充。它不具有自适应尺寸的功能,但可以设置默认尺寸,并且常与异步数据加载结合使用,确保即使在真实内容加载前也有良好的用户体验。 - - **Spacer**: - 上面已在Flex提到,主要用于分配布局中的空白空间。通常用于`Row`、`Column`或Flex布局中,作为填充空间的占位符。当希望某个方向上的剩余空间被均匀分配时,可以放置一个或多个Spacer。它没有自身的尺寸,而是根据Flex布局规则来决定占用的空间大小。 -- **Stack**:Stack允许子组件堆叠展示,支持定位(alignment)和z轴排序(index),可以用于制作悬浮按钮、叠加图片、标签页指示器等效果。 - - **Positioned**: 在Stack中结合Positioned使用,可以更精确地控制子组件在Stack中的绝对位置。 - - **IndexedStack**: 允许在一组子组件中切换显示,类似TabView效果,通过索引值控制显示指定子组件。 -- **Align**:Align组件可以用来对齐其子组件,根据alignment参数调整子组件在父组件中的位置。 - - **Center**:Align子类,Center组件将子组件居中显示,无论父容器大小如何变化,子组件始终保持居中。 -- Wrap 组件用于包装多个子组件,当一行空间不足时自动换行,常见于创建标签列表、商品陈列等。 -- **Wrap**:Wrap组件用于包装多个子组件,当一行空间不足时自动换行,常见于创建标签列表、商品陈列等。 -- **ConstrainedBox**:为子组件添加额外的大小限制,常用于在自定义布局中施加特定的宽高约束。 - - **UnconstrainedBox**: 取消对其子组件的所有约束,使得子组件能自由根据其内容大小进行布局。 -- **Container**: 虽然本身不是一个布局组件,但它提供了装饰、边距、填充等功能,结合其子组件可以实现复杂的布局效果。 -- **Padding**:Padding组件用于在子组件周围添加内边距,可以在不影响子组件本身尺寸的前提下调整其在父容器中的位置。 -- Table 和 DataTable:Table用于创建表格布局,可以灵活定义行和列的数量及内容。 - - **DataTable**: Table的增强版,为表格提供了更丰富的样式和交互功能,适合展示具有表头、索引列和操作列的数据。 -- **FractionallySizedBox**:可以根据父容器尺寸按比例调整子组件的尺寸。 -- IntrinsicHeight 和 IntrinsicWidth:这两个组件会使子组件的高度或宽度与其内容匹配,而不是依赖于外部约束。 -- Flow:Flow组件允许子组件在二维平面上进行布局,可以实现一些自定义的复杂布局效果。 -- CustomSingleChildLayout与CustomMultiChildLayout: 实现SingleChildLayoutDelegate/MultiChildLayoutDelegate自定义子组件的布局。 -- LayoutId 和 CustomScrollView:在CustomScrollView中结合使用,可以实现自定义的滚动视图布局,如多个不同滚动速度的列表视图。 -- 滚动类 - - ScrollView - - ListView 可滚动的、单列数据的组件,支持垂直或水平滚动,结合ListView.builder可以高效地展示大量数据。 - - **ListView.separated**:与ListView类似,但提供了item之间插入分割线的功能。 - - GridView 网格布局,可以创建类似表格或卡片列表的效果,支持横向或纵向滚动。 - - **BoxScrollView** - - **CustomScrollView** - - NestedScrollView:在同一滚动视图中嵌套其他滚动视图,如顶部有一个固定的AppBar和底部有一个可滚动的列表。 -- **Opacity**: 是一种可以改变其子组件透明度的布局组件。它并不会影响子组件的实际尺寸和布局,而是控制子组件的内容可视性。 -- **PageView** - - 用于实现滑动页面效果,常见于幻灯片、轮播图或页面间的滑动切换。 -- **Hero动画** - - 虽非布局组件,但与布局转换相关。它在不同路由或页面间实现元素共享及动画过渡,常用于Material Design中的共享元素过渡效果。 -- **OverflowBox** - - 允许其子组件的尺寸超出自身约束范围,适用于实现部分组件溢出父容器的情况。 -- **Transform** - - 提供对子组件的旋转、缩放和平移变换功能,在特定布局场景中也有应用。 -- **ClipRect** 和 **ClipRRect** - - 用于裁剪其子组件的绘制区域,尽管主要用于图形效果,但在实现特定布局和视觉效果时也会使用。 -- **Layer** 类组件 - - 如 `RepaintBoundary`、`PhysicalModel`、`Opacity` 等,它们在Flutter渲染架构层面对布局和绘制产生影响,可用于优化性能或实现特殊视觉效果。 -- **Sliver系列组件** - - 如 `SliverAppBar`、`SliverList`、`SliverGrid` 等,专为`CustomScrollView`设计,用于高效实现滚动视图布局。 -- **SafeArea**: - - SafeArea组件用于确保其子组件避开屏幕边缘的不安全区域,如手机的刘海屏、摄像头孔位或底部的虚拟按键区域,确保内容布局在可视且不受遮挡的安全区域内。 -- **AspectRatio**: - - 此组件强制其子组件保持特定的宽高比,确保内容在不同屏幕尺寸下都能保持一致的比例关系。 -- **Card**: - - Card组件虽然不是纯粹的布局组件,但因其提供了统一的矩形框样式和阴影效果,常用于构建卡片式的布局单元,特别是在列表和网格布局中。 -- **Baseline**: - - Baseline组件用于基于文本基线对齐其子组件,尤其在处理多行文本或混合文本与其他元素时,可以确保文本行间的基线一致性。 -- **CustomPainter**: - - 虽然CustomPainter主要用于自定义绘画,但在实现复杂自定义布局时也发挥着重要作用,可以通过`Canvas` API实现精确的像素级布局。 -- **FittedBox**: - - FittedBox组件会调整其子组件的大小,使其适应自己的尺寸,常用于图标、文本等内容的自适应缩放。 - 当然,还有一些其它值得注意的布局相关组件和技术: - - -- **AnimatedContainer**: - - AnimatedContainer组件在更改其尺寸、颜色、边距等属性时,会为其变化提供平滑的动画效果,非常适合构建动态布局变化的场景。 - -- **Scaffold**: - - Scaffold是Material Design风格应用的基础布局组件,包含了app bar、body、bottomNavigationBar、drawer等常见布局元素,有助于快速构建标准的Material应用界面。 - -- **ShrinkWrappingViewport**: - - 类似于ListView,但它的大小可以根据其子组件的大小进行收缩,而不是根据父容器的大小进行填充。 - -- **RenderObjectWidget** 和 **RenderBox**: - - 虽然它们不是直接的布局组件,但理解和使用RenderObjectWidget和RenderBox对于自定义布局逻辑至关重要。通过继承和自定义这些底层渲染对象,可以创建高度自定义的布局效果。 - - -- 布局相关动画 - - **AlignTransition** 和 **PositionedTransition**: - - 这两个组件是对`Align`和`Positioned`组件的动画版本,可以为子组件的对齐或定位提供平滑过渡动画。 - -## 核心知识点 - -- StatefulWidget在最外层会随着屏幕大小变化自动build -- /// /flutter/examples/api/lib/widgets/framework/build_owner.0.dart - - - diff --git a/notes/flutter_web/lib/notes/layout/box_layout/constraints/note.g.dart b/notes/flutter_web/lib/notes/layout/box_layout/constraints/note.g.dart deleted file mode 100644 index f228a8a6..00000000 --- a/notes/flutter_web/lib/notes/layout/box_layout/constraints/note.g.dart +++ /dev/null @@ -1,41 +0,0 @@ -// Generated by github.com/chen56/note, please don't edit! - -noteInfo() => ( - children: [ - /// () - ( - cellType: 'header', - offset: 0, - end: 177, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// (print(const MD(r''' # flutter , print("${BoxConstraints(minWid, print("${BoxConstraints(minWid, ..., print(const MD(r''' ```dart va, BoxConstraints.tightFor(width:) - ( - cellType: 'body', - offset: 177, - end: 2418, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// () - ( - cellType: 'tail', - offset: 2418, - end: 4450, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ) - ], - ); diff --git a/notes/flutter_web/lib/notes/layout/box_layout/constraints/note.g.json b/notes/flutter_web/lib/notes/layout/box_layout/constraints/note.g.json deleted file mode 100644 index 64bb4304..00000000 --- a/notes/flutter_web/lib/notes/layout/box_layout/constraints/note.g.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "/* note.g.json */": { - "zh-CN": "❗重要配置❗,由github.com/chen56/note生成,一个笔记一个目录,每个目录都生成一个note.g.json,用来记录这篇笔记的重要元数据,比如生成note的uri, 文件应被保存在版本控制中,比如git,不应编辑或移动此文件。 ", - "en": "❗ Important configuration ❗, generated by the github.com/chen56/note, one directory for each one note, note.g.json to record the important metadata of the note, for example generate the uri of note , the file should be saved in version control, such as git, and this file should not be edited or moved." - }, - "noteId": 44 -} \ No newline at end of file diff --git a/notes/flutter_web/lib/notes/layout/note.g.dart b/notes/flutter_web/lib/notes/layout/note.g.dart deleted file mode 100644 index 0de9b1a7..00000000 --- a/notes/flutter_web/lib/notes/layout/note.g.dart +++ /dev/null @@ -1,41 +0,0 @@ -// Generated by github.com/chen56/note, please don't edit! - -noteInfo() => ( - children: [ - /// () - ( - cellType: 'header', - offset: 0, - end: 177, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// (StatefulBuilder(builder: (Buil) - ( - cellType: 'body', - offset: 177, - end: 296, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// () - ( - cellType: 'tail', - offset: 296, - end: 298, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ) - ], - ); diff --git a/notes/flutter_web/lib/notes/layout/note.g.json b/notes/flutter_web/lib/notes/layout/note.g.json deleted file mode 100644 index 8a93d0f7..00000000 --- a/notes/flutter_web/lib/notes/layout/note.g.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "/* note.g.json */": { - "zh-CN": "❗重要配置❗,由github.com/chen56/note生成,一个笔记一个目录,每个目录都生成一个note.g.json,用来记录这篇笔记的重要元数据,比如生成note的uri, 文件应被保存在版本控制中,比如git,不应编辑或移动此文件。 ", - "en": "❗ Important configuration ❗, generated by the github.com/chen56/note, one directory for each one note, note.g.json to record the important metadata of the note, for example generate the uri of note , the file should be saved in version control, such as git, and this file should not be edited or moved." - }, - "noteId": 46 -} \ No newline at end of file diff --git a/notes/flutter_web/lib/notes/layout/old/layout/note.g.dart b/notes/flutter_web/lib/notes/layout/old/layout/note.g.dart deleted file mode 100644 index 07a0f21c..00000000 --- a/notes/flutter_web/lib/notes/layout/old/layout/note.g.dart +++ /dev/null @@ -1,41 +0,0 @@ -// Generated by github.com/chen56/note, please don't edit! - -noteInfo() => ( - children: [ - /// () - ( - cellType: 'header', - offset: 0, - end: 129, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// (print(const MD(r''' # 布局 ## ) - ( - cellType: 'body', - offset: 129, - end: 2268, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// () - ( - cellType: 'tail', - offset: 2268, - end: 2270, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ) - ], - ); diff --git a/notes/flutter_web/lib/notes/layout/old/layout/note.g.json b/notes/flutter_web/lib/notes/layout/old/layout/note.g.json deleted file mode 100644 index 705e4874..00000000 --- a/notes/flutter_web/lib/notes/layout/old/layout/note.g.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "/* note.g.json */": { - "zh-CN": "❗重要配置❗,由github.com/chen56/note生成,一个笔记一个目录,每个目录都生成一个note.g.json,用来记录这篇笔记的重要元数据,比如生成note的uri, 文件应被保存在版本控制中,比如git,不应编辑或移动此文件。 ", - "en": "❗ Important configuration ❗, generated by the github.com/chen56/note, one directory for each one note, note.g.json to record the important metadata of the note, for example generate the uri of note , the file should be saved in version control, such as git, and this file should not be edited or moved." - }, - "noteId": 43 -} \ No newline at end of file diff --git a/notes/flutter_web/lib/notes/layout/responsive_design/note.g.dart b/notes/flutter_web/lib/notes/layout/responsive_design/note.g.dart deleted file mode 100644 index a838635f..00000000 --- a/notes/flutter_web/lib/notes/layout/responsive_design/note.g.dart +++ /dev/null @@ -1,41 +0,0 @@ -// Generated by github.com/chen56/note, please don't edit! - -noteInfo() => ( - children: [ - /// () - ( - cellType: 'header', - offset: 0, - end: 130, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// (print(const MD(''' # 响应式设计 ##) - ( - cellType: 'body', - offset: 130, - end: 278, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// () - ( - cellType: 'tail', - offset: 278, - end: 280, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ) - ], - ); diff --git a/notes/flutter_web/lib/notes/layout/responsive_design/note.g.json b/notes/flutter_web/lib/notes/layout/responsive_design/note.g.json deleted file mode 100644 index ada57f04..00000000 --- a/notes/flutter_web/lib/notes/layout/responsive_design/note.g.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "/* note.g.json */": { - "zh-CN": "❗重要配置❗,由github.com/chen56/note生成,一个笔记一个目录,每个目录都生成一个note.g.json,用来记录这篇笔记的重要元数据,比如生成note的uri, 文件应被保存在版本控制中,比如git,不应编辑或移动此文件。 ", - "en": "❗ Important configuration ❗, generated by the github.com/chen56/note, one directory for each one note, note.g.json to record the important metadata of the note, for example generate the uri of note , the file should be saved in version control, such as git, and this file should not be edited or moved." - }, - "noteId": 45 -} \ No newline at end of file diff --git a/notes/flutter_web/lib/notes/media&assets&file/assets/note.g.dart b/notes/flutter_web/lib/notes/media&assets&file/assets/note.g.dart deleted file mode 100644 index 308b5de1..00000000 --- a/notes/flutter_web/lib/notes/media&assets&file/assets/note.g.dart +++ /dev/null @@ -1,53 +0,0 @@ -// Generated by github.com/chen56/note, please don't edit! - -noteInfo() => ( - children: [ - /// () - ( - cellType: 'header', - offset: 0, - end: 192, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// () - ( - cellType: 'body', - offset: 192, - end: 195, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// (print(const MD(r''' # asset , var jsonAsset = await rootBund, print(jsonAsset);) - ( - cellType: 'body', - offset: 250, - end: 381, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// () - ( - cellType: 'tail', - offset: 381, - end: 383, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ) - ], - ); diff --git a/notes/flutter_web/lib/notes/media&assets&file/assets/note.g.json b/notes/flutter_web/lib/notes/media&assets&file/assets/note.g.json deleted file mode 100644 index 2faa7075..00000000 --- a/notes/flutter_web/lib/notes/media&assets&file/assets/note.g.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "/* note.g.json */": { - "zh-CN": "❗重要配置❗,由github.com/chen56/note生成,一个笔记一个目录,每个目录都生成一个note.g.json,用来记录这篇笔记的重要元数据,比如生成note的uri, 文件应被保存在版本控制中,比如git,不应编辑或移动此文件。 ", - "en": "❗ Important configuration ❗, generated by the github.com/chen56/note, one directory for each one note, note.g.json to record the important metadata of the note, for example generate the uri of note , the file should be saved in version control, such as git, and this file should not be edited or moved." - }, - "noteId": 8 -} \ No newline at end of file diff --git a/notes/flutter_web/lib/notes/media&assets&file/file_desktop/note.g.dart b/notes/flutter_web/lib/notes/media&assets&file/file_desktop/note.g.dart deleted file mode 100644 index b5bb94a9..00000000 --- a/notes/flutter_web/lib/notes/media&assets&file/file_desktop/note.g.dart +++ /dev/null @@ -1,41 +0,0 @@ -// Generated by github.com/chen56/note, please don't edit! - -noteInfo() => ( - children: [ - /// () - ( - cellType: 'header', - offset: 0, - end: 256, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// (if (kIsWeb) {print("本页面只适合桌面版本, print(const MD(r''' # file ', LocalFileSystem fs = const Loc, print(fs.directory("").absolut, print("Directory.current:${Dir) - ( - cellType: 'body', - offset: 256, - end: 566, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// () - ( - cellType: 'tail', - offset: 566, - end: 569, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ) - ], - ); diff --git a/notes/flutter_web/lib/notes/media&assets&file/file_desktop/note.g.json b/notes/flutter_web/lib/notes/media&assets&file/file_desktop/note.g.json deleted file mode 100644 index c1433e2a..00000000 --- a/notes/flutter_web/lib/notes/media&assets&file/file_desktop/note.g.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "/* note.g.json */": { - "zh-CN": "❗重要配置❗,由github.com/chen56/note生成,一个笔记一个目录,每个目录都生成一个note.g.json,用来记录这篇笔记的重要元数据,比如生成note的uri, 文件应被保存在版本控制中,比如git,不应编辑或移动此文件。 ", - "en": "❗ Important configuration ❗, generated by the github.com/chen56/note, one directory for each one note, note.g.json to record the important metadata of the note, for example generate the uri of note , the file should be saved in version control, such as git, and this file should not be edited or moved." - }, - "noteId": 7 -} \ No newline at end of file diff --git a/notes/flutter_web/lib/notes/media&assets&file/file_web/note.g.dart b/notes/flutter_web/lib/notes/media&assets&file/file_web/note.g.dart deleted file mode 100644 index 410c1d54..00000000 --- a/notes/flutter_web/lib/notes/media&assets&file/file_web/note.g.dart +++ /dev/null @@ -1,41 +0,0 @@ -// Generated by github.com/chen56/note, please don't edit! - -noteInfo() => ( - children: [ - /// () - ( - cellType: 'header', - offset: 0, - end: 202, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// (print(const MD(r''' # file acc, print("Uri.base(window.locatio) - ( - cellType: 'body', - offset: 202, - end: 382, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// () - ( - cellType: 'tail', - offset: 382, - end: 384, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ) - ], - ); diff --git a/notes/flutter_web/lib/notes/media&assets&file/file_web/note.g.json b/notes/flutter_web/lib/notes/media&assets&file/file_web/note.g.json deleted file mode 100644 index 069c274b..00000000 --- a/notes/flutter_web/lib/notes/media&assets&file/file_web/note.g.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "/* note.g.json */": { - "zh-CN": "❗重要配置❗,由github.com/chen56/note生成,一个笔记一个目录,每个目录都生成一个note.g.json,用来记录这篇笔记的重要元数据,比如生成note的uri, 文件应被保存在版本控制中,比如git,不应编辑或移动此文件。 ", - "en": "❗ Important configuration ❗, generated by the github.com/chen56/note, one directory for each one note, note.g.json to record the important metadata of the note, for example generate the uri of note , the file should be saved in version control, such as git, and this file should not be edited or moved." - }, - "noteId": 55 -} \ No newline at end of file diff --git a/notes/flutter_web/lib/notes/navigation/note.g.dart b/notes/flutter_web/lib/notes/navigation/note.g.dart deleted file mode 100644 index 01bbfa05..00000000 --- a/notes/flutter_web/lib/notes/navigation/note.g.dart +++ /dev/null @@ -1,41 +0,0 @@ -// Generated by github.com/chen56/note, please don't edit! - -noteInfo() => ( - children: [ - /// () - ( - cellType: 'header', - offset: 0, - end: 129, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// (print(const MD(r''' # Navigato) - ( - cellType: 'body', - offset: 129, - end: 373, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// () - ( - cellType: 'tail', - offset: 373, - end: 375, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ) - ], - ); diff --git a/notes/flutter_web/lib/notes/navigation/note.g.json b/notes/flutter_web/lib/notes/navigation/note.g.json deleted file mode 100644 index 140bc582..00000000 --- a/notes/flutter_web/lib/notes/navigation/note.g.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "/* note.g.json */": { - "zh-CN": "❗重要配置❗,由github.com/chen56/note生成,一个笔记一个目录,每个目录都生成一个note.g.json,用来记录这篇笔记的重要元数据,比如生成note的uri, 文件应被保存在版本控制中,比如git,不应编辑或移动此文件。 ", - "en": "❗ Important configuration ❗, generated by the github.com/chen56/note, one directory for each one note, note.g.json to record the important metadata of the note, for example generate the uri of note , the file should be saved in version control, such as git, and this file should not be edited or moved." - }, - "noteId": 3 -} \ No newline at end of file diff --git a/notes/flutter_web/lib/notes/note.g.dart b/notes/flutter_web/lib/notes/note.g.dart deleted file mode 100644 index 15b8f0a1..00000000 --- a/notes/flutter_web/lib/notes/note.g.dart +++ /dev/null @@ -1,41 +0,0 @@ -// Generated by github.com/chen56/note, please don't edit! - -noteInfo() => ( - children: [ - /// () - ( - cellType: 'header', - offset: 0, - end: 129, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// (print(const MD(r''' # home 本页) - ( - cellType: 'body', - offset: 129, - end: 203, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// () - ( - cellType: 'tail', - offset: 203, - end: 205, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ) - ], - ); diff --git a/notes/flutter_web/lib/notes/note.g.json b/notes/flutter_web/lib/notes/note.g.json deleted file mode 100644 index 767a08c7..00000000 --- a/notes/flutter_web/lib/notes/note.g.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "/* note.g.json */": { - "zh-CN": "❗重要配置❗,由github.com/chen56/note生成,一个笔记一个目录,每个目录都生成一个note.g.json,用来记录这篇笔记的重要元数据,比如生成note的uri, 文件应被保存在版本控制中,比如git,不应编辑或移动此文件。 ", - "en": "❗ Important configuration ❗, generated by the github.com/chen56/note, one directory for each one note, note.g.json to record the important metadata of the note, for example generate the uri of note , the file should be saved in version control, such as git, and this file should not be edited or moved." - }, - "noteId": 21 -} \ No newline at end of file diff --git a/notes/flutter_web/lib/notes/pure_dart/analyzer/note.g.dart b/notes/flutter_web/lib/notes/pure_dart/analyzer/note.g.dart deleted file mode 100644 index 1070a871..00000000 --- a/notes/flutter_web/lib/notes/pure_dart/analyzer/note.g.dart +++ /dev/null @@ -1,41 +0,0 @@ -// Generated by github.com/chen56/note, please don't edit! - -noteInfo() => ( - children: [ - /// () - ( - cellType: 'header', - offset: 0, - end: 258, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// (print(const MD(''' # analyzer , print = print.next(title: cons, var x = analyzer_util.parseStr, ..., for (int i = 0; i < times; i++, print("分析本页面源文件:$times 次, 花费时间) - ( - cellType: 'body', - offset: 258, - end: 1143, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// () - ( - cellType: 'tail', - offset: 1143, - end: 1145, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ) - ], - ); diff --git a/notes/flutter_web/lib/notes/pure_dart/analyzer/note.g.json b/notes/flutter_web/lib/notes/pure_dart/analyzer/note.g.json deleted file mode 100644 index 4e983827..00000000 --- a/notes/flutter_web/lib/notes/pure_dart/analyzer/note.g.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "/* note.g.json */": { - "zh-CN": "❗重要配置❗,由github.com/chen56/note生成,一个笔记一个目录,每个目录都生成一个note.g.json,用来记录这篇笔记的重要元数据,比如生成note的uri, 文件应被保存在版本控制中,比如git,不应编辑或移动此文件。 ", - "en": "❗ Important configuration ❗, generated by the github.com/chen56/note, one directory for each one note, note.g.json to record the important metadata of the note, for example generate the uri of note , the file should be saved in version control, such as git, and this file should not be edited or moved." - }, - "noteId": 15 -} \ No newline at end of file diff --git a/notes/flutter_web/lib/notes/pure_dart/async/note.g.dart b/notes/flutter_web/lib/notes/pure_dart/async/note.g.dart deleted file mode 100644 index 5762ea3d..00000000 --- a/notes/flutter_web/lib/notes/pure_dart/async/note.g.dart +++ /dev/null @@ -1,89 +0,0 @@ -// Generated by github.com/chen56/note, please don't edit! - -noteInfo() => ( - children: [ - /// () - ( - cellType: 'header', - offset: 0, - end: 222, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// () - ( - cellType: 'body', - offset: 222, - end: 225, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// (print(const MD(r''' # 异步 很好的异) - ( - cellType: 'body', - offset: 280, - end: 551, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// ({Future bomb() async {) - ( - cellType: 'body', - offset: 606, - end: 1339, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// (print(const MD(r''' ## Isalted) - ( - cellType: 'body', - offset: 1394, - end: 1876, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// ({send123(sendPort) async {for ) - ( - cellType: 'body', - offset: 1931, - end: 2580, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// () - ( - cellType: 'tail', - offset: 2580, - end: 2582, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ) - ], - ); diff --git a/notes/flutter_web/lib/notes/pure_dart/async/note.g.json b/notes/flutter_web/lib/notes/pure_dart/async/note.g.json deleted file mode 100644 index 3d8724f2..00000000 --- a/notes/flutter_web/lib/notes/pure_dart/async/note.g.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "/* note.g.json */": { - "zh-CN": "❗重要配置❗,由github.com/chen56/note生成,一个笔记一个目录,每个目录都生成一个note.g.json,用来记录这篇笔记的重要元数据,比如生成note的uri, 文件应被保存在版本控制中,比如git,不应编辑或移动此文件。 ", - "en": "❗ Important configuration ❗, generated by the github.com/chen56/note, one directory for each one note, note.g.json to record the important metadata of the note, for example generate the uri of note , the file should be saved in version control, such as git, and this file should not be edited or moved." - }, - "noteId": 11 -} \ No newline at end of file diff --git a/notes/flutter_web/lib/notes/pure_dart/dart3/note.g.dart b/notes/flutter_web/lib/notes/pure_dart/dart3/note.g.dart deleted file mode 100644 index 681bf60f..00000000 --- a/notes/flutter_web/lib/notes/pure_dart/dart3/note.g.dart +++ /dev/null @@ -1,41 +0,0 @@ -// Generated by github.com/chen56/note, please don't edit! - -noteInfo() => ( - children: [ - /// () - ( - cellType: 'header', - offset: 0, - end: 129, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// (print(const MD(r''' ## dart 3 ) - ( - cellType: 'body', - offset: 129, - end: 265, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// () - ( - cellType: 'tail', - offset: 265, - end: 267, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ) - ], - ); diff --git a/notes/flutter_web/lib/notes/pure_dart/dart3/note.g.json b/notes/flutter_web/lib/notes/pure_dart/dart3/note.g.json deleted file mode 100644 index 937be393..00000000 --- a/notes/flutter_web/lib/notes/pure_dart/dart3/note.g.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "/* note.g.json */": { - "zh-CN": "❗重要配置❗,由github.com/chen56/note生成,一个笔记一个目录,每个目录都生成一个note.g.json,用来记录这篇笔记的重要元数据,比如生成note的uri, 文件应被保存在版本控制中,比如git,不应编辑或移动此文件。 ", - "en": "❗ Important configuration ❗, generated by the github.com/chen56/note, one directory for each one note, note.g.json to record the important metadata of the note, for example generate the uri of note , the file should be saved in version control, such as git, and this file should not be edited or moved." - }, - "noteId": 10 -} \ No newline at end of file diff --git a/notes/flutter_web/lib/notes/pure_dart/execption/note.g.dart b/notes/flutter_web/lib/notes/pure_dart/execption/note.g.dart deleted file mode 100644 index 5809d94f..00000000 --- a/notes/flutter_web/lib/notes/pure_dart/execption/note.g.dart +++ /dev/null @@ -1,41 +0,0 @@ -// Generated by github.com/chen56/note, please don't edit! - -noteInfo() => ( - children: [ - /// () - ( - cellType: 'header', - offset: 0, - end: 463, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// (print(const MD("text"));, StackTrace? catchStack;, try {throwException();} catch , var catchStackParsed = Trace.p, print(MD(""" ### 原始堆栈StackTrac) - ( - cellType: 'body', - offset: 463, - end: 1396, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// () - ( - cellType: 'tail', - offset: 1396, - end: 2521, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ) - ], - ); diff --git a/notes/flutter_web/lib/notes/pure_dart/execption/note.g.json b/notes/flutter_web/lib/notes/pure_dart/execption/note.g.json deleted file mode 100644 index c65320bf..00000000 --- a/notes/flutter_web/lib/notes/pure_dart/execption/note.g.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "/* note.g.json */": { - "zh-CN": "❗重要配置❗,由github.com/chen56/note生成,一个笔记一个目录,每个目录都生成一个note.g.json,用来记录这篇笔记的重要元数据,比如生成note的uri, 文件应被保存在版本控制中,比如git,不应编辑或移动此文件。 ", - "en": "❗ Important configuration ❗, generated by the github.com/chen56/note, one directory for each one note, note.g.json to record the important metadata of the note, for example generate the uri of note , the file should be saved in version control, such as git, and this file should not be edited or moved." - }, - "noteId": 13 -} \ No newline at end of file diff --git a/notes/flutter_web/lib/notes/pure_dart/safe_interface/note.g.dart b/notes/flutter_web/lib/notes/pure_dart/safe_interface/note.g.dart deleted file mode 100644 index 53f68122..00000000 --- a/notes/flutter_web/lib/notes/pure_dart/safe_interface/note.g.dart +++ /dev/null @@ -1,41 +0,0 @@ -// Generated by github.com/chen56/note, please don't edit! - -noteInfo() => ( - children: [ - /// () - ( - cellType: 'header', - offset: 0, - end: 162, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// (print(const MD(r''' # json [I, OneImpl().a();, OneImpl().a();, OneImpl().b();) - ( - cellType: 'body', - offset: 162, - end: 532, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// () - ( - cellType: 'tail', - offset: 532, - end: 1106, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ) - ], - ); diff --git a/notes/flutter_web/lib/notes/pure_dart/safe_interface/note.g.json b/notes/flutter_web/lib/notes/pure_dart/safe_interface/note.g.json deleted file mode 100644 index 915e3069..00000000 --- a/notes/flutter_web/lib/notes/pure_dart/safe_interface/note.g.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "/* note.g.json */": { - "zh-CN": "❗重要配置❗,由github.com/chen56/note生成,一个笔记一个目录,每个目录都生成一个note.g.json,用来记录这篇笔记的重要元数据,比如生成note的uri, 文件应被保存在版本控制中,比如git,不应编辑或移动此文件。 ", - "en": "❗ Important configuration ❗, generated by the github.com/chen56/note, one directory for each one note, note.g.json to record the important metadata of the note, for example generate the uri of note , the file should be saved in version control, such as git, and this file should not be edited or moved." - }, - "noteId": 12 -} \ No newline at end of file diff --git a/notes/flutter_web/lib/notes/pure_dart/serialization_json/note.g.dart b/notes/flutter_web/lib/notes/pure_dart/serialization_json/note.g.dart deleted file mode 100644 index 077a7968..00000000 --- a/notes/flutter_web/lib/notes/pure_dart/serialization_json/note.g.dart +++ /dev/null @@ -1,41 +0,0 @@ -// Generated by github.com/chen56/note, please don't edit! - -noteInfo() => ( - children: [ - /// () - ( - cellType: 'header', - offset: 0, - end: 185, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// (print(const MD(r''' # json js, print = print.next(title: cons, var userJson = ''' { "na, ..., print('user: ${user['name']}!', print('email: ${user['email']}) - ( - cellType: 'body', - offset: 185, - end: 520, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// () - ( - cellType: 'tail', - offset: 520, - end: 522, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ) - ], - ); diff --git a/notes/flutter_web/lib/notes/pure_dart/serialization_json/note.g.json b/notes/flutter_web/lib/notes/pure_dart/serialization_json/note.g.json deleted file mode 100644 index 40eac773..00000000 --- a/notes/flutter_web/lib/notes/pure_dart/serialization_json/note.g.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "/* note.g.json */": { - "zh-CN": "❗重要配置❗,由github.com/chen56/note生成,一个笔记一个目录,每个目录都生成一个note.g.json,用来记录这篇笔记的重要元数据,比如生成note的uri, 文件应被保存在版本控制中,比如git,不应编辑或移动此文件。 ", - "en": "❗ Important configuration ❗, generated by the github.com/chen56/note, one directory for each one note, note.g.json to record the important metadata of the note, for example generate the uri of note , the file should be saved in version control, such as git, and this file should not be edited or moved." - }, - "noteId": 14 -} \ No newline at end of file diff --git a/notes/flutter_web/lib/notes/research/remote_view/note.g.dart b/notes/flutter_web/lib/notes/research/remote_view/note.g.dart deleted file mode 100644 index 782e7aaa..00000000 --- a/notes/flutter_web/lib/notes/research/remote_view/note.g.dart +++ /dev/null @@ -1,41 +0,0 @@ -// Generated by github.com/chen56/note, please don't edit! - -noteInfo() => ( - children: [ - /// () - ( - cellType: 'header', - offset: 0, - end: 130, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// (print(const MD(r''' # Remote f) - ( - cellType: 'body', - offset: 130, - end: 2032, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// () - ( - cellType: 'tail', - offset: 2032, - end: 2034, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ) - ], - ); diff --git a/notes/flutter_web/lib/notes/research/remote_view/note.g.json b/notes/flutter_web/lib/notes/research/remote_view/note.g.json deleted file mode 100644 index 472189ce..00000000 --- a/notes/flutter_web/lib/notes/research/remote_view/note.g.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "/* note.g.json */": { - "zh-CN": "❗重要配置❗,由github.com/chen56/note生成,一个笔记一个目录,每个目录都生成一个note.g.json,用来记录这篇笔记的重要元数据,比如生成note的uri, 文件应被保存在版本控制中,比如git,不应编辑或移动此文件。 ", - "en": "❗ Important configuration ❗, generated by the github.com/chen56/note, one directory for each one note, note.g.json to record the important metadata of the note, for example generate the uri of note , the file should be saved in version control, such as git, and this file should not be edited or moved." - }, - "noteId": 2 -} \ No newline at end of file diff --git a/notes/flutter_web/lib/notes/research/research_parameterized_example/note.g.dart b/notes/flutter_web/lib/notes/research/research_parameterized_example/note.g.dart deleted file mode 100644 index a724e4d1..00000000 --- a/notes/flutter_web/lib/notes/research/research_parameterized_example/note.g.dart +++ /dev/null @@ -1,209 +0,0 @@ -// Generated by github.com/chen56/note, please don't edit! - -noteInfo() => ( - children: [ - /// () - ( - cellType: 'header', - offset: 0, - end: 130, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// () - ( - cellType: 'body', - offset: 130, - end: 133, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// (print(const MD(''' # 参数化范例 ##) - ( - cellType: 'body', - offset: 188, - end: 659, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// (print(const SizedBox(height: 1) - ( - cellType: 'body', - offset: 714, - end: 800, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// (print(const MD(''' ### String参) - ( - cellType: 'body', - offset: 855, - end: 902, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// (print(const Text("我是Text.data,) - ( - cellType: 'body', - offset: 957, - end: 1001, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// (print(const MD(''' ### Color参数) - ( - cellType: 'body', - offset: 1056, - end: 1121, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// (print(Container(width: 200, he) - ( - cellType: 'body', - offset: 1176, - end: 1469, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// (print(const MD(''' ### bool参数 ) - ( - cellType: 'body', - offset: 1524, - end: 1569, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// (print(Container(width: 100, co) - ( - cellType: 'body', - offset: 1624, - end: 1786, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// (print(const MD(r''' ### 枚举参数 ) - ( - cellType: 'body', - offset: 1841, - end: 1908, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// (print(Row(mainAxisAlignment: M) - ( - cellType: 'body', - offset: 1963, - end: 2254, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// (print(const MD(r''' ## 其他特性 #) - ( - cellType: 'body', - offset: 2309, - end: 2487, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// (showAbout() {showAboutDialog(c, print(ElevatedButton(onPressed) - ( - cellType: 'body', - offset: 2542, - end: 2829, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// (print(const MD(r''' ### 用循环一次性) - ( - cellType: 'body', - offset: 2884, - end: 2936, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// (for (var mainAxisAlignment in ) - ( - cellType: 'body', - offset: 2991, - end: 3384, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// () - ( - cellType: 'tail', - offset: 3384, - end: 3386, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ) - ], - ); diff --git a/notes/flutter_web/lib/notes/research/research_parameterized_example/note.g.json b/notes/flutter_web/lib/notes/research/research_parameterized_example/note.g.json deleted file mode 100644 index 94e15eaf..00000000 --- a/notes/flutter_web/lib/notes/research/research_parameterized_example/note.g.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "/* note.g.json */": { - "zh-CN": "❗重要配置❗,由github.com/chen56/note生成,一个笔记一个目录,每个目录都生成一个note.g.json,用来记录这篇笔记的重要元数据,比如生成note的uri, 文件应被保存在版本控制中,比如git,不应编辑或移动此文件。 ", - "en": "❗ Important configuration ❗, generated by the github.com/chen56/note, one directory for each one note, note.g.json to record the important metadata of the note, for example generate the uri of note , the file should be saved in version control, such as git, and this file should not be edited or moved." - }, - "noteId": 26 -} \ No newline at end of file diff --git a/notes/flutter_web/lib/notes/state/1.vanilla_state/note.g.dart b/notes/flutter_web/lib/notes/state/1.vanilla_state/note.g.dart deleted file mode 100644 index 40cd6e5a..00000000 --- a/notes/flutter_web/lib/notes/state/1.vanilla_state/note.g.dart +++ /dev/null @@ -1,41 +0,0 @@ -// Generated by github.com/chen56/note, please don't edit! - -noteInfo() => ( - children: [ - /// () - ( - cellType: 'header', - offset: 0, - end: 129, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// (print(const MD(r''' ## 范例1 普通文, print(const MD(r''' ## Inherit) - ( - cellType: 'body', - offset: 129, - end: 1589, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// () - ( - cellType: 'tail', - offset: 1589, - end: 1591, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ) - ], - ); diff --git a/notes/flutter_web/lib/notes/state/1.vanilla_state/note.g.json b/notes/flutter_web/lib/notes/state/1.vanilla_state/note.g.json deleted file mode 100644 index 2e98f5c9..00000000 --- a/notes/flutter_web/lib/notes/state/1.vanilla_state/note.g.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "/* note.g.json */": { - "zh-CN": "❗重要配置❗,由github.com/chen56/note生成,一个笔记一个目录,每个目录都生成一个note.g.json,用来记录这篇笔记的重要元数据,比如生成note的uri, 文件应被保存在版本控制中,比如git,不应编辑或移动此文件。 ", - "en": "❗ Important configuration ❗, generated by the github.com/chen56/note, one directory for each one note, note.g.json to record the important metadata of the note, for example generate the uri of note , the file should be saved in version control, such as git, and this file should not be edited or moved." - }, - "noteId": 4 -} \ No newline at end of file diff --git a/notes/flutter_web/lib/notes/state/StatefulBuilder/note.g.dart b/notes/flutter_web/lib/notes/state/StatefulBuilder/note.g.dart deleted file mode 100644 index a59aec94..00000000 --- a/notes/flutter_web/lib/notes/state/StatefulBuilder/note.g.dart +++ /dev/null @@ -1,41 +0,0 @@ -// Generated by github.com/chen56/note, please don't edit! - -noteInfo() => ( - children: [ - /// () - ( - cellType: 'header', - offset: 0, - end: 129, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// (print(const MD(r''' ## 范例1 ) - ( - cellType: 'body', - offset: 129, - end: 207, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// () - ( - cellType: 'tail', - offset: 207, - end: 209, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ) - ], - ); diff --git a/notes/flutter_web/lib/notes/state/StatefulBuilder/note.g.json b/notes/flutter_web/lib/notes/state/StatefulBuilder/note.g.json deleted file mode 100644 index 284bf0dd..00000000 --- a/notes/flutter_web/lib/notes/state/StatefulBuilder/note.g.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "/* note.g.json */": { - "zh-CN": "❗重要配置❗,由github.com/chen56/note生成,一个笔记一个目录,每个目录都生成一个note.g.json,用来记录这篇笔记的重要元数据,比如生成note的uri, 文件应被保存在版本控制中,比如git,不应编辑或移动此文件。 ", - "en": "❗ Important configuration ❗, generated by the github.com/chen56/note, one directory for each one note, note.g.json to record the important metadata of the note, for example generate the uri of note , the file should be saved in version control, such as git, and this file should not be edited or moved." - }, - "noteId": 6 -} \ No newline at end of file diff --git a/notes/flutter_web/lib/notes/state/note.g.dart b/notes/flutter_web/lib/notes/state/note.g.dart deleted file mode 100644 index b1a399db..00000000 --- a/notes/flutter_web/lib/notes/state/note.g.dart +++ /dev/null @@ -1,41 +0,0 @@ -// Generated by github.com/chen56/note, please don't edit! - -noteInfo() => ( - children: [ - /// () - ( - cellType: 'header', - offset: 0, - end: 129, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// (print(const MD(r''' # flutter ) - ( - cellType: 'body', - offset: 129, - end: 283, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// () - ( - cellType: 'tail', - offset: 283, - end: 285, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ) - ], - ); diff --git a/notes/flutter_web/lib/notes/state/note.g.json b/notes/flutter_web/lib/notes/state/note.g.json deleted file mode 100644 index e6e14070..00000000 --- a/notes/flutter_web/lib/notes/state/note.g.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "/* note.g.json */": { - "zh-CN": "❗重要配置❗,由github.com/chen56/note生成,一个笔记一个目录,每个目录都生成一个note.g.json,用来记录这篇笔记的重要元数据,比如生成note的uri, 文件应被保存在版本控制中,比如git,不应编辑或移动此文件。 ", - "en": "❗ Important configuration ❗, generated by the github.com/chen56/note, one directory for each one note, note.g.json to record the important metadata of the note, for example generate the uri of note , the file should be saved in version control, such as git, and this file should not be edited or moved." - }, - "noteId": 5 -} \ No newline at end of file diff --git a/notes/flutter_web/lib/notes/style&theming/material3/note.g.dart b/notes/flutter_web/lib/notes/style&theming/material3/note.g.dart deleted file mode 100644 index c07e926f..00000000 --- a/notes/flutter_web/lib/notes/style&theming/material3/note.g.dart +++ /dev/null @@ -1,41 +0,0 @@ -// Generated by github.com/chen56/note, please don't edit! - -noteInfo() => ( - children: [ - /// () - ( - cellType: 'header', - offset: 0, - end: 130, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// (print(const MD(r''' # Material) - ( - cellType: 'body', - offset: 130, - end: 271, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// () - ( - cellType: 'tail', - offset: 271, - end: 273, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ) - ], - ); diff --git a/notes/flutter_web/lib/notes/style&theming/material3/note.g.json b/notes/flutter_web/lib/notes/style&theming/material3/note.g.json deleted file mode 100644 index 429caf99..00000000 --- a/notes/flutter_web/lib/notes/style&theming/material3/note.g.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "/* note.g.json */": { - "zh-CN": "❗重要配置❗,由github.com/chen56/note生成,一个笔记一个目录,每个目录都生成一个note.g.json,用来记录这篇笔记的重要元数据,比如生成note的uri, 文件应被保存在版本控制中,比如git,不应编辑或移动此文件。 ", - "en": "❗ Important configuration ❗, generated by the github.com/chen56/note, one directory for each one note, note.g.json to record the important metadata of the note, for example generate the uri of note , the file should be saved in version control, such as git, and this file should not be edited or moved." - }, - "noteId": 9 -} \ No newline at end of file diff --git a/notes/flutter_web/lib/notes/thinking_in_ui/readable_html_vs_dart/note.g.dart b/notes/flutter_web/lib/notes/thinking_in_ui/readable_html_vs_dart/note.g.dart deleted file mode 100644 index 3673c667..00000000 --- a/notes/flutter_web/lib/notes/thinking_in_ui/readable_html_vs_dart/note.g.dart +++ /dev/null @@ -1,41 +0,0 @@ -// Generated by github.com/chen56/note, please don't edit! - -noteInfo() => ( - children: [ - /// () - ( - cellType: 'header', - offset: 0, - end: 130, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// (print(const MD(r''' # flutter ) - ( - cellType: 'body', - offset: 130, - end: 3469, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// () - ( - cellType: 'tail', - offset: 3469, - end: 3471, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ) - ], - ); diff --git a/notes/flutter_web/lib/notes/thinking_in_ui/readable_html_vs_dart/note.g.json b/notes/flutter_web/lib/notes/thinking_in_ui/readable_html_vs_dart/note.g.json deleted file mode 100644 index ff971e0c..00000000 --- a/notes/flutter_web/lib/notes/thinking_in_ui/readable_html_vs_dart/note.g.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "/* note.g.json */": { - "zh-CN": "❗重要配置❗,由github.com/chen56/note生成,一个笔记一个目录,每个目录都生成一个note.g.json,用来记录这篇笔记的重要元数据,比如生成note的uri, 文件应被保存在版本控制中,比如git,不应编辑或移动此文件。 ", - "en": "❗ Important configuration ❗, generated by the github.com/chen56/note, one directory for each one note, note.g.json to record the important metadata of the note, for example generate the uri of note , the file should be saved in version control, such as git, and this file should not be edited or moved." - }, - "noteId": 23 -} \ No newline at end of file diff --git a/notes/flutter_web/lib/notes/widgets/container_widgets/bar/note.g.dart b/notes/flutter_web/lib/notes/widgets/container_widgets/bar/note.g.dart deleted file mode 100644 index 72f74650..00000000 --- a/notes/flutter_web/lib/notes/widgets/container_widgets/bar/note.g.dart +++ /dev/null @@ -1,41 +0,0 @@ -// Generated by github.com/chen56/note, please don't edit! - -noteInfo() => ( - children: [ - /// () - ( - cellType: 'header', - offset: 0, - end: 182, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// (print(const MD(r''' ## AppBar , print = print.next(title: cons, print(AppBar(title: const Text, ..., click() {showAboutDialog(conte, print(MenuBar(children: [MenuI) - ( - cellType: 'body', - offset: 182, - end: 12334, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// () - ( - cellType: 'tail', - offset: 12334, - end: 12336, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ) - ], - ); diff --git a/notes/flutter_web/lib/notes/widgets/container_widgets/bar/note.g.json b/notes/flutter_web/lib/notes/widgets/container_widgets/bar/note.g.json deleted file mode 100644 index 94579de4..00000000 --- a/notes/flutter_web/lib/notes/widgets/container_widgets/bar/note.g.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "/* note.g.json */": { - "zh-CN": "❗重要配置❗,由github.com/chen56/note生成,一个笔记一个目录,每个目录都生成一个note.g.json,用来记录这篇笔记的重要元数据,比如生成note的uri, 文件应被保存在版本控制中,比如git,不应编辑或移动此文件。 ", - "en": "❗ Important configuration ❗, generated by the github.com/chen56/note, one directory for each one note, note.g.json to record the important metadata of the note, for example generate the uri of note , the file should be saved in version control, such as git, and this file should not be edited or moved." - }, - "noteId": 49 -} \ No newline at end of file diff --git a/notes/flutter_web/lib/notes/widgets/container_widgets/menu/note.g.dart b/notes/flutter_web/lib/notes/widgets/container_widgets/menu/note.g.dart deleted file mode 100644 index dae3afbc..00000000 --- a/notes/flutter_web/lib/notes/widgets/container_widgets/menu/note.g.dart +++ /dev/null @@ -1,41 +0,0 @@ -// Generated by github.com/chen56/note, please don't edit! - -noteInfo() => ( - children: [ - /// () - ( - cellType: 'header', - offset: 0, - end: 130, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// (print(const MD(r''' # 菜单Menu , print(const MD(r''' ## Checkb, print = print.next(title: cons, print(Row(children: [CheckboxM) - ( - cellType: 'body', - offset: 130, - end: 447, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// () - ( - cellType: 'tail', - offset: 447, - end: 449, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ) - ], - ); diff --git a/notes/flutter_web/lib/notes/widgets/container_widgets/menu/note.g.json b/notes/flutter_web/lib/notes/widgets/container_widgets/menu/note.g.json deleted file mode 100644 index 7f8f8990..00000000 --- a/notes/flutter_web/lib/notes/widgets/container_widgets/menu/note.g.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "/* note.g.json */": { - "zh-CN": "❗重要配置❗,由github.com/chen56/note生成,一个笔记一个目录,每个目录都生成一个note.g.json,用来记录这篇笔记的重要元数据,比如生成note的uri, 文件应被保存在版本控制中,比如git,不应编辑或移动此文件。 ", - "en": "❗ Important configuration ❗, generated by the github.com/chen56/note, one directory for each one note, note.g.json to record the important metadata of the note, for example generate the uri of note , the file should be saved in version control, such as git, and this file should not be edited or moved." - }, - "noteId": 47 -} \ No newline at end of file diff --git a/notes/flutter_web/lib/notes/widgets/container_widgets/scrollable/Dismissible/note.g.dart b/notes/flutter_web/lib/notes/widgets/container_widgets/scrollable/Dismissible/note.g.dart deleted file mode 100644 index ab765051..00000000 --- a/notes/flutter_web/lib/notes/widgets/container_widgets/scrollable/Dismissible/note.g.dart +++ /dev/null @@ -1,41 +0,0 @@ -// Generated by github.com/chen56/note, please don't edit! - -noteInfo() => ( - children: [ - /// () - ( - cellType: 'header', - offset: 0, - end: 129, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// (print(const MD(r''' ## 参考 [], - ), - - /// () - ( - cellType: 'tail', - offset: 226, - end: 228, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ) - ], - ); diff --git a/notes/flutter_web/lib/notes/widgets/container_widgets/scrollable/Dismissible/note.g.json b/notes/flutter_web/lib/notes/widgets/container_widgets/scrollable/Dismissible/note.g.json deleted file mode 100644 index 772e8a85..00000000 --- a/notes/flutter_web/lib/notes/widgets/container_widgets/scrollable/Dismissible/note.g.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "/* note.g.json */": { - "zh-CN": "❗重要配置❗,由github.com/chen56/note生成,一个笔记一个目录,每个目录都生成一个note.g.json,用来记录这篇笔记的重要元数据,比如生成note的uri, 文件应被保存在版本控制中,比如git,不应编辑或移动此文件。 ", - "en": "❗ Important configuration ❗, generated by the github.com/chen56/note, one directory for each one note, note.g.json to record the important metadata of the note, for example generate the uri of note , the file should be saved in version control, such as git, and this file should not be edited or moved." - }, - "noteId": 48 -} \ No newline at end of file diff --git a/notes/flutter_web/lib/notes/widgets/specific_widgets/button/ButtonStyleButton/note.g.dart b/notes/flutter_web/lib/notes/widgets/specific_widgets/button/ButtonStyleButton/note.g.dart deleted file mode 100644 index d8a23e59..00000000 --- a/notes/flutter_web/lib/notes/widgets/specific_widgets/button/ButtonStyleButton/note.g.dart +++ /dev/null @@ -1,41 +0,0 @@ -// Generated by github.com/chen56/note, please don't edit! - -noteInfo() => ( - children: [ - /// () - ( - cellType: 'header', - offset: 0, - end: 130, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// (print(const MD(r''' # ButtonSt, print = print.next(title: cons, print(Wrap(children: [Elevated, print = print.next(title: cons, print(const MD(r''' ## 范例2 Met) - ( - cellType: 'body', - offset: 130, - end: 980, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// () - ( - cellType: 'tail', - offset: 980, - end: 982, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ) - ], - ); diff --git a/notes/flutter_web/lib/notes/widgets/specific_widgets/button/ButtonStyleButton/note.g.json b/notes/flutter_web/lib/notes/widgets/specific_widgets/button/ButtonStyleButton/note.g.json deleted file mode 100644 index 2af62d65..00000000 --- a/notes/flutter_web/lib/notes/widgets/specific_widgets/button/ButtonStyleButton/note.g.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "/* note.g.json */": { - "zh-CN": "❗重要配置❗,由github.com/chen56/note生成,一个笔记一个目录,每个目录都生成一个note.g.json,用来记录这篇笔记的重要元数据,比如生成note的uri, 文件应被保存在版本控制中,比如git,不应编辑或移动此文件。 ", - "en": "❗ Important configuration ❗, generated by the github.com/chen56/note, one directory for each one note, note.g.json to record the important metadata of the note, for example generate the uri of note , the file should be saved in version control, such as git, and this file should not be edited or moved." - }, - "noteId": 36 -} \ No newline at end of file diff --git a/notes/flutter_web/lib/notes/widgets/specific_widgets/button/FloatingActionButton/note.g.dart b/notes/flutter_web/lib/notes/widgets/specific_widgets/button/FloatingActionButton/note.g.dart deleted file mode 100644 index 1da4e117..00000000 --- a/notes/flutter_web/lib/notes/widgets/specific_widgets/button/FloatingActionButton/note.g.dart +++ /dev/null @@ -1,41 +0,0 @@ -// Generated by github.com/chen56/note, please don't edit! - -noteInfo() => ( - children: [ - /// () - ( - cellType: 'header', - offset: 0, - end: 130, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// (print(const MD(r''' # Floating) - ( - cellType: 'body', - offset: 130, - end: 443, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// () - ( - cellType: 'tail', - offset: 443, - end: 445, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ) - ], - ); diff --git a/notes/flutter_web/lib/notes/widgets/specific_widgets/button/FloatingActionButton/note.g.json b/notes/flutter_web/lib/notes/widgets/specific_widgets/button/FloatingActionButton/note.g.json deleted file mode 100644 index 1a5ca0c0..00000000 --- a/notes/flutter_web/lib/notes/widgets/specific_widgets/button/FloatingActionButton/note.g.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "/* note.g.json */": { - "zh-CN": "❗重要配置❗,由github.com/chen56/note生成,一个笔记一个目录,每个目录都生成一个note.g.json,用来记录这篇笔记的重要元数据,比如生成note的uri, 文件应被保存在版本控制中,比如git,不应编辑或移动此文件。 ", - "en": "❗ Important configuration ❗, generated by the github.com/chen56/note, one directory for each one note, note.g.json to record the important metadata of the note, for example generate the uri of note , the file should be saved in version control, such as git, and this file should not be edited or moved." - }, - "noteId": 37 -} \ No newline at end of file diff --git a/notes/flutter_web/lib/notes/widgets/specific_widgets/button/IconButton/note.g.dart b/notes/flutter_web/lib/notes/widgets/specific_widgets/button/IconButton/note.g.dart deleted file mode 100644 index 255c3689..00000000 --- a/notes/flutter_web/lib/notes/widgets/specific_widgets/button/IconButton/note.g.dart +++ /dev/null @@ -1,41 +0,0 @@ -// Generated by github.com/chen56/note, please don't edit! - -noteInfo() => ( - children: [ - /// () - ( - cellType: 'header', - offset: 0, - end: 130, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// (print(const MD(r''' # IconButt, print = print.next(title: cons, print(const Wrap(children: [])) - ( - cellType: 'body', - offset: 130, - end: 411, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// () - ( - cellType: 'tail', - offset: 411, - end: 413, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ) - ], - ); diff --git a/notes/flutter_web/lib/notes/widgets/specific_widgets/button/IconButton/note.g.json b/notes/flutter_web/lib/notes/widgets/specific_widgets/button/IconButton/note.g.json deleted file mode 100644 index 5d113ea9..00000000 --- a/notes/flutter_web/lib/notes/widgets/specific_widgets/button/IconButton/note.g.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "/* note.g.json */": { - "zh-CN": "❗重要配置❗,由github.com/chen56/note生成,一个笔记一个目录,每个目录都生成一个note.g.json,用来记录这篇笔记的重要元数据,比如生成note的uri, 文件应被保存在版本控制中,比如git,不应编辑或移动此文件。 ", - "en": "❗ Important configuration ❗, generated by the github.com/chen56/note, one directory for each one note, note.g.json to record the important metadata of the note, for example generate the uri of note , the file should be saved in version control, such as git, and this file should not be edited or moved." - }, - "noteId": 38 -} \ No newline at end of file diff --git a/notes/flutter_web/lib/notes/widgets/specific_widgets/button/overview/note.g.dart b/notes/flutter_web/lib/notes/widgets/specific_widgets/button/overview/note.g.dart deleted file mode 100644 index 4e160cf2..00000000 --- a/notes/flutter_web/lib/notes/widgets/specific_widgets/button/overview/note.g.dart +++ /dev/null @@ -1,245 +0,0 @@ -// Generated by github.com/chen56/note, please don't edit! - -noteInfo() => ( - children: [ - /// () - ( - cellType: 'header', - offset: 0, - end: 130, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// () - ( - cellType: 'body', - offset: 130, - end: 133, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// (print(const MD(r''' # overview) - ( - cellType: 'body', - offset: 188, - end: 443, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// (print(Wrap(children: [Elevated) - ( - cellType: 'body', - offset: 498, - end: 926, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// (print(const MD(r''' ### IconBu) - ( - cellType: 'body', - offset: 981, - end: 1038, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// (print(Row(children: [IconButto) - ( - cellType: 'body', - offset: 1093, - end: 1408, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// (print(const MD(r''' ### Floati) - ( - cellType: 'body', - offset: 1463, - end: 1552, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// (int id = 0;, print(Row(children: [FloatingA) - ( - cellType: 'body', - offset: 1607, - end: 2489, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// (print(const MD(r''' ### 几个特殊的系) - ( - cellType: 'body', - offset: 2544, - end: 2881, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// (print(const Row(children: [Bac) - ( - cellType: 'body', - offset: 2936, - end: 3076, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// (print(const MD(r''' ### Toggl) - ( - cellType: 'body', - offset: 3131, - end: 3285, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// (print(Row(children: [ToggleBut) - ( - cellType: 'body', - offset: 3340, - end: 3622, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// (print(const MD(r''' ### Segmen) - ( - cellType: 'body', - offset: 3677, - end: 3883, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// (print(Row(children: [Segmented) - ( - cellType: 'body', - offset: 3938, - end: 4624, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// (print(const MD(r''' ## 相关组件 #) - ( - cellType: 'body', - offset: 4679, - end: 5215, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// (print(const MD(r''' ### Ink*组件) - ( - cellType: 'body', - offset: 5270, - end: 5465, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// (print(Column(children: [const ) - ( - cellType: 'body', - offset: 5520, - end: 5794, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// (print(const MD(r''' ### Button) - ( - cellType: 'body', - offset: 5849, - end: 5958, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// (print(Container(width: 600, co) - ( - cellType: 'body', - offset: 6013, - end: 6403, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// () - ( - cellType: 'tail', - offset: 6403, - end: 6405, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ) - ], - ); diff --git a/notes/flutter_web/lib/notes/widgets/specific_widgets/button/overview/note.g.json b/notes/flutter_web/lib/notes/widgets/specific_widgets/button/overview/note.g.json deleted file mode 100644 index 68dc9ab8..00000000 --- a/notes/flutter_web/lib/notes/widgets/specific_widgets/button/overview/note.g.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "/* note.g.json */": { - "zh-CN": "❗重要配置❗,由github.com/chen56/note生成,一个笔记一个目录,每个目录都生成一个note.g.json,用来记录这篇笔记的重要元数据,比如生成note的uri, 文件应被保存在版本控制中,比如git,不应编辑或移动此文件。 ", - "en": "❗ Important configuration ❗, generated by the github.com/chen56/note, one directory for each one note, note.g.json to record the important metadata of the note, for example generate the uri of note , the file should be saved in version control, such as git, and this file should not be edited or moved." - }, - "noteId": 39 -} \ No newline at end of file diff --git a/notes/flutter_web/lib/notes/widgets/specific_widgets/icon/note.g.dart b/notes/flutter_web/lib/notes/widgets/specific_widgets/icon/note.g.dart deleted file mode 100644 index ccdd17f5..00000000 --- a/notes/flutter_web/lib/notes/widgets/specific_widgets/icon/note.g.dart +++ /dev/null @@ -1,41 +0,0 @@ -// Generated by github.com/chen56/note, please don't edit! - -noteInfo() => ( - children: [ - /// () - ( - cellType: 'header', - offset: 0, - end: 477, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// (print(const MD(''' # Material , print = print.next(title: cons, var sampleIcons = {"access_tim, for (var entry in sampleIcons.) - ( - cellType: 'body', - offset: 477, - end: 1122, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// () - ( - cellType: 'tail', - offset: 1122, - end: 1124, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ) - ], - ); diff --git a/notes/flutter_web/lib/notes/widgets/specific_widgets/icon/note.g.json b/notes/flutter_web/lib/notes/widgets/specific_widgets/icon/note.g.json deleted file mode 100644 index 4e4b1e79..00000000 --- a/notes/flutter_web/lib/notes/widgets/specific_widgets/icon/note.g.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "/* note.g.json */": { - "zh-CN": "❗重要配置❗,由github.com/chen56/note生成,一个笔记一个目录,每个目录都生成一个note.g.json,用来记录这篇笔记的重要元数据,比如生成note的uri, 文件应被保存在版本控制中,比如git,不应编辑或移动此文件。 ", - "en": "❗ Important configuration ❗, generated by the github.com/chen56/note, one directory for each one note, note.g.json to record the important metadata of the note, for example generate the uri of note , the file should be saved in version control, such as git, and this file should not be edited or moved." - }, - "noteId": 42 -} \ No newline at end of file diff --git a/notes/flutter_web/lib/notes/widgets/specific_widgets/input/note.g.dart b/notes/flutter_web/lib/notes/widgets/specific_widgets/input/note.g.dart deleted file mode 100644 index 911a4770..00000000 --- a/notes/flutter_web/lib/notes/widgets/specific_widgets/input/note.g.dart +++ /dev/null @@ -1,41 +0,0 @@ -// Generated by github.com/chen56/note, please don't edit! - -noteInfo() => ( - children: [ - /// () - ( - cellType: 'header', - offset: 0, - end: 130, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// (print(const MD(r''' # input ) - ( - cellType: 'body', - offset: 130, - end: 172, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// () - ( - cellType: 'tail', - offset: 172, - end: 174, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ) - ], - ); diff --git a/notes/flutter_web/lib/notes/widgets/specific_widgets/input/note.g.json b/notes/flutter_web/lib/notes/widgets/specific_widgets/input/note.g.json deleted file mode 100644 index f492a2b9..00000000 --- a/notes/flutter_web/lib/notes/widgets/specific_widgets/input/note.g.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "/* note.g.json */": { - "zh-CN": "❗重要配置❗,由github.com/chen56/note生成,一个笔记一个目录,每个目录都生成一个note.g.json,用来记录这篇笔记的重要元数据,比如生成note的uri, 文件应被保存在版本控制中,比如git,不应编辑或移动此文件。 ", - "en": "❗ Important configuration ❗, generated by the github.com/chen56/note, one directory for each one note, note.g.json to record the important metadata of the note, for example generate the uri of note , the file should be saved in version control, such as git, and this file should not be edited or moved." - }, - "noteId": 32 -} \ No newline at end of file diff --git a/notes/flutter_web/lib/notes/widgets/specific_widgets/selectable/note.g.dart b/notes/flutter_web/lib/notes/widgets/specific_widgets/selectable/note.g.dart deleted file mode 100644 index ef13bea5..00000000 --- a/notes/flutter_web/lib/notes/widgets/specific_widgets/selectable/note.g.dart +++ /dev/null @@ -1,41 +0,0 @@ -// Generated by github.com/chen56/note, please don't edit! - -noteInfo() => ( - children: [ - /// () - ( - cellType: 'header', - offset: 0, - end: 129, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// (print(const MD(r''' ## flutter) - ( - cellType: 'body', - offset: 129, - end: 213, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// () - ( - cellType: 'tail', - offset: 213, - end: 215, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ) - ], - ); diff --git a/notes/flutter_web/lib/notes/widgets/specific_widgets/selectable/note.g.json b/notes/flutter_web/lib/notes/widgets/specific_widgets/selectable/note.g.json deleted file mode 100644 index dd1fa654..00000000 --- a/notes/flutter_web/lib/notes/widgets/specific_widgets/selectable/note.g.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "/* note.g.json */": { - "zh-CN": "❗重要配置❗,由github.com/chen56/note生成,一个笔记一个目录,每个目录都生成一个note.g.json,用来记录这篇笔记的重要元数据,比如生成note的uri, 文件应被保存在版本控制中,比如git,不应编辑或移动此文件。 ", - "en": "❗ Important configuration ❗, generated by the github.com/chen56/note, one directory for each one note, note.g.json to record the important metadata of the note, for example generate the uri of note , the file should be saved in version control, such as git, and this file should not be edited or moved." - }, - "noteId": 35 -} \ No newline at end of file diff --git a/notes/flutter_web/lib/notes/widgets/specific_widgets/slider/note.g.dart b/notes/flutter_web/lib/notes/widgets/specific_widgets/slider/note.g.dart deleted file mode 100644 index 831cd370..00000000 --- a/notes/flutter_web/lib/notes/widgets/specific_widgets/slider/note.g.dart +++ /dev/null @@ -1,41 +0,0 @@ -// Generated by github.com/chen56/note, please don't edit! - -noteInfo() => ( - children: [ - /// () - ( - cellType: 'header', - offset: 0, - end: 129, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// (print(const MD(r''' # 进度条 ## , print(const MD(r''' ## 范例1 富文本) - ( - cellType: 'body', - offset: 129, - end: 250, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// () - ( - cellType: 'tail', - offset: 250, - end: 252, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ) - ], - ); diff --git a/notes/flutter_web/lib/notes/widgets/specific_widgets/slider/note.g.json b/notes/flutter_web/lib/notes/widgets/specific_widgets/slider/note.g.json deleted file mode 100644 index 3c4f6d01..00000000 --- a/notes/flutter_web/lib/notes/widgets/specific_widgets/slider/note.g.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "/* note.g.json */": { - "zh-CN": "❗重要配置❗,由github.com/chen56/note生成,一个笔记一个目录,每个目录都生成一个note.g.json,用来记录这篇笔记的重要元数据,比如生成note的uri, 文件应被保存在版本控制中,比如git,不应编辑或移动此文件。 ", - "en": "❗ Important configuration ❗, generated by the github.com/chen56/note, one directory for each one note, note.g.json to record the important metadata of the note, for example generate the uri of note , the file should be saved in version control, such as git, and this file should not be edited or moved." - }, - "noteId": 34 -} \ No newline at end of file diff --git a/notes/flutter_web/lib/notes/widgets/specific_widgets/text/RichText/note.g.dart b/notes/flutter_web/lib/notes/widgets/specific_widgets/text/RichText/note.g.dart deleted file mode 100644 index aefd4d7c..00000000 --- a/notes/flutter_web/lib/notes/widgets/specific_widgets/text/RichText/note.g.dart +++ /dev/null @@ -1,41 +0,0 @@ -// Generated by github.com/chen56/note, please don't edit! - -noteInfo() => ( - children: [ - /// () - ( - cellType: 'header', - offset: 0, - end: 129, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// (print(const MD(r''' ## 范例1 普通文) - ( - cellType: 'body', - offset: 129, - end: 190, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// () - ( - cellType: 'tail', - offset: 190, - end: 192, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ) - ], - ); diff --git a/notes/flutter_web/lib/notes/widgets/specific_widgets/text/RichText/note.g.json b/notes/flutter_web/lib/notes/widgets/specific_widgets/text/RichText/note.g.json deleted file mode 100644 index fb650b3b..00000000 --- a/notes/flutter_web/lib/notes/widgets/specific_widgets/text/RichText/note.g.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "/* note.g.json */": { - "zh-CN": "❗重要配置❗,由github.com/chen56/note生成,一个笔记一个目录,每个目录都生成一个note.g.json,用来记录这篇笔记的重要元数据,比如生成note的uri, 文件应被保存在版本控制中,比如git,不应编辑或移动此文件。 ", - "en": "❗ Important configuration ❗, generated by the github.com/chen56/note, one directory for each one note, note.g.json to record the important metadata of the note, for example generate the uri of note , the file should be saved in version control, such as git, and this file should not be edited or moved." - }, - "noteId": 40 -} \ No newline at end of file diff --git a/notes/flutter_web/lib/notes/widgets/specific_widgets/text/Text/note.g.dart b/notes/flutter_web/lib/notes/widgets/specific_widgets/text/Text/note.g.dart deleted file mode 100644 index aba609ef..00000000 --- a/notes/flutter_web/lib/notes/widgets/specific_widgets/text/Text/note.g.dart +++ /dev/null @@ -1,41 +0,0 @@ -// Generated by github.com/chen56/note, please don't edit! - -noteInfo() => ( - children: [ - /// () - ( - cellType: 'header', - offset: 0, - end: 129, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// (print(const MD(r''' ## 范例1 普通文, print(const MD(r''' ## 范例1 富文本) - ( - cellType: 'body', - offset: 129, - end: 341, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// () - ( - cellType: 'tail', - offset: 341, - end: 343, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ) - ], - ); diff --git a/notes/flutter_web/lib/notes/widgets/specific_widgets/text/Text/note.g.json b/notes/flutter_web/lib/notes/widgets/specific_widgets/text/Text/note.g.json deleted file mode 100644 index ab12fbd2..00000000 --- a/notes/flutter_web/lib/notes/widgets/specific_widgets/text/Text/note.g.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "/* note.g.json */": { - "zh-CN": "❗重要配置❗,由github.com/chen56/note生成,一个笔记一个目录,每个目录都生成一个note.g.json,用来记录这篇笔记的重要元数据,比如生成note的uri, 文件应被保存在版本控制中,比如git,不应编辑或移动此文件。 ", - "en": "❗ Important configuration ❗, generated by the github.com/chen56/note, one directory for each one note, note.g.json to record the important metadata of the note, for example generate the uri of note , the file should be saved in version control, such as git, and this file should not be edited or moved." - }, - "noteId": 41 -} \ No newline at end of file diff --git a/notes/flutter_web/lib/notes/widgets/specific_widgets/webview/note.g.dart b/notes/flutter_web/lib/notes/widgets/specific_widgets/webview/note.g.dart deleted file mode 100644 index fb2ffcad..00000000 --- a/notes/flutter_web/lib/notes/widgets/specific_widgets/webview/note.g.dart +++ /dev/null @@ -1,41 +0,0 @@ -// Generated by github.com/chen56/note, please don't edit! - -noteInfo() => ( - children: [ - /// () - ( - cellType: 'header', - offset: 0, - end: 161, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// (print(const MD(r''' # webview ) - ( - cellType: 'body', - offset: 161, - end: 338, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// () - ( - cellType: 'tail', - offset: 338, - end: 340, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ) - ], - ); diff --git a/notes/flutter_web/lib/notes/widgets/specific_widgets/webview/note.g.json b/notes/flutter_web/lib/notes/widgets/specific_widgets/webview/note.g.json deleted file mode 100644 index deb6f124..00000000 --- a/notes/flutter_web/lib/notes/widgets/specific_widgets/webview/note.g.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "/* note.g.json */": { - "zh-CN": "❗重要配置❗,由github.com/chen56/note生成,一个笔记一个目录,每个目录都生成一个note.g.json,用来记录这篇笔记的重要元数据,比如生成note的uri, 文件应被保存在版本控制中,比如git,不应编辑或移动此文件。 ", - "en": "❗ Important configuration ❗, generated by the github.com/chen56/note, one directory for each one note, note.g.json to record the important metadata of the note, for example generate the uri of note , the file should be saved in version control, such as git, and this file should not be edited or moved." - }, - "noteId": 33 -} \ No newline at end of file diff --git a/notes/flutter_web/lib/notes/x.note_inside/1.welcome/note.g.dart b/notes/flutter_web/lib/notes/x.note_inside/1.welcome/note.g.dart deleted file mode 100644 index d867800e..00000000 --- a/notes/flutter_web/lib/notes/x.note_inside/1.welcome/note.g.dart +++ /dev/null @@ -1,41 +0,0 @@ -// Generated by github.com/chen56/note, please don't edit! - -noteInfo() => ( - children: [ - /// () - ( - cellType: 'header', - offset: 0, - end: 130, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// (print(const MD(r''' # flutter , print = print.next(title: cons, print(Row(children: [., ..., print = print.next(title: cons, print(const MD(r''' 组件组合是不是很棒) - ( - cellType: 'body', - offset: 130, - end: 2558, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// () - ( - cellType: 'tail', - offset: 2558, - end: 2560, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ) - ], - ); diff --git a/notes/flutter_web/lib/notes/x.note_inside/1.welcome/note.g.json b/notes/flutter_web/lib/notes/x.note_inside/1.welcome/note.g.json deleted file mode 100644 index 8649fab7..00000000 --- a/notes/flutter_web/lib/notes/x.note_inside/1.welcome/note.g.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "/* note.g.json */": { - "zh-CN": "❗重要配置❗,由github.com/chen56/note生成,一个笔记一个目录,每个目录都生成一个note.g.json,用来记录这篇笔记的重要元数据,比如生成note的uri, 文件应被保存在版本控制中,比如git,不应编辑或移动此文件。 ", - "en": "❗ Important configuration ❗, generated by the github.com/chen56/note, one directory for each one note, note.g.json to record the important metadata of the note, for example generate the uri of note , the file should be saved in version control, such as git, and this file should not be edited or moved." - }, - "noteId": 28 -} \ No newline at end of file diff --git a/notes/flutter_web/lib/notes/x.note_inside/how_note_work/note.g.dart b/notes/flutter_web/lib/notes/x.note_inside/how_note_work/note.g.dart deleted file mode 100644 index 1c2eefa7..00000000 --- a/notes/flutter_web/lib/notes/x.note_inside/how_note_work/note.g.dart +++ /dev/null @@ -1,293 +0,0 @@ -// Generated by github.com/chen56/note, please don't edit! - -noteInfo() => ( - children: [ - /// () - ( - cellType: 'header', - offset: 0, - end: 211, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// (print(const MD(r''' # Notebook) - ( - cellType: 'body', - offset: 211, - end: 361, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// (print("hello flutter-note , i , print("today is ${DateTime.now) - ( - cellType: 'body', - offset: 416, - end: 506, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// (print(const MD(r''' notebook的方) - ( - cellType: 'body', - offset: 561, - end: 749, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// (print(ToggleButtons(isSelected) - ( - cellType: 'body', - offset: 804, - end: 982, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// (print(const MD(r''' 或者,发现[Time) - ( - cellType: 'body', - offset: 1037, - end: 1180, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// (ValueNotifier times = Val, int maxTimes = 600;, var random = Random(1);, Timer.periodic(const Duration(, print(ListenableBuilder(listen) - ( - cellType: 'body', - offset: 1235, - end: 1937, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// (print(const MD(""" notebook模式的) - ( - cellType: 'body', - offset: 1992, - end: 2373, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// (print("hello");, print(1);, print(true);, print(["a", "b", "c"]);) - ( - cellType: 'body', - offset: 2428, - end: 2503, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// (print(const MD(""" ### Markdow) - ( - cellType: 'body', - offset: 2558, - end: 2662, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// (print(const MD("""hello markdo) - ( - cellType: 'body', - offset: 2717, - end: 2764, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// (print(const MD(""" ### WidgetC) - ( - cellType: 'body', - offset: 2819, - end: 2870, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// (print(Container(width: 100, he) - ( - cellType: 'body', - offset: 2925, - end: 2994, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// (print(const MD(""" ### SampleC) - ( - cellType: 'body', - offset: 3049, - end: 3293, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// (print(Container(width: 100, he, print(Container(width: 100, he) - ( - cellType: 'body', - offset: 3348, - end: 3539, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// (print(const MD(""" ## 事件回调的问题 ) - ( - cellType: 'body', - offset: 3594, - end: 3693, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// ({int count = 0; print(Elevated) - ( - cellType: 'body', - offset: 3748, - end: 3962, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// (print(const MD(""" 问题原因:onPres) - ( - cellType: 'body', - offset: 4017, - end: 4294, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// (int i = 0;, print(StatefulBuilder(builder:) - ( - cellType: 'body', - offset: 4349, - end: 4558, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// (print(const MD(""" 或用runInCurr) - ( - cellType: 'body', - offset: 4613, - end: 4703, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// (print(const MD(""" ## cell的元信息) - ( - cellType: 'body', - offset: 4758, - end: 4802, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// () - ( - cellType: 'body', - offset: 4857, - end: 5138, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// (print(const MD(""" ## 结束 上面回调) - ( - cellType: 'body', - offset: 5193, - end: 5266, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// () - ( - cellType: 'tail', - offset: 5266, - end: 5268, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ) - ], - ); diff --git a/notes/flutter_web/lib/notes/x.note_inside/how_note_work/note.g.json b/notes/flutter_web/lib/notes/x.note_inside/how_note_work/note.g.json deleted file mode 100644 index d3a7e8bb..00000000 --- a/notes/flutter_web/lib/notes/x.note_inside/how_note_work/note.g.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "/* note.g.json */": { - "zh-CN": "❗重要配置❗,由github.com/chen56/note生成,一个笔记一个目录,每个目录都生成一个note.g.json,用来记录这篇笔记的重要元数据,比如生成note的uri, 文件应被保存在版本控制中,比如git,不应编辑或移动此文件。 ", - "en": "❗ Important configuration ❗, generated by the github.com/chen56/note, one directory for each one note, note.g.json to record the important metadata of the note, for example generate the uri of note , the file should be saved in version control, such as git, and this file should not be edited or moved." - }, - "noteId": 24 -} \ No newline at end of file diff --git a/notes/flutter_web/lib/notes/x.note_inside/mockup_content/note.g.dart b/notes/flutter_web/lib/notes/x.note_inside/mockup_content/note.g.dart deleted file mode 100644 index 12c69a0b..00000000 --- a/notes/flutter_web/lib/notes/x.note_inside/mockup_content/note.g.dart +++ /dev/null @@ -1,41 +0,0 @@ -// Generated by github.com/chen56/note, please don't edit! - -noteInfo() => ( - children: [ - /// () - ( - cellType: 'header', - offset: 0, - end: 176, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// (print(MD(''' '''));, print(MockupWindow()(LayoutBui, print(MockupWindow()(LayoutBui, print(MockupWindow(width: 1000, print(MockupWindow(height: 100) - ( - cellType: 'body', - offset: 176, - end: 1769, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// () - ( - cellType: 'tail', - offset: 1769, - end: 1771, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ) - ], - ); diff --git a/notes/flutter_web/lib/notes/x.note_inside/mockup_content/note.g.json b/notes/flutter_web/lib/notes/x.note_inside/mockup_content/note.g.json deleted file mode 100644 index 75fc6265..00000000 --- a/notes/flutter_web/lib/notes/x.note_inside/mockup_content/note.g.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "/* note.g.json */": { - "zh-CN": "❗重要配置❗,由github.com/chen56/note生成,一个笔记一个目录,每个目录都生成一个note.g.json,用来记录这篇笔记的重要元数据,比如生成note的uri, 文件应被保存在版本控制中,比如git,不应编辑或移动此文件。 ", - "en": "❗ Important configuration ❗, generated by the github.com/chen56/note, one directory for each one note, note.g.json to record the important metadata of the note, for example generate the uri of note , the file should be saved in version control, such as git, and this file should not be edited or moved." - }, - "noteId": 27 -} \ No newline at end of file diff --git a/notes/flutter_web/lib/notes/x.note_inside/note_api_thinking/note.g.dart b/notes/flutter_web/lib/notes/x.note_inside/note_api_thinking/note.g.dart deleted file mode 100644 index de0aa52c..00000000 --- a/notes/flutter_web/lib/notes/x.note_inside/note_api_thinking/note.g.dart +++ /dev/null @@ -1,41 +0,0 @@ -// Generated by github.com/chen56/note, please don't edit! - -noteInfo() => ( - children: [ - /// () - ( - cellType: 'header', - offset: 0, - end: 210, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// (var i = 1;, print.runInCurrentCell((print), print.level(title: const Text(, {void x({Text title = const Te) - ( - cellType: 'body', - offset: 210, - end: 2474, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// () - ( - cellType: 'tail', - offset: 2474, - end: 2576, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ) - ], - ); diff --git a/notes/flutter_web/lib/notes/x.note_inside/note_api_thinking/note.g.json b/notes/flutter_web/lib/notes/x.note_inside/note_api_thinking/note.g.json deleted file mode 100644 index 0a52c1ea..00000000 --- a/notes/flutter_web/lib/notes/x.note_inside/note_api_thinking/note.g.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "/* note.g.json */": { - "zh-CN": "❗重要配置❗,由github.com/chen56/note生成,一个笔记一个目录,每个目录都生成一个note.g.json,用来记录这篇笔记的重要元数据,比如生成note的uri, 文件应被保存在版本控制中,比如git,不应编辑或移动此文件。 ", - "en": "❗ Important configuration ❗, generated by the github.com/chen56/note, one directory for each one note, note.g.json to record the important metadata of the note, for example generate the uri of note , the file should be saved in version control, such as git, and this file should not be edited or moved." - }, - "noteId": 29 -} \ No newline at end of file diff --git a/notes/flutter_web/lib/notes/x.note_inside/note_test_self/nobody/note.g.dart b/notes/flutter_web/lib/notes/x.note_inside/note_test_self/nobody/note.g.dart deleted file mode 100644 index 29370886..00000000 --- a/notes/flutter_web/lib/notes/x.note_inside/note_test_self/nobody/note.g.dart +++ /dev/null @@ -1,41 +0,0 @@ -// Generated by github.com/chen56/note, please don't edit! - -noteInfo() => ( - children: [ - /// () - ( - cellType: 'header', - offset: 0, - end: 130, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// (print(const MD(r''' # test自测目录) - ( - cellType: 'body', - offset: 130, - end: 221, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// () - ( - cellType: 'tail', - offset: 221, - end: 223, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ) - ], - ); diff --git a/notes/flutter_web/lib/notes/x.note_inside/note_test_self/nobody/note.g.json b/notes/flutter_web/lib/notes/x.note_inside/note_test_self/nobody/note.g.json deleted file mode 100644 index 9b268978..00000000 --- a/notes/flutter_web/lib/notes/x.note_inside/note_test_self/nobody/note.g.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "/* note.g.json */": { - "zh-CN": "❗重要配置❗,由github.com/chen56/note生成,一个笔记一个目录,每个目录都生成一个note.g.json,用来记录这篇笔记的重要元数据,比如生成note的uri, 文件应被保存在版本控制中,比如git,不应编辑或移动此文件。 ", - "en": "❗ Important configuration ❗, generated by the github.com/chen56/note, one directory for each one note, note.g.json to record the important metadata of the note, for example generate the uri of note , the file should be saved in version control, such as git, and this file should not be edited or moved." - }, - "noteId": 30 -} \ No newline at end of file diff --git a/notes/flutter_web/lib/notes/x.note_inside/note_test_self/note.g.dart b/notes/flutter_web/lib/notes/x.note_inside/note_test_self/note.g.dart deleted file mode 100644 index f706c2f2..00000000 --- a/notes/flutter_web/lib/notes/x.note_inside/note_test_self/note.g.dart +++ /dev/null @@ -1,41 +0,0 @@ -// Generated by github.com/chen56/note, please don't edit! - -noteInfo() => ( - children: [ - /// () - ( - cellType: 'header', - offset: 0, - end: 161, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// (print(const MD(r''' # test自测目录) - ( - cellType: 'body', - offset: 161, - end: 225, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ), - - /// () - ( - cellType: 'tail', - offset: 225, - end: 227, - specialNodes: <({ - String nodeType, - int end, - int offset, - })>[], - ) - ], - ); diff --git a/notes/flutter_web/lib/notes/x.note_inside/note_test_self/note.g.json b/notes/flutter_web/lib/notes/x.note_inside/note_test_self/note.g.json deleted file mode 100644 index 4c97781b..00000000 --- a/notes/flutter_web/lib/notes/x.note_inside/note_test_self/note.g.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "/* note.g.json */": { - "zh-CN": "❗重要配置❗,由github.com/chen56/note生成,一个笔记一个目录,每个目录都生成一个note.g.json,用来记录这篇笔记的重要元数据,比如生成note的uri, 文件应被保存在版本控制中,比如git,不应编辑或移动此文件。 ", - "en": "❗ Important configuration ❗, generated by the github.com/chen56/note, one directory for each one note, note.g.json to record the important metadata of the note, for example generate the uri of note , the file should be saved in version control, such as git, and this file should not be edited or moved." - }, - "noteId": 31 -} \ No newline at end of file diff --git a/notes/flutter_web/lib/routes.g.dart b/notes/flutter_web/lib/routes.g.dart new file mode 100644 index 00000000..e310cf6b --- /dev/null +++ b/notes/flutter_web/lib/routes.g.dart @@ -0,0 +1,231 @@ +// // Generated by https://github.com/chen56/you +// - This file setup routes tree and strong type `routes` reference +// - This file should be version controlled and should not be manually edited +// +// ignore_for_file: prefer_function_declarations_over_variables +// ignore_for_file: library_prefixes +// ignore_for_file: non_constant_identifier_names + +// ignore_for_file: no_leading_underscores_for_library_prefixes +import 'package:you_flutter/router.dart'; +import 'package:flutter_web/routes/page.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'; +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; + +mixin RoutesMixin { + final To root = To('routes', builder: build, children: [ + ToNote('notes', builder: _notes_page.build, layout: layout, children: [ + ToNote('research', children: [ + ToNote('bash_note'), + ToNote('parameterized', builder: _parameterized_page.build), + ToNote('remote_view', builder: _remote_view_page.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('navigation', builder: _navigation_page.build, children: [ + ToNote('navigator_v1'), + ToNote('navigator_v2'), + ]), + ToNote('state', builder: _state_page.build, children: [ + ToNote('1.vanilla_state', builder: _1_vanilla_state_page.build), + ToNote('StatefulBuilder', builder: _StatefulBuilder_page.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('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('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('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), + ]), + ]), + ]); + 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/notes/Improve_app/1.overview/note.dart b/notes/flutter_web/lib/routes/notes/Improve_app/1.overview/page.dart similarity index 100% rename from notes/flutter_web/lib/notes/Improve_app/1.overview/note.dart rename to notes/flutter_web/lib/routes/notes/Improve_app/1.overview/page.dart diff --git a/notes/flutter_web/lib/notes/Improve_app/RepaintBoundary/note.dart b/notes/flutter_web/lib/routes/notes/Improve_app/RepaintBoundary/page.dart similarity index 100% rename from notes/flutter_web/lib/notes/Improve_app/RepaintBoundary/note.dart rename to notes/flutter_web/lib/routes/notes/Improve_app/RepaintBoundary/page.dart diff --git a/notes/flutter_web/lib/notes/Improve_app/error_handle/main_error1_FlutterError.onError.dart b/notes/flutter_web/lib/routes/notes/Improve_app/error_handle/main_error1_FlutterError.onError.dart similarity index 100% rename from notes/flutter_web/lib/notes/Improve_app/error_handle/main_error1_FlutterError.onError.dart rename to notes/flutter_web/lib/routes/notes/Improve_app/error_handle/main_error1_FlutterError.onError.dart diff --git a/notes/flutter_web/lib/notes/Improve_app/event&listener&lifeycle/note.dart b/notes/flutter_web/lib/routes/notes/Improve_app/event&listener&lifeycle/page.dart similarity index 100% rename from notes/flutter_web/lib/notes/Improve_app/event&listener&lifeycle/note.dart rename to notes/flutter_web/lib/routes/notes/Improve_app/event&listener&lifeycle/page.dart diff --git a/notes/flutter_web/lib/notes/Improve_app/note.dart b/notes/flutter_web/lib/routes/notes/Improve_app/page.dart similarity index 100% rename from notes/flutter_web/lib/notes/Improve_app/note.dart rename to notes/flutter_web/lib/routes/notes/Improve_app/page.dart diff --git a/notes/flutter_web/lib/notes/Improve_app/web_optimization/1.deferrred_lib_main.dart b/notes/flutter_web/lib/routes/notes/Improve_app/web_optimization/1.deferrred_lib_main.dart similarity index 100% rename from notes/flutter_web/lib/notes/Improve_app/web_optimization/1.deferrred_lib_main.dart rename to notes/flutter_web/lib/routes/notes/Improve_app/web_optimization/1.deferrred_lib_main.dart diff --git a/notes/flutter_web/lib/notes/Improve_app/web_optimization/note.dart b/notes/flutter_web/lib/routes/notes/Improve_app/web_optimization/page.dart similarity index 96% rename from notes/flutter_web/lib/notes/Improve_app/web_optimization/note.dart rename to notes/flutter_web/lib/routes/notes/Improve_app/web_optimization/page.dart index f1396257..89bb6a44 100644 --- a/notes/flutter_web/lib/notes/Improve_app/web_optimization/note.dart +++ b/notes/flutter_web/lib/routes/notes/Improve_app/web_optimization/page.dart @@ -3,7 +3,7 @@ import 'package:flutter/widgets.dart'; import 'package:you_note_dart/note.dart'; -void build(BuildContext context, Cell print) { +void build(BuildContext context, Cell print) async{ print(const MD(r''' # web 优化 diff --git a/notes/flutter_web/lib/notes/dev/debug/note.dart b/notes/flutter_web/lib/routes/notes/dev/debug/page.dart similarity index 100% rename from notes/flutter_web/lib/notes/dev/debug/note.dart rename to notes/flutter_web/lib/routes/notes/dev/debug/page.dart diff --git a/notes/flutter_web/lib/notes/dev/devtool/note.dart b/notes/flutter_web/lib/routes/notes/dev/devtool/page.dart similarity index 100% rename from notes/flutter_web/lib/notes/dev/devtool/note.dart rename to notes/flutter_web/lib/routes/notes/dev/devtool/page.dart diff --git a/notes/flutter_web/lib/notes/dev/devtool/vmservice/note.dart b/notes/flutter_web/lib/routes/notes/dev/devtool/vmservice/page.dart similarity index 100% rename from notes/flutter_web/lib/notes/dev/devtool/vmservice/note.dart rename to notes/flutter_web/lib/routes/notes/dev/devtool/vmservice/page.dart diff --git a/notes/flutter_web/lib/notes/dev/host_mirror/note.dart b/notes/flutter_web/lib/routes/notes/dev/host_mirror/page.dart similarity index 97% rename from notes/flutter_web/lib/notes/dev/host_mirror/note.dart rename to notes/flutter_web/lib/routes/notes/dev/host_mirror/page.dart index f00553ff..5fe524d5 100644 --- a/notes/flutter_web/lib/notes/dev/host_mirror/note.dart +++ b/notes/flutter_web/lib/routes/notes/dev/host_mirror/page.dart @@ -37,7 +37,7 @@ export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn flutter run --device-id chrome --web-renderer canvaskit --release --dart-define=FLUTTER_WEB_CANVASKIT_URL=https://cdn.jsdelivr.net/npm/canvaskit-wasm@0.37.1/bin/ # build 也有效 -flutter build web -v --release --web-renderer canvaskit --dart-define=FLUTTER_WEB_CANVASKIT_URL=https://cdn.jsdelivr.net/npm/canvaskit-wasm@0.37.1/bin/ -t lib/notes/navigator/navigator_v2/3.1.navigator_v2_args_screen.dart +flutter build web -v --release --web-renderer canvaskit --dart-define=FLUTTER_WEB_CANVASKIT_URL=https://cdn.jsdelivr.net/npm/canvaskit-wasm@0.37.1/bin/ -t lib/routes/navigator/navigator_v2/3.1.navigator_v2_args_screen.dart ``` diff --git a/notes/flutter_web/lib/notes/dev/macos_config/note.dart b/notes/flutter_web/lib/routes/notes/dev/macos_config/page.dart similarity index 100% rename from notes/flutter_web/lib/notes/dev/macos_config/note.dart rename to notes/flutter_web/lib/routes/notes/dev/macos_config/page.dart diff --git a/notes/flutter_web/lib/notes/env_info/note.dart b/notes/flutter_web/lib/routes/notes/env_info/page.dart similarity index 100% rename from notes/flutter_web/lib/notes/env_info/note.dart rename to notes/flutter_web/lib/routes/notes/env_info/page.dart diff --git a/notes/flutter_web/lib/notes/i18n/note.dart b/notes/flutter_web/lib/routes/notes/i18n/page.dart similarity index 100% rename from notes/flutter_web/lib/notes/i18n/note.dart rename to notes/flutter_web/lib/routes/notes/i18n/page.dart diff --git a/notes/flutter_web/lib/routes/notes/layout.dart b/notes/flutter_web/lib/routes/notes/layout.dart new file mode 100644 index 00000000..a5806223 --- /dev/null +++ b/notes/flutter_web/lib/routes/notes/layout.dart @@ -0,0 +1,12 @@ +import 'package:flutter/widgets.dart'; +import 'package:you_flutter/router.dart'; +import 'package:you_note_dart/note.dart'; +import 'package:you_note_dart/note_layouts.dart'; + +/// [NoteLayoutBuilder] +@ToType(type: ToNote) +Widget layout(BuildContext context, NoteBuilder builder) { + // ignore: unnecessary_type_check + assert(layout is NoteLayoutBuilder); + return NoteLayoutStyle1(builder: builder); +} diff --git a/notes/flutter_web/lib/notes/layout/1.welcome/1.get_size.dart b/notes/flutter_web/lib/routes/notes/layout/1.welcome/1.get_size.dart similarity index 100% rename from notes/flutter_web/lib/notes/layout/1.welcome/1.get_size.dart rename to notes/flutter_web/lib/routes/notes/layout/1.welcome/1.get_size.dart diff --git a/notes/flutter_web/lib/notes/layout/1.welcome/2.get_size_stateful.dart b/notes/flutter_web/lib/routes/notes/layout/1.welcome/2.get_size_stateful.dart similarity index 100% rename from notes/flutter_web/lib/notes/layout/1.welcome/2.get_size_stateful.dart rename to notes/flutter_web/lib/routes/notes/layout/1.welcome/2.get_size_stateful.dart diff --git a/notes/flutter_web/lib/routes/notes/layout/1.welcome/note.md b/notes/flutter_web/lib/routes/notes/layout/1.welcome/note.md new file mode 100644 index 00000000..4c25e222 --- /dev/null +++ b/notes/flutter_web/lib/routes/notes/layout/1.welcome/note.md @@ -0,0 +1,212 @@ +# Layout + +## 基础布局 + +- **AspectRatio**:此组件强制其子组件保持特定的宽高比,确保内容在不同屏幕尺寸下都能保持一致的比例关系。 +- **Container**: 虽然本身不是一个布局组件,但它提供了装饰、边距、填充等功能,结合其子组件可以实现复杂的布局效果。 +- **ConstrainedBox**: + - **ConstrainedBox**:为子组件添加额外的大小限制,常用于在自定义布局中施加特定的宽高约束。 + - 【场景】当你需要对子Widget施加尺寸上的约束,但允许其在一定范围内自适应时,使用ConstrainedBox + - **UnconstrainedBox**: 取消对其子组件的所有约束,使得子组件能自由根据其内容大小进行布局。 +- **FittedBox**:`FittedBox`可调整其子组件大小以适应自己的尺寸。保证内容按比例适应容器,常用于图标、文本等内容的自适应缩放。FittedBox提供了几种不同的`fit`模式,例如`BoxFit.contain`、`BoxFit.cover`、`BoxFit.fill`等,每种模式决定了内容如何适应容器的尺寸。 +- **Flex**: Flexbox布局模型,Flex(子类Row、Column)和Flexible(子类Expanded)组合 + - **Flexible**:它不会强制填满所有剩余空间,而是根据子Widget的实际需求和可用空间来调整大小。这意味着,如果子Widget不需要那么多空间,它不会撑满,可以比分配的最小空间小。 + - 【场景】当你希望子Widget能够根据内容自适应大小,同时允许它们在必要时伸展以填充额外空间时,使用Flexible。这种情况下,子Widget的大小会更加动态,根据实际内容和可用空间来调整。 + - 【原理】Flexible的fit属性默认为FlexFit.loose,Flexible的fit属性默认为FlexFit.loose,允许子Widget在满足其最小尺寸的前提下可以不填满所有分配的空间 + - **Expanded**:Expanded 会强制填充父布局中剩余的所有可用空间。这意味着,如果你在一个Row或Column中有多个Expanded子Widget,它们会按照各自的flex属性分配剩余空间,并且至少会填满分配给它们的空间。 + - 【场景】当你需要确保某一部分总是占据剩余的所有空间时,使用Expanded。这在实现如分栏布局、列表项中标题和详细信息的自适应布局时很有用。 + - 【原理】Flexible的子类,Expanded的fit属性固定为FlexFit.tight,指示它必须填满分配的空间 + - **Spacer**:可以根据主轴方向自动拉伸占据剩余空间,辅助调整布局间距。 + - 【原理】Spacer组件内部包装了一个Expanded,在`Row`或`Column`布局中占位 +- **FractionallySizedBox**:用于根据父Widget的尺寸按比例设置子Widget的大小。它是基于父Widget尺寸的百分比来决定子Widget的宽度和高度,而不是绝对值。 + 通过widthFactor和heightFactor属性设置宽度和高度的比例因子,这两个值是0到1之间的浮点数,分别代表宽度和高度占父Widget相应维度的比例。这对于创建响应式布局非常有用,特别是在你希望子Widget始终占据父Widget一定比例空间的场景。 + - 【场景】当你需要按比例设置子Widget尺寸,尤其适合响应式设计,确保子Widget能够随父Widget尺寸变化而按比例缩放。 +- **LayoutBuilder**:它根据父组件提供的布局约束来动态构建其子组件,使子组件能够适应不同尺寸的屏幕或容器。 + - 【场景】 + - 响应式设计: 当需要根据屏幕尺寸(如手机横竖屏切换)改变布局时,LayoutBuilder可以轻松实现UI的自适应。 + - 流式布局: 在列表项或网格布局中,根据父容器的可用空间动态决定每行显示的子项数量。 + - 分栏布局: 根据屏幕宽度决定是否采用单列或双列(或多列)布局,常见于新闻阅读应用或商品展示页面。 + - 自定义滚动区域: 确定特定Widget的尺寸,以便创建精确的滚动效果,例如在图片查看器中根据图片大小自动调整滚动视图。 + - 【原理】 + - 获取约束信息: 它提供了一个BuildContext和一个BoxConstraints对象。BoxConstraints包含了当前Widget在布局过程中可以使用的空间限制,比如最大宽度、最小高度等,这让开发者能够做出智能的布局决策。 + - 动态布局: LayoutBuilder可以在运行时根据可用空间动态调整子Widget的尺寸和位置。这意味着开发者可以根据屏幕尺寸、方向变化或其他父Widget的约束来定制布局。 +- **LimitedBox**:LimitedBox 类似于 ConstrainedBox,但它主要用来限制最大尺寸,特别是当子Widget可能无限增长时(例如,因为文字溢出)。它允许你设置最大宽度和高度。主要是用来限制极端情况下的尺寸,防止过度膨胀导致的布局问题,而不是直接控制尺寸,因此它更偏向于防御性布局策略 + - 【场景】当你担心子Widget尺寸无限制增长,需要设定一个最大尺寸限制时,使用LimitedBox。 +- **IntrinsicHeight & IntrinsicWidth**:这两个组件会使子组件的高度或宽度与其内容匹配,而不是依赖于外部约束。 + - 【场景】当你需要让一个Widget的高度由其内部子Widget的最高高度决定时使用。换句话说,它会使整个Widget的高度等于其最高子Widget的高度,而宽度则根据正常布局规则确定。 + - 【原理】它会遍历所有子Widget,找到最高的那个,然后将自己的高度设置为该高度。这样,即使外部容器有其他高度约束,IntrinsicHeight 内部也会优先满足最高子Widget的需求。 +- **SizedBox**:SizedBox 是最简单的尺寸限制类容器,它强制其子Widget具有固定的宽度和高度。提供width和height参数来直接指定大小,适用于静态布局,不考虑子Widget本身的大小请求。 + - 【场景】当你需要一个确切大小的Widget时,使用SizedBox。 +- **Wrap**:Wrap组件用于包装多个子组件,当一行空间不足时自动换行,常见于创建标签列表、商品陈列等。 + + +## 布局辅助组件 + +### 溢出处理 + +- **OverflowBox**:允许其子组件的尺寸超出自身约束范围,适用于实现部分组件溢出父容器的情况。 + - 【原理】 + - 忽略约束: OverflowBox 会忽略传递给它的大小限制(constraints),转而使用子 Widget 自身的大小需求(size request)来确定最终的大小。这意味着,如果子 Widget 想要占用比父 Widget 允许的更大的空间,OverflowBox 将允许这种情况发生,即使这会导致溢出(overflow)或被父级剪裁(clipping)。 + - 溢出处理: 默认情况下,溢出的内容会被剪裁,但是,通过设置父级或兄弟 Widget 的 clipBehavior,可以改变这一行为,比如允许溢出内容可见。 + - 【场景】 + - 临时展示: 当需要短暂展示一些内容,而这些内容的大小可能暂时超过其容器时,例如弹出提示、气泡对话等。 + - 精确控制: 在某些特定的布局中,你可能需要精确控制某个元素的位置和尺寸,即使这会导致溢出,OverflowBox 可以帮助实现这样的布局效果。 + - 调试辅助: 在调试布局问题时,使用 OverflowBox 可以帮助你直观地看到子 Widget 实际需要的尺寸,从而调整布局逻辑。 +- **SizedOverflowBox**:SizedOverflowBox 允许你为子 Widget 指定一个特定的尺寸,即使这个尺寸超出了其正常约束范围而溢出 + - 【原理】 + - 指定尺寸: 不同于 OverflowBox 直接使用子 Widget 的尺寸需求,SizedOverflowBox 允许你显式地设置一个尺寸(宽度和高度),这个尺寸可以独立于子 Widget 自身的尺寸请求。这意味着,无论子 Widget 实际需要多少空间,你都可以强制它按照你指定的尺寸来渲染。 + - 溢出处理: 和 OverflowBox 一样,SizedOverflowBox 中超出其指定尺寸的内容默认会被剪裁。这意味着,如果你指定的尺寸小于子 Widget 所需的尺寸,超出部分将不可见。同样,也可以通过外部容器的 clipBehavior 来调整是否剪裁。 +- **剪裁**:用于裁剪其子组件的绘制区域,尽管主要用于图形效果,但在实现特定布局和视觉效果时也会使用 + - **ClipRect**:for more efficient clips without rounded corners + - **ClipOval**:for an elliptical clip + - **ClipRRect**:for a clip with rounded corners + - **ClipPath**:for an arbitrarily shaped clip + - **CustomClipper**:custom clips + +### 旋转 + +- **RotatedBox** +- **Transform**:提供对子组件的旋转、缩放和平移变换功能,在特定布局场景中也有应用。 + +### 对齐 + +- **Baseline**:Baseline组件用于基于文本基线对齐其子组件,尤其在处理多行文本或混合文本与其他元素时,可以确保文本行间的基线一致性。 +- **Align**:Align组件可以用来对齐其子组件,根据alignment参数调整子组件在父组件中的位置。 + - **Center**:Align子类,Center组件将子组件居中显示,无论父容器大小如何变化,子组件始终保持居中。 + +### 装饰器 + +- **简介**:是外观样式或特性增强 +- **BoxDecoration**:指定颜色、背景图片、边框`BoxBorder` +- **Opacity**: 是一种可以改变其子组件透明度的布局组件。它并不会影响子组件的实际尺寸和布局,而是控制子组件的内容可视性。 +- **Padding**:Padding组件用于在子组件周围添加内边距,可以在不影响子组件本身尺寸的前提下调整其在父容器中的位置。 +- **PhysicalModel**:用于给其子 Widget 添加物理外观属性,如阴影、边界和背景色等,从而使得 UI 具有更加丰富的视觉效果和质感。它主要用于实现Material设计中的“ elevation”(即阴影效果)和颜色叠加效果。 + - 与 Card 相比,PhysicalModel 提供了更多的自定义选项,比如可以自定义阴影颜色,而不仅仅是依赖主题。 + - 与 Container 结合 BoxShadow 使用相比,PhysicalModel 更简洁,直接通过 elevation 参数就能实现阴影效果。 + - 与 ClipRRect 或 ClipOval 结合使用时,PhysicalModel 可以同时提供剪辑和物理外观效果,但直接设置 borderRadius 可以简化代码。 +- **RepaintBoundary**: +- **SafeArea**:SafeArea组件用于确保其子组件避开屏幕边缘的不安全区域,如手机的刘海屏、摄像头孔位或底部的虚拟按键区域,确保内容布局在可视且不受遮挡的安全区域内。 +- **Offstage**:用于控制其子Widget是否参与布局和绘制过程。 + - 【原理】 + - offstage: 一个布尔型属性,默认值为false。当设置为true时,表示子Widget将不会被布局或绘制,即该子Widget会被“隐藏”起来,但仍然保持在Widget树中,保持状态并且继续接收生命周期方法调用(如build)。当设置为false时,子Widget则正常参与布局和绘制,可见于屏幕上。 + - performLayout: 另一个布尔型属性,默认与offstage属性值相同。这个属性控制是否执行子Widget的布局过程,即使offstage为true时,也可以通过设置performLayout为false来完全跳过布局步骤,这在某些性能敏感场景下可能有帮助。 + - 【场景】 + - 动画切换: 当需要在两个Widget之间进行切换显示时,可以使用Offstage配合AnimatedCrossFade或其他动画Widget,避免不必要的重建和初始化,提高性能。 + - 条件渲染: 类似于 Visibility Widget,但更适用于那些需要保持状态不变或避免重建成本较高的Widget。例如,在分页组件中,可以利用Offstage隐藏当前未显示的页面内容,同时保持它们的状态。 + - 预加载: 如果你希望预先加载一些复杂的Widget但初始时不显示它们,可以使用Offstage将其“隐藏”,这样当需要显示时能迅速切换,提升用户体验。 + - 性能优化: 对于昂贵的渲染操作(如大量数据的列表),可以在滚动到可视区域外时使用Offstage隐藏它们,减少不必要的计算和渲染负担。 + +### 填充留白 + +- **Divider** + - **ListTile.divideTiles** another approach to dividing widgets in a list. + - **PopupMenuDivider** which is the equivalent but for popup menus. + - **VerticalDivider** which is the vertical analog of this widget. +- **Placeholder**:常用于占位,在加载数据或资源尚未准备就绪时显示临时内容。它可以作为一个视觉提示,提醒用户该位置的内容随后会被填充。它不具有自适应尺寸的功能,但可以设置默认尺寸,并且常与异步数据加载结合使用,确保即使在真实内容加载前也有良好的用户体验。 +- **Spacer**:已在`Flex`中提到,主要用于分配布局中的空白空间。通常用于`Row`、`Column`或`Flex`布局中,作为填充空间的占位符。当希望某个方向上的剩余空间被均匀分配时,可以放置一个或多个`Spacer`。它没有自身的尺寸,而是根据`Flex`布局规则来决定占用的空间大小。 + +## 高级特性复杂布局 + +- **AppBar** +- **Card**:Card组件虽然不是纯粹的布局组件,但因其提供了统一的矩形框样式和阴影效果,常用于构建卡片式的布局单元,特别是在列表和网格布局中。 +- **GridView** 网格布局,可以创建类似表格或卡片列表的效果,支持横向或纵向滚动。 +- **ListView&ListBody**:可在 ListView 的头部或尾部使用 ListBody 来渲染一些固定的内容,这样可以充分利用两者的优势。 + - **ListBody**: 列表容器,不支持滚动、懒加载等高级特性。 + - 【原理】通过 Flex 布局算法来决定子 Widget 的位置。它只负责布局,不提供滚动功能。 + - 【场景】适用于列表项数量较少、不需要滚动功能的场景,比如简单的菜单列表。 + - **ListView**: 列表容器,还支持滚动、懒加载、头尾部件等丰富的功能。 + - 【原理】内部使用 Sliver 技术来实现滚动效果。它不仅提供列表布局,还支持滚动、懒加载等功能。 + - 【场景】适用于需要处理大量列表项、支持滚动和懒加载的场景,比如新闻列表、电商列表等。 +- **Scaffold**:Scaffold是Material Design风格应用的基础布局组件,包含了app bar、body、bottomNavigationBar、drawer等常见布局元素,有助于快速构建标准的Material应用界面。 +- **Table**:表格布局,可以灵活定义行和列的数量及内容。 + - **DataTable**: Table的增强版,为表格提供了更丰富的样式和交互功能,适合展示具有表头、索引列和操作列的数据。 +- **堆叠&可切换** + - **PageView**:用于实现滑动页面效果。 + - 【场景】幻灯片、相册浏览、引导页、广告轮播、仪表盘切换 + - **Stack**:Stack允许子组件堆叠展示,支持定位(alignment)和z轴排序(index),可以用于制作悬浮按钮、叠加图片、标签页指示器等效果。 + - **Positioned**: 在Stack中结合Positioned使用,可以更精确地控制子组件在Stack中的绝对位置。 + - **IndexedStack**: 内部包了个Stack,允许在一组子组件中切换显示,类似TabView效果,通过索引值控制显示指定子组件。 + - 【场景】适合于页面数量相对较少且需要快速切换、同时保持页面状态(比如滚动位置)的场景,它不包含任何动画效果,页面切换是瞬间完成的。 + - 【原理】IndexedStack是一个能够记住其子Widget状态的Stack。当你改变索引时,它不会销毁和重建未显示的子Widget,而是简单地改变可见性,从而保留之前页面的状态。 + - **TabView**: 是一个用于实现带标签页导航的Widget,常与TabBar配合使用,提供平滑的页面切换动画。提供了丰富的自定义选项,比如页面切换动画、指示器样式等。 + - 【原理】当用户在不同的tab之间切换时,TabView默认会销毁离开的页面并重建进入的页面,这意味着页面状态不会被保留(除非额外采取措施,比如使用AutomaticKeepAliveClientMixin)。 + - 【场景】更适用于有多个固定分类内容展示的场景,比如应用的主页有新闻、视频、我的等几个固定的tab。 + +## 滚动性 + +- **ScrollView**: + - **SingleChildScrollView**: + - 【原理】 + - SingleChildScrollView 本身不提供任何布局能力,需要手动包裹一个布局 Widget(如 Column、Row 等) + - 简单,性能好 + - 【场景】SingleChildScrollView 适用于需要滚动的单个 Widget,比如表单、简单的列表等。 + - **BoxScrollView**: + - 【原理】 + - 基于 Viewport 和 RenderBox 技术实现,内部会直接处理滚动逻辑。 + - 其父类是ScrollView 而ListView和GridView是BoxScrollView子类。 + - 【场景】 + - 适用于普通的列表或网格滚动场景,如新闻列表、商品列表等。 + - **CustomScrollView**:LayoutId 和CustomScrollView结合使用,可以实现自定义的滚动视图布局,如多个不同滚动速度的列表视图。 + - 【原理】 + - 基于 Sliver 技术实现,内部使用多个 Sliver 组件来共同完成滚动效果。可以自由组合各种 Sliver 组件来构建复杂的滚动界面。 + - 【场景】 + - 适用于需要实现复杂滚动效果的场景,如带有吸顶效果的应用栏、嵌套的列表/网格等。 + - **NestedScrollView**:在同一滚动视图中嵌套其他滚动视图,如顶部有一个固定的AppBar和底部有一个可滚动的列表。 +- **滚动相关** + - **ScrollNotification** and **NotificationListener**: which can be used to watch the scroll position without using a [ScrollController]. + - **ScrollController**: 记得dispose + - **Viewport** 用于表示可视区域内的内容。Viewport 通常与可滚动组件配合使用,用于控制和管理可滚动内容的显示。 + - 【原理】 + - 确定可视区域:Viewport 负责计算和管理当前可视区域的大小和位置。 它会根据屏幕尺寸和滚动位置来确定可视区域的范围。 + - 管理可视内容:Viewport 会决定哪些子组件应该被渲染和显示在可视区域内。 它会根据可视区域的范围来选择需要渲染的子组件,以提高性能。 + - 处理滚动:Viewport 会监听用户的滚动输入,并根据滚动距离更新可视区域的位置。 它负责将滚动事件转化为对可视内容的适当调整。 + - 提供约束条件:Viewport 会将可视区域的大小作为约束条件传递给子组件。 子组件可以根据这些约束条件来决定自身的大小和布局。 + - 【场景】 + - ListView 和 GridView 都是基于 Viewport 实现的可滚动组件。 它们利用 Viewport 来确定当前可视区域内应该显示哪些子组件,从而实现高效的滚动体验。 + - CustomScrollView 基于 Viewport 和 Sliver 技术实现。Viewport 负责管理可视区域内的 Sliver 组件,如 SliverList、SliverGrid 等,从而构建出复杂的滚动界面。 + - SingleChildScrollView 也使用 Viewport 来管理其单个子组件的滚动。它可以确保子组件在可视区域内正确显示和滚动。 + - PageView 是一种基于 Viewport 实现的特殊可滚动组件,它用于实现页面级别的滚动和切换。Viewport 在这里负责管理当前可视的页面,并在用户滑动时切换到下一个页面。 + - Expanded 和 Flexible这两个布局组件也与 Viewport 相关,它们用于控制子组件在可用空间内的分布和增长。当子组件位于可滚动视图中时,Viewport 提供的约束条件会影响 Expanded 和 Flexible 的行为。 + +- **已提及的其他可滚动组件** + - GridView + - ListView + - PageView +- **ScrollPhysics** + - **简介**: 滚动物理模型 + - **BouncingScrollPhysics**: 用于实现类似 iOS 上的弹性滚动效果。 + - 弹性滚动:当用户滚动到列表的顶部或底部时,会出现一种"弹性"的感觉,给用户一种"拉伸"的体验。这种效果可以让滚动操作更加自然和生动。 + - 阻尼效果:当用户松开手指时,滚动会逐渐减速并停下来,而不是立即停止。这种阻尼效果让滚动操作更加顺滑自然。 + - 过度滚动:当用户滚动到列表的顶部或底部时,列表会稍微"超出"一点,然后再返回到正常位置。这种过度滚动也是 iOS 上常见的效果,增加了视觉上的连贯性。 + - **ClampingScrollPhysics**: 不允许过度滚动,列表滚动到顶部或底部时会立即停止。 + - **AlwaysScrollableScrollPhysics**: 始终允许滚动,即使列表项的总高度小于列表容器的高度。 + - **NeverScrollableScrollPhysics**: 禁用滚动功能,列表项无法滚动。 +## **自定义Custom** + +- **CustomSingleChildLayout**: 实现SingleChildLayoutDelegate自定义子组件的布局。 +- **CustomMultiChildLayout**: 实现MultiChildLayoutDelegate自定义子组件的布局。 +- **CustomPainter**: 虽然主要用于自定义绘画,但在实现复杂自定义布局时也发挥着重要作用,可以通过`Canvas` API实现精确的像素级布局。 +- **Flow**: 可以指定`FlowDelegate`实现自己的绘制逻辑,你可以根据子 Widget 的大小和位置来动态调整子 Widget 的位置和大小。这个 Widget 非常适合用于实现复杂的布局需求,例如文本编辑器、绘图工具等。 +- **RenderObjectWidget** 和 **RenderBox**:虽然它们不是直接的布局组件,但理解和使用RenderObjectWidget和RenderBox对于自定义布局逻辑至关重要。通过继承和自定义这些底层渲染对象,可以创建高度自定义的布局效果。 +- **已提及的其他可自定义的组件** + - CustomClipper + - CustomScrollView + +## **Sliver系列** + +- **介绍** + - 如 `SliverAppBar`、`SliverList`、`SliverGrid` 等,专为`CustomScrollView`设计,用于高效实现滚动视图布局。 +- **ShrinkWrappingViewport**:类似于ListView,但它的大小可以根据其子组件的大小进行收缩,而不是根据父容器的大小进行填充。 + +## **布局&动画** + +- **AlignTransition** 和 **PositionedTransition**: + - 这两个组件是对`Align`和`Positioned`组件的动画版本,可以为子组件的对齐或定位提供平滑过渡动画。 +- **Hero动画**:虽非布局组件,但与布局转换相关。它在不同路由或页面间实现元素共享及动画过渡,常用于Material Design中的共享元素过渡效果。 +- **AnimatedContainer**:AnimatedContainer组件在更改其尺寸、颜色、边距等属性时,会为其变化提供平滑的动画效果,非常适合构建动态布局变化的场景。 + +## 其他参考 + +- StatefulWidget在最外层会随着屏幕大小变化自动build +- 自适应尺寸:/flutter/examples/api/lib/widgets/framework/build_owner.0.dart +- 屏幕宽度:`double screenWidth = MediaQuery.of(context).size.width;` diff --git a/notes/flutter_web/lib/notes/layout/box_layout/constraints/box_1_basic.dart b/notes/flutter_web/lib/routes/notes/layout/box_layout/constraints/box_1_basic.dart similarity index 100% rename from notes/flutter_web/lib/notes/layout/box_layout/constraints/box_1_basic.dart rename to notes/flutter_web/lib/routes/notes/layout/box_layout/constraints/box_1_basic.dart diff --git a/notes/flutter_web/lib/notes/layout/box_layout/constraints/box_error1_infinity.dart b/notes/flutter_web/lib/routes/notes/layout/box_layout/constraints/box_error1_infinity.dart similarity index 88% rename from notes/flutter_web/lib/notes/layout/box_layout/constraints/box_error1_infinity.dart rename to notes/flutter_web/lib/routes/notes/layout/box_layout/constraints/box_error1_infinity.dart index 2f6579f2..3bcac383 100644 --- a/notes/flutter_web/lib/notes/layout/box_layout/constraints/box_error1_infinity.dart +++ b/notes/flutter_web/lib/routes/notes/layout/box_layout/constraints/box_error1_infinity.dart @@ -3,17 +3,14 @@ import 'package:flutter/material.dart'; main() { - runApp(const App()); -} - -class App extends StatelessWidget { - const App({super.key}); - - @override - Widget build(BuildContext context) { - // flutter程序外部必须有一个Directionality文本方向组件,要不会报错 - return Directionality(textDirection: TextDirection.ltr, /*修改这里测试*/ child: test1_unbounded_fail()); - } + runApp( + Builder( + builder: (context) => Directionality( + textDirection: TextDirection.ltr, + /*修改这里测试*/ child: test2_ListView_is_ok(), + ), + ), + ); } Widget constraintsInfo(String title) { @@ -43,7 +40,7 @@ Widget test1_unbounded_fail() { ); } -// Column直接包ListView汇报错 +// Column直接包ListView报错 Widget test1_unbounded_fail_recover() { return Column( children: [ diff --git a/notes/flutter_web/lib/notes/layout/box_layout/constraints/main.dart b/notes/flutter_web/lib/routes/notes/layout/box_layout/constraints/main.dart similarity index 100% rename from notes/flutter_web/lib/notes/layout/box_layout/constraints/main.dart rename to notes/flutter_web/lib/routes/notes/layout/box_layout/constraints/main.dart diff --git a/notes/flutter_web/lib/notes/layout/box_layout/constraints/note.dart b/notes/flutter_web/lib/routes/notes/layout/box_layout/constraints/page.dart similarity index 100% rename from notes/flutter_web/lib/notes/layout/box_layout/constraints/note.dart rename to notes/flutter_web/lib/routes/notes/layout/box_layout/constraints/page.dart diff --git a/notes/flutter_web/lib/notes/layout/old/layout/note.dart b/notes/flutter_web/lib/routes/notes/layout/old/layout/page.dart similarity index 100% rename from notes/flutter_web/lib/notes/layout/old/layout/note.dart rename to notes/flutter_web/lib/routes/notes/layout/old/layout/page.dart diff --git a/notes/flutter_web/lib/notes/layout/old/layout/screen.dart b/notes/flutter_web/lib/routes/notes/layout/old/layout/screen.dart similarity index 100% rename from notes/flutter_web/lib/notes/layout/old/layout/screen.dart rename to notes/flutter_web/lib/routes/notes/layout/old/layout/screen.dart diff --git a/notes/flutter_web/lib/notes/layout/old/layout/screen2.dart b/notes/flutter_web/lib/routes/notes/layout/old/layout/screen2.dart similarity index 100% rename from notes/flutter_web/lib/notes/layout/old/layout/screen2.dart rename to notes/flutter_web/lib/routes/notes/layout/old/layout/screen2.dart diff --git a/notes/flutter_web/lib/notes/layout/note.dart b/notes/flutter_web/lib/routes/notes/layout/page.dart similarity index 100% rename from notes/flutter_web/lib/notes/layout/note.dart rename to notes/flutter_web/lib/routes/notes/layout/page.dart diff --git a/notes/flutter_web/lib/notes/layout/responsive_design/note.dart b/notes/flutter_web/lib/routes/notes/layout/responsive_design/page.dart similarity index 100% rename from notes/flutter_web/lib/notes/layout/responsive_design/note.dart rename to notes/flutter_web/lib/routes/notes/layout/responsive_design/page.dart diff --git a/notes/flutter_web/lib/notes/media&assets&file/assets/note.dart b/notes/flutter_web/lib/routes/notes/media&assets&file/assets/page.dart similarity index 81% rename from notes/flutter_web/lib/notes/media&assets&file/assets/note.dart rename to notes/flutter_web/lib/routes/notes/media&assets&file/assets/page.dart index c3886d43..e91e84ed 100644 --- a/notes/flutter_web/lib/notes/media&assets&file/assets/note.dart +++ b/notes/flutter_web/lib/routes/notes/media&assets&file/assets/page.dart @@ -8,6 +8,6 @@ void build(BuildContext context, Cell print) async { # asset ''')); - var jsonAsset = await rootBundle.loadString('lib/notes/note.dart'); + var jsonAsset = await rootBundle.loadString('lib/routes/note.dart'); print(jsonAsset); } diff --git a/notes/flutter_web/lib/notes/media&assets&file/file_desktop/note.dart b/notes/flutter_web/lib/routes/notes/media&assets&file/file_desktop/page.dart similarity index 100% rename from notes/flutter_web/lib/notes/media&assets&file/file_desktop/note.dart rename to notes/flutter_web/lib/routes/notes/media&assets&file/file_desktop/page.dart diff --git a/notes/flutter_web/lib/notes/media&assets&file/file_web/note.dart b/notes/flutter_web/lib/routes/notes/media&assets&file/file_web/page.dart similarity index 100% rename from notes/flutter_web/lib/notes/media&assets&file/file_web/note.dart rename to notes/flutter_web/lib/routes/notes/media&assets&file/file_web/page.dart diff --git a/notes/flutter_web/lib/notes/navigation/navigator_v1/ref.dart b/notes/flutter_web/lib/routes/notes/navigation/navigator_v1/ref.dart similarity index 100% rename from notes/flutter_web/lib/notes/navigation/navigator_v1/ref.dart rename to notes/flutter_web/lib/routes/notes/navigation/navigator_v1/ref.dart diff --git a/notes/flutter_web/lib/notes/navigation/navigator_v2/1.1.navigator_hello_v1.dart b/notes/flutter_web/lib/routes/notes/navigation/navigator_v2/1.1.navigator_hello_v1.dart similarity index 100% rename from notes/flutter_web/lib/notes/navigation/navigator_v2/1.1.navigator_hello_v1.dart rename to notes/flutter_web/lib/routes/notes/navigation/navigator_v2/1.1.navigator_hello_v1.dart diff --git a/notes/flutter_web/lib/notes/navigation/navigator_v2/1.2.navigator_hello_v2.dart b/notes/flutter_web/lib/routes/notes/navigation/navigator_v2/1.2.navigator_hello_v2.dart similarity index 100% rename from notes/flutter_web/lib/notes/navigation/navigator_v2/1.2.navigator_hello_v2.dart rename to notes/flutter_web/lib/routes/notes/navigation/navigator_v2/1.2.navigator_hello_v2.dart diff --git a/notes/flutter_web/lib/notes/navigation/navigator_v2/2.navigator_v2_result.dart b/notes/flutter_web/lib/routes/notes/navigation/navigator_v2/2.navigator_v2_result.dart similarity index 100% rename from notes/flutter_web/lib/notes/navigation/navigator_v2/2.navigator_v2_result.dart rename to notes/flutter_web/lib/routes/notes/navigation/navigator_v2/2.navigator_v2_result.dart diff --git a/notes/flutter_web/lib/notes/navigation/navigator_v2/3.navigator_v2_only_pages_last_version.dart b/notes/flutter_web/lib/routes/notes/navigation/navigator_v2/3.navigator_v2_only_pages_last_version.dart similarity index 100% rename from notes/flutter_web/lib/notes/navigation/navigator_v2/3.navigator_v2_only_pages_last_version.dart rename to notes/flutter_web/lib/routes/notes/navigation/navigator_v2/3.navigator_v2_only_pages_last_version.dart diff --git a/notes/flutter_web/lib/notes/navigation/navigator_v2/4.2.navigator_v2_last_version.dart b/notes/flutter_web/lib/routes/notes/navigation/navigator_v2/4.2.navigator_v2_last_version.dart similarity index 100% rename from notes/flutter_web/lib/notes/navigation/navigator_v2/4.2.navigator_v2_last_version.dart rename to notes/flutter_web/lib/routes/notes/navigation/navigator_v2/4.2.navigator_v2_last_version.dart diff --git a/notes/flutter_web/lib/notes/navigation/note.dart b/notes/flutter_web/lib/routes/notes/navigation/page.dart similarity index 100% rename from notes/flutter_web/lib/notes/navigation/note.dart rename to notes/flutter_web/lib/routes/notes/navigation/page.dart diff --git a/notes/flutter_web/lib/notes/note.dart b/notes/flutter_web/lib/routes/notes/page.dart similarity index 93% rename from notes/flutter_web/lib/notes/note.dart rename to notes/flutter_web/lib/routes/notes/page.dart index 16c5f2c7..1e3a4b79 100644 --- a/notes/flutter_web/lib/notes/note.dart +++ b/notes/flutter_web/lib/routes/notes/page.dart @@ -1,6 +1,7 @@ import 'package:flutter/widgets.dart'; import 'package:you_note_dart/note.dart'; +/// [PageBuilder] void build(BuildContext context, Cell print) { print(const MD(r''' # home diff --git a/notes/flutter_web/lib/notes/note.json b/notes/flutter_web/lib/routes/notes/page.json similarity index 100% rename from notes/flutter_web/lib/notes/note.json rename to notes/flutter_web/lib/routes/notes/page.json diff --git a/notes/flutter_web/lib/notes/pure_dart/analyzer/analyzer_ast.dart b/notes/flutter_web/lib/routes/notes/pure_dart/analyzer/analyzer_ast.dart similarity index 100% rename from notes/flutter_web/lib/notes/pure_dart/analyzer/analyzer_ast.dart rename to notes/flutter_web/lib/routes/notes/pure_dart/analyzer/analyzer_ast.dart diff --git a/notes/flutter_web/lib/notes/pure_dart/analyzer/analyzer_element.dart b/notes/flutter_web/lib/routes/notes/pure_dart/analyzer/analyzer_element.dart similarity index 100% rename from notes/flutter_web/lib/notes/pure_dart/analyzer/analyzer_element.dart rename to notes/flutter_web/lib/routes/notes/pure_dart/analyzer/analyzer_element.dart diff --git a/notes/flutter_web/lib/notes/pure_dart/analyzer/note.dart b/notes/flutter_web/lib/routes/notes/pure_dart/analyzer/page.dart similarity index 100% rename from notes/flutter_web/lib/notes/pure_dart/analyzer/note.dart rename to notes/flutter_web/lib/routes/notes/pure_dart/analyzer/page.dart diff --git a/notes/flutter_web/lib/notes/pure_dart/async/note.dart b/notes/flutter_web/lib/routes/notes/pure_dart/async/page.dart similarity index 100% rename from notes/flutter_web/lib/notes/pure_dart/async/note.dart rename to notes/flutter_web/lib/routes/notes/pure_dart/async/page.dart diff --git a/notes/flutter_web/lib/notes/pure_dart/dart3/note.dart b/notes/flutter_web/lib/routes/notes/pure_dart/dart3/page.dart similarity index 100% rename from notes/flutter_web/lib/notes/pure_dart/dart3/note.dart rename to notes/flutter_web/lib/routes/notes/pure_dart/dart3/page.dart diff --git a/notes/flutter_web/lib/notes/pure_dart/dart3/simple_interface_class.dart b/notes/flutter_web/lib/routes/notes/pure_dart/dart3/simple_interface_class.dart similarity index 100% rename from notes/flutter_web/lib/notes/pure_dart/dart3/simple_interface_class.dart rename to notes/flutter_web/lib/routes/notes/pure_dart/dart3/simple_interface_class.dart diff --git a/notes/flutter_web/lib/notes/pure_dart/execption/note.dart b/notes/flutter_web/lib/routes/notes/pure_dart/execption/page.dart similarity index 100% rename from notes/flutter_web/lib/notes/pure_dart/execption/note.dart rename to notes/flutter_web/lib/routes/notes/pure_dart/execption/page.dart diff --git a/notes/flutter_web/lib/notes/pure_dart/safe_interface/note.dart b/notes/flutter_web/lib/routes/notes/pure_dart/safe_interface/page.dart similarity index 100% rename from notes/flutter_web/lib/notes/pure_dart/safe_interface/note.dart rename to notes/flutter_web/lib/routes/notes/pure_dart/safe_interface/page.dart diff --git a/notes/flutter_web/lib/notes/pure_dart/serialization_json/note.dart b/notes/flutter_web/lib/routes/notes/pure_dart/serialization_json/page.dart similarity index 100% rename from notes/flutter_web/lib/notes/pure_dart/serialization_json/note.dart rename to notes/flutter_web/lib/routes/notes/pure_dart/serialization_json/page.dart diff --git a/notes/flutter_web/lib/notes/research/research_note_bash/note.bash b/notes/flutter_web/lib/routes/notes/research/bash_note/note.bash similarity index 100% rename from notes/flutter_web/lib/notes/research/research_note_bash/note.bash rename to notes/flutter_web/lib/routes/notes/research/bash_note/note.bash diff --git a/notes/flutter_web/lib/notes/research/research_note_bash/note.json b/notes/flutter_web/lib/routes/notes/research/bash_note/page.json similarity index 100% rename from notes/flutter_web/lib/notes/research/research_note_bash/note.json rename to notes/flutter_web/lib/routes/notes/research/bash_note/page.json diff --git a/notes/flutter_web/lib/notes/research/research_parameterized_example/note.dart b/notes/flutter_web/lib/routes/notes/research/parameterized/page.dart similarity index 100% rename from notes/flutter_web/lib/notes/research/research_parameterized_example/note.dart rename to notes/flutter_web/lib/routes/notes/research/parameterized/page.dart diff --git a/notes/flutter_web/lib/notes/research/research_parameterized_example/note.json b/notes/flutter_web/lib/routes/notes/research/parameterized/page.json similarity index 100% rename from notes/flutter_web/lib/notes/research/research_parameterized_example/note.json rename to notes/flutter_web/lib/routes/notes/research/parameterized/page.json diff --git a/notes/flutter_web/lib/notes/research/remote_view/note.dart b/notes/flutter_web/lib/routes/notes/research/remote_view/page.dart similarity index 100% rename from notes/flutter_web/lib/notes/research/remote_view/note.dart rename to notes/flutter_web/lib/routes/notes/research/remote_view/page.dart diff --git a/notes/flutter_web/lib/notes/state/1.vanilla_state/1.1.hello.dart b/notes/flutter_web/lib/routes/notes/state/1.vanilla_state/1.1.hello.dart similarity index 100% rename from notes/flutter_web/lib/notes/state/1.vanilla_state/1.1.hello.dart rename to notes/flutter_web/lib/routes/notes/state/1.vanilla_state/1.1.hello.dart diff --git a/notes/flutter_web/lib/notes/state/1.vanilla_state/1.2.state_can_keep_instance.dart b/notes/flutter_web/lib/routes/notes/state/1.vanilla_state/1.2.state_can_keep_instance.dart similarity index 100% rename from notes/flutter_web/lib/notes/state/1.vanilla_state/1.2.state_can_keep_instance.dart rename to notes/flutter_web/lib/routes/notes/state/1.vanilla_state/1.2.state_can_keep_instance.dart diff --git a/notes/flutter_web/lib/notes/state/1.vanilla_state/2.1.child.dart b/notes/flutter_web/lib/routes/notes/state/1.vanilla_state/2.1.child.dart similarity index 100% rename from notes/flutter_web/lib/notes/state/1.vanilla_state/2.1.child.dart rename to notes/flutter_web/lib/routes/notes/state/1.vanilla_state/2.1.child.dart diff --git a/notes/flutter_web/lib/notes/state/1.vanilla_state/3.1.ChangeNotifier.dart b/notes/flutter_web/lib/routes/notes/state/1.vanilla_state/3.1.ChangeNotifier.dart similarity index 100% rename from notes/flutter_web/lib/notes/state/1.vanilla_state/3.1.ChangeNotifier.dart rename to notes/flutter_web/lib/routes/notes/state/1.vanilla_state/3.1.ChangeNotifier.dart diff --git a/notes/flutter_web/lib/notes/state/1.vanilla_state/3.2.ValueNotifer.dart b/notes/flutter_web/lib/routes/notes/state/1.vanilla_state/3.2.ValueNotifer.dart similarity index 100% rename from notes/flutter_web/lib/notes/state/1.vanilla_state/3.2.ValueNotifer.dart rename to notes/flutter_web/lib/routes/notes/state/1.vanilla_state/3.2.ValueNotifer.dart diff --git a/notes/flutter_web/lib/notes/state/1.vanilla_state/4.1.ListenableBuilder.dart b/notes/flutter_web/lib/routes/notes/state/1.vanilla_state/4.1.ListenableBuilder.dart similarity index 100% rename from notes/flutter_web/lib/notes/state/1.vanilla_state/4.1.ListenableBuilder.dart rename to notes/flutter_web/lib/routes/notes/state/1.vanilla_state/4.1.ListenableBuilder.dart diff --git a/notes/flutter_web/lib/notes/state/1.vanilla_state/5.1.function_state.dart b/notes/flutter_web/lib/routes/notes/state/1.vanilla_state/5.1.function_state.dart similarity index 100% rename from notes/flutter_web/lib/notes/state/1.vanilla_state/5.1.function_state.dart rename to notes/flutter_web/lib/routes/notes/state/1.vanilla_state/5.1.function_state.dart diff --git a/notes/flutter_web/lib/notes/state/1.vanilla_state/note.dart b/notes/flutter_web/lib/routes/notes/state/1.vanilla_state/page.dart similarity index 100% rename from notes/flutter_web/lib/notes/state/1.vanilla_state/note.dart rename to notes/flutter_web/lib/routes/notes/state/1.vanilla_state/page.dart diff --git a/notes/flutter_web/lib/notes/state/StatefulBuilder/note.dart b/notes/flutter_web/lib/routes/notes/state/StatefulBuilder/page.dart similarity index 100% rename from notes/flutter_web/lib/notes/state/StatefulBuilder/note.dart rename to notes/flutter_web/lib/routes/notes/state/StatefulBuilder/page.dart diff --git a/notes/flutter_web/lib/notes/state/note.dart b/notes/flutter_web/lib/routes/notes/state/page.dart similarity index 100% rename from notes/flutter_web/lib/notes/state/note.dart rename to notes/flutter_web/lib/routes/notes/state/page.dart diff --git a/notes/flutter_web/lib/notes/style&theming/Material/sample1.dart b/notes/flutter_web/lib/routes/notes/style&theming/Material/sample1.dart similarity index 100% rename from notes/flutter_web/lib/notes/style&theming/Material/sample1.dart rename to notes/flutter_web/lib/routes/notes/style&theming/Material/sample1.dart diff --git a/notes/flutter_web/lib/notes/style&theming/material3/note.dart b/notes/flutter_web/lib/routes/notes/style&theming/material3/page.dart similarity index 100% rename from notes/flutter_web/lib/notes/style&theming/material3/note.dart rename to notes/flutter_web/lib/routes/notes/style&theming/material3/page.dart diff --git a/notes/flutter_web/lib/notes/thinking_in_ui/readable_html_vs_dart/main.dart b/notes/flutter_web/lib/routes/notes/thinking_in_ui/readable_html_vs_dart/main.dart similarity index 100% rename from notes/flutter_web/lib/notes/thinking_in_ui/readable_html_vs_dart/main.dart rename to notes/flutter_web/lib/routes/notes/thinking_in_ui/readable_html_vs_dart/main.dart diff --git a/notes/flutter_web/lib/notes/thinking_in_ui/readable_html_vs_dart/note.dart b/notes/flutter_web/lib/routes/notes/thinking_in_ui/readable_html_vs_dart/page.dart similarity index 100% rename from notes/flutter_web/lib/notes/thinking_in_ui/readable_html_vs_dart/note.dart rename to notes/flutter_web/lib/routes/notes/thinking_in_ui/readable_html_vs_dart/page.dart diff --git a/notes/flutter_web/lib/notes/widgets/container_widgets/Card/sample1.dart b/notes/flutter_web/lib/routes/notes/widgets/container_widgets/Card/sample1.dart similarity index 100% rename from notes/flutter_web/lib/notes/widgets/container_widgets/Card/sample1.dart rename to notes/flutter_web/lib/routes/notes/widgets/container_widgets/Card/sample1.dart diff --git a/notes/flutter_web/lib/notes/widgets/container_widgets/app/1.hello_meterial_app.dart b/notes/flutter_web/lib/routes/notes/widgets/container_widgets/app/1.hello_meterial_app.dart similarity index 100% rename from notes/flutter_web/lib/notes/widgets/container_widgets/app/1.hello_meterial_app.dart rename to notes/flutter_web/lib/routes/notes/widgets/container_widgets/app/1.hello_meterial_app.dart diff --git a/notes/flutter_web/lib/notes/widgets/container_widgets/bar/note.dart b/notes/flutter_web/lib/routes/notes/widgets/container_widgets/bar/page.dart similarity index 100% rename from notes/flutter_web/lib/notes/widgets/container_widgets/bar/note.dart rename to notes/flutter_web/lib/routes/notes/widgets/container_widgets/bar/page.dart diff --git a/notes/flutter_web/lib/notes/widgets/container_widgets/dialog/1.sample_dialog.dart b/notes/flutter_web/lib/routes/notes/widgets/container_widgets/dialog/1.sample_dialog.dart similarity index 100% rename from notes/flutter_web/lib/notes/widgets/container_widgets/dialog/1.sample_dialog.dart rename to notes/flutter_web/lib/routes/notes/widgets/container_widgets/dialog/1.sample_dialog.dart diff --git a/notes/flutter_web/lib/notes/widgets/container_widgets/dialog/2.alert_dialog.dart b/notes/flutter_web/lib/routes/notes/widgets/container_widgets/dialog/2.alert_dialog.dart similarity index 100% rename from notes/flutter_web/lib/notes/widgets/container_widgets/dialog/2.alert_dialog.dart rename to notes/flutter_web/lib/routes/notes/widgets/container_widgets/dialog/2.alert_dialog.dart diff --git a/notes/flutter_web/lib/notes/widgets/container_widgets/drawer/1.drawer_in_body.dart b/notes/flutter_web/lib/routes/notes/widgets/container_widgets/drawer/1.drawer_in_body.dart similarity index 100% rename from notes/flutter_web/lib/notes/widgets/container_widgets/drawer/1.drawer_in_body.dart rename to notes/flutter_web/lib/routes/notes/widgets/container_widgets/drawer/1.drawer_in_body.dart diff --git a/notes/flutter_web/lib/notes/widgets/container_widgets/drawer/2.drawer_header.dart b/notes/flutter_web/lib/routes/notes/widgets/container_widgets/drawer/2.drawer_header.dart similarity index 100% rename from notes/flutter_web/lib/notes/widgets/container_widgets/drawer/2.drawer_header.dart rename to notes/flutter_web/lib/routes/notes/widgets/container_widgets/drawer/2.drawer_header.dart diff --git a/notes/flutter_web/lib/notes/widgets/container_widgets/menu/note.dart b/notes/flutter_web/lib/routes/notes/widgets/container_widgets/menu/page.dart similarity index 100% rename from notes/flutter_web/lib/notes/widgets/container_widgets/menu/note.dart rename to notes/flutter_web/lib/routes/notes/widgets/container_widgets/menu/page.dart diff --git a/notes/flutter_web/lib/notes/widgets/container_widgets/page_view/1.sample.dart b/notes/flutter_web/lib/routes/notes/widgets/container_widgets/page_view/1.sample.dart similarity index 100% rename from notes/flutter_web/lib/notes/widgets/container_widgets/page_view/1.sample.dart rename to notes/flutter_web/lib/routes/notes/widgets/container_widgets/page_view/1.sample.dart diff --git a/notes/flutter_web/lib/notes/widgets/container_widgets/scrollable/Dismissible/note.dart b/notes/flutter_web/lib/routes/notes/widgets/container_widgets/scrollable/Dismissible/page.dart similarity index 100% rename from notes/flutter_web/lib/notes/widgets/container_widgets/scrollable/Dismissible/note.dart rename to notes/flutter_web/lib/routes/notes/widgets/container_widgets/scrollable/Dismissible/page.dart diff --git a/notes/flutter_web/lib/notes/widgets/container_widgets/scrollable/Dismissible/sample1.dart b/notes/flutter_web/lib/routes/notes/widgets/container_widgets/scrollable/Dismissible/sample1.dart similarity index 100% rename from notes/flutter_web/lib/notes/widgets/container_widgets/scrollable/Dismissible/sample1.dart rename to notes/flutter_web/lib/routes/notes/widgets/container_widgets/scrollable/Dismissible/sample1.dart diff --git a/notes/flutter_web/lib/notes/widgets/container_widgets/scrollable/DraggableScrollableSheet/sample1.dart b/notes/flutter_web/lib/routes/notes/widgets/container_widgets/scrollable/DraggableScrollableSheet/sample1.dart similarity index 100% rename from notes/flutter_web/lib/notes/widgets/container_widgets/scrollable/DraggableScrollableSheet/sample1.dart rename to notes/flutter_web/lib/routes/notes/widgets/container_widgets/scrollable/DraggableScrollableSheet/sample1.dart diff --git a/notes/flutter_web/lib/notes/widgets/note.md b/notes/flutter_web/lib/routes/notes/widgets/note.md similarity index 100% rename from notes/flutter_web/lib/notes/widgets/note.md rename to notes/flutter_web/lib/routes/notes/widgets/note.md diff --git a/notes/flutter_web/lib/notes/widgets/specific_widgets/Divider/1.sample_divider.dart b/notes/flutter_web/lib/routes/notes/widgets/specific_widgets/Divider/1.sample_divider.dart similarity index 100% rename from notes/flutter_web/lib/notes/widgets/specific_widgets/Divider/1.sample_divider.dart rename to notes/flutter_web/lib/routes/notes/widgets/specific_widgets/Divider/1.sample_divider.dart diff --git a/notes/flutter_web/lib/notes/widgets/specific_widgets/Divider/2.sample_vertical_divider.dart b/notes/flutter_web/lib/routes/notes/widgets/specific_widgets/Divider/2.sample_vertical_divider.dart similarity index 100% rename from notes/flutter_web/lib/notes/widgets/specific_widgets/Divider/2.sample_vertical_divider.dart rename to notes/flutter_web/lib/routes/notes/widgets/specific_widgets/Divider/2.sample_vertical_divider.dart diff --git a/notes/flutter_web/lib/notes/widgets/specific_widgets/button/ButtonStyleButton/1.elevated_button.dart b/notes/flutter_web/lib/routes/notes/widgets/specific_widgets/button/ButtonStyleButton/1.elevated_button.dart similarity index 100% rename from notes/flutter_web/lib/notes/widgets/specific_widgets/button/ButtonStyleButton/1.elevated_button.dart rename to notes/flutter_web/lib/routes/notes/widgets/specific_widgets/button/ButtonStyleButton/1.elevated_button.dart diff --git a/notes/flutter_web/lib/notes/widgets/specific_widgets/button/ButtonStyleButton/note.dart b/notes/flutter_web/lib/routes/notes/widgets/specific_widgets/button/ButtonStyleButton/page.dart similarity index 100% rename from notes/flutter_web/lib/notes/widgets/specific_widgets/button/ButtonStyleButton/note.dart rename to notes/flutter_web/lib/routes/notes/widgets/specific_widgets/button/ButtonStyleButton/page.dart diff --git a/notes/flutter_web/lib/notes/widgets/specific_widgets/button/FloatingActionButton/note.dart b/notes/flutter_web/lib/routes/notes/widgets/specific_widgets/button/FloatingActionButton/page.dart similarity index 100% rename from notes/flutter_web/lib/notes/widgets/specific_widgets/button/FloatingActionButton/note.dart rename to notes/flutter_web/lib/routes/notes/widgets/specific_widgets/button/FloatingActionButton/page.dart diff --git a/notes/flutter_web/lib/notes/widgets/specific_widgets/button/IconButton/note.dart b/notes/flutter_web/lib/routes/notes/widgets/specific_widgets/button/IconButton/page.dart similarity index 100% rename from notes/flutter_web/lib/notes/widgets/specific_widgets/button/IconButton/note.dart rename to notes/flutter_web/lib/routes/notes/widgets/specific_widgets/button/IconButton/page.dart diff --git a/notes/flutter_web/lib/notes/widgets/specific_widgets/button/overview/note.dart b/notes/flutter_web/lib/routes/notes/widgets/specific_widgets/button/overview/page.dart similarity index 100% rename from notes/flutter_web/lib/notes/widgets/specific_widgets/button/overview/note.dart rename to notes/flutter_web/lib/routes/notes/widgets/specific_widgets/button/overview/page.dart diff --git a/notes/flutter_web/lib/notes/widgets/specific_widgets/icon/note.dart b/notes/flutter_web/lib/routes/notes/widgets/specific_widgets/icon/page.dart similarity index 100% rename from notes/flutter_web/lib/notes/widgets/specific_widgets/icon/note.dart rename to notes/flutter_web/lib/routes/notes/widgets/specific_widgets/icon/page.dart diff --git a/notes/flutter_web/lib/notes/widgets/specific_widgets/input/note.dart b/notes/flutter_web/lib/routes/notes/widgets/specific_widgets/input/page.dart similarity index 100% rename from notes/flutter_web/lib/notes/widgets/specific_widgets/input/note.dart rename to notes/flutter_web/lib/routes/notes/widgets/specific_widgets/input/page.dart diff --git a/notes/flutter_web/lib/notes/widgets/specific_widgets/selectable/note.dart b/notes/flutter_web/lib/routes/notes/widgets/specific_widgets/selectable/page.dart similarity index 100% rename from notes/flutter_web/lib/notes/widgets/specific_widgets/selectable/note.dart rename to notes/flutter_web/lib/routes/notes/widgets/specific_widgets/selectable/page.dart diff --git a/notes/flutter_web/lib/notes/widgets/specific_widgets/slider/1.slider.dart b/notes/flutter_web/lib/routes/notes/widgets/specific_widgets/slider/1.slider.dart similarity index 100% rename from notes/flutter_web/lib/notes/widgets/specific_widgets/slider/1.slider.dart rename to notes/flutter_web/lib/routes/notes/widgets/specific_widgets/slider/1.slider.dart diff --git a/notes/flutter_web/lib/notes/widgets/specific_widgets/slider/note.dart b/notes/flutter_web/lib/routes/notes/widgets/specific_widgets/slider/page.dart similarity index 100% rename from notes/flutter_web/lib/notes/widgets/specific_widgets/slider/note.dart rename to notes/flutter_web/lib/routes/notes/widgets/specific_widgets/slider/page.dart diff --git a/notes/flutter_web/lib/notes/widgets/specific_widgets/text/RichText/note.dart b/notes/flutter_web/lib/routes/notes/widgets/specific_widgets/text/RichText/page.dart similarity index 100% rename from notes/flutter_web/lib/notes/widgets/specific_widgets/text/RichText/note.dart rename to notes/flutter_web/lib/routes/notes/widgets/specific_widgets/text/RichText/page.dart diff --git a/notes/flutter_web/lib/notes/widgets/specific_widgets/text/Text/1.text_normal.dart b/notes/flutter_web/lib/routes/notes/widgets/specific_widgets/text/Text/1.text_normal.dart similarity index 100% rename from notes/flutter_web/lib/notes/widgets/specific_widgets/text/Text/1.text_normal.dart rename to notes/flutter_web/lib/routes/notes/widgets/specific_widgets/text/Text/1.text_normal.dart diff --git a/notes/flutter_web/lib/notes/widgets/specific_widgets/text/Text/2.text_rich.dart b/notes/flutter_web/lib/routes/notes/widgets/specific_widgets/text/Text/2.text_rich.dart similarity index 100% rename from notes/flutter_web/lib/notes/widgets/specific_widgets/text/Text/2.text_rich.dart rename to notes/flutter_web/lib/routes/notes/widgets/specific_widgets/text/Text/2.text_rich.dart diff --git a/notes/flutter_web/lib/notes/widgets/specific_widgets/text/Text/note.dart b/notes/flutter_web/lib/routes/notes/widgets/specific_widgets/text/Text/page.dart similarity index 100% rename from notes/flutter_web/lib/notes/widgets/specific_widgets/text/Text/note.dart rename to notes/flutter_web/lib/routes/notes/widgets/specific_widgets/text/Text/page.dart diff --git a/notes/flutter_web/lib/notes/widgets/specific_widgets/webview/note.dart b/notes/flutter_web/lib/routes/notes/widgets/specific_widgets/webview/page.dart similarity index 100% rename from notes/flutter_web/lib/notes/widgets/specific_widgets/webview/note.dart rename to notes/flutter_web/lib/routes/notes/widgets/specific_widgets/webview/page.dart diff --git a/notes/flutter_web/lib/notes/x.note_inside/1.welcome/note.dart b/notes/flutter_web/lib/routes/notes/x.note_inside/1.welcome/page.dart similarity index 100% rename from notes/flutter_web/lib/notes/x.note_inside/1.welcome/note.dart rename to notes/flutter_web/lib/routes/notes/x.note_inside/1.welcome/page.dart diff --git a/notes/flutter_web/lib/notes/x.note_inside/1.welcome/note.json b/notes/flutter_web/lib/routes/notes/x.note_inside/1.welcome/page.json similarity index 100% rename from notes/flutter_web/lib/notes/x.note_inside/1.welcome/note.json rename to notes/flutter_web/lib/routes/notes/x.note_inside/1.welcome/page.json diff --git a/notes/flutter_web/lib/notes/x.note_inside/how_note_work/note.dart b/notes/flutter_web/lib/routes/notes/x.note_inside/how_note_work/page.dart similarity index 100% rename from notes/flutter_web/lib/notes/x.note_inside/how_note_work/note.dart rename to notes/flutter_web/lib/routes/notes/x.note_inside/how_note_work/page.dart diff --git a/notes/flutter_web/lib/notes/x.note_inside/how_note_work/note.json b/notes/flutter_web/lib/routes/notes/x.note_inside/how_note_work/page.json similarity index 100% rename from notes/flutter_web/lib/notes/x.note_inside/how_note_work/note.json rename to notes/flutter_web/lib/routes/notes/x.note_inside/how_note_work/page.json diff --git a/notes/flutter_web/lib/notes/x.note_inside/mockup_content/note.dart b/notes/flutter_web/lib/routes/notes/x.note_inside/mockup_content/page.dart similarity index 100% rename from notes/flutter_web/lib/notes/x.note_inside/mockup_content/note.dart rename to notes/flutter_web/lib/routes/notes/x.note_inside/mockup_content/page.dart diff --git a/notes/flutter_web/lib/notes/x.note_inside/note_api_thinking/format2_md_is_king.dart b/notes/flutter_web/lib/routes/notes/x.note_inside/note_api_thinking/format2_md_is_king.dart similarity index 100% rename from notes/flutter_web/lib/notes/x.note_inside/note_api_thinking/format2_md_is_king.dart rename to notes/flutter_web/lib/routes/notes/x.note_inside/note_api_thinking/format2_md_is_king.dart diff --git a/notes/flutter_web/lib/notes/x.note_inside/note_api_thinking/format_1.1_cell_block_is_king.dart b/notes/flutter_web/lib/routes/notes/x.note_inside/note_api_thinking/format_1.1_cell_block_is_king.dart similarity index 100% rename from notes/flutter_web/lib/notes/x.note_inside/note_api_thinking/format_1.1_cell_block_is_king.dart rename to notes/flutter_web/lib/routes/notes/x.note_inside/note_api_thinking/format_1.1_cell_block_is_king.dart diff --git a/notes/flutter_web/lib/notes/x.note_inside/note_api_thinking/format_1.2_cell_tree_is_king.dart b/notes/flutter_web/lib/routes/notes/x.note_inside/note_api_thinking/format_1.2_cell_tree_is_king.dart similarity index 100% rename from notes/flutter_web/lib/notes/x.note_inside/note_api_thinking/format_1.2_cell_tree_is_king.dart rename to notes/flutter_web/lib/routes/notes/x.note_inside/note_api_thinking/format_1.2_cell_tree_is_king.dart diff --git a/notes/flutter_web/lib/notes/x.note_inside/note_api_thinking/format_3_real_api.dart b/notes/flutter_web/lib/routes/notes/x.note_inside/note_api_thinking/format_3_real_api.dart similarity index 100% rename from notes/flutter_web/lib/notes/x.note_inside/note_api_thinking/format_3_real_api.dart rename to notes/flutter_web/lib/routes/notes/x.note_inside/note_api_thinking/format_3_real_api.dart diff --git a/notes/flutter_web/lib/notes/x.note_inside/note_test_self/nobody/note.dart b/notes/flutter_web/lib/routes/notes/x.note_inside/note_test_self/nobody/page.dart similarity index 100% rename from notes/flutter_web/lib/notes/x.note_inside/note_test_self/nobody/note.dart rename to notes/flutter_web/lib/routes/notes/x.note_inside/note_test_self/nobody/page.dart diff --git a/notes/flutter_web/lib/notes/x.note_inside/note_test_self/note.dart b/notes/flutter_web/lib/routes/notes/x.note_inside/note_test_self/page.dart similarity index 100% rename from notes/flutter_web/lib/notes/x.note_inside/note_test_self/note.dart rename to notes/flutter_web/lib/routes/notes/x.note_inside/note_test_self/page.dart diff --git a/notes/flutter_web/lib/notes/x.note_inside/note_test_self/note.json b/notes/flutter_web/lib/routes/notes/x.note_inside/note_test_self/page.json similarity index 100% rename from notes/flutter_web/lib/notes/x.note_inside/note_test_self/note.json rename to notes/flutter_web/lib/routes/notes/x.note_inside/note_test_self/page.json diff --git a/notes/flutter_web/lib/notes/x.note_inside/note.json b/notes/flutter_web/lib/routes/notes/x.note_inside/page.json similarity index 100% rename from notes/flutter_web/lib/notes/x.note_inside/note.json rename to notes/flutter_web/lib/routes/notes/x.note_inside/page.json diff --git a/notes/flutter_web/lib/routes/page.dart b/notes/flutter_web/lib/routes/page.dart new file mode 100644 index 00000000..29af7539 --- /dev/null +++ b/notes/flutter_web/lib/routes/page.dart @@ -0,0 +1,14 @@ +import 'package:flutter/material.dart'; + +RootPage build(BuildContext context) { + return const RootPage(); +} + +class RootPage extends StatelessWidget { + const RootPage({super.key}); + + @override + Widget build(BuildContext context) { + return const Text("/ root page"); + } +} diff --git a/notes/flutter_web/notes.g.json b/notes/flutter_web/notes.g.json deleted file mode 100644 index 7c319d4b..00000000 --- a/notes/flutter_web/notes.g.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "/* notes.g.json */": { - "zh-CN": "由github.com/chen56/note生成,note工具会在笔记根目录生成notes.g.json,用于识别您的笔记项目结构, 本文件应被保存在版本控制中,比如git,不应编辑、移动此文件。 ", - "en": "Generated by github.com/chen56/note, the note tool will generate a notes.g.json at the root of the note project, which is used to identify the structure of your note item, This file should be saved in version control, such as git, and should not be edited or moved." - }, - "currentMaxNoteId": 1, - "notes": { - "/research/research_parameterized_example": { - "displayName": "参数化范例机制", - "order": 100, - "codeExpand": false - }, - "/": { - "displayName": "flutter-note笔记", - "order": 100, - "codeExpand": false - }, - "/x.note_inside/how_note_work": { - "displayName": "Notebook机制", - "order": 100, - "codeExpand": false - }, - "/x.note_inside/1.welcome": { - "displayName": "welcome", - "order": 10, - "codeExpand": false - }, - "/x.note_inside/note_test_self": { - "displayName": "test", - "order": 10, - "codeExpand": false - } - } -} \ No newline at end of file diff --git a/notes/flutter_web/pubspec.yaml b/notes/flutter_web/pubspec.yaml index efeb9c34..89b45df8 100644 --- a/notes/flutter_web/pubspec.yaml +++ b/notes/flutter_web/pubspec.yaml @@ -61,63 +61,8 @@ dev_dependencies: flutter: uses-material-design: true - # if app can not start , you can remove all prefix "lib/notes/*" assets , it is auto generated by note_tools - assets: - - notes.g.json - - lib/notes/ - - lib/notes/widgets/container_widgets/bar/ - - lib/notes/widgets/container_widgets/menu/ - - lib/notes/widgets/container_widgets/scrollable/Dismissible/ - - lib/notes/widgets/specific_widgets/input/ - - lib/notes/widgets/specific_widgets/selectable/ - - lib/notes/widgets/specific_widgets/slider/ - - lib/notes/widgets/specific_widgets/text/RichText/ - - lib/notes/widgets/specific_widgets/text/Text/ - - lib/notes/widgets/specific_widgets/webview/ - - lib/notes/dev/debug/ - - lib/notes/dev/devtool/ - - lib/notes/dev/devtool/vmservice/ - - lib/notes/dev/host_mirror/ - - lib/notes/dev/macos_config/ - - lib/notes/pure_dart/analyzer/ - - lib/notes/pure_dart/dart3/ - - lib/notes/pure_dart/execption/ - - lib/notes/pure_dart/serialization_json/ - - lib/notes/research/remote_view/ - - lib/notes/thinking_in_ui/readable_html_vs_dart/ - - lib/notes/x.note_inside/how_note_work/ - - lib/notes/x.note_inside/note_test_self/ - - lib/notes/x.note_inside/note_test_self/nobody/ - - lib/notes/Improve_app/ - - lib/notes/Improve_app/1.overview/ - - lib/notes/Improve_app/web_optimization/ - - lib/notes/Improve_app/RepaintBoundary/ - - lib/notes/Improve_app/event&listener&lifeycle/ - - lib/notes/i18n/ - - lib/notes/media&assets&file/assets/ - - lib/notes/pure_dart/async/ - - lib/notes/style&theming/material3/ - - lib/notes/widgets/specific_widgets/button/ButtonStyleButton/ - - lib/notes/widgets/specific_widgets/button/FloatingActionButton/ - - lib/notes/widgets/specific_widgets/button/IconButton/ - - lib/notes/widgets/specific_widgets/button/overview/ - - lib/notes/widgets/specific_widgets/icon/ - - lib/notes/x.note_inside/1.welcome/ - - lib/notes/x.note_inside/mockup_content/ - - lib/notes/navigation/ - - lib/notes/state/ - - lib/notes/state/1.vanilla_state/ - - lib/notes/state/StatefulBuilder/ - - lib/notes/pure_dart/safe_interface/ - - lib/notes/layout/ - - lib/notes/layout/box_layout/constraints/ - - lib/notes/layout/old/layout/ - - lib/notes/layout/responsive_design/ - - lib/notes/media&assets&file/file_desktop/ - - lib/notes/media&assets&file/file_web/ - - lib/notes/env_info/ - - lib/notes/research/research_parameterized_example/ - + # if app can not start , you can remove all prefix "lib/routes/*" assets , it is auto generated by note_tools +# assets: # An image asset can refer to one or more resolution-specific "variants", see # https://flutter.dev/assets-and-images/#resolution-aware diff --git a/notes/flutter_web/pubspec_overrides.yaml b/notes/flutter_web/pubspec_overrides.yaml deleted file mode 100644 index 1a46a152..00000000 --- a/notes/flutter_web/pubspec_overrides.yaml +++ /dev/null @@ -1,4 +0,0 @@ -## melos_managed_dependency_overrides: note,mate_flutter -#dependency_overrides: -# note: -# path: ../../ \ No newline at end of file diff --git a/notes/flutter_web/test/widget_test.dart b/notes/flutter_web/test/widget_test.dart index afc3af7d..6b10172c 100644 --- a/notes/flutter_web/test/widget_test.dart +++ b/notes/flutter_web/test/widget_test.dart @@ -6,7 +6,7 @@ // tree, read text, and verify that the values of widget properties are correct. import 'package:flutter/material.dart'; -import 'package:flutter_web/notes/widgets/container_widgets/Card/sample1.dart'; +import 'package:flutter_web/routes/notes/widgets/container_widgets/Card/sample1.dart'; import 'package:flutter_test/flutter_test.dart'; diff --git a/notes/learn_dart/pubspec.yaml b/notes/learn_dart/pubspec.yaml index a3f93de6..6b22c4db 100644 --- a/notes/learn_dart/pubspec.yaml +++ b/notes/learn_dart/pubspec.yaml @@ -13,6 +13,7 @@ dependencies: # Provides internationalization and localization facilities, # including message translation, plurals and genders, # date/number formatting and parsing, and bidirectional text. + file: ^7.0.0 intl: test_api: ^0.7.0 vm_service: ^14.2.0 diff --git a/notes/learn_dart/test/benchmark/collection_benchmark_test.dart b/notes/learn_dart/test/@benchmark/collection_benchmark_test.dart similarity index 100% rename from notes/learn_dart/test/benchmark/collection_benchmark_test.dart rename to notes/learn_dart/test/@benchmark/collection_benchmark_test.dart diff --git a/notes/learn_dart/test/benchmark/exception_benchmark.dart b/notes/learn_dart/test/@benchmark/exception_benchmark.dart similarity index 100% rename from notes/learn_dart/test/benchmark/exception_benchmark.dart rename to notes/learn_dart/test/@benchmark/exception_benchmark.dart diff --git a/notes/learn_dart/test/benchmark/vs/map_vs_function_test.dart b/notes/learn_dart/test/@benchmark/vs/map_vs_function_test.dart similarity index 100% rename from notes/learn_dart/test/benchmark/vs/map_vs_function_test.dart rename to notes/learn_dart/test/@benchmark/vs/map_vs_function_test.dart diff --git a/notes/learn_dart/test/basic_syntax/basic.dart b/notes/learn_dart/test/@syntax/basic.dart similarity index 100% rename from notes/learn_dart/test/basic_syntax/basic.dart rename to notes/learn_dart/test/@syntax/basic.dart diff --git a/notes/learn_dart/test/class_and_object/constroctor_order_test.dart b/notes/learn_dart/test/@syntax/class_and_object/constroctor_order_test.dart similarity index 100% rename from notes/learn_dart/test/class_and_object/constroctor_order_test.dart rename to notes/learn_dart/test/@syntax/class_and_object/constroctor_order_test.dart diff --git a/notes/learn_dart/test/class_and_object/meta.dart b/notes/learn_dart/test/@syntax/class_and_object/meta.dart similarity index 100% rename from notes/learn_dart/test/class_and_object/meta.dart rename to notes/learn_dart/test/@syntax/class_and_object/meta.dart diff --git a/notes/learn_dart/test/class_and_object/method_test.dart b/notes/learn_dart/test/@syntax/class_and_object/method_test.dart similarity index 100% rename from notes/learn_dart/test/class_and_object/method_test.dart rename to notes/learn_dart/test/@syntax/class_and_object/method_test.dart diff --git a/notes/learn_dart/test/concurrency/async_test.dart b/notes/learn_dart/test/@syntax/concurrency/async_test.dart similarity index 100% rename from notes/learn_dart/test/concurrency/async_test.dart rename to notes/learn_dart/test/@syntax/concurrency/async_test.dart diff --git a/notes/learn_dart/test/dart3_augment/README.md b/notes/learn_dart/test/@syntax/dart3_augment/README.md similarity index 100% rename from notes/learn_dart/test/dart3_augment/README.md rename to notes/learn_dart/test/@syntax/dart3_augment/README.md diff --git a/notes/learn_dart/test/dart3_augment/ext.dart b/notes/learn_dart/test/@syntax/dart3_augment/ext.dart similarity index 100% rename from notes/learn_dart/test/dart3_augment/ext.dart rename to notes/learn_dart/test/@syntax/dart3_augment/ext.dart diff --git a/notes/learn_dart/test/dart3_augment/main.dart b/notes/learn_dart/test/@syntax/dart3_augment/main.dart similarity index 100% rename from notes/learn_dart/test/dart3_augment/main.dart rename to notes/learn_dart/test/@syntax/dart3_augment/main.dart diff --git a/notes/learn_dart/test/dart3_augment/x.dart b/notes/learn_dart/test/@syntax/dart3_augment/x.dart similarity index 100% rename from notes/learn_dart/test/dart3_augment/x.dart rename to notes/learn_dart/test/@syntax/dart3_augment/x.dart diff --git a/notes/learn_dart/test/error_handle/exception.dart b/notes/learn_dart/test/@syntax/error_handle/exception.dart similarity index 100% rename from notes/learn_dart/test/error_handle/exception.dart rename to notes/learn_dart/test/@syntax/error_handle/exception.dart diff --git a/notes/learn_dart/test/types/class-modifiers/base.dart b/notes/learn_dart/test/@syntax/types/class-modifiers/base.dart similarity index 100% rename from notes/learn_dart/test/types/class-modifiers/base.dart rename to notes/learn_dart/test/@syntax/types/class-modifiers/base.dart diff --git a/notes/learn_dart/test/types/class-modifiers/base_client.dart b/notes/learn_dart/test/@syntax/types/class-modifiers/base_client.dart similarity index 100% rename from notes/learn_dart/test/types/class-modifiers/base_client.dart rename to notes/learn_dart/test/@syntax/types/class-modifiers/base_client.dart diff --git a/notes/learn_dart/test/types/class-modifiers/interface.dart b/notes/learn_dart/test/@syntax/types/class-modifiers/interface.dart similarity index 100% rename from notes/learn_dart/test/types/class-modifiers/interface.dart rename to notes/learn_dart/test/@syntax/types/class-modifiers/interface.dart diff --git a/notes/learn_dart/test/types/class-modifiers/mixin.dart b/notes/learn_dart/test/@syntax/types/class-modifiers/mixin.dart similarity index 100% rename from notes/learn_dart/test/types/class-modifiers/mixin.dart rename to notes/learn_dart/test/@syntax/types/class-modifiers/mixin.dart diff --git a/notes/learn_dart/test/types/class-modifiers/sealed.dart b/notes/learn_dart/test/@syntax/types/class-modifiers/sealed.dart similarity index 100% rename from notes/learn_dart/test/types/class-modifiers/sealed.dart rename to notes/learn_dart/test/@syntax/types/class-modifiers/sealed.dart diff --git a/notes/learn_dart/test/types/class-modifiers/sealed_client.dart b/notes/learn_dart/test/@syntax/types/class-modifiers/sealed_client.dart similarity index 100% rename from notes/learn_dart/test/types/class-modifiers/sealed_client.dart rename to notes/learn_dart/test/@syntax/types/class-modifiers/sealed_client.dart diff --git a/notes/learn_dart/test/types/collection_type_test.dart b/notes/learn_dart/test/@syntax/types/collection_type_test.dart similarity index 100% rename from notes/learn_dart/test/types/collection_type_test.dart rename to notes/learn_dart/test/@syntax/types/collection_type_test.dart diff --git a/notes/learn_dart/test/types/dart3_record.dart b/notes/learn_dart/test/@syntax/types/dart3_record.dart similarity index 100% rename from notes/learn_dart/test/types/dart3_record.dart rename to notes/learn_dart/test/@syntax/types/dart3_record.dart diff --git a/notes/learn_dart/test/types/generics_test.dart b/notes/learn_dart/test/@syntax/types/generics_test.dart similarity index 100% rename from notes/learn_dart/test/types/generics_test.dart rename to notes/learn_dart/test/@syntax/types/generics_test.dart diff --git a/notes/learn_dart/test/types/types_test.dart b/notes/learn_dart/test/@syntax/types/types_test.dart similarity index 84% rename from notes/learn_dart/test/types/types_test.dart rename to notes/learn_dart/test/@syntax/types/types_test.dart index 4a3be6e5..b232dd7d 100644 --- a/notes/learn_dart/test/types/types_test.dart +++ b/notes/learn_dart/test/@syntax/types/types_test.dart @@ -41,13 +41,11 @@ void main() { Symbol? a = #a; Symbol? a2 = #a; check(a).equals(a2); - }); test('Object equals', () { - check(const Object()==const Object()).equals(true); - check( Object()!=const Object()).equals(true); - check( Object()!= Object()).equals(true); - + check(const Object() == const Object()).equals(true); + check(Object() != const Object()).equals(true); + check(Object() != Object()).equals(true); }); }); group("Enum", () { @@ -77,40 +75,51 @@ void main() { }); }); group("runtimeType 关系?", () { + test('type ==', () { + // 2s多 + DoubleLinkedQueue q = DoubleLinkedQueue(); + check(q.runtimeType == DoubleLinkedQueue).isTrue(); + check(q.runtimeType != Queue).isTrue(); + }); + test('SpecificTypeFuncInject扩展Function后可在里面加点料,方便mate模型生成代码', () { // 2s多 - for(int i=0;i<1000*1000*1000;i++){ + for (int i = 0; i < 1000 * 1000 * 1000; i++) { // ignore: unused_local_variable - var x =[] is ListBase; + var x = [] is ListBase; // check([] is ListBase).equals(true); } }); - }); group("Unique", () { test(' x', () { - Uniquely x = Uniquely(name: "x") ; - check(x==x).equals(false); + Uniquely x = Uniquely(name: "x"); + check(x == x).equals(false); }); }); } class SegmentedButton$Mate { String injectInfo; + SegmentedButton$Mate({this.onSelectionChanged}) : injectInfo = "${onSelectionChanged?.name}"; void Function(Set)? onSelectionChanged; } extension SpecificTypeFuncInject on void Function(Set selected) { static final _name = Expando(); + String get name => _name[this] ?? ""; + set name(String v) => _name[this] = v; + inject({ required String func, }) { _name[this] = func; } } + class Uniquely { final String name; @@ -131,18 +140,23 @@ class Uniquely { extension FuncCodeInject on Function { static final _from = Expando(); static final _mode = Expando(); + String get from => _from[this] ?? ""; + InjectMode get mode => _mode[this] ?? InjectMode.embed; + set name(String v) => _from[this] = v; + inject( - /// the Mate field Referenced function name - String func, { - /// expected inject code mode - InjectMode mode = InjectMode.refer, - /// is copy function context code - bool copyContext = true, - }) { + /// the Mate field Referenced function name + String func, { + /// expected inject code mode + InjectMode mode = InjectMode.refer, + + /// is copy function context code + bool copyContext = true, + }) { _from[this] = func; _mode[this] = mode; } diff --git a/notes/learn_dart/test/collection/list_test.dart b/notes/learn_dart/test/collection/list_test.dart deleted file mode 100644 index 9d84d343..00000000 --- a/notes/learn_dart/test/collection/list_test.dart +++ /dev/null @@ -1,8 +0,0 @@ -// ignore_for_file: unnecessary_type_check - -import 'dart:core'; - - -void main() { - -} diff --git a/notes/learn_dart/test/collection/map_test.dart b/notes/learn_dart/test/collection/map_test.dart deleted file mode 100644 index 1d5d70d3..00000000 --- a/notes/learn_dart/test/collection/map_test.dart +++ /dev/null @@ -1,9 +0,0 @@ -// ignore_for_file: unnecessary_type_check - -import 'dart:core'; - -import 'package:test/test.dart'; - -void main() { - test('map', () {}); -} diff --git a/notes/learn_dart/test/collection/queue.dart b/notes/learn_dart/test/collection/queue.dart deleted file mode 100644 index e69de29b..00000000 diff --git a/notes/learn_dart/test/pub_lib_core/test/test_api.dart b/notes/learn_dart/test/dark_lang!test/test_api.dart similarity index 100% rename from notes/learn_dart/test/pub_lib_core/test/test_api.dart rename to notes/learn_dart/test/dark_lang!test/test_api.dart diff --git a/notes/learn_dart/test/pub_lib_core/code_builder/code_test.dart b/notes/learn_dart/test/dart_lang!code_builder/code_test.dart similarity index 82% rename from notes/learn_dart/test/pub_lib_core/code_builder/code_test.dart rename to notes/learn_dart/test/dart_lang!code_builder/code_test.dart index 6a0a0769..537fc597 100644 --- a/notes/learn_dart/test/pub_lib_core/code_builder/code_test.dart +++ b/notes/learn_dart/test/dart_lang!code_builder/code_test.dart @@ -6,6 +6,8 @@ import 'package:test/test.dart'; void main() { group("范型", () { - test('list', () {}); + test('list', () { + + }); }); } diff --git a/notes/learn_dart/test/pub_lib/glob/glob_test.dart b/notes/learn_dart/test/dart_lang!glob/glob_test.dart similarity index 100% rename from notes/learn_dart/test/pub_lib/glob/glob_test.dart rename to notes/learn_dart/test/dart_lang!glob/glob_test.dart diff --git a/notes/learn_dart/test/pub_lib_core/path_test.dart b/notes/learn_dart/test/dart_lang!path/path_test.dart similarity index 100% rename from notes/learn_dart/test/pub_lib_core/path_test.dart rename to notes/learn_dart/test/dart_lang!path/path_test.dart diff --git a/notes/learn_dart/test/collection/iterable_test.dart b/notes/learn_dart/test/dart_lang!sdk!core/collection_iterable_test.dart similarity index 100% rename from notes/learn_dart/test/collection/iterable_test.dart rename to notes/learn_dart/test/dart_lang!sdk!core/collection_iterable_test.dart diff --git a/notes/learn_dart/test/pub_lib_core/dart:core/convert_test.dart b/notes/learn_dart/test/dart_lang!sdk!core/convert_test.dart similarity index 100% rename from notes/learn_dart/test/pub_lib_core/dart:core/convert_test.dart rename to notes/learn_dart/test/dart_lang!sdk!core/convert_test.dart diff --git a/notes/learn_dart/test/gc/finalizer.dart b/notes/learn_dart/test/dart_lang!sdk!core/finalizer.dart similarity index 100% rename from notes/learn_dart/test/gc/finalizer.dart rename to notes/learn_dart/test/dart_lang!sdk!core/finalizer.dart diff --git a/notes/learn_dart/test/pub_lib_core/dart:core/regex_test.dart b/notes/learn_dart/test/dart_lang!sdk!core/regex_test.dart similarity index 100% rename from notes/learn_dart/test/pub_lib_core/dart:core/regex_test.dart rename to notes/learn_dart/test/dart_lang!sdk!core/regex_test.dart diff --git a/notes/learn_dart/test/pub_lib_core/dart:core/str_test.dart b/notes/learn_dart/test/dart_lang!sdk!core/str_test.dart similarity index 100% rename from notes/learn_dart/test/pub_lib_core/dart:core/str_test.dart rename to notes/learn_dart/test/dart_lang!sdk!core/str_test.dart diff --git a/notes/learn_dart/test/dart_lang!sdk!core/uri_test.dart b/notes/learn_dart/test/dart_lang!sdk!core/uri_test.dart new file mode 100644 index 00000000..74565f7d --- /dev/null +++ b/notes/learn_dart/test/dart_lang!sdk!core/uri_test.dart @@ -0,0 +1,25 @@ +// ignore_for_file: unnecessary_type_check + +import 'package:checks/checks.dart'; +import 'package:test/test.dart'; + +void main() { + group('uri', () { + test('segments', () { + // + check(Uri.parse("/").pathSegments).deepEquals([]); + check(Uri.parse("https://a.com/").pathSegments).deepEquals([]); + + + check(Uri.parse("//").pathSegments).deepEquals([]); + check(Uri.parse("https://a.com//").pathSegments).deepEquals(["",""]); + + check(Uri.parse("/a").pathSegments).deepEquals(["a"]); + check(Uri.parse("https://a.com/a").pathSegments).deepEquals(["a"]); + + check(Uri.parse("/a/").pathSegments).deepEquals(["a",""]); + check(Uri.parse("https://a.com/a/").pathSegments).deepEquals(["a",""]); + }); + + }); +} diff --git a/notes/learn_dart/test/pub_lib_core/dart:io/all_env.dart b/notes/learn_dart/test/dart_lang!sdk!io/all_env.dart similarity index 100% rename from notes/learn_dart/test/pub_lib_core/dart:io/all_env.dart rename to notes/learn_dart/test/dart_lang!sdk!io/all_env.dart diff --git a/notes/learn_dart/test/dart_lang!sdk!io/read_file_as_string_test.dart b/notes/learn_dart/test/dart_lang!sdk!io/read_file_as_string_test.dart new file mode 100644 index 00000000..b80aa06d --- /dev/null +++ b/notes/learn_dart/test/dart_lang!sdk!io/read_file_as_string_test.dart @@ -0,0 +1,13 @@ +// ignore_for_file: avoid_print + + +import 'package:test/test.dart'; + + +main() { + group('read file as string', () async { + test('analyzer', () async { + }); + + }); +} diff --git a/notes/learn_dart/test/pub_lib_core/analyzer/analyzer_list_alltype.dart b/notes/learn_dart/test/dart_lang!sdk!pkg!analyzer/analyzer_list_alltype.dart similarity index 100% rename from notes/learn_dart/test/pub_lib_core/analyzer/analyzer_list_alltype.dart rename to notes/learn_dart/test/dart_lang!sdk!pkg!analyzer/analyzer_list_alltype.dart diff --git a/notes/learn_dart/test/dart_lang!sdk!pkg!analyzer/element_test.dart b/notes/learn_dart/test/dart_lang!sdk!pkg!analyzer/element_test.dart new file mode 100644 index 00000000..2b05e905 --- /dev/null +++ b/notes/learn_dart/test/dart_lang!sdk!pkg!analyzer/element_test.dart @@ -0,0 +1,53 @@ +// ignore_for_file: unnecessary_type_check + +import 'package:analyzer/dart/analysis/analysis_context_collection.dart'; +import 'package:analyzer/dart/analysis/results.dart'; +import 'package:analyzer/dart/element/element.dart'; +import 'package:analyzer/dart/element/visitor.dart'; +import 'package:analyzer/file_system/physical_file_system.dart'; +import 'package:test/test.dart'; +import 'package:path/path.dart' as path; + +void main() { + test('analyzer', () async { + String f = "test/dart_lang!sdk!pkg!analyzer/element_test.dart"; + f = path.absolute(f); + var session = AnalysisContextCollection( + includedPaths: [f], + resourceProvider: PhysicalResourceProvider(), + ).contexts[0].currentSession; + var resolved = await session.getResolvedLibrary(f) as ResolvedLibraryResult; + // resolved.element.visitChildren(XXX()); + findAll(resolved.element).toList().forEach((e)=>print("ssss $e")); + }); +} + +Iterable findAll(Element element, {bool Function(Element element)? where}) sync* { + if (where != null && where(element) == false) { + return ; + } + yield element; + for(var child in element.children){ + yield* findAll(child,where:where); + } +} + +class XXX extends RecursiveElementVisitor { + String x = ""; + + @override + // visitElement(Element element) { + // print(element); + // return super.visitElement(element); + // } + visitClassElement(ClassElement element) { + print(element); + return super.visitClassElement(element); + } + + @override + visitLibraryImportElement(LibraryImportElement element) { + // element.importedLibrary + return super.visitLibraryImportElement(element); + } +} \ No newline at end of file diff --git a/notes/learn_dart/test/pub_lib_core/analyzer/mock_sdk_analyzer_test.dart b/notes/learn_dart/test/dart_lang!sdk!pkg!analyzer/mock_sdk_analyzer_test.dart similarity index 100% rename from notes/learn_dart/test/pub_lib_core/analyzer/mock_sdk_analyzer_test.dart rename to notes/learn_dart/test/dart_lang!sdk!pkg!analyzer/mock_sdk_analyzer_test.dart diff --git a/notes/learn_dart/test/vm_service/vm_uri.dart b/notes/learn_dart/test/dary_lang!sdk!pkg!vm_service/vm_uri.dart similarity index 100% rename from notes/learn_dart/test/vm_service/vm_uri.dart rename to notes/learn_dart/test/dary_lang!sdk!pkg!vm_service/vm_uri.dart diff --git a/notes/learn_dart/test/google!file.dart/file_test.dart b/notes/learn_dart/test/google!file.dart/file_test.dart new file mode 100644 index 00000000..aa636e22 --- /dev/null +++ b/notes/learn_dart/test/google!file.dart/file_test.dart @@ -0,0 +1,51 @@ +// ignore_for_file: unnecessary_type_check, avoid_print + +import 'package:file/file.dart'; +import 'package:file/local.dart'; +import 'package:test/test.dart'; + +void main() { + test('directory recursive', () { + FileSystem fs = LocalFileSystem(); + var d = fs.directory("./"); + d.listSync().forEach((f) { + print(f); + }); + + PageNode page(Directory dir) { + var children = dir.listSync(recursive: false).whereType().map((e) => page(e)); + return PageNode(dir: dir, children: children.toList()); + } + + PageNode root = page(d); + root.toList().forEach((e) { + print("ssssss ${e.dir}"); + }); + }); +} + +class PageNode { + List children; + Directory dir; + + PageNode({required this.dir, required this.children}); + + List toList({ + bool includeThis = true, + bool Function(PageNode path)? where, + Comparator? sortBy, + }) { + where = where ?? (e) => true; + if (!where(this)) { + return []; + } + List sorted = List.from(children); + if (sortBy != null) { + sorted.sort(sortBy); + } + var flatChildren = sorted.expand((child) { + return child.toList(includeThis: true, where: where, sortBy: sortBy); + }).toList(); + return includeThis ? [this, ...flatChildren] : flatChildren; + } +} diff --git a/notes/learn_dart/test/pub_lib_core/analyzer/analyzer_parse_test.dart b/notes/learn_dart/test/pub_lib_core/analyzer/analyzer_parse_test.dart deleted file mode 100644 index 71e1a25d..00000000 --- a/notes/learn_dart/test/pub_lib_core/analyzer/analyzer_parse_test.dart +++ /dev/null @@ -1,18 +0,0 @@ -// ignore_for_file: unnecessary_type_check - -import 'package:analyzer/dart/analysis/features.dart'; -import 'package:test/test.dart'; -import 'package:analyzer/dart/analysis/utilities.dart' as analyzer_util; -import 'package:path/path.dart' as path; - -void main() { - test('analyzer', () { - var x = analyzer_util.parseFile( - path: path.absolute("test/pub_lib_core/analyzer/analyzer_parse_test.dart"), - featureSet: FeatureSet.latestLanguageVersion()); - print(x); - }); -} -class XXX{ - String x=""; -} \ No newline at end of file diff --git a/analysis_options.yaml b/packages/you_cli/analysis_options.yaml similarity index 100% rename from analysis_options.yaml rename to packages/you_cli/analysis_options.yaml diff --git a/packages/you_cli/bake b/packages/you_cli/bake new file mode 100755 index 00000000..aeb1828c --- /dev/null +++ b/packages/you_cli/bake @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +cd "$(dirname "${BASH_SOURCE[0]}")" || exit 200 +# project base bake shortcuts +../../bake you_cli "$@" \ No newline at end of file diff --git a/packages/you_cli/bin/cli.dart b/packages/you_cli/bin/cli.dart new file mode 100644 index 00000000..7059dd17 --- /dev/null +++ b/packages/you_cli/bin/cli.dart @@ -0,0 +1,222 @@ +import 'package:args/command_runner.dart'; +import 'package:code_builder/code_builder.dart'; + +import 'package:dart_style/dart_style.dart'; +import 'package:file/file.dart'; +import 'package:file/local.dart'; +import 'package:path/path.dart' as path; +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}"); + FileSystem fs = const LocalFileSystem(); + + var runner = CommandRunner("note", "you page tools."); + runner.addCommand( + Cmd_gen(fs: fs) + ..addSubcommand(Cmd_gen_all(fs: fs)) + ..addSubcommand(Cmd_gen_routes_g_dart(fs: fs)), + ); + + await runner.run(args); +} + +// ignore: camel_case_types +class Cmd_gen_all extends Command { + // The [name] and [description] properties must be defined by every + // subclass. + Cmd_gen_all({required this.fs}) { + argParser.addOption("dir", mandatory: true, help: "要生成的flutter note项目根目录"); + } + + final FileSystem fs; + @override + final name = "all"; + @override + final description = "gen all ."; + + // [run] may also return a Future. + @override + Future run() async {} +} + +// ignore: camel_case_types +class Cmd_gen extends Command { + Cmd_gen({required this.fs}); + + final FileSystem fs; + @override + final name = "gen"; + @override + final description = "gen management ."; + + // [run] may also return a Future. + @override + Future run() async {} +} + +// ignore: camel_case_types +class Cmd_gen_routes_g_dart extends Command { + Cmd_gen_routes_g_dart({required this.fs}) : libMode = false { + argParser.addOption("dir", mandatory: true, help: "要生成的flutter note项目根目录"); + argParser.addFlag("async", help: "import deferred as模式生成(默认同步加载),web环境下异步加载资源可减少首屏下载"); + } + + Cmd_gen_routes_g_dart.libMode({ + required this.fs, + required this.async, + required this.dir, + }) : libMode = true; + + bool libMode; + bool async = false; + late Directory dir; + + @override + final name = "routes.g.dart"; + @override + final description = "gen routes.g.dart ."; + final FileSystem fs; + final CleanPrefixedAllocator _allocator = CleanPrefixedAllocator(); + YouCli? _cli; + + YouCli get cli => _cli != null ? _cli! : _cli = YouCli(projectDir: dir); + + // example: + // - async page: + // (context, print) async => await notes_i18n_.loadLibrary().then((_) => notes_i18n_.build(context, print)) + // - async layout + page : + // notes_layout.layout((context, print) async => await notes_i18n_.loadLibrary().then((_) => notes_i18n_.build(context, print))) + @Deprecated("已废弃,待完成重构后删除") + Expression? builderExpression(RouteNode node) { + if (!node.file_page_dart.existsSync()) { + return null; + } + 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 Method((b) => b + ..modifier = MethodModifier.async + ..body = Block.of( + [ + refer("${node.flatName}_").property("loadLibrary").call([]).awaited.statement, + if (layout != null) refer("${layout.flatName}__").property("loadLibrary").call([]).awaited.statement, + builder.returned.statement, + ], + )).closure; + } else { + return builder; + } + } + + + 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 + Future run() async { + if (!libMode) { + String dirOpt = argResults!["dir"]; + dir = fs.directory(path.absolute(dirOpt)); + async = argResults!.flag("async"); + } + if (!dir.existsSync()) { + throw AssertionError("【--dir $dir】 not exists"); + } + + var rootRoute = await cli.rootRoute; + Iterable routes = rootRoute.toList(); + + Library all = Library( + (b) => b + ..generatedByComment = """ +// Generated by https://github.com/chen56/you +// - This file setup routes tree and strong type `routes` reference +// - This file should be version controlled and should not be manually edited +// +// ignore_for_file: prefer_function_declarations_over_variables +// 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.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( + Class( + (b) => b + ..name = "Routes" + ..mixins.add(refer("RoutesMixin")) + ), + ), + ); + + var fmt = DartFormatter(pageWidth: 200); + 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); + // 暂时不格式化,因为要保持变量名后的padding,对齐变量更好看 + // file.writeAsString(_fmt.format(toCode)); + } +} + +_log(Object? o) { + // ignore: avoid_print + print("${DateTime.now()} - $o"); +} diff --git a/packages/you_cli/lib/src/cli_core.dart b/packages/you_cli/lib/src/cli_core.dart new file mode 100644 index 00000000..ce65e124 --- /dev/null +++ b/packages/you_cli/lib/src/cli_core.dart @@ -0,0 +1,242 @@ +// ignore_for_file: non_constant_identifier_names + +import 'package:analyzer/dart/analysis/analysis_context_collection.dart'; +import 'package:analyzer/dart/analysis/results.dart'; +import 'package:analyzer/dart/analysis/session.dart'; +import 'package:analyzer/dart/element/element.dart'; +import 'package:analyzer/file_system/physical_file_system.dart'; +import 'package:code_builder/code_builder.dart'; +import 'package:file/file.dart'; +import 'package:path/path.dart' as path; +import 'package:you_cli/src/yaml.dart'; + +// final Glob _PAGE_GLOB = Glob("{**/page.dart,page.dart}"); +class YouCli { + YouCli({required Directory projectDir}) + : dir_project = projectDir.fileSystem.directory(path.normalize(path.absolute(projectDir.path))), + fs = projectDir.fileSystem; + + static const Reference toTypeDefault = Reference("To", "package:you_flutter/router.dart"); + static const String toTypeName = "ToType"; + static const String pageDart = "page.dart"; + static const String layoutDart = "layout.dart"; + static const String layoutFunctionName = "layout"; + static const String pageBuildFunctionName = "build"; + final Directory dir_project; + final FileSystem fs; + Pubspec? _pubspec; + RouteNode? _rootRoute; + AnalysisSession? _session; + + Directory get dir_lib => dir_project.childDirectory("lib"); + + Directory get dir_routes => dir_project.childDirectory("lib/routes"); + + Directory get dir_notes => dir_project.childDirectory("lib/routes/notes"); + + File get file_routes_g_dart => dir_project.childFile("lib/routes.g.dart"); + + File get file_pubspec_yaml => dir_project.childFile("pubspec.yaml"); + + Pubspec get pubspec => _pubspec ??= Pubspec.parseFileSync(file_pubspec_yaml); + + Future get rootRoute async { + Future from(Directory dir) async { + if (!dir.existsSync()) { + 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, + toType: toType, + children: children, + ); + } + + return _rootRoute ??= await from(dir_routes); + } + AnalysisSession get analysisSession { + return _session ??= AnalysisContextCollection( + includedPaths: [dir_lib.path], + resourceProvider: PhysicalResourceProvider(), + ).contexts[0].currentSession; + } + + /// given a internal lib: package:you_flutter/src/router.dart + /// => find it's public export : package:you_flutter/router.dart + LibraryElement? findPublicExportLib(TypeDefiningElement toFind, LibraryElement useAt) { + for (var import in useAt.importedLibraries) { + for (var MapEntry(key: _, value: value) in import.exportNamespace.definedNames.entries) { + if (toFind == value) { + return import; + } + } + } + return toFind.library!; + } + + Future<({FunctionElement? layout, Reference? toType})> analysisLayout(File file) async { + if (!await file.exists()) { + return (layout: null, toType: null); + } + + var layoutLib = (await analysisSession.getResolvedLibrary(path.normalize(path.absolute(file.path))) as ResolvedLibraryResult).element; + FunctionElement? layoutFunction = layoutLib.definingCompilationUnit.functions.where((e) => e.name == layoutFunctionName).firstOrNull; + if (layoutFunction == null) { + return (layout: null, toType: null); + } + var findToTypeAnno = layoutFunction.metadata.map((e) => e.computeConstantValue()).where((e) { + var t = e?.type; + if (t == null) { + return false; + } + if (t.getDisplayString(withNullability: false) != toTypeName) { + return false; + } + var element = t.element; + if (element is! ClassElement) { + return false; + } + // result?.type?.element?.library?.children + var publicExportFrom = findPublicExportLib(element, layoutLib); + return publicExportFrom?.identifier == toTypeDefault.type.url; + }).firstOrNull; + if (findToTypeAnno == null) { + return (layout: layoutFunction, toType: null); + } + var type = findToTypeAnno.getField("type")?.toTypeValue(); + if (type == null) { + return (layout: layoutFunction, toType: toTypeDefault); + } + + var symbol = type.getDisplayString(withNullability: false); + + if (symbol == "") { + return (layout: layoutFunction, toType: toTypeDefault); + } + + var publicExportFrom = findPublicExportLib(type.element! as TypeDefiningElement, layoutLib); + var url = publicExportFrom?.identifier; + + return (layout: layoutFunction, toType: refer(symbol, url)); + } + + Future analysisPage(File file) async { + if (!await file.exists()) { + return null; + } + var lib = (await analysisSession.getResolvedLibrary(path.normalize(path.absolute(file.path))) as ResolvedLibraryResult).element; + return lib.definingCompilationUnit.functions.where((e) => e.name == pageBuildFunctionName).firstOrNull; + } +} + +class RouteNode { + final YouCli cli; + final List children; + final Directory dir; + final Reference? toType; + final FunctionElement? layoutFunction; + final FunctionElement? pageBuild; + late RouteNode _parent = this; + + RouteNode({required this.dir, this.toType, required this.children, this.layoutFunction, this.pageBuild, required this.cli}) { + for (var child in children) { + child._parent = this; + } + } + + int get level => isRoot ? 0 : _parent.level + 1; + + RouteNode get root => isRoot ? this : _parent.root; + + bool get isRoot => _parent == this; + + File get file_page_dart => dir.childFile("page.dart"); + + File get file_layout_dart => dir.childFile("layout.dart"); + + String get routePath { + if (isRoot) { + return "/"; + } + 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 { + String p = routePath; + if (p == "/") { + return "root"; + } + var names = p.split(path.separator).where((e) => e.isNotEmpty); + return names + .map((e) => e + // ignore: unnecessary_string_escapes + .replaceAll(RegExp("^\\d+\."), "") // 1.z.about -> note_note-self + .replaceAll(".", "_") + .replaceAll("-", "_") + .replaceAll("&", "_") + .replaceAll("*", "_") + .replaceAll("*", "_") + .replaceAll("@", "_")) + .join("_"); + } + + List toList({ + bool includeThis = true, + bool Function(RouteNode path)? where, + Comparator? sortBy, + }) { + where = where ?? (e) => true; + if (!where(this)) { + return []; + } + List sorted = List.from(children); + if (sortBy != null) { + sorted.sort(sortBy); + } + var flatChildren = sorted.expand((child) { + return child.toList(includeThis: true, where: where, sortBy: sortBy); + }).toList(); + return includeThis ? [this, ...flatChildren] : flatChildren; + } + + @override + String toString() { + return dir.toString(); + } + + RouteNode? findLayoutSync() { + if (file_layout_dart.existsSync()) { + return this; + } + if (isRoot) { + return null; + } + return _parent.findLayoutSync(); + } + + Reference findToType() { + if (toType != null) { + return toType!; + } + if (isRoot) { + return YouCli.toTypeDefault; + } + return _parent.findToType(); + } +} diff --git a/packages/you_cli/lib/src/code_analyzer.dart b/packages/you_cli/lib/src/code_analyzer.dart new file mode 100644 index 00000000..58eb883c --- /dev/null +++ b/packages/you_cli/lib/src/code_analyzer.dart @@ -0,0 +1,31 @@ +import 'package:analyzer/dart/analysis/analysis_context_collection.dart'; +import 'package:analyzer/dart/analysis/results.dart'; +import 'package:analyzer/dart/analysis/session.dart'; +import 'package:analyzer/file_system/physical_file_system.dart'; +import 'package:path/path.dart' as path_; + +class CodeAnalyzer { + final _resourceProvider = PhysicalResourceProvider(); + late final AnalysisSession session; + + CodeAnalyzer() { + var collection = AnalysisContextCollection( + includedPaths: [""], + resourceProvider: _resourceProvider, + ); + session = collection.contexts[0].currentSession; + } + + Future getResolvedLibrary({required String path, required String content}) async { + return session.getResolvedLibrary(path) as ResolvedLibraryResult; + } + + SomeParsedUnitResult getParsedUnit({required String path, required String content}) { + return session.getParsedUnit(path_.absolute(path)); + } + + Future getResolvedUnit({required String path, required String content}) { + return session.getResolvedUnit(path_.absolute(path)); + } + +} diff --git a/packages/you_cli/lib/src/code_builder_ext.dart b/packages/you_cli/lib/src/code_builder_ext.dart new file mode 100644 index 00000000..3382f4dd --- /dev/null +++ b/packages/you_cli/lib/src/code_builder_ext.dart @@ -0,0 +1,321 @@ + +import 'package:code_builder/code_builder.dart'; +import 'package:path/path.dart' as path; +import 'package:you_cli/src/urils.dart'; + +/// 自定义Allocator: 更清晰干净的前缀 +class CleanPrefixedAllocator implements Allocator { + final _importWithSymbols = >{}; + final _importsUrlAndAs = {}; + final _asKeys = {}; + + @override + String allocate(Reference reference) { + String symbol = reference.symbol!; + String? url = reference.url; + + if (url == null) { + return symbol; + } + + Set? symbols = _importWithSymbols[url]; + + if (symbols == null) { + // init + _importWithSymbols[url] = symbols = {}; + } + + for (var MapEntry(key: otherUrl, value: symbols) in _importWithSymbols.entries) { + if (otherUrl == url) { + continue; + } + if (symbols.contains(symbol)) { + // 冲突 + String as = _importsUrlAndAs.putIfAbsent(url, () { + Uri uri = Uri.parse(url); + String filename = path.basename(uri.path).replaceFirst(".dart", ""); + var dirname=path.basename(path.dirname(uri.path)); + var as = paths.pathPartToVar("_${dirname}_$filename"); + int times = _asKeys.putIfAbsent(as, ()=>0); + if(times==0){ + _asKeys[as]=++times; + return as; + }else{ + _asKeys[as]=++times; + return "$as$times"; + } + })!; + return "$as.$symbol"; + } + } + + // 未发现冲突 + symbols.add(symbol); + _importsUrlAndAs.putIfAbsent(url, () => null); + return symbol; + } + + @override + Iterable get imports => _importsUrlAndAs.keys.map( + (u) => Directive.import(u, as: _importsUrlAndAs[u]), + ); +} + +/// copy from code_builder source code +/// 【you_cli】update code: +/// - visitInvokeExpression : only remove last arguments: ',' +/// - visitClass : only remove field newline ',' +/// - visitMixin : only remove field newline ',' +/// - visitLiteralListExpression: only add ',' at last +class DartEmitterForCli extends DartEmitter { + bool _withInConstExpression = false; + + DartEmitterForCli({super.allocator, super.orderDirectives, super.useNullSafetySyntax}); + + @override + StringSink visitInvokeExpression(InvokeExpression expression, [StringSink? output]) { + final out = output ??= StringBuffer(); + return _writeConstExpression(out, expression.isConst, () { + expression.target.accept(this, out); + if (expression.name != null) { + out + ..write('.') + ..write(expression.name); + } + if (expression.typeArguments.isNotEmpty) { + out.write('<'); + visitAll(expression.typeArguments, out, (type) { + type.accept(this, out); + }); + out.write('>'); + } + out.write('('); + visitAll(expression.positionalArguments, out, (spec) { + spec.accept(this, out); + }); + if (expression.positionalArguments.isNotEmpty && expression.namedArguments.isNotEmpty) { + out.write(', '); + } + visitAll(expression.namedArguments.keys, out, (name) { + out + ..write(name) + ..write(': '); + expression.namedArguments[name]!.accept(this, out); + }); + final argumentCount = expression.positionalArguments.length + expression.namedArguments.length; + if (argumentCount > 1) { + // ***【you_cli】: only change this code:*** + // out.write(', '); + } + return out..write(')'); + }); + } + + @override + StringSink visitLiteralListExpression( + LiteralListExpression expression, [ + StringSink? output, + ]) { + final out = output ??= StringBuffer(); + + return _writeConstExpression(output, expression.isConst, () { + if (expression.type != null) { + out.write('<'); + expression.type!.accept(this, output); + out.write('>'); + } + out.write('['); + visitAll(expression.values, out, (value) { + _acceptLiteral(value, out); + }); + // ***【you_cli】: only change this code:*** + // old: if (expression.values.length > 1) { + /*new*/ if (expression.values.isNotEmpty) { + out.write(', '); + } + return out..write(']'); + }); + } + void _acceptLiteral(Object? literalOrSpec, StringSink output) { + if (literalOrSpec is Spec) { + literalOrSpec.accept(this, output); + return; + } + literal(literalOrSpec).accept(this, output); + } + + @override + StringSink visitClass(Class spec, [StringSink? output]) { + final out = output ??= StringBuffer(); + spec.docs.forEach(out.writeln); + for (var a in spec.annotations) { + visitAnnotation(a, out); + } + + void writeModifier() { + if (spec.modifier != null) { + out.write('${spec.modifier!.name} '); + } + } + + if (spec.sealed) { + out.write('sealed '); + } else { + if (spec.abstract) { + out.write('abstract '); + } + writeModifier(); + if (spec.mixin) { + out.write('mixin '); + } + } + out.write('class ${spec.name}'); + visitTypeParameters(spec.types.map((r) => r.type), out); + if (spec.extend != null) { + out.write(' extends '); + spec.extend!.type.accept(this, out); + } + if (spec.mixins.isNotEmpty) { + out + ..write(' with ') + ..writeAll(spec.mixins.map((m) => m.type.accept(this)), ','); + } + if (spec.implements.isNotEmpty) { + out + ..write(' implements ') + ..writeAll(spec.implements.map((m) => m.type.accept(this)), ','); + } + out.write(' {'); + for (var c in spec.constructors) { + visitConstructor(c, spec.name, out); + out.writeln(); + } + for (var f in spec.fields) { + visitField(f, out); + // ***【you_cli】: only change this code:*** + // out.writeln(); + } + for (var m in spec.methods) { + visitMethod(m, out); + if (_isLambdaMethod(m)) { + out.writeln(';'); + } + out.writeln(); + } + out.writeln(' }'); + return out; + } + + @override + StringSink visitMixin(Mixin spec, [StringSink? output]) { + final out = output ??= StringBuffer(); + spec.docs.forEach(out.writeln); + for (var a in spec.annotations) { + visitAnnotation(a, out); + } + + if (spec.base) { + out.write('base '); + } + out.write('mixin ${spec.name}'); + visitTypeParameters(spec.types.map((r) => r.type), out); + if (spec.on != null) { + out.write(' on '); + spec.on!.type.accept(this, out); + } + if (spec.implements.isNotEmpty) { + out + ..write(' implements ') + ..writeAll(spec.implements.map((m) => m.type.accept(this)), ','); + } + out.write(' {'); + for (var f in spec.fields) { + visitField(f, out); + // ***【you_cli】: only change this code:*** + // out.writeln(); + } + for (var m in spec.methods) { + visitMethod(m, out); + if (_isLambdaMethod(m)) { + out.write(';'); + } + out.writeln(); + } + out.write(' }'); + return out; + } + + static bool _isLambdaBody(Code? code) => code is ToCodeExpression && !code.isStatement; + + /// Whether the provided [method] is considered a lambda method. + static bool _isLambdaMethod(Method method) => method.lambda ?? _isLambdaBody(method.body); + + /// Executes [visit] within a context which may alter the output if [isConst] + /// is `true`. + /// + /// This allows constant expressions to omit the `const` keyword if they + /// are already within a constant expression. + @override + void startConstCode( + bool isConst, + Null Function() visit, + ) { + final previousConstContext = _withInConstExpression; + if (isConst) { + _withInConstExpression = true; + } + + visit(); + _withInConstExpression = previousConstContext; + } + + /// Similar to [startConstCode], but handles writing `"const "` if [isConst] + /// is `true` and the invocation is not nested under other invocations where + /// [isConst] is true. + StringSink _writeConstExpression( + StringSink sink, + bool isConst, + StringSink Function() visitExpression, + ) { + final previousConstContext = _withInConstExpression; + if (isConst) { + if (!_withInConstExpression) { + sink.write('const '); + } + _withInConstExpression = true; + } + + final returnedSink = visitExpression(); + assert(identical(returnedSink, sink)); + _withInConstExpression = previousConstContext; + return sink; + } +} + + +/// Helper method improving on [StringSink.writeAll]. +/// +/// For every `Spec` in [elements], executing [visit]. +/// +/// If [elements] is at least 2 elements, inserts [separator] delimiting them. +StringSink visitAll( + Iterable elements, + StringSink output, + void Function(T) visit, [ + String separator = ', ', + ]) { + // Basically, this whole method is an improvement on + // output.writeAll(specs.map((s) => s.accept(visitor)); + // + // ... which would allocate more StringBuffer(s) for a one-time use. + if (elements.isEmpty) { + return output; + } + final iterator = elements.iterator..moveNext(); + visit(iterator.current); + while (iterator.moveNext()) { + output.write(separator); + visit(iterator.current); + } + return output; +} diff --git a/packages/you_cli/lib/src/urils.dart b/packages/you_cli/lib/src/urils.dart new file mode 100644 index 00000000..988fbddb --- /dev/null +++ b/packages/you_cli/lib/src/urils.dart @@ -0,0 +1,15 @@ + +Paths paths=Paths(); +class Paths{ + String pathPartToVar(String pathPart){ + return pathPart + // ignore: unnecessary_string_escapes + .replaceAll(RegExp("^\\d+\."), "") // 1.z.about -> note_note-self + .replaceAll(".", "_") + .replaceAll("-", "_") + .replaceAll("&", "_") + .replaceAll("*", "_") + .replaceAll("*", "_") + .replaceAll("@", "_"); + } +} \ No newline at end of file diff --git a/packages/you_cli/lib/src/yaml.dart b/packages/you_cli/lib/src/yaml.dart new file mode 100644 index 00000000..df74f634 --- /dev/null +++ b/packages/you_cli/lib/src/yaml.dart @@ -0,0 +1,106 @@ +import 'package:collection/collection.dart'; +import 'package:file/file.dart'; +import 'package:yaml/yaml.dart'; +import 'package:yaml_edit/yaml_edit.dart'; + +class Pubspec { + final YamlMap document; + + Pubspec._(this.document); + + static Future parseFile(File file) async { + String content = await file.readAsString(); + return parseString(content); + } + + static Pubspec parseFileSync(File file) { + String content = file.readAsStringSync(); + return parseString(content); + } + + static Pubspec parseString(String content) { + YamlMap document = loadYaml(content); + return Pubspec._(document); + } + + String get name => document["name"] as String; +} + +class PubspecEdit { + static const _yamlPathAssets = ["flutter", "assets"]; + late final YamlEditor _yamlEditor; + late List _assetsCache; + + File file; + + static Future parseFile(File file) async { + String content = await file.readAsString(); + return PubspecEdit._(file, content); + } + + static PubspecEdit parseFileSync(File file) { + String content = file.readAsStringSync(); + return PubspecEdit._(file, content); + } + + PubspecEdit._(this.file, String content) { + _yamlEditor = YamlEditor(content); + _assetsCache = assets; + } + + List get assets { + return (_yamlEditor.parseAt(_yamlPathAssets) as List).map((e) => "$e").toList(); + } + + void removeAsset(String noteAsset) { + _yamlEditor.remove([..._yamlPathAssets, assets.indexOf(noteAsset)]); + } + + void addAsset(String noteAsset) { + if (assets.contains(noteAsset)) return; + _yamlEditor.appendToList([..._yamlPathAssets], noteAsset); + } + + /// 1. remove previously Generated + /// 2. add new + void updateAssets({required String toUpdatePath, required List toUpdate}) { + List toAdd = List.from(toUpdate, growable: true); + + var oldAssets = assets; + var removed = 0; + for (int i = 0; i < oldAssets.length; i++) { + var oldAsset = oldAssets[i]; + // manual config, leave it + // lib/routes is our Generated + if (!oldAsset.startsWith(toUpdatePath)) { + continue; + } + // our Generated, no change , no need to repeat add + if (toAdd.contains(oldAsset)) { + toAdd.remove(oldAsset); + continue; + } + + // prefix lib/routes is previously Generated ,and now not exists + _yamlEditor.remove([..._yamlPathAssets, i - removed]); + removed++; + } + for (var add in toAdd) { + _yamlEditor.appendToList(_yamlPathAssets, add); + } + } + + Future save() async { + const ListEquality listEquality = ListEquality(); + // no change , no need to save + if (listEquality.equals(_assetsCache, assets)) { + return Future.value(file); + } + return file.writeAsString(_yamlEditor.toString()); + } + + @override + String toString() { + return _yamlEditor.toString(); + } +} diff --git a/pubspec.yaml b/packages/you_cli/pubspec.yaml similarity index 85% rename from pubspec.yaml rename to packages/you_cli/pubspec.yaml index b994ecc8..fcc106be 100644 --- a/pubspec.yaml +++ b/packages/you_cli/pubspec.yaml @@ -1,6 +1,6 @@ -name: note -description: you-* project include some flutter common lib ,and my study notes. -version: 0.0.4 +name: you_cli +description: you-* project include some flutter common lib ,and study notes. +version: 0.0.6-dev.1 homepage: https://github.com/chen56/you publish_to: 'none' # Remove this line if you wish to publish to pub.dev @@ -21,10 +21,14 @@ dependencies: glob: ^2.1.1 watcher: ^1.1.0 yaml_edit: ^2.2.0 + yaml: ^3.1.2 + checks: ^0.3.0 + + # you_* you_note_dart: ^0.0.4 you_dart: ^0.0.4 + dev_dependencies: - lints: ^3.0.0 test: @@ -34,6 +38,6 @@ dependency_overrides: # Dependency overrides only take effect in the root package of a resolution. # - ref: https://github.com/dart-lang/sdk/blob/main/CHANGELOG.md you_dart: - path: packages/you_dart + path: ../you_dart you_note_dart: - path: packages/you_note_dart + path: ../you_note_dart diff --git a/packages/you_cli/test/bin/cli_commands_test.dart b/packages/you_cli/test/bin/cli_commands_test.dart new file mode 100644 index 00000000..9bc1a268 --- /dev/null +++ b/packages/you_cli/test/bin/cli_commands_test.dart @@ -0,0 +1,73 @@ +import 'package:checks/checks.dart'; +import 'package:code_builder/code_builder.dart'; +import 'package:file/memory.dart'; +import 'package:test/test.dart'; +import 'package:you_cli/src/cli_core.dart'; + +import '../../bin/cli.dart'; + +void main() { + late MemoryFileSystem fs; + late YouCli cli; + + setUp(() { + fs = MemoryFileSystem(); + cli = YouCli(projectDir: fs.directory("/app")); + + // YouCli需要 + fs.file("/app/pubspec.yaml") + ..createSync(recursive: true) + ..writeAsString("""name: app"""); + }); + group("Cmd_gen_routes_g_dart", () { + Future checkBuilder(String? expected, {required bool async}) async { + Cmd_gen_routes_g_dart cmd = Cmd_gen_routes_g_dart.libMode(fs: fs, async: async, dir: fs.directory("/app/lib/routes")); + var result = cmd.builderExpression(await cli.rootRoute); + if (expected == null) { + check(result).isNull(); + } else { + check(cmd.builderExpression(await cli.rootRoute)!.accept(DartEmitter()).toString().split("\n").join()).equals(expected); + } + } + + test('builderExpression: no page + no layout', () { + checkBuilder(async: false, null); + checkBuilder(async: true, null); + }); + + test('builderExpression: page + no layout', () { + fs.file("/app/lib/routes/page.dart").createSync(recursive: true); + + checkBuilder(async: false, "root_.build"); + checkBuilder(async: true, "() async { await root_.loadLibrary();return root_.build; } "); + }); + + test('builderExpression: page + layout', () { + fs.file("/app/lib/routes/page.dart").createSync(recursive: true); + fs.file("/app/lib/routes/layout.dart").createSync(recursive: true); + + checkBuilder(async: false, "root__.layout(root_.build)"); + checkBuilder(async: true, "() async { await root_.loadLibrary(); await root__.loadLibrary();return root__.layout(root_.build); } "); + }); + }); +} + +Expression genRouteExpression(RouteNode rootPage) { + final $To = refer('To', 'package:you_flutter/router.dart'); + return $To.newInstance([ + literalString(rootPage.dir.basename) + ], { + "builderAsync": refer(rootPage.flatName).property('build'), + // "children": literalList(rootPage.children.map((e)=>createRoutes(e))), + "children": literalList(rootPage.children.map((e) => genRouteExpression(e)).toList()), + }); +} + +String genRouteString(RouteNode rootPage) { + if (rootPage.children.isEmpty) { + return '''To("${rootPage.dir.basename}", builderAsync: ${rootPage.flatName}.build)'''; + } + return '''To("${rootPage.dir.basename}", builderAsync: ${rootPage.flatName}.build, children:[ +${rootPage.children.map((e) => genRouteString(e)).join(",")} +])'''; +} diff --git a/packages/you_cli/test/bin/cli_core_test.dart b/packages/you_cli/test/bin/cli_core_test.dart new file mode 100644 index 00000000..6c071729 --- /dev/null +++ b/packages/you_cli/test/bin/cli_core_test.dart @@ -0,0 +1,59 @@ +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", () { + test('create from directory', () async { + late MemoryFileSystem fs = MemoryFileSystem(); + fs.directory("/note/lib/routes/notes/page_1").createSync(recursive: true); + fs.directory("/note/lib/routes/notes/page_1/page_1_1").createSync(recursive: true); + fs.directory("/note/lib/routes/notes/page_1/page_1_2").createSync(recursive: true); + + YouCli cli = YouCli(projectDir: fs.directory("/note")); + var rootRoute = await cli.rootRoute; + check(rootRoute.toList().map((e) => e.routePath)).deepEquals([ + "/", + "/notes", + "/notes/page_1", + "/notes/page_1/page_1_1", + "/notes/page_1/page_1_2", + ]); + }); + }); + 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).equals(refer("ToNote","package:you_note_dart/note.dart")); + }); + }); + + +} diff --git a/packages/you_cli/test/bin/pubspec_edit_test.dart b/packages/you_cli/test/bin/pubspec_edit_test.dart new file mode 100644 index 00000000..a6a41d2e --- /dev/null +++ b/packages/you_cli/test/bin/pubspec_edit_test.dart @@ -0,0 +1,56 @@ +import 'package:file/file.dart'; +import 'package:file/memory.dart'; +import 'package:test/test.dart'; +import 'package:you_cli/src/yaml.dart'; + + +void main() { + late MemoryFileSystem fs; + File createMemoryPubspecFile(String content) { + var file = fs.file("/note/pubspec.yaml"); + file.parent.createSync(recursive: true); + file.writeAsStringSync(content); + return file; + } + + group("Pubspec.putNoteAssets", () { + setUp(() { + fs = MemoryFileSystem(); + print("setup"); //TODO remove + }); + + test('add', () async { + File file = createMemoryPubspecFile(""" +flutter: + assets: + - assets/manual1 # manual config, keep it +"""); + PubspecEdit pubspec = PubspecEdit.parseFileSync(file); + expect(pubspec.assets, ["assets/manual1"]); + + // when + pubspec.updateAssets(toUpdatePath: "lib/routes/notes/", toUpdate: ["lib/routes/notes/new/"]); + + // then + expect(pubspec.assets, ['assets/manual1', 'lib/routes/notes/new/']); + }); + + test('remove not exists', () async { + File file = createMemoryPubspecFile(""" +flutter: + assets: + - assets/manual1 # manual config, keep it + - lib/routes/notes/rm/ # to remove +"""); + PubspecEdit pubspec = PubspecEdit.parseFileSync(file); + var old = pubspec.assets; + expect(old, ["assets/manual1" ,"lib/routes/notes/rm/"]); + + // when + pubspec.updateAssets(toUpdatePath: "lib/routes/notes/", toUpdate: ["lib/routes/notes/new/"]); + + // then + expect(pubspec.assets, ['assets/manual1', 'lib/routes/notes/new/']); + }); + }); +} diff --git a/packages/you_dart/analysis_options.yaml b/packages/you_dart/analysis_options.yaml index dee8927a..e42b0e40 100644 --- a/packages/you_dart/analysis_options.yaml +++ b/packages/you_dart/analysis_options.yaml @@ -12,12 +12,11 @@ # The core lints are also what is used by pub.dev for scoring packages. include: package:lints/recommended.yaml - # Uncomment the following section to specify additional rules. -# linter: -# rules: -# - camel_case_types +linter: + rules: + - lines_longer_than_80_chars: false # analyzer: # exclude: diff --git a/packages/you_dart/pubspec.yaml b/packages/you_dart/pubspec.yaml index 10e31763..77b012ba 100644 --- a/packages/you_dart/pubspec.yaml +++ b/packages/you_dart/pubspec.yaml @@ -1,6 +1,6 @@ name: you_dart description: "dart lib, for data basic tools such as json、yaml serialization ." -version: 0.0.4 +version: 0.0.6-dev.1 homepage: https://github.com/chen56/you repository: https://github.com/chen56/you @@ -11,15 +11,10 @@ environment: dependencies: flutter: sdk: flutter - path: ^1.8.3 - file: ^7.0.0 - collection: ^1.18.0 meta: ^1.11.0 - intl: - args: ^2.4.2 + collection: ^1.18.0 dev_dependencies: - lints: ^3.0.0 test: ^1.24.0 flutter_test: sdk: flutter diff --git a/packages/you_flutter/lib/better_ui.dart b/packages/you_flutter/lib/better_ui.dart new file mode 100644 index 00000000..d84c71c6 --- /dev/null +++ b/packages/you_flutter/lib/better_ui.dart @@ -0,0 +1,3 @@ +library you_better_ui; + +export 'package:you_flutter/src/better_ui.dart' ; \ No newline at end of file diff --git a/packages/you_flutter/lib/router.dart b/packages/you_flutter/lib/router.dart new file mode 100644 index 00000000..0e9a02db --- /dev/null +++ b/packages/you_flutter/lib/router.dart @@ -0,0 +1,4 @@ +library you_router; + +export 'package:you_flutter/src/router.dart' show YouRouter,To,ToUri,PageBuilder,LazyPageBuilder,PageLayoutBuilder; +export 'package:you_flutter/src/router_core.dart' show ToType; diff --git a/packages/you_flutter/lib/src/better_ui.dart b/packages/you_flutter/lib/src/better_ui.dart new file mode 100644 index 00000000..55b2ad99 --- /dev/null +++ b/packages/you_flutter/lib/src/better_ui.dart @@ -0,0 +1,413 @@ +import 'package:flutter/foundation.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/rendering.dart'; + +typedef _WidgetWarp = Widget Function(Widget child); + +bool _isDebug = kDebugMode && true; + +/* + * 更好的flutter ui编程实践,代码尽力做到美观: + * - 代码缩进只应体现组件的父子关系,属性会干扰层级视觉,需要独立开尽量不换行,最少也要隔离开。 + * - 扁平化不必要的组件层级,比如Padding、Decoration、Aglin等只是外观属性,不用一层包一层。 + * */ + +/// 用 Style(padding:...,center:...)的形式构造时,包裹Padding、Center等组件的顺序时固定的,写在[BetterUI]构造器初始化块里 +/// 如果想自定义包裹顺序应该:Style().center(...).padding(...).styled(child) +/// => Center +/// Padding +/// child +/// c +/// +BetterUI betterUI = BetterUI._([]); + +final class BetterUI { + final List<_WidgetWarp> _warps; + + BetterUI._(this._warps); + + BetterUI _wrap(_WidgetWarp newWarp) { + return BetterUI._([..._warps, newWarp]); + } + + Widget child(Widget child) { + Widget result = child; + for (var warp in _warps) { + result = warp(result); + } + return result; + } + + BetterUI expanded({int flex = 1}) { + return _wrap((child) => Expanded(flex: flex, child: child)); + } + + BetterUI padding(EdgeInsetsGeometry padding) { + return _wrap((child) => Padding(padding: padding, child: child)); + } + + BetterUI paddingAll(double value) { + return _wrap((child) => Padding(padding: EdgeInsets.all(value), child: child)); + } + + BetterUI paddingOnly({ + double left = 0.0, + double top = 0.0, + double right = 0.0, + double bottom = 0.0, + }) { + return _wrap((child) => Padding( + padding: EdgeInsets.only(left: left, top: top, right: right, bottom: bottom), + child: child, + )); + } + + BetterUI paddingSymmetric({double vertical = 0.0, double horizontal = 0.0}) { + return _wrap((child) => Padding( + padding: EdgeInsets.symmetric(vertical: vertical, horizontal: horizontal), + child: child, + )); + } + + BetterUI center({double? widthFactor, double? heightFactor}) { + return _wrap((child) => Center( + widthFactor: widthFactor, + heightFactor: heightFactor, + child: child, + )); + } + + /// [LimitedBox] + /// [maxWidth] The maximum width limit to apply in the absence of a + /// [BoxConstraints.maxWidth] constraint. + /// [maxHeight] The maximum height limit to apply in the absence of a + /// [BoxConstraints.maxHeight] constraint. + BetterUI limit({double maxWidth = double.infinity, double maxHeight = double.infinity}) { + return _wrap((child) => LimitedBox( + maxWidth: maxWidth, + maxHeight: maxHeight, + child: child, + )); + } +} + +extension StyleExtension on Widget { + /// Warp a [Padding] + Widget padding$(EdgeInsetsGeometry padding) => Padding(padding: padding, child: this); + + /// Warp a [Padding] + Widget paddingAll$(double value) { + return Padding(padding: EdgeInsets.all(value), child: this); + } + + /// Warp a [Padding] + Widget paddingOnly$({ + double left = 0.0, + double top = 0.0, + double right = 0.0, + double bottom = 0.0, + }) { + return Padding( + padding: EdgeInsets.only(left: left, top: top, right: right, bottom: bottom), + child: this, + ); + } + + /// Warp a [Padding] + Widget paddingSymmetric$({double vertical = 0.0, double horizontal = 0.0}) { + return Padding( + padding: EdgeInsets.symmetric(vertical: vertical, horizontal: horizontal), + child: this, + ); + } + + /// Warp a [Expanded] + Widget expanded$({int flex = 1}) => Expanded(flex: flex, child: this); + + /// Warp a [Flexible] + /// [flex]Default to 1 + /// [fit]Default to FlexFit.loose + Widget flexible$({int flex = 1, FlexFit fit = FlexFit.loose}) { + return Flexible(flex: flex, fit: fit, child: this); + } + + Widget clipRect$({Clip clipBehavior = Clip.hardEdge}) { + return ClipRect(clipBehavior: clipBehavior, child: this); + } + + /// Warp a [Center] + Widget center$({double? widthFactor, double? heightFactor}) { + return Center(widthFactor: widthFactor, heightFactor: heightFactor, child: this); + } + + /// Warp a [LimitedBox] + /// [maxWidth] The maximum width limit to apply in the absence of a + /// [BoxConstraints.maxWidth] constraint. + /// [maxHeight] The maximum height limit to apply in the absence of a + /// [BoxConstraints.maxHeight] constraint. + Widget limitedBox$({double maxWidth = double.infinity, double maxHeight = double.infinity}) { + return LimitedBox( + maxWidth: maxWidth, + maxHeight: maxHeight, + child: this, + ); + } + + Widget constrainedBox$({required BoxConstraints constraints}) { + return ConstrainedBox( + constraints: constraints, + child: this, + ); + } + Widget intrinsicWidth$({double? stepWidth, double? stepHeight}) { + return IntrinsicWidth( + stepWidth: stepWidth, + stepHeight: stepHeight, + child: this, + ); + } + + /// [width]If non-null, requires the child to have exactly this width. + /// [height]If non-null, requires the child to have exactly this height. + Widget sizedBox$({double? width, double? height}) { + return SizedBox( + width: width, + height: height, + child: this, + ); + } + + Widget sizedBoxExpand$() { + return SizedBox.expand( + child: this, + ); + } + + Widget sizedBoxShrink$() { + return SizedBox.shrink( + child: this, + ); + } + + Widget sizedBoxSquare$({double? dimension}) { + return SizedBox.square( + dimension: dimension, + child: this, + ); + } + + /// Warp a [FittedBox] + /// [fit]How to inscribe the child into the space allocated during layout. + /// [alignment]Defaults to [Alignment.center]. + /// [clipBehavior]Defaults to [Clip.none]. + Widget fittedBox$({BoxFit fit = BoxFit.contain, AlignmentGeometry alignment = Alignment.center, Clip clipBehavior = Clip.none}) { + return FittedBox( + fit: fit, + alignment: alignment, + clipBehavior: clipBehavior, + child: this, + ); + } + + + /// [minWidth]The minimum width constraint to give the child. Set this to null (the + /// default) to use the constraint from the parent instead. + /// [maxWidth]The maximum width constraint to give the child. Set this to null (the + /// default) to use the constraint from the parent instead. + /// [minHeight]The minimum height constraint to give the child. Set this to null (the + /// default) to use the constraint from the parent instead. + /// [maxHeight]The maximum height constraint to give the child. Set this to null (the + /// default) to use the constraint from the parent instead. + Widget overflowBox$({ AlignmentGeometry alignment = Alignment.center,double? minWidth,double? maxWidth, double? minHeight,double? maxHeight,OverflowBoxFit fit = OverflowBoxFit.max}) { + return OverflowBox( + fit: fit, + alignment: alignment, + child: this, + ); + } + + /// Warp a [Align] + Widget align$({Alignment alignment = Alignment.center, double? widthFactor, double? heightFactor}) { + return Align(alignment: alignment, widthFactor: widthFactor, heightFactor: heightFactor, child: this); + } + + /// Warp a [Align] + Widget singleChildScrollView$({Axis scrollDirection = Axis.vertical}) { + return SingleChildScrollView(scrollDirection: scrollDirection, child: this); + } + + /// Warp a [DecoratedBox], and add border + Widget borderAll$({ + Color color = const Color(0xFF000000), + double width = 1.0, + BorderStyle style = BorderStyle.solid, + double strokeAlign = BorderSide.strokeAlignInside, + double radius = 0, + }) { + return DecoratedBox( + position: DecorationPosition.foreground, + decoration: BoxDecoration( + border: Border.all(color: color, width: width, style: style, strokeAlign: strokeAlign), + borderRadius: BorderRadius.all(Radius.circular(radius)), + ), + child: this, + ); + } + + /// if(kDebugMode) Warp a [LayoutBuilder], and print constraints info + Widget debugLayoutBuilder$() { + if (!_isDebug) { + return this; + } + + return LayoutBuilder(builder: (context, constraints) { + debugPrint("\$debugLayoutBuilder: this:$runtimeType, constraints:$constraints, this:$this"); + return this; + }); + } + + /// if(kDebugMode) add border and padding, show what is looks like. + Widget debugBorder$({double paddingAll = 6}) { + if (!_isDebug) { + return this; + } + return DecoratedBox( + decoration: const BoxDecoration( + border: Border( + // 上下左右四个边框 + top: BorderSide(color: Colors.black, width: 1.0), + right: BorderSide(color: Colors.black, width: 1.0), + bottom: BorderSide(color: Colors.black, width: 1.0), + left: BorderSide(color: Colors.black, width: 1.0), + // 如果需要圆角边框 + // borderRadius: BorderRadius.circular(8.0), + ), + ), + child: this, + ).paddingAll$(paddingAll); + } +} + +/// 小屏手机优先的响应式设计 +/// +/// material3 +/// https://m3.material.io/foundations/layout/applying-layout/window-size-classes +/// Compact Width < 600 Phone in portrait +/// Medium 600 ≤ width < 840 Tablet in portrait Foldable in portrait (unfolded) +/// Expanded 840 ≤ width < 1200* Phone in landscape, Tablet in landscape , Foldable in landscape (unfolded) Desktop Large +/// 1200 ≤ width < 1600 Desktop +/// Extra-large 1600 ≤ width Desktop Ultra-wide +/// +/// tailwindcss: +/// https://www.tailwindcss.cn/docs/responsive-design#targeting-a-breakpoint-range +/// sm 640px @media (min-width: 640px) { ... } +/// md 768px @media (min-width: 768px) { ... } +/// lg 1024px @media (min-width: 1024px) { ... } +/// xl 1280px @media (min-width: 1280px) { ... } +/// 2xl 1536px @media (min-÷÷width: 1536px) { ... } +/// 命名模仿tailwindcss命名习惯 +enum ScreenSize { + /// 即缺省档, mobile优先设计 + min(minWidth: 0), + sm(minWidth: 640), + md(minWidth: 768), + lg(minWidth: 1024), + xl(minWidth: 1280), + xxl(minWidth: 1536); + + const ScreenSize({required this.minWidth}); + + final double minWidth; + + static ScreenSize byName(String name) { + return ScreenSize.values.firstWhere((e) => e.name == name); + } + + /// 计算当前屏幕宽度卡在哪一档,比如 + /// - 如果screen==639, 卡在min档,因为 0<=screen<640 + /// - 如果screen==640或767 , 卡在sm档, 因为640<=screen<768 + /// - 如果screen==768或1023, 卡在md档,因为768<=screen<1024 + /// - 如果screen==1024或1279, 卡在lg档,因为1024<=screen<1280 + /// - 如果screen==1280或1535, 卡在lx档,因为1280<=screen<1536 + /// - 如果screen==1536及以上, 卡在xxl档,因为1536<=screen= breakpoint.minWidth) { + current = breakpoint; + continue; + } + return current; + } + return ScreenSize.xxl; + } + + static T best(BuildContext context, {required T min, T? sm, T? md, T? lg, T? xl, T? xxl}) { + return bestWithWidth(MediaQuery.of(context).size.width, min: min, sm: sm, md: md, lg: lg, xl: xl, xxl: xxl); + } + + /// 为一个宽度的屏幕选择其相应的样式,概念和tailwindcss相似 + /// 屏幕宽度落在哪档的计算参考[byScreen] + static T bestWithWidth(double screenWidth, {required T min, T? sm, T? md, T? lg, T? xl, T? xxl}) { + ScreenSize now = byScreen(screenWidth); + List<(ScreenSize, T?)> options = [ + (ScreenSize.xxl, xxl), + (ScreenSize.xl, xl), + (ScreenSize.lg, lg), + (ScreenSize.md, md), + (ScreenSize.sm, sm), + ]; + for (var (breakpoint, option) in options) { + // 未提供某档专用样式的忽略 + if (option == null) { + continue; + } + // 专用样式落在此档 + if (breakpoint.minWidth <= now.minWidth) { + return option; + } + } + return min; + } +} + +/// ref: +/// - +/// - +/// - +final class DesignTokens { + BuildContext context; + ColorScheme colors; + + DesignTokens(this.context) : colors = Theme.of(context).colorScheme; + + ButtonStyle get elevatedButtonPrimary => ElevatedButton.styleFrom(backgroundColor: colors.primaryContainer, foregroundColor: colors.primary); + + ButtonStyle get elevatedButtonSecondary => ElevatedButton.styleFrom(backgroundColor: colors.secondaryContainer, foregroundColor: colors.secondary); + + ButtonStyle get elevatedButtonTertiary => ElevatedButton.styleFrom(backgroundColor: colors.tertiaryContainer, foregroundColor: colors.tertiary); + + TextStyle get textPrimary => TextStyle(color: colors.onPrimary); + + TextStyle get textSecondary => TextStyle(color: colors.onSecondary); + + TextStyle get textTertiary => TextStyle(color: colors.onTertiary); +} + +enum ColorSeed { + m3baseline('M3 Baseline', Color(0xff6750a4)), + indigo('Indigo', Colors.indigo), + blue('Blue', Colors.blue), + teal('Teal', Colors.teal), + green('Green', Colors.green), + yellow('Yellow', Colors.yellow), + orange('Orange', Colors.orange), + deepOrange('Deep Orange', Colors.deepOrange), + white('White', Colors.white), + pink('Pink', Colors.pink); + + const ColorSeed(this.label, this.color); + + final String label; + final Color color; +} diff --git a/packages/you_flutter/lib/src/layouts/page_layout_default.dart b/packages/you_flutter/lib/src/layouts/page_layout_default.dart new file mode 100644 index 00000000..5b89723a --- /dev/null +++ b/packages/you_flutter/lib/src/layouts/page_layout_default.dart @@ -0,0 +1,80 @@ +import 'package:flutter/material.dart'; +import 'package:you_flutter/src/router.dart'; + +class PageLayoutDefault extends StatelessWidget { + final PageBuilder builder; + final ToUri uri; + + const PageLayoutDefault({super.key, required this.builder, required this.uri}); + + @override + Widget build(BuildContext context) { + var child = builder(context); + + 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: Text("location: $uri"), actions: [ + IconButton(iconSize: 24, icon: const Icon(Icons.color_lens_outlined), onPressed: () {}), + IconButton(iconSize: 24, icon: const Icon(Icons.settings), onPressed: () {}), + ]), + floatingActionButton: FloatingActionButton(onPressed: () {}, tooltip: 'Increment', child: const Icon(Icons.add)), + body: SafeArea( + child: SelectionArea( + 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), + rail(title: "文件夹2", icon: Icons.folder_outlined), + ]), + const Drawer( + width: 200, + child: _RouteTree(), + ), + Expanded(child: child), + ], + ), + ), + ), + ); + } +} + +class _RouteTree extends StatelessWidget { + const _RouteTree(); + + @override + Widget build(BuildContext context) { + final router = YouRouter.of(context); + + var validRoutes = router.root.toList().where((e) => e.isValid || e.isNonLeaf); + var routeWidgets = validRoutes.map((node) { + String title = "▼ ${node.part}"; + title = title.padLeft((node.level * 3) + title.length); + + click() { + router.to(node.toUri()); + } + + return Align( + alignment: Alignment.centerLeft, + child: TextButton(onPressed: node.isValid ? click : null, child: Text(title)), + ); + }); + return ConstrainedBox( + constraints: const BoxConstraints.tightFor(width: 350), + child: ListView( + children: [ + ...routeWidgets, + ], + )); + } +} diff --git a/packages/you_flutter/lib/src/log.dart b/packages/you_flutter/lib/src/log.dart new file mode 100644 index 00000000..c386abdf --- /dev/null +++ b/packages/you_flutter/lib/src/log.dart @@ -0,0 +1,87 @@ +import 'package:flutter/foundation.dart'; +import 'package:flutter/widgets.dart'; +import 'package:meta/meta.dart'; + +@internal +Logger logger = Logger(); + +@internal +class Logger extends ChangeNotifier { + final List messages = List.empty(growable: true); + Element? logView; + + log(Object? object) { + String message = "${DateTime.now()} - $object"; + if (kDebugMode) { + print(message); + } + messages.add(message); + if (logView?.mounted ?? false) logView!.markNeedsBuild(); + } +} + +@internal +class LoggableRouterDelegate implements RouterDelegate { + final RouterDelegate delegate; + final Logger logger; + + LoggableRouterDelegate({required this.delegate, required this.logger}); + + @override + void addListener(VoidCallback listener) { + log("addListener($listener)"); + return delegate.addListener(listener); + } + + @override + Widget build(BuildContext context) { + log("build(${(context as Element).toStringShallow(minLevel: DiagnosticLevel.hidden)})"); + return delegate.build(context); + } + + @override + T? get currentConfiguration { + log("currentConfiguration -> ${_configuration(delegate.currentConfiguration)}"); + return delegate.currentConfiguration; + } + + String _configuration(T? configuration) { + var result = configuration; + var str = result is RouteInformation ? "path:${result.uri.path},state:${result.state}" : "$result"; + return str; + } + + @override + Future popRoute() { + log("popRoute()"); + return delegate.popRoute(); + } + + @override + void removeListener(VoidCallback listener) { + log("removeListener($listener)"); + return delegate.removeListener(listener); + } + + @override + Future setInitialRoutePath(T configuration) { + log("setInitialRoutePath(configuration:${_configuration(configuration)})"); + return delegate.setInitialRoutePath(configuration); + } + + @override + Future setNewRoutePath(T configuration) { + log("setNewRoutePath(configuration:${_configuration(configuration)})"); + return delegate.setNewRoutePath(configuration); + } + + @override + Future setRestoredRoutePath(T configuration) { + log("setRestoredRoutePath(configuration:${_configuration(configuration)})"); + return delegate.setRestoredRoutePath(configuration); + } + + log(Object? msg) { + logger.log("${delegate.runtimeType}(id:${identityHashCode(delegate)}).$msg"); + } +} diff --git a/packages/you_flutter/lib/src/router.dart b/packages/you_flutter/lib/src/router.dart new file mode 100644 index 00000000..69daf55f --- /dev/null +++ b/packages/you_flutter/lib/src/router.dart @@ -0,0 +1,642 @@ +import 'dart:async'; +import 'dart:collection'; + +import 'package:flutter/foundation.dart'; +import 'package:flutter/material.dart'; +import 'package:meta/meta.dart'; +import 'package:path/path.dart' as path_; +import 'package:you_flutter/src/layouts/page_layout_default.dart'; +import 'package:you_flutter/src/log.dart'; + +/* +ref: +- https://flutter.cn/community/tutorials/understanding-navigator-v2 +- https://github.com/react-navigation/react-navigation + + +## 关于自动化push选择的问题,是否能在大多数情况下减少由客户程序员选择pop,push,replace等等? +## 用例:聊天窗口在 + 手机屏:push新page + 桌面屏:层级展示(没有push新page) + 旷世难题:通过route 的tree配置,而不是push等接口来决定是否增加page栈 +### 方案1: +/ + main layout:MainWindowLayout + chat layout:ChatsLayout page:chatsPage(空页面) // windows:默认, mobile:/pushUpPage/main/chat/1 , + [user_id] page: chatPage + 通讯录 + 发现 + 我 + pushUpPage newRouteBehaviour:pop // 切换新路由,pop弹出有返回按钮的页面 + main + chat + [user_id] ref-> /main/chat/user_id + +### 方案2: +/ + main layout:MainWindowLayout + chat layout:ChatsLayout page:chatsPage(空页面) // windows:默认, mobile:/pushUpPage/main/chat/1 , + [user_id] page:chatPage , layoutRetry:LayoutRetry.up // fallStrategy: 页面踏空策略,如果页面没有被上游layout处理,则用此此略push一个新page + 通讯录 + 发现 + 我 + */ + +typedef PageBuilder = Widget Function(BuildContext context); +typedef PageLayoutBuilder = Widget Function(BuildContext context, PageBuilder bulider); +typedef LazyPageBuilder = Future Function(); + +final class NotFoundError extends ArgumentError { + NotFoundError({required Uri invalidValue, String name = "uri", String message = "Not Found"}) : super.value(invalidValue, name, message); +} + +mixin RouterMixin { + YouRouter get router; + + To get root => router.root; + + @nonVirtual + ToUri match(Uri uri) { + var root = router.root; + assert(uri.path.startsWith("/")); + if (uri.path == "/") return ToUri._(uri: uri, to: root, routeParameters: const {}); + + Map params = {}; + return root._match(uri: uri, segments: uri.pathSegments, params: params); + } + + @nonVirtual + void to(Uri uri) { + ToUri to = match(uri); + var result = router._routerDelegate.setNewRoutePath(to); + bool completed = false; + result.whenComplete(() => completed = true); + assert(completed, "bug: internal ensure routerDelegate.setNewRoutePath is sync implement"); + } +} + +final class RouteContext with RouterMixin { + RouteContext._(this.router, this.uri); + + @override + final YouRouter router; + final ToUri uri; +} + +/// TODO P1 应针对2种flutter 支持的route模式进行适配: +/// path base: https://example.com/product/1 +/// fragment base: https://example.com/base-harf/#/product/1 +/// +final class YouRouter with RouterMixin { + YouRouter({ + required this.root, + + /// [PlatformRouteInformationProvider.initialRouteInformation] + required Uri initial, + required GlobalKey navigatorKey, + }) : _navigatorKey = navigatorKey, + assert(root.templatePath == "/") { + _routerDelegate = LoggableRouterDelegate(logger: logger, delegate: _RouterDelegate(navigatorKey: _navigatorKey, router: this)); + _config = RouterConfig( + routeInformationProvider: PlatformRouteInformationProvider(initialRouteInformation: RouteInformation(uri: initial)), + routerDelegate: _routerDelegate, + routeInformationParser: _RouteInformationParser(router: this), + ); + } + + @override + final To root; + final GlobalKey _navigatorKey; + late final RouterConfig _config; + late final RouterDelegate _routerDelegate; + + static RouteContext of(BuildContext context) { + var result = context.findAncestorWidgetOfExactType<_RouteScope>(); + assert(result != null, "YouRouter not found, please: MaterialApp.router(routerConfig:YouRouter(...).config())"); + return RouteContext._(result!.router, result.uri); + } + + RouterConfig config() => _config; + + @override + @visibleForTesting + YouRouter get router => this; +} + +enum RoutePartType { + /// static path : /settings + static, + + /// dynamic param single part: /user/[id] : + /// /user/1 -> id==1 + dynamic, + + /// dynamic param rest parts: /file/[...path] : + /// /file/a.txt -> path==a.txt + /// /file/a/b/c.txt -> path==a/b/c.txt + dynamicRest; + + static RoutePartType? parse(String name) { + for (var i in values) { + if (i.name == name) { + return i; + } + } + return null; + } +} + +/// To == go_router.GoRoute +/// 官方的go_router内部略显复杂,且没有我们想要的layout等功能,所以自定一个简化版的to_router +base class To { + /// part may be a template + /// /[user]/[repository] + /// - /dart-lang/sdk => {"user":"dart-lang","repository":"sdk"} + /// - /flutter/flutter => {"user":"flutter","repository":"flutter"} + @nonVirtual + final String part; + + late final String _name; + late final RoutePartType _type; + + late To _parent = this; + + @nonVirtual + final List children; + + final PageBuilder? _builder; + final PageLayoutBuilder? _layout; + + // TODO P1 root Node的part是routes,有问题! + To( + this.part, { + PageBuilder? builder, + PageLayoutBuilder? layout, + this.children = const [], + }) : _builder = builder, + _layout = layout, + assert(part == "/" || !part.contains("/"), "part:'$part' should be '/' or legal directory name") { + var parsed = _parse(part); + _name = parsed.$1; + _type = parsed.$2; + + for (var route in children) { + route._parent = this; + } + } + + To.lazy( + String part, { + LazyPageBuilder? builder, + List children = const [], + }) : this( + part, + builder: _asyncToSync(builder), + children: children, + ); + + To get parent => _parent; + + @mustBeOverridden + bool get isValid => _builder != null; + + static PageBuilder? _asyncToSync(LazyPageBuilder? builder) { + if (builder == null) { + return null; + } + return (BuildContext context) => FutureBuilder( + future: builder().then((b) => b(context)), + builder: (context, snapshot) { + final router = YouRouter.of(context); + if (snapshot.connectionState == ConnectionState.done) { + if (snapshot.hasError) { + return Text('page load error(${router.uri}): ${snapshot.error} \n${snapshot.stackTrace}'); + } + return snapshot.data!; + } + return const CircularProgressIndicator(); + }, + ); + } + + @nonVirtual + bool get isRoot => _parent == this; + + @nonVirtual + bool get isLeaf => children.isEmpty; + + @nonVirtual + bool get isNonLeaf => !isLeaf; + + // 对于page目录树: + // - / -> uriTemplate: / + // - users -> uriTemplate: /users + // - [user] -> uriTemplate: /users/[user] + @nonVirtual + String get templatePath => isRoot ? "/" : path_.join(_parent.templatePath, part); + + @nonVirtual + List get ancestors => isRoot ? [] : [_parent, ..._parent.ancestors]; + + /// return Strictly equal ancestors of type + @nonVirtual + Iterable findAncestorsOfSameType() sync* { + for (var a in ancestors) { + if (a.runtimeType == runtimeType) { + yield a as T; + } + } + } + + @nonVirtual + To get root => isRoot ? this : _parent.root; + + @nonVirtual + int get level => isRoot ? 0 : _parent.level + 1; + + ToUri _match({ + required Uri uri, + required List segments, + required Map params, + }) { + assert(segments.isNotEmpty); + + var [next, ...rest] = segments; + + // 忽略后缀'/' + // next=="" 代表最后以 '/' 结尾,当前 segments==[""] + if (_type == RoutePartType.static && next == "") { + return ToUri._(uri: uri, to: this, routeParameters: params); + } + + To? matchChild({required String segment}) { + To? matched = children.where((e) => e._type == RoutePartType.static).where((e) => segment == e._name).firstOrNull; + if (matched != null) return matched; + matched = children.where((e) => e._type == RoutePartType.dynamic || e._type == RoutePartType.dynamicRest).firstOrNull; + if (matched != null) return matched; + return null; + } + + To? matchedNext = matchChild(segment: next); + if (matchedNext == null) { + /// FIXME NotFoundError如何处理 + throw NotFoundError(invalidValue: uri); + } + + if (matchedNext._type == RoutePartType.dynamicRest) { + // /tree/[...file] + // /tree/x/y --> {"file":"x/y"} + // /tree/x/y/ --> {"file":"x/y/"} + // dynamicAll param must be last + params[matchedNext._name] = segments.join("/"); + return ToUri._(uri: uri, to: matchedNext, routeParameters: params); + } else { + if (next == "") { + return ToUri._(uri: uri, to: this, routeParameters: params); + } + if (matchedNext._type == RoutePartType.dynamic) { + params[matchedNext._name] = next; + } + } + + if (rest.isEmpty) { + return ToUri._(uri: uri, to: matchedNext, routeParameters: params); + } + + return matchedNext._match(uri: uri, segments: rest, params: params); + } + + /// tree to list + /// /a + /// - /a/1 + /// - /a/2 + /// + /// a.toList(includeThis:true) + /// => [/a,/a/1,/a/2] + @nonVirtual + List toList({ + bool includeThis = true, + bool Function(To path)? where, + Comparator? sortBy, + }) { + where = where ?? (e) => true; + if (!where(this)) { + return []; + } + List sorted = List.from(children); + if (sortBy != null) { + sorted.sort(sortBy); + } + + var flatChildren = sorted.expand((child) { + return child.toList(includeThis: true, where: where, sortBy: sortBy); + }).toList(); + return includeThis ? [this, ...flatChildren] : flatChildren; + } + + /// parse("user") --> (name:"user",type:ToNodeType.normal) + /// parse("[id]") --> (name:"id", type:ToNodeType.dynamic) + /// parse("[...path]") --> (name:"path",type:ToNodeType.dynamicAll) + static (String, RoutePartType) _parse(String pattern) { + assert(pattern.isNotEmpty); + + if (pattern[0] != "[" || pattern[pattern.length - 1] != "]") { + return (pattern, RoutePartType.static); + } + + assert(pattern != "[]"); + assert(pattern != "[...]"); + + // name 现在是[...xxx]或[xx] + + final removeBrackets = pattern.substring(1, pattern.length - 1); + + if (removeBrackets.startsWith("...")) { + return (removeBrackets.substring(3), RoutePartType.dynamicRest); + } else { + return (removeBrackets, RoutePartType.dynamic); + } + } + + @override + String toString({bool deep = false}) { + if (!deep) return ""; + return _toStringDeep(level: 0); + } + + String _toStringDeep({int level = 0}) { + if (children.isEmpty) { + return "${" " * level}"; + } + + return '''${" " * level} +${children.map((e) => e._toStringDeep(level: level + 1)).join("\n")} +${" " * level}'''; + } + + To? find(String templatePath) { + return _findBySegments(Uri.parse(templatePath).pathSegments.where((e) => e.isNotEmpty).toList()); + } + + To? _findBySegments(List segments) { + if (segments.isEmpty) return this; + var [first, ...rest] = segments; + for (var c in children) { + if (c.part == first) { + return c._findBySegments(rest); + } + } + return null; + } + + @nonVirtual + Uri toUri({Map routeParameters = const {}, Map> queryParameters = const {}}) { + // TODO 临时实现,需要增加模版参数 + return Uri.parse(templatePath); + } + + @visibleForOverriding + @mustBeOverridden + Widget build(BuildContext context, ToUri uri) { + if (_builder == null) { + // FIXME NotFoundError如何处理 + throw NotFoundError(invalidValue: uri); + } + final List chain = [this, ...findAncestorsOfSameType()]; + + for (var i in chain) { + if (i._layout != null) return i._layout(context, _builder); + } + return PageLayoutDefault(uri: uri, builder: _builder); + } +} + +// TODO TOUri 设计的还不完善, +// - 没有处理removeFragment、replace等更新操作,没有在path变化时更新_routeParameters +// - 桌面和web的Uri是不一样的,web上有域名,且有fragment和path base路由2种情况,未明确处理 +final class ToUri implements Uri { + final To to; + final Uri _uri; + final Map _routeParameters; + + ToUri._({ + required Uri uri, + required this.to, + required Map routeParameters, + }) : _uri = uri, + _routeParameters = /*safe copy*/ Map.from(routeParameters); + + Map get routeParameters { + return UnmodifiableMapView(_routeParameters); + } + + @override + int get hashCode => _uri.hashCode; + + @override + bool operator ==(Object other) { + if (identical(this, other)) return true; + return other is ToUri && _uri == other; + } + + @override + String toString() { + return _uri.toString(); + } + + @override + String get authority => _uri.authority; + + @override + UriData? get data => _uri.data; + + @override + String get fragment => _uri.fragment; + + @override + bool get hasAbsolutePath => _uri.hasAbsolutePath; + + @override + bool get hasAuthority => _uri.hasAuthority; + + @override + bool get hasEmptyPath => _uri.hasEmptyPath; + + @override + bool get hasFragment => _uri.hasFragment; + + @override + bool get hasPort => _uri.hasPort; + + @override + bool get hasQuery => _uri.hasQuery; + + @override + bool get hasScheme => _uri.hasScheme; + + @override + String get host => _uri.host; + + @override + bool get isAbsolute => _uri.isAbsolute; + + @override + bool isScheme(String scheme) => _uri.isScheme(scheme); + + @override + Uri normalizePath() => _uri.normalizePath(); + + @override + String get origin => _uri.origin; + + @override + String get path => _uri.path; + + @override + List get pathSegments => _uri.pathSegments; + + @override + int get port => _uri.port; + + @override + String get query => _uri.query; + + @override + Map get queryParameters => _uri.queryParameters; + + @override + Map> get queryParametersAll => _uri.queryParametersAll; + + @override + Uri removeFragment() => ToUri._(uri: _uri.removeFragment(), to: to, routeParameters: routeParameters); + + @override + ToUri replace({ + String? scheme, + String? userInfo, + String? host, + int? port, + String? path, + Iterable? pathSegments, + String? query, + Map? queryParameters, + String? fragment, + }) { + return ToUri._(to: to, routeParameters: routeParameters, uri: _uri.replace(scheme: scheme, userInfo: userInfo, host: host, port: port, path: path, pathSegments: pathSegments, query: query, queryParameters: queryParameters, fragment: fragment)); + } + + @override + ToUri resolve(String reference) => ToUri._(uri: _uri.resolve(reference), to: to, routeParameters: routeParameters); + + @override + ToUri resolveUri(Uri reference) => ToUri._(uri: _uri.resolveUri(reference), to: to, routeParameters: routeParameters); + + @override + String get scheme => _uri.scheme; + + @override + String toFilePath({bool? windows}) => _uri.toFilePath(windows: windows); + + @override + String get userInfo => _uri.userInfo; +} + +/// this class only use for [router] , +/// ref: [YouRouter.of] +class _RouteScope extends StatelessWidget { + const _RouteScope({ + required this.router, + required this.builder, + required this.uri, + }); + + final YouRouter router; + final WidgetBuilder builder; + final ToUri uri; + + @override + Widget build(BuildContext context) { + return builder(context); + } +} + +class _RouteInformationParser extends RouteInformationParser { + final YouRouter router; + + _RouteInformationParser({required this.router}); + + // TODO P1 routeInformation.uri 这个在web上是fragments或path base路由,要区分 + @override + Future parseRouteInformation(RouteInformation routeInformation) { + ToUri location = router.match(routeInformation.uri); + return SynchronousFuture(location); + } + + @override + RouteInformation? restoreRouteInformation(ToUri configuration) { + return RouteInformation(uri: configuration._uri); + } +} + +class _RouterDelegate extends RouterDelegate with ChangeNotifier, PopNavigatorRouterDelegateMixin { + final YouRouter router; + final Set stack; + + @override + final GlobalKey navigatorKey; + + _RouterDelegate({ + required this.router, + required this.navigatorKey, + }) : stack = {}; + + @override + Future setNewRoutePath(ToUri configuration) { + // TODO router暂时这样实现,还未确定Layout和route的配合细节 + stack.clear(); + stack.add(configuration); + notifyListeners(); + return SynchronousFuture(null); + } + + @override + Future setRestoredRoutePath(ToUri configuration) { + var result = setNewRoutePath(configuration); + notifyListeners(); + return result; + } + + @override + ToUri? get currentConfiguration { + return stack.isEmpty ? null : stack.last; + } + + @override + Widget build(BuildContext context) { + return _RouteScope( + uri: stack.first, + router: router, + builder: (context) { + return Navigator( + key: navigatorKey, + onPopPage: (route, result) { + if (!route.didPop(result)) { + return false; + } + if (stack.isEmpty) { + return true; + } + stack.remove(stack.last); + notifyListeners(); + return true; + }, + pages: List.from( + stack.map( + (uri) => MaterialPage(key: ValueKey(uri), child: uri.to.build(context, uri)), + ), + ), + ); + }, + ); + } +} diff --git a/packages/you_flutter/lib/src/router_core.dart b/packages/you_flutter/lib/src/router_core.dart new file mode 100644 index 00000000..5d2c5d24 --- /dev/null +++ b/packages/you_flutter/lib/src/router_core.dart @@ -0,0 +1,7 @@ +library router; + +class ToType { + final Type type; + + const ToType({this.type = Null}); +} diff --git a/packages/you_flutter/lib/state.dart b/packages/you_flutter/lib/state.dart index 989d6069..70efc527 100644 --- a/packages/you_flutter/lib/state.dart +++ b/packages/you_flutter/lib/state.dart @@ -1,4 +1,4 @@ library you_state; export 'package:you_dart/state.dart'; -export 'src/state_widget.dart' show Watch; +export 'package:you_flutter/src/state_widget.dart' show Watch; diff --git a/packages/you_flutter/pubspec.yaml b/packages/you_flutter/pubspec.yaml index 4e11680d..008977b8 100644 --- a/packages/you_flutter/pubspec.yaml +++ b/packages/you_flutter/pubspec.yaml @@ -1,6 +1,6 @@ name: you_flutter description: "Flutter framework project, for state , navigator and other flutter development infrastructure ." -version: 0.0.4 +version: 0.0.6-dev.1 homepage: https://github.com/chen56/you repository: https://github.com/chen56/you @@ -11,11 +11,17 @@ environment: dependencies: flutter: sdk: flutter - you_dart: ^0.0.4 + meta: ^1.12.0 + path: ^1.9.0 + you_dart: ^0.0.5 + + dev_dependencies: flutter_test: sdk: flutter - flutter_lints: ^3.0.0 + checks: ^0.3.0 + flutter_lints: ^3.0.2 + dependency_overrides: # dart CHANGELOG 3.0.0 2023-05-10 diff --git a/packages/you_flutter/test/better_ui_test.dart b/packages/you_flutter/test/better_ui_test.dart new file mode 100644 index 00000000..0c081af5 --- /dev/null +++ b/packages/you_flutter/test/better_ui_test.dart @@ -0,0 +1,55 @@ +import 'package:checks/checks.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:you_flutter/src/better_ui.dart'; + +void main() { + group("YouRouter.parse ok", () { + test('select() 所有档位都覆盖,测一下', () { + assertScreen(ScreenSize screen) { + // 用此档位的最小宽度+1,来模仿此屏幕大小 + var screenWidth = screen.minWidth + 1; + check(ScreenSize.byScreen(screenWidth)).equals(screen); + check( + ScreenSize.bestWithWidth(screenWidth, min: "min", sm:"sm",md: "md", lg: "lg", xl: "xl", xxl: "xxl"), + because: "假设当前屏幕宽度$screenWidth,在${screen.name}档, 应该用相应档位的style", + ).equals(screen.name); + } + + for (var screen in ScreenSize.values) { + assertScreen(screen); + } + }); + test('select() 提供一个档位,跳档看看覆盖', () { + // 用此档位的最小宽度+1,来模仿此屏幕大小 + screen(String screen) => ScreenSize.byName(screen).minWidth + 1; + + check(ScreenSize.bestWithWidth(screen("sm"), min: "min",sm:"sm",)).equals("sm"); + check(ScreenSize.bestWithWidth(screen("sm"), min: "min")).equals("min"); + check(ScreenSize.bestWithWidth(screen("md"), min: "min",sm:"sm")).equals("sm"); + check(ScreenSize.bestWithWidth(screen("md"), min: "min",sm:"md")).equals("md"); + }); + + test('current', () { + var byScreen= ScreenSize.byScreen; + + check(byScreen(ScreenSize.sm.minWidth - 1)).equals(ScreenSize.min); + check(byScreen(ScreenSize.sm.minWidth)).equals(ScreenSize.sm); + + check(byScreen(ScreenSize.md.minWidth - 1)).equals(ScreenSize.sm); + check(byScreen(ScreenSize.md.minWidth)).equals(ScreenSize.md); + + check(byScreen(ScreenSize.lg.minWidth - 1)).equals(ScreenSize.md); + check(byScreen(ScreenSize.lg.minWidth)).equals(ScreenSize.lg); + + check(byScreen(ScreenSize.xl.minWidth - 1)).equals(ScreenSize.lg); + check(byScreen(ScreenSize.xl.minWidth)).equals(ScreenSize.xl); + + check(byScreen(ScreenSize.xxl.minWidth - 1)).equals(ScreenSize.xl); + check(byScreen(ScreenSize.xxl.minWidth)).equals(ScreenSize.xxl); + check(byScreen(ScreenSize.xxl.minWidth + 10000)).equals(ScreenSize.xxl); + }); + test('Enum.values 按原始定义顺序', () { + check("${ScreenSize.values.map((e) => e.name)}").equals("(min, sm, md, lg, xl, xxl)"); + }); + }); +} diff --git a/packages/you_flutter/test/router_to_test.dart b/packages/you_flutter/test/router_to_test.dart new file mode 100644 index 00000000..196b498a --- /dev/null +++ b/packages/you_flutter/test/router_to_test.dart @@ -0,0 +1,138 @@ +import 'package:checks/checks.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:you_flutter/src/router.dart'; + +void main() { + WidgetsFlutterBinding.ensureInitialized(); + group("YouRouter.parse ok", () { + var router = YouRouter( + initial: Uri.parse("/"), + navigatorKey: GlobalKey(), + root: To("/", children: [ + To("settings", children: [ + To("profile"), + ]), + To("[user]", children: [ + To("[repository]", children: [ + To("tree", children: [ + To("[branch]", children: [ + To("[...file]"), + ]), + ]), + ]), + ]), + ])); + // Tos.root.user("chen56").repository("note").tree.branch("main").file("a/b/c.dart"); + // Tos.user_repository_tree_branch_file(user:"chen56",repository:"note",branch:"main",file:"a/b"); + void match(String path, {required ({String location, Map routeParameters}) expected}) { + var match = router.match(Uri.parse(path)); + expect(match.to.templatePath, equals(expected.location)); + expect(match.routeParameters, equals(expected.routeParameters)); + } + + test('static', () { + match("/", expected: (location: "/", routeParameters: {})); + + match("/settings", expected: (location: "/settings", routeParameters: {})); + // end with '/' + match("/settings/", expected: (location: "/settings", routeParameters: {})); + + match("/settings/profile", expected: (location: "/settings/profile", routeParameters: {})); + // end with '/' + match("/settings/profile/", expected: (location: "/settings/profile", routeParameters: {})); + }); + + test('dynamic', () { + /// dynamic + match("/flutter", expected: (location: "/[user]", routeParameters: {"user": "flutter"})); + // end with '/' + match("/flutter/", expected: (location: "/[user]", routeParameters: {"user": "flutter"})); + + match("/flutter/flutter", + expected: (location: "/[user]/[repository]", routeParameters: {"user": "flutter", "repository": "flutter"})); + match("/flutter/packages", + expected: (location: "/[user]/[repository]", routeParameters: {"user": "flutter", "repository": "packages"})); + + match("/flutter/packages/tree", + expected: (location: "/[user]/[repository]/tree", routeParameters: {"user": "flutter", "repository": "packages"})); + + match("/flutter/packages/tree/main", expected: ( + location: "/[user]/[repository]/tree/[branch]", + routeParameters: {"user": "flutter", "repository": "packages", "branch": "main"} + )); + }); + + test('dynamicAll', () { + match("/flutter/packages/tree/main/b/c.dart", expected: ( + location: "/[user]/[repository]/tree/[branch]/[...file]", + routeParameters: {"user": "flutter", "repository": "packages", "branch": "main", "file": "b/c.dart"} + )); + // end with '/' + match("/flutter/packages/tree/main/b/c.dart/", expected: ( + location: "/[user]/[repository]/tree/[branch]/[...file]", + routeParameters: {"user": "flutter", "repository": "packages", "branch": "main", "file": "b/c.dart/"} + )); + }); + + test('priority', () { + /// static 目录名 优先级高于 dynamic 目录名,同级中既有动态又有静态目录名时,优先匹配static + match("/settings", expected: (location: "/settings", routeParameters: {})); + match("/chen56", expected: (location: "/[user]", routeParameters: {"user": "chen56"})); + }); + }); + group("YouRouter.parse 404", () { + var router = YouRouter( + initial: Uri.parse("/"), + navigatorKey: GlobalKey(), + root: To("/", children: [ + To("settings", children: [ + To("profile"), + ]), + ]), + ); + + void match(String path, {required String matched, required Map params}) { + var match = router.match(Uri.parse(path)); + expect(match.to.templatePath, equals(matched)); + expect(match.routeParameters, equals(params)); + } + + void checkNotFound({required String uri}) { + try { + router.match(Uri.parse(uri)); + fail("Never"); + } catch (e) { + check(e).isA(); + } + } + + test('404 no_page_found', () { + // found + match("/settings", matched: "/settings", params: {}); + match("/settings/profile", matched: "/settings/profile", params: {}); + // notFound + checkNotFound(uri: "/no_exists_path"); + checkNotFound(uri: "/settings/no_exists_path"); + }); + }); + group("get path", () { + var router = YouRouter( + initial: Uri.parse("/"), + navigatorKey: GlobalKey(), + root: To("/", children: [ + To("settings", children: [ + To("profile"), + ]), + ]), + ); + + test('find', () { + check(router.root.find("")!.templatePath).equals("/"); + check(router.root.find("/")!.templatePath).equals("/"); + check(router.root.find("settings")!.templatePath).equals("/settings"); + check(router.root.find("/settings/profile")!.templatePath).equals("/settings/profile"); + check(router.root.find("/settings/profile/not_exists")).isNull(); + }); + }); +} diff --git a/packages/you_note_dart/analysis_options.yaml b/packages/you_note_dart/analysis_options.yaml new file mode 100644 index 00000000..a5744c1c --- /dev/null +++ b/packages/you_note_dart/analysis_options.yaml @@ -0,0 +1,4 @@ +include: package:flutter_lints/flutter.yaml + +# Additional information about this file can be found at +# https://dart.dev/guides/language/analysis-options diff --git a/packages/you_note_dart/lib/note.dart b/packages/you_note_dart/lib/note.dart index 655f3ba4..999e8d29 100644 --- a/packages/you_note_dart/lib/note.dart +++ b/packages/you_note_dart/lib/note.dart @@ -1,5 +1,6 @@ library note; -export 'src/note.dart' show Print, Cell, LazyNoteBuilder, NoteSystem, NoteRoute, NoteBuilder; -export 'src/content/mockup.dart' show MockupWindow; -export 'src/content/markdown_content.dart' show MD; +export 'src/note.dart' show ToNote, Cell, NoteBuilder,NoteLayoutBuilder, NoteSystem; +export 'src/contents/contents.dart' show contents; +export 'src/contents/mockup.dart' show MockupWindow; +export 'src/contents/markdown_content.dart' show MD; diff --git a/packages/you_note_dart/lib/note_conf.dart b/packages/you_note_dart/lib/note_conf.dart index 2928398a..7e80109d 100644 --- a/packages/you_note_dart/lib/note_conf.dart +++ b/packages/you_note_dart/lib/note_conf.dart @@ -104,20 +104,20 @@ class NoteConf { } /// note.g.json -class NoteGenConf { +class NoteGJson { late Map comment = { "zh-CN": """❗重要配置❗,由github.com/chen56/note生成,一个笔记一个目录,每个目录都生成一个note.g.json,用来记录这篇笔记的重要元数据,比如生成note的uri, 文件应被保存在版本控制中,比如git,不应编辑或移动此文件。 """, "en": """❗ Important configuration ❗, generated by the github.com/chen56/note, one directory for each one note, note.g.json to record the important metadata of the note, for example generate the uri of note , the file should be saved in version control, such as git, and this file should not be edited or moved.""", }; late int noteId; - NoteGenConf({ + NoteGJson({ required this.noteId, }); - NoteGenConf.decode(String jsonStr) : this.decodeJson(jsonDecode(jsonStr)); + NoteGJson.decode(String jsonStr) : this.decodeJson(jsonDecode(jsonStr)); - NoteGenConf.decodeJson(Map json) + NoteGJson.decodeJson(Map json) : this( noteId: json["noteId"] ?? -1, ); @@ -129,7 +129,7 @@ class NoteGenConf { }; } - Future save(File file) async { + Future save(File file) async { await file.writeAsString(_encoder.convert(encode())); return this; } diff --git a/packages/you_note_dart/lib/note_layouts.dart b/packages/you_note_dart/lib/note_layouts.dart new file mode 100644 index 00000000..98bfa213 --- /dev/null +++ b/packages/you_note_dart/lib/note_layouts.dart @@ -0,0 +1,4 @@ +library note; + +export 'src/layouts/note_layout_style_1.dart' show NoteLayoutStyle1; +export 'src/layouts/note_layout_default.dart' show NoteLayoutDefault; \ No newline at end of file diff --git a/packages/you_note_dart/lib/note_shell.dart b/packages/you_note_dart/lib/note_shell.dart deleted file mode 100644 index 54877385..00000000 --- a/packages/you_note_dart/lib/note_shell.dart +++ /dev/null @@ -1,6 +0,0 @@ -// note外壳 - -// We separate the note.dart and note_shell.dart packages of note, -// because shells can have both flutter and html implementations in the future, -// and notes should not depend on which shell is used -export 'package:you_note_dart/src/note_layout.dart' show LayoutScreen, DeferredScreen; diff --git a/packages/you_note_dart/lib/src/contents/contents.dart b/packages/you_note_dart/lib/src/contents/contents.dart new file mode 100644 index 00000000..4d7c4251 --- /dev/null +++ b/packages/you_note_dart/lib/src/contents/contents.dart @@ -0,0 +1,15 @@ +import 'package:flutter/widgets.dart'; +import 'package:flutter_markdown/flutter_markdown.dart'; +import 'package:you_note_dart/src/contents/markdown_content.dart'; + +final Contents contents=Contents._(); +class Contents{ + Contents._(); + Widget contentToWidget(content) { + return switch (content) { + MD _ => MarkdownBody(data: content.text), + Widget _ => content, + _ => Text("$content"), + }; + } +} \ No newline at end of file diff --git a/packages/you_note_dart/lib/src/content/example_content.dart b/packages/you_note_dart/lib/src/contents/example_content.dart similarity index 99% rename from packages/you_note_dart/lib/src/content/example_content.dart rename to packages/you_note_dart/lib/src/contents/example_content.dart index bd1efe97..32d01855 100644 --- a/packages/you_note_dart/lib/src/content/example_content.dart +++ b/packages/you_note_dart/lib/src/contents/example_content.dart @@ -1,6 +1,6 @@ import 'package:flutter/material.dart'; import 'package:flutter_highlight/themes/vs2015.dart'; -import 'package:you_note_dart/src/content/params.dart'; +import 'package:you_note_dart/src/contents/params.dart'; import 'package:you_note_dart/src/flutter_highlight.dart'; import 'package:you_note_dart/src/note.dart'; import 'package:you_note_dart/ui.dart'; diff --git a/packages/you_note_dart/lib/src/content/markdown_content.dart b/packages/you_note_dart/lib/src/contents/markdown_content.dart similarity index 68% rename from packages/you_note_dart/lib/src/content/markdown_content.dart rename to packages/you_note_dart/lib/src/contents/markdown_content.dart index 76a8dccc..68551451 100644 --- a/packages/you_note_dart/lib/src/content/markdown_content.dart +++ b/packages/you_note_dart/lib/src/contents/markdown_content.dart @@ -1,15 +1,15 @@ import 'package:flutter/material.dart'; -import 'package:flutter_highlight/themes/vs2015.dart'; import 'package:flutter_markdown/flutter_markdown.dart'; import 'package:markdown/markdown.dart' as md; import 'package:meta/meta.dart'; -import 'package:you_note_dart/src/content/outline.dart'; -import 'package:you_note_dart/src/flutter_highlight.dart'; +import 'package:you_note_dart/src/contents/outline.dart'; +// import 'package:you_note_dart/src/flutter_highlight.dart'; +// import 'package:flutter_highlight/themes/vs2015.dart'; class MD extends StatelessWidget { final String text; - const MD(this.text,{Object? debugLabel}); + const MD(this.text, {super.key, Object? debugLabel}); @override Widget build(BuildContext context) { @@ -19,20 +19,22 @@ class MD extends StatelessWidget { @internal class MarkdownContent extends StatelessWidget { - final Outline outline; - final ScrollController controller = ScrollController(); + final Outline _outline; + final ScrollController controller; final String content; - MarkdownContent({super.key, required this.outline, required this.content}); + MarkdownContent({super.key, ScrollController? controller, Outline? outline, required this.content}) + : controller = controller ?? ScrollController(), + _outline = outline ?? Outline(); @override Widget build(BuildContext context) { - var headerBuilder = _HeaderBuilder(outline); + var headerBuilder = _HeaderBuilder(_outline); return Markdown( data: content, selectable: true, // 得研究下controller层层嵌套要怎么用 - controller: controller, + // controller: controller, shrinkWrap: true, builders: { @@ -105,37 +107,31 @@ class _PreBuilder extends MarkdownElementBuilder { @override Widget? visitText(md.Text text, TextStyle? preferredStyle) { - var highlight = HighlightView( - // The original code to be highlighted - text.textContent, - - // Specify language - // It is recommended to give it a value for performance - language: 'dart', - - // Specify highlight theme - // All available themes are listed in `themes` folder - theme: vs2015Theme, - - // Specify padding - padding: const EdgeInsets.all(12), - - // Specify text style - textStyle: const TextStyle( - fontFamily: 'My awesome monospace font', - fontSize: 16, - ), - ); - var noScroll = Row( - children: [ - Expanded(child: highlight), - ], - ); - + // var highlight = HighlightView( + // // The original code to be highlighted + // text.textContent, + // + // // Specify language + // // It is recommended to give it a value for performance + // language: 'dart', + // + // // Specify highlight theme + // // All available themes are listed in `themes` folder + // theme: vs2015Theme, + // + // // Specify padding + // padding: const EdgeInsets.all(12), + // + // // Specify text style + // textStyle: const TextStyle( + // fontFamily: 'My awesome monospace font', + // fontSize: 16, + // ), + // ); //目前看,markdown中的code/prd 不滚动是不是更好些,一般内容不会很长 return Container( padding: const EdgeInsets.only(right: 100), - child: noScroll, + child: Text(text.textContent), ); } } diff --git a/packages/you_note_dart/lib/src/content/mockup.dart b/packages/you_note_dart/lib/src/contents/mockup.dart similarity index 100% rename from packages/you_note_dart/lib/src/content/mockup.dart rename to packages/you_note_dart/lib/src/contents/mockup.dart diff --git a/packages/you_note_dart/lib/src/content/outline.dart b/packages/you_note_dart/lib/src/contents/outline.dart similarity index 100% rename from packages/you_note_dart/lib/src/content/outline.dart rename to packages/you_note_dart/lib/src/contents/outline.dart diff --git a/packages/you_note_dart/lib/src/content/params.dart b/packages/you_note_dart/lib/src/contents/params.dart similarity index 99% rename from packages/you_note_dart/lib/src/content/params.dart rename to packages/you_note_dart/lib/src/contents/params.dart index cbcc12d5..e18b3564 100644 --- a/packages/you_note_dart/lib/src/content/params.dart +++ b/packages/you_note_dart/lib/src/contents/params.dart @@ -6,7 +6,8 @@ import 'package:code_builder/code_builder.dart' as code; import 'package:dart_style/dart_style.dart' show DartFormatter; import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; -import 'package:you_note_dart/src/content/params_editors.dart'; +import 'package:you_note_dart/src/contents/params_editors.dart'; +// ignore: implementation_imports, internal import /src of the same project. import 'package:you_dart/src/core.dart'; final defaultEmitter = code.DartEmitter(allocator: code.Allocator(), useNullSafetySyntax: true); diff --git a/packages/you_note_dart/lib/src/content/params_editors.dart b/packages/you_note_dart/lib/src/contents/params_editors.dart similarity index 99% rename from packages/you_note_dart/lib/src/content/params_editors.dart rename to packages/you_note_dart/lib/src/contents/params_editors.dart index 611c977e..b9114c0d 100644 --- a/packages/you_note_dart/lib/src/content/params_editors.dart +++ b/packages/you_note_dart/lib/src/contents/params_editors.dart @@ -1,7 +1,7 @@ import 'package:code_builder/code_builder.dart' as code; import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; -import 'package:you_note_dart/src/content/params.dart'; +import 'package:you_note_dart/src/contents/params.dart'; abstract class BaseValueInputEditor extends BaseValueEditor { BaseValueInputEditor(super.param, {required super.editors}); diff --git a/packages/you_note_dart/lib/src/content/source_code.dart b/packages/you_note_dart/lib/src/contents/source_code.dart similarity index 95% rename from packages/you_note_dart/lib/src/content/source_code.dart rename to packages/you_note_dart/lib/src/contents/source_code.dart index 767e6d04..342b5e2d 100644 --- a/packages/you_note_dart/lib/src/content/source_code.dart +++ b/packages/you_note_dart/lib/src/contents/source_code.dart @@ -5,10 +5,12 @@ import 'package:analyzer/dart/ast/ast.dart'; import 'package:analyzer/dart/ast/visitor.dart'; import 'package:analyzer/file_system/file_system.dart'; import 'package:analyzer/file_system/memory_file_system.dart'; +// ignore: implementation_imports, there is no other way i don t want to copy it . import 'package:analyzer/src/test_utilities/mock_sdk.dart'; import 'package:meta/meta.dart'; import 'package:path/path.dart' as path_; import 'package:you_note_dart/src/utils_core.dart'; +// ignore: implementation_imports, internal import /src of the same project import 'package:you_dart/src/core.dart'; typedef _AddCell = ({Block belongTo, MethodInvocation invocation}); @@ -198,7 +200,6 @@ class FindCellAdd { class CodeAnalyzer { final _resourceProvider = MemoryResourceProvider(); - late final AnalysisContextCollection collection; late final AnalysisSession session; final ({String path, String content}) _defaultInitLib = ( path: "/lib/note.dart", @@ -223,7 +224,7 @@ class Cell{ root: _newFolder(sdkPath), ); - collection = AnalysisContextCollection( + var collection = AnalysisContextCollection( includedPaths: libs.map((e) => e.path).toList(), resourceProvider: _resourceProvider, sdkPath: sdkPath, @@ -233,17 +234,17 @@ class Cell{ Future getResolvedLibrary({required String path, required String content}) async { var file = _newFile(_resourceProvider.convertPath(path_.absolute(path)), content); - return collection.contexts[0].currentSession.getResolvedLibrary(file.path) as ResolvedLibraryResult; + return session.getResolvedLibrary(file.path) as ResolvedLibraryResult; } SomeParsedUnitResult getParsedUnit({required String path, required String content}) { var file = _newFile(_resourceProvider.convertPath(path_.absolute(path)), content); - return collection.contexts[0].currentSession.getParsedUnit(file.path); + return session.getParsedUnit(file.path); } Future getResolvedUnit({required String path, required String content}) { var file = _newFile(_resourceProvider.convertPath(path_.absolute(path)), content); - return collection.contexts[0].currentSession.getResolvedUnit(file.path); + return session.getResolvedUnit(file.path); } Folder _newFolder(String path) { diff --git a/packages/you_note_dart/lib/src/conventions.dart b/packages/you_note_dart/lib/src/conventions.dart index 3a26716c..81120120 100644 --- a/packages/you_note_dart/lib/src/conventions.dart +++ b/packages/you_note_dart/lib/src/conventions.dart @@ -10,10 +10,10 @@ class Conventions { Conventions._(); String noteDartAssetPath(String notePath) { - return path.join("lib/notes", path.relative(notePath, from: "/"), "note.dart"); + return path.join("lib/routes", path.relative(notePath, from: "/"), "page.dart"); } String noteConfAssetPath(String notePath) { - return path.join("lib/notes", path.relative(notePath, from: "/"), "note.json"); + return path.join("lib/routes", path.relative(notePath, from: "/"), "page.json"); } } diff --git a/packages/you_note_dart/lib/src/layouts/note_layout_default.dart b/packages/you_note_dart/lib/src/layouts/note_layout_default.dart new file mode 100644 index 00000000..b7280d0e --- /dev/null +++ b/packages/you_note_dart/lib/src/layouts/note_layout_default.dart @@ -0,0 +1,36 @@ +import 'package:flutter/material.dart'; +import 'package:you_flutter/router.dart'; +import 'package:you_flutter/state.dart'; +import 'package:you_note_dart/note.dart'; + +final class NoteLayoutDefault extends StatelessWidget { + final NoteBuilder builder; + final ToUri uri; + + const NoteLayoutDefault({super.key, required this.uri, required this.builder}); + + @override + Widget build(BuildContext context) { + return Scaffold( + body: SafeArea( + child: SelectionArea( + /// Watch是you_flutter的state管理组件, 被其包裹的状态可以被观测刷新(ref: Cell._contents = [].signal()) + child: Watch((context) { + // contents是收集到调用print(xx)的所有结果 + Cell rootCell = Cell.empty(); + builder(context, rootCell); + var pageContents = rootCell.toList().expand((cell) sync* { + for (var content in cell.contents) { + yield Align( + alignment: Alignment.centerLeft, + child: contents.contentToWidget(content), + ); + } + }).toList(); + return ListView(children: pageContents); + }), + ), + ), + ); + } +} diff --git a/packages/you_note_dart/lib/src/layouts/note_layout_style_1.dart b/packages/you_note_dart/lib/src/layouts/note_layout_style_1.dart new file mode 100644 index 00000000..d39977df --- /dev/null +++ b/packages/you_note_dart/lib/src/layouts/note_layout_style_1.dart @@ -0,0 +1,75 @@ +import 'package:flutter/material.dart'; +import 'package:you_flutter/router.dart'; +import 'package:you_flutter/state.dart'; +import 'package:you_note_dart/src/contents/contents.dart'; +import 'package:you_note_dart/src/note.dart'; + +/// 一个极简的笔记布局范例 +/// 左边routes树,右边页面内容 +final class NoteLayoutStyle1 extends StatelessWidget { + final NoteBuilder builder; + + const NoteLayoutStyle1({super.key, required this.builder}); + + @override + Widget build(BuildContext context) { + return Scaffold( + body: SafeArea( + child: SelectionArea( + /// Watch是you_flutter的state管理组件, 被其包裹的状态可以被观测刷新(ref: Cell._contents = [].signal()) + child: Watch((context) { + // contents是收集到调用print(xx)的所有结果 + Cell cell = Cell.empty(); + builder(context, cell); + var pageContents = cell.toList().expand((cell) sync* { + for (var content in cell.contents) { + yield Align( + alignment: Alignment.centerLeft, + child: contents.contentToWidget(content), + ); + } + }).toList(); + return Row( + children: [ + // IntrinsicWidth(child: _NoteTreeView(uri)), + const _RouteTree(), + Flexible(child: ListView(children: pageContents)), + ], + ); + }), + ), + ), + ); + } +} + +class _RouteTree extends StatelessWidget { + const _RouteTree(); + + @override + Widget build(BuildContext context) { + final router = YouRouter.of(context); + + var validRoutes = router.root.toList().where((e) => e.isValid || e.isNonLeaf); + var routeWidgets = validRoutes.map((node) { + String title = "▼ ${node.part}"; + title = title.padLeft((node.level * 3) + title.length); + + click() { + router.to(node.toUri()); + } + + return Align( + alignment: Alignment.centerLeft, + child: TextButton(onPressed: node.isValid ? click : null, child: Text(title)), + ); + }); + return ConstrainedBox( + constraints: const BoxConstraints.tightFor(width: 350), + child: ListView( + children: [ + ...routeWidgets, + ], + )); + } +} diff --git a/packages/you_note_dart/lib/src/layouts/page_layout_default.dart b/packages/you_note_dart/lib/src/layouts/page_layout_default.dart new file mode 100644 index 00000000..173ed5ff --- /dev/null +++ b/packages/you_note_dart/lib/src/layouts/page_layout_default.dart @@ -0,0 +1,20 @@ +import 'package:flutter/material.dart'; +import 'package:you_flutter/router.dart'; + +final class PageLayoutDefault extends StatelessWidget { + final PageBuilder builder; + + const PageLayoutDefault({super.key, required this.builder}); + + @override + Widget build(BuildContext context) { + var pageBody = builder(context); + return Scaffold( + body: SafeArea( + child: SelectionArea( + child: pageBody, + ), + ), + ); + } +} diff --git a/packages/you_note_dart/lib/src/node_code.dart b/packages/you_note_dart/lib/src/node_code.dart deleted file mode 100644 index 800b672f..00000000 --- a/packages/you_note_dart/lib/src/node_code.dart +++ /dev/null @@ -1,135 +0,0 @@ - -import 'package:meta/meta.dart'; -import 'package:you_note_dart/src/note.dart'; - - -typedef NoteSourceData = ({ -List< - ({ - String cellType, - int end, - int offset, - List< - ({ - String nodeType, - int end, - int offset, - })> specialNodes, - })> cells, -// NoteConfPart meta -}); - -// TODO 130 remove -/// ref: [LazyNoteBuilder] -class DeprecatedNotePage { - - // TODO 130 remove - // final String content; // source code content - DeprecatedNotePage(); - - @internal - String getCellCode(CodeEntity codeEntity) { - // TODO 130 remove - // if (codeEntity.end > content.length) { - // return "// ${codeEntity.offset}:(${codeEntity.end}) >= code.length(${content.length}) "; - // } - // return content.safeSubstring(codeEntity.offset, codeEntity.end); - return ""; - } -} - - -@internal -class NoteSource { - final NoteSourceData pageGenInfo; - - NoteSource({required this.pageGenInfo}); -} - -@internal -class CodeEntity { - /// CodeEntity is same as analyzer [SyntacticEntity] class CodeEntity { - final int offset; - final int end; - - CodeEntity({required this.offset, required this.end}); - - int get length => end - offset; - - @override - String toString() { - return "CodeEntity(offset:$offset, end:$end, length:$length )"; - } -} - -class CellSource { - CellSource({ - required this.cellType, - required this.codeEntity, - required this.specialSources, - required this.page, - }); - - final CellType cellType; - final CodeEntity codeEntity; - final List specialSources; - final DeprecatedNotePage page; - - String get code { - return page.getCellCode(codeEntity); - } - - bool get isCodeEmpty { - return code.contains(RegExp(r'^\s*$')); - } - - bool get isCodeNotEmpty { - return !isCodeEmpty; - } - - @override - String toString() { - return "CellSource:cellType:$cellType block:$codeEntity )"; - } -} - -@internal -class SpecialSource { - /// todo codeType to enum, common use by this and note_dev_gen.dart - String codeType; - final CodeEntity codeEntity; - final DeprecatedNotePage page; - final NoteRoute note; - // final NoteSource pageSource; - - SpecialSource({ - required this.codeType, - required this.codeEntity, - required this.page, - required this.note, - }) //:TODO 130 remove pageSource = note.source - ; - - String get code { - return page.getCellCode(codeEntity); - } - - @override - String toString() { - return "SpecialSource(codeType:$codeType,codeEntity:$codeEntity,)"; - } -} - -@internal -enum CellType { - header, - body, - tail; - - static CellType parse(String name) { - for (CellType t in CellType.values) { - if (t.name == name) return t; - } - throw Exception("CellType.name:$name not exist"); - } -} diff --git a/packages/you_note_dart/lib/src/note.dart b/packages/you_note_dart/lib/src/note.dart index 6e04a172..5b2f5218 100644 --- a/packages/you_note_dart/lib/src/note.dart +++ b/packages/you_note_dart/lib/src/note.dart @@ -1,18 +1,47 @@ -import 'package:flutter/services.dart'; import 'package:flutter/widgets.dart'; import 'package:meta/meta.dart'; import 'package:stack_trace/stack_trace.dart'; import 'package:source_map_stack_trace/source_map_stack_trace.dart' as source_map_stack_trace; import 'package:path/path.dart' as path; import 'package:source_maps/source_maps.dart' as source_map; +import 'package:you_flutter/router.dart'; import 'package:you_flutter/state.dart'; import 'package:you_note_dart/note_conf.dart'; import 'package:you_note_dart/src/conventions.dart'; import 'package:http/http.dart' as http; +import 'package:you_note_dart/src/layouts/note_layout_default.dart'; typedef NoteBuilder = void Function(BuildContext context, Cell print); -typedef LazyNoteBuilder = Future Function(BuildContext context, Cell print); +typedef NoteLayoutBuilder = Widget Function(BuildContext context, NoteBuilder builder); +base class ToNote extends To { + final NoteBuilder? _builder; + final NoteLayoutBuilder? _layout; + + ToNote(super.part, {NoteBuilder? builder, NoteLayoutBuilder? layout, List children = const []}) + : _builder = builder, + _layout = layout, + super(children: children); + + @override + bool get isValid => _builder!=null; + + @override + Widget build(BuildContext context, ToUri uri) { + if (_builder == null) { + // TODO not found + return Text("not found $uri"); + } + List chain = [this, ...findAncestorsOfSameType()]; + for (var i in chain) { + if (i._layout != null) return i._layout(context, _builder); + } + return NoteLayoutDefault(uri: uri, builder: _builder); + } + +} + +@Deprecated("已被you_router取代,待删除") class NoteRoute { /// A file system term, that refers to the last part of a path /// example: a/b/c , c is basename @@ -21,25 +50,12 @@ class NoteRoute { final NoteRoute? parent; bool expand = false; - @internal - LazyNoteBuilder? lazyNoteBuilder; - NoteConf? conf; - NoteRoute._child({required this.basename, required NoteRoute this.parent}); - NoteRoute.root() : basename = "", parent = null; - NoteRoute put(String fullPath, LazyNoteBuilder lazyNoteBuilder) { - var p = fullPath.split("/").map((e) => e.trim()).where((e) => e.isNotEmpty).toList(); - var path = _ensurePath(p); - - path.lazyNoteBuilder = lazyNoteBuilder; - return path; - } - void configTree({int extendLevel = 0}) { if (extendLevel <= 0) return; @@ -51,20 +67,6 @@ class NoteRoute { List get children => List.from(_children.values); - NoteRoute _ensurePath(List nameList) { - if (nameList.isEmpty) { - return this; - } - String name = nameList[0]; - assert(name != "" && name != "/", "path:$nameList, path[0]:'$name' must not be '' and '/' "); - var next = _children.putIfAbsent(name, () { - var child = NoteRoute._child(basename: name, parent: this); - _children[name] = child; - return child; - }); - return next._ensurePath(nameList.sublist(1)); - } - bool get isLeaf => _children.isEmpty; int get level => isRoot ? 0 : parent!.level + 1; @@ -169,20 +171,15 @@ class NoteRoute { } class NoteSystem { - final NoteRoute root; + final To root; NoteSystem({ required this.root, }); static Future load({ - required NoteRoute root, + required To root, }) async { - SpaceConf spaceConf = SpaceConf.decodeJson(await rootBundle.loadString('notes.g.json')); - root.visit((e) { - e.conf = spaceConf.notes[e.path]; - return true; - }); return NoteSystem( root: root, ); @@ -236,8 +233,7 @@ class NoteSystem { } base class Cell { - Cell( - Function(Cell print) callback, { + Cell(Function(Cell print) callback, { this.title, }) { callback(this); diff --git a/packages/you_note_dart/lib/src/note_layout.dart b/packages/you_note_dart/lib/src/note_layout.dart index 3e98d2d3..9e906f0e 100644 --- a/packages/you_note_dart/lib/src/note_layout.dart +++ b/packages/you_note_dart/lib/src/note_layout.dart @@ -1,8 +1,8 @@ import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:you_flutter/state.dart'; -import 'package:you_note_dart/src/content/markdown_content.dart'; -import 'package:you_note_dart/src/content/outline.dart'; +import 'package:you_note_dart/src/contents/markdown_content.dart'; +import 'package:you_note_dart/src/contents/outline.dart'; import 'package:you_note_dart/src/navigator_v2.dart'; import 'package:you_note_dart/src/note.dart'; import 'package:you_note_dart/src/utils_ui.dart'; @@ -10,50 +10,18 @@ import 'package:you_note_dart/src/utils_ui.dart'; /// 分割块,在cell间分割留白 const Widget _cellSplitBlock = SizedBox(height: 18); -class DeferredScreen extends StatelessWidget with Screen { - final NoteRoute noteRoute; - final NoteSystem noteSystem; - - DeferredScreen({super.key, required this.noteRoute, required this.noteSystem}); - - @override - Widget build(BuildContext context) { - Cell noteRootCell = Cell.empty(); - return FutureBuilder( - future: noteRoute.lazyNoteBuilder!(context, noteRootCell), - builder: (context, snapshot) { - if (snapshot.connectionState == ConnectionState.done) { - if (snapshot.hasError) { - return Text('note load error(${noteRoute.path}): ${snapshot.error} \n${snapshot.stackTrace}'); - } - - return LayoutScreen( - note: noteRoute, - noteSystem: noteSystem, - rootCell: noteRootCell, - ); - } - return const CircularProgressIndicator(); - }, - ); - } - - @override - String get location => noteRoute.path; -} - +@Deprecated("已被新router替代暂时保留,代码还没移植完") class LayoutScreen extends StatefulWidget with Screen { final NoteSystem noteSystem; - final NoteRoute note; + final NoteRoute note = NoteRoute.root(); final Cell rootCell; - final NoteRoute rootNote; + final NoteRoute rootNote = NoteRoute.root(); LayoutScreen({ super.key, required this.noteSystem, required this.rootCell, - required this.note, - }) : rootNote = noteSystem.root; + }); @override String get location => note.path; @@ -100,27 +68,10 @@ class _LayoutScreenState extends State { var navigatorTree = _NoteTreeView(widget.rootNote); var outlineView = _OutlineTreeView( - mainContentViewController: controllerV, + pageController: controllerV, outline: outline, ); - // 总是偶发的报错: The Scrollbar's ScrollController has no ScrollPosition attached. - // 参考:https://stackoverflow.com/questions/69853729/flutter-the-scrollbars-scrollcontroller-has-no-scrollposition-attached/71490688#71490688 - // 暂时用Scrollbar试试,但不知其所以然,还是对其布局机制不太懂啊: - // var contentListView = ListView( - // scrollDirection: Axis.vertical, - // shrinkWrap: true, - // controller: controller, - // children: [ - // ...pen._contents, - // //page下留白,避免被os工具栏遮挡 - // const SizedBox(height: 200), - // ], - // ); - // 20230404 chen56 - // why use SingleChildScrollView+ListBody replace ListView : - // ListView is lazy load, so page not complete, then outline load not complete. - var pageBody = SingleChildScrollView( scrollDirection: Axis.vertical, controller: controllerV, @@ -257,9 +208,9 @@ class _OutlineTreeView extends StatelessWidget { final Outline outline; // 主内容部分的滚动控制,点击outline触发主屏滚动到指定标题 - final ScrollController mainContentViewController; + final ScrollController pageController; - const _OutlineTreeView({required this.outline, required this.mainContentViewController}); + const _OutlineTreeView({required this.outline, required this.pageController}); @override Widget build(BuildContext context) { @@ -281,7 +232,7 @@ class _OutlineTreeView extends StatelessWidget { ), onPressed: () { // 防止异常 - if (mainContentViewController.hasClients) { + if (pageController.hasClients) { Scrollable.ensureVisible(node.key.currentContext!); } }, diff --git a/packages/you_note_dart/lib/src/utils_core.dart b/packages/you_note_dart/lib/src/utils_core.dart index 0b8f5d5d..dea851b2 100644 --- a/packages/you_note_dart/lib/src/utils_core.dart +++ b/packages/you_note_dart/lib/src/utils_core.dart @@ -1,8 +1,6 @@ final Collections collections=Collections(); class Collections{ - - Iterable<(E value, E? next)> combineNext(Iterable values) sync* { var list = values.toList(); for (int i = 0; i < list.length; i++) { diff --git a/packages/you_note_dart/lib/src/utils_ui.dart b/packages/you_note_dart/lib/src/utils_ui.dart index bd17719c..3567ea66 100644 --- a/packages/you_note_dart/lib/src/utils_ui.dart +++ b/packages/you_note_dart/lib/src/utils_ui.dart @@ -1,43 +1,9 @@ /// 基础包,不依赖其他业务代码 library; -import 'dart:collection'; import 'package:flutter/widgets.dart'; -class ListenableMap extends MapBase with ChangeNotifier { - final Map _attributes = {}; - - ListenableMap(); - - @override - Object? operator [](Object? key) { - return _attributes[key]; - } - - @override - void operator []=(String key, Object value) { - _attributes[key] = value; - notifyListeners(); - } - - @override - void clear() { - _attributes.clear(); - notifyListeners(); - } - - @override - Iterable get keys => _attributes.keys; - - @override - Object? remove(Object? key) { - var result = _attributes.remove(key); - notifyListeners(); - return result; - } -} - /// https://m3.material.io/foundations/layout/applying-layout/window-size-classes enum WindowClass { // phone diff --git a/packages/you_note_dart/pubspec.yaml b/packages/you_note_dart/pubspec.yaml index 83a74780..ffb2c7de 100644 --- a/packages/you_note_dart/pubspec.yaml +++ b/packages/you_note_dart/pubspec.yaml @@ -1,10 +1,11 @@ name: you_note_dart description: A Flutter note project. -version: 0.0.4 +version: 0.0.6-dev.1 homepage: https://github.com/chen56/note environment: - sdk: '>=3.3.0 <4.0.0' + sdk: '>=3.4.0-282.2.beta <4.0.0' + flutter: ">=3.22.0-0.2.pre" dependencies: flutter: @@ -37,13 +38,12 @@ dependencies: # you_* you_dart: ^0.0.4 you_flutter: ^0.0.4 + flutter_lints: ^3.0.2 # async: ^2.11.0 dev_dependencies: flutter_test: sdk: flutter - flutter_lints: - yaml_edit: ^2.2.0 # for NoteDevTool checks: ^0.3.0 diff --git a/packages/you_note_dart/test/benchmarks/code_block_benchmarks_test.dart b/packages/you_note_dart/test/benchmarks/code_block_benchmarks_test.dart index c9b9cd68..85b4926a 100644 --- a/packages/you_note_dart/test/benchmarks/code_block_benchmarks_test.dart +++ b/packages/you_note_dart/test/benchmarks/code_block_benchmarks_test.dart @@ -6,14 +6,14 @@ import 'package:analyzer/dart/ast/visitor.dart'; import 'package:flutter_test/flutter_test.dart'; void main() { - group("code analyzer benchmarks", () { + group("code analyzer benchmarks", skip: true, () { ///解析600行的文件 100次,1.7秒,足够做实时解析了 test("parse", () async { - File file = File.fromUri(Uri.file("lib/src/note_core.dart")); + File file = File.fromUri(Uri.file("lib/src/note.dart")); for (var _ in List.generate(100, (i) => i)) { var parseResult = parseString(content: file.readAsStringSync(), featureSet: FeatureSet.latestLanguageVersion()); var unit = parseResult.unit; - unit.visitChildren(GeneralizingAstVisitor()); + unit.visitChildren(const GeneralizingAstVisitor()); } }); }); diff --git a/packages/you_note_dart/test/note_cell_test.dart b/packages/you_note_dart/test/note_cell_test.dart index a74be7ef..afa920a2 100644 --- a/packages/you_note_dart/test/note_cell_test.dart +++ b/packages/you_note_dart/test/note_cell_test.dart @@ -13,7 +13,7 @@ void main() { print("hello"); //then - check(print.contents, because: "root no contents").deepEquals(["hello"]); + check(print.contents).deepEquals(["hello"]); check(print.children.isEmpty).isTrue(); }); @@ -42,7 +42,7 @@ void main() { }); test("note Sequential writing style", () async { Cell print = Cell.empty(title: "0"); - var root=print; + var root = print; print("0:content"); print = print.addCell(title: "1"); diff --git a/packages/you_note_dart/test/note_source_code_test.dart b/packages/you_note_dart/test/note_source_code_test.dart index 328c3f92..af3fecf8 100644 --- a/packages/you_note_dart/test/note_source_code_test.dart +++ b/packages/you_note_dart/test/note_source_code_test.dart @@ -2,7 +2,7 @@ import 'package:analyzer/dart/analysis/results.dart'; import 'package:checks/checks.dart'; import 'package:flutter_test/flutter_test.dart'; -import 'package:you_note_dart/src/content/source_code.dart'; +import 'package:you_note_dart/src/contents/source_code.dart'; void main() { late CodeAnalyzer analyzer; diff --git a/packages/you_note_dart/test/note_trace_base_cell_find_test.dart b/packages/you_note_dart/test/note_trace_base_cell_find_test.dart index c064166e..712929d8 100644 --- a/packages/you_note_dart/test/note_trace_base_cell_find_test.dart +++ b/packages/you_note_dart/test/note_trace_base_cell_find_test.dart @@ -3,7 +3,7 @@ import 'package:flutter_test/flutter_test.dart'; import 'package:stack_trace/stack_trace.dart'; import 'package:you_note_dart/src/note.dart'; -final _emptyJsonMap = '{"version":3,"sources":[],"mappings":""}'; +const _emptyJsonMap = '{"version":3,"sources":[],"mappings":""}'; void main() { group("jsSourceMap", () { @@ -73,7 +73,7 @@ Exception: my throw "sources": [ "org-dartlang-sdk:///dart-sdk/lib/async/stream.dart", "org-dartlang-sdk:///dart-sdk/lib/async/stream_controller.dart", - "../../../lib/notes/pure_dart/execption/note.dart", + "../../../lib/routes/notes/pure_dart/execption/note.dart", "../../../../../packages/you_note_dart/lib/src/note_cell.dart", "org-dartlang-sdk:///dart-sdk/lib/_internal/js_runtime/lib/js_array.dart", "org-dartlang-sdk:///dart-sdk/lib/internal/iterable.dart", @@ -633,7 +633,7 @@ Exception: my throw } """), ); - check(found.callerFrame!.library).endsWith("lib/notes/pure_dart/execption/note.dart"); + check(found.callerFrame!.library).endsWith("lib/routes/notes/pure_dart/execption/note.dart"); // print("=====>${found.dartTrace}"); }); diff --git a/packages/you_note_dart/test/src/params/editor_test.dart b/packages/you_note_dart/test/src/params/editor_test.dart index c7e7d575..2875f2f8 100644 --- a/packages/you_note_dart/test/src/params/editor_test.dart +++ b/packages/you_note_dart/test/src/params/editor_test.dart @@ -1,7 +1,7 @@ // ignore_for_file: unnecessary_type_check import 'package:flutter/material.dart'; -import 'package:you_note_dart/src/content/params.dart'; +import 'package:you_note_dart/src/contents/params.dart'; import 'package:flutter_test/flutter_test.dart'; typedef OnClick = void Function(); diff --git a/packages/you_note_dart/test/src/params/param_test.dart b/packages/you_note_dart/test/src/params/param_test.dart index e01e53e3..d1ced884 100644 --- a/packages/you_note_dart/test/src/params/param_test.dart +++ b/packages/you_note_dart/test/src/params/param_test.dart @@ -1,6 +1,6 @@ // ignore_for_file: unnecessary_type_check -import 'package:you_note_dart/src/content/params.dart'; +import 'package:you_note_dart/src/contents/params.dart'; import 'package:flutter_test/flutter_test.dart'; typedef OnClick = void Function(); diff --git a/test/bin/note_cli_gen_assets_test.dart b/test/bin/note_cli_gen_assets_test.dart deleted file mode 100644 index 406f4404..00000000 --- a/test/bin/note_cli_gen_assets_test.dart +++ /dev/null @@ -1,42 +0,0 @@ -import 'package:file/file.dart'; -import 'package:file/memory.dart'; -import 'package:path/path.dart' as path; -import 'package:test/test.dart'; - -import '../../bin/notecli.dart'; - - - -MemoryFileSystem fs = MemoryFileSystem(); -NotesGenerator gen = NotesGenerator(packageBaseName: "test_note", fs: fs, projectDir: fs.directory(path.absolute("/note"))); -File memoryPubspec(String content) { - MemoryFileSystem fs = MemoryFileSystem(); - var file = fs.file("/note/pubspec.yaml"); - file.parent.createSync(recursive: true); - file.writeAsStringSync(content); - return file; -} - -void main() { - group("Pubspec.putNoteAssets", () { - test('normal', () async { - var file = memoryPubspec(""" -flutter: - assets: - - assets/manual1 # manual config, keep it - - lib/notes/ # previously Generated ,keep it - - lib/notes/rm/ # previously Generated ,remove it - - assets/manual2 # manual config, keep it -"""); - Pubspec pubspec = await Pubspec.parseFile(file); - var old = pubspec.assets; - expect(old, ["assets/manual1", "lib/notes/", "lib/notes/rm/", "assets/manual2"]); - - // when - pubspec.noteAssetsUpdate(["lib/notes/", "lib/notes/new/"]); - - // then - expect(pubspec.assets, ['assets/manual1', 'lib/notes/', 'assets/manual2', 'lib/notes/new/']); - }); - }); -} diff --git a/test/bin/note_cli_test.dart b/test/bin/note_cli_test.dart deleted file mode 100644 index 47c33103..00000000 --- a/test/bin/note_cli_test.dart +++ /dev/null @@ -1,89 +0,0 @@ -import 'package:file/memory.dart'; -import 'package:test/test.dart'; - -import '../../bin/notecli.dart'; - -void main() { - late NotesGenerator gen; - late MemoryFileSystem fs; - - setUp(() { - fs = MemoryFileSystem(); - fs.directory("/n/lib/notes").createSync(recursive: true); - fs.currentDirectory = "/n"; - - gen = NotesGenerator( - packageBaseName: "flutter_web", - fs: fs, - projectDir: fs.directory("./"), - ); - }); - - group("NotesGenerator", () { - test('basic app_info', () { - expect(gen.projectDir.path, "./"); - expect(gen.libDir.path, "./lib"); - expect(gen.noteRootDir.path, "./lib/notes"); - }); - }); - - group("NoteLib", () { - test('relative path', () { - var testcases = [ - (noteRoute: "lib/notes/note.dart", key: "/", asVariableName: "root", asset: "lib/notes/"), - (noteRoute: "lib/notes/a/note.dart", key: "/a", asVariableName: "a", asset: "lib/notes/a/"), - (noteRoute: "lib/notes/a/b/note.dart", key: "/a/b", asVariableName: "a_b", asset: "lib/notes/a/b/"), - // number prefix may be use to sort - (noteRoute: "lib/notes/1.a/note.dart", key: "/1.a", asVariableName: "a", asset: "lib/notes/1.a/"), - ]; - for (var testcase in testcases) { - NoteLib note = gen.noteOf(testcase.noteRoute); - expect(note.noteKey, testcase.key); - expect(note.asVariableName, testcase.asVariableName); - expect(note.asset, testcase.asset); - } - }); - test('absolute path', () { - gen = NotesGenerator( - packageBaseName: "flutter_web", - fs: fs, - projectDir: fs.directory("/n"), - ); - - var testcases = [ - (noteRoute: "/n/lib/notes/note.dart", key: "/", asVariableName: "root", asset: "lib/notes/"), - (noteRoute: "/n/lib/notes/a/note.dart", key: "/a", asVariableName: "a", asset: "lib/notes/a/"), - (noteRoute: "/n/lib/notes/a/b/note.dart", key: "/a/b", asVariableName: "a_b", asset: "lib/notes/a/b/"), - // number prefix may be use to sort - (noteRoute: "/n/lib/notes/1.a/note.dart", key: "/1.a", asVariableName: "a", asset: "lib/notes/1.a/"), - ]; - for (var testcase in testcases) { - NoteLib note = gen.noteOf(testcase.noteRoute); - expect(note.noteKey, testcase.key); - expect(note.asVariableName, testcase.asVariableName); - expect(note.asset, testcase.asset); - } - }); - }); - - group("gen cell app_info", () { - test('1', () async { - fs.file("/n/lib/notes/note.dart").writeAsStringSync("""import 'package:flutter/widgets.dart'; -import 'package:you_note_dart/note.dart'; - -build(BuildContext context, Pen print) { - print(const MD(r'''## cell 2''')); - print("in cell 2"); - - /// print.markdown is cell separator - print(const MD(r'''## cell 3''')); - print("in cell 3"); -} - """); - var noteLib = gen.noteOf("lib/notes/note.dart"); - // ignore: unused_local_variable - NoteParseResult noteGen = await noteLib.gen(); - // expect(noteGen.noteConf?.displayName, "/"); - }); - }); -}