Skip to content

Commit

Permalink
chore: change example and melos config (#142)
Browse files Browse the repository at this point in the history
* chore: change example and melos config

Signed-off-by: Caijinglong <[email protected]>

* chore: downgrade version

Signed-off-by: Caijinglong <[email protected]>

* chroe: CI - update runnable jdk version

Signed-off-by: Caijinglong <[email protected]>

* chore: fix example error for ios

Signed-off-by: Caijinglong <[email protected]>

---------

Signed-off-by: Caijinglong <[email protected]>
  • Loading branch information
CaiJingLong authored Nov 22, 2024
1 parent 17ff0e4 commit 6241bc3
Show file tree
Hide file tree
Showing 129 changed files with 188 additions and 5,077 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/runnable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: "corretto"
java-version: "17"
- uses: subosito/flutter-action@v2
with:
channel: "stable"
Expand Down
1 change: 1 addition & 0 deletions image_editor/example/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,5 @@ app.*.symbols

# Obfuscation related
app.*.map.json

!pubspec.lock
15 changes: 12 additions & 3 deletions image_editor/example/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
# flutter_image_editor_example

A demo for flutter_image_editor.
Demonstrates how to use the flutter_image_editor plugin.

Run example of open harmony in the [directory][example-for-harmony]
## Getting Started

[example-for-harmony]: ../../image_editor_ohos/example/
This project is a starting point for a Flutter application.

A few resources to get you started if this is your first Flutter project:

- [Lab: Write your first Flutter app](https://flutter.dev/docs/get-started/codelab)
- [Cookbook: Useful Flutter samples](https://flutter.dev/docs/cookbook)

For help getting started with Flutter, view our
[online documentation](https://flutter.dev/docs), which offers tutorials,
samples, guidance on mobile development, and a full API reference.
32 changes: 21 additions & 11 deletions image_editor/example/android/app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
plugins {
id "com.android.application"
id "kotlin-android"
id "dev.flutter.flutter-gradle-plugin"
}

def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
Expand All @@ -6,11 +12,6 @@ if (localPropertiesFile.exists()) {
}
}

def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}

def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
Expand All @@ -21,12 +22,13 @@ if (flutterVersionName == null) {
flutterVersionName = '1.0'
}

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
compileSdkVersion flutter.compileSdkVersion
def sdkVersion = 35
if (project.hasProperty('compileSdk')) {
compileSdk = sdkVersion
} else {
compileSdkVersion = sdkVersion
}

sourceSets {
main.java.srcDirs += 'src/main/kotlin'
Expand All @@ -53,12 +55,20 @@ android {
signingConfig signingConfigs.debug
}
}

if (project.android.hasProperty('namespace')) {
namespace 'com.fluttercandies.image_editor'
}

kotlinOptions {
jvmTarget = '1.8'
}

}

flutter {
source '../..'
}

dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.fluttercandies.flutter_image_editor_example">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.INTERNET"/>
<application
android:icon="@mipmap/ic_launcher"
Expand Down
13 changes: 0 additions & 13 deletions image_editor/example/android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,16 +1,3 @@
buildscript {
ext.kotlin_version = '1.8.10'
repositories {
google()
mavenCentral()
}

dependencies {
classpath 'com.android.tools.build:gradle:8.7.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}

allprojects {
repositories {
google()
Expand Down
30 changes: 22 additions & 8 deletions image_editor/example/android/settings.gradle
Original file line number Diff line number Diff line change
@@ -1,11 +1,25 @@
include ':app'
pluginManagement {
def flutterSdkPath = {
def properties = new Properties()
file("local.properties").withInputStream { properties.load(it) }
def flutterSdkPath = properties.getProperty("flutter.sdk")
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
return flutterSdkPath
}()

def localPropertiesFile = new File(rootProject.projectDir, "local.properties")
def properties = new Properties()
includeBuild("$flutterSdkPath/packages/flutter_tools/gradle")

assert localPropertiesFile.exists()
localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) }
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
}

def flutterSdkPath = properties.getProperty("flutter.sdk")
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle"
plugins {
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
id "com.android.application" version '8.7.2' apply false
id "org.jetbrains.kotlin.android" version '1.8.22' apply false
}

include ":app"
2 changes: 1 addition & 1 deletion image_editor/example/ios/Flutter/AppFrameworkInfo.plist
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@
<key>CFBundleVersion</key>
<string>1.0</string>
<key>MinimumOSVersion</key>
<string>12.0</string>
<string>9.0</string>
</dict>
</plist>
33 changes: 1 addition & 32 deletions image_editor/example/ios/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,42 +27,11 @@ require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelpe

flutter_ios_podfile_setup

def install_plugin_pods(application_path = nil, relative_symlink_dir, platform)
# defined_in_file is set by CocoaPods and is a Pathname to the Podfile.
application_path ||= File.dirname(defined_in_file.realpath) if self.respond_to?(:defined_in_file)
raise 'Could not find application path' unless application_path

# Prepare symlinks folder. We use symlinks to avoid having Podfile.lock
# referring to absolute paths on developers' machines.

symlink_dir = File.expand_path(relative_symlink_dir, application_path)
system('rm', '-rf', symlink_dir) # Avoid the complication of dependencies like FileUtils.

symlink_plugins_dir = File.expand_path('plugins', symlink_dir)
system('mkdir', '-p', symlink_plugins_dir)

plugins_file = File.join(application_path, '..', '.flutter-plugins-dependencies')
plugin_pods = flutter_parse_plugins_file(plugins_file, platform)
plugin_pods.each do |plugin_hash|
plugin_name = plugin_hash['name']
plugin_path = plugin_hash['path']
# iOS and macOS code can be shared in "darwin" directory, otherwise
# respectively in "ios" or "macos" directories.
shared_darwin_source = plugin_hash.fetch('shared_darwin_source', false)
platform_directory = shared_darwin_source ? 'darwin' : platform
if (plugin_name && plugin_path)
specPath = "#{plugin_path}/#{platform_directory}/#{plugin_name}.podspec"
pod plugin_name, :path => specPath
end
end
end

target 'Runner' do
use_frameworks!
use_modular_headers!

flutter_install_ios_engine_pod(File.dirname(File.realpath(__FILE__)))
install_plugin_pods(File.dirname(File.realpath(__FILE__)), '.symlinks', 'ios')
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
end

post_install do |installer|
Expand Down
17 changes: 7 additions & 10 deletions image_editor/example/ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
objectVersion = 54;
objectVersion = 50;
objects = {

/* Begin PBXBuildFile section */
Expand Down Expand Up @@ -146,7 +146,7 @@
97C146EC1CF9000F007C117D /* Resources */,
9705A1C41CF9048500538489 /* Embed Frameworks */,
3B06AD1E1E4923F5004D2608 /* Thin Binary */,
A26971BBAB1B41EA1D99CAF0 /* [CP] Embed Pods Frameworks */,
D1337B04A10CD6FD98489BBF /* [CP] Embed Pods Frameworks */,
);
buildRules = (
);
Expand All @@ -163,7 +163,7 @@
97C146E61CF9000F007C117D /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 1510;
LastUpgradeCheck = 1300;
ORGANIZATIONNAME = "The Chromium Authors";
TargetAttributes = {
97C146ED1CF9000F007C117D = {
Expand Down Expand Up @@ -208,12 +208,10 @@
/* Begin PBXShellScriptBuildPhase section */
3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
"${TARGET_BUILD_DIR}/${INFOPLIST_PATH}",
);
name = "Thin Binary";
outputPaths = (
Expand Down Expand Up @@ -246,7 +244,6 @@
};
9740EEB61CF901F6004384FC /* Run Script */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
Expand All @@ -259,7 +256,7 @@
shellPath = /bin/sh;
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build";
};
A26971BBAB1B41EA1D99CAF0 /* [CP] Embed Pods Frameworks */ = {
D1337B04A10CD6FD98489BBF /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
Expand Down Expand Up @@ -356,7 +353,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos;
Expand Down Expand Up @@ -442,7 +439,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
Expand Down Expand Up @@ -491,7 +488,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1510"
LastUpgradeVersion = "1300"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
2 changes: 0 additions & 2 deletions image_editor/example/ios/Runner/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,5 @@
<string>App want to use your camera to capture photo.</string>
<key>CADisableMinimumFrameDurationOnPhone</key>
<true/>
<key>UIApplicationSupportsIndirectInputEvents</key>
<true/>
</dict>
</plist>
31 changes: 1 addition & 30 deletions image_editor/example/lib/add_text_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -103,35 +103,7 @@ class _AddTextPageState extends State<AddTextPage> {
controller: _controller,
),
),

// text align dropdown
ListTile(
title: Text('textAlign'),
subtitle: DropdownButton<TextAlign>(
value: textAlign,
items: <DropdownMenuItem<TextAlign>>[
const DropdownMenuItem<TextAlign>(
value: TextAlign.left,
child: Text('left'),
),
const DropdownMenuItem<TextAlign>(
value: TextAlign.center,
child: Text('center'),
),
const DropdownMenuItem<TextAlign>(
value: TextAlign.right,
child: Text('right'),
),
],
onChanged: (TextAlign? value) {
if (value != null) {
setState(() {
textAlign = value;
});
}
},
),
),
// Slider(value: null, onChanged: null),
],
),
),
Expand All @@ -149,7 +121,6 @@ class _AddTextPageState extends State<AddTextPage> {
fontSizePx: size,
textColor: const Color(0xFF995555),
fontName: fontName,
textAlign: textAlign,
),
);
option.outputFormat = const OutputFormat.png();
Expand Down
Loading

0 comments on commit 6241bc3

Please sign in to comment.