Added static method to the task model that returns a sample task model

This commit is contained in:
Mariano Uvalle 2019-03-11 23:55:02 -06:00
parent 1566310a02
commit 7d708f328a
3 changed files with 16 additions and 3 deletions

View file

@ -51,6 +51,17 @@ class TaskModel {
}
}
static TaskModel sample() {
return TaskModel(
id: '1',
text: 'A task',
done: false,
ownerUsername: 'testUser',
event: 'testEvent',
priority: 1,
);
}
@override
int get hashCode =>
id.hashCode ^

View file

@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import '../models/task_model.dart';
import '../resources/authService.dart';
import '../widgets/task_list_tile.dart';
@ -11,7 +12,7 @@ class HomeScreen extends StatelessWidget {
appBar: AppBar(
title: Text('Main Screen'),
),
body: TaskListTile(),
body: TaskListTile(task: TaskModel.sample()),
);
}
}

View file

@ -8,8 +8,6 @@ class TaskListTile extends StatelessWidget {
TaskListTile({@required this.task});
Widget build(BuildContext context) {
String getTaskPriority() {}
return FractionallySizedBox(
widthFactor: .9,
child: Container(
@ -28,6 +26,9 @@ class TaskListTile extends StatelessWidget {
bottomRight: Radius.circular(14),
),
),
child: Center(
child: Text(task.getPriorityText()),
),
),
)
],