├── .DS_Store ├── .flutter-plugins ├── .packages ├── README.md ├── dslDemo └── demo_blog_code.dart ├── example ├── .fhgenerator.json ├── .gitignore ├── .metadata ├── README.md ├── android │ ├── app │ │ ├── build.gradle │ │ └── src │ │ │ ├── debug │ │ │ └── AndroidManifest.xml │ │ │ ├── main │ │ │ ├── AndroidManifest.xml │ │ │ ├── kotlin │ │ │ │ └── com │ │ │ │ │ └── newcoretech │ │ │ │ │ └── flutter_hot_widget │ │ │ │ │ └── MainActivity.kt │ │ │ └── res │ │ │ │ ├── drawable │ │ │ │ └── launch_background.xml │ │ │ │ ├── mipmap-hdpi │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-mdpi │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-xhdpi │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-xxhdpi │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-xxxhdpi │ │ │ │ └── ic_launcher.png │ │ │ │ └── values │ │ │ │ └── styles.xml │ │ │ └── profile │ │ │ └── AndroidManifest.xml │ ├── build.gradle │ ├── gradle.properties │ ├── gradle │ │ └── wrapper │ │ │ └── gradle-wrapper.properties │ └── settings.gradle ├── assets │ └── ast_records_data.json ├── ios │ ├── Flutter │ │ ├── AppFrameworkInfo.plist │ │ ├── Debug.xcconfig │ │ └── Release.xcconfig │ ├── Podfile │ ├── Runner.xcodeproj │ │ ├── project.pbxproj │ │ ├── project.xcworkspace │ │ │ └── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ └── xcschemes │ │ │ └── Runner.xcscheme │ ├── Runner.xcworkspace │ │ └── contents.xcworkspacedata │ └── Runner │ │ ├── AppDelegate.swift │ │ ├── Assets.xcassets │ │ ├── AppIcon.appiconset │ │ │ ├── Contents.json │ │ │ ├── Icon-App-1024x1024@1x.png │ │ │ ├── Icon-App-20x20@1x.png │ │ │ ├── Icon-App-20x20@2x.png │ │ │ ├── Icon-App-20x20@3x.png │ │ │ ├── Icon-App-29x29@1x.png │ │ │ ├── Icon-App-29x29@2x.png │ │ │ ├── Icon-App-29x29@3x.png │ │ │ ├── Icon-App-40x40@1x.png │ │ │ ├── Icon-App-40x40@2x.png │ │ │ ├── Icon-App-40x40@3x.png │ │ │ ├── Icon-App-60x60@2x.png │ │ │ ├── Icon-App-60x60@3x.png │ │ │ ├── Icon-App-76x76@1x.png │ │ │ ├── Icon-App-76x76@2x.png │ │ │ └── Icon-App-83.5x83.5@2x.png │ │ └── LaunchImage.imageset │ │ │ ├── Contents.json │ │ │ ├── LaunchImage.png │ │ │ ├── LaunchImage@2x.png │ │ │ ├── LaunchImage@3x.png │ │ │ └── README.md │ │ ├── Base.lproj │ │ ├── LaunchScreen.storyboard │ │ └── Main.storyboard │ │ ├── Info.plist │ │ └── Runner-Bridging-Header.h ├── lib │ ├── dsl │ │ └── listview_dsl.dart │ └── main.dart ├── pubspec.yaml └── test │ └── widget_test.dart ├── lib ├── ast_node.dart ├── ast_runtime_class.dart ├── ast_varialble_stack.dart ├── main.dart └── widget │ ├── .DS_Store │ ├── argument_parser │ ├── argument_circularprogressIndicator_parser.dart │ ├── argument_comm_parser.dart │ ├── argument_decoration_parser.dart │ ├── argument_icon_parser.dart │ ├── argument_image_parser.dart │ ├── argument_parser.dart │ ├── argument_row_column_parser.dart │ └── argument_text_parser.dart │ ├── ast_statefulwidget.dart │ └── widget_builders │ ├── basebuilder_box.dart │ ├── basewidget_builder.dart │ ├── components_builders.dart │ ├── layout_builders.dart │ ├── recommand_builder_box.dart │ ├── widget_builder_factory.dart │ └── widget_builders.dart ├── pubspec.lock └── pubspec.yaml /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Newcore-mobile/DynamicFlutter/d4481f61011b2f5746a907ba2e93cec9b8e7dfa8/.DS_Store -------------------------------------------------------------------------------- /.flutter-plugins: -------------------------------------------------------------------------------- 1 | connectivity=/Users/youngchan/Library/flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/connectivity-0.4.6/ 2 | flutter_webview_plugin=/Users/youngchan/Library/flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/flutter_webview_plugin-0.3.2/ 3 | nc_image_picker=/Users/youngchan/Library/flutter/flutter/.pub-cache/git/ncimagepicker-d167e268d2cb0d59a0141a193e8fbf1bbad0ea67/ 4 | ncf_base=/Users/youngchan/Library/flutter/flutter/.pub-cache/git/ncfbase-f86c2a2127a15d73203a64ecce4cc48adc72a03f/ 5 | ncf_ui=/Users/youngchan/Library/flutter/flutter/.pub-cache/git/ncfui-fb28d48357eada99f266f96a5c41c246b3a07fc9/ 6 | ncfilepicker=/Users/youngchan/Library/flutter/flutter/.pub-cache/git/fileselector-5d09f19240a7d33f2db66ae3ae47d25706eca3e3/ 7 | package_info=/Users/youngchan/Library/flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/package_info-0.4.0+12/ 8 | path_provider=/Users/youngchan/Library/flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/path_provider-0.5.0+1/ 9 | shared_preferences=/Users/youngchan/Library/flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/shared_preferences-0.5.4/ 10 | sqflite=/Users/youngchan/Library/flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/sqflite-1.1.8/ 11 | -------------------------------------------------------------------------------- /.packages: -------------------------------------------------------------------------------- 1 | # Generated by pub on 2020-04-22 18:58:32.035472. 2 | _fe_analyzer_shared:file:///Users/youngchan/Library/flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/_fe_analyzer_shared-1.0.1/lib/ 3 | analyzer:file:///Users/youngchan/Library/flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/analyzer-0.39.2+1/lib/ 4 | args:file:///Users/youngchan/Library/flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/args-1.6.0/lib/ 5 | async:file:///Users/youngchan/Library/flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/async-2.3.0/lib/ 6 | boolean_selector:file:///Users/youngchan/Library/flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/boolean_selector-1.0.5/lib/ 7 | build:file:///Users/youngchan/Library/flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/build-1.2.2/lib/ 8 | charcode:file:///Users/youngchan/Library/flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/charcode-1.1.2/lib/ 9 | collection:file:///Users/youngchan/Library/flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/collection-1.14.11/lib/ 10 | connectivity:file:///Users/youngchan/Library/flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/connectivity-0.4.6/lib/ 11 | convert:file:///Users/youngchan/Library/flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/convert-2.1.1/lib/ 12 | crypto:file:///Users/youngchan/Library/flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/crypto-2.1.4/lib/ 13 | csslib:file:///Users/youngchan/Library/flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/csslib-0.16.1/lib/ 14 | dart_style:file:///Users/youngchan/Library/flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/dart_style-1.3.3/lib/ 15 | flutter:file:///Users/youngchan/Library/flutter/flutter/packages/flutter/lib/ 16 | flutter_test:file:///Users/youngchan/Library/flutter/flutter/packages/flutter_test/lib/ 17 | glob:file:///Users/youngchan/Library/flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/glob-1.2.0/lib/ 18 | html:file:///Users/youngchan/Library/flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/html-0.14.0+3/lib/ 19 | js:file:///Users/youngchan/Library/flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/js-0.6.1+1/lib/ 20 | logging:file:///Users/youngchan/Library/flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/logging-0.11.4/lib/ 21 | matcher:file:///Users/youngchan/Library/flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/matcher-0.12.5/lib/ 22 | meta:file:///Users/youngchan/Library/flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/meta-1.1.7/lib/ 23 | node_interop:file:///Users/youngchan/Library/flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/node_interop-1.0.3/lib/ 24 | node_io:file:///Users/youngchan/Library/flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/node_io-1.0.1+2/lib/ 25 | package_config:file:///Users/youngchan/Library/flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/package_config-1.1.0/lib/ 26 | path:file:///Users/youngchan/Library/flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/path-1.6.4/lib/ 27 | pedantic:file:///Users/youngchan/Library/flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/pedantic-1.8.0+1/lib/ 28 | pub_semver:file:///Users/youngchan/Library/flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/pub_semver-1.4.4/lib/ 29 | quiver:file:///Users/youngchan/Library/flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/quiver-2.0.5/lib/ 30 | shared_preferences:file:///Users/youngchan/Library/flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/shared_preferences-0.5.4/lib/ 31 | sky_engine:file:///Users/youngchan/Library/flutter/flutter/bin/cache/pkg/sky_engine/lib/ 32 | source_gen:file:///Users/youngchan/Library/flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/source_gen-0.9.5/lib/ 33 | source_span:file:///Users/youngchan/Library/flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/source_span-1.5.5/lib/ 34 | sqflite:file:///Users/youngchan/Library/flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/sqflite-1.1.8/lib/ 35 | stack_trace:file:///Users/youngchan/Library/flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/stack_trace-1.9.3/lib/ 36 | stream_channel:file:///Users/youngchan/Library/flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/stream_channel-2.0.0/lib/ 37 | string_scanner:file:///Users/youngchan/Library/flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/string_scanner-1.0.5/lib/ 38 | synchronized:file:///Users/youngchan/Library/flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/synchronized-2.1.1/lib/ 39 | term_glyph:file:///Users/youngchan/Library/flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/term_glyph-1.1.0/lib/ 40 | test_api:file:///Users/youngchan/Library/flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/test_api-0.2.5/lib/ 41 | typed_data:file:///Users/youngchan/Library/flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/typed_data-1.1.6/lib/ 42 | vector_math:file:///Users/youngchan/Library/flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/vector_math-2.0.8/lib/ 43 | watcher:file:///Users/youngchan/Library/flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/watcher-0.9.7+14/lib/ 44 | yaml:file:///Users/youngchan/Library/flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/yaml-2.2.0/lib/ 45 | dynamicflutter:lib/ 46 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | > 本项目为《Flutter动态化热更新的思考与实践》的示例代码 2 | 3 | 详见: 4 | 5 | 1. [Flutter动态化热更新的思考与实践](https://juejin.im/post/5e8c23536fb9a03c3f1ea10b) 6 | 2. [Flutter 动态化热更新的思考与实践(二)----Dart 代码转换AST](https://juejin.im/post/5e918f22e51d4546d83b105f) 7 | 3. [Flutter 动态化热更新的思考与实践(三)---- 解析AST之Runtime](https://juejin.im/post/5ea016c46fb9a03c875cafd6) 8 | 9 | 10 | 11 | 运行: 12 | 13 | `dart lib/main.dart -f dslDemo/demo_blog_code.dart` 14 | 15 | -------------------------------------------------------------------------------- /dslDemo/demo_blog_code.dart: -------------------------------------------------------------------------------- 1 | /// 2 | ///Author: YoungChan 3 | ///Date: 2020-04-11 15:11:52 4 | ///LastEditors: YoungChan 5 | ///LastEditTime: 2020-04-22 16:24:14 6 | ///Description: file content 7 | /// 8 | 9 | int incTen(int a) { 10 | int b = a + 10; 11 | return b; 12 | } 13 | -------------------------------------------------------------------------------- /example/.fhgenerator.json: -------------------------------------------------------------------------------- 1 | [{"name":"ListViewDSL","filePath":"./lib/dsl/listview_dsl.dart","version":"e7bc40472edcac122fa96863a95e2137","classId":"8a6b3c194efcd9aeb6fc6f29a77a97e9","metadata":"FlutterHotWidget"},{"name":"RowColumnDSL","filePath":"./lib/dsl/column_row_dsl.dart","version":"23ebd1dc151d95c519566f4ace953be4","classId":"7251e562a7f2859cd246fdff22d5da74","metadata":"FlutterHotWidget"},{"name":"IconDsl","filePath":"./lib/dsl/icon_dsl.dart","version":"53a6ced7761ea53368e8cd93be6178c6","classId":"a63c89faebb3fb5b2f98ccf086abf367","metadata":"FlutterHotWidget"},{"name":"ScaffoldDSL","filePath":"./lib/dsl/scaffold_dsl.dart","version":"bb4af7e09335b59d3320231b1e7c4ba4","classId":"16c7389376fba1ff879c6f7a91f5f190","metadata":"FlutterHotWidget"}] -------------------------------------------------------------------------------- /example/.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | 12 | # IntelliJ related 13 | *.iml 14 | *.ipr 15 | *.iws 16 | .idea/ 17 | 18 | # The .vscode folder contains launch configuration and tasks you configure in 19 | # VS Code which you may wish to be included in version control, so this line 20 | # is commented out by default. 21 | #.vscode/ 22 | 23 | # Flutter/Dart/Pub related 24 | **/doc/api/ 25 | .dart_tool/ 26 | .flutter-plugins 27 | .packages 28 | .pub-cache/ 29 | .pub/ 30 | /build/ 31 | 32 | # Android related 33 | **/android/**/gradle-wrapper.jar 34 | **/android/.gradle 35 | **/android/captures/ 36 | **/android/gradlew 37 | **/android/gradlew.bat 38 | **/android/local.properties 39 | **/android/**/GeneratedPluginRegistrant.java 40 | 41 | # iOS/XCode related 42 | **/ios/**/*.mode1v3 43 | **/ios/**/*.mode2v3 44 | **/ios/**/*.moved-aside 45 | **/ios/**/*.pbxuser 46 | **/ios/**/*.perspectivev3 47 | **/ios/**/*sync/ 48 | **/ios/**/.sconsign.dblite 49 | **/ios/**/.tags* 50 | **/ios/**/.vagrant/ 51 | **/ios/**/DerivedData/ 52 | **/ios/**/Icon? 53 | **/ios/**/Pods/ 54 | **/ios/**/.symlinks/ 55 | **/ios/**/profile 56 | **/ios/**/xcuserdata 57 | **/ios/.generated/ 58 | **/ios/Flutter/App.framework 59 | **/ios/Flutter/Flutter.framework 60 | **/ios/Flutter/Generated.xcconfig 61 | **/ios/Flutter/app.flx 62 | **/ios/Flutter/app.zip 63 | **/ios/Flutter/flutter_assets/ 64 | **/ios/Flutter/flutter_export_environment.sh 65 | **/ios/ServiceDefinitions.json 66 | **/ios/Runner/GeneratedPluginRegistrant.* 67 | 68 | # Exceptions to above rules. 69 | !**/ios/**/default.mode1v3 70 | !**/ios/**/default.mode2v3 71 | !**/ios/**/default.pbxuser 72 | !**/ios/**/default.perspectivev3 73 | !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages 74 | pubspec.lock 75 | 76 | -------------------------------------------------------------------------------- /example/.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled and should not be manually edited. 5 | 6 | version: 7 | revision: 68587a0916366e9512a78df22c44163d041dd5f3 8 | channel: unknown 9 | 10 | project_type: app 11 | -------------------------------------------------------------------------------- /example/README.md: -------------------------------------------------------------------------------- 1 | # flutter_hot_widget 2 | 3 | A new Flutter application. 4 | 5 | ## Getting Started 6 | 7 | This project is a starting point for a Flutter application. 8 | 9 | A few resources to get you started if this is your first Flutter project: 10 | 11 | - [Lab: Write your first Flutter app](https://flutter.dev/docs/get-started/codelab) 12 | - [Cookbook: Useful Flutter samples](https://flutter.dev/docs/cookbook) 13 | 14 | For help getting started with Flutter, view our 15 | [online documentation](https://flutter.dev/docs), which offers tutorials, 16 | samples, guidance on mobile development, and a full API reference. 17 | -------------------------------------------------------------------------------- /example/android/app/build.gradle: -------------------------------------------------------------------------------- 1 | def localProperties = new Properties() 2 | def localPropertiesFile = rootProject.file('local.properties') 3 | if (localPropertiesFile.exists()) { 4 | localPropertiesFile.withReader('UTF-8') { reader -> 5 | localProperties.load(reader) 6 | } 7 | } 8 | 9 | def flutterRoot = localProperties.getProperty('flutter.sdk') 10 | if (flutterRoot == null) { 11 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") 12 | } 13 | 14 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode') 15 | if (flutterVersionCode == null) { 16 | flutterVersionCode = '1' 17 | } 18 | 19 | def flutterVersionName = localProperties.getProperty('flutter.versionName') 20 | if (flutterVersionName == null) { 21 | flutterVersionName = '1.0' 22 | } 23 | 24 | apply plugin: 'com.android.application' 25 | apply plugin: 'kotlin-android' 26 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" 27 | 28 | android { 29 | compileSdkVersion 28 30 | 31 | sourceSets { 32 | main.java.srcDirs += 'src/main/kotlin' 33 | } 34 | 35 | lintOptions { 36 | disable 'InvalidPackage' 37 | } 38 | 39 | defaultConfig { 40 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 41 | applicationId "com.newcoretech.flutter_hot_widget" 42 | minSdkVersion 21 43 | targetSdkVersion 28 44 | versionCode flutterVersionCode.toInteger() 45 | versionName flutterVersionName 46 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 47 | } 48 | 49 | buildTypes { 50 | release { 51 | // TODO: Add your own signing config for the release build. 52 | // Signing with the debug keys for now, so `flutter run --release` works. 53 | signingConfig signingConfigs.debug 54 | } 55 | } 56 | } 57 | 58 | flutter { 59 | source '../..' 60 | } 61 | 62 | dependencies { 63 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 64 | testImplementation 'junit:junit:4.12' 65 | androidTestImplementation 'com.android.support.test:runner:1.0.2' 66 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' 67 | } 68 | -------------------------------------------------------------------------------- /example/android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 14 | 15 | 19 | 26 | 30 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /example/android/app/src/main/kotlin/com/newcoretech/flutter_hot_widget/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.newcoretech.flutter_hot_widget 2 | 3 | import android.os.Bundle 4 | 5 | import io.flutter.app.FlutterActivity 6 | import io.flutter.plugins.GeneratedPluginRegistrant 7 | 8 | class MainActivity: FlutterActivity() { 9 | override fun onCreate(savedInstanceState: Bundle?) { 10 | super.onCreate(savedInstanceState) 11 | GeneratedPluginRegistrant.registerWith(this) 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Newcore-mobile/DynamicFlutter/d4481f61011b2f5746a907ba2e93cec9b8e7dfa8/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Newcore-mobile/DynamicFlutter/d4481f61011b2f5746a907ba2e93cec9b8e7dfa8/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Newcore-mobile/DynamicFlutter/d4481f61011b2f5746a907ba2e93cec9b8e7dfa8/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Newcore-mobile/DynamicFlutter/d4481f61011b2f5746a907ba2e93cec9b8e7dfa8/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Newcore-mobile/DynamicFlutter/d4481f61011b2f5746a907ba2e93cec9b8e7dfa8/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | -------------------------------------------------------------------------------- /example/android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | ext.kotlin_version = '1.3.50' 3 | repositories { 4 | google() 5 | jcenter() 6 | } 7 | 8 | dependencies { 9 | classpath 'com.android.tools.build:gradle:3.5.3' 10 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 11 | } 12 | } 13 | 14 | allprojects { 15 | repositories { 16 | google() 17 | jcenter() 18 | } 19 | } 20 | 21 | rootProject.buildDir = '../build' 22 | subprojects { 23 | project.buildDir = "${rootProject.buildDir}/${project.name}" 24 | } 25 | subprojects { 26 | project.evaluationDependsOn(':app') 27 | } 28 | 29 | task clean(type: Delete) { 30 | delete rootProject.buildDir 31 | } 32 | -------------------------------------------------------------------------------- /example/android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | 3 | -------------------------------------------------------------------------------- /example/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Fri Jun 23 08:50:38 CEST 2017 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip 7 | -------------------------------------------------------------------------------- /example/android/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | 3 | def flutterProjectRoot = rootProject.projectDir.parentFile.toPath() 4 | 5 | def plugins = new Properties() 6 | def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins') 7 | if (pluginsFile.exists()) { 8 | pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) } 9 | } 10 | 11 | plugins.each { name, path -> 12 | def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile() 13 | include ":$name" 14 | project(":$name").projectDir = pluginDirectory 15 | } 16 | -------------------------------------------------------------------------------- /example/assets/ast_records_data.json: -------------------------------------------------------------------------------- 1 | [{"name":"ListViewDSL","classId":"8a6b3c194efcd9aeb6fc6f29a77a97e9","version":"e7bc40472edcac122fa96863a95e2137","metadata":"FlutterHotWidget","versionDate":1587095897223,"ast":"{\"type\":\"Program\",\"body\":[{\"type\":\"ClassDeclaration\",\"id\":{\"type\":\"Identifier\",\"name\":\"ListViewDSL\"},\"superClause\":{\"type\":\"Identifier\",\"name\":\"StatefulWidget\"},\"implementsClause\":null,\"mixinClause\":null,\"metadata\":[{\"type\":\"Annotation\",\"id\":{\"type\":\"Identifier\",\"name\":\"FlutterHotWidget\"},\"argumentList\":{\"type\":\"ArgumentList\",\"argumentList\":[]}}],\"body\":[{\"type\":\"MethodDeclaration\",\"id\":{\"type\":\"Identifier\",\"name\":\"createState\"},\"parameters\":{\"type\":\"FormalParameterList\",\"parameterList\":[]},\"typeParameters\":null,\"body\":{\"type\":\"MethodInvocation\",\"callee\":{\"type\":\"Identifier\",\"name\":\"_ListViewDSLState\"},\"typeArguments\":null,\"argumentList\":{\"type\":\"ArgumentList\",\"argumentList\":[]},\"selectAstClass\":null},\"returnType\":{\"type\":\"Identifier\",\"name\":\"_ListViewDSLState\"}}]},{\"type\":\"ClassDeclaration\",\"id\":{\"type\":\"Identifier\",\"name\":\"_ListViewDSLState\"},\"superClause\":{\"type\":\"Identifier\",\"name\":\"State\"},\"implementsClause\":null,\"mixinClause\":null,\"metadata\":[],\"body\":[{\"type\":\"MethodDeclaration\",\"id\":{\"type\":\"Identifier\",\"name\":\"build\"},\"parameters\":{\"type\":\"FormalParameterList\",\"parameterList\":[{\"type\":\"SimpleFormalParameter\",\"typeAnnotaion\":{\"type\":\"Identifier\",\"name\":\"BuildContext\"},\"id\":{\"type\":\"Identifier\",\"name\":\"context\"}}]},\"typeParameters\":null,\"body\":{\"type\":\"BlockStatement\",\"body\":[{\"type\":\"ReturnStatement\",\"argument\":{\"type\":\"MethodInvocation\",\"callee\":{\"type\":\"Identifier\",\"name\":\"Scaffold\"},\"typeArguments\":null,\"argumentList\":{\"type\":\"ArgumentList\",\"argumentList\":[{\"type\":\"NamedExpression\",\"id\":{\"type\":\"Identifier\",\"name\":\"appBar\"},\"expression\":{\"type\":\"MethodInvocation\",\"callee\":{\"type\":\"Identifier\",\"name\":\"AppBar\"},\"typeArguments\":null,\"argumentList\":{\"type\":\"ArgumentList\",\"argumentList\":[{\"type\":\"NamedExpression\",\"id\":{\"type\":\"Identifier\",\"name\":\"backgroundColor\"},\"expression\":{\"type\":\"PrefixedIdentifier\",\"identifier\":{\"type\":\"Identifier\",\"name\":\"red\"},\"prefix\":{\"type\":\"Identifier\",\"name\":\"Colors\"}}},{\"type\":\"NamedExpression\",\"id\":{\"type\":\"Identifier\",\"name\":\"title\"},\"expression\":{\"type\":\"MethodInvocation\",\"callee\":{\"type\":\"Identifier\",\"name\":\"Text\"},\"typeArguments\":null,\"argumentList\":{\"type\":\"ArgumentList\",\"argumentList\":[{\"type\":\"StringLiteral\",\"value\":\"ListViewDSL\"},{\"type\":\"NamedExpression\",\"id\":{\"type\":\"Identifier\",\"name\":\"style\"},\"expression\":{\"type\":\"MethodInvocation\",\"callee\":{\"type\":\"Identifier\",\"name\":\"TextStyle\"},\"typeArguments\":null,\"argumentList\":{\"type\":\"ArgumentList\",\"argumentList\":[{\"type\":\"NamedExpression\",\"id\":{\"type\":\"Identifier\",\"name\":\"fontSize\"},\"expression\":{\"type\":\"NumericLiteral\",\"value\":20}},{\"type\":\"NamedExpression\",\"id\":{\"type\":\"Identifier\",\"name\":\"color\"},\"expression\":{\"type\":\"PrefixedIdentifier\",\"identifier\":{\"type\":\"Identifier\",\"name\":\"white\"},\"prefix\":{\"type\":\"Identifier\",\"name\":\"Colors\"}}}]},\"selectAstClass\":null}}]},\"selectAstClass\":null}},{\"type\":\"NamedExpression\",\"id\":{\"type\":\"Identifier\",\"name\":\"centerTitle\"},\"expression\":{\"type\":\"BooleanLiteral\",\"value\":true}}]},\"selectAstClass\":null}},{\"type\":\"NamedExpression\",\"id\":{\"type\":\"Identifier\",\"name\":\"body\"},\"expression\":{\"type\":\"MethodInvocation\",\"callee\":{\"type\":\"Identifier\",\"name\":\"ListView\"},\"typeArguments\":null,\"argumentList\":{\"type\":\"ArgumentList\",\"argumentList\":[{\"type\":\"NamedExpression\",\"id\":{\"type\":\"Identifier\",\"name\":\"padding\"},\"expression\":{\"type\":\"MethodInvocation\",\"callee\":{\"type\":\"MemberExpression\",\"object\":{\"type\":\"Identifier\",\"name\":\"EdgeInsets\"},\"property\":{\"type\":\"Identifier\",\"name\":\"only\"}},\"typeArguments\":null,\"argumentList\":{\"type\":\"ArgumentList\",\"argumentList\":[{\"type\":\"NamedExpression\",\"id\":{\"type\":\"Identifier\",\"name\":\"left\"},\"expression\":{\"type\":\"NumericLiteral\",\"value\":16}},{\"type\":\"NamedExpression\",\"id\":{\"type\":\"Identifier\",\"name\":\"right\"},\"expression\":{\"type\":\"NumericLiteral\",\"value\":16}}]},\"selectAstClass\":null}},{\"type\":\"NamedExpression\",\"id\":{\"type\":\"Identifier\",\"name\":\"children\"},\"expression\":{\"type\":\"ListLiteral\",\"elements\":[{\"type\":\"MethodInvocation\",\"callee\":{\"type\":\"Identifier\",\"name\":\"Container\"},\"typeArguments\":null,\"argumentList\":{\"type\":\"ArgumentList\",\"argumentList\":[{\"type\":\"NamedExpression\",\"id\":{\"type\":\"Identifier\",\"name\":\"child\"},\"expression\":{\"type\":\"MethodInvocation\",\"callee\":{\"type\":\"Identifier\",\"name\":\"Text\"},\"typeArguments\":null,\"argumentList\":{\"type\":\"ArgumentList\",\"argumentList\":[{\"type\":\"StringLiteral\",\"value\":\"Hellow world 1\"}]},\"selectAstClass\":null}},{\"type\":\"NamedExpression\",\"id\":{\"type\":\"Identifier\",\"name\":\"color\"},\"expression\":{\"type\":\"PrefixedIdentifier\",\"identifier\":{\"type\":\"Identifier\",\"name\":\"blue\"},\"prefix\":{\"type\":\"Identifier\",\"name\":\"Colors\"}}},{\"type\":\"NamedExpression\",\"id\":{\"type\":\"Identifier\",\"name\":\"height\"},\"expression\":{\"type\":\"NumericLiteral\",\"value\":45}}]},\"selectAstClass\":null},{\"type\":\"MethodInvocation\",\"callee\":{\"type\":\"Identifier\",\"name\":\"Container\"},\"typeArguments\":null,\"argumentList\":{\"type\":\"ArgumentList\",\"argumentList\":[{\"type\":\"NamedExpression\",\"id\":{\"type\":\"Identifier\",\"name\":\"child\"},\"expression\":{\"type\":\"MethodInvocation\",\"callee\":{\"type\":\"Identifier\",\"name\":\"Text\"},\"typeArguments\":null,\"argumentList\":{\"type\":\"ArgumentList\",\"argumentList\":[{\"type\":\"StringLiteral\",\"value\":\"Hellow world 2\"},{\"type\":\"NamedExpression\",\"id\":{\"type\":\"Identifier\",\"name\":\"style\"},\"expression\":{\"type\":\"MethodInvocation\",\"callee\":{\"type\":\"Identifier\",\"name\":\"TextStyle\"},\"typeArguments\":null,\"argumentList\":{\"type\":\"ArgumentList\",\"argumentList\":[{\"type\":\"NamedExpression\",\"id\":{\"type\":\"Identifier\",\"name\":\"fontSize\"},\"expression\":{\"type\":\"NumericLiteral\",\"value\":18}}]},\"selectAstClass\":null}}]},\"selectAstClass\":null}},{\"type\":\"NamedExpression\",\"id\":{\"type\":\"Identifier\",\"name\":\"color\"},\"expression\":{\"type\":\"PrefixedIdentifier\",\"identifier\":{\"type\":\"Identifier\",\"name\":\"red\"},\"prefix\":{\"type\":\"Identifier\",\"name\":\"Colors\"}}},{\"type\":\"NamedExpression\",\"id\":{\"type\":\"Identifier\",\"name\":\"height\"},\"expression\":{\"type\":\"NumericLiteral\",\"value\":45}}]},\"selectAstClass\":null},{\"type\":\"MethodInvocation\",\"callee\":{\"type\":\"Identifier\",\"name\":\"Container\"},\"typeArguments\":null,\"argumentList\":{\"type\":\"ArgumentList\",\"argumentList\":[{\"type\":\"NamedExpression\",\"id\":{\"type\":\"Identifier\",\"name\":\"child\"},\"expression\":{\"type\":\"MethodInvocation\",\"callee\":{\"type\":\"Identifier\",\"name\":\"Text\"},\"typeArguments\":null,\"argumentList\":{\"type\":\"ArgumentList\",\"argumentList\":[{\"type\":\"StringLiteral\",\"value\":\"Hellow world 3\"}]},\"selectAstClass\":null}},{\"type\":\"NamedExpression\",\"id\":{\"type\":\"Identifier\",\"name\":\"color\"},\"expression\":{\"type\":\"PrefixedIdentifier\",\"identifier\":{\"type\":\"Identifier\",\"name\":\"green\"},\"prefix\":{\"type\":\"Identifier\",\"name\":\"Colors\"}}},{\"type\":\"NamedExpression\",\"id\":{\"type\":\"Identifier\",\"name\":\"alignment\"},\"expression\":{\"type\":\"PrefixedIdentifier\",\"identifier\":{\"type\":\"Identifier\",\"name\":\"centerLeft\"},\"prefix\":{\"type\":\"Identifier\",\"name\":\"Alignment\"}}},{\"type\":\"NamedExpression\",\"id\":{\"type\":\"Identifier\",\"name\":\"padding\"},\"expression\":{\"type\":\"MethodInvocation\",\"callee\":{\"type\":\"MemberExpression\",\"object\":{\"type\":\"Identifier\",\"name\":\"EdgeInsets\"},\"property\":{\"type\":\"Identifier\",\"name\":\"only\"}},\"typeArguments\":null,\"argumentList\":{\"type\":\"ArgumentList\",\"argumentList\":[{\"type\":\"NamedExpression\",\"id\":{\"type\":\"Identifier\",\"name\":\"left\"},\"expression\":{\"type\":\"NumericLiteral\",\"value\":16}}]},\"selectAstClass\":null}},{\"type\":\"NamedExpression\",\"id\":{\"type\":\"Identifier\",\"name\":\"height\"},\"expression\":{\"type\":\"NumericLiteral\",\"value\":45}}]},\"selectAstClass\":null}]}}]},\"selectAstClass\":null}}]},\"selectAstClass\":null}}]},\"returnType\":{\"type\":\"Identifier\",\"name\":\"Widget\"}}]}]}"},{"name":"RowColumnDSL","classId":"7251e562a7f2859cd246fdff22d5da74","version":"23ebd1dc151d95c519566f4ace953be4","metadata":"FlutterHotWidget","versionDate":1587095897224,"ast":"{\"type\":\"Program\",\"body\":[{\"type\":\"ClassDeclaration\",\"id\":{\"type\":\"Identifier\",\"name\":\"RowColumnDSL\"},\"superClause\":{\"type\":\"Identifier\",\"name\":\"StatefulWidget\"},\"implementsClause\":null,\"mixinClause\":null,\"metadata\":[{\"type\":\"Annotation\",\"id\":{\"type\":\"Identifier\",\"name\":\"FlutterHotWidget\"},\"argumentList\":{\"type\":\"ArgumentList\",\"argumentList\":[]}}],\"body\":[{\"type\":\"MethodDeclaration\",\"id\":{\"type\":\"Identifier\",\"name\":\"createState\"},\"parameters\":{\"type\":\"FormalParameterList\",\"parameterList\":[]},\"typeParameters\":null,\"body\":{\"type\":\"MethodInvocation\",\"callee\":{\"type\":\"Identifier\",\"name\":\"_RowColumnDSLState\"},\"typeArguments\":null,\"argumentList\":{\"type\":\"ArgumentList\",\"argumentList\":[]},\"selectAstClass\":null},\"returnType\":{\"type\":\"Identifier\",\"name\":\"_RowColumnDSLState\"}}]},{\"type\":\"ClassDeclaration\",\"id\":{\"type\":\"Identifier\",\"name\":\"_RowColumnDSLState\"},\"superClause\":{\"type\":\"Identifier\",\"name\":\"State\"},\"implementsClause\":null,\"mixinClause\":null,\"metadata\":[],\"body\":[{\"type\":\"MethodDeclaration\",\"id\":{\"type\":\"Identifier\",\"name\":\"build\"},\"parameters\":{\"type\":\"FormalParameterList\",\"parameterList\":[{\"type\":\"SimpleFormalParameter\",\"typeAnnotaion\":{\"type\":\"Identifier\",\"name\":\"BuildContext\"},\"id\":{\"type\":\"Identifier\",\"name\":\"context\"}}]},\"typeParameters\":null,\"body\":{\"type\":\"BlockStatement\",\"body\":[{\"type\":\"ReturnStatement\",\"argument\":{\"type\":\"MethodInvocation\",\"callee\":{\"type\":\"Identifier\",\"name\":\"Scaffold\"},\"typeArguments\":null,\"argumentList\":{\"type\":\"ArgumentList\",\"argumentList\":[{\"type\":\"NamedExpression\",\"id\":{\"type\":\"Identifier\",\"name\":\"appBar\"},\"expression\":{\"type\":\"MethodInvocation\",\"callee\":{\"type\":\"Identifier\",\"name\":\"AppBar\"},\"typeArguments\":null,\"argumentList\":{\"type\":\"ArgumentList\",\"argumentList\":[{\"type\":\"NamedExpression\",\"id\":{\"type\":\"Identifier\",\"name\":\"backgroundColor\"},\"expression\":{\"type\":\"PrefixedIdentifier\",\"identifier\":{\"type\":\"Identifier\",\"name\":\"red\"},\"prefix\":{\"type\":\"Identifier\",\"name\":\"Colors\"}}},{\"type\":\"NamedExpression\",\"id\":{\"type\":\"Identifier\",\"name\":\"title\"},\"expression\":{\"type\":\"MethodInvocation\",\"callee\":{\"type\":\"Identifier\",\"name\":\"Text\"},\"typeArguments\":null,\"argumentList\":{\"type\":\"ArgumentList\",\"argumentList\":[{\"type\":\"StringLiteral\",\"value\":\"RowColumnDSL\"},{\"type\":\"NamedExpression\",\"id\":{\"type\":\"Identifier\",\"name\":\"style\"},\"expression\":{\"type\":\"MethodInvocation\",\"callee\":{\"type\":\"Identifier\",\"name\":\"TextStyle\"},\"typeArguments\":null,\"argumentList\":{\"type\":\"ArgumentList\",\"argumentList\":[{\"type\":\"NamedExpression\",\"id\":{\"type\":\"Identifier\",\"name\":\"fontSize\"},\"expression\":{\"type\":\"NumericLiteral\",\"value\":20}},{\"type\":\"NamedExpression\",\"id\":{\"type\":\"Identifier\",\"name\":\"color\"},\"expression\":{\"type\":\"PrefixedIdentifier\",\"identifier\":{\"type\":\"Identifier\",\"name\":\"white\"},\"prefix\":{\"type\":\"Identifier\",\"name\":\"Colors\"}}}]},\"selectAstClass\":null}}]},\"selectAstClass\":null}},{\"type\":\"NamedExpression\",\"id\":{\"type\":\"Identifier\",\"name\":\"centerTitle\"},\"expression\":{\"type\":\"BooleanLiteral\",\"value\":true}}]},\"selectAstClass\":null}},{\"type\":\"NamedExpression\",\"id\":{\"type\":\"Identifier\",\"name\":\"body\"},\"expression\":{\"type\":\"MethodInvocation\",\"callee\":{\"type\":\"Identifier\",\"name\":\"Column\"},\"typeArguments\":null,\"argumentList\":{\"type\":\"ArgumentList\",\"argumentList\":[{\"type\":\"NamedExpression\",\"id\":{\"type\":\"Identifier\",\"name\":\"children\"},\"expression\":{\"type\":\"ListLiteral\",\"elements\":[{\"type\":\"MethodInvocation\",\"callee\":{\"type\":\"Identifier\",\"name\":\"Row\"},\"typeArguments\":null,\"argumentList\":{\"type\":\"ArgumentList\",\"argumentList\":[{\"type\":\"NamedExpression\",\"id\":{\"type\":\"Identifier\",\"name\":\"children\"},\"expression\":{\"type\":\"ListLiteral\",\"elements\":[{\"type\":\"MethodInvocation\",\"callee\":{\"type\":\"Identifier\",\"name\":\"Container\"},\"typeArguments\":null,\"argumentList\":{\"type\":\"ArgumentList\",\"argumentList\":[{\"type\":\"NamedExpression\",\"id\":{\"type\":\"Identifier\",\"name\":\"child\"},\"expression\":{\"type\":\"MethodInvocation\",\"callee\":{\"type\":\"Identifier\",\"name\":\"Text\"},\"typeArguments\":null,\"argumentList\":{\"type\":\"ArgumentList\",\"argumentList\":[{\"type\":\"StringLiteral\",\"value\":\"Hellow world 1\"}]},\"selectAstClass\":null}},{\"type\":\"NamedExpression\",\"id\":{\"type\":\"Identifier\",\"name\":\"color\"},\"expression\":{\"type\":\"PrefixedIdentifier\",\"identifier\":{\"type\":\"Identifier\",\"name\":\"blue\"},\"prefix\":{\"type\":\"Identifier\",\"name\":\"Colors\"}}},{\"type\":\"NamedExpression\",\"id\":{\"type\":\"Identifier\",\"name\":\"height\"},\"expression\":{\"type\":\"NumericLiteral\",\"value\":45}}]},\"selectAstClass\":null},{\"type\":\"MethodInvocation\",\"callee\":{\"type\":\"Identifier\",\"name\":\"Container\"},\"typeArguments\":null,\"argumentList\":{\"type\":\"ArgumentList\",\"argumentList\":[{\"type\":\"NamedExpression\",\"id\":{\"type\":\"Identifier\",\"name\":\"child\"},\"expression\":{\"type\":\"MethodInvocation\",\"callee\":{\"type\":\"Identifier\",\"name\":\"Text\"},\"typeArguments\":null,\"argumentList\":{\"type\":\"ArgumentList\",\"argumentList\":[{\"type\":\"StringLiteral\",\"value\":\"Hellow world 2\"},{\"type\":\"NamedExpression\",\"id\":{\"type\":\"Identifier\",\"name\":\"style\"},\"expression\":{\"type\":\"MethodInvocation\",\"callee\":{\"type\":\"Identifier\",\"name\":\"TextStyle\"},\"typeArguments\":null,\"argumentList\":{\"type\":\"ArgumentList\",\"argumentList\":[{\"type\":\"NamedExpression\",\"id\":{\"type\":\"Identifier\",\"name\":\"fontSize\"},\"expression\":{\"type\":\"NumericLiteral\",\"value\":18}}]},\"selectAstClass\":null}}]},\"selectAstClass\":null}},{\"type\":\"NamedExpression\",\"id\":{\"type\":\"Identifier\",\"name\":\"color\"},\"expression\":{\"type\":\"PrefixedIdentifier\",\"identifier\":{\"type\":\"Identifier\",\"name\":\"red\"},\"prefix\":{\"type\":\"Identifier\",\"name\":\"Colors\"}}},{\"type\":\"NamedExpression\",\"id\":{\"type\":\"Identifier\",\"name\":\"height\"},\"expression\":{\"type\":\"NumericLiteral\",\"value\":45}}]},\"selectAstClass\":null}]}}]},\"selectAstClass\":null},{\"type\":\"MethodInvocation\",\"callee\":{\"type\":\"Identifier\",\"name\":\"Row\"},\"typeArguments\":null,\"argumentList\":{\"type\":\"ArgumentList\",\"argumentList\":[{\"type\":\"NamedExpression\",\"id\":{\"type\":\"Identifier\",\"name\":\"children\"},\"expression\":{\"type\":\"ListLiteral\",\"elements\":[{\"type\":\"MethodInvocation\",\"callee\":{\"type\":\"Identifier\",\"name\":\"Container\"},\"typeArguments\":null,\"argumentList\":{\"type\":\"ArgumentList\",\"argumentList\":[{\"type\":\"NamedExpression\",\"id\":{\"type\":\"Identifier\",\"name\":\"child\"},\"expression\":{\"type\":\"MethodInvocation\",\"callee\":{\"type\":\"Identifier\",\"name\":\"Text\"},\"typeArguments\":null,\"argumentList\":{\"type\":\"ArgumentList\",\"argumentList\":[{\"type\":\"StringLiteral\",\"value\":\"Hellow world 2\"},{\"type\":\"NamedExpression\",\"id\":{\"type\":\"Identifier\",\"name\":\"style\"},\"expression\":{\"type\":\"MethodInvocation\",\"callee\":{\"type\":\"Identifier\",\"name\":\"TextStyle\"},\"typeArguments\":null,\"argumentList\":{\"type\":\"ArgumentList\",\"argumentList\":[{\"type\":\"NamedExpression\",\"id\":{\"type\":\"Identifier\",\"name\":\"fontSize\"},\"expression\":{\"type\":\"NumericLiteral\",\"value\":18}}]},\"selectAstClass\":null}}]},\"selectAstClass\":null}},{\"type\":\"NamedExpression\",\"id\":{\"type\":\"Identifier\",\"name\":\"color\"},\"expression\":{\"type\":\"PrefixedIdentifier\",\"identifier\":{\"type\":\"Identifier\",\"name\":\"red\"},\"prefix\":{\"type\":\"Identifier\",\"name\":\"Colors\"}}},{\"type\":\"NamedExpression\",\"id\":{\"type\":\"Identifier\",\"name\":\"height\"},\"expression\":{\"type\":\"NumericLiteral\",\"value\":45}}]},\"selectAstClass\":null},{\"type\":\"MethodInvocation\",\"callee\":{\"type\":\"Identifier\",\"name\":\"Container\"},\"typeArguments\":null,\"argumentList\":{\"type\":\"ArgumentList\",\"argumentList\":[{\"type\":\"NamedExpression\",\"id\":{\"type\":\"Identifier\",\"name\":\"child\"},\"expression\":{\"type\":\"MethodInvocation\",\"callee\":{\"type\":\"Identifier\",\"name\":\"Text\"},\"typeArguments\":null,\"argumentList\":{\"type\":\"ArgumentList\",\"argumentList\":[{\"type\":\"StringLiteral\",\"value\":\"Hellow world 3\"}]},\"selectAstClass\":null}},{\"type\":\"NamedExpression\",\"id\":{\"type\":\"Identifier\",\"name\":\"color\"},\"expression\":{\"type\":\"PrefixedIdentifier\",\"identifier\":{\"type\":\"Identifier\",\"name\":\"green\"},\"prefix\":{\"type\":\"Identifier\",\"name\":\"Colors\"}}},{\"type\":\"NamedExpression\",\"id\":{\"type\":\"Identifier\",\"name\":\"alignment\"},\"expression\":{\"type\":\"PrefixedIdentifier\",\"identifier\":{\"type\":\"Identifier\",\"name\":\"centerLeft\"},\"prefix\":{\"type\":\"Identifier\",\"name\":\"Alignment\"}}},{\"type\":\"NamedExpression\",\"id\":{\"type\":\"Identifier\",\"name\":\"padding\"},\"expression\":{\"type\":\"MethodInvocation\",\"callee\":{\"type\":\"MemberExpression\",\"object\":{\"type\":\"Identifier\",\"name\":\"EdgeInsets\"},\"property\":{\"type\":\"Identifier\",\"name\":\"only\"}},\"typeArguments\":null,\"argumentList\":{\"type\":\"ArgumentList\",\"argumentList\":[{\"type\":\"NamedExpression\",\"id\":{\"type\":\"Identifier\",\"name\":\"left\"},\"expression\":{\"type\":\"NumericLiteral\",\"value\":16}}]},\"selectAstClass\":null}},{\"type\":\"NamedExpression\",\"id\":{\"type\":\"Identifier\",\"name\":\"height\"},\"expression\":{\"type\":\"NumericLiteral\",\"value\":45}}]},\"selectAstClass\":null}]}}]},\"selectAstClass\":null}]}}]},\"selectAstClass\":null}}]},\"selectAstClass\":null}}]},\"returnType\":{\"type\":\"Identifier\",\"name\":\"Widget\"}}]}]}"},{"name":"IconDsl","classId":"a63c89faebb3fb5b2f98ccf086abf367","version":"53a6ced7761ea53368e8cd93be6178c6","metadata":"FlutterHotWidget","versionDate":1587095897224,"ast":"{\"type\":\"Program\",\"body\":[{\"type\":\"ClassDeclaration\",\"id\":{\"type\":\"Identifier\",\"name\":\"IconDsl\"},\"superClause\":{\"type\":\"Identifier\",\"name\":\"StatefulWidget\"},\"implementsClause\":{\"type\":\"ImplementsClause\",\"implements\":[{\"type\":\"Identifier\",\"name\":\"FHBaseWidget\"}]},\"mixinClause\":null,\"metadata\":[{\"type\":\"Annotation\",\"id\":{\"type\":\"Identifier\",\"name\":\"FlutterHotWidget\"},\"argumentList\":{\"type\":\"ArgumentList\",\"argumentList\":[]}}],\"body\":[{\"type\":\"MethodDeclaration\",\"id\":{\"type\":\"Identifier\",\"name\":\"createState\"},\"parameters\":{\"type\":\"FormalParameterList\",\"parameterList\":[]},\"typeParameters\":null,\"body\":{\"type\":\"MethodInvocation\",\"callee\":{\"type\":\"Identifier\",\"name\":\"_IconDslState\"},\"typeArguments\":null,\"argumentList\":{\"type\":\"ArgumentList\",\"argumentList\":[]},\"selectAstClass\":null},\"returnType\":{\"type\":\"Identifier\",\"name\":\"_IconDslState\"}},{\"type\":\"MethodDeclaration\",\"id\":{\"type\":\"Identifier\",\"name\":\"widget\"},\"parameters\":null,\"typeParameters\":null,\"body\":null,\"returnType\":{\"type\":\"Identifier\",\"name\":\"Widget\"}}]},{\"type\":\"ClassDeclaration\",\"id\":{\"type\":\"Identifier\",\"name\":\"_IconDslState\"},\"superClause\":{\"type\":\"Identifier\",\"name\":\"State\"},\"implementsClause\":null,\"mixinClause\":null,\"metadata\":[],\"body\":[{\"type\":\"MethodDeclaration\",\"id\":{\"type\":\"Identifier\",\"name\":\"build\"},\"parameters\":{\"type\":\"FormalParameterList\",\"parameterList\":[{\"type\":\"SimpleFormalParameter\",\"typeAnnotaion\":{\"type\":\"Identifier\",\"name\":\"BuildContext\"},\"id\":{\"type\":\"Identifier\",\"name\":\"context\"}}]},\"typeParameters\":null,\"body\":{\"type\":\"BlockStatement\",\"body\":[{\"type\":\"ReturnStatement\",\"argument\":{\"type\":\"MethodInvocation\",\"callee\":{\"type\":\"Identifier\",\"name\":\"Container\"},\"typeArguments\":null,\"argumentList\":{\"type\":\"ArgumentList\",\"argumentList\":[{\"type\":\"NamedExpression\",\"id\":{\"type\":\"Identifier\",\"name\":\"color\"},\"expression\":{\"type\":\"PrefixedIdentifier\",\"identifier\":{\"type\":\"Identifier\",\"name\":\"blue\"},\"prefix\":{\"type\":\"Identifier\",\"name\":\"Colors\"}}},{\"type\":\"NamedExpression\",\"id\":{\"type\":\"Identifier\",\"name\":\"margin\"},\"expression\":{\"type\":\"MethodInvocation\",\"callee\":{\"type\":\"MemberExpression\",\"object\":{\"type\":\"Identifier\",\"name\":\"EdgeInsets\"},\"property\":{\"type\":\"Identifier\",\"name\":\"all\"}},\"typeArguments\":null,\"argumentList\":{\"type\":\"ArgumentList\",\"argumentList\":[{\"type\":\"NumericLiteral\",\"value\":16}]},\"selectAstClass\":null}},{\"type\":\"NamedExpression\",\"id\":{\"type\":\"Identifier\",\"name\":\"alignment\"},\"expression\":{\"type\":\"PrefixedIdentifier\",\"identifier\":{\"type\":\"Identifier\",\"name\":\"center\"},\"prefix\":{\"type\":\"Identifier\",\"name\":\"Alignment\"}}},{\"type\":\"NamedExpression\",\"id\":{\"type\":\"Identifier\",\"name\":\"child\"},\"expression\":{\"type\":\"MethodInvocation\",\"callee\":{\"type\":\"Identifier\",\"name\":\"Text\"},\"typeArguments\":null,\"argumentList\":{\"type\":\"ArgumentList\",\"argumentList\":[{\"type\":\"StringLiteral\",\"value\":\"Hello world\"},{\"type\":\"NamedExpression\",\"id\":{\"type\":\"Identifier\",\"name\":\"style\"},\"expression\":{\"type\":\"MethodInvocation\",\"callee\":{\"type\":\"Identifier\",\"name\":\"TextStyle\"},\"typeArguments\":null,\"argumentList\":{\"type\":\"ArgumentList\",\"argumentList\":[{\"type\":\"NamedExpression\",\"id\":{\"type\":\"Identifier\",\"name\":\"color\"},\"expression\":{\"type\":\"PrefixedIdentifier\",\"identifier\":{\"type\":\"Identifier\",\"name\":\"white\"},\"prefix\":{\"type\":\"Identifier\",\"name\":\"Colors\"}}},{\"type\":\"NamedExpression\",\"id\":{\"type\":\"Identifier\",\"name\":\"fontSize\"},\"expression\":{\"type\":\"NumericLiteral\",\"value\":24}}]},\"selectAstClass\":null}}]},\"selectAstClass\":null}}]},\"selectAstClass\":null}}]},\"returnType\":{\"type\":\"Identifier\",\"name\":\"Widget\"}}]}]}"},{"name":"ScaffoldDSL","classId":"16c7389376fba1ff879c6f7a91f5f190","version":"bb4af7e09335b59d3320231b1e7c4ba4","metadata":"FlutterHotWidget","versionDate":1587095897225,"ast":"{\"type\":\"Program\",\"body\":[{\"type\":\"ClassDeclaration\",\"id\":{\"type\":\"Identifier\",\"name\":\"ScaffoldDSL\"},\"superClause\":{\"type\":\"Identifier\",\"name\":\"StatefulWidget\"},\"implementsClause\":null,\"mixinClause\":null,\"metadata\":[{\"type\":\"Annotation\",\"id\":{\"type\":\"Identifier\",\"name\":\"FlutterHotWidget\"},\"argumentList\":{\"type\":\"ArgumentList\",\"argumentList\":[]}}],\"body\":[{\"type\":\"MethodDeclaration\",\"id\":{\"type\":\"Identifier\",\"name\":\"createState\"},\"parameters\":{\"type\":\"FormalParameterList\",\"parameterList\":[]},\"typeParameters\":null,\"body\":{\"type\":\"MethodInvocation\",\"callee\":{\"type\":\"Identifier\",\"name\":\"_ScaffoldDSLState\"},\"typeArguments\":null,\"argumentList\":{\"type\":\"ArgumentList\",\"argumentList\":[]},\"selectAstClass\":null},\"returnType\":{\"type\":\"Identifier\",\"name\":\"_ScaffoldDSLState\"}}]},{\"type\":\"ClassDeclaration\",\"id\":{\"type\":\"Identifier\",\"name\":\"_ScaffoldDSLState\"},\"superClause\":{\"type\":\"Identifier\",\"name\":\"State\"},\"implementsClause\":null,\"mixinClause\":null,\"metadata\":[],\"body\":[{\"type\":\"MethodDeclaration\",\"id\":{\"type\":\"Identifier\",\"name\":\"build\"},\"parameters\":{\"type\":\"FormalParameterList\",\"parameterList\":[{\"type\":\"SimpleFormalParameter\",\"typeAnnotaion\":{\"type\":\"Identifier\",\"name\":\"BuildContext\"},\"id\":{\"type\":\"Identifier\",\"name\":\"context\"}}]},\"typeParameters\":null,\"body\":{\"type\":\"BlockStatement\",\"body\":[{\"type\":\"ReturnStatement\",\"argument\":{\"type\":\"MethodInvocation\",\"callee\":{\"type\":\"Identifier\",\"name\":\"Scaffold\"},\"typeArguments\":null,\"argumentList\":{\"type\":\"ArgumentList\",\"argumentList\":[{\"type\":\"NamedExpression\",\"id\":{\"type\":\"Identifier\",\"name\":\"appBar\"},\"expression\":{\"type\":\"MethodInvocation\",\"callee\":{\"type\":\"Identifier\",\"name\":\"AppBar\"},\"typeArguments\":null,\"argumentList\":{\"type\":\"ArgumentList\",\"argumentList\":[{\"type\":\"NamedExpression\",\"id\":{\"type\":\"Identifier\",\"name\":\"backgroundColor\"},\"expression\":{\"type\":\"PrefixedIdentifier\",\"identifier\":{\"type\":\"Identifier\",\"name\":\"red\"},\"prefix\":{\"type\":\"Identifier\",\"name\":\"Colors\"}}},{\"type\":\"NamedExpression\",\"id\":{\"type\":\"Identifier\",\"name\":\"title\"},\"expression\":{\"type\":\"MethodInvocation\",\"callee\":{\"type\":\"Identifier\",\"name\":\"Text\"},\"typeArguments\":null,\"argumentList\":{\"type\":\"ArgumentList\",\"argumentList\":[{\"type\":\"StringLiteral\",\"value\":\"Scaffold\"},{\"type\":\"NamedExpression\",\"id\":{\"type\":\"Identifier\",\"name\":\"style\"},\"expression\":{\"type\":\"MethodInvocation\",\"callee\":{\"type\":\"Identifier\",\"name\":\"TextStyle\"},\"typeArguments\":null,\"argumentList\":{\"type\":\"ArgumentList\",\"argumentList\":[{\"type\":\"NamedExpression\",\"id\":{\"type\":\"Identifier\",\"name\":\"fontSize\"},\"expression\":{\"type\":\"NumericLiteral\",\"value\":20}},{\"type\":\"NamedExpression\",\"id\":{\"type\":\"Identifier\",\"name\":\"color\"},\"expression\":{\"type\":\"PrefixedIdentifier\",\"identifier\":{\"type\":\"Identifier\",\"name\":\"white\"},\"prefix\":{\"type\":\"Identifier\",\"name\":\"Colors\"}}}]},\"selectAstClass\":null}}]},\"selectAstClass\":null}},{\"type\":\"NamedExpression\",\"id\":{\"type\":\"Identifier\",\"name\":\"centerTitle\"},\"expression\":{\"type\":\"BooleanLiteral\",\"value\":true}}]},\"selectAstClass\":null}},{\"type\":\"NamedExpression\",\"id\":{\"type\":\"Identifier\",\"name\":\"body\"},\"expression\":{\"type\":\"MethodInvocation\",\"callee\":{\"type\":\"Identifier\",\"name\":\"Container\"},\"typeArguments\":null,\"argumentList\":{\"type\":\"ArgumentList\",\"argumentList\":[{\"type\":\"NamedExpression\",\"id\":{\"type\":\"Identifier\",\"name\":\"color\"},\"expression\":{\"type\":\"PrefixedIdentifier\",\"identifier\":{\"type\":\"Identifier\",\"name\":\"blue\"},\"prefix\":{\"type\":\"Identifier\",\"name\":\"Colors\"}}},{\"type\":\"NamedExpression\",\"id\":{\"type\":\"Identifier\",\"name\":\"margin\"},\"expression\":{\"type\":\"MethodInvocation\",\"callee\":{\"type\":\"MemberExpression\",\"object\":{\"type\":\"Identifier\",\"name\":\"EdgeInsets\"},\"property\":{\"type\":\"Identifier\",\"name\":\"all\"}},\"typeArguments\":null,\"argumentList\":{\"type\":\"ArgumentList\",\"argumentList\":[{\"type\":\"NumericLiteral\",\"value\":16}]},\"selectAstClass\":null}},{\"type\":\"NamedExpression\",\"id\":{\"type\":\"Identifier\",\"name\":\"alignment\"},\"expression\":{\"type\":\"PrefixedIdentifier\",\"identifier\":{\"type\":\"Identifier\",\"name\":\"center\"},\"prefix\":{\"type\":\"Identifier\",\"name\":\"Alignment\"}}},{\"type\":\"NamedExpression\",\"id\":{\"type\":\"Identifier\",\"name\":\"child\"},\"expression\":{\"type\":\"MethodInvocation\",\"callee\":{\"type\":\"Identifier\",\"name\":\"selectWidget\"},\"typeArguments\":{\"type\":\"TypeArgumentList\",\"arguments\":[{\"type\":\"Identifier\",\"name\":\"IconDsl\"}]},\"argumentList\":{\"type\":\"ArgumentList\",\"argumentList\":[{\"type\":\"MethodInvocation\",\"callee\":{\"type\":\"Identifier\",\"name\":\"IconDsl\"},\"typeArguments\":null,\"argumentList\":{\"type\":\"ArgumentList\",\"argumentList\":[]},\"selectAstClass\":null}]},\"selectAstClass\":{\"classId\":\"a63c89faebb3fb5b2f98ccf086abf367\",\"filePath\":\"./lib/dsl/icon_dsl.dart\",\"version\":\"53a6ced7761ea53368e8cd93be6178c6\",\"name\":\"IconDsl\",\"metadata\":\"FlutterHotWidget\"}}}]},\"selectAstClass\":null}}]},\"selectAstClass\":null}}]},\"returnType\":{\"type\":\"Identifier\",\"name\":\"Widget\"}}]}]}"}] -------------------------------------------------------------------------------- /example/ios/Flutter/AppFrameworkInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | App 9 | CFBundleIdentifier 10 | io.flutter.flutter.app 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | App 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1.0 23 | MinimumOSVersion 24 | 8.0 25 | 26 | 27 | -------------------------------------------------------------------------------- /example/ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /example/ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /example/ios/Podfile: -------------------------------------------------------------------------------- 1 | # Uncomment this line to define a global platform for your project 2 | # platform :ios, '9.0' 3 | 4 | # CocoaPods analytics sends network stats synchronously affecting flutter build latency. 5 | ENV['COCOAPODS_DISABLE_STATS'] = 'true' 6 | 7 | project 'Runner', { 8 | 'Debug' => :debug, 9 | 'Profile' => :release, 10 | 'Release' => :release, 11 | } 12 | 13 | def parse_KV_file(file, separator='=') 14 | file_abs_path = File.expand_path(file) 15 | if !File.exists? file_abs_path 16 | return []; 17 | end 18 | pods_ary = [] 19 | skip_line_start_symbols = ["#", "/"] 20 | File.foreach(file_abs_path) { |line| 21 | next if skip_line_start_symbols.any? { |symbol| line =~ /^\s*#{symbol}/ } 22 | plugin = line.split(pattern=separator) 23 | if plugin.length == 2 24 | podname = plugin[0].strip() 25 | path = plugin[1].strip() 26 | podpath = File.expand_path("#{path}", file_abs_path) 27 | pods_ary.push({:name => podname, :path => podpath}); 28 | else 29 | puts "Invalid plugin specification: #{line}" 30 | end 31 | } 32 | return pods_ary 33 | end 34 | 35 | target 'Runner' do 36 | use_frameworks! 37 | 38 | # Prepare symlinks folder. We use symlinks to avoid having Podfile.lock 39 | # referring to absolute paths on developers' machines. 40 | system('rm -rf .symlinks') 41 | system('mkdir -p .symlinks/plugins') 42 | 43 | # Flutter Pods 44 | generated_xcode_build_settings = parse_KV_file('./Flutter/Generated.xcconfig') 45 | if generated_xcode_build_settings.empty? 46 | puts "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter pub get is executed first." 47 | end 48 | generated_xcode_build_settings.map { |p| 49 | if p[:name] == 'FLUTTER_FRAMEWORK_DIR' 50 | symlink = File.join('.symlinks', 'flutter') 51 | File.symlink(File.dirname(p[:path]), symlink) 52 | pod 'Flutter', :path => File.join(symlink, File.basename(p[:path])) 53 | end 54 | } 55 | 56 | # Plugin Pods 57 | plugin_pods = parse_KV_file('../.flutter-plugins') 58 | plugin_pods.map { |p| 59 | symlink = File.join('.symlinks', 'plugins', p[:name]) 60 | File.symlink(p[:path], symlink) 61 | pod p[:name], :path => File.join(symlink, 'ios') 62 | } 63 | end 64 | 65 | # Prevent Cocoapods from embedding a second Flutter framework and causing an error with the new Xcode build system. 66 | install! 'cocoapods', :disable_input_output_paths => true 67 | 68 | post_install do |installer| 69 | installer.pods_project.targets.each do |target| 70 | target.build_configurations.each do |config| 71 | config.build_settings['ENABLE_BITCODE'] = 'NO' 72 | end 73 | end 74 | end 75 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; 11 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; 12 | 3B80C3941E831B6300D905FE /* App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; }; 13 | 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 14 | 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; 15 | 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; }; 16 | 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 17 | 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 9740EEB21CF90195004384FC /* Debug.xcconfig */; }; 18 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 19 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 20 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; 21 | /* End PBXBuildFile section */ 22 | 23 | /* Begin PBXCopyFilesBuildPhase section */ 24 | 9705A1C41CF9048500538489 /* Embed Frameworks */ = { 25 | isa = PBXCopyFilesBuildPhase; 26 | buildActionMask = 2147483647; 27 | dstPath = ""; 28 | dstSubfolderSpec = 10; 29 | files = ( 30 | 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */, 31 | 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */, 32 | ); 33 | name = "Embed Frameworks"; 34 | runOnlyForDeploymentPostprocessing = 0; 35 | }; 36 | /* End PBXCopyFilesBuildPhase section */ 37 | 38 | /* Begin PBXFileReference section */ 39 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 40 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; 41 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; 42 | 3B80C3931E831B6300D905FE /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/App.framework; sourceTree = ""; }; 43 | 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; 44 | 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 45 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; 46 | 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 47 | 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; 48 | 9740EEBA1CF902C7004384FC /* Flutter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Flutter.framework; path = Flutter/Flutter.framework; sourceTree = ""; }; 49 | 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; 50 | 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 51 | 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 52 | 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 53 | 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 54 | /* End PBXFileReference section */ 55 | 56 | /* Begin PBXFrameworksBuildPhase section */ 57 | 97C146EB1CF9000F007C117D /* Frameworks */ = { 58 | isa = PBXFrameworksBuildPhase; 59 | buildActionMask = 2147483647; 60 | files = ( 61 | 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */, 62 | 3B80C3941E831B6300D905FE /* App.framework in Frameworks */, 63 | ); 64 | runOnlyForDeploymentPostprocessing = 0; 65 | }; 66 | /* End PBXFrameworksBuildPhase section */ 67 | 68 | /* Begin PBXGroup section */ 69 | 9740EEB11CF90186004384FC /* Flutter */ = { 70 | isa = PBXGroup; 71 | children = ( 72 | 3B80C3931E831B6300D905FE /* App.framework */, 73 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, 74 | 9740EEBA1CF902C7004384FC /* Flutter.framework */, 75 | 9740EEB21CF90195004384FC /* Debug.xcconfig */, 76 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, 77 | 9740EEB31CF90195004384FC /* Generated.xcconfig */, 78 | ); 79 | name = Flutter; 80 | sourceTree = ""; 81 | }; 82 | 97C146E51CF9000F007C117D = { 83 | isa = PBXGroup; 84 | children = ( 85 | 9740EEB11CF90186004384FC /* Flutter */, 86 | 97C146F01CF9000F007C117D /* Runner */, 87 | 97C146EF1CF9000F007C117D /* Products */, 88 | ); 89 | sourceTree = ""; 90 | }; 91 | 97C146EF1CF9000F007C117D /* Products */ = { 92 | isa = PBXGroup; 93 | children = ( 94 | 97C146EE1CF9000F007C117D /* Runner.app */, 95 | ); 96 | name = Products; 97 | sourceTree = ""; 98 | }; 99 | 97C146F01CF9000F007C117D /* Runner */ = { 100 | isa = PBXGroup; 101 | children = ( 102 | 97C146FA1CF9000F007C117D /* Main.storyboard */, 103 | 97C146FD1CF9000F007C117D /* Assets.xcassets */, 104 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, 105 | 97C147021CF9000F007C117D /* Info.plist */, 106 | 97C146F11CF9000F007C117D /* Supporting Files */, 107 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, 108 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, 109 | 74858FAE1ED2DC5600515810 /* AppDelegate.swift */, 110 | 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */, 111 | ); 112 | path = Runner; 113 | sourceTree = ""; 114 | }; 115 | 97C146F11CF9000F007C117D /* Supporting Files */ = { 116 | isa = PBXGroup; 117 | children = ( 118 | ); 119 | name = "Supporting Files"; 120 | sourceTree = ""; 121 | }; 122 | /* End PBXGroup section */ 123 | 124 | /* Begin PBXNativeTarget section */ 125 | 97C146ED1CF9000F007C117D /* Runner */ = { 126 | isa = PBXNativeTarget; 127 | buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; 128 | buildPhases = ( 129 | 9740EEB61CF901F6004384FC /* Run Script */, 130 | 97C146EA1CF9000F007C117D /* Sources */, 131 | 97C146EB1CF9000F007C117D /* Frameworks */, 132 | 97C146EC1CF9000F007C117D /* Resources */, 133 | 9705A1C41CF9048500538489 /* Embed Frameworks */, 134 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */, 135 | ); 136 | buildRules = ( 137 | ); 138 | dependencies = ( 139 | ); 140 | name = Runner; 141 | productName = Runner; 142 | productReference = 97C146EE1CF9000F007C117D /* Runner.app */; 143 | productType = "com.apple.product-type.application"; 144 | }; 145 | /* End PBXNativeTarget section */ 146 | 147 | /* Begin PBXProject section */ 148 | 97C146E61CF9000F007C117D /* Project object */ = { 149 | isa = PBXProject; 150 | attributes = { 151 | LastUpgradeCheck = 1020; 152 | ORGANIZATIONNAME = "The Chromium Authors"; 153 | TargetAttributes = { 154 | 97C146ED1CF9000F007C117D = { 155 | CreatedOnToolsVersion = 7.3.1; 156 | LastSwiftMigration = 0910; 157 | }; 158 | }; 159 | }; 160 | buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; 161 | compatibilityVersion = "Xcode 3.2"; 162 | developmentRegion = en; 163 | hasScannedForEncodings = 0; 164 | knownRegions = ( 165 | en, 166 | Base, 167 | ); 168 | mainGroup = 97C146E51CF9000F007C117D; 169 | productRefGroup = 97C146EF1CF9000F007C117D /* Products */; 170 | projectDirPath = ""; 171 | projectRoot = ""; 172 | targets = ( 173 | 97C146ED1CF9000F007C117D /* Runner */, 174 | ); 175 | }; 176 | /* End PBXProject section */ 177 | 178 | /* Begin PBXResourcesBuildPhase section */ 179 | 97C146EC1CF9000F007C117D /* Resources */ = { 180 | isa = PBXResourcesBuildPhase; 181 | buildActionMask = 2147483647; 182 | files = ( 183 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, 184 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, 185 | 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */, 186 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, 187 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, 188 | ); 189 | runOnlyForDeploymentPostprocessing = 0; 190 | }; 191 | /* End PBXResourcesBuildPhase section */ 192 | 193 | /* Begin PBXShellScriptBuildPhase section */ 194 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { 195 | isa = PBXShellScriptBuildPhase; 196 | buildActionMask = 2147483647; 197 | files = ( 198 | ); 199 | inputPaths = ( 200 | ); 201 | name = "Thin Binary"; 202 | outputPaths = ( 203 | ); 204 | runOnlyForDeploymentPostprocessing = 0; 205 | shellPath = /bin/sh; 206 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" thin"; 207 | }; 208 | 9740EEB61CF901F6004384FC /* Run Script */ = { 209 | isa = PBXShellScriptBuildPhase; 210 | buildActionMask = 2147483647; 211 | files = ( 212 | ); 213 | inputPaths = ( 214 | ); 215 | name = "Run Script"; 216 | outputPaths = ( 217 | ); 218 | runOnlyForDeploymentPostprocessing = 0; 219 | shellPath = /bin/sh; 220 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; 221 | }; 222 | /* End PBXShellScriptBuildPhase section */ 223 | 224 | /* Begin PBXSourcesBuildPhase section */ 225 | 97C146EA1CF9000F007C117D /* Sources */ = { 226 | isa = PBXSourcesBuildPhase; 227 | buildActionMask = 2147483647; 228 | files = ( 229 | 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */, 230 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, 231 | ); 232 | runOnlyForDeploymentPostprocessing = 0; 233 | }; 234 | /* End PBXSourcesBuildPhase section */ 235 | 236 | /* Begin PBXVariantGroup section */ 237 | 97C146FA1CF9000F007C117D /* Main.storyboard */ = { 238 | isa = PBXVariantGroup; 239 | children = ( 240 | 97C146FB1CF9000F007C117D /* Base */, 241 | ); 242 | name = Main.storyboard; 243 | sourceTree = ""; 244 | }; 245 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = { 246 | isa = PBXVariantGroup; 247 | children = ( 248 | 97C147001CF9000F007C117D /* Base */, 249 | ); 250 | name = LaunchScreen.storyboard; 251 | sourceTree = ""; 252 | }; 253 | /* End PBXVariantGroup section */ 254 | 255 | /* Begin XCBuildConfiguration section */ 256 | 249021D3217E4FDB00AE95B9 /* Profile */ = { 257 | isa = XCBuildConfiguration; 258 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 259 | buildSettings = { 260 | ALWAYS_SEARCH_USER_PATHS = NO; 261 | CLANG_ANALYZER_NONNULL = YES; 262 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 263 | CLANG_CXX_LIBRARY = "libc++"; 264 | CLANG_ENABLE_MODULES = YES; 265 | CLANG_ENABLE_OBJC_ARC = YES; 266 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 267 | CLANG_WARN_BOOL_CONVERSION = YES; 268 | CLANG_WARN_COMMA = YES; 269 | CLANG_WARN_CONSTANT_CONVERSION = YES; 270 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 271 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 272 | CLANG_WARN_EMPTY_BODY = YES; 273 | CLANG_WARN_ENUM_CONVERSION = YES; 274 | CLANG_WARN_INFINITE_RECURSION = YES; 275 | CLANG_WARN_INT_CONVERSION = YES; 276 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 277 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 278 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 279 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 280 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 281 | CLANG_WARN_STRICT_PROTOTYPES = YES; 282 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 283 | CLANG_WARN_UNREACHABLE_CODE = YES; 284 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 285 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 286 | COPY_PHASE_STRIP = NO; 287 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 288 | ENABLE_NS_ASSERTIONS = NO; 289 | ENABLE_STRICT_OBJC_MSGSEND = YES; 290 | GCC_C_LANGUAGE_STANDARD = gnu99; 291 | GCC_NO_COMMON_BLOCKS = YES; 292 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 293 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 294 | GCC_WARN_UNDECLARED_SELECTOR = YES; 295 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 296 | GCC_WARN_UNUSED_FUNCTION = YES; 297 | GCC_WARN_UNUSED_VARIABLE = YES; 298 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 299 | MTL_ENABLE_DEBUG_INFO = NO; 300 | SDKROOT = iphoneos; 301 | TARGETED_DEVICE_FAMILY = "1,2"; 302 | VALIDATE_PRODUCT = YES; 303 | }; 304 | name = Profile; 305 | }; 306 | 249021D4217E4FDB00AE95B9 /* Profile */ = { 307 | isa = XCBuildConfiguration; 308 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 309 | buildSettings = { 310 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 311 | CLANG_ENABLE_MODULES = YES; 312 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 313 | ENABLE_BITCODE = NO; 314 | FRAMEWORK_SEARCH_PATHS = ( 315 | "$(inherited)", 316 | "$(PROJECT_DIR)/Flutter", 317 | ); 318 | INFOPLIST_FILE = Runner/Info.plist; 319 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 320 | LIBRARY_SEARCH_PATHS = ( 321 | "$(inherited)", 322 | "$(PROJECT_DIR)/Flutter", 323 | ); 324 | PRODUCT_BUNDLE_IDENTIFIER = com.newcoretech.flutterHotWidget; 325 | PRODUCT_NAME = "$(TARGET_NAME)"; 326 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 327 | SWIFT_VERSION = 4.0; 328 | VERSIONING_SYSTEM = "apple-generic"; 329 | }; 330 | name = Profile; 331 | }; 332 | 97C147031CF9000F007C117D /* Debug */ = { 333 | isa = XCBuildConfiguration; 334 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; 335 | buildSettings = { 336 | ALWAYS_SEARCH_USER_PATHS = NO; 337 | CLANG_ANALYZER_NONNULL = YES; 338 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 339 | CLANG_CXX_LIBRARY = "libc++"; 340 | CLANG_ENABLE_MODULES = YES; 341 | CLANG_ENABLE_OBJC_ARC = YES; 342 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 343 | CLANG_WARN_BOOL_CONVERSION = YES; 344 | CLANG_WARN_COMMA = YES; 345 | CLANG_WARN_CONSTANT_CONVERSION = YES; 346 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 347 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 348 | CLANG_WARN_EMPTY_BODY = YES; 349 | CLANG_WARN_ENUM_CONVERSION = YES; 350 | CLANG_WARN_INFINITE_RECURSION = YES; 351 | CLANG_WARN_INT_CONVERSION = YES; 352 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 353 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 354 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 355 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 356 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 357 | CLANG_WARN_STRICT_PROTOTYPES = YES; 358 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 359 | CLANG_WARN_UNREACHABLE_CODE = YES; 360 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 361 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 362 | COPY_PHASE_STRIP = NO; 363 | DEBUG_INFORMATION_FORMAT = dwarf; 364 | ENABLE_STRICT_OBJC_MSGSEND = YES; 365 | ENABLE_TESTABILITY = YES; 366 | GCC_C_LANGUAGE_STANDARD = gnu99; 367 | GCC_DYNAMIC_NO_PIC = NO; 368 | GCC_NO_COMMON_BLOCKS = YES; 369 | GCC_OPTIMIZATION_LEVEL = 0; 370 | GCC_PREPROCESSOR_DEFINITIONS = ( 371 | "DEBUG=1", 372 | "$(inherited)", 373 | ); 374 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 375 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 376 | GCC_WARN_UNDECLARED_SELECTOR = YES; 377 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 378 | GCC_WARN_UNUSED_FUNCTION = YES; 379 | GCC_WARN_UNUSED_VARIABLE = YES; 380 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 381 | MTL_ENABLE_DEBUG_INFO = YES; 382 | ONLY_ACTIVE_ARCH = YES; 383 | SDKROOT = iphoneos; 384 | TARGETED_DEVICE_FAMILY = "1,2"; 385 | }; 386 | name = Debug; 387 | }; 388 | 97C147041CF9000F007C117D /* Release */ = { 389 | isa = XCBuildConfiguration; 390 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 391 | buildSettings = { 392 | ALWAYS_SEARCH_USER_PATHS = NO; 393 | CLANG_ANALYZER_NONNULL = YES; 394 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 395 | CLANG_CXX_LIBRARY = "libc++"; 396 | CLANG_ENABLE_MODULES = YES; 397 | CLANG_ENABLE_OBJC_ARC = YES; 398 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 399 | CLANG_WARN_BOOL_CONVERSION = YES; 400 | CLANG_WARN_COMMA = YES; 401 | CLANG_WARN_CONSTANT_CONVERSION = YES; 402 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 403 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 404 | CLANG_WARN_EMPTY_BODY = YES; 405 | CLANG_WARN_ENUM_CONVERSION = YES; 406 | CLANG_WARN_INFINITE_RECURSION = YES; 407 | CLANG_WARN_INT_CONVERSION = YES; 408 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 409 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 410 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 411 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 412 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 413 | CLANG_WARN_STRICT_PROTOTYPES = YES; 414 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 415 | CLANG_WARN_UNREACHABLE_CODE = YES; 416 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 417 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 418 | COPY_PHASE_STRIP = NO; 419 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 420 | ENABLE_NS_ASSERTIONS = NO; 421 | ENABLE_STRICT_OBJC_MSGSEND = YES; 422 | GCC_C_LANGUAGE_STANDARD = gnu99; 423 | GCC_NO_COMMON_BLOCKS = YES; 424 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 425 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 426 | GCC_WARN_UNDECLARED_SELECTOR = YES; 427 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 428 | GCC_WARN_UNUSED_FUNCTION = YES; 429 | GCC_WARN_UNUSED_VARIABLE = YES; 430 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 431 | MTL_ENABLE_DEBUG_INFO = NO; 432 | SDKROOT = iphoneos; 433 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 434 | TARGETED_DEVICE_FAMILY = "1,2"; 435 | VALIDATE_PRODUCT = YES; 436 | }; 437 | name = Release; 438 | }; 439 | 97C147061CF9000F007C117D /* Debug */ = { 440 | isa = XCBuildConfiguration; 441 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; 442 | buildSettings = { 443 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 444 | CLANG_ENABLE_MODULES = YES; 445 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 446 | ENABLE_BITCODE = NO; 447 | FRAMEWORK_SEARCH_PATHS = ( 448 | "$(inherited)", 449 | "$(PROJECT_DIR)/Flutter", 450 | ); 451 | INFOPLIST_FILE = Runner/Info.plist; 452 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 453 | LIBRARY_SEARCH_PATHS = ( 454 | "$(inherited)", 455 | "$(PROJECT_DIR)/Flutter", 456 | ); 457 | PRODUCT_BUNDLE_IDENTIFIER = com.newcoretech.flutterHotWidget; 458 | PRODUCT_NAME = "$(TARGET_NAME)"; 459 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 460 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 461 | SWIFT_VERSION = 4.0; 462 | VERSIONING_SYSTEM = "apple-generic"; 463 | }; 464 | name = Debug; 465 | }; 466 | 97C147071CF9000F007C117D /* Release */ = { 467 | isa = XCBuildConfiguration; 468 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 469 | buildSettings = { 470 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 471 | CLANG_ENABLE_MODULES = YES; 472 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 473 | ENABLE_BITCODE = NO; 474 | FRAMEWORK_SEARCH_PATHS = ( 475 | "$(inherited)", 476 | "$(PROJECT_DIR)/Flutter", 477 | ); 478 | INFOPLIST_FILE = Runner/Info.plist; 479 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 480 | LIBRARY_SEARCH_PATHS = ( 481 | "$(inherited)", 482 | "$(PROJECT_DIR)/Flutter", 483 | ); 484 | PRODUCT_BUNDLE_IDENTIFIER = com.newcoretech.flutterHotWidget; 485 | PRODUCT_NAME = "$(TARGET_NAME)"; 486 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 487 | SWIFT_VERSION = 4.0; 488 | VERSIONING_SYSTEM = "apple-generic"; 489 | }; 490 | name = Release; 491 | }; 492 | /* End XCBuildConfiguration section */ 493 | 494 | /* Begin XCConfigurationList section */ 495 | 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { 496 | isa = XCConfigurationList; 497 | buildConfigurations = ( 498 | 97C147031CF9000F007C117D /* Debug */, 499 | 97C147041CF9000F007C117D /* Release */, 500 | 249021D3217E4FDB00AE95B9 /* Profile */, 501 | ); 502 | defaultConfigurationIsVisible = 0; 503 | defaultConfigurationName = Release; 504 | }; 505 | 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = { 506 | isa = XCConfigurationList; 507 | buildConfigurations = ( 508 | 97C147061CF9000F007C117D /* Debug */, 509 | 97C147071CF9000F007C117D /* Release */, 510 | 249021D4217E4FDB00AE95B9 /* Profile */, 511 | ); 512 | defaultConfigurationIsVisible = 0; 513 | defaultConfigurationName = Release; 514 | }; 515 | /* End XCConfigurationList section */ 516 | 517 | }; 518 | rootObject = 97C146E61CF9000F007C117D /* Project object */; 519 | } 520 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 54 | 56 | 62 | 63 | 64 | 65 | 66 | 67 | 73 | 75 | 81 | 82 | 83 | 84 | 86 | 87 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /example/ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/ios/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | import Flutter 3 | 4 | @UIApplicationMain 5 | @objc class AppDelegate: FlutterAppDelegate { 6 | override func application( 7 | _ application: UIApplication, 8 | didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? 9 | ) -> Bool { 10 | GeneratedPluginRegistrant.register(with: self) 11 | return super.application(application, didFinishLaunchingWithOptions: launchOptions) 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "20x20", 5 | "idiom" : "iphone", 6 | "filename" : "Icon-App-20x20@2x.png", 7 | "scale" : "2x" 8 | }, 9 | { 10 | "size" : "20x20", 11 | "idiom" : "iphone", 12 | "filename" : "Icon-App-20x20@3x.png", 13 | "scale" : "3x" 14 | }, 15 | { 16 | "size" : "29x29", 17 | "idiom" : "iphone", 18 | "filename" : "Icon-App-29x29@1x.png", 19 | "scale" : "1x" 20 | }, 21 | { 22 | "size" : "29x29", 23 | "idiom" : "iphone", 24 | "filename" : "Icon-App-29x29@2x.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "29x29", 29 | "idiom" : "iphone", 30 | "filename" : "Icon-App-29x29@3x.png", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "size" : "40x40", 35 | "idiom" : "iphone", 36 | "filename" : "Icon-App-40x40@2x.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "40x40", 41 | "idiom" : "iphone", 42 | "filename" : "Icon-App-40x40@3x.png", 43 | "scale" : "3x" 44 | }, 45 | { 46 | "size" : "60x60", 47 | "idiom" : "iphone", 48 | "filename" : "Icon-App-60x60@2x.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "60x60", 53 | "idiom" : "iphone", 54 | "filename" : "Icon-App-60x60@3x.png", 55 | "scale" : "3x" 56 | }, 57 | { 58 | "size" : "20x20", 59 | "idiom" : "ipad", 60 | "filename" : "Icon-App-20x20@1x.png", 61 | "scale" : "1x" 62 | }, 63 | { 64 | "size" : "20x20", 65 | "idiom" : "ipad", 66 | "filename" : "Icon-App-20x20@2x.png", 67 | "scale" : "2x" 68 | }, 69 | { 70 | "size" : "29x29", 71 | "idiom" : "ipad", 72 | "filename" : "Icon-App-29x29@1x.png", 73 | "scale" : "1x" 74 | }, 75 | { 76 | "size" : "29x29", 77 | "idiom" : "ipad", 78 | "filename" : "Icon-App-29x29@2x.png", 79 | "scale" : "2x" 80 | }, 81 | { 82 | "size" : "40x40", 83 | "idiom" : "ipad", 84 | "filename" : "Icon-App-40x40@1x.png", 85 | "scale" : "1x" 86 | }, 87 | { 88 | "size" : "40x40", 89 | "idiom" : "ipad", 90 | "filename" : "Icon-App-40x40@2x.png", 91 | "scale" : "2x" 92 | }, 93 | { 94 | "size" : "76x76", 95 | "idiom" : "ipad", 96 | "filename" : "Icon-App-76x76@1x.png", 97 | "scale" : "1x" 98 | }, 99 | { 100 | "size" : "76x76", 101 | "idiom" : "ipad", 102 | "filename" : "Icon-App-76x76@2x.png", 103 | "scale" : "2x" 104 | }, 105 | { 106 | "size" : "83.5x83.5", 107 | "idiom" : "ipad", 108 | "filename" : "Icon-App-83.5x83.5@2x.png", 109 | "scale" : "2x" 110 | }, 111 | { 112 | "size" : "1024x1024", 113 | "idiom" : "ios-marketing", 114 | "filename" : "Icon-App-1024x1024@1x.png", 115 | "scale" : "1x" 116 | } 117 | ], 118 | "info" : { 119 | "version" : 1, 120 | "author" : "xcode" 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Newcore-mobile/DynamicFlutter/d4481f61011b2f5746a907ba2e93cec9b8e7dfa8/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Newcore-mobile/DynamicFlutter/d4481f61011b2f5746a907ba2e93cec9b8e7dfa8/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Newcore-mobile/DynamicFlutter/d4481f61011b2f5746a907ba2e93cec9b8e7dfa8/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Newcore-mobile/DynamicFlutter/d4481f61011b2f5746a907ba2e93cec9b8e7dfa8/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Newcore-mobile/DynamicFlutter/d4481f61011b2f5746a907ba2e93cec9b8e7dfa8/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Newcore-mobile/DynamicFlutter/d4481f61011b2f5746a907ba2e93cec9b8e7dfa8/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Newcore-mobile/DynamicFlutter/d4481f61011b2f5746a907ba2e93cec9b8e7dfa8/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Newcore-mobile/DynamicFlutter/d4481f61011b2f5746a907ba2e93cec9b8e7dfa8/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Newcore-mobile/DynamicFlutter/d4481f61011b2f5746a907ba2e93cec9b8e7dfa8/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Newcore-mobile/DynamicFlutter/d4481f61011b2f5746a907ba2e93cec9b8e7dfa8/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Newcore-mobile/DynamicFlutter/d4481f61011b2f5746a907ba2e93cec9b8e7dfa8/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Newcore-mobile/DynamicFlutter/d4481f61011b2f5746a907ba2e93cec9b8e7dfa8/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Newcore-mobile/DynamicFlutter/d4481f61011b2f5746a907ba2e93cec9b8e7dfa8/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Newcore-mobile/DynamicFlutter/d4481f61011b2f5746a907ba2e93cec9b8e7dfa8/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Newcore-mobile/DynamicFlutter/d4481f61011b2f5746a907ba2e93cec9b8e7dfa8/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "LaunchImage.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "LaunchImage@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "LaunchImage@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Newcore-mobile/DynamicFlutter/d4481f61011b2f5746a907ba2e93cec9b8e7dfa8/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Newcore-mobile/DynamicFlutter/d4481f61011b2f5746a907ba2e93cec9b8e7dfa8/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Newcore-mobile/DynamicFlutter/d4481f61011b2f5746a907ba2e93cec9b8e7dfa8/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md: -------------------------------------------------------------------------------- 1 | # Launch Screen Assets 2 | 3 | You can customize the launch screen with your own desired assets by replacing the image files in this directory. 4 | 5 | You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images. -------------------------------------------------------------------------------- /example/ios/Runner/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /example/ios/Runner/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /example/ios/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | flutter_hot_widget 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | $(FLUTTER_BUILD_NAME) 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | $(FLUTTER_BUILD_NUMBER) 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UISupportedInterfaceOrientations 30 | 31 | UIInterfaceOrientationPortrait 32 | UIInterfaceOrientationLandscapeLeft 33 | UIInterfaceOrientationLandscapeRight 34 | 35 | UISupportedInterfaceOrientations~ipad 36 | 37 | UIInterfaceOrientationPortrait 38 | UIInterfaceOrientationPortraitUpsideDown 39 | UIInterfaceOrientationLandscapeLeft 40 | UIInterfaceOrientationLandscapeRight 41 | 42 | UIViewControllerBasedStatusBarAppearance 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /example/ios/Runner/Runner-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | #import "GeneratedPluginRegistrant.h" -------------------------------------------------------------------------------- /example/lib/dsl/listview_dsl.dart: -------------------------------------------------------------------------------- 1 | /// 2 | ///Author: YoungChan 3 | ///Date: 2020-04-16 15:37:16 4 | ///LastEditors: YoungChan 5 | ///LastEditTime: 2020-04-22 20:33:59 6 | ///Description: file content 7 | /// 8 | import 'package:flutter/material.dart'; 9 | 10 | class ListViewDSL extends StatefulWidget { 11 | @override 12 | _ListViewDSLState createState() => _ListViewDSLState(); 13 | } 14 | 15 | class _ListViewDSLState extends State { 16 | @override 17 | Widget build(BuildContext context) { 18 | return Scaffold( 19 | appBar: AppBar( 20 | backgroundColor: Colors.red, 21 | title: Text( 22 | 'ListViewDSL', 23 | style: TextStyle(fontSize: 20, color: Colors.white), 24 | ), 25 | centerTitle: true, 26 | ), 27 | body: ListView.builder( 28 | itemBuilder: (context, index) { 29 | return Container( 30 | padding: EdgeInsets.only(left: 16, right: 16), 31 | alignment: Alignment.centerLeft, 32 | child: Text('Hellow World', 33 | style: TextStyle(color: Colors.white, fontSize: 18)), 34 | color: Colors.lightBlue.shade300, 35 | height: 45, 36 | ); 37 | }, 38 | itemCount: 50, 39 | ), 40 | ); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /example/lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'dart:convert'; 2 | 3 | import 'package:flutter/material.dart'; 4 | import 'package:flutter/services.dart'; 5 | import 'dsl/listview_dsl.dart'; 6 | import 'package:dynamicflutter/widget/ast_statefulwidget.dart'; 7 | 8 | import 'package:flutter/services.dart' show rootBundle; 9 | 10 | void main() => runApp(MyApp()); 11 | 12 | class MyApp extends StatelessWidget { 13 | // This widget is the root of your application. 14 | @override 15 | Widget build(BuildContext context) { 16 | return MaterialApp( 17 | title: 'Flutter Demo', 18 | theme: ThemeData( 19 | // This is the theme of your application. 20 | // 21 | // Try running your application with \"flutter run\". You'll see the 22 | // application has a blue toolbar. Then, without quitting the app, try 23 | // changing the primarySwatch below to Colors.green and then invoke 24 | // \"hot reload\" (press \"r\" in the console where you ran \"flutter run\", 25 | // or simply save your changes to \"hot reload\" in a Flutter IDE). 26 | // Notice that the counter didn't reset back to zero; the application 27 | // is not restarted. 28 | primarySwatch: Colors.blue, 29 | ), 30 | home: MyHomePage(title: 'Flutter Demo Home Page'), 31 | ); 32 | } 33 | } 34 | 35 | class MyHomePage extends StatefulWidget { 36 | MyHomePage({Key key, this.title}) : super(key: key); 37 | 38 | final String title; 39 | 40 | @override 41 | _MyHomePageState createState() => _MyHomePageState(); 42 | } 43 | 44 | class _MyHomePageState extends State { 45 | @override 46 | Widget build(BuildContext context) { 47 | return Scaffold( 48 | appBar: AppBar( 49 | // Here we take the value from the MyHomePage object that was created by 50 | // the App.build method, and use it to set our appbar title. 51 | title: Text(widget.title), 52 | ), 53 | body: ListView( 54 | children: [ 55 | ListTile( 56 | title: Text('DSL模板'), 57 | onTap: () { 58 | Navigator.push(context, 59 | MaterialPageRoute(builder: (context) => _DSLListPage())); 60 | }, 61 | ), 62 | ListTile( 63 | title: Text('动态渲染'), 64 | onTap: () { 65 | Navigator.push( 66 | context, 67 | MaterialPageRoute( 68 | builder: (context) => _DynamicFlutterList())); 69 | }, 70 | ), 71 | ], 72 | )); 73 | } 74 | } 75 | 76 | class _DSLListPage extends StatelessWidget { 77 | @override 78 | Widget build(BuildContext context) { 79 | return Scaffold( 80 | appBar: AppBar( 81 | title: Text('DSL模板列表'), 82 | ), 83 | body: ListView( 84 | children: [ 85 | ListTile( 86 | title: Text('ListView'), 87 | onTap: () { 88 | Navigator.push(context, 89 | MaterialPageRoute(builder: (context) => ListViewDSL())); 90 | }, 91 | ), 92 | ], 93 | ), 94 | ); 95 | } 96 | } 97 | 98 | class _DynamicFlutterList extends StatelessWidget { 99 | @override 100 | Widget build(BuildContext context) { 101 | return Scaffold( 102 | appBar: AppBar( 103 | title: Text('动态渲染列表'), 104 | ), 105 | body: ListView( 106 | children: [ 107 | ListTile( 108 | title: Text('ListView'), 109 | onTap: () async { 110 | Navigator.push( 111 | context, 112 | MaterialPageRoute( 113 | builder: (context) => 114 | AstStatefulWidget(jsonDecode(listViewAst) as Map))); 115 | }, 116 | ), 117 | ], 118 | ), 119 | ); 120 | } 121 | } 122 | 123 | const listViewAst = 124 | '{"type":"Program","body":[{"type":"ClassDeclaration","id":{"type":"Identifier","name":"ListViewDSL"},"superClause":{"type":"TypeName","name":"StatefulWidget"},"implementsClause":null,"mixinClause":null,"metadata":[],"body":[{"type":"MethodDeclaration","id":{"type":"Identifier","name":"createState"},"parameters":{"type":"FormalParameterList","parameterList":[]},"typeParameters":null,"body":null,"isAsync":false,"returnType":{"type":"TypeName","name":"_ListViewDSLState"}}]},{"type":"ClassDeclaration","id":{"type":"Identifier","name":"_ListViewDSLState"},"superClause":{"type":"TypeName","name":"State"},"implementsClause":null,"mixinClause":null,"metadata":[],"body":[{"type":"MethodDeclaration","id":{"type":"Identifier","name":"build"},"parameters":{"type":"FormalParameterList","parameterList":[{"type":"SimpleFormalParameter","paramType":{"type":"TypeName","name":"BuildContext"},"name":"context"}]},"typeParameters":null,"body":{"type":"BlockStatement","body":[{"type":"ReturnStatement","argument":{"type":"MethodInvocation","callee":{"type":"Identifier","name":"Scaffold"},"typeArguments":null,"argumentList":{"type":"ArgumentList","argumentList":[{"type":"NamedExpression","id":{"type":"Identifier","name":"appBar"},"expression":{"type":"MethodInvocation","callee":{"type":"Identifier","name":"AppBar"},"typeArguments":null,"argumentList":{"type":"ArgumentList","argumentList":[{"type":"NamedExpression","id":{"type":"Identifier","name":"backgroundColor"},"expression":{"type":"PrefixedIdentifier","identifier":{"type":"Identifier","name":"red"},"prefix":{"type":"Identifier","name":"Colors"}}},{"type":"NamedExpression","id":{"type":"Identifier","name":"title"},"expression":{"type":"MethodInvocation","callee":{"type":"Identifier","name":"Text"},"typeArguments":null,"argumentList":{"type":"ArgumentList","argumentList":[{"type":"StringLiteral","value":"ListViewDSL"},{"type":"NamedExpression","id":{"type":"Identifier","name":"style"},"expression":{"type":"MethodInvocation","callee":{"type":"Identifier","name":"TextStyle"},"typeArguments":null,"argumentList":{"type":"ArgumentList","argumentList":[{"type":"NamedExpression","id":{"type":"Identifier","name":"fontSize"},"expression":{"type":"NumericLiteral","value":20}},{"type":"NamedExpression","id":{"type":"Identifier","name":"color"},"expression":{"type":"PrefixedIdentifier","identifier":{"type":"Identifier","name":"white"},"prefix":{"type":"Identifier","name":"Colors"}}}]}}}]}}},{"type":"NamedExpression","id":{"type":"Identifier","name":"centerTitle"},"expression":{"type":"BooleanLiteral","value":true}}]}}},{"type":"NamedExpression","id":{"type":"Identifier","name":"body"},"expression":{"type":"MethodInvocation","callee":{"type":"MemberExpression","object":{"type":"Identifier","name":"ListView"},"property":{"type":"Identifier","name":"builder"}},"typeArguments":null,"argumentList":{"type":"ArgumentList","argumentList":[{"type":"NamedExpression","id":{"type":"Identifier","name":"itemBuilder"},"expression":{"type":"FunctionExpression","parameters":{"type":"FormalParameterList","parameterList":[{"type":"SimpleFormalParameter","paramType":null,"name":"context"},{"type":"SimpleFormalParameter","paramType":null,"name":"index"}]},"body":{"type":"BlockStatement","body":[{"type":"ReturnStatement","argument":{"type":"MethodInvocation","callee":{"type":"Identifier","name":"Container"},"typeArguments":null,"argumentList":{"type":"ArgumentList","argumentList":[{"type":"NamedExpression","id":{"type":"Identifier","name":"padding"},"expression":{"type":"MethodInvocation","callee":{"type":"MemberExpression","object":{"type":"Identifier","name":"EdgeInsets"},"property":{"type":"Identifier","name":"only"}},"typeArguments":null,"argumentList":{"type":"ArgumentList","argumentList":[{"type":"NamedExpression","id":{"type":"Identifier","name":"left"},"expression":{"type":"NumericLiteral","value":16}},{"type":"NamedExpression","id":{"type":"Identifier","name":"right"},"expression":{"type":"NumericLiteral","value":16}}]}}},{"type":"NamedExpression","id":{"type":"Identifier","name":"alignment"},"expression":{"type":"PrefixedIdentifier","identifier":{"type":"Identifier","name":"centerLeft"},"prefix":{"type":"Identifier","name":"Alignment"}}},{"type":"NamedExpression","id":{"type":"Identifier","name":"child"},"expression":{"type":"MethodInvocation","callee":{"type":"Identifier","name":"Text"},"typeArguments":null,"argumentList":{"type":"ArgumentList","argumentList":[{"type":"StringLiteral","value":"Hellow World"},{"type":"NamedExpression","id":{"type":"Identifier","name":"style"},"expression":{"type":"MethodInvocation","callee":{"type":"Identifier","name":"TextStyle"},"typeArguments":null,"argumentList":{"type":"ArgumentList","argumentList":[{"type":"NamedExpression","id":{"type":"Identifier","name":"color"},"expression":{"type":"PrefixedIdentifier","identifier":{"type":"Identifier","name":"white"},"prefix":{"type":"Identifier","name":"Colors"}}},{"type":"NamedExpression","id":{"type":"Identifier","name":"fontSize"},"expression":{"type":"NumericLiteral","value":18}}]}}}]}}},{"type":"NamedExpression","id":{"type":"Identifier","name":"color"},"expression":{"type":"PropertyAccess","id":{"type":"Identifier","name":"shade300"},"expression":{"type":"PrefixedIdentifier","identifier":{"type":"Identifier","name":"lightBlue"},"prefix":{"type":"Identifier","name":"Colors"}}}},{"type":"NamedExpression","id":{"type":"Identifier","name":"height"},"expression":{"type":"NumericLiteral","value":45}}]}}}]},"isAsync":false}},{"type":"NamedExpression","id":{"type":"Identifier","name":"itemCount"},"expression":{"type":"NumericLiteral","value":50}}]}}}]}}}]},"isAsync":false,"returnType":{"type":"TypeName","name":"Widget"}}]}]}'; 125 | -------------------------------------------------------------------------------- /example/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: dynamic_flutter_widget 2 | description: 动态widget 示例 3 | 4 | # The following defines the version and build number for your application. 5 | # A version number is three numbers separated by dots, like 1.2.43 6 | # followed by an optional build number separated by a +. 7 | # Both the version and the builder number may be overridden in flutter 8 | # build by specifying --build-name and --build-number, respectively. 9 | # In Android, build-name is used as versionName while build-number used as versionCode. 10 | # Read more about Android versioning at https://developer.android.com/studio/publish/versioning 11 | # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. 12 | # Read more about iOS versioning at 13 | # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html 14 | version: 1.0.0+1 15 | 16 | environment: 17 | sdk: ">=2.1.0 <3.0.0" 18 | 19 | dependencies: 20 | flutter: 21 | sdk: flutter 22 | 23 | # The following adds the Cupertino Icons font to your application. 24 | # Use with the CupertinoIcons class for iOS style icons. 25 | cupertino_icons: ^0.1.2 26 | 27 | dev_dependencies: 28 | flutter_test: 29 | sdk: flutter 30 | 31 | dynamicflutter: 32 | path: ../ 33 | 34 | # For information on the generic Dart part of this file, see the 35 | # following page: https://dart.dev/tools/pub/pubspec 36 | 37 | # The following section is specific to Flutter. 38 | flutter: 39 | # The following line ensures that the Material Icons font is 40 | # included with your application, so that you can use the icons in 41 | # the material Icons class. 42 | uses-material-design: true 43 | assets: 44 | - assets/ 45 | # To add assets to your application, add an assets section, like this: 46 | # assets: 47 | # - images/a_dot_burr.jpeg 48 | # - images/a_dot_ham.jpeg 49 | # An image asset can refer to one or more resolution-specific "variants", see 50 | # https://flutter.dev/assets-and-images/#resolution-aware. 51 | # For details regarding adding assets from package dependencies, see 52 | # https://flutter.dev/assets-and-images/#from-packages 53 | # To add custom fonts to your application, add a fonts section here, 54 | # in this "flutter" section. Each entry in this list should have a 55 | # "family" key with the font family name, and a "fonts" key with a 56 | # list giving the asset and other descriptors for the font. For 57 | # example: 58 | # fonts: 59 | # - family: Schyler 60 | # fonts: 61 | # - asset: fonts/Schyler-Regular.ttf 62 | # - asset: fonts/Schyler-Italic.ttf 63 | # style: italic 64 | # - family: Trajan Pro 65 | # fonts: 66 | # - asset: fonts/TrajanPro.ttf 67 | # - asset: fonts/TrajanPro_Bold.ttf 68 | # weight: 700 69 | # 70 | # For details regarding fonts from package dependencies, 71 | # see https://flutter.dev/custom-fonts/#from-packages 72 | -------------------------------------------------------------------------------- /example/test/widget_test.dart: -------------------------------------------------------------------------------- 1 | /// 2 | ///Author: YoungChan 3 | ///Date: 2020-04-14 19:23:02 4 | ///LastEditors: YoungChan 5 | ///LastEditTime: 2020-04-22 18:50:08 6 | ///Description: file content 7 | /// 8 | // This is a basic Flutter widget test. 9 | // 10 | // To perform an interaction with a widget in your test, use the WidgetTester 11 | // utility that Flutter provides. For example, you can send tap and scroll 12 | // gestures. You can also use WidgetTester to find child widgets in the widget 13 | // tree, read text, and verify that the values of widget properties are correct. 14 | 15 | import 'package:flutter/material.dart'; 16 | import 'package:flutter_test/flutter_test.dart'; 17 | 18 | void main() { 19 | testWidgets('Counter increments smoke test', (WidgetTester tester) async {}); 20 | } 21 | -------------------------------------------------------------------------------- /lib/ast_runtime_class.dart: -------------------------------------------------------------------------------- 1 | /// 2 | ///Author: YoungChan 3 | ///Date: 2020-04-18 19:47:09 4 | ///LastEditors: YoungChan 5 | ///LastEditTime: 2020-04-22 17:42:57 6 | ///Description: runtime 数据类定义 7 | /// 8 | import 'ast_node.dart'; 9 | import 'ast_varialble_stack.dart'; 10 | 11 | String _TAG = "[Ast Runtime Class] "; 12 | 13 | class AstRuntime { 14 | AstClass _astClass; 15 | AstVariableStack _variableStack; 16 | 17 | AstRuntime(Map ast) { 18 | if (ast['type'] == astNodeNameValue(AstNodeName.Program)) { 19 | var body = ast['body'] as List; 20 | _variableStack = AstVariableStack(); 21 | _variableStack.blockIn(); 22 | body?.forEach((b) { 23 | if (b['type'] == astNodeNameValue(AstNodeName.ClassDeclaration)) { 24 | //解析类 25 | _astClass = AstClass.fromAst(b, variableStack: _variableStack); 26 | } else if (b['type'] == 27 | astNodeNameValue(AstNodeName.FunctionDeclaration)) { 28 | //解析全局函数 29 | var func = AstFunction.fromAst(b); 30 | _variableStack.setFunctionInstance(func.name, func); 31 | } 32 | }); 33 | } 34 | } 35 | 36 | ///调用类方法,注意参数列表顺序与模版代码相同 37 | Future callMethod(String methodName, {List params}) async { 38 | if (_astClass != null) { 39 | return _astClass.callMethod(methodName, params: params); 40 | } 41 | return Future.value(); 42 | } 43 | 44 | ///调用全局函数,注意参数列表顺序与模版代码相同 45 | Future callFunction(String functionName, {List params}) async { 46 | var function = 47 | _variableStack.getFunctionInstance(functionName); 48 | if (function != null) { 49 | return function.invoke(params, variableStack: _variableStack); 50 | } 51 | return Future.value(); 52 | } 53 | } 54 | 55 | class AstClass { 56 | AstVariableStack _variableStack; 57 | 58 | AstClass(this._variableStack); 59 | 60 | dynamic callMethod(String name, {List params}) { 61 | var method = _variableStack.getFunctionInstance(name); 62 | if (method != null) { 63 | return method.invoke(params, variableStack: _variableStack); 64 | } 65 | return null; 66 | } 67 | 68 | factory AstClass.fromAst(Map ast, {AstVariableStack variableStack}) { 69 | if (ast['type'] == astNodeNameValue(AstNodeName.ClassDeclaration)) { 70 | var classNode = ClassDeclaration.fromAst(ast); 71 | 72 | if (variableStack == null) { 73 | variableStack = AstVariableStack(); 74 | } 75 | variableStack.blockIn(); 76 | 77 | for (var b in classNode.body) { 78 | if (b.isMethodDeclaration) { 79 | //解析类方法 80 | var method = b.asMethodDeclaration; 81 | variableStack.setFunctionInstance( 82 | method.name, 83 | AstFunction(method.name, method.parameterList, method.body, 84 | method.isAsync)); 85 | } else if (b.isVariableDeclarationList) { 86 | //解析类成员变量 87 | variableStack.setVariableValue( 88 | b.asVariableDeclarationList.declarationList[0].name, 89 | _executeBaseExpression(b, variableStack)); 90 | } 91 | } 92 | return AstClass(variableStack); 93 | } 94 | return null; 95 | } 96 | } 97 | 98 | class AstFunction { 99 | List _parameterList; 100 | BlockStatement _body; 101 | String name; 102 | bool _isAsync; 103 | AstFunction(this.name, this._parameterList, this._body, this._isAsync); 104 | 105 | Future invoke(List params, {AstVariableStack variableStack}) async { 106 | if (variableStack == null) { 107 | variableStack = AstVariableStack(); 108 | } 109 | variableStack.blockIn(); 110 | //初始化函数参数 111 | if (params?.isNotEmpty == true && params.length == _parameterList.length) { 112 | for (var i = 0; i < params.length; i++) { 113 | variableStack.setVariableValue(_parameterList[i].name, params[i]); 114 | } 115 | } 116 | 117 | var result = await _executeBlockStatement(_body, variableStack); 118 | variableStack.blockOut(); 119 | return Future.value(result); 120 | } 121 | 122 | factory AstFunction.fromExpression(Expression expression) { 123 | if (expression.isFunctionDeclaration) { 124 | var function = expression.asFunctionDeclaration; 125 | return AstFunction(function.name, function.expression.parameterList, 126 | function.expression.body, function.expression.isAsync); 127 | } else if (expression.isMethodDeclaration) { 128 | var method = expression.asMethodDeclaration; 129 | return AstFunction( 130 | method.name, method.parameterList, method.body, method.isAsync); 131 | } 132 | 133 | return null; 134 | } 135 | 136 | factory AstFunction.fromAst(Map ast) { 137 | if (ast != null) { 138 | if (ast['type'] == astNodeNameValue(AstNodeName.MethodDeclaration)) { 139 | var method = MethodDeclaration.fromAst(ast); 140 | return AstFunction( 141 | method.name, method.parameterList, method.body, method.isAsync); 142 | } else if (ast['type'] == 143 | astNodeNameValue(AstNodeName.FunctionDeclaration)) { 144 | var function = FunctionDeclaration.fromAst(ast); 145 | return AstFunction(function.name, function.expression.parameterList, 146 | function.expression.body, function.expression.isAsync); 147 | } 148 | } 149 | return null; 150 | } 151 | } 152 | 153 | Future _executeBlockStatement( 154 | BlockStatement block, AstVariableStack variableStack) async { 155 | variableStack.blockIn(); 156 | var result; 157 | if (block.body?.isNotEmpty == true) { 158 | for (var expression in block.body) { 159 | result = await _executeBodyExpression(expression, variableStack); 160 | } 161 | } 162 | 163 | variableStack.blockOut(); 164 | return Future.value(result); 165 | } 166 | 167 | //解析执行语法逻辑 168 | Future _executeBodyExpression( 169 | Expression expression, AstVariableStack variableStack) async { 170 | if (expression.isVariableDeclarationList) { 171 | await _executeVariableDeclaration( 172 | expression.asVariableDeclarationList, variableStack); 173 | } else if (expression.isAssignmentExpression) { 174 | await _executeAssignmentExpression( 175 | expression.asAssignmentExpression, variableStack); 176 | } else if (expression.isIfStatement) { 177 | await _executeIfStatement(expression.asIfStatement, variableStack); 178 | } else if (expression.isForStatement) { 179 | await _executeForStatement(expression.asForStatement, variableStack); 180 | } else if (expression.isExpressionStatement) { 181 | await _executeBodyExpression(expression.asExpression, variableStack); 182 | } else if (expression.isSwitchStatement) { 183 | await _executeSwitchStatement(expression.asSwitchStatement, variableStack); 184 | } else if (expression.isFunctionDeclaration) { 185 | //构造函数调用的参数值 186 | var params = []; 187 | var function = expression.asFunctionDeclaration; 188 | function.expression.parameterList?.forEach((p) { 189 | params.add(variableStack.getVariableValue(p.name).value); 190 | }); 191 | return AstFunction.fromExpression(expression) 192 | .invoke(params, variableStack: variableStack); 193 | } else if (expression.isMethodDeclaration) { 194 | //构造方法调用的参数值 195 | var params = []; 196 | var function = expression.asFunctionDeclaration.expression; 197 | function.parameterList?.forEach((p) { 198 | params.add(variableStack.getVariableValue(p.name).value); 199 | }); 200 | return AstFunction.fromExpression(expression) 201 | .invoke(params, variableStack: variableStack); 202 | } else if (expression.isReturnStatement) { 203 | return _executeBaseExpression( 204 | expression.asReturnStatement.argument, variableStack); 205 | } 206 | return Future.value(); 207 | } 208 | 209 | ///解析有返回值的基础表达式 210 | dynamic _executeBaseExpression( 211 | Expression expression, AstVariableStack variableStack) { 212 | if (expression.isIdentifier) { 213 | return variableStack.getVariableValue(expression.asIdentifier.name)?.value; 214 | } else if (expression.isStringLiteral) { 215 | return expression.asStringLiteral.value; 216 | } else if (expression.isNumericLiteral) { 217 | return expression.asNumericLiteral.value; 218 | } else if (expression.isBooleanLiteral) { 219 | return expression.asBooleanLiteral.value; 220 | } else if (expression.isListLiteral) { 221 | return _executeListLiteral(expression.asListLiteral, variableStack); 222 | } else if (expression.isMapLiteral) { 223 | return _executeMapLiteral(expression.asMapLiteral, variableStack); 224 | } else if (expression.isBinaryExpression) { 225 | return _executeBinaryExpression( 226 | expression.asBinaryExpression, variableStack); 227 | } else if (expression.isPrefixedIdentifier) { 228 | //TODO prefix identifier 229 | } else if (expression.isIndexExpression) { 230 | return _executeIndexExpression(expression.asIndexExpression, variableStack); 231 | } 232 | return null; 233 | } 234 | 235 | List _executeListLiteral( 236 | ListLiteral listLiteral, AstVariableStack variableStack) { 237 | var list = []; 238 | listLiteral.elements.forEach((e) { 239 | list.add(_executeBaseExpression(e, variableStack)); 240 | }); 241 | return list; 242 | } 243 | 244 | Map _executeMapLiteral(MapLiteral mapLiteral, AstVariableStack variableStack) { 245 | var map = {}; 246 | mapLiteral.elements.forEach((k, v) { 247 | map[k] = _executeBaseExpression(v, variableStack); 248 | }); 249 | return map; 250 | } 251 | 252 | Future _executeVariableDeclaration( 253 | VariableDeclarationList variableDeclarationList, 254 | AstVariableStack variableStack) async { 255 | var variableDeclarator = variableDeclarationList.declarationList[0]; 256 | if (variableDeclarator.init.isAwaitExpression) { 257 | //await expression; 258 | var value = await _executeMethodInvocation( 259 | variableDeclarator.init.asAwaitExpression.expression, variableStack); 260 | //存入声明的初始化变量值 261 | variableStack.setVariableValue(variableDeclarator.name, value); 262 | } else if (variableDeclarator.init.isMethodInvocation) { 263 | var value = await _executeMethodInvocation( 264 | variableDeclarator.init.asMethodInvocation, variableStack); 265 | //存入声明的初始化变量值 266 | variableStack.setVariableValue(variableDeclarator.name, value); 267 | } else { 268 | //存入声明的初始化变量值 269 | var v = _executeBaseExpression(variableDeclarator.init, variableStack); 270 | variableStack.setVariableValue(variableDeclarator.name, v); 271 | } 272 | return Future.value(); 273 | } 274 | 275 | Future _executeIfStatement( 276 | IfStatement ifStatement, AstVariableStack variableStack) async { 277 | bool condition = 278 | _executeBinaryExpression(ifStatement.condition, variableStack) as bool; 279 | if (condition) { 280 | await _executeBlockStatement(ifStatement.consequent, variableStack); 281 | } else { 282 | await _executeBlockStatement(ifStatement.alternate, variableStack); 283 | } 284 | return Future.value(); 285 | } 286 | 287 | Future _executeForStatement( 288 | ForStatement forStatement, AstVariableStack variableStack) async { 289 | var forLoopParts = forStatement.forLoopParts; 290 | //for...in... 语句处理 291 | if (forStatement.type == ForLoopParts.forEachPartsWithDeclaration) { 292 | //获取迭代数据集 293 | var iterableValue = 294 | (variableStack.getVariableValue(forLoopParts.iterable)?.value ?? []) 295 | as List; 296 | if (iterableValue?.isNotEmpty == true) { 297 | iterableValue.forEach((v) { 298 | //将迭代值存入变量栈 299 | variableStack.setVariableValue(forLoopParts.loopVariable, v); 300 | //执行循环内的逻辑 301 | _executeBlockStatement(forStatement.body, variableStack); 302 | }); 303 | } 304 | } else { 305 | //初始化 306 | if (forStatement.type == ForLoopParts.forPartsWithDeclarations) { 307 | await _executeVariableDeclaration( 308 | forLoopParts.variableList, variableStack); 309 | } else if (forStatement.type == ForLoopParts.forPartsWithExpression) { 310 | await _executeAssignmentExpression( 311 | forLoopParts.initialization, variableStack); 312 | } 313 | //循环判断条件位 314 | bool condition = 315 | _executeBinaryExpression(forLoopParts.condition, variableStack); 316 | while (condition) { 317 | //解析循环步长 318 | if (forLoopParts.updater.isPrefixExpression) { 319 | _executePrefixExpression( 320 | forLoopParts.updater.asPrefixExpression, variableStack); 321 | } else if (forLoopParts.updater.isAssignmentExpression) { 322 | await _executeAssignmentExpression( 323 | forLoopParts.updater.asAssignmentExpression, variableStack); 324 | } 325 | //执行循环体的逻辑 326 | _executeBlockStatement(forStatement.body, variableStack); 327 | //循环判断条件位 328 | condition = 329 | _executeBinaryExpression(forLoopParts.condition, variableStack); 330 | } 331 | } 332 | return Future.value(); 333 | } 334 | 335 | Future _executeSwitchStatement( 336 | SwitchStatement switchStatement, AstVariableStack variableStack) async { 337 | var conditionValue; 338 | if (switchStatement.checkValue.isIdentifier) { 339 | conditionValue = variableStack 340 | .getVariableValue(switchStatement.checkValue.asIdentifier.name) 341 | ?.value; 342 | } else { 343 | //TODO Others expression 344 | } 345 | for (var c in switchStatement.body) { 346 | if (c.isDefault || 347 | conditionValue == _executeBaseExpression(c.condition, variableStack)) { 348 | for (var b in c.statements) { 349 | await _executeBodyExpression(b, variableStack); 350 | } 351 | break; 352 | } 353 | } 354 | return Future.value(); 355 | } 356 | 357 | num _executePrefixExpression( 358 | PrefixExpression prefixExpression, AstVariableStack variableStack) { 359 | var argValue = variableStack.getVariableValue(prefixExpression.argument); 360 | num returnValue; 361 | if (argValue?.value is int || argValue?.value is double) { 362 | if (prefixExpression.operator == '++') { 363 | if (prefixExpression.prefix) { 364 | returnValue = ++argValue.value; 365 | } else { 366 | returnValue = argValue.value++; 367 | } 368 | } else if (prefixExpression.operator == '--') { 369 | if (prefixExpression.prefix) { 370 | returnValue = --argValue.value; 371 | } else { 372 | returnValue = argValue.value--; 373 | } 374 | } 375 | } 376 | return returnValue; 377 | } 378 | 379 | dynamic _executeIndexExpression( 380 | IndexExpression indexExpression, AstVariableStack variableStack) { 381 | var target; 382 | if (indexExpression.target.isIndexExpression) { 383 | target = _executeIndexExpression( 384 | indexExpression.target.asIndexExpression, variableStack); 385 | } else if (indexExpression.target.isIdentifier) { 386 | target = variableStack 387 | .getVariableValue(indexExpression.target.asIdentifier.name) 388 | ?.value; 389 | } 390 | if (target != null) { 391 | if (target is List) { 392 | var index = indexExpression.index.asNumericLiteral.value; 393 | if (target.length > index) { 394 | return target[index]; 395 | } 396 | } else if (target is Map) { 397 | var index = indexExpression.index.asIdentifier.name; 398 | return target[index]; 399 | } 400 | } 401 | 402 | return null; 403 | } 404 | 405 | ///更新IndexExpression 表达式的值 406 | void _updateIndexExpressionValue(IndexExpression indexExpression, dynamic value, 407 | AstVariableStack variableStack) { 408 | var target; 409 | if (indexExpression.target.isIndexExpression) { 410 | target = _executeIndexExpression( 411 | indexExpression.target.asIndexExpression, variableStack); 412 | } else if (indexExpression.target.isIdentifier) { 413 | target = variableStack 414 | .getVariableValue(indexExpression.target.asIdentifier.name) 415 | ?.value; 416 | } 417 | if (target != null) { 418 | if (target is List) { 419 | var index = indexExpression.index.asNumericLiteral.value; 420 | if (target.length > index) { 421 | target[index] = value; 422 | } 423 | } else if (target is Map) { 424 | var index = indexExpression.index.asIdentifier.name; 425 | target[index] = value; 426 | } 427 | } 428 | } 429 | 430 | Future _executeAssignmentExpression(AssignmentExpression assignmentExpression, 431 | AstVariableStack variableStack) async { 432 | var leftValue = 433 | _executeBaseExpression(assignmentExpression.left, variableStack); 434 | var rightValue; 435 | if (assignmentExpression.right.isAwaitExpression) { 436 | rightValue = await _executeMethodInvocation( 437 | assignmentExpression.right.asAwaitExpression.expression, variableStack); 438 | } 439 | if (assignmentExpression.right.isMethodInvocation) { 440 | rightValue = await _executeMethodInvocation( 441 | assignmentExpression.right.asMethodInvocation, variableStack); 442 | } else { 443 | rightValue = 444 | _executeBaseExpression(assignmentExpression.right, variableStack); 445 | } 446 | 447 | switch (assignmentExpression.operator) { 448 | case '+=': 449 | rightValue = leftValue + rightValue; 450 | break; 451 | case '+=': 452 | rightValue = leftValue - rightValue; 453 | break; 454 | case '*=': 455 | rightValue = leftValue * rightValue; 456 | break; 457 | case '/=': 458 | rightValue = leftValue / rightValue; 459 | break; 460 | } 461 | if (assignmentExpression.left.isIdentifier) { 462 | var variableValue = variableStack 463 | .getVariableValue(assignmentExpression.left.asIdentifier.name); 464 | variableValue.value = rightValue; 465 | } else if (assignmentExpression.left.isPrefixedIdentifier) { 466 | //TODO: Prefixed 类型处理 467 | } else if (assignmentExpression.left.isIndexExpression) { 468 | _updateIndexExpressionValue( 469 | assignmentExpression.left.asIndexExpression, rightValue, variableStack); 470 | } 471 | return Future.value(); 472 | } 473 | 474 | dynamic _executeBinaryExpression( 475 | BinaryExpression binaryExpression, AstVariableStack variableStack) { 476 | //获取左操作符的值 477 | var leftValue = _executeBaseExpression(binaryExpression.left, variableStack); 478 | 479 | //获取右操作符的值 480 | var rightValue = 481 | _executeBaseExpression(binaryExpression.right, variableStack); 482 | 483 | //操作符 484 | switch (binaryExpression.operator) { 485 | case '+': 486 | return leftValue + rightValue; 487 | case '-': 488 | return leftValue - rightValue; 489 | case '*': 490 | return leftValue * rightValue; 491 | case '/': 492 | return leftValue / rightValue; 493 | case '<': 494 | return leftValue < rightValue; 495 | case '>': 496 | return leftValue > rightValue; 497 | case '<=': 498 | return leftValue <= rightValue; 499 | case '>=': 500 | return leftValue >= rightValue; 501 | case '==': 502 | return leftValue == rightValue; 503 | case '&&': 504 | return leftValue && rightValue; 505 | case '||': 506 | return leftValue || rightValue; 507 | case '%': 508 | return leftValue % rightValue; 509 | case '<<': 510 | return leftValue << rightValue; 511 | case '|': 512 | return leftValue | rightValue; 513 | case '&': 514 | return leftValue & rightValue; 515 | case '>>': 516 | return leftValue >> rightValue; 517 | default: 518 | return null; 519 | } 520 | } 521 | 522 | Future _executeMethodInvocation( 523 | MethodInvocation invocation, AstVariableStack variableStack) async { 524 | if (invocation.callee.isIdentifier) { 525 | var methodName = invocation.callee.asIdentifier.name; 526 | if (methodName == 'selectNewModel') { 527 | return Future.value({}); 528 | } else { 529 | //构造方法参数值 530 | var params = []; 531 | if (invocation.argumentList?.isNotEmpty == true) { 532 | for (var arg in invocation.argumentList) { 533 | params.add(_executeBaseExpression(arg, variableStack)); 534 | } 535 | } 536 | var method = variableStack.getFunctionInstance(methodName); 537 | if (method != null) { 538 | //调用方法 539 | return method.invoke(params, variableStack: variableStack); 540 | } 541 | } 542 | } else if (invocation.callee.isMemberExpression) { 543 | //TODO MemberExression 544 | } 545 | return Future.value(); 546 | } 547 | -------------------------------------------------------------------------------- /lib/ast_varialble_stack.dart: -------------------------------------------------------------------------------- 1 | /// 2 | ///Author: YoungChan 3 | ///Date: 2020-04-18 13:37:28 4 | ///LastEditors: YoungChan 5 | ///LastEditTime: 2020-04-22 17:42:22 6 | ///Description: 变量栈 7 | /// 8 | /// 标识变量类型 9 | enum AstVariableType { 10 | ///基础数据类型 11 | Base, 12 | 13 | ///函数 14 | Function, 15 | } 16 | 17 | class AstVariableStack { 18 | List> _stack = []; 19 | 20 | ///进入代码块的时候调用,新建一个变量集并压栈 21 | void blockIn() { 22 | _stack.add(Map()); 23 | } 24 | 25 | ///跳出代码块的时候调用,将栈顶的变量集出栈 26 | void blockOut() { 27 | _stack.removeLast(); 28 | } 29 | 30 | ///获取基础数据变量值,考虑变量赋值的情况,通过返回类结构模拟引用变量 31 | AstVarialbleModel getVariableValue(String name) { 32 | ///从栈顶开始遍历,直到找到目标变量 33 | for (var i = _stack.length; i > 0; i--) { 34 | var top = _stack[i - 1]; 35 | if (top.containsKey(name)) { 36 | var variableModel = top[name]; 37 | if (variableModel != null && 38 | variableModel._variableType == AstVariableType.Base) { 39 | return variableModel; 40 | } 41 | } 42 | } 43 | return null; 44 | } 45 | 46 | T getFunctionInstance(String name) { 47 | ///从栈顶开始遍历,直到找到目标方法 48 | for (var i = _stack.length; i > 0; i--) { 49 | var top = _stack[i - 1]; 50 | if (top.containsKey(name)) { 51 | var variableModel = top[name]; 52 | if (variableModel != null && 53 | variableModel._variableType == AstVariableType.Function && 54 | variableModel.value is T) { 55 | return variableModel.value; 56 | } 57 | } 58 | } 59 | return null; 60 | } 61 | 62 | ///设置变量值 63 | void setVariableValue(String name, dynamic value) { 64 | assert(_stack.isNotEmpty); 65 | 66 | ///从栈顶开始遍历,直到找到目标变量,赋值后跳出循环 67 | for (var i = _stack.length; i > 0; i--) { 68 | var top = _stack[i - 1]; 69 | if (top.containsKey(name)) { 70 | top[name] = AstVarialbleModel(AstVariableType.Base, value); 71 | return; 72 | } 73 | } 74 | //如果没有目标变量,则将该变量存入变量栈 75 | _stack.last[name] = AstVarialbleModel(AstVariableType.Base, value); 76 | } 77 | 78 | ///设置函数值 79 | void setFunctionInstance(String name, T instance) { 80 | assert(_stack.isNotEmpty); 81 | _stack.last[name] = AstVarialbleModel(AstVariableType.Function, instance); 82 | } 83 | } 84 | 85 | class AstVarialbleModel { 86 | AstVariableType _variableType; 87 | dynamic value; 88 | AstVarialbleModel(this._variableType, this.value); 89 | } 90 | -------------------------------------------------------------------------------- /lib/main.dart: -------------------------------------------------------------------------------- 1 | /// 2 | ///Author: YoungChan 3 | ///Date: 2020-04-11 15:17:06 4 | ///LastEditors: YoungChan 5 | ///LastEditTime: 2020-04-23 00:08:59 6 | ///Description: file content 7 | /// 8 | import 'dart:io'; 9 | import 'dart:convert'; 10 | import 'package:analyzer/dart/analysis/features.dart'; 11 | import 'package:analyzer/dart/analysis/utilities.dart'; 12 | import 'package:analyzer/dart/ast/visitor.dart'; 13 | import 'package:analyzer/dart/ast/ast.dart'; 14 | import 'package:args/args.dart'; 15 | import 'ast_runtime_class.dart'; 16 | 17 | main(List arguments) async { 18 | exitCode = 0; // presume success 19 | final parser = ArgParser()..addFlag("file", negatable: false, abbr: 'f'); 20 | 21 | var argResults = parser.parse(arguments); 22 | final paths = argResults.rest; 23 | if (paths.isEmpty) { 24 | stdout.writeln('No file found'); 25 | } else { 26 | var ast = await generate(paths[0]); 27 | //测试Runtime 28 | // var astRuntime = AstRuntime(ast); 29 | // var res = await astRuntime.callFunction('incTen', params: [100]); 30 | // stdout.writeln('Invoke incTec(100) result: $res'); 31 | } 32 | } 33 | 34 | class DemoAstVisitor extends GeneralizingAstVisitor { 35 | @override 36 | Map visitNode(AstNode node) { 37 | //输出遍历AST Node 节点内容 38 | stdout.writeln("${node.runtimeType}<---->${node.toSource()}"); 39 | return super.visitNode(node); 40 | } 41 | } 42 | 43 | class MyAstVisitor extends SimpleAstVisitor { 44 | /// 遍历节点 45 | Map _safelyVisitNode(AstNode node) { 46 | if (node != null) { 47 | return node.accept(this); 48 | } 49 | return null; 50 | } 51 | 52 | /// 遍历节点列表 53 | List _safelyVisitNodeList(NodeList nodes) { 54 | List maps = []; 55 | if (nodes != null) { 56 | int size = nodes.length; 57 | for (int i = 0; i < size; i++) { 58 | var node = nodes[i]; 59 | if (node != null) { 60 | var res = node.accept(this); 61 | if (res != null) { 62 | maps.add(res); 63 | } 64 | } 65 | } 66 | } 67 | return maps; 68 | } 69 | 70 | //构造根节点 71 | Map _buildAstRoot(List body) { 72 | if (body.isNotEmpty) { 73 | return { 74 | "type": "Program", 75 | "body": body, 76 | }; 77 | } else { 78 | return null; 79 | } 80 | } 81 | 82 | //构造代码块Bloc 结构 83 | Map _buildBloc(List body) => {"type": "BlockStatement", "body": body}; 84 | 85 | //构造运算表达式结构 86 | Map _buildBinaryExpression(Map left, Map right, String lexeme) => { 87 | "type": "BinaryExpression", 88 | "operator": lexeme, 89 | "left": left, 90 | "right": right 91 | }; 92 | 93 | //构造变量声明 94 | Map _buildVariableDeclaration(Map id, Map init) => { 95 | "type": "VariableDeclarator", 96 | "id": id, 97 | "init": init, 98 | }; 99 | 100 | //构造变量声明 101 | Map _buildVariableDeclarationList( 102 | Map typeAnnotation, List declarations) => 103 | { 104 | "type": "VariableDeclarationList", 105 | "typeAnnotation": typeAnnotation, 106 | "declarations": declarations, 107 | }; 108 | //构造标识符定义 109 | Map _buildIdentifier(String name) => {"type": "Identifier", "name": name}; 110 | 111 | //构造数值定义 112 | Map _buildNumericLiteral(num value) => 113 | {"type": "NumericLiteral", "value": value}; 114 | 115 | //构造函数声明 116 | Map _buildFunctionDeclaration(Map id, Map expression) => { 117 | "type": "FunctionDeclaration", 118 | "id": id, 119 | "expression": expression, 120 | }; 121 | 122 | //构造函数表达式 123 | Map _buildFunctionExpression(Map params, Map body, {bool isAsync: false}) => { 124 | "type": "FunctionExpression", 125 | "parameters": params, 126 | "body": body, 127 | "isAsync": isAsync, 128 | }; 129 | 130 | //构造函数参数 131 | Map _buildFormalParameterList(List parameterList) => 132 | {"type": "FormalParameterList", "parameterList": parameterList}; 133 | 134 | //构造函数参数 135 | Map _buildSimpleFormalParameter(Map type, String name) => 136 | {"type": "SimpleFormalParameter", "paramType": type, "name": name}; 137 | 138 | //构造函数参数类型 139 | Map _buildTypeName(String name) => { 140 | "type": "TypeName", 141 | "name": name, 142 | }; 143 | 144 | //构造返回数据定义 145 | Map _buildReturnStatement(Map argument) => { 146 | "type": "ReturnStatement", 147 | "argument": argument, 148 | }; 149 | 150 | Map _buildMethodDeclaration( 151 | Map id, Map parameters, Map typeParameters, Map body, Map returnType, 152 | {bool isAsync: false}) => 153 | { 154 | "type": "MethodDeclaration", 155 | "id": id, 156 | "parameters": parameters, 157 | "typeParameters": typeParameters, 158 | "body": body, 159 | "isAsync": isAsync, 160 | "returnType": returnType, 161 | }; 162 | 163 | Map _buildNamedExpression(Map id, Map expression) => { 164 | "type": "NamedExpression", 165 | "id": id, 166 | "expression": expression, 167 | }; 168 | 169 | Map _buildPrefixedIdentifier(Map identifier, Map prefix) => { 170 | "type": "PrefixedIdentifier", 171 | "identifier": identifier, 172 | "prefix": prefix, 173 | }; 174 | 175 | Map _buildMethodInvocation(Map callee, Map typeArguments, Map argumentList) => 176 | { 177 | "type": "MethodInvocation", 178 | "callee": callee, 179 | "typeArguments": typeArguments, 180 | "argumentList": argumentList, 181 | }; 182 | 183 | Map _buildClassDeclaration(Map id, Map superClause, Map implementsClause, 184 | Map mixinClause, List metadata, List body) => 185 | { 186 | "type": "ClassDeclaration", 187 | "id": id, 188 | "superClause": superClause, 189 | "implementsClause": implementsClause, 190 | "mixinClause": mixinClause, 191 | 'metadata': metadata, 192 | "body": body, 193 | }; 194 | 195 | Map _buildArgumentList(List argumentList) => 196 | {"type": "ArgumentList", "argumentList": argumentList}; 197 | 198 | Map _buildStringLiteral(String value) => 199 | {"type": "StringLiteral", "value": value}; 200 | 201 | Map _buildBooleanLiteral(bool value) => 202 | {"type": "BooleanLiteral", "value": value}; 203 | 204 | Map _buildImplementsClause(List implementList) => 205 | {"type": "ImplementsClause", "implements": implementList}; 206 | 207 | Map _buildPropertyAccess(Map id, Map expression) => { 208 | "type": "PropertyAccess", 209 | "id": id, 210 | "expression": expression, 211 | }; 212 | 213 | @override 214 | Map visitCompilationUnit(CompilationUnit node) { 215 | return _buildAstRoot(_safelyVisitNodeList(node.declarations)); 216 | } 217 | 218 | @override 219 | Map visitBlock(Block node) { 220 | return _buildBloc(_safelyVisitNodeList(node.statements)); 221 | } 222 | 223 | @override 224 | Map visitBlockFunctionBody(BlockFunctionBody node) { 225 | return _safelyVisitNode(node.block); 226 | } 227 | 228 | @override 229 | Map visitVariableDeclaration(VariableDeclaration node) { 230 | return _buildVariableDeclaration( 231 | _safelyVisitNode(node.name), _safelyVisitNode(node.initializer)); 232 | } 233 | 234 | @override 235 | Map visitVariableDeclarationStatement(VariableDeclarationStatement node) { 236 | return _safelyVisitNode(node.variables); 237 | } 238 | 239 | @override 240 | Map visitVariableDeclarationList(VariableDeclarationList node) { 241 | return _buildVariableDeclarationList( 242 | _safelyVisitNode(node.type), _safelyVisitNodeList(node.variables)); 243 | } 244 | 245 | @override 246 | Map visitSimpleIdentifier(SimpleIdentifier node) { 247 | return _buildIdentifier(node.name); 248 | } 249 | 250 | @override 251 | Map visitBinaryExpression(BinaryExpression node) { 252 | return _buildBinaryExpression(_safelyVisitNode(node.leftOperand), 253 | _safelyVisitNode(node.rightOperand), node.operator.lexeme); 254 | } 255 | 256 | @override 257 | Map visitIntegerLiteral(IntegerLiteral node) { 258 | return _buildNumericLiteral(node.value); 259 | } 260 | 261 | @override 262 | Map visitFunctionDeclaration(FunctionDeclaration node) { 263 | return _buildFunctionDeclaration( 264 | _safelyVisitNode(node.name), _safelyVisitNode(node.functionExpression)); 265 | } 266 | 267 | @override 268 | Map visitFunctionDeclarationStatement(FunctionDeclarationStatement node) { 269 | return _safelyVisitNode(node.functionDeclaration); 270 | } 271 | 272 | @override 273 | Map visitFunctionExpression(FunctionExpression node) { 274 | return _buildFunctionExpression( 275 | _safelyVisitNode(node.parameters), _safelyVisitNode(node.body), 276 | isAsync: node.body.isAsynchronous); 277 | } 278 | 279 | @override 280 | Map visitSimpleFormalParameter(SimpleFormalParameter node) { 281 | return _buildSimpleFormalParameter( 282 | _safelyVisitNode(node.type), node.identifier.name); 283 | } 284 | 285 | @override 286 | Map visitFormalParameterList(FormalParameterList node) { 287 | return _buildFormalParameterList(_safelyVisitNodeList(node.parameters)); 288 | } 289 | 290 | @override 291 | Map visitTypeName(TypeName node) { 292 | return _buildTypeName(node.name.name); 293 | } 294 | 295 | @override 296 | Map visitReturnStatement(ReturnStatement node) { 297 | return _buildReturnStatement(_safelyVisitNode(node.expression)); 298 | } 299 | 300 | @override 301 | visitMethodDeclaration(MethodDeclaration node) { 302 | return _buildMethodDeclaration( 303 | _safelyVisitNode(node.name), 304 | _safelyVisitNode(node.parameters), 305 | _safelyVisitNode(node.typeParameters), 306 | _safelyVisitNode(node.body), 307 | _safelyVisitNode(node.returnType), 308 | isAsync: node.body.isAsynchronous); 309 | } 310 | 311 | @override 312 | visitNamedExpression(NamedExpression node) { 313 | return _buildNamedExpression( 314 | _safelyVisitNode(node.name), _safelyVisitNode(node.expression)); 315 | } 316 | 317 | @override 318 | visitPrefixedIdentifier(PrefixedIdentifier node) { 319 | return _buildPrefixedIdentifier( 320 | _safelyVisitNode(node.identifier), _safelyVisitNode(node.prefix)); 321 | } 322 | 323 | @override 324 | visitMethodInvocation(MethodInvocation node) { 325 | Map callee; 326 | if (node.target != null) { 327 | node.target.accept(this); 328 | callee = { 329 | "type": "MemberExpression", 330 | "object": _safelyVisitNode(node.target), 331 | "property": _safelyVisitNode(node.methodName), 332 | }; 333 | } else { 334 | callee = _safelyVisitNode(node.methodName); 335 | } 336 | return _buildMethodInvocation(callee, _safelyVisitNode(node.typeArguments), 337 | _safelyVisitNode(node.argumentList)); 338 | } 339 | 340 | @override 341 | visitClassDeclaration(ClassDeclaration node) { 342 | return _buildClassDeclaration( 343 | _safelyVisitNode(node.name), 344 | _safelyVisitNode(node.extendsClause), 345 | _safelyVisitNode(node.implementsClause), 346 | _safelyVisitNode(node.withClause), 347 | _safelyVisitNodeList(node.metadata), 348 | _safelyVisitNodeList(node.members)); 349 | } 350 | 351 | @override 352 | visitSimpleStringLiteral(SimpleStringLiteral node) { 353 | return _buildStringLiteral(node.value); 354 | } 355 | 356 | @override 357 | visitBooleanLiteral(BooleanLiteral node) { 358 | return _buildBooleanLiteral(node.value); 359 | } 360 | 361 | @override 362 | visitArgumentList(ArgumentList node) { 363 | return _buildArgumentList(_safelyVisitNodeList(node.arguments)); 364 | } 365 | 366 | @override 367 | visitLabel(Label node) { 368 | return _safelyVisitNode(node.label); 369 | } 370 | 371 | @override 372 | visitExtendsClause(ExtendsClause node) { 373 | return _safelyVisitNode(node.superclass); 374 | } 375 | 376 | @override 377 | visitImplementsClause(ImplementsClause node) { 378 | return _buildImplementsClause(_safelyVisitNodeList(node.interfaces)); 379 | } 380 | 381 | @override 382 | visitWithClause(WithClause node) { 383 | return _safelyVisitNode(node); 384 | } 385 | 386 | @override 387 | visitPropertyAccess(PropertyAccess node) { 388 | return _buildPropertyAccess( 389 | _safelyVisitNode(node.propertyName), _safelyVisitNode(node.target)); 390 | } 391 | } 392 | 393 | ///生成AST 394 | Future generate(String path) async { 395 | if (path.isEmpty) { 396 | stdout.writeln("No file found"); 397 | } else { 398 | await _handleError(path); 399 | if (exitCode == 2) { 400 | try { 401 | var parseResult = 402 | parseFile(path: path, featureSet: FeatureSet.fromEnableFlags([])); 403 | var compilationUnit = parseResult.unit; 404 | //遍历AST 405 | var astData = compilationUnit.accept(MyAstVisitor()); 406 | stdout.writeln(jsonEncode(astData)); 407 | return Future.value(astData); 408 | } catch (e) { 409 | stdout.writeln('Parse file error: ${e.toString()}'); 410 | } 411 | } 412 | } 413 | return Future.value(); 414 | } 415 | 416 | Future _handleError(String path) async { 417 | if (await FileSystemEntity.isDirectory(path)) { 418 | stderr.writeln('error: $path is a directory'); 419 | } else { 420 | exitCode = 2; 421 | } 422 | } 423 | -------------------------------------------------------------------------------- /lib/widget/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Newcore-mobile/DynamicFlutter/d4481f61011b2f5746a907ba2e93cec9b8e7dfa8/lib/widget/.DS_Store -------------------------------------------------------------------------------- /lib/widget/argument_parser/argument_circularprogressIndicator_parser.dart: -------------------------------------------------------------------------------- 1 | /// 2 | ///Author: YoungChan 3 | ///Date: 2020-03-17 13:24:11 4 | ///LastEditors: YoungChan 5 | ///LastEditTime: 2020-04-16 18:56:47 6 | ///Description: file content 7 | /// 8 | import 'package:flutter/material.dart'; 9 | import 'package:dynamicflutter/ast_node.dart'; 10 | import 'argument_comm_parser.dart'; 11 | 12 | Animation parseValueColor(Expression expression) { 13 | if (expression.isMethodInvocation && 14 | expression.asMethodInvocation.callee.isIdentifier && 15 | expression.asMethodInvocation.callee.asIdentifier.name == 16 | 'AlwaysStoppedAnimation') { 17 | var argumentList = expression.asMethodInvocation.argumentList; 18 | if ((argumentList?.length ?? 0) > 0) { 19 | return AlwaysStoppedAnimation(parseColor(argumentList[0])); 20 | } 21 | } 22 | return AlwaysStoppedAnimation(Colors.black); 23 | } 24 | -------------------------------------------------------------------------------- /lib/widget/argument_parser/argument_comm_parser.dart: -------------------------------------------------------------------------------- 1 | /// 2 | ///Author: YoungChan 3 | ///Date: 2020-03-12 18:05:59 4 | ///LastEditors: YoungChan 5 | ///LastEditTime: 2020-04-22 18:42:35 6 | ///Description: file content 7 | /// 8 | import 'package:flutter/material.dart'; 9 | import 'package:dynamicflutter/ast_node.dart'; 10 | import '../widget_builders/widget_builder_factory.dart'; 11 | 12 | Color parseColor(Expression expression) { 13 | if (expression.isPrefixedIdentifier && 14 | (expression.asPrefixedIdentifier).prefix == 'Colors') { 15 | switch ((expression.asPrefixedIdentifier).identifier) { 16 | case 'amber': 17 | return Colors.amber; 18 | case 'amberAccent': 19 | return Colors.amberAccent; 20 | case 'black': 21 | return Colors.black; 22 | case 'black12': 23 | return Colors.black12; 24 | case 'black26': 25 | return Colors.black26; 26 | case 'black38': 27 | return Colors.black38; 28 | case 'black45': 29 | return Colors.black45; 30 | case 'black54': 31 | return Colors.black54; 32 | case 'black87': 33 | return Colors.black87; 34 | case 'blue': 35 | return Colors.blue; 36 | case 'blueAccent': 37 | return Colors.blueAccent; 38 | case 'blueGrey': 39 | return Colors.blueGrey; 40 | case 'brown': 41 | return Colors.brown; 42 | case 'cyan': 43 | return Colors.cyan; 44 | case 'cyanAccent': 45 | return Colors.cyanAccent; 46 | case 'deepOrange': 47 | return Colors.deepOrange; 48 | case 'deepOrangeAccent': 49 | return Colors.deepOrangeAccent; 50 | case 'deepPurple': 51 | return Colors.deepPurple; 52 | case 'deepPurpleAccent': 53 | return Colors.deepPurpleAccent; 54 | case 'green': 55 | return Colors.green; 56 | case 'greenAccent': 57 | return Colors.greenAccent; 58 | case 'grey': 59 | return Colors.grey; 60 | case 'indigo': 61 | return Colors.indigo; 62 | case 'indigoAccent': 63 | return Colors.indigoAccent; 64 | case 'lightBlue': 65 | return Colors.lightBlue; 66 | case 'lightBlueAccent': 67 | return Colors.lightBlueAccent; 68 | case 'lightGreen': 69 | return Colors.lightGreen; 70 | case 'lightGreenAccent': 71 | return Colors.lightGreenAccent; 72 | case 'lime': 73 | return Colors.lime; 74 | case 'limeAccent': 75 | return Colors.limeAccent; 76 | case 'orange': 77 | return Colors.orange; 78 | case 'orangeAccent': 79 | return Colors.orangeAccent; 80 | case 'pink': 81 | return Colors.pink; 82 | case 'pinkAccent': 83 | return Colors.pinkAccent; 84 | case 'purple': 85 | return Colors.purple; 86 | case 'purpleAccent': 87 | return Colors.purpleAccent; 88 | case 'red': 89 | return Colors.red; 90 | case 'redAccent': 91 | return Colors.redAccent; 92 | case 'teal': 93 | return Colors.teal; 94 | case 'tealAccent': 95 | return Colors.tealAccent; 96 | case 'transparent': 97 | return Colors.transparent; 98 | case 'white': 99 | return Colors.white; 100 | case 'white10': 101 | return Colors.white10; 102 | case 'white12': 103 | return Colors.white12; 104 | case 'white24': 105 | return Colors.white24; 106 | case 'white30': 107 | return Colors.white30; 108 | case 'white38': 109 | return Colors.white38; 110 | case 'white54': 111 | return Colors.white54; 112 | case 'white60': 113 | return Colors.white60; 114 | case 'white70': 115 | return Colors.white70; 116 | case 'yellow': 117 | return Colors.yellow; 118 | case 'yellowAccent': 119 | return Colors.yellowAccent; 120 | } 121 | } else if (expression.isPropertyAccess) { 122 | var propertyExpression = expression.asPropertyAccess.expression; 123 | switch (expression.asPropertyAccess.name) { 124 | case 'shade50': 125 | return (parseColor(propertyExpression) as MaterialColor).shade50; 126 | case 'shade100': 127 | return (parseColor(propertyExpression) as MaterialColor).shade100; 128 | case 'shade200': 129 | return (parseColor(propertyExpression) as MaterialColor).shade200; 130 | case 'shade300': 131 | return (parseColor(propertyExpression) as MaterialColor).shade300; 132 | case 'shade400': 133 | return (parseColor(propertyExpression) as MaterialColor).shade400; 134 | case 'shade500': 135 | return (parseColor(propertyExpression) as MaterialColor).shade500; 136 | case 'shade600': 137 | return (parseColor(propertyExpression) as MaterialColor).shade600; 138 | case 'shade700': 139 | return (parseColor(propertyExpression) as MaterialColor).shade700; 140 | case 'shade800': 141 | return (parseColor(propertyExpression) as MaterialColor).shade800; 142 | case 'shade900': 143 | return (parseColor(propertyExpression) as MaterialColor).shade900; 144 | } 145 | } else if (expression.isMethodInvocation) { 146 | var methodInvocation = expression.asMethodInvocation; 147 | 148 | var calleeExpression = methodInvocation.callee; 149 | if (calleeExpression.isMemberExpression) { 150 | var callee = calleeExpression.asMemberExpression; 151 | var masterColor = parseColor(callee.object); 152 | num argumentValue = 255; 153 | var argumentList = methodInvocation.argumentList; 154 | if (argumentList != null && argumentList.length > 0) { 155 | if (argumentList[0].isNumericLiteral) { 156 | argumentValue = (argumentList[0] as NumericLiteral).value; 157 | } 158 | } 159 | switch (callee.property) { 160 | case 'withAlpha': 161 | return masterColor.withAlpha(argumentValue); 162 | case 'withBlue': 163 | return masterColor.withBlue(argumentValue); 164 | case 'withRed': 165 | return masterColor.withRed(argumentValue); 166 | case 'withGreen': 167 | return masterColor.withGreen(argumentValue); 168 | case 'withOpacity': 169 | return masterColor.withOpacity(argumentValue); 170 | } 171 | } else if (calleeExpression.isIdentifier && 172 | (calleeExpression.asIdentifier).name == 'Color') { 173 | num argumentValue = 255; 174 | var argumentList = methodInvocation.argumentList; 175 | if (argumentList != null && argumentList.length > 0) { 176 | if (argumentList[0].isNumericLiteral) { 177 | argumentValue = (argumentList[0] as NumericLiteral).value; 178 | } 179 | } 180 | return Color(argumentValue); 181 | } 182 | } 183 | return Colors.black; 184 | } 185 | 186 | /// 解析基础数据类型,String, number, bool 187 | dynamic parseBaseLiteral(Expression expression) { 188 | if (expression.isStringLiteral) { 189 | return (expression.asStringLiteral).value; 190 | } else if (expression.isNumericLiteral) { 191 | return (expression.asNumericLiteral).value; 192 | } else if (expression.isBooleanLiteral) { 193 | return (expression.asBooleanLiteral).value; 194 | } else { 195 | return null; 196 | } 197 | } 198 | 199 | EdgeInsets parseEdgeInsets(Expression expression) { 200 | if (expression.isMethodInvocation) { 201 | var methodInvocation = expression.asMethodInvocation; 202 | var callee = methodInvocation.callee; 203 | if (callee.isMemberExpression) { 204 | var memberExpression = callee.asMemberExpression; 205 | var argumentList = methodInvocation.argumentList; 206 | switch (memberExpression.property) { 207 | case 'symmetric': 208 | num vertical = .0, horizontal = .0; 209 | for (var arg in argumentList) { 210 | if (arg.isNamedExpression) { 211 | if (arg.asNamedExpression.label == 'vertical') { 212 | vertical = parseBaseLiteral(arg.asNamedExpression.expression) 213 | ?.toDouble() ?? 214 | .0; 215 | } else if (arg.asNamedExpression.label == 'horizontal') { 216 | horizontal = parseBaseLiteral(arg.asNamedExpression.expression) 217 | ?.toDouble() ?? 218 | .0; 219 | } 220 | } 221 | } 222 | return EdgeInsets.symmetric( 223 | vertical: vertical, horizontal: horizontal); 224 | case 'only': 225 | num left = 0, top = 0, right = 0, bottom = 0; 226 | for (var arg in argumentList) { 227 | if (arg.isNamedExpression) { 228 | switch (arg.asNamedExpression.label) { 229 | case 'left': 230 | left = parseBaseLiteral(arg.asNamedExpression.expression) 231 | ?.toDouble() ?? 232 | .0; 233 | break; 234 | case 'top': 235 | top = parseBaseLiteral(arg.asNamedExpression.expression) 236 | ?.toDouble() ?? 237 | .0; 238 | break; 239 | case 'right': 240 | right = parseBaseLiteral(arg.asNamedExpression.expression) 241 | ?.toDouble() ?? 242 | .0; 243 | break; 244 | case 'bottom': 245 | bottom = parseBaseLiteral(arg.asNamedExpression.expression) 246 | ?.toDouble() ?? 247 | .0; 248 | break; 249 | } 250 | } 251 | } 252 | return EdgeInsets.only( 253 | left: left.toDouble(), 254 | top: top.toDouble(), 255 | right: right.toDouble(), 256 | bottom: bottom.toDouble()); 257 | case 'all': 258 | num all = 0; 259 | if ((argumentList?.length ?? 0) > 0 && 260 | argumentList[0].isNumericLiteral) { 261 | all = (argumentList[0].asNumericLiteral).value; 262 | } 263 | return EdgeInsets.all(all.toDouble()); 264 | case 'fromLTRB': 265 | num left = 0, top = 0, right = 0, bottom = 0; 266 | if ((argumentList?.length ?? 0) == 4) { 267 | if (argumentList[0].isNumericLiteral) { 268 | left = (argumentList[0].asNumericLiteral).value; 269 | } 270 | if (argumentList[1].isNumericLiteral) { 271 | top = (argumentList[1].asNumericLiteral).value; 272 | } 273 | if (argumentList[2].isNumericLiteral) { 274 | right = (argumentList[2].asNumericLiteral).value; 275 | } 276 | if (argumentList[3].isNumericLiteral) { 277 | bottom = (argumentList[3].asNumericLiteral).value; 278 | } 279 | } 280 | return EdgeInsets.fromLTRB(left.toDouble(), top.toDouble(), 281 | right.toDouble(), bottom.toDouble()); 282 | } 283 | } 284 | } else if (expression.isPrefixedIdentifier) { 285 | var prefixedIdentifier = expression.asPrefixedIdentifier; 286 | if (prefixedIdentifier.prefix == 'EdgeInsets' && 287 | prefixedIdentifier.identifier == 'zero') { 288 | return EdgeInsets.zero; 289 | } 290 | } 291 | return EdgeInsets.zero; 292 | } 293 | 294 | BoxConstraints parseBoxConstraints(Expression expression) { 295 | if (expression.isMethodInvocation) { 296 | var callee = expression.asMethodInvocation.callee; 297 | if (callee.isMemberExpression) { 298 | var memberExpression = callee.asMemberExpression; 299 | var argumentList = expression.asMethodInvocation.argumentList; 300 | switch (memberExpression.property) { 301 | case 'expand': 302 | double width = .0, height = .0; 303 | for (var arg in argumentList) { 304 | if (arg.isNamedExpression) { 305 | if (arg.asNamedExpression.label == 'width') { 306 | width = parseBaseLiteral(arg.asNamedExpression.expression) 307 | ?.toDouble() ?? 308 | .0; 309 | } else if (arg.asNamedExpression.label == 'height') { 310 | height = parseBaseLiteral(arg.asNamedExpression.expression) 311 | ?.toDouble() ?? 312 | .0; 313 | } 314 | } 315 | } 316 | return BoxConstraints.expand(width: width, height: height); 317 | case 'loose': 318 | Size size = Size.zero; 319 | if ((argumentList?.length ?? 0) == 1) { 320 | size = parseSize(argumentList[0]); 321 | } 322 | return BoxConstraints.loose(size); 323 | case 'tight': 324 | Size size = Size.zero; 325 | if ((argumentList?.length ?? 0) == 1) { 326 | size = parseSize(argumentList[0]); 327 | } 328 | return BoxConstraints.tight(size); 329 | case 'tightFor': 330 | double width = .0, height = .0; 331 | for (var arg in argumentList) { 332 | if (arg.isNamedExpression) { 333 | if (arg.asNamedExpression.label == 'width') { 334 | width = parseBaseLiteral(arg.asNamedExpression.expression) 335 | ?.toDouble() ?? 336 | .0; 337 | } else if (arg.asNamedExpression.label == 'height') { 338 | height = parseBaseLiteral(arg.asNamedExpression.expression) 339 | ?.toDouble() ?? 340 | .0; 341 | } 342 | } 343 | } 344 | return BoxConstraints.tightFor(width: width, height: height); 345 | case 'tightForFinite': 346 | double width = double.infinity, height = double.infinity; 347 | for (var arg in argumentList) { 348 | if (arg.isNamedExpression) { 349 | if (arg.asNamedExpression.label == 'width') { 350 | width = parseBaseLiteral(arg.asNamedExpression.expression) 351 | ?.toDouble() ?? 352 | .0; 353 | } else if (arg.asNamedExpression.label == 'height') { 354 | height = parseBaseLiteral(arg.asNamedExpression.expression) 355 | ?.toDouble() ?? 356 | .0; 357 | } 358 | } 359 | } 360 | return BoxConstraints.tightForFinite(width: width, height: height); 361 | } 362 | } 363 | } 364 | return null; 365 | } 366 | 367 | Size parseSize(Expression sizeExpression) { 368 | if (sizeExpression != null) { 369 | if (sizeExpression.isMethodInvocation) { 370 | var methodInvocation = sizeExpression.asMethodInvocation; 371 | var callee = methodInvocation.callee; 372 | var argumentList = methodInvocation.argumentList; 373 | if (callee.isMemberExpression) { 374 | var memberExpression = callee.asMemberExpression; 375 | switch (memberExpression.property) { 376 | case 'fromWidth': 377 | num width = 0; 378 | if ((argumentList?.length ?? 0) == 1) { 379 | width = (argumentList[0].asNumericLiteral).value; 380 | } 381 | return Size.fromWidth(width.toDouble()); 382 | case 'fromHeight': 383 | num height = 0; 384 | if ((argumentList?.length ?? 0) == 1) { 385 | height = (argumentList[0].asNumericLiteral).value; 386 | } 387 | return Size.fromHeight(height.toDouble()); 388 | case 'fromRadius': 389 | num radius = 0; 390 | if ((argumentList?.length ?? 0) == 1) { 391 | radius = (argumentList[0].asNumericLiteral).value; 392 | } 393 | return Size.fromRadius(radius.toDouble()); 394 | case 'square': 395 | num dimension = 0; 396 | if ((argumentList?.length ?? 0) == 1) { 397 | dimension = (argumentList[0].asNumericLiteral).value; 398 | } 399 | return Size.square(dimension.toDouble()); 400 | } 401 | } else if (callee.isIdentifier) { 402 | var identifier = callee.asIdentifier; 403 | if (identifier.name == 'Size') { 404 | num width = 0, height = 0; 405 | if ((argumentList?.length ?? 0) == 2) { 406 | width = (argumentList[0].asNumericLiteral).value; 407 | height = (argumentList[0].asNumericLiteral).value; 408 | } 409 | return Size(width.toDouble(), height.toDouble()); 410 | } 411 | } 412 | } else if (sizeExpression.isPrefixedIdentifier) { 413 | var prefixedIdentifier = sizeExpression.asPrefixedIdentifier; 414 | if (prefixedIdentifier.prefix == 'Size') { 415 | switch (prefixedIdentifier.identifier) { 416 | case 'zero': 417 | return Size.zero; 418 | case 'infinite': 419 | return Size.infinite; 420 | } 421 | } 422 | } 423 | } 424 | 425 | return Size.zero; 426 | } 427 | 428 | Radius parseRadius(MethodInvocation radiusNode) { 429 | if (radiusNode != null) { 430 | var callee = radiusNode.callee; 431 | if (callee.isMemberExpression) { 432 | var memberExpression = callee.asMemberExpression; 433 | if ((memberExpression.object.asIdentifier).name == 'Radius' && 434 | memberExpression.property == 'circular') { 435 | num circular = 0; 436 | if (radiusNode.argumentList.length == 1) { 437 | circular = (radiusNode.argumentList[0].asNumericLiteral).value; 438 | } 439 | return Radius.circular(circular.toDouble()); 440 | } 441 | } 442 | } 443 | 444 | return Radius.zero; 445 | } 446 | 447 | Axis parseAxis(Expression expression) { 448 | if (expression.isPrefixedIdentifier && 449 | expression.asPrefixedIdentifier.prefix == 'Axis') { 450 | if (expression.asPrefixedIdentifier.identifier == 'vertical') { 451 | return Axis.vertical; 452 | } else if (expression.asPrefixedIdentifier.identifier == 'horizontal') { 453 | return Axis.horizontal; 454 | } 455 | } 456 | return Axis.vertical; 457 | } 458 | 459 | Alignment parseAlignment(Expression expression) { 460 | if (expression.isPrefixedIdentifier) { 461 | switch (expression.asPrefixedIdentifier.identifier) { 462 | case 'topLeft': 463 | return Alignment.topLeft; 464 | case 'topRight': 465 | return Alignment.topRight; 466 | case 'topCenter': 467 | return Alignment.topCenter; 468 | case 'bottomLeft': 469 | return Alignment.bottomLeft; 470 | case 'bottomRight': 471 | return Alignment.bottomRight; 472 | case 'bottomCenter': 473 | return Alignment.bottomCenter; 474 | case 'center': 475 | return Alignment.center; 476 | case 'centerLeft': 477 | return Alignment.centerLeft; 478 | case 'centerRight': 479 | return Alignment.centerRight; 480 | } 481 | } 482 | 483 | return Alignment.center; 484 | } 485 | -------------------------------------------------------------------------------- /lib/widget/argument_parser/argument_decoration_parser.dart: -------------------------------------------------------------------------------- 1 | /// 2 | ///Author: YoungChan 3 | ///Date: 2020-03-17 18:55:07 4 | ///LastEditors: YoungChan 5 | ///LastEditTime: 2020-04-22 18:43:34 6 | ///Description: file content 7 | /// 8 | import 'package:flutter/material.dart'; 9 | import 'argument_comm_parser.dart'; 10 | import 'package:dynamicflutter/ast_node.dart'; 11 | 12 | BoxDecoration parseBoxDecoration(Expression expression) { 13 | if (expression.isMethodInvocation) { 14 | if ((expression.asMethodInvocation.callee.asIdentifier).name == 15 | 'BoxDecoration') { 16 | var argumentList = expression.asMethodInvocation.argumentList; 17 | var color = Colors.black; 18 | var border = Border.all(style: BorderStyle.none); 19 | var borderRadius = BorderRadius.circular(0); 20 | var shape = BoxShape.rectangle; 21 | 22 | for (var arg in argumentList) { 23 | if (arg.isNamedExpression) { 24 | switch (arg.asNamedExpression.label) { 25 | case 'color': 26 | color = parseColor(arg.asNamedExpression.expression); 27 | break; 28 | case 'border': 29 | border = parseBoxBorder(arg.asNamedExpression.expression); 30 | break; 31 | case 'borderRadius': 32 | borderRadius = 33 | parseBorderRadius(arg.asNamedExpression.expression); 34 | break; 35 | case 'shape': 36 | shape = parseBoxShape(arg.asNamedExpression.expression); 37 | break; 38 | } 39 | } 40 | } 41 | return BoxDecoration( 42 | color: color, 43 | border: border, 44 | borderRadius: borderRadius, 45 | shape: shape); 46 | } 47 | } 48 | 49 | return null; 50 | } 51 | 52 | BoxBorder parseBoxBorder(Expression expression) { 53 | var borderStyle = BorderStyle.solid; 54 | var color = Colors.black; 55 | num width = 1; 56 | if (expression.isMethodInvocation) { 57 | var argumentList = expression.asMethodInvocation.argumentList; 58 | for (var arg in argumentList) { 59 | switch (arg.asIdentifier.name) { 60 | case 'color': 61 | color = parseColor(arg.asNamedExpression.expression); 62 | break; 63 | case 'width': 64 | width = arg.asNamedExpression.expression.asNumericLiteral.value; 65 | break; 66 | case 'style': 67 | if (arg.asNamedExpression.expression.isPrefixedIdentifier && 68 | arg.asNamedExpression.expression.asPrefixedIdentifier.prefix == 69 | 'BorderStyle') { 70 | switch (arg 71 | .asNamedExpression.expression.asPrefixedIdentifier.identifier) { 72 | case 'solid': 73 | borderStyle = BorderStyle.solid; 74 | break; 75 | case 'none': 76 | borderStyle = BorderStyle.none; 77 | break; 78 | } 79 | } 80 | break; 81 | } 82 | } 83 | } 84 | 85 | return Border.all(color: color, width: width.toDouble(), style: borderStyle); 86 | } 87 | 88 | BorderRadius parseBorderRadius(Expression expression) { 89 | if (expression.isMethodInvocation) { 90 | var argumentList = expression.asMethodInvocation.argumentList; 91 | var callee = expression.asMethodInvocation.callee; 92 | if (callee.isMemberExpression) { 93 | switch (callee.asMemberExpression.property) { 94 | case 'circular': 95 | num circular = 0; 96 | if ((argumentList?.length ?? 0) == 1) { 97 | circular = argumentList[0].asNumericLiteral.value; 98 | } 99 | return BorderRadius.circular(circular); 100 | case 'only': 101 | Radius topLeft = Radius.zero, 102 | topRight = Radius.zero, 103 | bottomLeft = Radius.zero, 104 | bottomRight = Radius.zero; 105 | for (var arg in argumentList) { 106 | switch (arg.asNamedExpression.label) { 107 | case 'topLeft': 108 | topLeft = parseRadius( 109 | arg.asNamedExpression.expression.asMethodInvocation); 110 | break; 111 | case 'topRight': 112 | topRight = parseRadius( 113 | arg.asNamedExpression.expression.asMethodInvocation); 114 | break; 115 | case 'bottomLeft': 116 | bottomLeft = parseRadius( 117 | arg.asNamedExpression.expression.asMethodInvocation); 118 | break; 119 | case 'bottomRight': 120 | bottomRight = parseRadius( 121 | arg.asNamedExpression.expression.asMethodInvocation); 122 | break; 123 | } 124 | } 125 | return BorderRadius.only( 126 | topLeft: topLeft, 127 | topRight: topRight, 128 | bottomLeft: bottomLeft, 129 | bottomRight: bottomRight); 130 | } 131 | } 132 | } 133 | 134 | return BorderRadius.circular(0); 135 | } 136 | 137 | BoxShape parseBoxShape(Expression expression) { 138 | if (expression.isPrefixedIdentifier) { 139 | switch (expression.asPrefixedIdentifier.identifier) { 140 | case 'rectangle': 141 | return BoxShape.rectangle; 142 | case 'circle': 143 | return BoxShape.circle; 144 | } 145 | } 146 | 147 | return BoxShape.rectangle; 148 | } 149 | -------------------------------------------------------------------------------- /lib/widget/argument_parser/argument_icon_parser.dart: -------------------------------------------------------------------------------- 1 | /// 2 | ///Author: YoungChan 3 | ///Date: 2020-03-17 11:22:54 4 | ///LastEditors: YoungChan 5 | ///LastEditTime: 2020-04-16 18:59:24 6 | ///Description: file content 7 | /// 8 | import 'package:flutter/material.dart'; 9 | import 'package:dynamicflutter/ast_node.dart'; 10 | 11 | IconData parseIconData(Expression expression) { 12 | if (expression.isPrefixedIdentifier) { 13 | switch (expression.asPrefixedIdentifier.identifier) { 14 | case 'face': 15 | return Icons.face; 16 | } 17 | } 18 | return null; 19 | } 20 | -------------------------------------------------------------------------------- /lib/widget/argument_parser/argument_image_parser.dart: -------------------------------------------------------------------------------- 1 | /// 2 | ///Author: YoungChan 3 | ///Date: 2020-03-16 18:40:23 4 | ///LastEditors: YoungChan 5 | ///LastEditTime: 2020-04-16 19:05:49 6 | ///Description: file content 7 | /// 8 | import 'package:flutter/material.dart'; 9 | import 'package:dynamicflutter/ast_node.dart'; 10 | 11 | BoxFit parseBoxFit(Expression expression) { 12 | if (expression.isPrefixedIdentifier) { 13 | switch (expression.asPrefixedIdentifier.identifier) { 14 | case 'fill': 15 | return BoxFit.fill; 16 | case 'cover': 17 | return BoxFit.cover; 18 | case 'contain': 19 | return BoxFit.contain; 20 | case 'fitWidth': 21 | return BoxFit.fitWidth; 22 | case 'fitHeight': 23 | return BoxFit.fitHeight; 24 | case 'scaleDown': 25 | return BoxFit.scaleDown; 26 | case 'none': 27 | return BoxFit.none; 28 | } 29 | } 30 | 31 | return BoxFit.none; 32 | } 33 | -------------------------------------------------------------------------------- /lib/widget/argument_parser/argument_parser.dart: -------------------------------------------------------------------------------- 1 | /// 2 | ///Author: YoungChan 3 | ///Date: 2020-03-16 15:38:26 4 | ///LastEditors: YoungChan 5 | ///LastEditTime: 2020-04-22 18:46:03 6 | ///Description: file content 7 | /// 8 | 9 | export 'argument_comm_parser.dart'; 10 | export 'argument_circularprogressIndicator_parser.dart'; 11 | export 'argument_decoration_parser.dart'; 12 | export 'argument_icon_parser.dart'; 13 | export 'argument_image_parser.dart'; 14 | export 'argument_text_parser.dart'; 15 | export 'argument_row_column_parser.dart'; 16 | -------------------------------------------------------------------------------- /lib/widget/argument_parser/argument_row_column_parser.dart: -------------------------------------------------------------------------------- 1 | /// 2 | ///Author: YoungChan 3 | ///Date: 2020-04-17 11:30:50 4 | ///LastEditors: YoungChan 5 | ///LastEditTime: 2020-04-17 11:40:22 6 | ///Description: file content 7 | /// 8 | import 'package:flutter/material.dart'; 9 | import 'package:dynamicflutter/ast_node.dart'; 10 | 11 | MainAxisAlignment parseMainAxisAlignment(Expression expression) { 12 | if (expression.isPrefixedIdentifier) { 13 | switch (expression.asPrefixedIdentifier.identifier) { 14 | case 'start': 15 | return MainAxisAlignment.start; 16 | case 'end': 17 | return MainAxisAlignment.end; 18 | case 'center': 19 | return MainAxisAlignment.center; 20 | case 'spaceAround': 21 | return MainAxisAlignment.spaceAround; 22 | case 'spaceBetween': 23 | return MainAxisAlignment.spaceBetween; 24 | case 'spaceEvenly': 25 | return MainAxisAlignment.spaceEvenly; 26 | } 27 | } 28 | return MainAxisAlignment.start; 29 | } 30 | 31 | MainAxisSize parseMainAxisSize(Expression expression) { 32 | if (expression.isPrefixedIdentifier) { 33 | switch (expression.asPrefixedIdentifier.identifier) { 34 | case 'max': 35 | return MainAxisSize.max; 36 | case 'min': 37 | return MainAxisSize.min; 38 | } 39 | } 40 | return MainAxisSize.max; 41 | } 42 | 43 | CrossAxisAlignment parseCrossAxisAlignment(Expression expression) { 44 | if (expression.isPrefixedIdentifier) { 45 | switch (expression.asPrefixedIdentifier.identifier) { 46 | case 'start': 47 | return CrossAxisAlignment.start; 48 | case 'end': 49 | return CrossAxisAlignment.end; 50 | case 'center': 51 | return CrossAxisAlignment.center; 52 | case 'baseline': 53 | return CrossAxisAlignment.baseline; 54 | case 'stretch': 55 | return CrossAxisAlignment.stretch; 56 | } 57 | } 58 | return CrossAxisAlignment.center; 59 | } 60 | 61 | VerticalDirection parseVerticalDirection(Expression expression) { 62 | if (expression.isPrefixedIdentifier) { 63 | switch (expression.asPrefixedIdentifier.identifier) { 64 | case 'down': 65 | return VerticalDirection.down; 66 | case 'up': 67 | return VerticalDirection.up; 68 | } 69 | } 70 | return VerticalDirection.down; 71 | } 72 | -------------------------------------------------------------------------------- /lib/widget/argument_parser/argument_text_parser.dart: -------------------------------------------------------------------------------- 1 | /// 2 | ///Author: YoungChan 3 | ///Date: 2020-03-16 13:35:48 4 | ///LastEditors: YoungChan 5 | ///LastEditTime: 2020-04-22 18:44:09 6 | ///Description: file content 7 | /// 8 | import 'package:flutter/material.dart'; 9 | import 'package:dynamicflutter/ast_node.dart'; 10 | import 'argument_parser.dart'; 11 | 12 | TextStyle parseTextStyle(Expression expression) { 13 | var color = Colors.black; 14 | var fontStyle = FontStyle.normal; 15 | double fontSize = 14; 16 | var fontWeight = FontWeight.normal; 17 | if (expression.isMethodInvocation) { 18 | var argumentList = expression.asMethodInvocation.argumentList; 19 | for (var arg in argumentList) { 20 | if (arg.isNamedExpression) { 21 | switch (arg.asNamedExpression.label) { 22 | case 'color': 23 | color = parseColor(arg.asNamedExpression.expression); 24 | break; 25 | case 'fontStyle': 26 | fontStyle = parseFontStyle(arg.asNamedExpression.expression); 27 | break; 28 | case 'fontWeight': 29 | fontWeight = parseFontWeight(arg.asNamedExpression.expression); 30 | break; 31 | case 'fontSize': 32 | fontSize = parseBaseLiteral(arg.asNamedExpression.expression) 33 | ?.toDouble() ?? 34 | 14.0; 35 | break; 36 | } 37 | } 38 | } 39 | } 40 | 41 | return TextStyle( 42 | color: color, 43 | fontStyle: fontStyle, 44 | fontWeight: fontWeight, 45 | fontSize: fontSize); 46 | } 47 | 48 | TextAlign parseTextAlign(Expression expression) { 49 | if (expression.isPrefixedIdentifier) { 50 | switch (expression.asPrefixedIdentifier.identifier) { 51 | case 'center': 52 | return TextAlign.center; 53 | case 'end': 54 | return TextAlign.end; 55 | case 'justify': 56 | return TextAlign.justify; 57 | case 'start': 58 | return TextAlign.start; 59 | case 'left': 60 | return TextAlign.left; 61 | case 'right': 62 | return TextAlign.right; 63 | } 64 | } 65 | 66 | return TextAlign.center; 67 | } 68 | 69 | TextDirection parseTextDirection(Expression expression) { 70 | if (expression.isPrefixedIdentifier) { 71 | switch (expression.asPrefixedIdentifier.identifier) { 72 | case 'ltr': 73 | return TextDirection.ltr; 74 | case 'rtl': 75 | return TextDirection.rtl; 76 | } 77 | } 78 | 79 | return TextDirection.ltr; 80 | } 81 | 82 | TextOverflow parseTextOverflow(Expression expression) { 83 | if (expression.isPrefixedIdentifier) { 84 | switch (expression.asPrefixedIdentifier.identifier) { 85 | case 'clip': 86 | return TextOverflow.clip; 87 | case 'ellipsis': 88 | return TextOverflow.ellipsis; 89 | case 'fade': 90 | return TextOverflow.fade; 91 | } 92 | } 93 | 94 | return TextOverflow.ellipsis; 95 | } 96 | 97 | TextDecoration parseTextDecoration(Expression expression) { 98 | if (expression.isPrefixedIdentifier) { 99 | switch (expression.asPrefixedIdentifier.identifier) { 100 | case 'lineThrough': 101 | return TextDecoration.lineThrough; 102 | case 'none': 103 | return TextDecoration.none; 104 | case 'overline': 105 | return TextDecoration.overline; 106 | case 'underline': 107 | return TextDecoration.underline; 108 | } 109 | } 110 | 111 | return TextDecoration.none; 112 | } 113 | 114 | FontStyle parseFontStyle(Expression expression) { 115 | if (expression.isPrefixedIdentifier) { 116 | switch (expression.asPrefixedIdentifier.identifier) { 117 | case 'normal': 118 | return FontStyle.normal; 119 | case 'italic': 120 | return FontStyle.italic; 121 | } 122 | } 123 | 124 | return FontStyle.normal; 125 | } 126 | 127 | FontWeight parseFontWeight(Expression expression) { 128 | if (expression.isPrefixedIdentifier) { 129 | switch (expression.asPrefixedIdentifier.identifier) { 130 | case 'normal': 131 | return FontWeight.normal; 132 | case 'bold': 133 | return FontWeight.bold; 134 | case 'w100': 135 | return FontWeight.w100; 136 | case 'w200': 137 | return FontWeight.w200; 138 | case 'w300': 139 | return FontWeight.w300; 140 | case 'w400': 141 | return FontWeight.w400; 142 | case 'w500': 143 | return FontWeight.w500; 144 | case 'w600': 145 | return FontWeight.w600; 146 | case 'w700': 147 | return FontWeight.w700; 148 | case 'w800': 149 | return FontWeight.w800; 150 | case 'w900': 151 | return FontWeight.w900; 152 | } 153 | } 154 | 155 | return FontWeight.normal; 156 | } 157 | -------------------------------------------------------------------------------- /lib/widget/ast_statefulwidget.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | 3 | /// 4 | ///Author: YoungChan 5 | ///Date: 2020-03-12 17:30:17 6 | ///LastEditors: YoungChan 7 | ///LastEditTime: 2020-04-22 23:10:22 8 | ///Description: StatefulWidget wrapper 9 | /// 10 | import 'package:flutter/material.dart'; 11 | import 'package:dynamicflutter/ast_node.dart'; 12 | import 'widget_builders/widget_builders.dart'; 13 | 14 | class AstStatefulWidget extends StatefulWidget { 15 | final Map ast; 16 | 17 | AstStatefulWidget(this.ast); 18 | 19 | @override 20 | _AstStatefulWidgetState createState() => _AstStatefulWidgetState(); 21 | } 22 | 23 | class _AstStatefulWidgetState extends State { 24 | Widget _bodyWidget; 25 | 26 | static const TAG = "AstStatefulWidgetState"; 27 | 28 | Future _parseRootAst(Map rootAst) async { 29 | var rootExpression = Expression.fromAst(rootAst); 30 | if (rootExpression.isProgram) { 31 | var bodyList = rootExpression.asProgram.body; 32 | 33 | if ((bodyList?.length ?? 0) == 2) { 34 | var stateClass = bodyList[1].asClassDeclaration; 35 | if (stateClass.superClause == 'State') { 36 | var stateBodyList = stateClass.body; 37 | for (var bodyNode in stateBodyList) { 38 | if (bodyNode.isMethodDeclaration) { 39 | switch (bodyNode.asMethodDeclaration.name) { 40 | case 'build': 41 | var buildBodyReturn = bodyNode.asMethodDeclaration.body.body; 42 | if (buildBodyReturn.isNotEmpty && 43 | buildBodyReturn[0].isReturnStatement && 44 | buildBodyReturn[0].asReturnStatement.argument != null) { 45 | setState(() { 46 | _bodyWidget = 47 | FHWidgetBuilderFactory.buildWidgetWithExpression( 48 | buildBodyReturn[0].asReturnStatement.argument); 49 | }); 50 | } 51 | break; 52 | case 'initState': 53 | break; 54 | case 'didUpdateWidget': 55 | break; 56 | case 'dispose': 57 | break; 58 | } 59 | } else if (bodyNode.isFieldDeclaration) { 60 | //TODO state field declaration 61 | } 62 | } 63 | } 64 | } 65 | } 66 | return Future.value(); 67 | } 68 | 69 | @override 70 | void initState() { 71 | _parseRootAst(widget.ast); 72 | 73 | super.initState(); 74 | } 75 | 76 | @override 77 | void dispose() { 78 | super.dispose(); 79 | } 80 | 81 | @override 82 | Widget build(BuildContext context) { 83 | return Material( 84 | color: Colors.white, 85 | child: _bodyWidget == null 86 | ? Center( 87 | child: SizedBox.fromSize( 88 | size: Size.square(30), child: CircularProgressIndicator()), 89 | ) 90 | : _bodyWidget, 91 | ); 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /lib/widget/widget_builders/basebuilder_box.dart: -------------------------------------------------------------------------------- 1 | /// 2 | ///Author: YoungChan 3 | ///Date: 2020-03-24 14:45:29 4 | ///LastEditors: YoungChan 5 | ///LastEditTime: 2020-03-24 14:46:14 6 | ///Description: file content 7 | /// 8 | import 'package:flutter/material.dart'; 9 | import 'package:dynamicflutter/ast_node.dart'; 10 | 11 | abstract class BaseBuilderBox { 12 | Widget build(Expression widgetExpression, {Map variables}) => 13 | SizedBox.fromSize( 14 | size: Size.square(0), 15 | ); 16 | } 17 | -------------------------------------------------------------------------------- /lib/widget/widget_builders/basewidget_builder.dart: -------------------------------------------------------------------------------- 1 | /// 2 | ///Author: YoungChan 3 | ///Date: 2020-03-12 16:44:19 4 | ///LastEditors: YoungChan 5 | ///LastEditTime: 2020-03-24 14:46:38 6 | ///Description: widget builder interface 7 | /// 8 | import 'package:flutter/material.dart'; 9 | import 'package:dynamicflutter/ast_node.dart'; 10 | 11 | abstract class BaseWidgetBuilder { 12 | Widget build(Expression widgetExpression, {Map variables}) => 13 | SizedBox.fromSize( 14 | size: Size.square(0), 15 | ); 16 | 17 | String get widgetName => ""; 18 | } 19 | -------------------------------------------------------------------------------- /lib/widget/widget_builders/components_builders.dart: -------------------------------------------------------------------------------- 1 | import 'dart:convert'; 2 | 3 | /// 4 | ///Author: YoungChan 5 | ///Date: 2020-03-18 12:22:42 6 | ///LastEditors: YoungChan 7 | ///LastEditTime: 2020-04-22 18:55:51 8 | ///Description: file content 9 | /// 10 | import 'dart:io'; 11 | import '../argument_parser/argument_parser.dart'; 12 | import 'package:flutter/material.dart'; 13 | import 'package:dynamicflutter/ast_node.dart'; 14 | import 'widget_builder_factory.dart'; 15 | import 'basewidget_builder.dart'; 16 | 17 | ///构造Text,支持以下属性的解析: 18 | ///* text 19 | ///* style 20 | ///* textAlign 21 | ///* textDirection 22 | ///* overflow 23 | ///* maxLines 24 | ///* softWrap 25 | /// 26 | class TextWidgetBuilder implements BaseWidgetBuilder { 27 | TextWidgetBuilder(); 28 | 29 | @override 30 | Widget build(Expression widgetExpression, {Map variables}) { 31 | var argumentList = widgetExpression.asMethodInvocation.argumentList; 32 | String text = ''; 33 | var style; 34 | var textAlign = TextAlign.left; 35 | var textDirection = TextDirection.ltr; 36 | var overflow = TextOverflow.ellipsis; 37 | int maxLines = 1; 38 | bool softWrap = true; 39 | for (var arg in argumentList) { 40 | if (arg.isStringLiteral) { 41 | text = arg.asStringLiteral.value; 42 | } else if (arg.isNamedExpression) { 43 | var expression = arg.asNamedExpression.expression; 44 | switch (arg.asNamedExpression.label) { 45 | case 'style': 46 | style = parseTextStyle(expression); 47 | break; 48 | case 'textAlign': 49 | textAlign = parseTextAlign(expression); 50 | break; 51 | case 'textDirection': 52 | textDirection = parseTextDirection(expression); 53 | break; 54 | case 'textOverflow': 55 | overflow = parseTextOverflow(expression); 56 | break; 57 | case 'maxLines': 58 | maxLines = parseBaseLiteral(expression) ?? 1; 59 | break; 60 | case 'softWrap': 61 | softWrap = parseBaseLiteral(expression) ?? false; 62 | 63 | break; 64 | } 65 | } 66 | } 67 | return Text( 68 | text, 69 | style: style, 70 | textAlign: textAlign, 71 | textDirection: textDirection, 72 | overflow: overflow, 73 | maxLines: maxLines, 74 | softWrap: softWrap, 75 | ); 76 | } 77 | 78 | @override 79 | String get widgetName => 'Text'; 80 | } 81 | 82 | ///构造CircularProgressIndicator,支持以下属性解析: 83 | ///* value 84 | ///* valueColor 85 | ///* strokeWidth 86 | class CircularProgressIndicatorBuilder implements BaseWidgetBuilder { 87 | @override 88 | Widget build(Expression widgetExpression, {Map variables}) { 89 | var argumentList = widgetExpression.asMethodInvocation.argumentList; 90 | var value; 91 | var valueColor = AlwaysStoppedAnimation(Colors.black); 92 | double strokeWidth = 1.5; 93 | for (var arg in argumentList) { 94 | if (arg.isNamedExpression) { 95 | var expression = arg.asNamedExpression.expression; 96 | switch (arg.asNamedExpression.label) { 97 | case 'value': 98 | value = parseBaseLiteral(expression); 99 | break; 100 | case 'valueColor': 101 | valueColor = parseValueColor(expression); 102 | break; 103 | case 'strokeWidth': 104 | strokeWidth = parseBaseLiteral(expression)?.toDouble() ?? 1.5; 105 | break; 106 | } 107 | } 108 | } 109 | return CircularProgressIndicator( 110 | value: value, 111 | valueColor: valueColor, 112 | strokeWidth: strokeWidth, 113 | ); 114 | } 115 | 116 | @override 117 | String get widgetName => 'CircularProgressIndicator'; 118 | } 119 | 120 | ///构造Icon,支持以下属性解析 121 | ///* icon 122 | ///* size 123 | ///* color 124 | class IconBuilder implements BaseWidgetBuilder { 125 | @override 126 | Widget build(Expression widgetExpression, {Map variables}) { 127 | var argumentList = widgetExpression.asMethodInvocation.argumentList; 128 | var icon = Icons.face; 129 | double size = 25; 130 | var color = Colors.black; 131 | for (var arg in argumentList) { 132 | if (arg.isNamedExpression) { 133 | if (arg.asNamedExpression.label == 'size') { 134 | size = 135 | parseBaseLiteral(arg.asNamedExpression.expression)?.toDouble() ?? 136 | 25.0; 137 | } else if (arg.asNamedExpression.label == 'color') { 138 | color = parseColor(arg.asNamedExpression.expression); 139 | } 140 | } else { 141 | var argIcon = parseIconData(arg); 142 | if (argIcon != null) { 143 | icon = argIcon; 144 | } 145 | } 146 | } 147 | return Icon( 148 | icon, 149 | size: size.toDouble(), 150 | color: color, 151 | ); 152 | } 153 | 154 | @override 155 | String get widgetName => 'Icon'; 156 | } 157 | 158 | ///构造Image,支持以下构造方法: 159 | ///* asset 160 | ///* file 161 | ///* network 162 | /// 163 | ///支持以下属性解析: 164 | ///* width 165 | ///* height 166 | ///* scale 167 | ///* fit 168 | class ImageBuilder implements BaseWidgetBuilder { 169 | @override 170 | Widget build(Expression widgetExpression, {Map variables}) { 171 | var callee = widgetExpression.asMethodInvocation.callee; 172 | var argumentList = widgetExpression.asMethodInvocation.argumentList; 173 | num width; 174 | num height; 175 | num scale; 176 | var fit = BoxFit.none; 177 | for (var arg in argumentList) { 178 | if (arg.isNamedExpression) { 179 | var expression = arg.asNamedExpression.expression; 180 | switch (arg.asNamedExpression.label) { 181 | case 'width': 182 | width = parseBaseLiteral(expression)?.toDouble() ?? .32; 183 | break; 184 | case 'height': 185 | height = parseBaseLiteral(expression)?.toDouble() ?? .32; 186 | break; 187 | case 'scale': 188 | scale = parseBaseLiteral(expression)?.toDouble() ?? .1; 189 | break; 190 | case 'fit': 191 | fit = parseBoxFit(expression); 192 | break; 193 | } 194 | } 195 | } 196 | if (callee.isMemberExpression) { 197 | switch (callee.asMemberExpression.property) { 198 | case 'asset': 199 | var arg0 = argumentList[0]; 200 | var arg0Value = ''; 201 | if (arg0.isStringLiteral) { 202 | arg0Value = arg0.asStringLiteral.value; 203 | } else if (arg0.isIdentifier) { 204 | arg0Value = variables[arg0.asIdentifier.name] ?? ''; 205 | } 206 | return Image.asset( 207 | arg0Value, 208 | width: width, 209 | height: height, 210 | scale: scale, 211 | fit: fit, 212 | ); 213 | case 'file': 214 | var arg0 = argumentList[0]; 215 | File arg0Value; 216 | 217 | if (arg0.isMethodInvocation) { 218 | arg0Value = parseFileObject(arg0.asMethodInvocation); 219 | } else if (arg0.isIdentifier) { 220 | arg0Value = variables[arg0.asIdentifier.name]; 221 | } 222 | return Image.file( 223 | arg0Value, 224 | width: width, 225 | height: height, 226 | scale: scale, 227 | fit: fit, 228 | ); 229 | case 'network': 230 | var arg0 = argumentList[0]; 231 | var arg0Value = ''; 232 | if (arg0.isStringLiteral) { 233 | arg0Value = arg0.asStringLiteral.value; 234 | } else if (arg0.isIdentifier) { 235 | arg0Value = variables[arg0.asIdentifier.name] ?? ''; 236 | } 237 | return Image.network( 238 | arg0Value, 239 | width: width, 240 | height: height, 241 | scale: scale, 242 | fit: fit, 243 | ); 244 | } 245 | } 246 | return null; 247 | } 248 | 249 | @override 250 | String get widgetName => 'Image'; 251 | } 252 | 253 | ///构造AppBar,支持以下属性解析: 254 | ///* backgroundColor 255 | ///* centerTitle 256 | ///* title 257 | class AppBarBuilder implements BaseWidgetBuilder { 258 | @override 259 | Widget build(Expression widgetExpression, {Map variables}) { 260 | var argumentList = widgetExpression.asMethodInvocation.argumentList; 261 | var color = Colors.white; 262 | var title; 263 | var centerTitle; 264 | for (var arg in argumentList) { 265 | if (arg.isNamedExpression) { 266 | switch (arg.asNamedExpression.label) { 267 | case 'backgroundColor': 268 | color = parseColor(arg.asNamedExpression.expression); 269 | break; 270 | case 'centerTitle': 271 | centerTitle = 272 | parseBaseLiteral(arg.asNamedExpression.expression) ?? true; 273 | break; 274 | case 'title': 275 | title = FHWidgetBuilderFactory.buildWidgetWithExpression( 276 | arg.asNamedExpression.expression); 277 | break; 278 | } 279 | } 280 | } 281 | 282 | return AppBar( 283 | backgroundColor: color, 284 | title: title, 285 | centerTitle: centerTitle, 286 | ); 287 | } 288 | 289 | @override 290 | String get widgetName => 'AppBar'; 291 | } 292 | 293 | class DividerBuilder implements BaseWidgetBuilder { 294 | @override 295 | Widget build(Expression widgetExpression, {Map variables}) { 296 | var argumentList = widgetExpression.asMethodInvocation.argumentList; 297 | double height = 1.0; 298 | var color = Colors.black87; 299 | for (var arg in argumentList) { 300 | if (arg.isNamedExpression) { 301 | if (arg.asNamedExpression.label == 'height') { 302 | height = 303 | parseBaseLiteral(arg.asNamedExpression.expression)?.toDouble() ?? 304 | 1.0; 305 | } else if (arg.asNamedExpression.label == 'color') { 306 | color = parseColor(arg.asNamedExpression.expression); 307 | } 308 | } 309 | } 310 | return Divider( 311 | height: height, 312 | color: color, 313 | ); 314 | } 315 | 316 | @override 317 | String get widgetName => 'Divider'; 318 | } 319 | -------------------------------------------------------------------------------- /lib/widget/widget_builders/layout_builders.dart: -------------------------------------------------------------------------------- 1 | /// 2 | ///Author: YoungChan 3 | ///Date: 2020-03-18 12:22:32 4 | ///LastEditors: YoungChan 5 | ///LastEditTime: 2020-04-22 23:33:00 6 | ///Description: file content 7 | /// 8 | import 'package:flutter/material.dart'; 9 | import 'package:dynamicflutter/ast_node.dart'; 10 | import 'basewidget_builder.dart'; 11 | import 'widget_builder_factory.dart'; 12 | import '../argument_parser/argument_parser.dart'; 13 | 14 | class ScaffoldBuilder implements BaseWidgetBuilder { 15 | @override 16 | Widget build(Expression widgetExpression, {Map variables}) { 17 | var argumentList = widgetExpression.asMethodInvocation.argumentList; 18 | var color = Colors.white; 19 | var appBar; 20 | var body; 21 | var floatingActionButton; 22 | for (var arg in argumentList) { 23 | if (arg.isNamedExpression) { 24 | var expression = arg.asNamedExpression.expression; 25 | switch (arg.asNamedExpression.label) { 26 | case 'backgroundColor': 27 | color = parseColor(expression); 28 | break; 29 | case 'appBar': 30 | appBar = 31 | FHWidgetBuilderFactory.buildWidgetWithExpression(expression); 32 | break; 33 | case 'body': 34 | body = FHWidgetBuilderFactory.buildWidgetWithExpression(expression); 35 | break; 36 | case 'floatingActionButton': 37 | floatingActionButton = 38 | FHWidgetBuilderFactory.buildWidgetWithExpression(expression); 39 | break; 40 | } 41 | } 42 | } 43 | return Scaffold( 44 | backgroundColor: color, 45 | appBar: appBar, 46 | body: body, 47 | floatingActionButton: floatingActionButton, 48 | ); 49 | } 50 | 51 | @override 52 | String get widgetName => 'Scaffold'; 53 | } 54 | 55 | class ContainerBuilder implements BaseWidgetBuilder { 56 | @override 57 | Widget build(Expression widgetExpression, {Map variables}) { 58 | var argumentList = widgetExpression.asMethodInvocation.argumentList; 59 | var color; 60 | double width; 61 | double height; 62 | var alignment = Alignment.center; 63 | var padding = EdgeInsets.zero; 64 | var margin = EdgeInsets.zero; 65 | var constraints; 66 | var decoration; 67 | var foregroundDecoration; 68 | Widget child; 69 | for (var arg in argumentList) { 70 | if (arg.isNamedExpression) { 71 | var expression = arg.asNamedExpression.expression; 72 | switch (arg.asNamedExpression.label) { 73 | case 'color': 74 | color = parseColor(expression); 75 | break; 76 | case 'width': 77 | width = parseBaseLiteral(expression)?.toDouble(); 78 | break; 79 | case 'height': 80 | height = parseBaseLiteral(expression)?.toDouble(); 81 | break; 82 | case 'alignment': 83 | alignment = parseAlignment(expression); 84 | break; 85 | case 'padding': 86 | padding = parseEdgeInsets(expression); 87 | break; 88 | case 'margin': 89 | margin = parseEdgeInsets(expression); 90 | break; 91 | case 'constraints': 92 | constraints = parseBoxConstraints(expression); 93 | break; 94 | case 'decoration': 95 | decoration = parseBoxDecoration(expression); 96 | break; 97 | case 'foregroundDecoration': 98 | foregroundDecoration = parseBoxDecoration(expression); 99 | break; 100 | case 'child': 101 | child = 102 | FHWidgetBuilderFactory.buildWidgetWithExpression(expression); 103 | break; 104 | } 105 | } 106 | } 107 | return Container( 108 | color: color, 109 | width: width, 110 | height: height, 111 | alignment: alignment, 112 | padding: padding, 113 | margin: margin, 114 | constraints: constraints, 115 | decoration: decoration, 116 | foregroundDecoration: foregroundDecoration, 117 | child: child, 118 | ); 119 | } 120 | 121 | @override 122 | String get widgetName => 'Container'; 123 | } 124 | 125 | class ListViewBuilder implements BaseWidgetBuilder { 126 | @override 127 | Widget build(Expression widgetExpression, {Map variables}) { 128 | var callee = widgetExpression.asMethodInvocation.callee; 129 | var argumentList = widgetExpression.asMethodInvocation.argumentList; 130 | 131 | var reverse = false; 132 | double itemExtent; 133 | var padding = EdgeInsets.zero; 134 | var scrollDirection = Axis.vertical; 135 | var shrinkWrap = false; 136 | var itemCount = 0; 137 | Expression itemBuilderExpression; 138 | Expression separatorBuilderExpression; 139 | List children = []; 140 | print("Build listview"); 141 | for (var arg in argumentList) { 142 | if (arg.isNamedExpression) { 143 | var expression = arg.asNamedExpression.expression; 144 | switch (arg.asNamedExpression.label) { 145 | case 'reverse': 146 | reverse = parseBaseLiteral(expression); 147 | break; 148 | case 'itemExtent': 149 | itemExtent = parseBaseLiteral(expression)?.toDouble(); 150 | break; 151 | case 'padding': 152 | padding = parseEdgeInsets(expression); 153 | break; 154 | case 'scrollDirection': 155 | scrollDirection = parseAxis(expression); 156 | break; 157 | case 'shrinkWrap': 158 | shrinkWrap = parseBaseLiteral(expression); 159 | break; 160 | case 'itemCount': 161 | itemCount = parseBaseLiteral(expression); 162 | break; 163 | case 'itemBuilder': 164 | //读取itemBuilder 中返回的widget 165 | print("itemBuild: ${arg.asNamedExpression.expression}"); 166 | itemBuilderExpression = arg.asNamedExpression.expression 167 | .asFunctionExpression.body.body[0].asReturnStatement.argument; 168 | break; 169 | case 'separatorBuilder': 170 | //读取separatorBuilder 中返回的Widget 171 | separatorBuilderExpression = arg.asNamedExpression.expression 172 | .asFunctionExpression.body.body[0].asReturnStatement.argument; 173 | break; 174 | case 'children': 175 | var childrenArgument = 176 | arg.asNamedExpression.expression.asListLiteral; 177 | for (var childExpression in childrenArgument.elements) { 178 | children.add(FHWidgetBuilderFactory.buildWidgetWithExpression( 179 | childExpression)); 180 | } 181 | break; 182 | } 183 | } 184 | } 185 | if (callee.isMemberExpression) { 186 | if (callee.asMemberExpression.property == 'builder') { 187 | return ListView.builder( 188 | itemBuilder: (context, index) { 189 | return FHWidgetBuilderFactory.buildWidgetWithExpression( 190 | itemBuilderExpression); 191 | }, 192 | itemCount: itemCount, 193 | scrollDirection: scrollDirection, 194 | reverse: reverse, 195 | itemExtent: itemExtent, 196 | padding: padding, 197 | shrinkWrap: shrinkWrap, 198 | ); 199 | } else if (callee.asMemberExpression.property == 'separated') { 200 | return ListView.separated( 201 | itemBuilder: (context, index) { 202 | return FHWidgetBuilderFactory.buildWidgetWithExpression( 203 | itemBuilderExpression); 204 | }, 205 | itemCount: itemCount, 206 | scrollDirection: scrollDirection, 207 | reverse: reverse, 208 | separatorBuilder: (context, index) { 209 | return FHWidgetBuilderFactory.buildWidgetWithExpression( 210 | separatorBuilderExpression); 211 | }, 212 | padding: padding, 213 | shrinkWrap: shrinkWrap, 214 | ); 215 | } 216 | } 217 | return ListView( 218 | children: children, 219 | reverse: reverse, 220 | scrollDirection: scrollDirection, 221 | shrinkWrap: shrinkWrap, 222 | padding: padding, 223 | itemExtent: itemExtent, 224 | ); 225 | } 226 | 227 | @override 228 | String get widgetName => 'ListView'; 229 | } 230 | 231 | class RowBuilder implements BaseWidgetBuilder { 232 | @override 233 | Widget build(Expression widgetExpression, {Map variables}) { 234 | var argumentList = widgetExpression.asMethodInvocation.argumentList; 235 | 236 | var mainAlignment = MainAxisAlignment.start; 237 | var mainAxisSize = MainAxisSize.max; 238 | var crossAlignment = CrossAxisAlignment.center; 239 | var textDirection = TextDirection.ltr; 240 | var verticalDirection = VerticalDirection.down; 241 | var children = []; 242 | for (var arg in argumentList) { 243 | if (arg.isNamedExpression) { 244 | var expression = arg.asNamedExpression.expression; 245 | switch (arg.asNamedExpression.label) { 246 | case 'mainAxisAlignment': 247 | mainAlignment = parseMainAxisAlignment(expression); 248 | break; 249 | case 'mainAxisSize': 250 | mainAxisSize = parseMainAxisSize(expression); 251 | break; 252 | case 'CrossAxisAlignment': 253 | crossAlignment = parseCrossAxisAlignment(expression); 254 | break; 255 | case 'textDirection': 256 | textDirection = parseTextDirection(expression); 257 | break; 258 | case 'verticalDirection': 259 | verticalDirection = parseVerticalDirection(expression); 260 | break; 261 | case 'children': 262 | var childrenArgument = expression.asListLiteral; 263 | for (var childExpression in childrenArgument.elements) { 264 | children.add(FHWidgetBuilderFactory.buildWidgetWithExpression( 265 | childExpression)); 266 | } 267 | break; 268 | } 269 | } 270 | } 271 | return Row( 272 | children: children, 273 | mainAxisAlignment: mainAlignment, 274 | mainAxisSize: mainAxisSize, 275 | crossAxisAlignment: crossAlignment, 276 | textDirection: textDirection, 277 | verticalDirection: verticalDirection, 278 | ); 279 | } 280 | 281 | @override 282 | String get widgetName => 'Row'; 283 | } 284 | 285 | class ColumnBuilder implements BaseWidgetBuilder { 286 | @override 287 | Widget build(Expression widgetExpression, {Map variables}) { 288 | var argumentList = widgetExpression.asMethodInvocation.argumentList; 289 | 290 | var mainAlignment = MainAxisAlignment.start; 291 | var mainAxisSize = MainAxisSize.max; 292 | var crossAlignment = CrossAxisAlignment.center; 293 | var textDirection = TextDirection.ltr; 294 | var verticalDirection = VerticalDirection.down; 295 | var children = []; 296 | for (var arg in argumentList) { 297 | if (arg.isNamedExpression) { 298 | var expression = arg.asNamedExpression.expression; 299 | switch (arg.asNamedExpression.label) { 300 | case 'mainAxisAlignment': 301 | mainAlignment = parseMainAxisAlignment(expression); 302 | break; 303 | case 'mainAxisSize': 304 | mainAxisSize = parseMainAxisSize(expression); 305 | break; 306 | case 'CrossAxisAlignment': 307 | crossAlignment = parseCrossAxisAlignment(expression); 308 | break; 309 | case 'textDirection': 310 | textDirection = parseTextDirection(expression); 311 | break; 312 | case 'verticalDirection': 313 | verticalDirection = parseVerticalDirection(expression); 314 | break; 315 | case 'children': 316 | var childrenArgument = expression.asListLiteral; 317 | for (var childExpression in childrenArgument.elements) { 318 | children.add(FHWidgetBuilderFactory.buildWidgetWithExpression( 319 | childExpression)); 320 | } 321 | break; 322 | } 323 | } 324 | } 325 | 326 | return Column( 327 | children: children, 328 | mainAxisAlignment: mainAlignment, 329 | mainAxisSize: mainAxisSize, 330 | crossAxisAlignment: crossAlignment, 331 | textDirection: textDirection, 332 | verticalDirection: verticalDirection, 333 | ); 334 | } 335 | 336 | @override 337 | String get widgetName => 'Column'; 338 | } 339 | -------------------------------------------------------------------------------- /lib/widget/widget_builders/recommand_builder_box.dart: -------------------------------------------------------------------------------- 1 | /// 2 | ///Author: YoungChan 3 | ///Date: 2020-03-19 11:22:10 4 | ///LastEditors: YoungChan 5 | ///LastEditTime: 2020-04-22 23:26:43 6 | ///Description: file content 7 | /// 8 | import 'package:flutter/material.dart'; 9 | import 'package:dynamicflutter/ast_node.dart'; 10 | import 'basewidget_builder.dart'; 11 | import 'basebuilder_box.dart'; 12 | import 'components_builders.dart'; 13 | import 'layout_builders.dart'; 14 | 15 | class RecommandBuilderBox implements BaseBuilderBox { 16 | List _widgetBuilders = [ 17 | TextWidgetBuilder(), 18 | CircularProgressIndicatorBuilder(), 19 | IconBuilder(), 20 | ImageBuilder(), 21 | AppBarBuilder(), 22 | ContainerBuilder(), 23 | ScaffoldBuilder(), 24 | DividerBuilder(), 25 | ListViewBuilder(), 26 | RowBuilder(), 27 | ColumnBuilder(), 28 | ]; 29 | 30 | @override 31 | Widget build(Expression widgetExpression, {Map variables}) { 32 | if (widgetExpression != null && widgetExpression.isMethodInvocation) { 33 | var callee = widgetExpression.asMethodInvocation.callee; 34 | if (callee.isIdentifier) { 35 | for (var builder in _widgetBuilders) { 36 | if (builder.widgetName == callee.asIdentifier.name) { 37 | return builder?.build(widgetExpression, variables: variables); 38 | } 39 | } 40 | } else if (callee.isMemberExpression) { 41 | for (var builder in _widgetBuilders) { 42 | if (builder.widgetName == 43 | callee.asMemberExpression.object.asIdentifier.name) { 44 | return builder?.build(widgetExpression, variables: variables); 45 | } 46 | } 47 | } 48 | } 49 | return null; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /lib/widget/widget_builders/widget_builder_factory.dart: -------------------------------------------------------------------------------- 1 | /// 2 | ///Author: YoungChan 3 | ///Date: 2020-03-18 14:50:56 4 | ///LastEditors: YoungChan 5 | ///LastEditTime: 2020-04-22 15:06:38 6 | ///Description: Widget 构建类 7 | /// 8 | import 'package:flutter/material.dart'; 9 | import 'recommand_builder_box.dart'; 10 | import 'basebuilder_box.dart'; 11 | import 'package:dynamicflutter/ast_node.dart'; 12 | 13 | class FHWidgetBuilderFactory { 14 | static List _builderBox = [RecommandBuilderBox()]; 15 | 16 | ///设置自定义扩展Widget 构建器 17 | static void setExtendBuilderBox(BaseBuilderBox builderBox) { 18 | if (_builderBox.length == 2) { 19 | _builderBox.removeLast(); 20 | } 21 | _builderBox.add(builderBox); 22 | } 23 | 24 | static Widget buildWidget(Map widgetAst, {Map variables}) { 25 | return buildWidgetWithExpression(Expression.fromAst(widgetAst), 26 | variables: variables); 27 | } 28 | 29 | static Widget buildWidgetWithExpression(Expression widgetExpression, 30 | {Map variables}) { 31 | if (widgetExpression != null) { 32 | //从builder box 中查找匹配的widget builder, 优先顺序 ExtendBuilderBox > RecommandBuilderBox 33 | for (var i = _builderBox.length; i > 0; i--) { 34 | var w = 35 | _builderBox[i - 1].build(widgetExpression, variables: variables); 36 | if (w != null) { 37 | return w; 38 | } 39 | } 40 | } 41 | 42 | return Container(); 43 | } 44 | } 45 | 46 | Widget invokeWidgetBuilderFunction(Expression widgetExpression) { 47 | return null; 48 | } 49 | -------------------------------------------------------------------------------- /lib/widget/widget_builders/widget_builders.dart: -------------------------------------------------------------------------------- 1 | /// 2 | ///Author: YoungChan 3 | ///Date: 2020-03-12 17:19:35 4 | ///LastEditors: YoungChan 5 | ///LastEditTime: 2020-04-17 12:03:25 6 | ///Description: file content 7 | /// 8 | 9 | export 'basewidget_builder.dart'; 10 | export 'basebuilder_box.dart'; 11 | export 'widget_builder_factory.dart'; 12 | -------------------------------------------------------------------------------- /pubspec.lock: -------------------------------------------------------------------------------- 1 | # Generated by pub 2 | # See https://dart.dev/tools/pub/glossary#lockfile 3 | packages: 4 | _fe_analyzer_shared: 5 | dependency: transitive 6 | description: 7 | name: _fe_analyzer_shared 8 | url: "https://pub.flutter-io.cn" 9 | source: hosted 10 | version: "1.0.1" 11 | analyzer: 12 | dependency: "direct main" 13 | description: 14 | name: analyzer 15 | url: "https://pub.flutter-io.cn" 16 | source: hosted 17 | version: "0.39.2+1" 18 | args: 19 | dependency: "direct main" 20 | description: 21 | name: args 22 | url: "https://pub.flutter-io.cn" 23 | source: hosted 24 | version: "1.6.0" 25 | async: 26 | dependency: transitive 27 | description: 28 | name: async 29 | url: "https://pub.flutter-io.cn" 30 | source: hosted 31 | version: "2.3.0" 32 | boolean_selector: 33 | dependency: transitive 34 | description: 35 | name: boolean_selector 36 | url: "https://pub.flutter-io.cn" 37 | source: hosted 38 | version: "1.0.5" 39 | build: 40 | dependency: transitive 41 | description: 42 | name: build 43 | url: "https://pub.flutter-io.cn" 44 | source: hosted 45 | version: "1.2.2" 46 | charcode: 47 | dependency: transitive 48 | description: 49 | name: charcode 50 | url: "https://pub.flutter-io.cn" 51 | source: hosted 52 | version: "1.1.2" 53 | collection: 54 | dependency: transitive 55 | description: 56 | name: collection 57 | url: "https://pub.flutter-io.cn" 58 | source: hosted 59 | version: "1.14.11" 60 | connectivity: 61 | dependency: "direct main" 62 | description: 63 | name: connectivity 64 | url: "https://pub.flutter-io.cn" 65 | source: hosted 66 | version: "0.4.6" 67 | convert: 68 | dependency: transitive 69 | description: 70 | name: convert 71 | url: "https://pub.flutter-io.cn" 72 | source: hosted 73 | version: "2.1.1" 74 | crypto: 75 | dependency: transitive 76 | description: 77 | name: crypto 78 | url: "https://pub.flutter-io.cn" 79 | source: hosted 80 | version: "2.1.4" 81 | csslib: 82 | dependency: transitive 83 | description: 84 | name: csslib 85 | url: "https://pub.flutter-io.cn" 86 | source: hosted 87 | version: "0.16.1" 88 | dart_style: 89 | dependency: transitive 90 | description: 91 | name: dart_style 92 | url: "https://pub.flutter-io.cn" 93 | source: hosted 94 | version: "1.3.3" 95 | flutter: 96 | dependency: "direct main" 97 | description: flutter 98 | source: sdk 99 | version: "0.0.0" 100 | flutter_test: 101 | dependency: "direct dev" 102 | description: flutter 103 | source: sdk 104 | version: "0.0.0" 105 | glob: 106 | dependency: transitive 107 | description: 108 | name: glob 109 | url: "https://pub.flutter-io.cn" 110 | source: hosted 111 | version: "1.2.0" 112 | html: 113 | dependency: transitive 114 | description: 115 | name: html 116 | url: "https://pub.flutter-io.cn" 117 | source: hosted 118 | version: "0.14.0+3" 119 | js: 120 | dependency: transitive 121 | description: 122 | name: js 123 | url: "https://pub.flutter-io.cn" 124 | source: hosted 125 | version: "0.6.1+1" 126 | logging: 127 | dependency: transitive 128 | description: 129 | name: logging 130 | url: "https://pub.flutter-io.cn" 131 | source: hosted 132 | version: "0.11.4" 133 | matcher: 134 | dependency: transitive 135 | description: 136 | name: matcher 137 | url: "https://pub.flutter-io.cn" 138 | source: hosted 139 | version: "0.12.5" 140 | meta: 141 | dependency: transitive 142 | description: 143 | name: meta 144 | url: "https://pub.flutter-io.cn" 145 | source: hosted 146 | version: "1.1.7" 147 | node_interop: 148 | dependency: transitive 149 | description: 150 | name: node_interop 151 | url: "https://pub.flutter-io.cn" 152 | source: hosted 153 | version: "1.0.3" 154 | node_io: 155 | dependency: transitive 156 | description: 157 | name: node_io 158 | url: "https://pub.flutter-io.cn" 159 | source: hosted 160 | version: "1.0.1+2" 161 | package_config: 162 | dependency: transitive 163 | description: 164 | name: package_config 165 | url: "https://pub.flutter-io.cn" 166 | source: hosted 167 | version: "1.1.0" 168 | path: 169 | dependency: transitive 170 | description: 171 | name: path 172 | url: "https://pub.flutter-io.cn" 173 | source: hosted 174 | version: "1.6.4" 175 | pedantic: 176 | dependency: transitive 177 | description: 178 | name: pedantic 179 | url: "https://pub.flutter-io.cn" 180 | source: hosted 181 | version: "1.8.0+1" 182 | pub_semver: 183 | dependency: transitive 184 | description: 185 | name: pub_semver 186 | url: "https://pub.flutter-io.cn" 187 | source: hosted 188 | version: "1.4.4" 189 | quiver: 190 | dependency: transitive 191 | description: 192 | name: quiver 193 | url: "https://pub.flutter-io.cn" 194 | source: hosted 195 | version: "2.0.5" 196 | shared_preferences: 197 | dependency: "direct main" 198 | description: 199 | name: shared_preferences 200 | url: "https://pub.flutter-io.cn" 201 | source: hosted 202 | version: "0.5.4" 203 | sky_engine: 204 | dependency: transitive 205 | description: flutter 206 | source: sdk 207 | version: "0.0.99" 208 | source_gen: 209 | dependency: "direct dev" 210 | description: 211 | name: source_gen 212 | url: "https://pub.flutter-io.cn" 213 | source: hosted 214 | version: "0.9.5" 215 | source_span: 216 | dependency: transitive 217 | description: 218 | name: source_span 219 | url: "https://pub.flutter-io.cn" 220 | source: hosted 221 | version: "1.5.5" 222 | sqflite: 223 | dependency: "direct main" 224 | description: 225 | name: sqflite 226 | url: "https://pub.flutter-io.cn" 227 | source: hosted 228 | version: "1.1.8" 229 | stack_trace: 230 | dependency: transitive 231 | description: 232 | name: stack_trace 233 | url: "https://pub.flutter-io.cn" 234 | source: hosted 235 | version: "1.9.3" 236 | stream_channel: 237 | dependency: transitive 238 | description: 239 | name: stream_channel 240 | url: "https://pub.flutter-io.cn" 241 | source: hosted 242 | version: "2.0.0" 243 | string_scanner: 244 | dependency: transitive 245 | description: 246 | name: string_scanner 247 | url: "https://pub.flutter-io.cn" 248 | source: hosted 249 | version: "1.0.5" 250 | synchronized: 251 | dependency: transitive 252 | description: 253 | name: synchronized 254 | url: "https://pub.flutter-io.cn" 255 | source: hosted 256 | version: "2.1.1" 257 | term_glyph: 258 | dependency: transitive 259 | description: 260 | name: term_glyph 261 | url: "https://pub.flutter-io.cn" 262 | source: hosted 263 | version: "1.1.0" 264 | test_api: 265 | dependency: transitive 266 | description: 267 | name: test_api 268 | url: "https://pub.flutter-io.cn" 269 | source: hosted 270 | version: "0.2.5" 271 | typed_data: 272 | dependency: transitive 273 | description: 274 | name: typed_data 275 | url: "https://pub.flutter-io.cn" 276 | source: hosted 277 | version: "1.1.6" 278 | vector_math: 279 | dependency: transitive 280 | description: 281 | name: vector_math 282 | url: "https://pub.flutter-io.cn" 283 | source: hosted 284 | version: "2.0.8" 285 | watcher: 286 | dependency: transitive 287 | description: 288 | name: watcher 289 | url: "https://pub.flutter-io.cn" 290 | source: hosted 291 | version: "0.9.7+14" 292 | yaml: 293 | dependency: "direct main" 294 | description: 295 | name: yaml 296 | url: "https://pub.flutter-io.cn" 297 | source: hosted 298 | version: "2.2.0" 299 | sdks: 300 | dart: ">=2.5.0 <3.0.0" 301 | flutter: ">=1.9.1 <2.0.0" 302 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: dynamicflutter 2 | description: Flutter 动态化热更新的思考与实践. 3 | version: 0.0.1 4 | author: NewcoreMobile 5 | homepage: https://c2.xinheyun.com 6 | 7 | environment: 8 | sdk: ">=2.2.2 <3.0.0" 9 | 10 | dependencies: 11 | flutter: 12 | sdk: flutter 13 | 14 | args: ^1.5.0 15 | analyzer: ^0.39.2+1 16 | yaml: 17 | # dio: ^3.0.9 18 | sqflite: ^1.1.8 19 | shared_preferences: 0.5.4 20 | connectivity: <=0.4.6 21 | dev_dependencies: 22 | flutter_test: 23 | sdk: flutter 24 | source_gen: 25 | 26 | # For information on the generic Dart part of this file, see the 27 | # following page: https://dart.dev/tools/pub/pubspec 28 | 29 | # The following section is specific to Flutter. 30 | flutter: 31 | # To add assets to your package, add an assets section, like this: 32 | # assets: 33 | # - assets/ast_records_data.json 34 | # - images/a_dot_burr.jpeg 35 | # - images/a_dot_ham.jpeg 36 | # 37 | # For details regarding assets in packages, see 38 | # https://flutter.dev/assets-and-images/#from-packages 39 | # 40 | # An image asset can refer to one or more resolution-specific "variants", see 41 | # https://flutter.dev/assets-and-images/#resolution-aware. 42 | # To add custom fonts to your package, add a fonts section here, 43 | # in this "flutter" section. Each entry in this list should have a 44 | # "family" key with the font family name, and a "fonts" key with a 45 | # list giving the asset and other descriptors for the font. For 46 | # example: 47 | # fonts: 48 | # - family: Schyler 49 | # fonts: 50 | # - asset: fonts/Schyler-Regular.ttf 51 | # - asset: fonts/Schyler-Italic.ttf 52 | # style: italic 53 | # - family: Trajan Pro 54 | # fonts: 55 | # - asset: fonts/TrajanPro.ttf 56 | # - asset: fonts/TrajanPro_Bold.ttf 57 | # weight: 700 58 | # 59 | # For details regarding fonts in packages, see 60 | # https://flutter.dev/custom-fonts/#from-packages 61 | --------------------------------------------------------------------------------