atom_flutter 0.0.2 copy "atom_flutter: ^0.0.2" to clipboard
atom_flutter: ^0.0.2 copied to clipboard

A library that provides composable, reactive primitives for Flutter inspired by Signals and Runes.

example/lib/main.dart

// ignore_for_file: avoid_print

import 'package:example/counter.dart';
import 'package:example/themer.dart';
import 'package:flutter/material.dart';
import 'package:atom_flutter/atom_flutter.dart';

void main() => runApp(const App());

class App extends AtomWidget {
  const App({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: const HomePage(),
      theme: ThemeData(useMaterial3: true),
      darkTheme: ThemeData(useMaterial3: true, brightness: Brightness.dark),
      themeMode: themer.themeMode,
    );
  }
}

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

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: const Center(child: CounterText()),
      floatingActionButton: Column(
        mainAxisSize: MainAxisSize.min,
        mainAxisAlignment: MainAxisAlignment.end,
        crossAxisAlignment: CrossAxisAlignment.end,
        children: [
          FloatingActionButton(
            key: const Key('__increment_floating_action_button__'),
            onPressed: () => counter.increment(),
            child: const Icon(Icons.add),
          ),
          const SizedBox(height: 8),
          FloatingActionButton(
            key: const Key('__theme_floating_action_button__'),
            onPressed: () => themer.toggleTheme(),
            child: const Icon(Icons.brightness_1),
          ),
        ],
      ),
    );
  }
}

class CounterText extends AtomWidget {
  const CounterText({super.key});

  @override
  Widget build(BuildContext context) {
    return Text(
      '${counter.count}',
      style: Theme.of(context).textTheme.displayLarge,
    );
  }
}
5
likes
150
points
23
downloads

Publisher

unverified uploader

Weekly Downloads

A library that provides composable, reactive primitives for Flutter inspired by Signals and Runes.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

atom, flutter

More

Packages that depend on atom_flutter