There is community demand for a Flutter version of StageXL.
At the time of this writing, two rendering approaches seem eligible as replacements for the dart:html API, namely dart:ui Canvas (2D only) and the package flutter_web_gl, which provides native OpenGLES bindings for Android, iOS, macOS, and Windows (but not Flutter Web).
This project serves as a proof of concept.
- All references to dart:html have been removed – and because StageXL depends on it in a lot of places, it was necessary to refactor the whole package (i.e. we can't just add a Flutter renderer)
- Canvas2D rendering: Most API calls replaced or substituted, but Graphics needs refactoring because in dart:ui Canvas, drawing and decorating are done within the same call, while StageXL's API uses two separate calls.
- WebGL rendering: All API calls were refactored towards the slightly different FlutterWebGL APi.
- Nothing as of now, but hey, at least the example does compile :-)
- Example: Getting a GLES error when initializing FlutterWebGL. Compare settings with flutter_web_gl's example.
- GL: While the GL API is similar to dart:html's, it expects different data types and while conversion has been implemented, it has not been tested yet.
- GL: Graphics/BitmapData/RenderTexture will probably need additional work
- Canvas: Needs refactoring of Graphics operations because ui.Canvas expects styling info together with the draw call
- Mouse and Touch events – a GestureDetector needs to get mapped to either Canvas or the Texture used by FlutterWebGL
- Text – while basic text rendering should be possible to achieve with dart:ui's Paragraph, Flutter does not currently support control on glyph level.
- Sound - basic sound functionality was implemented by using the soundpool package, but it is not possible to skip or play excerpts.
- Video - while Flutter supports animated gif and webp, Flutter's support for 'real' Video is limited to exposing a Videoplayer widget, i.e. no way to get the contents
- Lots of details, see TODOs in source
Opinion: it should suffice to port the display list and graphics APIs and leave things like asset loading and resizing to Flutter. While some additional
- StageXL Forum: https://groups.google.com/forum/#!forum/stagexl
- StageXL GitHub Issues: https://github.com/bp74/StageXL/issues
- StageXL StackOverflow: http://stackoverflow.com/questions/ask?tags=stagexl
- StageXL API Reference: http://www.stagexl.org/docs/api/index.html