Added methods to allow the new task screen to update the blocs properties, revised
This commit is contained in:
parent
4db0ab4e53
commit
43cae32cf1
3 changed files with 15 additions and 3 deletions
|
|
@ -18,6 +18,14 @@ class NewTaskBloc {
|
|||
setCurrentUser();
|
||||
}
|
||||
|
||||
void setText(String newText) {
|
||||
text = newText;
|
||||
}
|
||||
|
||||
void setPriority(TaskPriority newPriority) {
|
||||
priority = newPriority;
|
||||
}
|
||||
|
||||
Future<void> setCurrentUser() async {
|
||||
final user = await _auth.currentUser;
|
||||
currentUser = user;
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ class _NewTaskScreenState extends State<NewTaskScreen> {
|
|||
children: <Widget>[
|
||||
BigTextInput(
|
||||
height: 95,
|
||||
onChanged: bloc.setText,
|
||||
),
|
||||
SizedBox(
|
||||
height: 15,
|
||||
|
|
@ -45,7 +46,7 @@ class _NewTaskScreenState extends State<NewTaskScreen> {
|
|||
SizedBox(
|
||||
height: 15,
|
||||
),
|
||||
buildPrioritySelectorSection(),
|
||||
buildPrioritySelectorSection(bloc),
|
||||
SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
|
|
@ -90,7 +91,7 @@ class _NewTaskScreenState extends State<NewTaskScreen> {
|
|||
);
|
||||
}
|
||||
|
||||
Widget buildPrioritySelectorSection() {
|
||||
Widget buildPrioritySelectorSection(NewTaskBloc bloc) {
|
||||
return Row(
|
||||
children: <Widget>[
|
||||
Text(
|
||||
|
|
@ -99,7 +100,7 @@ class _NewTaskScreenState extends State<NewTaskScreen> {
|
|||
),
|
||||
Spacer(),
|
||||
PrioritySelector(
|
||||
onChage: (priority) {},
|
||||
onChage: bloc.setPriority,
|
||||
width: 230,
|
||||
),
|
||||
],
|
||||
|
|
|
|||
|
|
@ -4,8 +4,10 @@ class BigTextInput extends StatelessWidget {
|
|||
final double height;
|
||||
final double width;
|
||||
final bool elevated;
|
||||
final Function(String) onChanged;
|
||||
|
||||
BigTextInput({
|
||||
@required this.onChanged,
|
||||
this.height,
|
||||
this.width,
|
||||
this.elevated = true,
|
||||
|
|
@ -27,6 +29,7 @@ class BigTextInput extends StatelessWidget {
|
|||
borderRadius: BorderRadius.circular(8.0),
|
||||
),
|
||||
child: TextField(
|
||||
onChanged: onChanged,
|
||||
maxLines: 3,
|
||||
maxLength: 220,
|
||||
maxLengthEnforced: true,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue