-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add switch to disable URL validation
- Loading branch information
Showing
6 changed files
with
99 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
- add switch to disable URL validation in login mask |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:string_validator/string_validator.dart'; | ||
|
||
class AddressFormAdvanced extends StatelessWidget { | ||
final GlobalKey<FormState> _formKey; | ||
final Function(Uri) _onSave; | ||
|
||
AddressFormAdvanced(this._formKey, this._onSave); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Form( | ||
key: _formKey, | ||
autovalidateMode: AutovalidateMode.onUserInteraction, | ||
child: TextFormField( | ||
decoration: InputDecoration( | ||
labelText: "Fully qualified Nextcloud Server address...", | ||
icon: Icon(Icons.cloud_queue), | ||
helperStyle: TextStyle(color: Colors.orange), | ||
helperText: "Validation is disabled."), | ||
onSaved: (value) => _onSave(Uri.parse(rtrim(value, "/"))), | ||
initialValue: "https://", | ||
), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:string_validator/string_validator.dart'; | ||
|
||
class AddressFormSimple extends StatelessWidget { | ||
final GlobalKey<FormState> _formKey; | ||
final Function(Uri) _onSave; | ||
|
||
AddressFormSimple(this._formKey, this._onSave); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Form( | ||
key: _formKey, | ||
autovalidateMode: AutovalidateMode.onUserInteraction, | ||
child: TextFormField( | ||
decoration: InputDecoration( | ||
labelText: "Nextcloud Server address https://...", | ||
icon: Icon(Icons.cloud_queue)), | ||
onSaved: (value) => _onSave(Uri.parse('https://${rtrim(value, "/")}')), | ||
validator: (value) { | ||
if (value.startsWith("https://") || value.startsWith("http://")) { | ||
return "Https will be added automaically."; | ||
} | ||
return isURL("https://$value") ? null : "Please enter a valid URL."; | ||
}, | ||
), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters