flutter_widget_model 0.5.1+21 copy "flutter_widget_model: ^0.5.1+21" to clipboard
flutter_widget_model: ^0.5.1+21 copied to clipboard

discontinued
outdated

Package that allows you to treat your models like widgets. Used with [flutter_hooks].

example/main.dart

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

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends HookWidget {
  MyHomePage({Key key, this.title}) : super(key: key);

  final String title;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(title),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            Text(
              'You have pushed the button this many times:',
            ),
            Text(
              DataFieldModel("count").getInt(0).toString(),
              style: Theme.of(context).textTheme.display1,
            ),
          ],
        ),
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: () => DataFieldModel("count").increment(),
        tooltip: 'Increment',
        child: Icon(Icons.add),
      ),
    );
  }
}
1
likes
0
points
5
downloads

Publisher

unverified uploader

Weekly Downloads

Package that allows you to treat your models like widgets. Used with [flutter_hooks].

Homepage
Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter, flutter_hooks, loading_animations, masamune_core

More

Packages that depend on flutter_widget_model