Giter Site home page Giter Site logo

devcarbon-com / flutter-mx Goto Github PK

View Code? Open in Web Editor NEW

This project forked from kennytilton/flutter-mx

0.0 0.0 0.0 7.19 MB

Flutter + ClojureDart, with Matrix Inside(tm)

License: MIT License

Shell 0.06% Ruby 0.43% C++ 5.30% C 0.23% Objective-C 0.01% Clojure 87.43% Kotlin 0.04% Dart 2.55% Swift 0.13% HTML 1.24% CMake 2.59%

flutter-mx's Introduction

Flutter/MX

Programming Flutter with ClojureDart and Matrix, a generic, fine-grained, transparent, reactive state manager.

Documentation

Please see our WIP Wiki, or just ping @kennytilton on the #clojurians or #fluttercommunity Slacks and we can pair to get you rolling.

Quick Start

If you just want to run the thing...

0. Prepare your ClojureDart working set-up, on Mac OS X

First, complete the ClojureDart "Flutter Quick Start". Help with that can be had in the #ClojureDart channel on the #Clojurians Slack. Or ping @kennytilton on that Slack or the Flutter Community Slack.

1. Clone this repo

git clone https://github.com/kennytilton/flutter-mx

2. Start a simulator. (Our focus so far has been mobile.)

In a terminal:

  • start a sim: open -a Simulator

You should see a Simulator appear. I get an iPhone 12 by default. Explore the open command for alternatives.

BEWARE! If you forget the step above to open a simulator, the next command will run for ages and open a tab in your browser. Close everything and start over.

3. Run the sample app.

In a terminal:

  • cd flutter-mx, or wherever you cloned it;

Next, we build the app and start a "watch" to rebuild when the source changes.

HEADS UP! This next command does not return. Use Control-C to kill the process when through exploring:

  • clj -M -m cljd.build flutter

After a few minutes (just the first time, thirty seconds on subsequent start-ups) you should see these last lines of output:

An Observatory debugger and profiler on iPhone 12 is available at: http://127.0.0.1:61081/v17dEYvUuuQ=/
The Flutter DevTools debugger and profiler on iPhone 12 is available at: http://127.0.0.1:9100?uri=http://127.0.0.1:61081/v17dEYvUuuQ=/

Now check the simulator you opened earlier. You should see our "hello, world" app in the sim:

FMX Hello World screenshot

Mr. Kernighan co-authored "The C Programming Language" with Dennis Ritchie, and contributed the bit on "hello, world".

The code for our hello-world is here.

4. Running other examples.

To try a different example:

  1. Edit main.cljd and change the namespace hello in (hello/make-app) to one of the namespaces listed above in the NS requires. Try counter to see the standard Flutter Counter app, or todo to see the TodoMVC classic.
  2. Save your changes.
  3. Now switch back to the "watch" terminal and wait a few seconds until you see that the app has been rebuilt.
  4. Now hit RETURN.
  5. Check the sim to see the new app.

5. More on the Flutter/MX version of TodoMVC

Here is a TodoMVC medium screenshot:

f/mx TodoMVC screenshot

Our TodoMVC extends the official spec to include a bit of async handling, in the form of an XHR request: we require an async XHR lookup of the text of a ToDo against the OpenFDA Adverse Events registry. If the lookup succeeds, the text color of the Todo must be set to red. There is no point to this, except as a demonstration of how to make a non-reactive API such as XHR reactive, thus handling async gracefully.

Well, it also demonstrates the power of reactive programming: if we change a ToDo item, a new lookup is triggered automatically, and the text color gets reconsidered automatically once the new lookup responds.

Workflow

Here is how I work. We will extend this section greatly as we help others get started on Matrix:

  • start with the above;
  • edit this project in IntelliJ+Cursive, with the Flutter plug-in installed;
    • IMPORTANT: tell IntelliJ to use clj formatting for .cljd files; more Cursive support is on the way;
  • after making changes, I save in IntelliJ and look at the "build" terminal for errors;
  • if all is well, I switch to the terminal and just hit ENTER to see the changed app;
  • if I am curious about some CLJD issue, such as how to run the Math abs method, I do this:
    • add snippets of code to the main function, after the test suite runner;
    • save;
    • check the "build" for errors;
    • switch to the build terminal and hit Return to trigger a sim reload;
    • check the Flutter console for print output.

Ping @kennytilton on #clojurians or #fluttercommunity Slack for help!

flutter-mx's People

Contributors

kennytilton avatar

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.