mirror of
https://github.com/flutter/samples.git
synced 2025-11-08 13:58:47 +00:00
[platform_channels] adds iOS implementation for platform image demo (#575)
This commit is contained in:
@@ -26,6 +26,19 @@ import Flutter
|
||||
}
|
||||
})
|
||||
|
||||
FlutterBasicMessageChannel(name: "platformImageDemo", binaryMessenger: flutterViewController.binaryMessenger, codec: FlutterStandardMessageCodec.sharedInstance()).setMessageHandler{
|
||||
(message: Any?, reply: FlutterReply) -> Void in
|
||||
|
||||
if(message as! String == "getImage") {
|
||||
guard let image = UIImage(named: "eat_new_orleans.jpg") else {
|
||||
reply(nil)
|
||||
return
|
||||
}
|
||||
|
||||
reply(FlutterStandardTypedData(bytes: image.jpegData(compressionQuality: 1)!))
|
||||
}
|
||||
}
|
||||
|
||||
GeneratedPluginRegistrant.register(with: self)
|
||||
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
||||
21
platform_channels/ios/Runner/Assets.xcassets/eat_new_orleans.imageset/Contents.json
vendored
Normal file
21
platform_channels/ios/Runner/Assets.xcassets/eat_new_orleans.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"filename" : "eat_new_orleans.jpg",
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
||||
BIN
platform_channels/ios/Runner/Assets.xcassets/eat_new_orleans.imageset/eat_new_orleans.jpg
vendored
Normal file
BIN
platform_channels/ios/Runner/Assets.xcassets/eat_new_orleans.imageset/eat_new_orleans.jpg
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 70 KiB |
Reference in New Issue
Block a user