Giter Club home page Giter Club logo

xamarin.flutter's Introduction

ABANDONED: While this project is technically feasible, it's not feasible for a couple of developers in their spare time to finish. It was only meant as a proof of concept and has taken several months to reach its current status and it may even take several more to complete. As stated, this project was never expected to be commercially viable. Due to the effort remaining and no future for this project, it was decided it was not worth our time to complete.

Flutter for Xamarin

This project has no affiliation with Microsoft, Google or the Xamarin or Flutter teams.

This project is still under construction, and a full working version does not exist yet. We will let everyone know when we finally get things running end to end.

The project is designed to make the Flutter SDK available on the .NET Framework, initially with the supported platforms of:

  1. Xamarin.Android
  2. Xamarin.iOS
  3. UWP

There is no reason this couldn't also expand to any place where SkiaSharp is supported.

This project is never expected to be commercially viable, unless it is picked up or supported by a larger company. As it currently stands, this is just a fun side project, done by a bunch of developers in their spare time. We offer no support for solutions ever built with this framework, or any guarantee of completion.

Overview

To make this work, numerous components need to come together.

alt text

Transpiler

The transpiler, will convert the existing Flutter SDK (written in Dart) to C#, for consumption in .NET applications.

Using the DartAnalyzer, we analyze the Flutter SDK, and output C#.

Bindings

Flutter Bindings will include the connection between SkiaSharp and the Flutter SDK. We will not be using the actual Flutter engine, though we may do in the future.

Due to previous exploratory work, the Flutter engine is difficult to integrate with since we need to expose many C++ level APIs. Due to how this is implemented in the Flutter engine currently, it would require certain modifications and would be difficult to keep in sync with the master repository.

Hence, we will map the calls directly to SkiaSharp and Harfbuzz to draw directly on a SkiaCanvas. I could regret this, we shall see :)

Shell

The Shell, is where the Skia Canvas is initialized and platform level events are collected, and sent through to the Bindings project.

License

All code here is licensed under the MIT license

xamarin.flutter's People

Contributors

adamped avatar brainoffline avatar krdmllr avatar mihamarkic avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

xamarin.flutter's Issues

Project status, contribution?

I've been developing C#/Winforms for over 10 years now and recently i decided to switch to a more viable alternative so that i could code for mobile/desktop. Xamarin was a good option but sadly it lacks the UI buzz that Flutter has. Luckily, I found this project and i am so willing to invest time and effort into making this work along with you but I have some questions

  1. What part of Flutter does this project port? As far as I understand, You translated the Flutter SDK, which was built on top of Flutter Engine which in turn uses opengl, so that it uses SkiaSharp instead and runs on top of mono instead of dart.
  2. If the previous is true, You're building upon two pretty feature rich projects kinda uniting Xamarin's rich apis with Flutter's UI capabilities, doesn't this mean that this project is actually as complete as Flutter and Xamarin are?
  3. Now this one is important ๐Ÿ˜‚... Have you been able run Flutter animations?
  4. How much of the Flutter SDK could successfully be transpiled?

I am so excited to hear your thoughts about this.

DartReader: Code block parsing

Parse out the code inside methods, and give to the DartModel. This will include everything from variable assignments, if/else statements, switches, returns, operator assignments, other function calls.

CSharpWriter: Support for human-transpiled sections

I'm seeing a couple places where automated transpiling may be impossible (or at least require a full program analysis). For instance: flutter/lib/src/foundation/annotations.dart includes attributes, which in Dart are just regular classes. Without looking around the code for references to those attributes, there's no way to tell that those classes should be rewritten as C# attributes.

So either we can spend time on the transpiler implementing that full program analysis or we can just have a map file that says, "when you see this file, use this hand-transpiled C# file from over here instead."

Something like this:

{
  "handTranspiledFiles": [
    { "dartFile": "flutter/lib/src/foundation/annotations.dart", "handTranspiledFile": "handTranspiled/lib/src/foundation/annotations.cs" },
    ...
  ]
}

C# to Dart Transpiler

Hi Adam. It's nice to see your effort. I'm a newbie Xamarin developer, and have come across your website and there. And I have read about some flutter stuff. And I found something here. I found some C# to Dart transpiler tools.
Maybe if it could help this work. Good luck and keep up the good work Adam ๐Ÿ‘ :)

Client/Server architecture for stateful hot reload

So obviously this isn't the highest priority for version 1 given that the transpiler isn't complete, but I thought I'd bring it up in case planning for this feature might affect design decisions going forward.

Basically, state-full hot reload would be implemented using a client/server architecture whereby a server on the development machine watches for file changes and sends updates to the running flutter engine, which then dynamically recompiles views on the fly, preserving state.

This is similar to how livexaml and HotReload work. The tricky bit is dynamically recompiling views, given that they are now C# code and not xaml files. Perhaps in debug mode the whole app runs in interpreted mode and gets live reloaded? Can we use the mono interpreter?

CSharpWriter: covariant argument types

For example, see the AbstractNode class in the flutter sources.

How can it cross-compile these and retain type safety (or as much as possible with C#?). I thought maybe it could rewrite the class to use a covariant generic interface.

So for AbstractNode, for example, it would generate something like this interface (not sure if this would work):

    public interface INode {}
    public interface INode<out T> : INode
    {
        INode owner { get; } // had to loosen the type here, not sure if we can do better?
        INode<INode<T>> parent { get; }
        int depth { get; set; }
        bool attached { get; }

        void attach(INode owner);
        void redepthChildren();
        void detach();
    }

    public class AbstractNode<T> : INode<T> {
        ...etc... 
        protected void dropChild<TChild>(INode<TChild> child) { ...etc.. }
    }

CSharpWriter: Mixin creation

Create all mixin's as appropriate, including the method body implementations. Since Mixin's aren't available in C#, you will need to devise a method on how to implement them.

Errors running the transpiler

Just tried this yesterday. Got this error while running analyzer.dart:
C:\Users\JBell\Downloads\xamarin.flutter-master\xamarin.flutter-master\flutter\lib\src\packages\flutter_tools\lib\src\base\logger.dart Unhandled exception: NoSuchMethodError: The getter 'childEntities' was called on null. Receiver: null Tried calling: childEntities #0 Object.noSuchMethod (dart:core/runtime/libobject_patch.dart:50:5) #1 Implementation.processMethodInvocation (file:///C:/Users

Also got a few "ouch" messages along the way:

C:\Users\JBell\Downloads\xamarin.flutter-master\xamarin.flutter-master\flutter\lib\src\packages\flutter\lib\src\rendering\platform_view.dart
ouch
ouch
C:\Users\JBell\Downloads\xamarin.flutter-master\xamarin.flutter-master\flutter\lib\src\packages\flutter\lib\src\widgets\platform_view.dart
ouch
ouch

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.