diff --git a/cookiecutter.json b/cookiecutter.json index e147a53..c629ec8 100644 --- a/cookiecutter.json +++ b/cookiecutter.json @@ -7,6 +7,7 @@ "org_name": "com.flet", "company_name": "Your Company", "copyright": "Copyright (c) 2023 Your Company", + "flutter": null, "sep": "/", "kotlin_dir": "{{ cookiecutter.org_name.replace('.', cookiecutter.sep) }}{{ cookiecutter.sep }}{{ cookiecutter.project_name }}{{ cookiecutter.sep }}", "hide_loading_animation": true, diff --git a/{{cookiecutter.out_dir}}/lib/main.dart b/{{cookiecutter.out_dir}}/lib/main.dart index cf61a02..21095ce 100644 --- a/{{cookiecutter.out_dir}}/lib/main.dart +++ b/{{cookiecutter.out_dir}}/lib/main.dart @@ -9,6 +9,10 @@ import 'package:path/path.dart' as path; import 'package:serious_python/serious_python.dart'; import 'package:url_strategy/url_strategy.dart'; +{% for dep in cookiecutter.flutter.dependencies %} +import 'package:{{ dep }}/{{ dep }}.dart' as {{ dep }}; +{% endfor %} + const bool isProduction = bool.fromEnvironment('dart.vm.product'); const assetPath = "app/app.zip"; @@ -19,6 +23,12 @@ final hideLoadingPage = const outLogFilename = "out.log"; const errorExitCode = 100; +var createControlFactories = [ +{% for dep in cookiecutter.flutter.dependencies %} +{{ dep }}.createControl, +{% endfor %} +]; + const pythonScript = """ import certifi, os, runpy, socket, sys, traceback @@ -79,6 +89,10 @@ void main() async { debugPrint = (String? message, {int? wrapWidth}) => null; } + {% for dep in cookiecutter.flutter.dependencies %} + {{ dep }}.ensureInitialized(); + {% endfor %} + runApp(FutureBuilder( future: prepareApp(), builder: (BuildContext context, AsyncSnapshot snapshot) { diff --git a/{{cookiecutter.out_dir}}/pubspec.yaml b/{{cookiecutter.out_dir}}/pubspec.yaml index 95094c7..6e8deab 100644 --- a/{{cookiecutter.out_dir}}/pubspec.yaml +++ b/{{cookiecutter.out_dir}}/pubspec.yaml @@ -18,7 +18,7 @@ dependencies: # path: src/serious_python # ref: 'd059aef' - flet: ^0.19.0 + flet: ^0.20.0 # flet: # git: # url: https://github.com/flet-dev/flet.git diff --git a/{{cookiecutter.out_dir}}/web/python-worker.js b/{{cookiecutter.out_dir}}/web/python-worker.js index 130690b..7e4e4eb 100644 --- a/{{cookiecutter.out_dir}}/web/python-worker.js +++ b/{{cookiecutter.out_dir}}/web/python-worker.js @@ -1,4 +1,4 @@ -importScripts("https://cdn.jsdelivr.net/pyodide/v0.24.1/full/pyodide.js"); +importScripts("https://cdn.jsdelivr.net/pyodide/v0.25.0/full/pyodide.js"); self.pythonModuleName = null; self.initialized = false;