Added static method to the task model that returns a sample task model
This commit is contained in:
parent
1566310a02
commit
7d708f328a
3 changed files with 16 additions and 3 deletions
|
|
@ -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
|
@override
|
||||||
int get hashCode =>
|
int get hashCode =>
|
||||||
id.hashCode ^
|
id.hashCode ^
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
import '../models/task_model.dart';
|
||||||
import '../resources/authService.dart';
|
import '../resources/authService.dart';
|
||||||
import '../widgets/task_list_tile.dart';
|
import '../widgets/task_list_tile.dart';
|
||||||
|
|
||||||
|
|
@ -11,7 +12,7 @@ class HomeScreen extends StatelessWidget {
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
title: Text('Main Screen'),
|
title: Text('Main Screen'),
|
||||||
),
|
),
|
||||||
body: TaskListTile(),
|
body: TaskListTile(task: TaskModel.sample()),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,8 +8,6 @@ class TaskListTile extends StatelessWidget {
|
||||||
TaskListTile({@required this.task});
|
TaskListTile({@required this.task});
|
||||||
|
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
String getTaskPriority() {}
|
|
||||||
|
|
||||||
return FractionallySizedBox(
|
return FractionallySizedBox(
|
||||||
widthFactor: .9,
|
widthFactor: .9,
|
||||||
child: Container(
|
child: Container(
|
||||||
|
|
@ -28,6 +26,9 @@ class TaskListTile extends StatelessWidget {
|
||||||
bottomRight: Radius.circular(14),
|
bottomRight: Radius.circular(14),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
child: Center(
|
||||||
|
child: Text(task.getPriorityText()),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue