Added validation for the new task screen
This commit is contained in:
parent
0901688163
commit
213c244553
3 changed files with 41 additions and 18 deletions
|
|
@ -1,3 +1,5 @@
|
|||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import './models/task_model.dart';
|
||||
|
||||
|
|
@ -37,3 +39,15 @@ Color getColorFromPriority(TaskPriority priority) {
|
|||
return Colors.white;
|
||||
}
|
||||
}
|
||||
|
||||
class Validators {
|
||||
final validateStringNotEmpty = StreamTransformer<String, String>.fromHandlers(
|
||||
handleData: (String string, EventSink<String> sink) {
|
||||
if (string.isEmpty) {
|
||||
sink.addError('Text cannot be empty');
|
||||
} else {
|
||||
sink.add(string);
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue