Skip to content

Suggestion: Refactor "Your first app!" and Dart+Flutter Quick Start source code #341

Description

@brent-peripatetic-labs

I apologize if you are already aware of this.

I also apologize if this is what, in American English, we call "nitpicking."

I recommend that you modify the CLJD code in your "Your first app!" and "ClojureDart+Flutter Quick Start" examples to reflect the nesting of attributes found in canonical Flutter code.

To wit, instead of this:

(defn main []
  (f/run
    (m/MaterialApp
      .title "Welcome to Flutter"
      .theme (m/ThemeData .primarySwatch m.Colors/pink))
    .home
    (m/Scaffold
      .appBar (m/AppBar
                .title (m/Text "Welcome to ClojureDart")))
    .body
    m/Center
    (m/Text "Let's get coding!"
       .style (m/TextStyle
                .color m.Colors/red
                .fontSize 32.0))))

I recommend that you use this:

(defn main []
  (f/run
   (m/MaterialApp
    .title "Welcome to Flutter"
    .theme (m/ThemeData .primarySwatch m.Colors/pink)
    .home (m/Scaffold
           .appBar (m/AppBar .title (m/Text "Welcome to ClojureDart"))
           .body (m/Center .child (m/Text "Let's get coding!"
                                          .style (m/TextStyle
                                                  .color m.Colors/red
                                                  .fontSize 32.0)))))))

I will readily admit that through the power of CLJD, equivalent Dart code is emitted, regardless of whether the input is the current intro example or the version that I suggested which better reflects typical, valid Flutter code.

I recommend that you consider updating your docs just to make the transition from Dart/Flutter to ClojureDart/Flutter smoother for folks who might be confused by the altered nesting. ;-)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions