forked from zhujian1989/flutter_study
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
316f0b5
commit 50df36c
Showing
8 changed files
with
140 additions
and
14 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Binary file not shown.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
android/app/src/main/java/com/jzhu/flutterstudy/plugin/FlutterPluginJumpToAct.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package com.jzhu.flutterstudy.plugin; | ||
|
||
import android.app.Activity; | ||
import android.content.Intent; | ||
import com.jzhu.flutterstudy.OneActivity; | ||
import com.jzhu.flutterstudy.TwoActivity; | ||
import io.flutter.plugin.common.MethodCall; | ||
import io.flutter.plugin.common.MethodChannel; | ||
import io.flutter.plugin.common.PluginRegistry; | ||
|
||
public class FlutterPluginJumpToAct implements MethodChannel.MethodCallHandler{ | ||
|
||
public static String CHANNEL = "com.jzhu.jumpPlugin"; | ||
|
||
static MethodChannel channel; | ||
|
||
private Activity activity; | ||
|
||
private FlutterPluginJumpToAct(Activity activity) { | ||
this.activity = activity; | ||
} | ||
|
||
|
||
public static void registerWith(PluginRegistry.Registrar registrar) { | ||
channel = new MethodChannel(registrar.messenger(), CHANNEL); | ||
FlutterPluginJumpToAct instance = new FlutterPluginJumpToAct(registrar.activity()); | ||
channel.setMethodCallHandler(instance); | ||
} | ||
|
||
@Override | ||
public void onMethodCall(MethodCall call, MethodChannel.Result result) { | ||
|
||
// 自定义插件 | ||
if (call.method.equals("oneAct")) { | ||
Intent intent = new Intent(activity, OneActivity.class); | ||
activity.startActivity(intent); | ||
result.success("success"); | ||
} | ||
if (call.method.equals("twoAct")) { | ||
String text = call.argument("flutter"); | ||
Intent intent = new Intent(activity, TwoActivity.class); | ||
intent.putExtra(TwoActivity.VALUE, text); | ||
activity.startActivity(intent); | ||
result.success("success"); | ||
} | ||
else { | ||
result.notImplemented(); | ||
} | ||
} | ||
|
||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
# Uncomment this line to define a global platform for your project | ||
# platform :ios, '9.0' | ||
|
||
# CocoaPods analytics sends network stats synchronously affecting flutter build latency. | ||
ENV['COCOAPODS_DISABLE_STATS'] = 'true' | ||
|
||
def parse_KV_file(file, separator='=') | ||
file_abs_path = File.expand_path(file) | ||
if !File.exists? file_abs_path | ||
return []; | ||
end | ||
pods_ary = [] | ||
skip_line_start_symbols = ["#", "/"] | ||
File.foreach(file_abs_path) { |line| | ||
next if skip_line_start_symbols.any? { |symbol| line =~ /^\s*#{symbol}/ } | ||
plugin = line.split(pattern=separator) | ||
if plugin.length == 2 | ||
podname = plugin[0].strip() | ||
path = plugin[1].strip() | ||
podpath = File.expand_path("#{path}", file_abs_path) | ||
pods_ary.push({:name => podname, :path => podpath}); | ||
else | ||
puts "Invalid plugin specification: #{line}" | ||
end | ||
} | ||
return pods_ary | ||
end | ||
|
||
target 'Runner' do | ||
# Prepare symlinks folder. We use symlinks to avoid having Podfile.lock | ||
# referring to absolute paths on developers' machines. | ||
system('rm -rf .symlinks') | ||
system('mkdir -p .symlinks/plugins') | ||
|
||
# Flutter Pods | ||
generated_xcode_build_settings = parse_KV_file('./Flutter/Generated.xcconfig') | ||
if generated_xcode_build_settings.empty? | ||
puts "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter packages get is executed first." | ||
end | ||
generated_xcode_build_settings.map { |p| | ||
if p[:name] == 'FLUTTER_FRAMEWORK_DIR' | ||
symlink = File.join('.symlinks', 'flutter') | ||
File.symlink(File.dirname(p[:path]), symlink) | ||
pod 'Flutter', :path => File.join(symlink, File.basename(p[:path])) | ||
end | ||
} | ||
|
||
# Plugin Pods | ||
plugin_pods = parse_KV_file('../.flutter-plugins') | ||
plugin_pods.map { |p| | ||
symlink = File.join('.symlinks', 'plugins', p[:name]) | ||
File.symlink(p[:path], symlink) | ||
pod p[:name], :path => File.join(symlink, 'ios') | ||
} | ||
end | ||
|
||
post_install do |installer| | ||
installer.pods_project.targets.each do |target| | ||
target.build_configurations.each do |config| | ||
config.build_settings['ENABLE_BITCODE'] = 'NO' | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>IDEDidComputeMac32BitWarning</key> | ||
<true/> | ||
</dict> | ||
</plist> |