Giter Site home page Giter Site logo

Comments (4)

rafaelprev avatar rafaelprev commented on August 15, 2024

The code that is generated :

  %inline
  public export
  new : HasIO io => TextButton.New.NamedParameters -> io TextButton
  new  ps = primIO $ prim__dart_new TextButton [] ps

  %foreign "Dart:TextButton.styleFrom,package:flutter/material.dart"
  prim__styleFrom :  ->  -> PrimIO ButtonStyle

  export
  styleFrom : HasIO io =>  ->  -> io ButtonStyle
  styleFrom  = primIO $ prim__styleFrom 

from idris2dart.

rafaelprev avatar rafaelprev commented on August 15, 2024

If It can generate something like this, it can work

namespace TextButton
  export
  IsAssignableFrom Widget TextButton where

  namespace New
    data Tag : Type where

    %inline
    public export
    onPressed : Parameter TextButton.New.Tag
    onPressed = mkParameter "onPressed" (IO ())

    %inline
    public export
    style : Parameter TextButton.New.Tag
    style = mkParameter "style" ButtonStyle

    %inline
    public export
    child : Parameter TextButton.New.Tag
    child = mkParameter "child" Widget
    %inline
    public export
    NamedParameters : Type
    NamedParameters = Parameters [TextButton.New.onPressed, TextButton.New.style, TextButton.New.child]

  
  namespace StyleFrom
      data Tag : Type where

      %inline
      public export
      primary : Parameter StyleFrom.Tag
      primary = mkParameter "primary" Color

      %inline
      public export
      backgroundColor : Parameter StyleFrom.Tag
      backgroundColor = mkParameter "backgroundColor" Color

      %inline
      public export
      NamedParameters : Type
      NamedParameters = Parameters [StyleFrom.primary, StyleFrom.backgroundColor]


  %inline
  public export
  new : HasIO io => TextButton.New.NamedParameters -> io TextButton
  new  ps = primIO $ prim__dart_new TextButton [] ps

  %extern prim__dart_new : Type -> HVect positional -> Parameters named -> (1 x : %World) -> IORes ButtonStyle
  
  %inline
  public export
  styleFrom : TextButton.StyleFrom.NamedParameters -> IO ButtonStyle
  styleFrom  ps = primIO $ prim__dart_new (Struct "TextButton.styleFrom,package:flutter/material.dart" []) [] ps


from idris2dart.

rafaelprev avatar rafaelprev commented on August 15, 2024

I have a fix here @bamboo rafaelprev@50a35a5
But I'm not really satisfied with this fix, unless you want me to do a PR because its a small project or because you think its good enough, I will improve that solution on my fork

from idris2dart.

bamboo avatar bamboo commented on August 15, 2024

Hey @rafaelprev, thanks for the report, I'll take a look at this in the next couple of days.

from idris2dart.

Related Issues (7)

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.