Flitter

A powerful framework inspired by Flutter, supporting both SVG and Canvas to...

README

Flitter


Flitter is a powerful framework inspired by Flutter, supporting both SVG and Canvas to create high-performance graphics and user interfaces. It is designed to easily implement complex data visualizations, interactive charts, diagrams, and graphic editors in web applications.


Key Features


- Render Object Tree: Flitter uses a render object tree for efficient rendering, allowing easy management and manipulation of complex layouts.

- Declarative Programming: Following a declarative paradigm, the screen automatically updates when values change, simplifying application state management.

- Optimized Rendering: Re-rendering, painting, and layout recalculations are managed by the renderer pipeline, with optimizations applied to update only necessary parts.

- Box Model Layout: Users can easily compose layouts using the familiar Box model.

- SVG and Canvas Support: Supports both SVG and Canvas, meeting various graphic requirements. Developers can choose the appropriate renderer as needed.

- Diverse Applications: Can be utilized in various fields such as charts, diagrams, data visualization, and graphic editors.

Showcase

Here are some examples of what you can create with Flitter:
Interactive ERD (Entity-Relationship Diagram)[https://easyrd.dev]

Interactive ERD

This interactive ERD demonstrates Flitter's capability to create complex, interactive diagrams. Users can manipulate entities, add relationships, and visualize database structures in real-time. This showcase highlights Flitter's strengths in:

Creating responsive, draggable elements
Handling complex user interactions
Rendering intricate diagrams with ease
Real-time updates based on user input

Installation Guide


Flitter can be used in various JavaScript environments. Here are installation and usage methods for major environments:

Pure JavaScript


  1. ```bash
  2. npm install @meursyphus/flitter
  3. ```

  1. ```javascript
  2. import { Widget, Container, AppRunner } from '@meursyphus/flitter';

  3. // Using SVG renderer
  4. const svgElement = document.getElementById('mySvg');
  5. const svgRunner = new AppRunner({ view: svgElement });
  6. svgRunner.runApp(Container({ color: 'lightblue' }));

  7. // Using Canvas renderer
  8. const canvasElement = document.getElementById('myCanvas');
  9. const canvasRunner = new AppRunner({ view: canvasElement });
  10. canvasRunner.runApp(Container({ color: 'lightgreen' }));
  11. ```

React


  1. ```bash
  2. npm install @meursyphus/flitter @meursyphus/flitter-react
  3. ```

  1. ```jsx
  2. import { Container, Alignment, Text, TextStyle } from '@meursyphus/flitter';
  3. import Widget from '@meursyphus/flitter-react';

  4. const App = () => (
  5.   <>
  6.     <Widget
  7.       width="600px"
  8.       height="300px"
  9.       renderer="svg"
  10.       widget={Container({
  11.         alignment: Alignment.center,
  12.         color: 'lightblue',
  13.         child: Text("Hello, Flitter SVG!", { style: TextStyle({ fontSize: 30, weight: 'bold' }) })
  14.       })}
  15.     />
  16.     <Widget
  17.       width="600px"
  18.       height="300px"
  19.       renderer="canvas"
  20.       widget={Container({
  21.         alignment: Alignment.center,
  22.         color: 'lightgreen',
  23.         child: Text("Hello, Flitter Canvas!", { style: TextStyle({ fontSize: 30, weight: 'bold' }) })
  24.       })}
  25.     />
  26.   </>
  27. );
  28. ```