Skip to main content

Flutter but Python

Project description

Flut (Technical Preview)

Flutter but Python

Status

This project is in Technical Preview (Alpha).

  • APIs are subject to change.
  • Requires manual build steps for the Flutter engine artifacts.
  • Not ready for production use.

Usage

Create a file app.py:

from flut import run_app
from flut.flutter.widgets import StatelessWidget, StatefulWidget, State, Text, Center, Column, Icon, MainAxisAlignment
from flut.flutter.material import MaterialApp, Scaffold, AppBar, FloatingActionButton, Icons, ThemeData, ColorScheme, Colors, Theme


class MyApp(StatelessWidget):
    def build(self, context):
        return MaterialApp(
            title="Flut Demo",
            theme=ThemeData(
                colorScheme=ColorScheme.fromSeed(seedColor=Colors.deepPurple),
            ),
            home=MyHomePage(title="Flut Demo Home Page"),
        )


class MyHomePage(StatefulWidget):
    def __init__(self, title):
        super().__init__()
        self.title = title

    def createState(self):
        return _MyHomePageState()


class _MyHomePageState(State[MyHomePage]):
    def initState(self):
        self._counter = 0

    def _incrementCounter(self):
        def _update():
            self._counter += 1

        self.setState(_update)

    def build(self, context):
        return Scaffold(
            appBar=AppBar(
                title=Text(self.widget.title),
                backgroundColor=Theme.of(context).colorScheme.inversePrimary,
            ),
            body=Center(
                child=Column(
                    mainAxisAlignment=MainAxisAlignment.center,
                    children=[
                        Text("You have pushed the button this many times:"),
                        Text(
                            f"{self._counter}",
                            style=Theme.of(context).textTheme.headlineMedium,
                        ),
                    ],
                ),
            ),
            floatingActionButton=FloatingActionButton(
                onPressed=self._incrementCounter,
                tooltip="Increment",
                child=Icon(Icons.add),
            ),
        )


if __name__ == "__main__":
    run_app(MyApp())

Run it:

python app.py

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

flut-0.0.0a3.tar.gz (307.1 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

flut-0.0.0a3-py3-none-win_amd64.whl (11.4 MB view details)

Uploaded Python 3Windows x86-64

flut-0.0.0a3-py3-none-manylinux1_x86_64.whl (15.2 MB view details)

Uploaded Python 3

flut-0.0.0a3-py3-none-macosx_10_14_universal2.whl (50.5 MB view details)

Uploaded Python 3macOS 10.14+ universal2 (ARM64, x86-64)

File details

Details for the file flut-0.0.0a3.tar.gz.

File metadata

  • Download URL: flut-0.0.0a3.tar.gz
  • Upload date:
  • Size: 307.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for flut-0.0.0a3.tar.gz
Algorithm Hash digest
SHA256 dc00595fbad47fd3e0c8524dfefae0316555c4938cd024791f13590f4482a506
MD5 056e4ec3abf49bbfbd93c6480b9d189d
BLAKE2b-256 757703b96a861d20b5555e614f14dc91d9a9ea8d5bff97bf90a041559f5f644a

See more details on using hashes here.

Provenance

The following attestation bundles were made for flut-0.0.0a3.tar.gz:

Publisher: publish.yml on yangyuan/flut

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file flut-0.0.0a3-py3-none-win_amd64.whl.

File metadata

  • Download URL: flut-0.0.0a3-py3-none-win_amd64.whl
  • Upload date:
  • Size: 11.4 MB
  • Tags: Python 3, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for flut-0.0.0a3-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 cacbcb4f292a0057b72ab8348c5d07541fa7d1f50cabf8398e336800711c9e4d
MD5 528e1dfa5f79548c17e1b9199451a81a
BLAKE2b-256 b09dadaa06a2f18af46cbc28527c6ecdfd19e391beccb078b74d5f9049fa8757

See more details on using hashes here.

Provenance

The following attestation bundles were made for flut-0.0.0a3-py3-none-win_amd64.whl:

Publisher: publish.yml on yangyuan/flut

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file flut-0.0.0a3-py3-none-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for flut-0.0.0a3-py3-none-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 a1bd67b19830b7a9332d09e5ac1fc4ecec7268a25a1851f2c9dfdf3ffc0d3ee8
MD5 272de8f7ee095c4c47980992f7e78f85
BLAKE2b-256 4d991e5ca2ea978d1954cb917780ea4ee8d00ef7376813a7d74138c44951e68e

See more details on using hashes here.

Provenance

The following attestation bundles were made for flut-0.0.0a3-py3-none-manylinux1_x86_64.whl:

Publisher: publish.yml on yangyuan/flut

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file flut-0.0.0a3-py3-none-macosx_10_14_universal2.whl.

File metadata

File hashes

Hashes for flut-0.0.0a3-py3-none-macosx_10_14_universal2.whl
Algorithm Hash digest
SHA256 cca1dc05076d1082c768f86b38707379a8b156219111a3294acc0785d96e60df
MD5 cd2d87d1a043f913792911130b9863cb
BLAKE2b-256 e67c5d90371c430325d5999a1c80f75ba564cedea4242c67c5d610a7990e7749

See more details on using hashes here.

Provenance

The following attestation bundles were made for flut-0.0.0a3-py3-none-macosx_10_14_universal2.whl:

Publisher: publish.yml on yangyuan/flut

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page