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}}/android/app/build.gradle b/{{cookiecutter.out_dir}}/android/app/build.gradle index 4a43123..59a566d 100644 --- a/{{cookiecutter.out_dir}}/android/app/build.gradle +++ b/{{cookiecutter.out_dir}}/android/app/build.gradle @@ -41,11 +41,8 @@ android { } defaultConfig { - // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). applicationId "{{ cookiecutter.org_name }}.{{ cookiecutter.project_name }}" - // You can update the following values to match your application needs. - // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration. - minSdkVersion flutter.minSdkVersion + minSdkVersion 23 targetSdkVersion flutter.targetSdkVersion versionCode flutterVersionCode.toInteger() versionName flutterVersionName @@ -57,8 +54,6 @@ android { buildTypes { release { - // TODO: Add your own signing config for the release build. - // Signing with the debug keys for now, so `flutter run --release` works. signingConfig signingConfigs.debug } } @@ -68,4 +63,4 @@ flutter { source '../..' } -dependencies {} +dependencies {} \ No newline at end of file diff --git a/{{cookiecutter.out_dir}}/android/app/src/debug/AndroidManifest.xml b/{{cookiecutter.out_dir}}/android/app/src/debug/AndroidManifest.xml index 399f698..7792018 100644 --- a/{{cookiecutter.out_dir}}/android/app/src/debug/AndroidManifest.xml +++ b/{{cookiecutter.out_dir}}/android/app/src/debug/AndroidManifest.xml @@ -3,5 +3,6 @@ the Flutter tool needs it to communicate with the running application to allow setting breakpoints, to provide hot reload, etc. --> - - + + + \ No newline at end of file diff --git a/{{cookiecutter.out_dir}}/android/app/src/main/AndroidManifest.xml b/{{cookiecutter.out_dir}}/android/app/src/main/AndroidManifest.xml index 2931f64..5913fe4 100644 --- a/{{cookiecutter.out_dir}}/android/app/src/main/AndroidManifest.xml +++ b/{{cookiecutter.out_dir}}/android/app/src/main/AndroidManifest.xml @@ -1,7 +1,8 @@ - + + + android:name="io.flutter.embedding.android.NormalTheme" + android:resource="@style/NormalTheme" + /> - - + + - - + + + \ No newline at end of file diff --git a/{{cookiecutter.out_dir}}/android/build.gradle b/{{cookiecutter.out_dir}}/android/build.gradle index ce647a4..2dcf86f 100644 --- a/{{cookiecutter.out_dir}}/android/build.gradle +++ b/{{cookiecutter.out_dir}}/android/build.gradle @@ -6,7 +6,6 @@ buildscript { } dependencies { - classpath 'com.android.tools.build:gradle:7.4.2' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" } } @@ -28,4 +27,4 @@ subprojects { tasks.register("clean", Delete) { delete rootProject.buildDir -} +} \ No newline at end of file diff --git a/{{cookiecutter.out_dir}}/android/settings.gradle b/{{cookiecutter.out_dir}}/android/settings.gradle index 55c4ca8..45d92d2 100644 --- a/{{cookiecutter.out_dir}}/android/settings.gradle +++ b/{{cookiecutter.out_dir}}/android/settings.gradle @@ -10,11 +10,20 @@ pluginManagement { includeBuild("${settings.ext.flutterSdkPath}/packages/flutter_tools/gradle") + repositories { + google() + mavenCentral() + gradlePluginPortal() + } + plugins { id "dev.flutter.flutter-gradle-plugin" version "1.0.0" apply false } } -include ":app" +plugins { + id "dev.flutter.flutter-plugin-loader" version "1.0.0" + id "com.android.application" version "7.3.0" apply false +} -apply from: "${settings.ext.flutterSdkPath}/packages/flutter_tools/gradle/app_plugin_loader.gradle" +include ":app" \ No newline at end of file diff --git a/{{cookiecutter.out_dir}}/ios/Runner/Info.plist b/{{cookiecutter.out_dir}}/ios/Runner/Info.plist index 6d95a10..ed7b6f8 100644 --- a/{{cookiecutter.out_dir}}/ios/Runner/Info.plist +++ b/{{cookiecutter.out_dir}}/ios/Runner/Info.plist @@ -1,49 +1,56 @@ - - CFBundleDevelopmentRegion - $(DEVELOPMENT_LANGUAGE) - CFBundleDisplayName - {{ cookiecutter.product_name }} - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - {{ cookiecutter.project_name }} - CFBundlePackageType - APPL - CFBundleShortVersionString - $(FLUTTER_BUILD_NAME) - CFBundleSignature - ???? - CFBundleVersion - $(FLUTTER_BUILD_NUMBER) - LSRequiresIPhoneOS - - UILaunchStoryboardName - LaunchScreen - UIMainStoryboardFile - Main - UISupportedInterfaceOrientations - - UIInterfaceOrientationPortrait - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - - UISupportedInterfaceOrientations~ipad - - UIInterfaceOrientationPortrait - UIInterfaceOrientationPortraitUpsideDown - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - - CADisableMinimumFrameDurationOnPhone - - UIApplicationSupportsIndirectInputEvents - - - + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleDisplayName + {{ cookiecutter.product_name }} + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + {{ cookiecutter.project_name }} + CFBundlePackageType + APPL + CFBundleShortVersionString + $(FLUTTER_BUILD_NAME) + CFBundleSignature + ???? + CFBundleVersion + $(FLUTTER_BUILD_NUMBER) + LSRequiresIPhoneOS + + UILaunchStoryboardName + LaunchScreen + UIMainStoryboardFile + Main + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + CADisableMinimumFrameDurationOnPhone + + UIApplicationSupportsIndirectInputEvents + + NSAppTransportSecurity + + NSAllowsArbitraryLoads + + + NSMicrophoneUsageDescription + Audio Recording + + \ No newline at end of file diff --git a/{{cookiecutter.out_dir}}/lib/main.dart b/{{cookiecutter.out_dir}}/lib/main.dart index cf61a02..7216580 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,12 +23,21 @@ final hideLoadingPage = const outLogFilename = "out.log"; const errorExitCode = 100; +List createControlFactories = [ +{% for dep in cookiecutter.flutter.dependencies %} +{{ dep }}.createControl, +{% endfor %} +]; + const pythonScript = """ import certifi, os, runpy, socket, sys, traceback os.environ["REQUESTS_CA_BUNDLE"] = certifi.where() os.environ["SSL_CERT_FILE"] = certifi.where() +# fix for: https://github.com/flet-dev/serious-python/issues/85#issuecomment-2065000974 +os.environ["OPENBLAS_NUM_THREADS"] = "1" + if os.getenv("FLET_PLATFORM") == "android": import ssl @@ -79,6 +92,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) { @@ -89,6 +106,7 @@ void main() async { pageUrl: pageUrl, assetsDir: assetsDir, hideLoadingPage: hideLoadingPage, + createControlFactories: createControlFactories ) : FutureBuilder( future: runPythonApp(), @@ -107,6 +125,7 @@ void main() async { pageUrl: pageUrl, assetsDir: assetsDir, hideLoadingPage: hideLoadingPage, + createControlFactories: createControlFactories ); } }); diff --git a/{{cookiecutter.out_dir}}/macos/Runner/Info.plist b/{{cookiecutter.out_dir}}/macos/Runner/Info.plist index 67cb3bb..5194320 100644 --- a/{{cookiecutter.out_dir}}/macos/Runner/Info.plist +++ b/{{cookiecutter.out_dir}}/macos/Runner/Info.plist @@ -1,34 +1,36 @@ - + FLTEnableImpeller - CFBundleDevelopmentRegion - $(DEVELOPMENT_LANGUAGE) - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIconFile - - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - APPL - CFBundleShortVersionString - $(FLUTTER_BUILD_NAME) - CFBundleVersion - $(FLUTTER_BUILD_NUMBER) - LSMinimumSystemVersion - $(MACOSX_DEPLOYMENT_TARGET) - NSHumanReadableCopyright - $(PRODUCT_COPYRIGHT) - NSMainNibFile - MainMenu - NSPrincipalClass - NSApplication - - + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIconFile + + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + APPL + CFBundleShortVersionString + $(FLUTTER_BUILD_NAME) + CFBundleVersion + $(FLUTTER_BUILD_NUMBER) + LSMinimumSystemVersion + $(MACOSX_DEPLOYMENT_TARGET) + NSHumanReadableCopyright + $(PRODUCT_COPYRIGHT) + NSMainNibFile + MainMenu + NSPrincipalClass + NSApplication + NSMicrophoneUsageDescription + Audio Recording + + \ No newline at end of file diff --git a/{{cookiecutter.out_dir}}/pubspec.yaml b/{{cookiecutter.out_dir}}/pubspec.yaml index 95094c7..1c85753 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.22.1 # flet: # git: # url: https://github.com/flet-dev/flet.git @@ -27,7 +27,7 @@ dependencies: path: ^1.8.3 url_strategy: ^0.2.0 - cupertino_icons: ^1.0.2 + cupertino_icons: ^1.0.6 dev_dependencies: flutter_test: 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;