ng 2.0.0 copy "ng: ^2.0.0" to clipboard
ng: ^2.0.0 copied to clipboard

Micro-framework for the UI layer architecture. Opinionated, minimalistic, Dart/Flutter oriented and built from real problems and real projects.

example/lib/main.dart

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

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

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'NG Demo',
      home: CounterScreen(controller: CounterController()),
    );
  }
}

class CounterScreen extends NGView<CounterController> {
  CounterScreen({Key? key, required CounterController controller})
      : super(controller: controller, key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('Counter'),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            Text(
              'You have pushed the button this many times:',
            ),
            NG(
              controller.counter,
              (int counterValue) => Text(
                '$counterValue',
                style: Theme.of(context).textTheme.headline4,
              ),
            ),
          ],
        ),
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: controller.increment,
        tooltip: 'Increment',
        child: Icon(Icons.add),
      ),
    );
  }
}

class CounterController extends NGViewController {
  final counter = NGValue(0);

  void increment() => counter.value++;
}
7
likes
140
points
31
downloads

Publisher

verified publishernomtek.com

Weekly Downloads

Micro-framework for the UI layer architecture. Opinionated, minimalistic, Dart/Flutter oriented and built from real problems and real projects.

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

flutter

More

Packages that depend on ng