Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import 'package:flutter/material.dart';
- import 'package:get/get.dart';
- void main() => runApp(GetMaterialApp(home: Home()));
- class Home extends StatelessWidget {
- final c = Get.put(Controller());
- @override
- Widget build(context) {
- ever(c.count, (_) {
- Get.defaultDialog(title: 'Show Dialog', middleText: 'Dialog ke ${c.count}', textCancel: 'Tutup');
- });
- return Scaffold(
- body: Center(child: Obx(() => Text("Clicks: ${c.count}", style: TextStyle(fontSize: 24)))),
- floatingActionButton: FloatingActionButton(child: Icon(Icons.add), onPressed: c.increment),
- );
- }
- }
- class Controller extends GetxController {
- var count = 0.obs;
- void increment() => count++;
- }
Add Comment
Please, Sign In to add comment