| 1234567891011121314151617181920212223242526272829303132333435363738 |
- import 'package:flutter/material.dart';
- import 'package:get/get.dart';
- void main() => runApp(GetMaterialApp(home: Gmus()));
- class Controller extends GetxController {
- var name = ''.obs;
- setName(String newName) {
- name.value = newName;
- }
- }
- class Gmus extends StatelessWidget {
- @override
- Widget build(BuildContext context) {
- final Controller controller = Get.put(Controller());
- return Scaffold(
- appBar: AppBar(
- title: Text('gmus'),
- ),
- body: Container(
- child: Column(
- children: [
- Obx(() => Text("Name: ${controller.name}")),
- TextField(
- onChanged: controller.setName,
- decoration: InputDecoration(
- border: InputBorder.none,
- hintText: 'Set name',
- ),
- ),
- ],
- ),
- ),
- );
- }
- }
|