Showing
22 changed files
with
179 additions
and
551 deletions
| @@ -28,7 +28,7 @@ packages: | @@ -28,7 +28,7 @@ packages: | ||
| 28 | name: async | 28 | name: async | 
| 29 | url: "https://pub.dartlang.org" | 29 | url: "https://pub.dartlang.org" | 
| 30 | source: hosted | 30 | source: hosted | 
| 31 | - version: "2.4.2" | 31 | + version: "2.5.0-nullsafety" | 
| 32 | bloc: | 32 | bloc: | 
| 33 | dependency: "direct main" | 33 | dependency: "direct main" | 
| 34 | description: | 34 | description: | 
| @@ -42,7 +42,7 @@ packages: | @@ -42,7 +42,7 @@ packages: | ||
| 42 | name: boolean_selector | 42 | name: boolean_selector | 
| 43 | url: "https://pub.dartlang.org" | 43 | url: "https://pub.dartlang.org" | 
| 44 | source: hosted | 44 | source: hosted | 
| 45 | - version: "2.0.0" | 45 | + version: "2.1.0-nullsafety" | 
| 46 | build: | 46 | build: | 
| 47 | dependency: transitive | 47 | dependency: transitive | 
| 48 | description: | 48 | description: | 
| @@ -105,14 +105,14 @@ packages: | @@ -105,14 +105,14 @@ packages: | ||
| 105 | name: characters | 105 | name: characters | 
| 106 | url: "https://pub.dartlang.org" | 106 | url: "https://pub.dartlang.org" | 
| 107 | source: hosted | 107 | source: hosted | 
| 108 | - version: "1.1.0-nullsafety" | 108 | + version: "1.1.0-nullsafety.2" | 
| 109 | charcode: | 109 | charcode: | 
| 110 | dependency: transitive | 110 | dependency: transitive | 
| 111 | description: | 111 | description: | 
| 112 | name: charcode | 112 | name: charcode | 
| 113 | url: "https://pub.dartlang.org" | 113 | url: "https://pub.dartlang.org" | 
| 114 | source: hosted | 114 | source: hosted | 
| 115 | - version: "1.1.3" | 115 | + version: "1.2.0-nullsafety" | 
| 116 | checked_yaml: | 116 | checked_yaml: | 
| 117 | dependency: transitive | 117 | dependency: transitive | 
| 118 | description: | 118 | description: | 
| @@ -126,7 +126,7 @@ packages: | @@ -126,7 +126,7 @@ packages: | ||
| 126 | name: clock | 126 | name: clock | 
| 127 | url: "https://pub.dartlang.org" | 127 | url: "https://pub.dartlang.org" | 
| 128 | source: hosted | 128 | source: hosted | 
| 129 | - version: "1.0.1" | 129 | + version: "1.1.0-nullsafety" | 
| 130 | code_builder: | 130 | code_builder: | 
| 131 | dependency: transitive | 131 | dependency: transitive | 
| 132 | description: | 132 | description: | 
| @@ -140,7 +140,7 @@ packages: | @@ -140,7 +140,7 @@ packages: | ||
| 140 | name: collection | 140 | name: collection | 
| 141 | url: "https://pub.dartlang.org" | 141 | url: "https://pub.dartlang.org" | 
| 142 | source: hosted | 142 | source: hosted | 
| 143 | - version: "1.15.0-nullsafety" | 143 | + version: "1.15.0-nullsafety.2" | 
| 144 | convert: | 144 | convert: | 
| 145 | dependency: transitive | 145 | dependency: transitive | 
| 146 | description: | 146 | description: | 
| @@ -189,7 +189,7 @@ packages: | @@ -189,7 +189,7 @@ packages: | ||
| 189 | name: fake_async | 189 | name: fake_async | 
| 190 | url: "https://pub.dartlang.org" | 190 | url: "https://pub.dartlang.org" | 
| 191 | source: hosted | 191 | source: hosted | 
| 192 | - version: "1.1.0" | 192 | + version: "1.1.0-nullsafety" | 
| 193 | fixnum: | 193 | fixnum: | 
| 194 | dependency: transitive | 194 | dependency: transitive | 
| 195 | description: | 195 | description: | 
| @@ -304,14 +304,14 @@ packages: | @@ -304,14 +304,14 @@ packages: | ||
| 304 | name: matcher | 304 | name: matcher | 
| 305 | url: "https://pub.dartlang.org" | 305 | url: "https://pub.dartlang.org" | 
| 306 | source: hosted | 306 | source: hosted | 
| 307 | - version: "0.12.8" | 307 | + version: "0.12.10-nullsafety" | 
| 308 | meta: | 308 | meta: | 
| 309 | dependency: "direct main" | 309 | dependency: "direct main" | 
| 310 | description: | 310 | description: | 
| 311 | name: meta | 311 | name: meta | 
| 312 | url: "https://pub.dartlang.org" | 312 | url: "https://pub.dartlang.org" | 
| 313 | source: hosted | 313 | source: hosted | 
| 314 | - version: "1.3.0-nullsafety" | 314 | + version: "1.3.0-nullsafety.2" | 
| 315 | mime: | 315 | mime: | 
| 316 | dependency: transitive | 316 | dependency: transitive | 
| 317 | description: | 317 | description: | 
| @@ -367,7 +367,7 @@ packages: | @@ -367,7 +367,7 @@ packages: | ||
| 367 | name: path | 367 | name: path | 
| 368 | url: "https://pub.dartlang.org" | 368 | url: "https://pub.dartlang.org" | 
| 369 | source: hosted | 369 | source: hosted | 
| 370 | - version: "1.7.0" | 370 | + version: "1.8.0-nullsafety" | 
| 371 | pedantic: | 371 | pedantic: | 
| 372 | dependency: transitive | 372 | dependency: transitive | 
| 373 | description: | 373 | description: | 
| @@ -456,21 +456,21 @@ packages: | @@ -456,21 +456,21 @@ packages: | ||
| 456 | name: source_span | 456 | name: source_span | 
| 457 | url: "https://pub.dartlang.org" | 457 | url: "https://pub.dartlang.org" | 
| 458 | source: hosted | 458 | source: hosted | 
| 459 | - version: "1.7.0" | 459 | + version: "1.8.0-nullsafety" | 
| 460 | stack_trace: | 460 | stack_trace: | 
| 461 | dependency: transitive | 461 | dependency: transitive | 
| 462 | description: | 462 | description: | 
| 463 | name: stack_trace | 463 | name: stack_trace | 
| 464 | url: "https://pub.dartlang.org" | 464 | url: "https://pub.dartlang.org" | 
| 465 | source: hosted | 465 | source: hosted | 
| 466 | - version: "1.9.5" | 466 | + version: "1.10.0-nullsafety" | 
| 467 | stream_channel: | 467 | stream_channel: | 
| 468 | dependency: transitive | 468 | dependency: transitive | 
| 469 | description: | 469 | description: | 
| 470 | name: stream_channel | 470 | name: stream_channel | 
| 471 | url: "https://pub.dartlang.org" | 471 | url: "https://pub.dartlang.org" | 
| 472 | source: hosted | 472 | source: hosted | 
| 473 | - version: "2.0.0" | 473 | + version: "2.1.0-nullsafety" | 
| 474 | stream_transform: | 474 | stream_transform: | 
| 475 | dependency: transitive | 475 | dependency: transitive | 
| 476 | description: | 476 | description: | 
| @@ -484,21 +484,21 @@ packages: | @@ -484,21 +484,21 @@ packages: | ||
| 484 | name: string_scanner | 484 | name: string_scanner | 
| 485 | url: "https://pub.dartlang.org" | 485 | url: "https://pub.dartlang.org" | 
| 486 | source: hosted | 486 | source: hosted | 
| 487 | - version: "1.0.5" | 487 | + version: "1.1.0-nullsafety" | 
| 488 | term_glyph: | 488 | term_glyph: | 
| 489 | dependency: transitive | 489 | dependency: transitive | 
| 490 | description: | 490 | description: | 
| 491 | name: term_glyph | 491 | name: term_glyph | 
| 492 | url: "https://pub.dartlang.org" | 492 | url: "https://pub.dartlang.org" | 
| 493 | source: hosted | 493 | source: hosted | 
| 494 | - version: "1.1.0" | 494 | + version: "1.2.0-nullsafety" | 
| 495 | test_api: | 495 | test_api: | 
| 496 | dependency: transitive | 496 | dependency: transitive | 
| 497 | description: | 497 | description: | 
| 498 | name: test_api | 498 | name: test_api | 
| 499 | url: "https://pub.dartlang.org" | 499 | url: "https://pub.dartlang.org" | 
| 500 | source: hosted | 500 | source: hosted | 
| 501 | - version: "0.2.17" | 501 | + version: "0.2.19-nullsafety" | 
| 502 | timing: | 502 | timing: | 
| 503 | dependency: transitive | 503 | dependency: transitive | 
| 504 | description: | 504 | description: | 
| @@ -512,7 +512,7 @@ packages: | @@ -512,7 +512,7 @@ packages: | ||
| 512 | name: typed_data | 512 | name: typed_data | 
| 513 | url: "https://pub.dartlang.org" | 513 | url: "https://pub.dartlang.org" | 
| 514 | source: hosted | 514 | source: hosted | 
| 515 | - version: "1.3.0-nullsafety" | 515 | + version: "1.3.0-nullsafety.2" | 
| 516 | uuid: | 516 | uuid: | 
| 517 | dependency: "direct main" | 517 | dependency: "direct main" | 
| 518 | description: | 518 | description: | 
| @@ -526,7 +526,7 @@ packages: | @@ -526,7 +526,7 @@ packages: | ||
| 526 | name: vector_math | 526 | name: vector_math | 
| 527 | url: "https://pub.dartlang.org" | 527 | url: "https://pub.dartlang.org" | 
| 528 | source: hosted | 528 | source: hosted | 
| 529 | - version: "2.1.0-nullsafety" | 529 | + version: "2.1.0-nullsafety.2" | 
| 530 | watcher: | 530 | watcher: | 
| 531 | dependency: transitive | 531 | dependency: transitive | 
| 532 | description: | 532 | description: | 
| @@ -549,5 +549,5 @@ packages: | @@ -549,5 +549,5 @@ packages: | ||
| 549 | source: hosted | 549 | source: hosted | 
| 550 | version: "2.2.1" | 550 | version: "2.2.1" | 
| 551 | sdks: | 551 | sdks: | 
| 552 | - dart: ">=2.9.0-18.0 <2.9.0" | 552 | + dart: ">=2.10.0-0.0.dev <2.10.0" | 
| 553 | flutter: ">=1.16.0" | 553 | flutter: ">=1.16.0" | 
example/.gitignore
0 → 100644
| 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 | +**/ios/Flutter/.last_build_id | ||
| 26 | +.dart_tool/ | ||
| 27 | +.flutter-plugins | ||
| 28 | +.flutter-plugins-dependencies | ||
| 29 | +.packages | ||
| 30 | +.pub-cache/ | ||
| 31 | +.pub/ | ||
| 32 | +/build/ | ||
| 33 | + | ||
| 34 | +# Web related | ||
| 35 | +lib/generated_plugin_registrant.dart | ||
| 36 | + | ||
| 37 | +# Symbolication related | ||
| 38 | +app.*.symbols | ||
| 39 | + | ||
| 40 | +# Obfuscation related | ||
| 41 | +app.*.map.json | 
example/.metadata
0 → 100644
| 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: 7c6f9dd2396dfe7deb6fd11edc12c10786490083 | ||
| 8 | + channel: dev | ||
| 9 | + | ||
| 10 | +project_type: app | 
example/README.md
0 → 100644
| 1 | +# example | ||
| 2 | + | ||
| 3 | +A new Flutter project. | ||
| 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. | 
example/android/gradlew
100644 → 100755
example/linux/Makefile
deleted
100644 → 0
| 1 | -include app_configuration.mk | ||
| 2 | - | ||
| 3 | -# Default build type. | ||
| 4 | -BUILD=debug | ||
| 5 | - | ||
| 6 | -FLUTTER_MANAGED_DIR=flutter | ||
| 7 | -FLUTTER_EPHEMERAL_DIR=$(FLUTTER_MANAGED_DIR)/ephemeral | ||
| 8 | - | ||
| 9 | -# Configuration provided via flutter tool. | ||
| 10 | -FLUTTER_CONFIG_FILE=$(FLUTTER_EPHEMERAL_DIR)/generated_config.mk | ||
| 11 | -include $(FLUTTER_CONFIG_FILE) | ||
| 12 | - | ||
| 13 | -# Dependency locations | ||
| 14 | -FLUTTER_APP_DIR=$(CURDIR)/.. | ||
| 15 | -FLUTTER_APP_BUILD_DIR=$(FLUTTER_APP_DIR)/build | ||
| 16 | - | ||
| 17 | -OUT_DIR=$(FLUTTER_APP_BUILD_DIR)/linux | ||
| 18 | -OBJ_DIR=$(OUT_DIR)/obj/$(BUILD) | ||
| 19 | - | ||
| 20 | -# Libraries | ||
| 21 | -FLUTTER_LIB_NAME=flutter_linux_glfw | ||
| 22 | -FLUTTER_LIB=$(FLUTTER_EPHEMERAL_DIR)/lib$(FLUTTER_LIB_NAME).so | ||
| 23 | - | ||
| 24 | -# Tools | ||
| 25 | -FLUTTER_BIN=$(FLUTTER_ROOT)/bin/flutter | ||
| 26 | -LINUX_BUILD=$(FLUTTER_ROOT)/packages/flutter_tools/bin/tool_backend.sh | ||
| 27 | - | ||
| 28 | -# Resources | ||
| 29 | -ICU_DATA_NAME=icudtl.dat | ||
| 30 | -ICU_DATA_SOURCE=$(FLUTTER_EPHEMERAL_DIR)/$(ICU_DATA_NAME) | ||
| 31 | -FLUTTER_ASSETS_NAME=flutter_assets | ||
| 32 | -FLUTTER_ASSETS_SOURCE=$(FLUTTER_APP_BUILD_DIR)/$(FLUTTER_ASSETS_NAME) | ||
| 33 | - | ||
| 34 | -# Bundle structure | ||
| 35 | -BUNDLE_OUT_DIR=$(OUT_DIR)/$(BUILD) | ||
| 36 | -BUNDLE_DATA_DIR=$(BUNDLE_OUT_DIR)/data | ||
| 37 | -BUNDLE_LIB_DIR=$(BUNDLE_OUT_DIR)/lib | ||
| 38 | - | ||
| 39 | -BIN_OUT=$(BUNDLE_OUT_DIR)/$(BINARY_NAME) | ||
| 40 | -ICU_DATA_OUT=$(BUNDLE_DATA_DIR)/$(ICU_DATA_NAME) | ||
| 41 | -FLUTTER_LIB_OUT=$(BUNDLE_LIB_DIR)/$(notdir $(FLUTTER_LIB)) | ||
| 42 | -ALL_LIBS_OUT=$(FLUTTER_LIB_OUT) \ | ||
| 43 | - $(foreach lib,$(EXTRA_BUNDLED_LIBRARIES),$(BUNDLE_LIB_DIR)/$(notdir $(lib))) | ||
| 44 | - | ||
| 45 | -# Add relevant code from the wrapper library, which is intended to be statically | ||
| 46 | -# built into the client. | ||
| 47 | -# Use abspath for the wrapper root, which can contain relative paths; the | ||
| 48 | -# intermediate build files will be based on the source path, which will cause | ||
| 49 | -# issues if they start with one or more '../'s. | ||
| 50 | -WRAPPER_ROOT=$(abspath $(FLUTTER_EPHEMERAL_DIR)/cpp_client_wrapper_glfw) | ||
| 51 | -WRAPPER_SOURCES= \ | ||
| 52 | - $(WRAPPER_ROOT)/flutter_window_controller.cc \ | ||
| 53 | - $(WRAPPER_ROOT)/plugin_registrar.cc \ | ||
| 54 | - $(WRAPPER_ROOT)/engine_method_result.cc | ||
| 55 | - | ||
| 56 | -# Use abspath for extra sources, which may also contain relative paths (see | ||
| 57 | -# note above about WRAPPER_ROOT). | ||
| 58 | -SOURCES=main.cc window_configuration.cc \ | ||
| 59 | - flutter/generated_plugin_registrant.cc \ | ||
| 60 | - $(WRAPPER_SOURCES) $(abspath $(EXTRA_SOURCES)) | ||
| 61 | - | ||
| 62 | -# Headers | ||
| 63 | -WRAPPER_INCLUDE_DIR=$(WRAPPER_ROOT)/include | ||
| 64 | -INCLUDE_DIRS=$(FLUTTER_EPHEMERAL_DIR) $(WRAPPER_INCLUDE_DIR) | ||
| 65 | - | ||
| 66 | -# Build settings | ||
| 67 | -ifneq ($(strip $(SYSTEM_LIBRARIES)),) | ||
| 68 | -EXTRA_CPPFLAGS+=$(patsubst -I%,-isystem%,$(shell pkg-config --cflags $(SYSTEM_LIBRARIES))) | ||
| 69 | -EXTRA_LDFLAGS+=$(shell pkg-config --libs $(SYSTEM_LIBRARIES)) | ||
| 70 | -endif | ||
| 71 | -CXX=clang++ | ||
| 72 | -CPPFLAGS.release=-DNDEBUG | ||
| 73 | -CPPFLAGS.profile=$(CPPFLAGS.release) | ||
| 74 | -CXXFLAGS.release=-O2 | ||
| 75 | -CXXFLAGS.profile=$(CXXFLAGS.release) | ||
| 76 | -CXXFLAGS=-std=c++14 -Wall -Werror $(CXXFLAGS.$(BUILD)) $(EXTRA_CXXFLAGS) | ||
| 77 | -CPPFLAGS=$(patsubst %,-I%,$(INCLUDE_DIRS)) \ | ||
| 78 | - $(CPPFLAGS.$(BUILD)) $(EXTRA_CPPFLAGS) | ||
| 79 | -LDFLAGS=-L$(BUNDLE_LIB_DIR) \ | ||
| 80 | - -l$(FLUTTER_LIB_NAME) \ | ||
| 81 | - $(EXTRA_LDFLAGS) \ | ||
| 82 | - -Wl,-rpath=\$$ORIGIN/lib | ||
| 83 | - | ||
| 84 | -# Intermediate files. | ||
| 85 | -OBJ_FILES=$(SOURCES:%.cc=$(OBJ_DIR)/%.o) | ||
| 86 | -DEPENDENCY_FILES=$(OBJ_FILES:%.o=%.d) | ||
| 87 | - | ||
| 88 | -# Targets | ||
| 89 | - | ||
| 90 | -.PHONY: all | ||
| 91 | -all: $(BIN_OUT) bundle | ||
| 92 | - | ||
| 93 | -# Add the plugin targets, and their associated settings. | ||
| 94 | -include $(FLUTTER_MANAGED_DIR)/generated_plugins.mk | ||
| 95 | -EXTRA_BUNDLED_LIBRARIES+=$(PLUGIN_LIBRARIES) | ||
| 96 | -EXTRA_LDFLAGS+=$(PLUGIN_LDFLAGS) | ||
| 97 | -EXTRA_CPPFLAGS+=$(PLUGIN_CPPFLAGS) | ||
| 98 | - | ||
| 99 | -# This is a phony target because the flutter tool cannot describe | ||
| 100 | -# its inputs and outputs yet. | ||
| 101 | -.PHONY: sync | ||
| 102 | -sync: $(FLUTTER_CONFIG_FILE) | ||
| 103 | - $(LINUX_BUILD) linux-x64 $(BUILD) | ||
| 104 | - | ||
| 105 | -.PHONY: bundle | ||
| 106 | -bundle: $(ICU_DATA_OUT) $(ALL_LIBS_OUT) bundleflutterassets | ||
| 107 | - | ||
| 108 | -$(BIN_OUT): $(OBJ_FILES) $(ALL_LIBS_OUT) | ||
| 109 | - mkdir -p $(@D) | ||
| 110 | - $(CXX) $(CXXFLAGS) $(CPPFLAGS) $(OBJ_FILES) $(LDFLAGS) -o $@ | ||
| 111 | - | ||
| 112 | -$(WRAPPER_SOURCES) $(FLUTTER_LIB) $(ICU_DATA_SOURCE) $(FLUTTER_ASSETS_SOURCE) \ | ||
| 113 | - $(PLUGIN_TARGETS): | sync | ||
| 114 | - | ||
| 115 | -# Plugin library bundling pattern. | ||
| 116 | -$(BUNDLE_LIB_DIR)/%: $(OUT_DIR)/% | ||
| 117 | - mkdir -p $(BUNDLE_LIB_DIR) | ||
| 118 | - cp $< $@ | ||
| 119 | - | ||
| 120 | -$(FLUTTER_LIB_OUT): $(FLUTTER_LIB) | ||
| 121 | - mkdir -p $(@D) | ||
| 122 | - cp $< $@ | ||
| 123 | - | ||
| 124 | -$(ICU_DATA_OUT): $(ICU_DATA_SOURCE) | ||
| 125 | - mkdir -p $(@D) | ||
| 126 | - cp $< $@ | ||
| 127 | - | ||
| 128 | --include $(DEPENDENCY_FILES) | ||
| 129 | - | ||
| 130 | -$(OBJ_DIR)/%.o : %.cc | sync | ||
| 131 | - mkdir -p $(@D) | ||
| 132 | - $(CXX) $(CXXFLAGS) $(CPPFLAGS) -MMD -c $< -o $@ | ||
| 133 | - | ||
| 134 | -# Fully re-copy the assets directory on each build to avoid having to keep a | ||
| 135 | -# comprehensive list of all asset files here, which would be fragile to changes | ||
| 136 | -# in other files (e.g., adding a new font to pubspec.yaml). | ||
| 137 | -.PHONY: bundleflutterassets | ||
| 138 | -bundleflutterassets: $(FLUTTER_ASSETS_SOURCE) | ||
| 139 | - mkdir -p $(BUNDLE_DATA_DIR) | ||
| 140 | - rsync -rpu --delete $(FLUTTER_ASSETS_SOURCE) $(BUNDLE_DATA_DIR) | ||
| 141 | - | ||
| 142 | -.PHONY: clean | ||
| 143 | -clean: | ||
| 144 | - rm -rf $(OUT_DIR); \ | ||
| 145 | - cd $(FLUTTER_APP_DIR); \ | ||
| 146 | - $(FLUTTER_BIN) clean | 
example/linux/app_configuration.mk
deleted
100644 → 0
| 1 | -# This file contains variables that applications are likely to need to | ||
| 2 | -# change, to isolate them from the main Makefile where the build rules are still | ||
| 3 | -# in flux. This should simplify re-creating the runner while preserving local | ||
| 4 | -# changes. | ||
| 5 | - | ||
| 6 | -# Executable name. | ||
| 7 | -BINARY_NAME=get_state | ||
| 8 | -# Any extra source files to build. | ||
| 9 | -EXTRA_SOURCES= | ||
| 10 | -# Paths of any additional libraries to be bundled in the output directory. | ||
| 11 | -EXTRA_BUNDLED_LIBRARIES= | ||
| 12 | -# Extra flags (e.g., for library dependencies). | ||
| 13 | -SYSTEM_LIBRARIES= | ||
| 14 | -EXTRA_CXXFLAGS= | ||
| 15 | -EXTRA_CPPFLAGS= | ||
| 16 | -EXTRA_LDFLAGS= | 
| 1 | -// | ||
| 2 | -// Generated file. Do not edit. | ||
| 3 | -// | ||
| 4 | - | ||
| 5 | -#ifndef GENERATED_PLUGIN_REGISTRANT_ | ||
| 6 | -#define GENERATED_PLUGIN_REGISTRANT_ | ||
| 7 | - | ||
| 8 | -#include <flutter_linux/flutter_linux.h> | ||
| 9 | - | ||
| 10 | -// Registers Flutter plugins. | ||
| 11 | -void fl_register_plugins(FlPluginRegistry* registry); | ||
| 12 | - | ||
| 13 | -#endif // GENERATED_PLUGIN_REGISTRANT_ | 
| 1 | -# | ||
| 2 | -# Generated file, do not edit. | ||
| 3 | -# | ||
| 4 | - | ||
| 5 | -list(APPEND FLUTTER_PLUGIN_LIST | ||
| 6 | -) | ||
| 7 | - | ||
| 8 | -set(PLUGIN_BUNDLED_LIBRARIES) | ||
| 9 | - | ||
| 10 | -foreach(plugin ${FLUTTER_PLUGIN_LIST}) | ||
| 11 | - add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/linux plugins/${plugin}) | ||
| 12 | - target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) | ||
| 13 | - list(APPEND PLUGIN_BUNDLED_LIBRARIES $<TARGET_FILE:${plugin}_plugin>) | ||
| 14 | - list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) | ||
| 15 | -endforeach(plugin) | 
| 1 | -# Plugins to include in the build. | ||
| 2 | -GENERATED_PLUGINS=\ | ||
| 3 | - | ||
| 4 | -GENERATED_PLUGINS_DIR=flutter/ephemeral/.plugin_symlinks | ||
| 5 | -# A plugin library name plugin name with _plugin appended. | ||
| 6 | -GENERATED_PLUGIN_LIB_NAMES=$(foreach plugin,$(GENERATED_PLUGINS),$(plugin)_plugin) | ||
| 7 | - | ||
| 8 | -# Variables for use in the enclosing Makefile. Changes to these names are | ||
| 9 | -# breaking changes. | ||
| 10 | -PLUGIN_TARGETS=$(GENERATED_PLUGINS) | ||
| 11 | -PLUGIN_LIBRARIES=$(foreach plugin,$(GENERATED_PLUGIN_LIB_NAMES),\ | ||
| 12 | - $(OUT_DIR)/lib$(plugin).so) | ||
| 13 | -PLUGIN_LDFLAGS=$(patsubst %,-l%,$(GENERATED_PLUGIN_LIB_NAMES)) | ||
| 14 | -PLUGIN_CPPFLAGS=$(foreach plugin,$(GENERATED_PLUGINS),\ | ||
| 15 | - -I$(GENERATED_PLUGINS_DIR)/$(plugin)/linux) | ||
| 16 | - | ||
| 17 | -# Targets | ||
| 18 | - | ||
| 19 | -# Implicit rules don't match phony targets, so list plugin builds explicitly. | ||
| 20 | - | ||
| 21 | -.PHONY: $(GENERATED_PLUGINS) | ||
| 22 | -$(GENERATED_PLUGINS): | ||
| 23 | - make -C $(GENERATED_PLUGINS_DIR)/$@/linux \ | ||
| 24 | - OUT_DIR=$(OUT_DIR) \ | ||
| 25 | - FLUTTER_EPHEMERAL_DIR="$(abspath flutter/ephemeral)" | 
example/linux/main.cc
deleted
100644 → 0
| 1 | -#include <flutter/flutter_window_controller.h> | ||
| 2 | -#include <linux/limits.h> | ||
| 3 | -#include <unistd.h> | ||
| 4 | - | ||
| 5 | -#include <cstdlib> | ||
| 6 | -#include <iostream> | ||
| 7 | -#include <memory> | ||
| 8 | -#include <vector> | ||
| 9 | - | ||
| 10 | -#include "flutter/generated_plugin_registrant.h" | ||
| 11 | -#include "window_configuration.h" | ||
| 12 | - | ||
| 13 | -namespace { | ||
| 14 | - | ||
| 15 | -// Returns the path of the directory containing this executable, or an empty | ||
| 16 | -// string if the directory cannot be found. | ||
| 17 | -std::string GetExecutableDirectory() { | ||
| 18 | - char buffer[PATH_MAX + 1]; | ||
| 19 | - ssize_t length = readlink("/proc/self/exe", buffer, sizeof(buffer)); | ||
| 20 | - if (length > PATH_MAX) { | ||
| 21 | - std::cerr << "Couldn't locate executable" << std::endl; | ||
| 22 | - return ""; | ||
| 23 | - } | ||
| 24 | - std::string executable_path(buffer, length); | ||
| 25 | - size_t last_separator_position = executable_path.find_last_of('/'); | ||
| 26 | - if (last_separator_position == std::string::npos) { | ||
| 27 | - std::cerr << "Unabled to find parent directory of " << executable_path | ||
| 28 | - << std::endl; | ||
| 29 | - return ""; | ||
| 30 | - } | ||
| 31 | - return executable_path.substr(0, last_separator_position); | ||
| 32 | -} | ||
| 33 | - | ||
| 34 | -} // namespace | ||
| 35 | - | ||
| 36 | -int main(int argc, char **argv) { | ||
| 37 | - // Resources are located relative to the executable. | ||
| 38 | - std::string base_directory = GetExecutableDirectory(); | ||
| 39 | - if (base_directory.empty()) { | ||
| 40 | - base_directory = "."; | ||
| 41 | - } | ||
| 42 | - std::string data_directory = base_directory + "/data"; | ||
| 43 | - std::string assets_path = data_directory + "/flutter_assets"; | ||
| 44 | - std::string icu_data_path = data_directory + "/icudtl.dat"; | ||
| 45 | - | ||
| 46 | - // Arguments for the Flutter Engine. | ||
| 47 | - std::vector<std::string> arguments; | ||
| 48 | - | ||
| 49 | - flutter::FlutterWindowController flutter_controller(icu_data_path); | ||
| 50 | - flutter::WindowProperties window_properties = {}; | ||
| 51 | - window_properties.title = kFlutterWindowTitle; | ||
| 52 | - window_properties.width = kFlutterWindowWidth; | ||
| 53 | - window_properties.height = kFlutterWindowHeight; | ||
| 54 | - | ||
| 55 | - // Start the engine. | ||
| 56 | - if (!flutter_controller.CreateWindow(window_properties, assets_path, | ||
| 57 | - arguments)) { | ||
| 58 | - return EXIT_FAILURE; | ||
| 59 | - } | ||
| 60 | - RegisterPlugins(&flutter_controller); | ||
| 61 | - | ||
| 62 | - // Run until the window is closed. | ||
| 63 | - while (flutter_controller.RunEventLoopWithTimeout( | ||
| 64 | - std::chrono::milliseconds::max())) { | ||
| 65 | - } | ||
| 66 | - return EXIT_SUCCESS; | ||
| 67 | -} | 
example/linux/window_configuration.h
deleted
100644 → 0
| 1 | -#ifndef WINDOW_CONFIGURATION_ | ||
| 2 | -#define WINDOW_CONFIGURATION_ | ||
| 3 | - | ||
| 4 | -// This is a temporary approach to isolate common customizations from main.cpp, | ||
| 5 | -// where the APIs are still in flux. This should simplify re-creating the | ||
| 6 | -// runner while preserving local changes. | ||
| 7 | -// | ||
| 8 | -// Longer term there should be simpler configuration options for common | ||
| 9 | -// customizations like this, without requiring native code changes. | ||
| 10 | - | ||
| 11 | -extern const char *kFlutterWindowTitle; | ||
| 12 | -extern const unsigned int kFlutterWindowWidth; | ||
| 13 | -extern const unsigned int kFlutterWindowHeight; | ||
| 14 | - | ||
| 15 | -#endif // WINDOW_CONFIGURATION_ | 
| @@ -7,42 +7,42 @@ packages: | @@ -7,42 +7,42 @@ packages: | ||
| 7 | name: async | 7 | name: async | 
| 8 | url: "https://pub.dartlang.org" | 8 | url: "https://pub.dartlang.org" | 
| 9 | source: hosted | 9 | source: hosted | 
| 10 | - version: "2.4.2" | 10 | + version: "2.5.0-nullsafety" | 
| 11 | boolean_selector: | 11 | boolean_selector: | 
| 12 | dependency: transitive | 12 | dependency: transitive | 
| 13 | description: | 13 | description: | 
| 14 | name: boolean_selector | 14 | name: boolean_selector | 
| 15 | url: "https://pub.dartlang.org" | 15 | url: "https://pub.dartlang.org" | 
| 16 | source: hosted | 16 | source: hosted | 
| 17 | - version: "2.0.0" | 17 | + version: "2.1.0-nullsafety" | 
| 18 | characters: | 18 | characters: | 
| 19 | dependency: transitive | 19 | dependency: transitive | 
| 20 | description: | 20 | description: | 
| 21 | name: characters | 21 | name: characters | 
| 22 | url: "https://pub.dartlang.org" | 22 | url: "https://pub.dartlang.org" | 
| 23 | source: hosted | 23 | source: hosted | 
| 24 | - version: "1.1.0-nullsafety" | 24 | + version: "1.1.0-nullsafety.2" | 
| 25 | charcode: | 25 | charcode: | 
| 26 | dependency: transitive | 26 | dependency: transitive | 
| 27 | description: | 27 | description: | 
| 28 | name: charcode | 28 | name: charcode | 
| 29 | url: "https://pub.dartlang.org" | 29 | url: "https://pub.dartlang.org" | 
| 30 | source: hosted | 30 | source: hosted | 
| 31 | - version: "1.1.3" | 31 | + version: "1.2.0-nullsafety" | 
| 32 | clock: | 32 | clock: | 
| 33 | dependency: transitive | 33 | dependency: transitive | 
| 34 | description: | 34 | description: | 
| 35 | name: clock | 35 | name: clock | 
| 36 | url: "https://pub.dartlang.org" | 36 | url: "https://pub.dartlang.org" | 
| 37 | source: hosted | 37 | source: hosted | 
| 38 | - version: "1.0.1" | 38 | + version: "1.1.0-nullsafety" | 
| 39 | collection: | 39 | collection: | 
| 40 | dependency: transitive | 40 | dependency: transitive | 
| 41 | description: | 41 | description: | 
| 42 | name: collection | 42 | name: collection | 
| 43 | url: "https://pub.dartlang.org" | 43 | url: "https://pub.dartlang.org" | 
| 44 | source: hosted | 44 | source: hosted | 
| 45 | - version: "1.15.0-nullsafety" | 45 | + version: "1.15.0-nullsafety.2" | 
| 46 | dio: | 46 | dio: | 
| 47 | dependency: "direct main" | 47 | dependency: "direct main" | 
| 48 | description: | 48 | description: | 
| @@ -56,7 +56,7 @@ packages: | @@ -56,7 +56,7 @@ packages: | ||
| 56 | name: fake_async | 56 | name: fake_async | 
| 57 | url: "https://pub.dartlang.org" | 57 | url: "https://pub.dartlang.org" | 
| 58 | source: hosted | 58 | source: hosted | 
| 59 | - version: "1.1.0" | 59 | + version: "1.1.0-nullsafety" | 
| 60 | flutter: | 60 | flutter: | 
| 61 | dependency: "direct main" | 61 | dependency: "direct main" | 
| 62 | description: flutter | 62 | description: flutter | 
| @@ -70,10 +70,10 @@ packages: | @@ -70,10 +70,10 @@ packages: | ||
| 70 | get: | 70 | get: | 
| 71 | dependency: "direct main" | 71 | dependency: "direct main" | 
| 72 | description: | 72 | description: | 
| 73 | - name: get | ||
| 74 | - url: "https://pub.dartlang.org" | ||
| 75 | - source: hosted | ||
| 76 | - version: "3.4.3" | 73 | + path: ".." | 
| 74 | + relative: true | ||
| 75 | + source: path | ||
| 76 | + version: "3.4.6" | ||
| 77 | http_parser: | 77 | http_parser: | 
| 78 | dependency: transitive | 78 | dependency: transitive | 
| 79 | description: | 79 | description: | 
| @@ -87,21 +87,21 @@ packages: | @@ -87,21 +87,21 @@ packages: | ||
| 87 | name: matcher | 87 | name: matcher | 
| 88 | url: "https://pub.dartlang.org" | 88 | url: "https://pub.dartlang.org" | 
| 89 | source: hosted | 89 | source: hosted | 
| 90 | - version: "0.12.8" | 90 | + version: "0.12.10-nullsafety" | 
| 91 | meta: | 91 | meta: | 
| 92 | dependency: transitive | 92 | dependency: transitive | 
| 93 | description: | 93 | description: | 
| 94 | name: meta | 94 | name: meta | 
| 95 | url: "https://pub.dartlang.org" | 95 | url: "https://pub.dartlang.org" | 
| 96 | source: hosted | 96 | source: hosted | 
| 97 | - version: "1.3.0-nullsafety" | 97 | + version: "1.3.0-nullsafety.2" | 
| 98 | path: | 98 | path: | 
| 99 | dependency: transitive | 99 | dependency: transitive | 
| 100 | description: | 100 | description: | 
| 101 | name: path | 101 | name: path | 
| 102 | url: "https://pub.dartlang.org" | 102 | url: "https://pub.dartlang.org" | 
| 103 | source: hosted | 103 | source: hosted | 
| 104 | - version: "1.7.0" | 104 | + version: "1.8.0-nullsafety" | 
| 105 | sky_engine: | 105 | sky_engine: | 
| 106 | dependency: transitive | 106 | dependency: transitive | 
| 107 | description: flutter | 107 | description: flutter | 
| @@ -113,55 +113,55 @@ packages: | @@ -113,55 +113,55 @@ packages: | ||
| 113 | name: source_span | 113 | name: source_span | 
| 114 | url: "https://pub.dartlang.org" | 114 | url: "https://pub.dartlang.org" | 
| 115 | source: hosted | 115 | source: hosted | 
| 116 | - version: "1.7.0" | 116 | + version: "1.8.0-nullsafety" | 
| 117 | stack_trace: | 117 | stack_trace: | 
| 118 | dependency: transitive | 118 | dependency: transitive | 
| 119 | description: | 119 | description: | 
| 120 | name: stack_trace | 120 | name: stack_trace | 
| 121 | url: "https://pub.dartlang.org" | 121 | url: "https://pub.dartlang.org" | 
| 122 | source: hosted | 122 | source: hosted | 
| 123 | - version: "1.9.5" | 123 | + version: "1.10.0-nullsafety" | 
| 124 | stream_channel: | 124 | stream_channel: | 
| 125 | dependency: transitive | 125 | dependency: transitive | 
| 126 | description: | 126 | description: | 
| 127 | name: stream_channel | 127 | name: stream_channel | 
| 128 | url: "https://pub.dartlang.org" | 128 | url: "https://pub.dartlang.org" | 
| 129 | source: hosted | 129 | source: hosted | 
| 130 | - version: "2.0.0" | 130 | + version: "2.1.0-nullsafety" | 
| 131 | string_scanner: | 131 | string_scanner: | 
| 132 | dependency: transitive | 132 | dependency: transitive | 
| 133 | description: | 133 | description: | 
| 134 | name: string_scanner | 134 | name: string_scanner | 
| 135 | url: "https://pub.dartlang.org" | 135 | url: "https://pub.dartlang.org" | 
| 136 | source: hosted | 136 | source: hosted | 
| 137 | - version: "1.0.5" | 137 | + version: "1.1.0-nullsafety" | 
| 138 | term_glyph: | 138 | term_glyph: | 
| 139 | dependency: transitive | 139 | dependency: transitive | 
| 140 | description: | 140 | description: | 
| 141 | name: term_glyph | 141 | name: term_glyph | 
| 142 | url: "https://pub.dartlang.org" | 142 | url: "https://pub.dartlang.org" | 
| 143 | source: hosted | 143 | source: hosted | 
| 144 | - version: "1.1.0" | 144 | + version: "1.2.0-nullsafety" | 
| 145 | test_api: | 145 | test_api: | 
| 146 | dependency: transitive | 146 | dependency: transitive | 
| 147 | description: | 147 | description: | 
| 148 | name: test_api | 148 | name: test_api | 
| 149 | url: "https://pub.dartlang.org" | 149 | url: "https://pub.dartlang.org" | 
| 150 | source: hosted | 150 | source: hosted | 
| 151 | - version: "0.2.17" | 151 | + version: "0.2.19-nullsafety" | 
| 152 | typed_data: | 152 | typed_data: | 
| 153 | dependency: transitive | 153 | dependency: transitive | 
| 154 | description: | 154 | description: | 
| 155 | name: typed_data | 155 | name: typed_data | 
| 156 | url: "https://pub.dartlang.org" | 156 | url: "https://pub.dartlang.org" | 
| 157 | source: hosted | 157 | source: hosted | 
| 158 | - version: "1.3.0-nullsafety" | 158 | + version: "1.3.0-nullsafety.2" | 
| 159 | vector_math: | 159 | vector_math: | 
| 160 | dependency: transitive | 160 | dependency: transitive | 
| 161 | description: | 161 | description: | 
| 162 | name: vector_math | 162 | name: vector_math | 
| 163 | url: "https://pub.dartlang.org" | 163 | url: "https://pub.dartlang.org" | 
| 164 | source: hosted | 164 | source: hosted | 
| 165 | - version: "2.1.0-nullsafety" | 165 | + version: "2.1.0-nullsafety.2" | 
| 166 | sdks: | 166 | sdks: | 
| 167 | - dart: ">=2.9.0-18.0 <2.9.0" | 167 | + dart: ">=2.10.0-0.0.dev <2.10.0" | 
| 1 | -export 'routes/custom_transition.dart'; | ||
| 2 | -export 'routes/transitions_type.dart'; | ||
| 3 | -export 'routes/get_route.dart'; | ||
| 4 | -export 'routes/default_route.dart'; | ||
| 5 | -export 'routes/observers/route_observer.dart'; | ||
| 6 | -export 'root/root_widget.dart'; | ||
| 7 | -export 'snackbar/snack_route.dart'; | ||
| 8 | -export 'bottomsheet/bottomsheet.dart'; | ||
| 9 | -export 'snackbar/snack.dart'; | ||
| 10 | -export '../core/get_main.dart'; | ||
| 11 | -export 'routes/default_route.dart'; | ||
| 12 | -export 'root/smart_management.dart'; | ||
| 13 | -export 'extension_navigation.dart'; | 
| @@ -3,9 +3,14 @@ import 'package:flutter/widgets.dart'; | @@ -3,9 +3,14 @@ import 'package:flutter/widgets.dart'; | ||
| 3 | import 'package:get/src/instance/get_instance.dart'; | 3 | import 'package:get/src/instance/get_instance.dart'; | 
| 4 | import 'package:get/src/navigation/root/smart_management.dart'; | 4 | import 'package:get/src/navigation/root/smart_management.dart'; | 
| 5 | import 'package:get/src/state_manager/rx/rx_interface.dart'; | 5 | import 'package:get/src/state_manager/rx/rx_interface.dart'; | 
| 6 | +import 'package:get/state_manager.dart'; | ||
| 7 | + | ||
| 8 | +import 'simple_builder.dart'; | ||
| 6 | 9 | ||
| 7 | typedef Disposer = void Function(); | 10 | typedef Disposer = void Function(); | 
| 8 | 11 | ||
| 12 | + | ||
| 13 | + | ||
| 9 | class GetxController extends DisposableInterface { | 14 | class GetxController extends DisposableInterface { | 
| 10 | final HashSet<StateSetter> _updaters = HashSet<StateSetter>(); | 15 | final HashSet<StateSetter> _updaters = HashSet<StateSetter>(); | 
| 11 | 16 | ||
| @@ -48,121 +53,6 @@ class GetxController extends DisposableInterface { | @@ -48,121 +53,6 @@ class GetxController extends DisposableInterface { | ||
| 48 | void onClose() async {} | 53 | void onClose() async {} | 
| 49 | } | 54 | } | 
| 50 | 55 | ||
| 51 | -// class GetBuilder<T extends GetxController> extends StatefulWidget { | ||
| 52 | -// final Widget Function(T) builder; | ||
| 53 | -// final bool global; | ||
| 54 | -// final String id; | ||
| 55 | -// final String tag; | ||
| 56 | -// final bool autoRemove; | ||
| 57 | -// final bool assignId; | ||
| 58 | -// final void Function(State state) initState, dispose, didChangeDependencies; | ||
| 59 | -// final void Function(GetBuilder oldWidget, State state) didUpdateWidget; | ||
| 60 | -// final T init; | ||
| 61 | -// const GetBuilder({ | ||
| 62 | -// Key key, | ||
| 63 | -// this.init, | ||
| 64 | -// this.global = true, | ||
| 65 | -// @required this.builder, | ||
| 66 | -// this.autoRemove = true, | ||
| 67 | -// this.assignId = false, | ||
| 68 | -// this.initState, | ||
| 69 | -// this.tag, | ||
| 70 | -// this.dispose, | ||
| 71 | -// this.id, | ||
| 72 | -// this.didChangeDependencies, | ||
| 73 | -// this.didUpdateWidget, | ||
| 74 | -// }) : assert(builder != null), | ||
| 75 | -// super(key: key); | ||
| 76 | -// @override | ||
| 77 | -// _GetBuilderState<T> createState() => _GetBuilderState<T>(); | ||
| 78 | -// } | ||
| 79 | - | ||
| 80 | -// class _GetBuilderState<T extends GetxController> extends State<GetBuilder<T>> { | ||
| 81 | -// GetxController controller; | ||
| 82 | -// bool isCreator = false; | ||
| 83 | -// @override | ||
| 84 | -// void initState() { | ||
| 85 | -// super.initState(); | ||
| 86 | - | ||
| 87 | -// if (widget.initState != null) widget.initState(this); | ||
| 88 | -// if (widget.global) { | ||
| 89 | -// final isPrepared = GetInstance().isPrepared<T>(tag: widget.tag); | ||
| 90 | -// final isRegistred = GetInstance().isRegistred<T>(tag: widget.tag); | ||
| 91 | - | ||
| 92 | -// if (isPrepared) { | ||
| 93 | -// if (GetConfig.smartManagement != SmartManagement.keepFactory) { | ||
| 94 | -// isCreator = true; | ||
| 95 | -// } | ||
| 96 | -// controller = GetInstance().find<T>(tag: widget.tag); | ||
| 97 | -// } else if (isRegistred) { | ||
| 98 | -// controller = GetInstance().find<T>(tag: widget.tag); | ||
| 99 | -// isCreator = false; | ||
| 100 | -// } else { | ||
| 101 | -// controller = widget.init; | ||
| 102 | -// isCreator = true; | ||
| 103 | -// GetInstance().put<T>(controller, tag: widget.tag); | ||
| 104 | -// } | ||
| 105 | -// } else { | ||
| 106 | -// controller = widget.init; | ||
| 107 | -// isCreator = true; | ||
| 108 | -// controller?.onStart(); | ||
| 109 | -// } | ||
| 110 | - | ||
| 111 | -// if (widget.global && | ||
| 112 | -// GetConfig.smartManagement == SmartManagement.onlyBuilder) { | ||
| 113 | -// controller?.onStart(); | ||
| 114 | -// } | ||
| 115 | -// (widget.id == null) | ||
| 116 | -// ? controller.addListener(setState) | ||
| 117 | -// : controller.addListenerId(widget.id, setState); | ||
| 118 | -// } | ||
| 119 | - | ||
| 120 | -// @override | ||
| 121 | -// void dispose() { | ||
| 122 | -// super.dispose(); | ||
| 123 | -// if (widget.dispose != null) widget.dispose(this); | ||
| 124 | -// if (isCreator || widget.assignId) { | ||
| 125 | -// if (widget.autoRemove && GetInstance().isRegistred<T>(tag: widget.tag)) { | ||
| 126 | -// (widget.id == null) | ||
| 127 | -// ? controller.removeListener(setState) | ||
| 128 | -// : controller.removeListenerId(widget.id); | ||
| 129 | -// GetInstance().delete<T>(tag: widget.tag); | ||
| 130 | -// } | ||
| 131 | -// } else { | ||
| 132 | -// (widget.id == null) | ||
| 133 | -// ? controller.removeListener(setState) | ||
| 134 | -// : controller.removeListenerId(widget.id); | ||
| 135 | -// } | ||
| 136 | -// } | ||
| 137 | - | ||
| 138 | -// @override | ||
| 139 | -// void didChangeDependencies() { | ||
| 140 | -// super.didChangeDependencies(); | ||
| 141 | -// if (widget.didChangeDependencies != null) { | ||
| 142 | -// widget.didChangeDependencies(this); | ||
| 143 | -// } | ||
| 144 | -// } | ||
| 145 | - | ||
| 146 | -// @override | ||
| 147 | -// void didUpdateWidget(GetBuilder oldWidget) { | ||
| 148 | -// super.didUpdateWidget(oldWidget as GetBuilder<T>); | ||
| 149 | -// if (widget.didUpdateWidget != null) widget.didUpdateWidget(oldWidget, this); | ||
| 150 | -// } | ||
| 151 | - | ||
| 152 | -// @override | ||
| 153 | -// Widget build(BuildContext context) { | ||
| 154 | -// return widget.builder(controller); | ||
| 155 | -// } | ||
| 156 | -// } | ||
| 157 | - | ||
| 158 | -// class Updater { | ||
| 159 | -// final StateSetter updater; | ||
| 160 | -// final String id; | ||
| 161 | -// const Updater({this.updater, this.id}); | ||
| 162 | -// } | ||
| 163 | - | ||
| 164 | -// typedef UpdaterBuilder = Updater Function(); | ||
| 165 | - | ||
| 166 | class GetBuilder<T extends GetxController> extends StatefulWidget { | 56 | class GetBuilder<T extends GetxController> extends StatefulWidget { | 
| 167 | final Widget Function(T) builder; | 57 | final Widget Function(T) builder; | 
| 168 | final bool global; | 58 | final bool global; | 
| @@ -268,73 +158,23 @@ class _GetBuilderState<T extends GetxController> extends State<GetBuilder<T>> { | @@ -268,73 +158,23 @@ class _GetBuilderState<T extends GetxController> extends State<GetBuilder<T>> { | ||
| 268 | if (widget.didUpdateWidget != null) widget.didUpdateWidget(oldWidget, this); | 158 | if (widget.didUpdateWidget != null) widget.didUpdateWidget(oldWidget, this); | 
| 269 | } | 159 | } | 
| 270 | 160 | ||
| 271 | - Widget get notifyChildren { | ||
| 272 | - final old = Value._remove; | ||
| 273 | - Value._remove = disposers; | ||
| 274 | - final observer = Value._setter; | ||
| 275 | - Value._setter = setState; | ||
| 276 | - final result = widget.builder(controller); | ||
| 277 | - Value._setter = observer; | ||
| 278 | - Value._remove = old; | ||
| 279 | - return result; | ||
| 280 | - } | ||
| 281 | - | ||
| 282 | @override | 161 | @override | 
| 283 | - Widget build(BuildContext context) => notifyChildren; | 162 | + Widget build(BuildContext context) => widget.builder(controller); | 
| 284 | } | 163 | } | 
| 285 | 164 | ||
| 165 | +/// This is a experimental feature | ||
| 286 | class Value<T> extends GetxController { | 166 | class Value<T> extends GetxController { | 
| 287 | Value([this._value]); | 167 | Value([this._value]); | 
| 288 | T _value; | 168 | T _value; | 
| 289 | 169 | ||
| 290 | T get value { | 170 | T get value { | 
| 291 | - if (_setter != null) { | ||
| 292 | - if (!_updaters.contains(_setter)) { | ||
| 293 | - final add = addListener(_setter); | ||
| 294 | - _remove.add(add); | ||
| 295 | - } | ||
| 296 | - } | 171 | + TaskManager.instance.notify(_updaters); | 
| 297 | return _value; | 172 | return _value; | 
| 298 | } | 173 | } | 
| 299 | 174 | ||
| 300 | - static StateSetter _setter; | ||
| 301 | - | ||
| 302 | - static HashSet<Disposer> _remove; | ||
| 303 | - | ||
| 304 | set value(T newValue) { | 175 | set value(T newValue) { | 
| 305 | if (_value == newValue) return; | 176 | if (_value == newValue) return; | 
| 306 | _value = newValue; | 177 | _value = newValue; | 
| 307 | update(); | 178 | update(); | 
| 308 | } | 179 | } | 
| 309 | } | 180 | } | 
| 310 | - | ||
| 311 | -class SimpleBuilder extends StatefulWidget { | ||
| 312 | - final Widget Function(BuildContext) builder; | ||
| 313 | - const SimpleBuilder({Key key, @required this.builder}) | ||
| 314 | - : assert(builder != null), | ||
| 315 | - super(key: key); | ||
| 316 | - @override | ||
| 317 | - _SimpleBuilderState createState() => _SimpleBuilderState(); | ||
| 318 | -} | ||
| 319 | - | ||
| 320 | -class _SimpleBuilderState extends State<SimpleBuilder> { | ||
| 321 | - final HashSet<Disposer> disposers = HashSet<Disposer>(); | ||
| 322 | - | ||
| 323 | - @override | ||
| 324 | - void dispose() { | ||
| 325 | - super.dispose(); | ||
| 326 | - disposers.forEach((element) => element()); | ||
| 327 | - } | ||
| 328 | - | ||
| 329 | - @override | ||
| 330 | - Widget build(BuildContext context) { | ||
| 331 | - HashSet<Disposer> old = Value._remove; | ||
| 332 | - Value._remove = disposers; | ||
| 333 | - StateSetter observer = Value._setter; | ||
| 334 | - Value._setter = setState; | ||
| 335 | - Widget result = widget.builder(context); | ||
| 336 | - Value._remove = old; | ||
| 337 | - Value._setter = observer; | ||
| 338 | - return result; | ||
| 339 | - } | ||
| 340 | -} | 
| 1 | +import 'dart:collection'; | ||
| 2 | +import 'package:flutter/widgets.dart'; | ||
| 3 | +import 'get_state.dart'; | ||
| 4 | + | ||
| 5 | +// It's a experimental feature | ||
| 6 | +class SimpleBuilder extends StatefulWidget { | ||
| 7 | + final Widget Function(BuildContext) builder; | ||
| 8 | + const SimpleBuilder({Key key, @required this.builder}) | ||
| 9 | + : assert(builder != null), | ||
| 10 | + super(key: key); | ||
| 11 | + @override | ||
| 12 | + _SimpleBuilderState createState() => _SimpleBuilderState(); | ||
| 13 | +} | ||
| 14 | + | ||
| 15 | +class _SimpleBuilderState extends State<SimpleBuilder> { | ||
| 16 | + final HashSet<Disposer> disposers = HashSet<Disposer>(); | ||
| 17 | + | ||
| 18 | + @override | ||
| 19 | + void dispose() { | ||
| 20 | + super.dispose(); | ||
| 21 | + disposers.forEach((element) => element()); | ||
| 22 | + } | ||
| 23 | + | ||
| 24 | + @override | ||
| 25 | + Widget build(BuildContext context) { | ||
| 26 | + return TaskManager.instance | ||
| 27 | + .exchange(disposers, setState, widget.builder, context); | ||
| 28 | + } | ||
| 29 | +} | ||
| 30 | + | ||
| 31 | +class TaskManager { | ||
| 32 | + TaskManager._(); | ||
| 33 | + static TaskManager _instance; | ||
| 34 | + static TaskManager get instance => _instance ??= TaskManager._(); | ||
| 35 | + | ||
| 36 | + StateSetter _setter; | ||
| 37 | + HashSet<Disposer> _remove; | ||
| 38 | + | ||
| 39 | + notify(HashSet<StateSetter> _updaters) { | ||
| 40 | + if (_setter != null) { | ||
| 41 | + if (!_updaters.contains(_setter)) { | ||
| 42 | + _updaters.add(_setter); | ||
| 43 | + _remove.add(() => _updaters.remove(_setter)); | ||
| 44 | + } | ||
| 45 | + } | ||
| 46 | + } | ||
| 47 | + | ||
| 48 | + Widget exchange( | ||
| 49 | + HashSet<Disposer> disposers, | ||
| 50 | + StateSetter setState, | ||
| 51 | + Widget Function(BuildContext) builder, | ||
| 52 | + BuildContext context, | ||
| 53 | + ) { | ||
| 54 | + _remove = disposers; | ||
| 55 | + _setter = setState; | ||
| 56 | + final result = builder(context); | ||
| 57 | + _remove = null; | ||
| 58 | + _setter = null; | ||
| 59 | + return result; | ||
| 60 | + } | ||
| 61 | +} | 
| 1 | -export 'simple/get_state.dart'; | ||
| 2 | -export 'simple/immutable_state.dart'; | ||
| 3 | -export 'simple/get_view.dart'; | ||
| 4 | -export 'simple/mixin_state.dart'; | ||
| 5 | -export 'rx/rx_interface.dart'; | ||
| 6 | -export 'rx/rx_impl.dart'; | ||
| 7 | -export 'rx/rx_event.dart'; | ||
| 8 | -export 'rx/rx_obx.dart'; | ||
| 9 | -export 'rx/rx_getbuilder.dart'; | 
lib/src/utils/utils.dart
deleted
100644 → 0
| 1 | export 'src/state_manager/simple/get_state.dart'; | 1 | export 'src/state_manager/simple/get_state.dart'; | 
| 2 | export 'src/state_manager/simple/immutable_state.dart'; | 2 | export 'src/state_manager/simple/immutable_state.dart'; | 
| 3 | export 'src/state_manager/simple/get_view.dart'; | 3 | export 'src/state_manager/simple/get_view.dart'; | 
| 4 | +export 'src/state_manager/simple/simple_builder.dart'; | ||
| 4 | export 'src/state_manager/simple/mixin_state.dart'; | 5 | export 'src/state_manager/simple/mixin_state.dart'; | 
| 5 | export 'src/state_manager/rx/rx_interface.dart'; | 6 | export 'src/state_manager/rx/rx_interface.dart'; | 
| 6 | export 'src/state_manager/rx/rx_impl.dart'; | 7 | export 'src/state_manager/rx/rx_impl.dart'; | 
- 
Please register or login to post a comment