-
Notifications
You must be signed in to change notification settings - Fork 7.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[platform_channels] adds Platform Image demo #475
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like a great start. I left a few comments, but nothing big.
I do have an important question, though: What is the source of the image in this PR? We need to make sure we're completely covered on copyright. If you're not particularly wedded to this exact image, I can email you some options that I know we won't have problems with.
// Registers a MessageHandler for BasicMessageChannel to receive a message from dart side and send | ||
// the image data in reply. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit:
// Registers a MessageHandler for BasicMessageChannel to receive
// a message from Dart and send image data in reply.
/// a platform image. The [BasicMessageChannel] is using [StandardMessageCodec] | ||
/// since it supports [Uint8List] which can be easily used to get the image data | ||
/// from platform and display an image using [Image.memory]. | ||
class PlatformImage { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider renaming this class to something slightly more descriptive ("PlatformImageFetcher" for example).
The image is taken from AnimationSamples. Here |
That'll work. 😄 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. I left one small additional note about taking out an unnecessary widget. Happy to land this afterwards.
appBar: AppBar( | ||
title: Text('Platform Image Demo'), | ||
), | ||
body: Builder( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Now that you're not using a snackbar, you don't need this builder any more.
Description
Demonstrates how to use
BasicMessageChannel
to send the message from the dart side and receive a reply from the platform. The demo also demonstrates how to receivean image from the platform.
Screenshots