FStudio

Flutter Studio

  • Split UI and logic, and provide connection to each other.
  • Easy state management with auto disposal.

Getting started

Example:

import 'package:fstudio/fstudio.dart';
import 'home-page-logic.dart';

class HomePage extends FPage<HomePageLogic> {
  HomePage({Key? key}) : super(key: key) {
    setLogic(HomePageLogic());
  }

  @override
  Widget buildLayout(BuildContext context) {
    return Scaffold(
      key: logic.scaffoldKey,
      appBar: AppBar(
        title: Text('Home'),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            const Text('You have pushed the button this many times:'),
            logic.countPipe.onUpdate((val) => Text(
              '$val',
              style: Theme.of(context).textTheme.headline4,
            )),
          ],
        ),
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: logic.onClickAdd,
        tooltip: 'Increment',
        child: const Icon(Icons.add),
      ),
    );
  }
}
import 'package:fstudio/fstudio.dart';
import 'home-page.dart';
import 'info-page.dart';

class HomePageLogic extends FPageLogic<HomePage> {
  late FPipe<int> countPipe;

  HomePageLogic() {
    countPipe = FPipe(initValue: 0, disposer: disposer);
  }

  @override
  void initState() {}

  @override
  void onBuildLayout() {}

  @override
  void onLayoutLoaded() {}

  void onClickAdd() async {
    countPipe.update(countPipe.value + 1);
    if (countPipe.value == 3) {
      countPipe.update(0);
      var value = await pageOpen<int>(InfoPage());
    }
  }
}

Contributions

Feel free to contribute to this project.

If you find a bug or want a feature, but don't know how to fix/implement it, please fill an issue.
If you fixed a bug or implemented a feature, please send a pull request.