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
Release history Release notifications | RSS feed
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.0a1.tar.gz
(295.9 kB
view details)
File details
Details for the file flut-0.0.0a1.tar.gz.
File metadata
- Download URL: flut-0.0.0a1.tar.gz
- Upload date:
- Size: 295.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fbd02e1cba1b56df9e1571feed34a5563525c79b8da2822398cb859fb9b4c784
|
|
| MD5 |
2774cf3a876501a9956147c71874c272
|
|
| BLAKE2b-256 |
4b343a7615f4d4455b483c9d7998beb85f50bc3f0ca3ba97ab29a07b47e7d4a3
|
Provenance
The following attestation bundles were made for flut-0.0.0a1.tar.gz:
Publisher:
publish.yml on yangyuan/flut
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
flut-0.0.0a1.tar.gz -
Subject digest:
fbd02e1cba1b56df9e1571feed34a5563525c79b8da2822398cb859fb9b4c784 - Sigstore transparency entry: 855007044
- Sigstore integration time:
-
Permalink:
yangyuan/flut@34294002927308d12b51cd134862eaddacd710a1 -
Branch / Tag:
refs/heads/master - Owner: https://github.com/yangyuan
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@34294002927308d12b51cd134862eaddacd710a1 -
Trigger Event:
workflow_dispatch
-
Statement type: