ffx 0.2.0 copy "ffx: ^0.2.0" to clipboard
ffx: ^0.2.0 copied to clipboard

ffx is a brand new life cycle + state management tool in flutter. It is intended to solve the templating problem written by StatefulWidget, simplify the code, and improve work efficiency.

example/example.dart

import 'package:ffx/ffx.dart';
import 'package:flutter/material.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'FFx Demo',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
        useMaterial3: true,
      ),
      home: FirstPage(),
    );
  }
}

class FirstPage extends XWidget {
  FirstPage({super.key});

  @override
  Widget build(BuildContext context) {
    final counter = x.remember(mutableIntStateOf(0));
    return Scaffold(
      appBar: AppBar(
        backgroundColor: x.theme.colorScheme.inversePrimary,
        title: const Text('FFx Demo'),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            Text(
              'You have pushed the button this many times:',
              style: x.theme.textTheme.headlineSmall,
            ),
            Text(
              '${counter.value}',
            ),
          ],
        ),
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: () {
          counter.value = counter.value + 1;
        },
        tooltip: 'Increment',
        child: const Icon(Icons.add),
      ), // This trailing comma makes auto-formatting nicer for build methods.
    );
  }
}
1
likes
120
points
30
downloads

Publisher

verified publisheraymtools.com

Weekly Downloads

ffx is a brand new life cycle + state management tool in flutter. It is intended to solve the templating problem written by StatefulWidget, simplify the code, and improve work efficiency.

Repository (GitHub)
View/report issues

Topics

#compose #function-widget #remember

Documentation

API reference

License

MIT (license)

Dependencies

an_lifecycle_cancellable, anlifecycle, cancellable, collection, flutter, weak_collections

More

Packages that depend on ffx