Created
October 4, 2021 18:07
-
-
Save brasizza/4b905eae11723f37d20a5b3ebf6e7760 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import 'package:flutter/material.dart'; | |
| import 'package:get/get.dart'; | |
| import 'package:hive_tutorial/app/data/models/task_model.dart'; | |
| import '../controllers/home_controller.dart'; | |
| class HomeView extends GetView<HomeController> { | |
| const HomeView({Key? key}) : super(key: key); | |
| @override | |
| Widget build(BuildContext context) { | |
| return Scaffold( | |
| appBar: AppBar( | |
| title: const Text('Another todo project (but with Getx+ Hive)'), | |
| centerTitle: true, | |
| ), | |
| body: Obx(() => ListView.separated( | |
| itemCount: controller.todoList.length, | |
| itemBuilder: (_, index) { | |
| final TaskModel _todo = controller.todoList[index]; | |
| return ListTile( | |
| title: Text(_todo.title), | |
| subtitle: Text(_todo.descritpion ?? ''), | |
| ); | |
| }, | |
| separatorBuilder: (_, __) => const Divider(), | |
| )), | |
| floatingActionButtonLocation: FloatingActionButtonLocation.endFloat, | |
| floatingActionButton: ElevatedButton( | |
| onPressed: () {}, | |
| child: const Icon( | |
| Icons.add, | |
| size: 30, | |
| ), | |
| ), | |
| ); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment