@simonklee/opentui-tex-native-source 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +674 -0
- package/LICENSE-PROJECT +21 -0
- package/README.md +7 -0
- package/build.zig +112 -0
- package/build.zig.zon +12 -0
- package/native/lib.zig +280 -0
- package/native/nanosvg.c +4 -0
- package/native/vendor/.bootstrap-v5 +1 -0
- package/native/vendor/LICENSE-NANOSVG +18 -0
- package/native/vendor/microtex/.clang-format +26 -0
- package/native/vendor/microtex/.github/workflows/ubuntu.yml +92 -0
- package/native/vendor/microtex/.github/workflows/windows-gdi.yml +34 -0
- package/native/vendor/microtex/.github/workflows/windows-qt.yml +52 -0
- package/native/vendor/microtex/CMakeLists.txt +110 -0
- package/native/vendor/microtex/LICENSE +21 -0
- package/native/vendor/microtex/MicroTeXInstall.cmake +42 -0
- package/native/vendor/microtex/README.md +600 -0
- package/native/vendor/microtex/build.zig +209 -0
- package/native/vendor/microtex/clatexmath.wrap +6 -0
- package/native/vendor/microtex/doc/meson.build +38 -0
- package/native/vendor/microtex/doc/microtex-doc.toml.in +47 -0
- package/native/vendor/microtex/doc/microtex.svg +39 -0
- package/native/vendor/microtex/doc/urlmap.js +6 -0
- package/native/vendor/microtex/example/gtk/CMakeLists.txt +68 -0
- package/native/vendor/microtex/example/gtk/gtk_main.c +170 -0
- package/native/vendor/microtex/example/gtk/isamples.cpp +21 -0
- package/native/vendor/microtex/example/gtk/isamples.h +15 -0
- package/native/vendor/microtex/example/gtk/meson.build +27 -0
- package/native/vendor/microtex/example/gtk/microtex-gtk.gresource.xml +6 -0
- package/native/vendor/microtex/example/gtk/microtex-gtk.ui +117 -0
- package/native/vendor/microtex/example/gtkmm/CMakeLists.txt +19 -0
- package/native/vendor/microtex/example/gtkmm/gtkmm_main.cpp +531 -0
- package/native/vendor/microtex/example/gtkmm/meson.build +19 -0
- package/native/vendor/microtex/example/memcheck/CMakeLists.txt +12 -0
- package/native/vendor/microtex/example/memcheck/mem_check_main.cpp +154 -0
- package/native/vendor/microtex/example/qt/CMakeLists.txt +37 -0
- package/native/vendor/microtex/example/qt/meson.build +25 -0
- package/native/vendor/microtex/example/qt/qt_main.cpp +70 -0
- package/native/vendor/microtex/example/qt/qt_mainwindow.cpp +107 -0
- package/native/vendor/microtex/example/qt/qt_mainwindow.h +40 -0
- package/native/vendor/microtex/example/qt/qt_skiatexwidget.cpp +149 -0
- package/native/vendor/microtex/example/qt/qt_skiatexwidget.h +48 -0
- package/native/vendor/microtex/example/qt/qt_tex_render.h +15 -0
- package/native/vendor/microtex/example/qt/qt_texqmlitem.cpp +56 -0
- package/native/vendor/microtex/example/qt/qt_texqmlitem.h +31 -0
- package/native/vendor/microtex/example/qt/qt_texwidget.cpp +62 -0
- package/native/vendor/microtex/example/qt/qt_texwidget.h +31 -0
- package/native/vendor/microtex/example/qtpng/CMakeLists.txt +11 -0
- package/native/vendor/microtex/example/qtpng/latex2png.cpp +115 -0
- package/native/vendor/microtex/example/samples/samples.cpp +52 -0
- package/native/vendor/microtex/example/samples/samples.h +32 -0
- package/native/vendor/microtex/example/win32/CMakeLists.txt +15 -0
- package/native/vendor/microtex/example/win32/meson.build +18 -0
- package/native/vendor/microtex/example/win32/win32_main.cpp +375 -0
- package/native/vendor/microtex/githooks/pre-commit +19 -0
- package/native/vendor/microtex/githooks/pre-push +103 -0
- package/native/vendor/microtex/lib/CMakeLists.txt +234 -0
- package/native/vendor/microtex/lib/atom/atom.cpp +14 -0
- package/native/vendor/microtex/lib/atom/atom.h +96 -0
- package/native/vendor/microtex/lib/atom/atom_accent.cpp +115 -0
- package/native/vendor/microtex/lib/atom/atom_accent.h +53 -0
- package/native/vendor/microtex/lib/atom/atom_basic.cpp +146 -0
- package/native/vendor/microtex/lib/atom/atom_basic.h +273 -0
- package/native/vendor/microtex/lib/atom/atom_box.cpp +41 -0
- package/native/vendor/microtex/lib/atom/atom_box.h +70 -0
- package/native/vendor/microtex/lib/atom/atom_char.cpp +99 -0
- package/native/vendor/microtex/lib/atom/atom_char.h +147 -0
- package/native/vendor/microtex/lib/atom/atom_delim.cpp +65 -0
- package/native/vendor/microtex/lib/atom/atom_delim.h +58 -0
- package/native/vendor/microtex/lib/atom/atom_fence.cpp +65 -0
- package/native/vendor/microtex/lib/atom/atom_fence.h +56 -0
- package/native/vendor/microtex/lib/atom/atom_font.cpp +20 -0
- package/native/vendor/microtex/lib/atom/atom_font.h +49 -0
- package/native/vendor/microtex/lib/atom/atom_frac.cpp +101 -0
- package/native/vendor/microtex/lib/atom/atom_frac.h +42 -0
- package/native/vendor/microtex/lib/atom/atom_matrix.cpp +756 -0
- package/native/vendor/microtex/lib/atom/atom_matrix.h +268 -0
- package/native/vendor/microtex/lib/atom/atom_misc.cpp +230 -0
- package/native/vendor/microtex/lib/atom/atom_misc.h +200 -0
- package/native/vendor/microtex/lib/atom/atom_operator.cpp +51 -0
- package/native/vendor/microtex/lib/atom/atom_operator.h +41 -0
- package/native/vendor/microtex/lib/atom/atom_root.cpp +61 -0
- package/native/vendor/microtex/lib/atom/atom_root.h +27 -0
- package/native/vendor/microtex/lib/atom/atom_row.cpp +334 -0
- package/native/vendor/microtex/lib/atom/atom_row.h +176 -0
- package/native/vendor/microtex/lib/atom/atom_scripts.cpp +182 -0
- package/native/vendor/microtex/lib/atom/atom_scripts.h +52 -0
- package/native/vendor/microtex/lib/atom/atom_sideset.cpp +92 -0
- package/native/vendor/microtex/lib/atom/atom_sideset.h +24 -0
- package/native/vendor/microtex/lib/atom/atom_space.cpp +22 -0
- package/native/vendor/microtex/lib/atom/atom_space.h +38 -0
- package/native/vendor/microtex/lib/atom/atom_stack.cpp +117 -0
- package/native/vendor/microtex/lib/atom/atom_stack.h +103 -0
- package/native/vendor/microtex/lib/atom/atom_text.cpp +17 -0
- package/native/vendor/microtex/lib/atom/atom_text.h +33 -0
- package/native/vendor/microtex/lib/atom/atom_vrow.cpp +96 -0
- package/native/vendor/microtex/lib/atom/atom_vrow.h +47 -0
- package/native/vendor/microtex/lib/atom/atom_zstack.cpp +66 -0
- package/native/vendor/microtex/lib/atom/atom_zstack.h +37 -0
- package/native/vendor/microtex/lib/atom/colors_def.cpp +157 -0
- package/native/vendor/microtex/lib/atom/meson.build +50 -0
- package/native/vendor/microtex/lib/box/box.cpp +49 -0
- package/native/vendor/microtex/lib/box/box.h +184 -0
- package/native/vendor/microtex/lib/box/box_factory.cpp +162 -0
- package/native/vendor/microtex/lib/box/box_factory.h +24 -0
- package/native/vendor/microtex/lib/box/box_group.cpp +503 -0
- package/native/vendor/microtex/lib/box/box_group.h +285 -0
- package/native/vendor/microtex/lib/box/box_single.cpp +179 -0
- package/native/vendor/microtex/lib/box/box_single.h +157 -0
- package/native/vendor/microtex/lib/box/meson.build +15 -0
- package/native/vendor/microtex/lib/core/debug_config.cpp +3 -0
- package/native/vendor/microtex/lib/core/debug_config.h +24 -0
- package/native/vendor/microtex/lib/core/formula.cpp +180 -0
- package/native/vendor/microtex/lib/core/formula.h +137 -0
- package/native/vendor/microtex/lib/core/formula_def.cpp +167 -0
- package/native/vendor/microtex/lib/core/glue.cpp +108 -0
- package/native/vendor/microtex/lib/core/glue.h +55 -0
- package/native/vendor/microtex/lib/core/localized_num.cpp +51 -0
- package/native/vendor/microtex/lib/core/meson.build +19 -0
- package/native/vendor/microtex/lib/core/parser.cpp +874 -0
- package/native/vendor/microtex/lib/core/parser.h +306 -0
- package/native/vendor/microtex/lib/core/split.cpp +185 -0
- package/native/vendor/microtex/lib/core/split.h +40 -0
- package/native/vendor/microtex/lib/env/env.cpp +141 -0
- package/native/vendor/microtex/lib/env/env.h +221 -0
- package/native/vendor/microtex/lib/env/meson.build +11 -0
- package/native/vendor/microtex/lib/env/units.cpp +109 -0
- package/native/vendor/microtex/lib/env/units.h +61 -0
- package/native/vendor/microtex/lib/graphic/font_style.cpp +63 -0
- package/native/vendor/microtex/lib/graphic/font_style.h +61 -0
- package/native/vendor/microtex/lib/graphic/graphic.cpp +38 -0
- package/native/vendor/microtex/lib/graphic/graphic.h +314 -0
- package/native/vendor/microtex/lib/graphic/graphic_basic.cpp +44 -0
- package/native/vendor/microtex/lib/graphic/graphic_basic.h +131 -0
- package/native/vendor/microtex/lib/graphic/meson.build +13 -0
- package/native/vendor/microtex/lib/macro/macro.cpp +143 -0
- package/native/vendor/microtex/lib/macro/macro.h +155 -0
- package/native/vendor/microtex/lib/macro/macro_accent.cpp +50 -0
- package/native/vendor/microtex/lib/macro/macro_accent.h +61 -0
- package/native/vendor/microtex/lib/macro/macro_boxes.h +68 -0
- package/native/vendor/microtex/lib/macro/macro_colors.cpp +42 -0
- package/native/vendor/microtex/lib/macro/macro_colors.h +42 -0
- package/native/vendor/microtex/lib/macro/macro_decl.h +16 -0
- package/native/vendor/microtex/lib/macro/macro_def.cpp +418 -0
- package/native/vendor/microtex/lib/macro/macro_delims.cpp +56 -0
- package/native/vendor/microtex/lib/macro/macro_delims.h +73 -0
- package/native/vendor/microtex/lib/macro/macro_env.h +212 -0
- package/native/vendor/microtex/lib/macro/macro_fonts.cpp +53 -0
- package/native/vendor/microtex/lib/macro/macro_fonts.h +78 -0
- package/native/vendor/microtex/lib/macro/macro_frac.cpp +138 -0
- package/native/vendor/microtex/lib/macro/macro_frac.h +50 -0
- package/native/vendor/microtex/lib/macro/macro_misc.cpp +211 -0
- package/native/vendor/microtex/lib/macro/macro_misc.h +217 -0
- package/native/vendor/microtex/lib/macro/macro_scripts.cpp +32 -0
- package/native/vendor/microtex/lib/macro/macro_scripts.h +17 -0
- package/native/vendor/microtex/lib/macro/macro_sizes.h +110 -0
- package/native/vendor/microtex/lib/macro/macro_space.cpp +31 -0
- package/native/vendor/microtex/lib/macro/macro_space.h +17 -0
- package/native/vendor/microtex/lib/macro/macro_styles.cpp +45 -0
- package/native/vendor/microtex/lib/macro/macro_styles.h +22 -0
- package/native/vendor/microtex/lib/macro/macro_types.h +48 -0
- package/native/vendor/microtex/lib/macro/meson.build +33 -0
- package/native/vendor/microtex/lib/meson.build +102 -0
- package/native/vendor/microtex/lib/microtex.cpp +208 -0
- package/native/vendor/microtex/lib/microtex.h +225 -0
- package/native/vendor/microtex/lib/microtexConfig.cmake.in +2 -0
- package/native/vendor/microtex/lib/microtexapi.h +22 -0
- package/native/vendor/microtex/lib/microtexconfig.h.in +7 -0
- package/native/vendor/microtex/lib/microtexexport.h +31 -0
- package/native/vendor/microtex/lib/otf/clm.cpp +405 -0
- package/native/vendor/microtex/lib/otf/clm.h +61 -0
- package/native/vendor/microtex/lib/otf/fontsense.cpp +191 -0
- package/native/vendor/microtex/lib/otf/fontsense.h +20 -0
- package/native/vendor/microtex/lib/otf/glyph.cpp +53 -0
- package/native/vendor/microtex/lib/otf/glyph.h +384 -0
- package/native/vendor/microtex/lib/otf/math_consts.h +154 -0
- package/native/vendor/microtex/lib/otf/meson.build +18 -0
- package/native/vendor/microtex/lib/otf/otf.cpp +84 -0
- package/native/vendor/microtex/lib/otf/otf.h +177 -0
- package/native/vendor/microtex/lib/otf/otfconfig.h +32 -0
- package/native/vendor/microtex/lib/otf/path.cpp +187 -0
- package/native/vendor/microtex/lib/otf/path.h +120 -0
- package/native/vendor/microtex/lib/render/builder.cpp +68 -0
- package/native/vendor/microtex/lib/render/builder.h +73 -0
- package/native/vendor/microtex/lib/render/meson.build +11 -0
- package/native/vendor/microtex/lib/render/render.cpp +136 -0
- package/native/vendor/microtex/lib/render/render.h +59 -0
- package/native/vendor/microtex/lib/unimath/font_meta.h +22 -0
- package/native/vendor/microtex/lib/unimath/font_src.cpp +21 -0
- package/native/vendor/microtex/lib/unimath/font_src.h +61 -0
- package/native/vendor/microtex/lib/unimath/math_type.cpp +318 -0
- package/native/vendor/microtex/lib/unimath/math_type.h +105 -0
- package/native/vendor/microtex/lib/unimath/meson.build +18 -0
- package/native/vendor/microtex/lib/unimath/uni_char.cpp +121 -0
- package/native/vendor/microtex/lib/unimath/uni_char.h +109 -0
- package/native/vendor/microtex/lib/unimath/uni_font.cpp +248 -0
- package/native/vendor/microtex/lib/unimath/uni_font.h +139 -0
- package/native/vendor/microtex/lib/unimath/uni_symbol.cpp +2929 -0
- package/native/vendor/microtex/lib/unimath/uni_symbol.h +31 -0
- package/native/vendor/microtex/lib/utils/dict_tree.h +68 -0
- package/native/vendor/microtex/lib/utils/exceptions.h +61 -0
- package/native/vendor/microtex/lib/utils/log.h +34 -0
- package/native/vendor/microtex/lib/utils/meson.build +18 -0
- package/native/vendor/microtex/lib/utils/nums.h +24 -0
- package/native/vendor/microtex/lib/utils/string_utils.cpp +85 -0
- package/native/vendor/microtex/lib/utils/string_utils.h +130 -0
- package/native/vendor/microtex/lib/utils/types.h +152 -0
- package/native/vendor/microtex/lib/utils/utf.cpp +115 -0
- package/native/vendor/microtex/lib/utils/utf.h +58 -0
- package/native/vendor/microtex/lib/utils/utils.cpp +40 -0
- package/native/vendor/microtex/lib/utils/utils.h +88 -0
- package/native/vendor/microtex/lib/wrapper/byte_seq.cpp +46 -0
- package/native/vendor/microtex/lib/wrapper/byte_seq.h +70 -0
- package/native/vendor/microtex/lib/wrapper/callback.cpp +10 -0
- package/native/vendor/microtex/lib/wrapper/callback.h +72 -0
- package/native/vendor/microtex/lib/wrapper/cwrapper.cpp +206 -0
- package/native/vendor/microtex/lib/wrapper/cwrapper.h +305 -0
- package/native/vendor/microtex/lib/wrapper/graphic_wrapper.cpp +211 -0
- package/native/vendor/microtex/lib/wrapper/graphic_wrapper.h +159 -0
- package/native/vendor/microtex/lib/wrapper/meson.build +22 -0
- package/native/vendor/microtex/meson.build +75 -0
- package/native/vendor/microtex/meson_options.txt +29 -0
- package/native/vendor/microtex/platform/cairo/CMakeLists.txt +36 -0
- package/native/vendor/microtex/platform/cairo/graphic_cairo.cpp +384 -0
- package/native/vendor/microtex/platform/cairo/graphic_cairo.h +119 -0
- package/native/vendor/microtex/platform/cairo/meson.build +47 -0
- package/native/vendor/microtex/platform/cairo/microtex-cairoConfig.cmake.in +11 -0
- package/native/vendor/microtex/platform/flutter/microtex/.metadata +10 -0
- package/native/vendor/microtex/platform/flutter/microtex/CHANGELOG.md +3 -0
- package/native/vendor/microtex/platform/flutter/microtex/LICENSE +1 -0
- package/native/vendor/microtex/platform/flutter/microtex/README.md +15 -0
- package/native/vendor/microtex/platform/flutter/microtex/analysis_options.yaml +4 -0
- package/native/vendor/microtex/platform/flutter/microtex/android/build.gradle +56 -0
- package/native/vendor/microtex/platform/flutter/microtex/android/settings.gradle +1 -0
- package/native/vendor/microtex/platform/flutter/microtex/android/src/main/AndroidManifest.xml +3 -0
- package/native/vendor/microtex/platform/flutter/microtex/android/src/main/kotlin/io/nano/microtex/microtex/MicrotexPlugin.kt +35 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/.metadata +10 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/README.md +16 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/analysis_options.yaml +31 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/android/app/build.gradle +68 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/android/app/src/debug/AndroidManifest.xml +7 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/android/app/src/main/AndroidManifest.xml +34 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/android/app/src/main/kotlin/io/nano/microtex/microtex_example/MainActivity.kt +6 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/android/app/src/main/res/drawable/launch_background.xml +12 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/android/app/src/main/res/drawable-v21/launch_background.xml +12 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png +0 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png +0 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png +0 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png +0 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/android/app/src/main/res/values/styles.xml +18 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/android/app/src/main/res/values-night/styles.xml +18 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/android/app/src/profile/AndroidManifest.xml +7 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/android/build.gradle +31 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/android/gradle/wrapper/gradle-wrapper.properties +6 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/android/gradle.properties +3 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/android/settings.gradle +11 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/ios/Flutter/AppFrameworkInfo.plist +26 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/ios/Flutter/Debug.xcconfig +2 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/ios/Flutter/Release.xcconfig +2 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/ios/Podfile +41 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/ios/Podfile.lock +22 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner/AppDelegate.swift +13 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json +122 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png +0 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png +0 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png +0 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png +0 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png +0 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png +0 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png +0 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png +0 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png +0 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png +0 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png +0 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png +0 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png +0 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png +0 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png +0 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json +23 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png +0 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png +0 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png +0 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md +5 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner/Base.lproj/LaunchScreen.storyboard +37 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner/Base.lproj/Main.storyboard +26 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner/Info.plist +49 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner/Runner-Bridging-Header.h +1 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner.xcodeproj/project.pbxproj +549 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings +8 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +87 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner.xcworkspace/contents.xcworkspacedata +10 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings +8 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/lib/main.dart +23 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/lib/screen/edit_in_one.dart +0 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/lib/screen/edit_screen.dart +208 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/lib/utils/convert_spans.dart +63 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/lib/utils/string_ext.dart +10 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/lib/widget/cmp.dart +118 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/lib/widget/draggable.dart +75 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/lib/widget/rich.dart +23 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/lib/widget/split.dart +72 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/lib/widget/tex_highlight_controller.dart +66 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/lib/widget/tex_input_controller.dart +19 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/linux/CMakeLists.txt +116 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/linux/flutter/CMakeLists.txt +87 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/linux/flutter/generated_plugin_registrant.cc +15 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/linux/flutter/generated_plugin_registrant.h +15 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/linux/flutter/generated_plugins.cmake +24 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/linux/main.cc +6 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/linux/my_application.cc +104 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/linux/my_application.h +18 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/macos/Flutter/Flutter-Debug.xcconfig +2 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/macos/Flutter/Flutter-Release.xcconfig +2 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/macos/Flutter/GeneratedPluginRegistrant.swift +12 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/macos/Podfile +40 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/macos/Podfile.lock +22 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/macos/Runner/AppDelegate.swift +9 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json +68 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png +0 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png +0 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png +0 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png +0 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png +0 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png +0 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png +0 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/macos/Runner/Base.lproj/MainMenu.xib +343 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/macos/Runner/Configs/AppInfo.xcconfig +14 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/macos/Runner/Configs/Debug.xcconfig +2 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/macos/Runner/Configs/Release.xcconfig +2 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/macos/Runner/Configs/Warnings.xcconfig +13 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/macos/Runner/DebugProfile.entitlements +12 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/macos/Runner/Info.plist +32 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/macos/Runner/MainFlutterWindow.swift +15 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/macos/Runner/Release.entitlements +8 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/macos/Runner.xcodeproj/project.pbxproj +633 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +87 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/macos/Runner.xcworkspace/contents.xcworkspacedata +10 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/pubspec.lock +191 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/pubspec.yaml +56 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/test/widget_test.dart +26 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/windows/CMakeLists.txt +95 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/windows/flutter/CMakeLists.txt +103 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/windows/flutter/generated_plugin_registrant.cc +14 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/windows/flutter/generated_plugin_registrant.h +15 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/windows/flutter/generated_plugins.cmake +24 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/windows/runner/CMakeLists.txt +17 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/windows/runner/Runner.rc +121 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/windows/runner/flutter_window.cpp +61 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/windows/runner/flutter_window.h +33 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/windows/runner/main.cpp +43 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/windows/runner/resource.h +16 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/windows/runner/resources/app_icon.ico +0 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/windows/runner/runner.exe.manifest +20 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/windows/runner/utils.cpp +64 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/windows/runner/utils.h +19 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/windows/runner/win32_window.cpp +245 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/windows/runner/win32_window.h +98 -0
- package/native/vendor/microtex/platform/flutter/microtex/ios/Assets/.gitkeep +0 -0
- package/native/vendor/microtex/platform/flutter/microtex/ios/Classes/MicrotexPlugin.h +4 -0
- package/native/vendor/microtex/platform/flutter/microtex/ios/Classes/MicrotexPlugin.m +19 -0
- package/native/vendor/microtex/platform/flutter/microtex/ios/Classes/SwiftMicrotexPlugin.swift +14 -0
- package/native/vendor/microtex/platform/flutter/microtex/ios/Classes/dummy.h +4 -0
- package/native/vendor/microtex/platform/flutter/microtex/ios/microtex.podspec +27 -0
- package/native/vendor/microtex/platform/flutter/microtex/lib/microtex.dart +7 -0
- package/native/vendor/microtex/platform/flutter/microtex/lib/src/bindings.dart +218 -0
- package/native/vendor/microtex/platform/flutter/microtex/lib/src/bounds.dart +10 -0
- package/native/vendor/microtex/platform/flutter/microtex/lib/src/context.dart +205 -0
- package/native/vendor/microtex/platform/flutter/microtex/lib/src/fontdesc.dart +14 -0
- package/native/vendor/microtex/platform/flutter/microtex/lib/src/fontmeta.dart +14 -0
- package/native/vendor/microtex/platform/flutter/microtex/lib/src/pathcache.dart +17 -0
- package/native/vendor/microtex/platform/flutter/microtex/lib/src/render.dart +291 -0
- package/native/vendor/microtex/platform/flutter/microtex/lib/src/texstyle.dart +11 -0
- package/native/vendor/microtex/platform/flutter/microtex/lib/src/textlayout.dart +93 -0
- package/native/vendor/microtex/platform/flutter/microtex/lib/src/widget.dart +163 -0
- package/native/vendor/microtex/platform/flutter/microtex/linux/CMakeLists.txt +33 -0
- package/native/vendor/microtex/platform/flutter/microtex/linux/include/microtex/microtex_plugin.h +26 -0
- package/native/vendor/microtex/platform/flutter/microtex/linux/microtex_plugin.cc +70 -0
- package/native/vendor/microtex/platform/flutter/microtex/macos/Classes/MicrotexPlugin.swift +20 -0
- package/native/vendor/microtex/platform/flutter/microtex/macos/Classes/dummy.h +4 -0
- package/native/vendor/microtex/platform/flutter/microtex/macos/Classes/microtex-Bridging-Header.h +1 -0
- package/native/vendor/microtex/platform/flutter/microtex/macos/microtex.podspec +26 -0
- package/native/vendor/microtex/platform/flutter/microtex/nativelib/CMakeLists.txt +44 -0
- package/native/vendor/microtex/platform/flutter/microtex/nativelib/builddarwin.sh +108 -0
- package/native/vendor/microtex/platform/flutter/microtex/pubspec.yaml +37 -0
- package/native/vendor/microtex/platform/flutter/microtex/test/microtex_test.dart +23 -0
- package/native/vendor/microtex/platform/flutter/microtex/windows/CMakeLists.txt +32 -0
- package/native/vendor/microtex/platform/flutter/microtex/windows/include/microtex/microtex_plugin.h +23 -0
- package/native/vendor/microtex/platform/flutter/microtex/windows/microtex_plugin.cpp +82 -0
- package/native/vendor/microtex/platform/gdi_win/CMakeLists.txt +20 -0
- package/native/vendor/microtex/platform/gdi_win/graphic_win32.cpp +352 -0
- package/native/vendor/microtex/platform/gdi_win/graphic_win32.h +137 -0
- package/native/vendor/microtex/platform/gdi_win/meson.build +39 -0
- package/native/vendor/microtex/platform/gtk/CMakeLists.txt +36 -0
- package/native/vendor/microtex/platform/gtk/meson.build +65 -0
- package/native/vendor/microtex/platform/gtk/microtex-gtkConfig.cmake.in +11 -0
- package/native/vendor/microtex/platform/gtk/microtexequation.cpp +708 -0
- package/native/vendor/microtex/platform/gtk/microtexequation.h +72 -0
- package/native/vendor/microtex/platform/qt/CMakeLists.txt +37 -0
- package/native/vendor/microtex/platform/qt/graphic_qt.cpp +355 -0
- package/native/vendor/microtex/platform/qt/graphic_qt.h +116 -0
- package/native/vendor/microtex/platform/qt/meson.build +38 -0
- package/native/vendor/microtex/platform/qt/microtex-qtConfig.cmake.in +7 -0
- package/native/vendor/microtex/platform/skia/CMakeLists.txt +46 -0
- package/native/vendor/microtex/platform/skia/graphic_skia.cpp +306 -0
- package/native/vendor/microtex/platform/skia/graphic_skia.h +125 -0
- package/native/vendor/microtex/platform/skia/microtex-skiaConfig.cmake.in +6 -0
- package/native/vendor/microtex/platform/wasm/CMakeLists.txt +38 -0
- package/native/vendor/microtex/platform/wasm/emscripten.cross +31 -0
- package/native/vendor/microtex/platform/wasm/main.cpp +15 -0
- package/native/vendor/microtex/platform/wasm/meson.build +8 -0
- package/native/vendor/microtex/platform/wasm/prebuild-example-meson.sh +21 -0
- package/native/vendor/microtex/platform/wasm/prebuild-example.sh +21 -0
- package/native/vendor/microtex/platform/wasm/prebuild-lib-meson.sh +28 -0
- package/native/vendor/microtex/platform/wasm/prebuild-lib.sh +31 -0
- package/native/vendor/microtex/platform/wasm/web/.babelrc +10 -0
- package/native/vendor/microtex/platform/wasm/web/example/examples.js +43 -0
- package/native/vendor/microtex/platform/wasm/web/example/hello.js +31 -0
- package/native/vendor/microtex/platform/wasm/web/example/index.html +55 -0
- package/native/vendor/microtex/platform/wasm/web/example/index.js +243 -0
- package/native/vendor/microtex/platform/wasm/web/example/styles.css +86 -0
- package/native/vendor/microtex/platform/wasm/web/example/utils.js +47 -0
- package/native/vendor/microtex/platform/wasm/web/lib/context.js +271 -0
- package/native/vendor/microtex/platform/wasm/web/lib/index.js +10 -0
- package/native/vendor/microtex/platform/wasm/web/lib/render.js +293 -0
- package/native/vendor/microtex/platform/wasm/web/lib/runtime.js +14 -0
- package/native/vendor/microtex/platform/wasm/web/lib/svg.js +237 -0
- package/native/vendor/microtex/platform/wasm/web/lib/textlayout.js +88 -0
- package/native/vendor/microtex/platform/wasm/web/package-lock.json +5931 -0
- package/native/vendor/microtex/platform/wasm/web/package.json +45 -0
- package/native/vendor/microtex/platform/wasm/web/publish-example.sh +17 -0
- package/native/vendor/microtex/platform/wasm/web/rollup.config.example.js +24 -0
- package/native/vendor/microtex/platform/wasm/web/rollup.config.lib.js +16 -0
- package/native/vendor/microtex/prebuilt/otf2clm.py +807 -0
- package/native/vendor/microtex/prebuilt/otf2clm.sh +9 -0
- package/native/vendor/microtex/prebuilt/preclms.sh +17 -0
- package/native/vendor/microtex/readme/example_bw_false.svg +680 -0
- package/native/vendor/microtex/readme/example_bw_true.svg +680 -0
- package/native/vendor/microtex/readme/example_cjk_trying.svg +54 -0
- package/native/vendor/microtex/readme/example_custom_symbols.svg +92 -0
- package/native/vendor/microtex/readme/example_debug.svg +764 -0
- package/native/vendor/microtex/readme/example_emoji.svg +199 -0
- package/native/vendor/microtex/readme/example_have_log.svg +79 -0
- package/native/vendor/microtex/readme/example_keep_trying.svg +101 -0
- package/native/vendor/microtex/readme/example_logos.svg +50 -0
- package/native/vendor/microtex/readme/example_ubuntu.png +0 -0
- package/native/vendor/microtex/readme/example_windows.png +0 -0
- package/native/vendor/microtex/readme/samples/sample_0.svg +665 -0
- package/native/vendor/microtex/readme/samples/sample_1.svg +1259 -0
- package/native/vendor/microtex/readme/samples/sample_10.svg +333 -0
- package/native/vendor/microtex/readme/samples/sample_11.svg +306 -0
- package/native/vendor/microtex/readme/samples/sample_2.svg +2461 -0
- package/native/vendor/microtex/readme/samples/sample_3.svg +2653 -0
- package/native/vendor/microtex/readme/samples/sample_4.svg +554 -0
- package/native/vendor/microtex/readme/samples/sample_5.svg +247 -0
- package/native/vendor/microtex/readme/samples/sample_6.svg +1082 -0
- package/native/vendor/microtex/readme/samples/sample_7.svg +518 -0
- package/native/vendor/microtex/readme/samples/sample_8.svg +529 -0
- package/native/vendor/microtex/readme/samples/sample_9.svg +1702 -0
- package/native/vendor/microtex/readme/samples.md +301 -0
- package/native/vendor/microtex/readme/tex_logo.svg +19 -0
- package/native/vendor/microtex/res/EXAMPLE.txt +25 -0
- package/native/vendor/microtex/res/SAMPLES.tex +946 -0
- package/native/vendor/microtex/res/firamath/FiraMath-Regular.clm1 +0 -0
- package/native/vendor/microtex/res/firamath/FiraMath-Regular.clm2 +0 -0
- package/native/vendor/microtex/res/firamath/FiraMath-Regular.otf +0 -0
- package/native/vendor/microtex/res/firamath/README.md +42 -0
- package/native/vendor/microtex/res/lm-math/README +92 -0
- package/native/vendor/microtex/res/lm-math/latinmodern-math.clm1 +0 -0
- package/native/vendor/microtex/res/lm-math/latinmodern-math.clm2 +0 -0
- package/native/vendor/microtex/res/lm-math/latinmodern-math.otf +0 -0
- package/native/vendor/microtex/res/tex-gyre/README-TeX-Gyre-DejaVu-Math.txt +82 -0
- package/native/vendor/microtex/res/tex-gyre/texgyredejavu-math.clm1 +0 -0
- package/native/vendor/microtex/res/tex-gyre/texgyredejavu-math.clm2 +0 -0
- package/native/vendor/microtex/res/tex-gyre/texgyredejavu-math.otf +0 -0
- package/native/vendor/microtex/res/xits/FONTLOG.txt +246 -0
- package/native/vendor/microtex/res/xits/OFL.txt +98 -0
- package/native/vendor/microtex/res/xits/README.txt +15 -0
- package/native/vendor/microtex/res/xits/XITS-Bold.clm1 +0 -0
- package/native/vendor/microtex/res/xits/XITS-Bold.clm2 +0 -0
- package/native/vendor/microtex/res/xits/XITS-Bold.otf +0 -0
- package/native/vendor/microtex/res/xits/XITS-BoldItalic.clm1 +0 -0
- package/native/vendor/microtex/res/xits/XITS-BoldItalic.clm2 +0 -0
- package/native/vendor/microtex/res/xits/XITS-BoldItalic.otf +0 -0
- package/native/vendor/microtex/res/xits/XITS-Italic.clm1 +0 -0
- package/native/vendor/microtex/res/xits/XITS-Italic.clm2 +0 -0
- package/native/vendor/microtex/res/xits/XITS-Italic.otf +0 -0
- package/native/vendor/microtex/res/xits/XITS-Regular.clm1 +0 -0
- package/native/vendor/microtex/res/xits/XITS-Regular.clm2 +0 -0
- package/native/vendor/microtex/res/xits/XITS-Regular.otf +0 -0
- package/native/vendor/microtex/res/xits/XITSMath-Bold.clm1 +0 -0
- package/native/vendor/microtex/res/xits/XITSMath-Bold.clm2 +0 -0
- package/native/vendor/microtex/res/xits/XITSMath-Bold.otf +0 -0
- package/native/vendor/microtex/res/xits/XITSMath-Regular.clm1 +0 -0
- package/native/vendor/microtex/res/xits/XITSMath-Regular.clm2 +0 -0
- package/native/vendor/microtex/res/xits/XITSMath-Regular.otf +0 -0
- package/native/vendor/microtex/test/clm/meson.build +10 -0
- package/native/vendor/microtex/test/clm/test_clm.cpp +140 -0
- package/native/vendor/microtex/test/env/meson.build +10 -0
- package/native/vendor/microtex/test/env/test_env.cpp +100 -0
- package/native/vendor/microtex/test/fuzzer/afl.native +20 -0
- package/native/vendor/microtex/test/fuzzer/fuzz.sh +135 -0
- package/native/vendor/microtex/test/fuzzer/fuzzer.cpp +61 -0
- package/native/vendor/microtex/test/fuzzer/generateSeed.java +33 -0
- package/native/vendor/microtex/test/fuzzer/meson.build +9 -0
- package/native/vendor/microtex/test/fuzzer/microtex.dict +3708 -0
- package/native/vendor/microtex/test/fuzzer/platform_none.cpp +100 -0
- package/native/vendor/microtex/test/has_filesystem.cpp +8 -0
- package/native/vendor/microtex/test/meson.build +6 -0
- package/native/vendor/nanosvg.h +3278 -0
- package/native/vendor/nanosvgrast.h +1472 -0
- package/native/vendor/zigtex/.github/assets/example.svg +27 -0
- package/native/vendor/zigtex/LICENSE +674 -0
- package/native/vendor/zigtex/README.md +52 -0
- package/native/vendor/zigtex/build.zig +52 -0
- package/native/vendor/zigtex/build.zig.zon +16 -0
- package/native/vendor/zigtex/fonts/latinmodern-math.clm2 +0 -0
- package/native/vendor/zigtex/src/main.zig +22 -0
- package/native/vendor/zigtex/src/root.zig +124 -0
- package/native/vendor/zigtex/src/svg.zig +273 -0
- package/native/vendor/zigtex/src/tex.zig +383 -0
- package/native/zigtex-0.16.patch +35 -0
- package/package.json +27 -0
- package/scripts/bootstrap-native +89 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import 'package:flutter/material.dart';
|
|
2
|
+
import 'package:flutter/rendering.dart';
|
|
3
|
+
|
|
4
|
+
import 'package:microtex/microtex.dart';
|
|
5
|
+
import 'package:microtex_example/screen/edit_screen.dart';
|
|
6
|
+
import 'package:microtex_example/widget/cmp.dart';
|
|
7
|
+
|
|
8
|
+
void main() async {
|
|
9
|
+
WidgetsFlutterBinding.ensureInitialized();
|
|
10
|
+
await MicroTeX().initialize(
|
|
11
|
+
clmAsset: 'assets/xits/XITSMath-Regular.clm2',
|
|
12
|
+
textLayoutSerif: 'Noto Color Emoji',
|
|
13
|
+
textLayoutSansSerif: 'Noto Color Emoji',
|
|
14
|
+
textLayoutMonospace: 'Noto Color Emoji',
|
|
15
|
+
);
|
|
16
|
+
debugMicroTeX = true;
|
|
17
|
+
runApp(
|
|
18
|
+
const MaterialApp(
|
|
19
|
+
debugShowCheckedModeBanner: false,
|
|
20
|
+
home: EditScreen(),
|
|
21
|
+
),
|
|
22
|
+
);
|
|
23
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
import 'dart:async';
|
|
2
|
+
|
|
3
|
+
import 'package:flutter/material.dart';
|
|
4
|
+
import 'package:flutter/services.dart';
|
|
5
|
+
import 'package:flutter_spinbox/material.dart';
|
|
6
|
+
import 'package:microtex/microtex.dart';
|
|
7
|
+
import 'package:microtex_example/widget/rich.dart';
|
|
8
|
+
import 'package:microtex_example/widget/split.dart';
|
|
9
|
+
import 'package:microtex_example/widget/tex_highlight_controller.dart';
|
|
10
|
+
|
|
11
|
+
class _Settings {
|
|
12
|
+
String mode;
|
|
13
|
+
String mainFontFamily;
|
|
14
|
+
String mathFont;
|
|
15
|
+
double textSize;
|
|
16
|
+
|
|
17
|
+
_Settings(this.mode, this.mainFontFamily, this.mathFont, this.textSize);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
class EditScreen extends StatefulWidget {
|
|
21
|
+
const EditScreen({Key? key}) : super(key: key);
|
|
22
|
+
|
|
23
|
+
@override
|
|
24
|
+
State<EditScreen> createState() => _EditScreenState();
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
class _EditScreenState extends State<EditScreen> {
|
|
28
|
+
final _controller = StreamController<String>();
|
|
29
|
+
|
|
30
|
+
@override
|
|
31
|
+
dispose() {
|
|
32
|
+
super.dispose();
|
|
33
|
+
_controller.close();
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
@override
|
|
37
|
+
Widget build(BuildContext context) {
|
|
38
|
+
return Scaffold(
|
|
39
|
+
appBar: AppBar(
|
|
40
|
+
title: const Text('MicroTeX Example'),
|
|
41
|
+
actions: [
|
|
42
|
+
Padding(
|
|
43
|
+
padding: const EdgeInsets.all(8.0),
|
|
44
|
+
child: IconButton(
|
|
45
|
+
icon: const Icon(Icons.settings),
|
|
46
|
+
onPressed: () => _showSettings(context),
|
|
47
|
+
),
|
|
48
|
+
),
|
|
49
|
+
],
|
|
50
|
+
),
|
|
51
|
+
body: SplitView(
|
|
52
|
+
left: _buildEditor(),
|
|
53
|
+
right: _buildRich(),
|
|
54
|
+
),
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
_section(
|
|
59
|
+
String title,
|
|
60
|
+
String selected,
|
|
61
|
+
List<String> sections,
|
|
62
|
+
void Function(String? value) onChanged,
|
|
63
|
+
) {
|
|
64
|
+
return [
|
|
65
|
+
Text(
|
|
66
|
+
title,
|
|
67
|
+
style: const TextStyle(fontWeight: FontWeight.w500, fontSize: 18),
|
|
68
|
+
),
|
|
69
|
+
...sections.map(
|
|
70
|
+
(e) => ListTile(
|
|
71
|
+
title: Text(e),
|
|
72
|
+
horizontalTitleGap: 0,
|
|
73
|
+
contentPadding: const EdgeInsets.only(left: 8),
|
|
74
|
+
leading: Radio(value: e, groupValue: selected, onChanged: onChanged),
|
|
75
|
+
),
|
|
76
|
+
)
|
|
77
|
+
];
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
_textSize() {
|
|
81
|
+
return SpinBox(
|
|
82
|
+
min: 10,
|
|
83
|
+
max: 200,
|
|
84
|
+
value: 20,
|
|
85
|
+
decoration: const InputDecoration(labelText: 'TextSize'),
|
|
86
|
+
onChanged: (value) => {},
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
_settings() {
|
|
91
|
+
return Column(
|
|
92
|
+
crossAxisAlignment: CrossAxisAlignment.start,
|
|
93
|
+
mainAxisSize: MainAxisSize.min,
|
|
94
|
+
children: [
|
|
95
|
+
..._section('Mode', 'text', ['text', 'LaTeX'], (value) {}),
|
|
96
|
+
..._section(
|
|
97
|
+
'Math Font',
|
|
98
|
+
MicroTeX().currentMathFontName,
|
|
99
|
+
MicroTeX().mathFonts.map((e) => e.fontName).toList(),
|
|
100
|
+
(value) {},
|
|
101
|
+
),
|
|
102
|
+
..._section(
|
|
103
|
+
'Main Font',
|
|
104
|
+
MicroTeX().currentMainFontFamilyName.isEmpty ? 'none' : MicroTeX().currentMainFontFamilyName,
|
|
105
|
+
MicroTeX().mainFonts.map((e) => e.fontFamily).toSet().toList() + ['none'],
|
|
106
|
+
(value) {},
|
|
107
|
+
),
|
|
108
|
+
Container(
|
|
109
|
+
constraints: const BoxConstraints(maxWidth: 300),
|
|
110
|
+
padding: const EdgeInsets.only(left: 10),
|
|
111
|
+
child: const Text(
|
|
112
|
+
'If you just want to use the math font to render the text '
|
|
113
|
+
'wrapped by command "text", just set it to "none".',
|
|
114
|
+
),
|
|
115
|
+
),
|
|
116
|
+
const SizedBox(height: 20),
|
|
117
|
+
_textSize(),
|
|
118
|
+
],
|
|
119
|
+
);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
Future<void> _showSettings(BuildContext context) async {
|
|
123
|
+
final navigator = Navigator.of(context);
|
|
124
|
+
final settings = await showDialog(
|
|
125
|
+
context: context,
|
|
126
|
+
builder: (context) {
|
|
127
|
+
return AlertDialog(
|
|
128
|
+
title: const Text('Settings'),
|
|
129
|
+
content: StatefulBuilder(builder: (context, setState) => _settings()),
|
|
130
|
+
actions: [
|
|
131
|
+
TextButton(
|
|
132
|
+
child: const Text('OK'),
|
|
133
|
+
onPressed: () {
|
|
134
|
+
navigator.pop('test');
|
|
135
|
+
},
|
|
136
|
+
),
|
|
137
|
+
],
|
|
138
|
+
);
|
|
139
|
+
},
|
|
140
|
+
);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
_buildRich() {
|
|
144
|
+
return SingleChildScrollView(
|
|
145
|
+
primary: false,
|
|
146
|
+
child: Padding(
|
|
147
|
+
padding: const EdgeInsets.all(16),
|
|
148
|
+
child: StreamBuilder(
|
|
149
|
+
stream: _controller.stream,
|
|
150
|
+
builder: (context, AsyncSnapshot<String> snapshot) {
|
|
151
|
+
final data = snapshot.data;
|
|
152
|
+
if (data == null) {
|
|
153
|
+
return const Text(
|
|
154
|
+
'Input sth...',
|
|
155
|
+
style: TextStyle(fontSize: 25),
|
|
156
|
+
);
|
|
157
|
+
}
|
|
158
|
+
return SimpleRichText(text: data);
|
|
159
|
+
},
|
|
160
|
+
),
|
|
161
|
+
),
|
|
162
|
+
);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
_buildEditor() {
|
|
166
|
+
return ConstrainedBox(
|
|
167
|
+
constraints: const BoxConstraints.expand(),
|
|
168
|
+
child: LayoutBuilder(builder: (context, constraints) {
|
|
169
|
+
return SingleChildScrollView(
|
|
170
|
+
child: ConstrainedBox(
|
|
171
|
+
constraints: BoxConstraints(
|
|
172
|
+
minWidth: constraints.maxWidth,
|
|
173
|
+
minHeight: constraints.maxHeight,
|
|
174
|
+
),
|
|
175
|
+
child: FutureBuilder(
|
|
176
|
+
future: rootBundle.loadString('assets/EXAMPLE.txt').then((value) {
|
|
177
|
+
_controller.sink.add(value);
|
|
178
|
+
return value;
|
|
179
|
+
}),
|
|
180
|
+
builder: (context, AsyncSnapshot<String> snapshot) {
|
|
181
|
+
return _buildTextField(snapshot.data);
|
|
182
|
+
},
|
|
183
|
+
),
|
|
184
|
+
),
|
|
185
|
+
);
|
|
186
|
+
}),
|
|
187
|
+
);
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
_buildTextField(String? txt) {
|
|
191
|
+
final controller = TeXHighlightController(text: txt);
|
|
192
|
+
// final controller = TeXInputController(text: txt);
|
|
193
|
+
return TextField(
|
|
194
|
+
controller: controller,
|
|
195
|
+
keyboardType: TextInputType.multiline,
|
|
196
|
+
maxLines: null,
|
|
197
|
+
style: const TextStyle(
|
|
198
|
+
fontFamily: 'Monaco',
|
|
199
|
+
fontFamilyFallback: ['Noto Color Emoji'],
|
|
200
|
+
),
|
|
201
|
+
decoration: const InputDecoration(
|
|
202
|
+
border: InputBorder.none,
|
|
203
|
+
contentPadding: EdgeInsets.all(16),
|
|
204
|
+
),
|
|
205
|
+
onChanged: (text) => _controller.sink.add(text),
|
|
206
|
+
);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import 'package:flutter/material.dart';
|
|
2
|
+
import 'package:microtex/microtex.dart';
|
|
3
|
+
|
|
4
|
+
class SpanConverter {
|
|
5
|
+
SpanConverter._();
|
|
6
|
+
|
|
7
|
+
static final _r = RegExp(r'\${1,2}[\s\S]*?\${1,2}');
|
|
8
|
+
static final _instance = SpanConverter._();
|
|
9
|
+
|
|
10
|
+
factory SpanConverter() {
|
|
11
|
+
return _instance;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
List<InlineSpan> buildSpans({
|
|
15
|
+
required String text,
|
|
16
|
+
required TextStyle style,
|
|
17
|
+
}) {
|
|
18
|
+
final children = <InlineSpan>[];
|
|
19
|
+
text.splitMapJoin(
|
|
20
|
+
_r,
|
|
21
|
+
onNonMatch: (span) {
|
|
22
|
+
if (span.isEmpty) return span;
|
|
23
|
+
children.add(TextSpan(text: span, style: style));
|
|
24
|
+
return span;
|
|
25
|
+
},
|
|
26
|
+
onMatch: (m) {
|
|
27
|
+
final tex = m[0] ?? '';
|
|
28
|
+
if (tex.isEmpty) return '';
|
|
29
|
+
final isInline = !tex.startsWith('\$\$');
|
|
30
|
+
children.add(WidgetSpan(
|
|
31
|
+
alignment: PlaceholderAlignment.baseline,
|
|
32
|
+
baseline: TextBaseline.alphabetic,
|
|
33
|
+
child: Padding(
|
|
34
|
+
padding: const EdgeInsets.symmetric(vertical: 8),
|
|
35
|
+
child: _buildLaTeX(tex, isInline, style),
|
|
36
|
+
),
|
|
37
|
+
));
|
|
38
|
+
return tex.toString();
|
|
39
|
+
},
|
|
40
|
+
);
|
|
41
|
+
return children;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
_buildLaTeX(String tex, bool isInline, TextStyle style) {
|
|
45
|
+
final t = LaTeX(
|
|
46
|
+
latex: tex,
|
|
47
|
+
textSize: style.fontSize ?? 14,
|
|
48
|
+
color: style.color ?? Colors.black,
|
|
49
|
+
style: TeXStyle.display,
|
|
50
|
+
isRenderGlyphUsePath: false,
|
|
51
|
+
);
|
|
52
|
+
if (isInline) {
|
|
53
|
+
return t;
|
|
54
|
+
}
|
|
55
|
+
return LayoutBuilder(builder: (context, constraints) {
|
|
56
|
+
print('build: ${constraints.maxWidth}');
|
|
57
|
+
return SizedBox(
|
|
58
|
+
width: constraints.maxWidth,
|
|
59
|
+
child: Center(child: t),
|
|
60
|
+
);
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
extension StringExt on String {
|
|
2
|
+
String takeUntil(bool Function(int j, String char) stop, [int from = 0, bool inclusive = false]) {
|
|
3
|
+
for (var i = from; i < length; i++) {
|
|
4
|
+
if (stop(i, this[i])) {
|
|
5
|
+
return substring(from, inclusive ? i + 1 : i);
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
return '';
|
|
9
|
+
}
|
|
10
|
+
}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import 'package:flutter/material.dart';
|
|
2
|
+
import 'package:microtex/microtex.dart';
|
|
3
|
+
|
|
4
|
+
class CmpRenderType extends StatelessWidget {
|
|
5
|
+
const CmpRenderType({Key? key}) : super(key: key);
|
|
6
|
+
|
|
7
|
+
@override
|
|
8
|
+
Widget build(BuildContext context) {
|
|
9
|
+
return Scaffold(
|
|
10
|
+
appBar: AppBar(
|
|
11
|
+
title: const Text('Compare render types'),
|
|
12
|
+
),
|
|
13
|
+
body: _buildCmp(),
|
|
14
|
+
);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
Widget _buildCmp() {
|
|
19
|
+
return Column(
|
|
20
|
+
mainAxisSize: MainAxisSize.min,
|
|
21
|
+
children: [
|
|
22
|
+
_buildRow(
|
|
23
|
+
'render by text',
|
|
24
|
+
() => const Text(
|
|
25
|
+
'Hello World!',
|
|
26
|
+
style: TextStyle(
|
|
27
|
+
fontSize: 200,
|
|
28
|
+
fontFamily: 'XITS Math',
|
|
29
|
+
color: Colors.black,
|
|
30
|
+
fontStyle: FontStyle.normal,
|
|
31
|
+
fontWeight: FontWeight.normal,
|
|
32
|
+
),
|
|
33
|
+
),
|
|
34
|
+
),
|
|
35
|
+
_buildRow(
|
|
36
|
+
'render by path with blur filter',
|
|
37
|
+
() => const LaTeX(
|
|
38
|
+
latex: "\\text{Hello World!}",
|
|
39
|
+
textSize: 200,
|
|
40
|
+
style: TeXStyle.text,
|
|
41
|
+
color: Colors.black,
|
|
42
|
+
blur: Blur(BlurStyle.normal, 0.5),
|
|
43
|
+
isRenderGlyphUsePath: true,
|
|
44
|
+
),
|
|
45
|
+
),
|
|
46
|
+
const SizedBox(height: 25),
|
|
47
|
+
_buildRow(
|
|
48
|
+
'render by path without blur filter',
|
|
49
|
+
() => const LaTeX(
|
|
50
|
+
latex: "\\text{Hello World!}",
|
|
51
|
+
textSize: 200,
|
|
52
|
+
style: TeXStyle.text,
|
|
53
|
+
color: Colors.black,
|
|
54
|
+
isRenderGlyphUsePath: true,
|
|
55
|
+
),
|
|
56
|
+
),
|
|
57
|
+
const SizedBox(height: 25),
|
|
58
|
+
_buildRow(
|
|
59
|
+
'render by glyphs',
|
|
60
|
+
() => const LaTeX(
|
|
61
|
+
latex: "\\text{Hello World!}",
|
|
62
|
+
textSize: 200,
|
|
63
|
+
style: TeXStyle.text,
|
|
64
|
+
color: Colors.black,
|
|
65
|
+
isRenderGlyphUsePath: false,
|
|
66
|
+
),
|
|
67
|
+
),
|
|
68
|
+
const SizedBox(height: 50),
|
|
69
|
+
_buildRichText(),
|
|
70
|
+
],
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
_buildRow(String desc, Widget Function() build) {
|
|
75
|
+
return Row(
|
|
76
|
+
mainAxisSize: MainAxisSize.min,
|
|
77
|
+
children: [
|
|
78
|
+
SizedBox(
|
|
79
|
+
width: 150,
|
|
80
|
+
child: Text(
|
|
81
|
+
desc,
|
|
82
|
+
textAlign: TextAlign.right,
|
|
83
|
+
style: const TextStyle(fontSize: 18),
|
|
84
|
+
),
|
|
85
|
+
),
|
|
86
|
+
const SizedBox(width: 10),
|
|
87
|
+
build(),
|
|
88
|
+
],
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
_buildRichText() {
|
|
93
|
+
return RichText(
|
|
94
|
+
text: const TextSpan(
|
|
95
|
+
children: [
|
|
96
|
+
TextSpan(
|
|
97
|
+
text: "Hello!",
|
|
98
|
+
style: TextStyle(
|
|
99
|
+
color: Colors.black,
|
|
100
|
+
fontSize: 25,
|
|
101
|
+
fontFamily: 'XITS Math',
|
|
102
|
+
),
|
|
103
|
+
),
|
|
104
|
+
WidgetSpan(
|
|
105
|
+
alignment: PlaceholderAlignment.baseline,
|
|
106
|
+
baseline: TextBaseline.alphabetic,
|
|
107
|
+
child: LaTeX(
|
|
108
|
+
latex: "F(\\omega)=\\int_{-\\infty}^{+\\infty}f(t)e^{-i\\omega_nt}dt",
|
|
109
|
+
textSize: 25,
|
|
110
|
+
style: TeXStyle.text,
|
|
111
|
+
color: Colors.black,
|
|
112
|
+
blur: Blur(BlurStyle.normal, 0.34),
|
|
113
|
+
),
|
|
114
|
+
)
|
|
115
|
+
],
|
|
116
|
+
),
|
|
117
|
+
);
|
|
118
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import 'dart:math';
|
|
2
|
+
|
|
3
|
+
import 'package:flutter/material.dart';
|
|
4
|
+
import 'package:flutter/widgets.dart';
|
|
5
|
+
|
|
6
|
+
class DragPane extends StatefulWidget {
|
|
7
|
+
final Widget top;
|
|
8
|
+
final Widget bottom;
|
|
9
|
+
final double dividerThickness;
|
|
10
|
+
final double offset;
|
|
11
|
+
|
|
12
|
+
const DragPane({
|
|
13
|
+
Key? key,
|
|
14
|
+
required this.top,
|
|
15
|
+
required this.bottom,
|
|
16
|
+
this.dividerThickness = 16,
|
|
17
|
+
this.offset = 20,
|
|
18
|
+
}) : super(key: key);
|
|
19
|
+
|
|
20
|
+
@override
|
|
21
|
+
State<DragPane> createState() => _DragPaneState();
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
class _DragPaneState extends State<DragPane> {
|
|
25
|
+
double _offset = 10;
|
|
26
|
+
|
|
27
|
+
@override
|
|
28
|
+
void initState() {
|
|
29
|
+
super.initState();
|
|
30
|
+
_offset = widget.offset;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
@override
|
|
34
|
+
Widget build(BuildContext context) {
|
|
35
|
+
return LayoutBuilder(builder: (context, constraints) {
|
|
36
|
+
return Stack(
|
|
37
|
+
children: [
|
|
38
|
+
Positioned.fill(child: widget.bottom),
|
|
39
|
+
Positioned(
|
|
40
|
+
top: _offset,
|
|
41
|
+
left: 0,
|
|
42
|
+
right: 0,
|
|
43
|
+
bottom: 0,
|
|
44
|
+
child: _buildTop(constraints),
|
|
45
|
+
),
|
|
46
|
+
],
|
|
47
|
+
);
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
_buildTop(BoxConstraints constraints) {
|
|
52
|
+
final h = constraints.maxHeight - widget.dividerThickness - _offset;
|
|
53
|
+
return Column(
|
|
54
|
+
children: [
|
|
55
|
+
GestureDetector(
|
|
56
|
+
behavior: HitTestBehavior.translucent,
|
|
57
|
+
onPanUpdate: (detailes) => setState(() {
|
|
58
|
+
_offset += detailes.delta.dy;
|
|
59
|
+
final b = constraints.maxHeight - widget.dividerThickness;
|
|
60
|
+
_offset = max(0, min(_offset, b));
|
|
61
|
+
}),
|
|
62
|
+
child: SizedBox(
|
|
63
|
+
width: constraints.maxWidth,
|
|
64
|
+
height: widget.dividerThickness,
|
|
65
|
+
child: Container(
|
|
66
|
+
color: Colors.black26,
|
|
67
|
+
child: const Icon(Icons.drag_handle),
|
|
68
|
+
),
|
|
69
|
+
),
|
|
70
|
+
),
|
|
71
|
+
SizedBox(height: h, child: widget.top),
|
|
72
|
+
],
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import 'package:flutter/material.dart';
|
|
2
|
+
import 'package:microtex_example/utils/convert_spans.dart';
|
|
3
|
+
|
|
4
|
+
class SimpleRichText extends StatelessWidget {
|
|
5
|
+
final String text;
|
|
6
|
+
|
|
7
|
+
const SimpleRichText({
|
|
8
|
+
Key? key,
|
|
9
|
+
required this.text,
|
|
10
|
+
}) : super(key: key);
|
|
11
|
+
|
|
12
|
+
@override
|
|
13
|
+
Widget build(BuildContext context) {
|
|
14
|
+
return RichText(
|
|
15
|
+
text: TextSpan(
|
|
16
|
+
children: SpanConverter().buildSpans(
|
|
17
|
+
text: text,
|
|
18
|
+
style: const TextStyle(color: Colors.black, fontSize: 20),
|
|
19
|
+
),
|
|
20
|
+
),
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import 'package:flutter/material.dart';
|
|
2
|
+
|
|
3
|
+
class SplitView extends StatefulWidget {
|
|
4
|
+
final Widget left;
|
|
5
|
+
final Widget right;
|
|
6
|
+
final double ratio;
|
|
7
|
+
final double dividerThickness;
|
|
8
|
+
|
|
9
|
+
const SplitView({
|
|
10
|
+
Key? key,
|
|
11
|
+
required this.left,
|
|
12
|
+
required this.right,
|
|
13
|
+
this.ratio = 0.5,
|
|
14
|
+
this.dividerThickness = 16,
|
|
15
|
+
}) : super(key: key);
|
|
16
|
+
|
|
17
|
+
@override
|
|
18
|
+
State<SplitView> createState() => _SplitViewState();
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
class _SplitViewState extends State<SplitView> {
|
|
22
|
+
double _ratio = 0;
|
|
23
|
+
|
|
24
|
+
@override
|
|
25
|
+
void initState() {
|
|
26
|
+
super.initState();
|
|
27
|
+
_ratio = widget.ratio;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
@override
|
|
31
|
+
Widget build(BuildContext context) {
|
|
32
|
+
return LayoutBuilder(builder: (context, constraints) {
|
|
33
|
+
final maxWidth = constraints.maxWidth - widget.dividerThickness;
|
|
34
|
+
final lw = maxWidth * _ratio;
|
|
35
|
+
final rw = maxWidth - lw;
|
|
36
|
+
return SizedBox(
|
|
37
|
+
width: constraints.maxWidth,
|
|
38
|
+
child: Row(
|
|
39
|
+
crossAxisAlignment: CrossAxisAlignment.start,
|
|
40
|
+
children: [
|
|
41
|
+
SizedBox(width: lw, child: widget.left),
|
|
42
|
+
GestureDetector(
|
|
43
|
+
behavior: HitTestBehavior.translucent,
|
|
44
|
+
onPanUpdate: (details) {
|
|
45
|
+
setState(() {
|
|
46
|
+
_ratio += details.delta.dx / maxWidth;
|
|
47
|
+
if (_ratio > 1) {
|
|
48
|
+
_ratio = 1;
|
|
49
|
+
} else if (_ratio < 0) {
|
|
50
|
+
_ratio = 0;
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
},
|
|
54
|
+
child: SizedBox(
|
|
55
|
+
width: widget.dividerThickness,
|
|
56
|
+
height: constraints.maxHeight,
|
|
57
|
+
child: Container(
|
|
58
|
+
color: Colors.black26,
|
|
59
|
+
child: const RotationTransition(
|
|
60
|
+
child: Icon(Icons.drag_handle),
|
|
61
|
+
turns: AlwaysStoppedAnimation(0.25),
|
|
62
|
+
),
|
|
63
|
+
),
|
|
64
|
+
),
|
|
65
|
+
),
|
|
66
|
+
SizedBox(width: rw, child: widget.right),
|
|
67
|
+
],
|
|
68
|
+
),
|
|
69
|
+
);
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import 'package:flutter/material.dart';
|
|
2
|
+
|
|
3
|
+
class TeXHighlightController extends TextEditingController {
|
|
4
|
+
TeXHighlightController({String? text}) : super(text: text);
|
|
5
|
+
|
|
6
|
+
static final out = RegExp(r'\${1,2}[\s\S]*?\${1,2}');
|
|
7
|
+
static final cmd = RegExp(r'\${1,2}|\\[a-zA-Z]*|\_|\^|\{|\}');
|
|
8
|
+
|
|
9
|
+
@override
|
|
10
|
+
TextSpan buildTextSpan({
|
|
11
|
+
required BuildContext context,
|
|
12
|
+
TextStyle? style,
|
|
13
|
+
required bool withComposing,
|
|
14
|
+
}) {
|
|
15
|
+
final sty = style ?? const TextStyle();
|
|
16
|
+
final dollarSty = sty.copyWith(color: Colors.deepOrange);
|
|
17
|
+
final texStyle = sty.copyWith(color: Colors.green);
|
|
18
|
+
final cmdStyle = sty.copyWith(color: Colors.blue);
|
|
19
|
+
final keyStyle = sty.copyWith(color: Colors.purple);
|
|
20
|
+
|
|
21
|
+
final children = <TextSpan>[];
|
|
22
|
+
|
|
23
|
+
matchTeX(String tex) {
|
|
24
|
+
tex.splitMapJoin(
|
|
25
|
+
cmd,
|
|
26
|
+
onNonMatch: (span) {
|
|
27
|
+
if (span.isEmpty) return span;
|
|
28
|
+
children.add(TextSpan(text: span, style: texStyle));
|
|
29
|
+
return span;
|
|
30
|
+
},
|
|
31
|
+
onMatch: (m) {
|
|
32
|
+
final cmd = m[0] ?? '';
|
|
33
|
+
if (cmd.isEmpty) return '';
|
|
34
|
+
final TextStyle s;
|
|
35
|
+
if (cmd == '\$' || cmd == '\$\$') {
|
|
36
|
+
s = dollarSty;
|
|
37
|
+
} else if (cmd == '_' || cmd == '^') {
|
|
38
|
+
s = keyStyle;
|
|
39
|
+
} else if (cmd == '{' || cmd == '}') {
|
|
40
|
+
s = sty;
|
|
41
|
+
} else {
|
|
42
|
+
s = cmdStyle;
|
|
43
|
+
}
|
|
44
|
+
children.add(TextSpan(text: cmd, style: s));
|
|
45
|
+
return cmd;
|
|
46
|
+
},
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
text.splitMapJoin(
|
|
51
|
+
out,
|
|
52
|
+
onNonMatch: (span) {
|
|
53
|
+
if (span.isEmpty) return span;
|
|
54
|
+
children.add(TextSpan(text: span, style: style));
|
|
55
|
+
return span;
|
|
56
|
+
},
|
|
57
|
+
onMatch: (m) {
|
|
58
|
+
final tex = m[0] ?? '';
|
|
59
|
+
if (tex.isEmpty) return '';
|
|
60
|
+
matchTeX(tex);
|
|
61
|
+
return tex;
|
|
62
|
+
},
|
|
63
|
+
);
|
|
64
|
+
return TextSpan(style: style, children: children);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import 'package:flutter/material.dart';
|
|
2
|
+
import 'package:microtex_example/utils/convert_spans.dart';
|
|
3
|
+
|
|
4
|
+
class TeXInputController extends TextEditingController {
|
|
5
|
+
TeXInputController({String? text}) : super(text: text);
|
|
6
|
+
|
|
7
|
+
@override
|
|
8
|
+
TextSpan buildTextSpan({
|
|
9
|
+
required BuildContext context,
|
|
10
|
+
TextStyle? style,
|
|
11
|
+
required bool withComposing,
|
|
12
|
+
}) {
|
|
13
|
+
final children = SpanConverter().buildSpans(
|
|
14
|
+
text: text,
|
|
15
|
+
style: style ?? const TextStyle(),
|
|
16
|
+
);
|
|
17
|
+
return TextSpan(style: style, children: children);
|
|
18
|
+
}
|
|
19
|
+
}
|