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();
|
setCurrentUser();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setText(String newText) {
|
||||||
|
text = newText;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setPriority(TaskPriority newPriority) {
|
||||||
|
priority = newPriority;
|
||||||
|
}
|
||||||
|
|
||||||
Future<void> setCurrentUser() async {
|
Future<void> setCurrentUser() async {
|
||||||
final user = await _auth.currentUser;
|
final user = await _auth.currentUser;
|
||||||
currentUser = user;
|
currentUser = user;
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,7 @@ class _NewTaskScreenState extends State<NewTaskScreen> {
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
BigTextInput(
|
BigTextInput(
|
||||||
height: 95,
|
height: 95,
|
||||||
|
onChanged: bloc.setText,
|
||||||
),
|
),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: 15,
|
height: 15,
|
||||||
|
|
@ -45,7 +46,7 @@ class _NewTaskScreenState extends State<NewTaskScreen> {
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: 15,
|
height: 15,
|
||||||
),
|
),
|
||||||
buildPrioritySelectorSection(),
|
buildPrioritySelectorSection(bloc),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: 20,
|
height: 20,
|
||||||
),
|
),
|
||||||
|
|
@ -90,7 +91,7 @@ class _NewTaskScreenState extends State<NewTaskScreen> {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget buildPrioritySelectorSection() {
|
Widget buildPrioritySelectorSection(NewTaskBloc bloc) {
|
||||||
return Row(
|
return Row(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Text(
|
Text(
|
||||||
|
|
@ -99,7 +100,7 @@ class _NewTaskScreenState extends State<NewTaskScreen> {
|
||||||
),
|
),
|
||||||
Spacer(),
|
Spacer(),
|
||||||
PrioritySelector(
|
PrioritySelector(
|
||||||
onChage: (priority) {},
|
onChage: bloc.setPriority,
|
||||||
width: 230,
|
width: 230,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|
|
||||||
|
|
@ -4,8 +4,10 @@ class BigTextInput extends StatelessWidget {
|
||||||
final double height;
|
final double height;
|
||||||
final double width;
|
final double width;
|
||||||
final bool elevated;
|
final bool elevated;
|
||||||
|
final Function(String) onChanged;
|
||||||
|
|
||||||
BigTextInput({
|
BigTextInput({
|
||||||
|
@required this.onChanged,
|
||||||
this.height,
|
this.height,
|
||||||
this.width,
|
this.width,
|
||||||
this.elevated = true,
|
this.elevated = true,
|
||||||
|
|
@ -27,6 +29,7 @@ class BigTextInput extends StatelessWidget {
|
||||||
borderRadius: BorderRadius.circular(8.0),
|
borderRadius: BorderRadius.circular(8.0),
|
||||||
),
|
),
|
||||||
child: TextField(
|
child: TextField(
|
||||||
|
onChanged: onChanged,
|
||||||
maxLines: 3,
|
maxLines: 3,
|
||||||
maxLength: 220,
|
maxLength: 220,
|
||||||
maxLengthEnforced: true,
|
maxLengthEnforced: true,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue