Skip to content

Instantly share code, notes, and snippets.

@velotiotech
Created July 6, 2022 07:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save velotiotech/79ea2c811b70b0f49ad0e771adb2b235 to your computer and use it in GitHub Desktop.
Save velotiotech/79ea2c811b70b0f49ad0e771adb2b235 to your computer and use it in GitHub Desktop.
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:get/get.dart';
import 'package:sprinkle_architecture_exp_2/views/counter_page_controller.dart';
class CounterPage extends GetWidget<CounterPageController> {
const CounterPage({Key? key, required this.title}) : super(key: key);
final String title;
CounterPageController get c => Get.put(CounterPageController());
@override
Widget build(BuildContext context) {
return Obx(() {
return Scaffold(
appBar: AppBar(title: Text(title)),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
const Text('You have pushed the button this many times:'),
Text('${c.manager.getCounter}',
style: Theme.of(context).textTheme.headline4),
],
),
),
floatingActionButton: FloatingActionButton(
onPressed: c.manager.increment,
tooltip: 'Increment',
child: const Icon(Icons.add),
),
);
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment