diff --git a/simplistic_calculator/.metadata b/simplistic_calculator/.metadata index 05f4d5d4f..31b763f97 100644 --- a/simplistic_calculator/.metadata +++ b/simplistic_calculator/.metadata @@ -1,10 +1,45 @@ # This file tracks properties of this Flutter project. # Used by Flutter tool to assess capabilities and perform upgrades etc. # -# This file should be version controlled and should not be manually edited. +# This file should be version controlled. version: - revision: 097d3313d8e2c7f901932d63e537c1acefb87800 + revision: ffccd96b62ee8cec7740dab303538c5fc26ac543 channel: stable project_type: app + +# Tracks metadata for the flutter migrate command +migration: + platforms: + - platform: root + create_revision: ffccd96b62ee8cec7740dab303538c5fc26ac543 + base_revision: ffccd96b62ee8cec7740dab303538c5fc26ac543 + - platform: android + create_revision: ffccd96b62ee8cec7740dab303538c5fc26ac543 + base_revision: ffccd96b62ee8cec7740dab303538c5fc26ac543 + - platform: ios + create_revision: ffccd96b62ee8cec7740dab303538c5fc26ac543 + base_revision: ffccd96b62ee8cec7740dab303538c5fc26ac543 + - platform: linux + create_revision: ffccd96b62ee8cec7740dab303538c5fc26ac543 + base_revision: ffccd96b62ee8cec7740dab303538c5fc26ac543 + - platform: macos + create_revision: ffccd96b62ee8cec7740dab303538c5fc26ac543 + base_revision: ffccd96b62ee8cec7740dab303538c5fc26ac543 + - platform: web + create_revision: ffccd96b62ee8cec7740dab303538c5fc26ac543 + base_revision: ffccd96b62ee8cec7740dab303538c5fc26ac543 + - platform: windows + create_revision: ffccd96b62ee8cec7740dab303538c5fc26ac543 + base_revision: ffccd96b62ee8cec7740dab303538c5fc26ac543 + + # User provided section + + # List of Local paths (relative to this file) that should be + # ignored by the migrate tool. + # + # Files that are not part of the templates will be ignored by default. + unmanaged_files: + - 'lib/main.dart' + - 'ios/Runner.xcodeproj/project.pbxproj' diff --git a/simplistic_calculator/android/app/build.gradle b/simplistic_calculator/android/app/build.gradle index 4d9007c57..38d0a9d39 100644 --- a/simplistic_calculator/android/app/build.gradle +++ b/simplistic_calculator/android/app/build.gradle @@ -27,6 +27,7 @@ apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" android { compileSdkVersion flutter.compileSdkVersion + ndkVersion flutter.ndkVersion compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 @@ -44,6 +45,8 @@ android { defaultConfig { // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). applicationId "com.example.simplistic_calculator" + // You can update the following values to match your application needs. + // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration. minSdkVersion flutter.minSdkVersion targetSdkVersion flutter.targetSdkVersion versionCode flutterVersionCode.toInteger() diff --git a/simplistic_calculator/android/app/src/debug/AndroidManifest.xml b/simplistic_calculator/android/app/src/debug/AndroidManifest.xml index 7a32dd2e4..bdf9e13cb 100644 --- a/simplistic_calculator/android/app/src/debug/AndroidManifest.xml +++ b/simplistic_calculator/android/app/src/debug/AndroidManifest.xml @@ -1,6 +1,7 @@ - diff --git a/simplistic_calculator/android/app/src/main/res/values-night/styles.xml b/simplistic_calculator/android/app/src/main/res/values-night/styles.xml index 3db14bb53..06952be74 100644 --- a/simplistic_calculator/android/app/src/main/res/values-night/styles.xml +++ b/simplistic_calculator/android/app/src/main/res/values-night/styles.xml @@ -3,7 +3,7 @@ diff --git a/simplistic_calculator/android/build.gradle b/simplistic_calculator/android/build.gradle index 4256f9173..83ae22004 100644 --- a/simplistic_calculator/android/build.gradle +++ b/simplistic_calculator/android/build.gradle @@ -6,7 +6,7 @@ buildscript { } dependencies { - classpath 'com.android.tools.build:gradle:4.1.0' + classpath 'com.android.tools.build:gradle:7.1.2' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" } } diff --git a/simplistic_calculator/android/gradle/wrapper/gradle-wrapper.properties b/simplistic_calculator/android/gradle/wrapper/gradle-wrapper.properties index bc6a58afd..cb24abda1 100644 --- a/simplistic_calculator/android/gradle/wrapper/gradle-wrapper.properties +++ b/simplistic_calculator/android/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,5 @@ -#Fri Jun 23 08:50:38 CEST 2017 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip diff --git a/simplistic_calculator/ios/Flutter/AppFrameworkInfo.plist b/simplistic_calculator/ios/Flutter/AppFrameworkInfo.plist index 8d4492f97..9625e105d 100644 --- a/simplistic_calculator/ios/Flutter/AppFrameworkInfo.plist +++ b/simplistic_calculator/ios/Flutter/AppFrameworkInfo.plist @@ -21,6 +21,6 @@ CFBundleVersion 1.0 MinimumOSVersion - 9.0 + 11.0 diff --git a/simplistic_calculator/ios/Podfile b/simplistic_calculator/ios/Podfile index 1e8c3c90a..88359b225 100644 --- a/simplistic_calculator/ios/Podfile +++ b/simplistic_calculator/ios/Podfile @@ -1,5 +1,5 @@ # Uncomment this line to define a global platform for your project -# platform :ios, '9.0' +# platform :ios, '11.0' # CocoaPods analytics sends network stats synchronously affecting flutter build latency. ENV['COCOAPODS_DISABLE_STATS'] = 'true' diff --git a/simplistic_calculator/ios/Runner.xcodeproj/project.pbxproj b/simplistic_calculator/ios/Runner.xcodeproj/project.pbxproj index bfc2b3317..a8e734e34 100644 --- a/simplistic_calculator/ios/Runner.xcodeproj/project.pbxproj +++ b/simplistic_calculator/ios/Runner.xcodeproj/project.pbxproj @@ -9,11 +9,11 @@ /* Begin PBXBuildFile section */ 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; + 441B036D57C5BF77194DCA39 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 70930D0CB779A9154568149D /* Pods_Runner.framework */; }; 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; - C7DCF28C4178CAB8B8DB8123 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DBB321D18CEB845FE062EA4F /* Pods_Runner.framework */; }; /* End PBXBuildFile section */ /* Begin PBXCopyFilesBuildPhase section */ @@ -33,7 +33,8 @@ 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; - 4A8839421B40C48D29E1A4F5 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; + 4A9D145498FEC5B2BE2E3376 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; + 70930D0CB779A9154568149D /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; @@ -44,9 +45,8 @@ 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - A1A30EBD0458E8D56FC155D0 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; - B5329C49ADE174DF9AAF7AEC /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; - DBB321D18CEB845FE062EA4F /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + BF0571E986932F3268B6980C /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; + FD405473DEF559FDEE4A9F62 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -54,24 +54,32 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - C7DCF28C4178CAB8B8DB8123 /* Pods_Runner.framework in Frameworks */, + 441B036D57C5BF77194DCA39 /* Pods_Runner.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ - 89B99A48C48F845031F5B272 /* Pods */ = { + 4AF2DA8362B7C606A052A4B9 /* Pods */ = { isa = PBXGroup; children = ( - 4A8839421B40C48D29E1A4F5 /* Pods-Runner.debug.xcconfig */, - A1A30EBD0458E8D56FC155D0 /* Pods-Runner.release.xcconfig */, - B5329C49ADE174DF9AAF7AEC /* Pods-Runner.profile.xcconfig */, + 4A9D145498FEC5B2BE2E3376 /* Pods-Runner.debug.xcconfig */, + FD405473DEF559FDEE4A9F62 /* Pods-Runner.release.xcconfig */, + BF0571E986932F3268B6980C /* Pods-Runner.profile.xcconfig */, ); name = Pods; path = Pods; sourceTree = ""; }; + 51F5F71A8E8952F6D733EEC8 /* Frameworks */ = { + isa = PBXGroup; + children = ( + 70930D0CB779A9154568149D /* Pods_Runner.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; 9740EEB11CF90186004384FC /* Flutter */ = { isa = PBXGroup; children = ( @@ -89,8 +97,8 @@ 9740EEB11CF90186004384FC /* Flutter */, 97C146F01CF9000F007C117D /* Runner */, 97C146EF1CF9000F007C117D /* Products */, - 89B99A48C48F845031F5B272 /* Pods */, - 9C31605A9109D386437A3CB5 /* Frameworks */, + 4AF2DA8362B7C606A052A4B9 /* Pods */, + 51F5F71A8E8952F6D733EEC8 /* Frameworks */, ); sourceTree = ""; }; @@ -117,14 +125,6 @@ path = Runner; sourceTree = ""; }; - 9C31605A9109D386437A3CB5 /* Frameworks */ = { - isa = PBXGroup; - children = ( - DBB321D18CEB845FE062EA4F /* Pods_Runner.framework */, - ); - name = Frameworks; - sourceTree = ""; - }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -132,7 +132,7 @@ isa = PBXNativeTarget; buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; buildPhases = ( - 33B847FA1E4DFA0DB5FB1001 /* [CP] Check Pods Manifest.lock */, + ADD96A8EA0C880FE74E0044C /* [CP] Check Pods Manifest.lock */, 9740EEB61CF901F6004384FC /* Run Script */, 97C146EA1CF9000F007C117D /* Sources */, 97C146EB1CF9000F007C117D /* Frameworks */, @@ -197,28 +197,6 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ - 33B847FA1E4DFA0DB5FB1001 /* [CP] Check Pods Manifest.lock */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - ); - inputPaths = ( - "${PODS_PODFILE_DIR_PATH}/Podfile.lock", - "${PODS_ROOT}/Manifest.lock", - ); - name = "[CP] Check Pods Manifest.lock"; - outputFileListPaths = ( - ); - outputPaths = ( - "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; - showEnvVarsInLog = 0; - }; 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; @@ -247,6 +225,28 @@ shellPath = /bin/sh; shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; }; + ADD96A8EA0C880FE74E0044C /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ @@ -322,7 +322,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; + IPHONEOS_DEPLOYMENT_TARGET = 11.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SUPPORTED_PLATFORMS = iphoneos; @@ -399,7 +399,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; + IPHONEOS_DEPLOYMENT_TARGET = 11.0; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; @@ -448,7 +448,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; + IPHONEOS_DEPLOYMENT_TARGET = 11.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SUPPORTED_PLATFORMS = iphoneos; diff --git a/simplistic_calculator/ios/Runner/Info.plist b/simplistic_calculator/ios/Runner/Info.plist index d8af1eb79..b087957be 100644 --- a/simplistic_calculator/ios/Runner/Info.plist +++ b/simplistic_calculator/ios/Runner/Info.plist @@ -43,5 +43,9 @@ UIViewControllerBasedStatusBarAppearance + CADisableMinimumFrameDurationOnPhone + + UIApplicationSupportsIndirectInputEvents + diff --git a/simplistic_calculator/lib/main.dart b/simplistic_calculator/lib/main.dart index 13a18ae89..1039f26fe 100644 --- a/simplistic_calculator/lib/main.dart +++ b/simplistic_calculator/lib/main.dart @@ -473,6 +473,8 @@ class CalcButton extends ConsumerWidget { child: Padding( padding: const EdgeInsets.all(4), child: buttonConstructor( + autofocus: false, + clipBehavior: Clip.none, onPressed: () => op(ref.read(calculatorStateProvider.notifier)), child: AutoSizeText( label, diff --git a/simplistic_calculator/linux/CMakeLists.txt b/simplistic_calculator/linux/CMakeLists.txt index 258695ab4..762567b22 100644 --- a/simplistic_calculator/linux/CMakeLists.txt +++ b/simplistic_calculator/linux/CMakeLists.txt @@ -1,11 +1,19 @@ +# Project-level configuration. cmake_minimum_required(VERSION 3.10) project(runner LANGUAGES CXX) +# The name of the executable created for the application. Change this to change +# the on-disk name of your application. set(BINARY_NAME "simplistic_calculator") +# The unique GTK application identifier for this application. See: +# https://wiki.gnome.org/HowDoI/ChooseApplicationID set(APPLICATION_ID "com.example.simplistic_calculator") +# Explicitly opt in to modern CMake behaviors to avoid warnings with recent +# versions of CMake. cmake_policy(SET CMP0063 NEW) +# Load bundled libraries from the lib/ directory relative to the binary. set(CMAKE_INSTALL_RPATH "$ORIGIN/lib") # Root filesystem for cross-building. @@ -18,7 +26,7 @@ if(FLUTTER_TARGET_PLATFORM_SYSROOT) set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) endif() -# Configure build options. +# Define build configuration options. if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) set(CMAKE_BUILD_TYPE "Debug" CACHE STRING "Flutter build mode" FORCE) @@ -27,6 +35,10 @@ if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) endif() # Compilation settings that should be applied to most targets. +# +# Be cautious about adding new options here, as plugins use this function by +# default. In most cases, you should add new options to specific targets instead +# of modifying this function. function(APPLY_STANDARD_SETTINGS TARGET) target_compile_features(${TARGET} PUBLIC cxx_std_14) target_compile_options(${TARGET} PRIVATE -Wall -Werror) @@ -34,9 +46,8 @@ function(APPLY_STANDARD_SETTINGS TARGET) target_compile_definitions(${TARGET} PRIVATE "$<$>:NDEBUG>") endfunction() -set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") - # Flutter library and tool build rules. +set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") add_subdirectory(${FLUTTER_MANAGED_DIR}) # System-level dependencies. @@ -45,16 +56,27 @@ pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0) add_definitions(-DAPPLICATION_ID="${APPLICATION_ID}") -# Application build +# Define the application target. To change its name, change BINARY_NAME above, +# not the value here, or `flutter run` will no longer work. +# +# Any new source files that you add to the application should be added here. add_executable(${BINARY_NAME} "main.cc" "my_application.cc" "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" ) + +# Apply the standard set of build settings. This can be removed for applications +# that need different build settings. apply_standard_settings(${BINARY_NAME}) + +# Add dependency libraries. Add any application-specific dependencies here. target_link_libraries(${BINARY_NAME} PRIVATE flutter) target_link_libraries(${BINARY_NAME} PRIVATE PkgConfig::GTK) + +# Run the Flutter tool portions of the build. This must not be removed. add_dependencies(${BINARY_NAME} flutter_assemble) + # Only the install-generated bundle's copy of the executable will launch # correctly, since the resources must in the right relative locations. To avoid # people trying to run the unbundled copy, put it in a subdirectory instead of @@ -94,11 +116,11 @@ install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR} install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) -if(PLUGIN_BUNDLED_LIBRARIES) - install(FILES "${PLUGIN_BUNDLED_LIBRARIES}" +foreach(bundled_library ${PLUGIN_BUNDLED_LIBRARIES}) + install(FILES "${bundled_library}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) -endif() +endforeach(bundled_library) # Fully re-copy the assets directory on each build to avoid having stale files # from a previous install. diff --git a/simplistic_calculator/linux/flutter/CMakeLists.txt b/simplistic_calculator/linux/flutter/CMakeLists.txt index 33fd5801e..d5bd01648 100644 --- a/simplistic_calculator/linux/flutter/CMakeLists.txt +++ b/simplistic_calculator/linux/flutter/CMakeLists.txt @@ -1,3 +1,4 @@ +# This file controls Flutter-level build steps. It should not be edited. cmake_minimum_required(VERSION 3.10) set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral") diff --git a/simplistic_calculator/macos/Runner.xcodeproj/project.pbxproj b/simplistic_calculator/macos/Runner.xcodeproj/project.pbxproj index 74f8bb66d..8c2344e5a 100644 --- a/simplistic_calculator/macos/Runner.xcodeproj/project.pbxproj +++ b/simplistic_calculator/macos/Runner.xcodeproj/project.pbxproj @@ -26,7 +26,7 @@ 33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F22044A3C60003C045 /* Assets.xcassets */; }; 33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F42044A3C60003C045 /* MainMenu.xib */; }; 33CC11132044BFA00003C045 /* MainFlutterWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */; }; - 6CE680FDAC23C61285A0D71B /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E42015C98DCB47D627CAA023 /* Pods_Runner.framework */; }; + 5A0D172F9734A5A2125C76CF /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C44B05E0012C1A913E24916C /* Pods_Runner.framework */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -53,7 +53,6 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ - 0667DF68BA659F6158C84C4E /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; 333000ED22D3DE5D00554162 /* Warnings.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Warnings.xcconfig; sourceTree = ""; }; 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GeneratedPluginRegistrant.swift; sourceTree = ""; }; 33CC10ED2044A3C60003C045 /* simplistic_calculator.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = simplistic_calculator.app; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -68,11 +67,12 @@ 33E51913231747F40026EE4D /* DebugProfile.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = DebugProfile.entitlements; sourceTree = ""; }; 33E51914231749380026EE4D /* Release.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.entitlements; path = Release.entitlements; sourceTree = ""; }; 33E5194F232828860026EE4D /* AppInfo.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = AppInfo.xcconfig; sourceTree = ""; }; - 6D4D935640336A6E38D67BB5 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; + 3ACD8920F7C86EB6DE0699FF /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Release.xcconfig; sourceTree = ""; }; 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Debug.xcconfig; sourceTree = ""; }; - E20A028B267E0C17E6792329 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; - E42015C98DCB47D627CAA023 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + A6926DA493E093D8D5CDA244 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; + C44B05E0012C1A913E24916C /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + CFD2A6C823031588254EB2DF /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -80,7 +80,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 6CE680FDAC23C61285A0D71B /* Pods_Runner.framework in Frameworks */, + 5A0D172F9734A5A2125C76CF /* Pods_Runner.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -105,7 +105,7 @@ 33CEB47122A05771004F2AC0 /* Flutter */, 33CC10EE2044A3C60003C045 /* Products */, D73912EC22F37F3D000D13A0 /* Frameworks */, - C2BDE0328D2300C142982675 /* Pods */, + B7CE6BA72DD826EA35B5978F /* Pods */, ); sourceTree = ""; }; @@ -152,12 +152,12 @@ path = Runner; sourceTree = ""; }; - C2BDE0328D2300C142982675 /* Pods */ = { + B7CE6BA72DD826EA35B5978F /* Pods */ = { isa = PBXGroup; children = ( - 0667DF68BA659F6158C84C4E /* Pods-Runner.debug.xcconfig */, - E20A028B267E0C17E6792329 /* Pods-Runner.release.xcconfig */, - 6D4D935640336A6E38D67BB5 /* Pods-Runner.profile.xcconfig */, + 3ACD8920F7C86EB6DE0699FF /* Pods-Runner.debug.xcconfig */, + CFD2A6C823031588254EB2DF /* Pods-Runner.release.xcconfig */, + A6926DA493E093D8D5CDA244 /* Pods-Runner.profile.xcconfig */, ); name = Pods; path = Pods; @@ -166,7 +166,7 @@ D73912EC22F37F3D000D13A0 /* Frameworks */ = { isa = PBXGroup; children = ( - E42015C98DCB47D627CAA023 /* Pods_Runner.framework */, + C44B05E0012C1A913E24916C /* Pods_Runner.framework */, ); name = Frameworks; sourceTree = ""; @@ -178,13 +178,13 @@ isa = PBXNativeTarget; buildConfigurationList = 33CC10FB2044A3C60003C045 /* Build configuration list for PBXNativeTarget "Runner" */; buildPhases = ( - 70644500D64D705B0BB41062 /* [CP] Check Pods Manifest.lock */, + 9E3366FB04A8F000E94E4994 /* [CP] Check Pods Manifest.lock */, 33CC10E92044A3C60003C045 /* Sources */, 33CC10EA2044A3C60003C045 /* Frameworks */, 33CC10EB2044A3C60003C045 /* Resources */, 33CC110E2044A8840003C045 /* Bundle Framework */, 3399D490228B24CF009A79C7 /* ShellScript */, - FBBC76201488306700165057 /* [CP] Embed Pods Frameworks */, + B90B5668F440347511727138 /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); @@ -291,7 +291,7 @@ shellPath = /bin/sh; shellScript = "\"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh && touch Flutter/ephemeral/tripwire"; }; - 70644500D64D705B0BB41062 /* [CP] Check Pods Manifest.lock */ = { + 9E3366FB04A8F000E94E4994 /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( @@ -313,7 +313,7 @@ shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; - FBBC76201488306700165057 /* [CP] Embed Pods Frameworks */ = { + B90B5668F440347511727138 /* [CP] Embed Pods Frameworks */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( diff --git a/simplistic_calculator/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png b/simplistic_calculator/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png index 3c4935a7c..82b6f9d9a 100644 Binary files a/simplistic_calculator/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png and b/simplistic_calculator/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png differ diff --git a/simplistic_calculator/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png b/simplistic_calculator/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png index ed4cc1642..13b35eba5 100644 Binary files a/simplistic_calculator/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png and b/simplistic_calculator/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png differ diff --git a/simplistic_calculator/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png b/simplistic_calculator/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png index 483be6138..0a3f5fa40 100644 Binary files a/simplistic_calculator/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png and b/simplistic_calculator/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png differ diff --git a/simplistic_calculator/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png b/simplistic_calculator/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png index bcbf36df2..bdb57226d 100644 Binary files a/simplistic_calculator/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png and b/simplistic_calculator/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png differ diff --git a/simplistic_calculator/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png b/simplistic_calculator/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png index 9c0a65286..f083318e0 100644 Binary files a/simplistic_calculator/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png and b/simplistic_calculator/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png differ diff --git a/simplistic_calculator/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png b/simplistic_calculator/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png index e71a72613..326c0e72c 100644 Binary files a/simplistic_calculator/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png and b/simplistic_calculator/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png differ diff --git a/simplistic_calculator/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png b/simplistic_calculator/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png index 8a31fe2dd..2f1632cfd 100644 Binary files a/simplistic_calculator/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png and b/simplistic_calculator/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png differ diff --git a/simplistic_calculator/web/index.html b/simplistic_calculator/web/index.html index fbf789b49..934341536 100644 --- a/simplistic_calculator/web/index.html +++ b/simplistic_calculator/web/index.html @@ -31,74 +31,28 @@ simplistic_calculator + + + + - diff --git a/simplistic_calculator/windows/CMakeLists.txt b/simplistic_calculator/windows/CMakeLists.txt index f1e40612c..fb54a2d9f 100644 --- a/simplistic_calculator/windows/CMakeLists.txt +++ b/simplistic_calculator/windows/CMakeLists.txt @@ -1,13 +1,16 @@ +# Project-level configuration. cmake_minimum_required(VERSION 3.14) project(simplistic_calculator LANGUAGES CXX) +# The name of the executable created for the application. Change this to change +# the on-disk name of your application. set(BINARY_NAME "simplistic_calculator") +# Explicitly opt in to modern CMake behaviors to avoid warnings with recent +# versions of CMake. cmake_policy(SET CMP0063 NEW) -set(CMAKE_INSTALL_RPATH "$ORIGIN/lib") - -# Configure build options. +# Define build configuration option. get_property(IS_MULTICONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) if(IS_MULTICONFIG) set(CMAKE_CONFIGURATION_TYPES "Debug;Profile;Release" @@ -20,7 +23,7 @@ else() "Debug" "Profile" "Release") endif() endif() - +# Define settings for the Profile build mode. set(CMAKE_EXE_LINKER_FLAGS_PROFILE "${CMAKE_EXE_LINKER_FLAGS_RELEASE}") set(CMAKE_SHARED_LINKER_FLAGS_PROFILE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE}") set(CMAKE_C_FLAGS_PROFILE "${CMAKE_C_FLAGS_RELEASE}") @@ -30,6 +33,10 @@ set(CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_RELEASE}") add_definitions(-DUNICODE -D_UNICODE) # Compilation settings that should be applied to most targets. +# +# Be cautious about adding new options here, as plugins use this function by +# default. In most cases, you should add new options to specific targets instead +# of modifying this function. function(APPLY_STANDARD_SETTINGS TARGET) target_compile_features(${TARGET} PUBLIC cxx_std_17) target_compile_options(${TARGET} PRIVATE /W4 /WX /wd"4100") @@ -38,12 +45,11 @@ function(APPLY_STANDARD_SETTINGS TARGET) target_compile_definitions(${TARGET} PRIVATE "$<$:_DEBUG>") endfunction() -set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") - # Flutter library and tool build rules. +set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") add_subdirectory(${FLUTTER_MANAGED_DIR}) -# Application build +# Application build; see runner/CMakeLists.txt. add_subdirectory("runner") # Generated plugin build rules, which manage building the plugins and adding diff --git a/simplistic_calculator/windows/flutter/CMakeLists.txt b/simplistic_calculator/windows/flutter/CMakeLists.txt index b2e4bd8d6..930d2071a 100644 --- a/simplistic_calculator/windows/flutter/CMakeLists.txt +++ b/simplistic_calculator/windows/flutter/CMakeLists.txt @@ -1,3 +1,4 @@ +# This file controls Flutter-level build steps. It should not be edited. cmake_minimum_required(VERSION 3.14) set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral") diff --git a/simplistic_calculator/windows/runner/CMakeLists.txt b/simplistic_calculator/windows/runner/CMakeLists.txt index de2d8916b..17411a8ab 100644 --- a/simplistic_calculator/windows/runner/CMakeLists.txt +++ b/simplistic_calculator/windows/runner/CMakeLists.txt @@ -1,6 +1,11 @@ cmake_minimum_required(VERSION 3.14) project(runner LANGUAGES CXX) +# Define the application target. To change its name, change BINARY_NAME in the +# top-level CMakeLists.txt, not the value here, or `flutter run` will no longer +# work. +# +# Any new source files that you add to the application should be added here. add_executable(${BINARY_NAME} WIN32 "flutter_window.cpp" "main.cpp" @@ -10,8 +15,25 @@ add_executable(${BINARY_NAME} WIN32 "Runner.rc" "runner.exe.manifest" ) + +# Apply the standard set of build settings. This can be removed for applications +# that need different build settings. apply_standard_settings(${BINARY_NAME}) + +# Add preprocessor definitions for the build version. +target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION=\"${FLUTTER_VERSION}\"") +target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MAJOR=${FLUTTER_VERSION_MAJOR}") +target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MINOR=${FLUTTER_VERSION_MINOR}") +target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_PATCH=${FLUTTER_VERSION_PATCH}") +target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_BUILD=${FLUTTER_VERSION_BUILD}") + +# Disable Windows macros that collide with C++ standard library functions. target_compile_definitions(${BINARY_NAME} PRIVATE "NOMINMAX") + +# Add dependency libraries and include directories. Add any application-specific +# dependencies here. target_link_libraries(${BINARY_NAME} PRIVATE flutter flutter_wrapper_app) target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}") + +# Run the Flutter tool portions of the build. This must not be removed. add_dependencies(${BINARY_NAME} flutter_assemble) diff --git a/simplistic_calculator/windows/runner/Runner.rc b/simplistic_calculator/windows/runner/Runner.rc index 6c103c9e1..835e11ab9 100644 --- a/simplistic_calculator/windows/runner/Runner.rc +++ b/simplistic_calculator/windows/runner/Runner.rc @@ -60,14 +60,14 @@ IDI_APP_ICON ICON "resources\\app_icon.ico" // Version // -#ifdef FLUTTER_BUILD_NUMBER -#define VERSION_AS_NUMBER FLUTTER_BUILD_NUMBER +#if defined(FLUTTER_VERSION_MAJOR) && defined(FLUTTER_VERSION_MINOR) && defined(FLUTTER_VERSION_PATCH) && defined(FLUTTER_VERSION_BUILD) +#define VERSION_AS_NUMBER FLUTTER_VERSION_MAJOR,FLUTTER_VERSION_MINOR,FLUTTER_VERSION_PATCH,FLUTTER_VERSION_BUILD #else -#define VERSION_AS_NUMBER 1,0,0 +#define VERSION_AS_NUMBER 1,0,0,0 #endif -#ifdef FLUTTER_BUILD_NAME -#define VERSION_AS_STRING #FLUTTER_BUILD_NAME +#if defined(FLUTTER_VERSION) +#define VERSION_AS_STRING FLUTTER_VERSION #else #define VERSION_AS_STRING "1.0.0" #endif diff --git a/simplistic_calculator/windows/runner/runner.exe.manifest b/simplistic_calculator/windows/runner/runner.exe.manifest index c977c4a42..a42ea7687 100644 --- a/simplistic_calculator/windows/runner/runner.exe.manifest +++ b/simplistic_calculator/windows/runner/runner.exe.manifest @@ -7,7 +7,7 @@ - + diff --git a/simplistic_calculator/windows/runner/utils.cpp b/simplistic_calculator/windows/runner/utils.cpp index d19bdbbcc..f5bf9fa0f 100644 --- a/simplistic_calculator/windows/runner/utils.cpp +++ b/simplistic_calculator/windows/runner/utils.cpp @@ -48,10 +48,10 @@ std::string Utf8FromUtf16(const wchar_t* utf16_string) { int target_length = ::WideCharToMultiByte( CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, -1, nullptr, 0, nullptr, nullptr); - if (target_length == 0) { - return std::string(); - } std::string utf8_string; + if (target_length == 0 || target_length > utf8_string.max_size()) { + return utf8_string; + } utf8_string.resize(target_length); int converted_length = ::WideCharToMultiByte( CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string,