1
0
mirror of https://gitlab.com/comunic/comunicmobile synced 2025-06-19 08:15:16 +00:00

Start to update general settings

This commit is contained in:
2020-04-27 13:27:37 +02:00
parent ca1f94531f
commit 8f927e9f72
6 changed files with 271 additions and 3 deletions

View File

@ -10,6 +10,7 @@ class SingleInputDialog extends StatefulWidget {
final String label;
final bool Function(String) checkInput;
final String errorMessage;
final bool canBeEmpty;
const SingleInputDialog({
Key key,
@ -19,8 +20,8 @@ class SingleInputDialog extends StatefulWidget {
@required this.label,
@required this.checkInput,
@required this.errorMessage,
this.canBeEmpty = false,
}) : assert(title != null),
assert(icon != null),
assert(label != null),
assert(checkInput != null),
assert(errorMessage != null),
@ -34,7 +35,8 @@ class __InputURLDialogState extends State<SingleInputDialog> {
TextEditingController _controller;
bool get _isValid =>
_controller.text.isNotEmpty && widget.checkInput(_controller.text);
(_controller.text.isNotEmpty || widget.canBeEmpty) &&
widget.checkInput(_controller.text);
@override
void initState() {
@ -50,7 +52,7 @@ class __InputURLDialogState extends State<SingleInputDialog> {
controller: _controller,
onChanged: (s) => setState(() {}),
decoration: InputDecoration(
icon: Icon(widget.icon),
icon: widget.icon == null ? null : Icon(widget.icon),
alignLabelWithHint: true,
labelText: widget.label,
errorText: _controller.text.isNotEmpty && !_isValid