-
-
Notifications
You must be signed in to change notification settings - Fork 30
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
Dart SDK compatibility #69
Comments
Overall it sounds like a good idea, we've had this plan before but never done the implementation. |
@kurtome @ufrshubham @jtmcdole do you have any input on this, #70 and #71? |
Maybe I'm missing something, but nothing is ever done with both Rect and Color right? Since Rectangle comes from |
Oh and I forgot to mention that I needed to replace |
Ah yes, if that works it would be great!
👍 |
My only thoughts are: make sure the Color primitives play nice with Dart's canvas methods. If I remember correctly I was having issues with the hex string being a pain to deal with, so I put the hex parsing in the |
I think that works because then you can make a |
I needed to include Also, I needed to parse the TMX file to pure Dart and I am very grateful for your
|
What do you mean by „WITHOUT a breaking change“? Wouldn’t changing the types be a breaking change anyway? Also I don‘t think it‘s smart to depend on another library when all that is needed is one Type: Color Secondly how would you propose a PR for #71 ? Did you already write an Exporter as well? I have already opened #78 with a finished implementation! |
I mean that the types from pure_dart_ui are 100% copied from Flutter
Wrapping classes in a library is a solution that makes the library more stable, but not inflexible. These classes can be used for many other pure Dart projects and can be extended with some useful extensions, as Flame has already done.
Nice! |
So does my ColorData class, however both are breaking changes as conversion methods are required in order to adapt to for example
While you are correct I don't believe that is worth it for only a single class, however that is something that should be decided by this projects maintainers @spydon |
The pure_dart_ui contains only the copied classes from
* import 'dart:ui' hide Color, Offset, Rect, Size;
+ import 'package:pure_dart_ui/pure_dart_ui.dart'; |
I agree here, especially since the class name will clash with everywhere where people are using the Flutter classes.
It will still be a breaking change even though no code except the imports need to change, the classes won't be compatible with the ones in |
Ok with |
They are not used here afaik. |
What could be improved
Remove requirement for
dart:ui
and therefore the Flutter SDKWhy should this be improved
Currently this package/parser is only usable with the Flutter SDK. However I believe there are valid use-cases for the Dart SDK. For example I'm currently working on a CLI to optimize tmx to only include the tiles actually used in a map in it's tilesets. This is not possible using the Flutter SDK.
Any risks?
This improvement would require the removal of all dart:ui dependencies. However there are only two in this project, which I replaced in the "#69-dart-sdk branch" on my fork:
dart:math
's RectangleMore information
These changes would break public contracts and therefore require some work on the flame_tiled plugin.
However I believe this would be minimal. I did not look into this further, but from what I changed this would only require converting Rect to Rectangle and casting ColorModel to Model, which is implemented in flutter_color_models.
I believe this would be worth it and I am prepared to submit PRs both here and in flame_tiled to make these rather simple changes. However if you would consider this to be too invasive, I am happy to just keep this as a fork!
The text was updated successfully, but these errors were encountered: