{"id":357325,"date":"2024-05-20T23:48:26","date_gmt":"2024-05-20T23:48:26","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=357325"},"modified":"-0001-11-30T00:00:00","modified_gmt":"2024-05-20T23:48:26","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=357325","title":{"rendered":"<span>\u0420\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u044b\u0435 \u0444\u043e\u0440\u043c\u044b \u0432\u043e Flutter: \u043a\u0430\u043a \u0434\u0435\u043b\u0430\u0442\u044c \u0444\u043e\u0440\u043c\u044b \u0441 \u043c\u0435\u043d\u044c\u0448\u0438\u043c\u0438 \u0442\u0440\u0443\u0434\u043e\u0437\u0430\u0442\u0440\u0430\u0442\u0430\u043c\u0438<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0412 \u044d\u0442\u043e\u043c \u043f\u043e\u0441\u0442\u0435 \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u043e \u0440\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u044b\u0445 \u0444\u043e\u0440\u043c\u0430\u0445 \u0432\u043e Flutter \u0438 \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u0434\u0435\u043b\u0430\u0442\u044c \u0444\u043e\u0440\u043c\u044b \u0441 \u043c\u0435\u043d\u044c\u0448\u0438\u043c\u0438 \u0442\u0440\u0443\u0434\u043e\u0437\u0430\u0442\u0440\u0430\u0442\u0430\u043c\u0438 \u0432 \u0446\u0435\u043b\u043e\u043c. \u041d\u0430\u0447\u043d\u0443 \u0441 \u043e\u0431\u044b\u0447\u043d\u044b\u0445 \u0444\u043e\u0440\u043c \u0438 \u0438\u0445 \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u0432\u043e Flutter, \u0437\u0430\u0442\u0435\u043c \u043f\u0435\u0440\u0435\u0439\u0434\u0443 \u043a \u0440\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u044b\u043c \u0444\u043e\u0440\u043c\u0430\u043c, \u0438\u0445 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044e \u0438 \u043f\u043e\u0434\u0432\u0435\u0434\u0443 \u0438\u0442\u043e\u0433\u0438.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/488\/4ce\/593\/4884ce593bd1480fc84228a7bab2a148.jpg\" width=\"800\" height=\"450\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/488\/4ce\/593\/4884ce593bd1480fc84228a7bab2a148.jpg\" data-blurred=\"true\"\/><\/figure>\n<p>\u0412\u043e Flutter \u044f \u043d\u0430\u0447\u0438\u043d\u0430\u043b \u0441 \u043e\u0431\u044b\u0447\u043d\u044b\u0445 \u0444\u043e\u0440\u043c. \u041f\u043e\u043b\u0443\u0447\u0430\u043b\u043e\u0441\u044c \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u043c\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0435\u0449\u0435 \u0438 \u0434\u0443\u0431\u043b\u0438\u0440\u043e\u0432\u0430\u043b\u0441\u044f. \u041f\u043e\u0442\u043e\u043c \u043f\u0440\u043e\u0431\u043e\u0432\u0430\u043b \u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u0438 \u0444\u043e\u0440\u043c\u044b \u0441 \u043d\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435\u043c \u043c\u043e\u0434\u0435\u043b\u0438 \u043f\u043e onChange: \u0441\u0442\u0430\u043b\u043e \u043b\u0443\u0447\u0448\u0435, \u043d\u043e \u0432\u0441\u0451 \u0440\u0430\u0432\u043d\u043e \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0445\u043e\u0440\u043e\u0448\u043e. \u0411\u044b\u043b\u043e \u0443\u0434\u0438\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e, \u043a\u0430\u043a \u043c\u043d\u043e\u0433\u043e \u043e\u0434\u043d\u043e\u0442\u0438\u043f\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u043b\u043e\u0441\u044c \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430.<\/p>\n<pre><code class=\"dart\">class MyCustomFormState extends State &lt;MyCustomForm> {    final _formKey = GlobalKey&lt;FormState>();    @override   Widget build(BuildContext context) {     return Form(       key: _formKey,       child: const Column(         children: &lt;Widget>[           \/\/ Add TextFormFields and ElevatedButton here.         ],       ),     );   } }<\/code><\/pre>\n<p>\u0412\u043e\u0442 \u043f\u0440\u0438\u043c\u0435\u0440 \u043e\u0431\u044b\u0447\u043d\u043e\u0439 \u0444\u043e\u0440\u043c\u044b. \u041c\u044b \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u0444\u043e\u0440\u043c\u0443, \u043f\u0440\u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c formKey \u0438 \u0434\u0430\u043b\u044c\u0448\u0435 \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u044f\u0435\u043c \u0432\u0438\u0434\u0436\u0435\u0442\u044b. \u0412\u043e\u0442, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432\u0438\u0434\u0436\u0435\u0442 TextFormField:<\/p>\n<pre><code class=\"dart\">TextFormField(   validator: (value) {     if (value == null || value.isEmpty) {       return 'Please enter some text';     }     return null;   }, ),<\/code><\/pre>\n<p>\u0417\u0434\u0435\u0441\u044c \u0443 \u043d\u0430\u0441 \u043f\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f inline-\u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044f \u2014 \u0438 \u044d\u0442\u043e \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430, \u0445\u043e\u0442\u044f \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044e \u0438 \u043c\u043e\u0436\u043d\u043e \u0441\u043f\u0440\u044f\u0442\u0430\u0442\u044c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e \u0432 \u0444\u0430\u0439\u043b \u0438\u043b\u0438 \u043c\u0435\u0442\u043e\u0434.<\/p>\n<pre><code class=\"dart\">ElevatedButton(   onPressed: () {     if (_formKey.currentState!.validate()) {       ScaffoldMessenger.of(context).showSnackBar(         const SnackBar(content: Text('Processing Data')),       );     }   },   child: const Text('Submit'), ),<\/code><\/pre>\n<p>\u0412 \u044d\u0442\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043c\u044b \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c, \u0432\u0430\u043b\u0438\u0434\u043d\u044b \u043b\u0438 \u0444\u043e\u0440\u043c\u044b (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u043e \u043a\u043b\u0438\u043a\u0443 \u043d\u0430 \u043a\u043d\u043e\u043f\u043a\u0443), \u0438 \u043f\u043e\u0442\u043e\u043c \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u043a\u0430\u043a\u0438\u0435-\u0442\u043e \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f. \u0412\u0441\u0451 \u0431\u0443\u0434\u0442\u043e \u0431\u044b \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e, \u043d\u043e \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u043e\u0441\u0442\u043e \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0434\u0432\u0430 \u043f\u043e\u043b\u044f \u043d\u0430 \u0431\u044d\u043a\u0435\u043d\u0434, \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u043f\u0440\u043e\u043f\u0438\u0441\u0430\u0442\u044c \u0434\u0432\u0430 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430, \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438\u0445 \u0438 \u043d\u0435 \u0437\u0430\u0431\u044b\u0442\u044c dispose. \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u043d\u0435\u043c\u0430\u043b\u043e \u043a\u043e\u0434\u0430:<\/p>\n<pre><code class=\"dart\">class _HomePageState extends State&lt;HomePage> {   final _formKey = GlobalKey&lt;FormState>();    late final TextEditingController _emailController;   late final TextEditingController _passwordController;    @override   void initState() {     super. initState();     _emailController = TextEditingController();     _passwordController = TextEditingController();   }    @override   void dispose() {     _emailController.dispose();     _passwordController.dispose();     super.dispose();   }<\/code><\/pre>\n<p>\u0415\u0441\u043b\u0438 \u0432\u0430\u0448\u0430 \u0444\u043e\u0440\u043c\u0430 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0445\u043e\u0442\u044f \u0431\u044b 5-10 \u043f\u043e\u043b\u0435\u0439, \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0434\u0438\u043a\u043e\u0432\u0430\u0442\u043e. \u0418\u0442\u043e\u0433\u043e\u0432\u044b\u0439 \u0441\u043f\u0438\u0441\u043e\u043a \u043f\u0440\u043e\u0431\u043b\u0435\u043c:<\/p>\n<ul>\n<li>\n<p>\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0432\u0441\u044e \u0444\u043e\u0440\u043c\u0443 \u0441\u0440\u0430\u0437\u0443 \u2014 \u043d\u0430\u0434\u043e \u0434\u043e\u0441\u0442\u0430\u0432\u0430\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0441 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430, \u043f\u0440\u0438 \u0431\u043e\u043b\u044c\u0448\u043e\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u043e\u043b\u0435\u0439 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u0441\u043b\u043e\u0436\u043d\u043e.<\/p>\n<\/li>\n<li>\n<p>\u041d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u044b.<\/p>\n<\/li>\n<li>\n<p>\u041d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c inline-\u043a\u043e\u0434 \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0438.<\/p>\n<\/li>\n<li>\n<p>\u041d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c onChanged \u0438 onSave \u043a\u043e\u043b\u0431\u044d\u043a\u0438, \u0447\u0442\u043e\u0431\u044b \u043d\u0430\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u044c.<\/p>\n<\/li>\n<li>\n<p>\u041d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c dispose \u0434\u043b\u044f \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u043e\u0432.<\/p>\n<\/li>\n<\/ul>\n<h3>\u0420\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u044b\u0435 \u0444\u043e\u0440\u043c\u044b<\/h3>\n<p>\u0410\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u2014 \u044d\u0442\u043e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 <a href=\"https:\/\/pub.dev\/packages\/reactive_forms\"><u>reactive_forms<\/u><\/a>, \u0432\u043e \u043c\u043d\u043e\u0433\u043e\u043c \u0441\u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0430\u044f \u0438\u0437 Angular. \u0415\u0441\u043b\u0438 \u0432\u044b \u0431\u0443\u0434\u0435\u0442\u0435 \u0433\u0443\u0433\u043b\u0438\u0442\u044c \u0440\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u044b\u0435 \u0444\u043e\u0440\u043c\u044b, \u0442\u043e \u0441\u043d\u0430\u0447\u0430\u043b\u0430, \u0441\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e, \u043f\u043e\u043f\u0430\u0434\u0435\u0442\u0435 \u043d\u0430 \u0440\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u044b\u0435 \u0444\u043e\u0440\u043c\u044b Angular, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0445\u043e\u0440\u043e\u0448\u043e \u0437\u0430\u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u043e\u0432\u0430\u043b\u0438 \u0441\u0435\u0431\u044f \u043d\u0430 \u0444\u0440\u043e\u043d\u0442\u0435\u043d\u0434\u0435.\u00a0<\/p>\n<pre><code class=\"dart\">class LoginFormState extends State&lt;LoginForm> {    final form = FormGroup ({     'email': FormControl&lt;String>(       validators: [         Validators.required,         Validators.email       ]),     'password': FormControl&lt;String>(       validators: [         Validators.required       ]),   }); }<\/code><\/pre>\n<p>\u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0440\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u044b\u0445 \u0444\u043e\u0440\u043c \u043f\u0440\u043e\u0441\u0442\u0430: \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0433\u0440\u0443\u043f\u043f\u0443 FormGroup \u0438 \u0432 \u043d\u0435\u0439 FormControl \u2014 \u044d\u0442\u043e \u043f\u043e\u043b\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0432\u043b\u043e\u0436\u0438\u0442\u044c \u0432 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 Map. \u0415\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u0438\u043c\u0435\u0435\u0442\u0441\u044f \u043a\u0430\u043a\u0430\u044f-\u0442\u043e \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u044c \u0432 \u0432\u0438\u0434\u0435 \u043c\u0430\u0441\u0441\u0438\u0432\u0430, \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c FormArray \u0432\u043c\u0435\u0441\u0442\u043e FormGroup, \u0438 \u0442\u0430\u043c \u0443\u0436\u0435 \u0431\u0443\u0434\u0443\u0442 \u0441\u0432\u043e\u0438 \u043c\u0435\u0442\u043e\u0434\u044b.<\/p>\n<p>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0444\u043e\u0440\u043c\u044b \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u2014 \u0447\u0435\u0440\u0435\u0437 setState \u0438\u043b\u0438 \u0434\u0440\u0443\u0433\u0438\u043c \u043f\u0440\u0438\u0432\u044b\u0447\u043d\u044b\u043c \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u043c:<\/p>\n<pre><code class=\"dart\">this.form.value = {   'name': 'John',   'email': 'john@email.com', };<\/code><\/pre>\n<p>\u0423 reactive_forms \u0435\u0441\u0442\u044c \u0441\u0432\u043e\u0438 \u043e\u0431\u0435\u0440\u0442\u043a\u0438 \u0434\u043b\u044f \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u0432\u0438\u0434\u0436\u0435\u0442\u043e\u0432 \u0438 \u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a. \u041c\u043e\u0436\u043d\u043e \u043e\u0431\u0435\u0440\u043d\u0443\u0442\u044c \u0438 \u0441\u0432\u043e\u0438 \u0432\u0438\u0434\u0436\u0435\u0442\u044b. \u041f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0438 \u0432\u0438\u0434 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0445 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043e\u0432 \u043d\u0435 \u043c\u0435\u043d\u044f\u044e\u0442\u0441\u044f, \u043e\u043d\u0438 \u043f\u0440\u043e\u0441\u0442\u043e \u0440\u0430\u0441\u0448\u0438\u0440\u044f\u044e\u0442\u0441\u044f \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u043c\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u043c\u0438, \u0447\u0442\u043e\u0431\u044b \u0432\u0441\u0451 \u0440\u0430\u0431\u043e\u0442\u0430\u043b\u043e.<\/p>\n<pre><code class=\"dart\">@override Widget build(BuildContext context) {   return ReactiveForm(     formGroup: this.form,     child: Column(       children: &lt;Widget> [         ReactiveTextField(           formControlName: 'email'         ),         ReactiveTextField(           formControlName: 'password',           obscureText: true,         ),       ],     ),   ); }<\/code><\/pre>\n<p>\u0412 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043c\u044b \u0432\u0438\u0434\u0438\u043c, \u0447\u0442\u043e formControlName \u2014 \u044d\u0442\u043e \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u043f\u043e\u043b\u0435, \u0433\u0434\u0435 \u043c\u044b \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c, \u0441 \u043a\u0430\u043a\u0438\u043c\u0438 \u0432\u0438\u0434\u0436\u0435\u0442\u0430\u043c\u0438 \u0431\u0443\u0434\u0435\u0442 \u043c\u0430\u043f\u0438\u0442\u044c\u0441\u044f \u043d\u0430\u0448\u0430 \u0444\u043e\u0440\u043c\u0430.<\/p>\n<p>\u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u0443\u0436\u0435 \u00ab\u0438\u0437 \u043a\u043e\u0440\u043e\u0431\u043a\u0438\u00bb \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0432\u0430\u043b\u0438\u0434\u0430\u0442\u043e\u0440\u044b: \u0432\u044b\u0448\u0435 \u0432 \u043a\u043e\u0434\u0435 \u0431\u044b\u043b\u0438 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u044b required \u0438 email. \u041c\u044b \u043c\u043e\u0436\u0435\u043c \u0432\u0437\u044f\u0442\u044c \u0438\u0445 \u0438 \u0441\u0440\u0430\u0437\u0443 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f. \u041d\u0435 \u043d\u0443\u0436\u043d\u043e \u043f\u0438\u0441\u0430\u0442\u044c inline-\u043a\u043e\u0434 \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0438, \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u0430\u043c\u0438\u0445 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439:<\/p>\n<pre><code class=\"dart\">children: &lt;Widget>[   ReactiveTextField(     formControlName: 'email',     validationMessages: {       'required': (error) => 'The email must not be empty',       'email': (error) => 'The email value must be a valid email'     },   ),   ReactiveTextField(     formControlName: 'password',     obscureText: true,     validationMessages: {       'required': (error) => 'The password must not be empty'       'minLength': (error) => 'The password must have at least 8 characters'     },   ), ],<\/code><\/pre>\n<p>\u0422\u0430\u043a\u0436\u0435 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u0442\u044c, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043a\u043d\u043e\u043f\u043a\u0443 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438, \u0435\u0441\u043b\u0438 \u043d\u0430\u0448\u0430 \u0444\u043e\u0440\u043c\u0430 \u043d\u0435\u0432\u0430\u043b\u0438\u0434\u043d\u0430. \u041f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 form.valid \u043f\u0440\u043e\u0441\u0442\u043e:<\/p>\n<pre><code class=\"dart\">ElevatedButton(   onPressed: form.valid ? _onSubmit : null,   child: const Text (\"Submit\"), )<\/code><\/pre>\n<p>\u041c\u043e\u0436\u0435\u043c \u043f\u0438\u0441\u0430\u0442\u044c \u0438 \u0441\u0432\u043e\u0438, \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0435 \u0432\u0430\u043b\u0438\u0434\u0430\u0442\u043e\u0440\u044b:<\/p>\n<pre><code class=\"dart\">class MustMatchValidator extends Validator&lt;dynamic> {   final String controlName;   final String matchingControlName;    MustMatchValidator ( {     required this.controlName,     required this.matchingControlName, }) : super();    @override   Map&lt;String, dynamic>? validate (AbstractControl&lt;dynamic> control) {     final form = control as FormGroup;      final formControl = form.control(controlName);     final matchingFormControl = form.control(matchingControlName);      if (formControl.value != matchingFormControl.value) {       matchingFormControl.setErrors({'mustMatch': true});       matchingFormControl.markAsTouched();     } else {       matchingFormControl.removeError('mustMatch');     }      return null;   } }<\/code><\/pre>\n<p>\u0412 \u044d\u0442\u043e\u043c \u0432\u0430\u043b\u0438\u0434\u0430\u0442\u043e\u0440\u0435 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0432\u043e\u043e\u0431\u0449\u0435 \u0432\u0441\u0435\u0439 FormGroup, \u0438, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043a\u0440\u043e\u0441\u0441-\u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044e \u043c\u0435\u0436\u0434\u0443 \u0434\u0432\u0443\u043c\u044f \u043f\u043e\u043b\u044f\u043c\u0438. \u0412\u043e\u043e\u0431\u0449\u0435, \u0432\u0430\u043b\u0438\u0434\u0430\u0442\u043e\u0440 \u0432\u044b\u0448\u0435 \u0432\u0437\u044f\u0442 \u00ab\u0438\u0437 \u043a\u043e\u0440\u043e\u0431\u043a\u0438\u00bb; \u044f \u043f\u0440\u0438\u0432\u0435\u043b \u044d\u0442\u043e\u0442 \u043f\u0440\u0438\u043c\u0435\u0440 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c, \u043a\u0430\u043a\u0430\u044f \u044d\u0442\u043e \u043c\u043e\u0449\u043d\u0430\u044f \u0448\u0442\u0443\u043a\u0430, \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u043b\u043e\u0436\u043d\u0443\u044e \u043b\u043e\u0433\u0438\u043a\u0443 \u0437\u0434\u0435\u0441\u044c \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c.<\/p>\n<pre><code class=\"dart\">final form = FormGroup({   'email': FormControl&lt;String>(validators: [Validators.required, Validators.email]),   'password': FormControl&lt;String>(validators: [Validators.required, Validators.minLength(8)]),   'passwordConfirmation': FormControl&lt;String>(), }, validators: [   MustMatchValidator(controlName: 'password', matchingControlName: 'passwordConfirmation' ) ]);<\/code><\/pre>\n<p>\u0410 \u0432\u043e\u0442 \u043a\u0430\u043a \u0432\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0439 \u0432\u0430\u043b\u0438\u0434\u0430\u0442\u043e\u0440: \u043c\u044b \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u0434\u0432\u0430 \u043f\u043e\u043b\u044f, \u0447\u0442\u043e \u0441 \u0447\u0435\u043c \u0434\u043e\u043b\u0436\u043d\u043e \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u0442\u044c, \u0438 \u043e\u043d \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442. \u041c\u043e\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043d\u0430 passwordConfirmation \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0442\u044c\u0441\u044f.<\/p>\n<pre><code class=\"dart\">final form = FormGroup({   'cardNumber': FormControl&lt;String>(     validators: [       Validators.composeOR( [         Validators.pattern(americanExpressCardPattern),         Validators.pattern(masterCardPattern),         Validators. pattern(visaCardPattern),       ])     ],   ), });<\/code><\/pre>\n<p>\u0412 \u0440\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u044b\u0445 \u0444\u043e\u0440\u043c\u0430\u0445 \u043f\u0440\u0435\u0434\u0443\u0441\u043c\u043e\u0442\u0440\u0435\u043d \u0438 \u0443\u0434\u043e\u0431\u043d\u044b\u0439 \u043a\u043e\u043c\u043f\u043e\u0437\u0435\u0440 \u0434\u043b\u044f \u0432\u0430\u043b\u0438\u0434\u0430\u0442\u043e\u0440\u043e\u0432, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0438\u0439 \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0438\u0442\u044c \u043f\u0430\u0442\u0442\u0435\u0440\u043d\u044b \u0434\u043b\u044f \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0438. \u042d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c composeOR, \u043a\u0430\u043a \u0432 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u2014 \u0442\u043e\u0433\u0434\u0430 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0442\u044c\u0441\u044f \u00ab\u0447\u0442\u043e-\u0442\u043e \u0438\u0437\u00bb. \u0418\u043b\u0438 \u043f\u0440\u043e\u0441\u0442\u043e compose \u2014 \u0442\u043e\u0433\u0434\u0430 \u0431\u0443\u0434\u0443\u0442 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0442\u044c\u0441\u044f \u00ab\u0432\u0441\u0435\u00bb. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0435\u0441\u043b\u0438 \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u0435\u0449\u0435\u0439 \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e.<\/p>\n<pre><code class=\"dart\">final Login login = Login(   email: form.control('email').value,   password: form.control('password').value);  \u2026  final Login login = Login.fromJson(form.value);<\/code><\/pre>\n<p>\u041c\u044b \u043c\u043e\u0436\u0435\u043c \u0441 \u043a\u0430\u0436\u0434\u043e\u0433\u043e control \u0434\u043e\u0441\u0442\u0430\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0438 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0434\u043b\u044f \u043d\u0438\u0445 set \u2014 \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, form.control \u0438 email.value \u0432 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0432\u044b\u0448\u0435. \u041b\u0438\u0431\u043e, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0441\u0430\u043c\u0430 \u0444\u043e\u0440\u043c\u0430 \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u0432 Map&lt;String, dynamic>, \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434\u044b fromJson \u043c\u043e\u0434\u0435\u043b\u0438: \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c set \u0432\u0441\u0435\u0439 \u0444\u043e\u0440\u043c\u044b \u043d\u0430 \u043a\u043b\u0430\u0441\u0441 \u043c\u043e\u0434\u0435\u043b\u0438, \u043a\u0430\u043a \u0432\u043e \u0432\u0442\u043e\u0440\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435. \u042d\u0442\u043e \u0443\u0434\u043e\u0431\u043d\u043e, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043d\u0430\u043c \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0432\u0441\u0451 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u0438 \u043c\u0430\u043f\u0438\u0442\u044c \u043f\u043e\u043b\u044f.<\/p>\n<p>\u0412\u043e\u0442 \u043b\u0438\u0448\u044c \u0447\u0430\u0441\u0442\u044c \u0432\u0438\u0434\u0436\u0435\u0442\u043e\u0432, \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0445 \u0432 \u0440\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u044b\u0445 \u0444\u043e\u0440\u043c\u0430\u0445:<\/p>\n<ul>\n<li>\n<p>ReactiveTextField<\/p>\n<\/li>\n<li>\n<p>ReactiveDropdownField<\/p>\n<\/li>\n<li>\n<p>ReactiveSwitch<\/p>\n<\/li>\n<li>\n<p>ReactiveCheckbox<\/p>\n<\/li>\n<li>\n<p>ReactiveRadio<\/p>\n<\/li>\n<li>\n<p>ReactiveSlider<\/p>\n<\/li>\n<li>\n<p>ReactiveCheckboxListTile<\/p>\n<\/li>\n<li>\n<p>ReactiveSwitchListTile<\/p>\n<\/li>\n<li>\n<p>ReactiveRadioListTile<\/p>\n<\/li>\n<li>\n<p>ReactiveDatePicker<\/p>\n<\/li>\n<li>\n<p>ReactiveTimePicker<\/p>\n<\/li>\n<\/ul>\n<p>\u0415\u0441\u0442\u044c \u0435\u0449\u0435 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u043f\u0430\u043a\u0435\u0442 <a href=\"https:\/\/pub.dev\/packages\/reactive_forms_widgets\"><u>reactive_forms_widgets<\/u><\/a>, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u0432\u0441\u0435 \u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u0435 \u0432\u0438\u0434\u0436\u0435\u0442\u044b.<\/p>\n<h3>\u0422\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435<\/h3>\n<p>\u041a\u043e\u0435-\u0447\u0442\u043e \u0441\u0442\u043e\u0438\u0442 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u0438 \u043f\u0440\u043e \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435. \u0412\u043e\u0437\u044c\u043c\u0435\u043c \u0434\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0444\u043e\u0440\u043c\u0443:<\/p>\n<pre><code class=\"dart\">class LoginFormState extends State&lt;LoginForm> {   final form = FormGroup({     'email': FormControl&lt;String>(validators: [Validators.required, Validators.email]),     'password': FormControl&lt;String>(validators: [Validators.required]),   });    @override   Widget build(BuildContext context) {     return ReactiveForm       formGroup: form,       child: Column(         children: &lt;Widget> [           ReactiveTextField(             key: const Key('email'),             formControlName: 'email',           ),           ReactiveTextField(             key: const Key('password'),             formControlName: 'password',             obscureText: true,           ),           ElevatedButton(             key: const Key('submit'),             onPressed: form.valid ? _onSubmit : null,             child: const Text('Submit'),           ),         ],<\/code><\/pre>\n<p>\u0421\u0432\u0435\u0440\u0445\u0443 \u043c\u044b \u0441\u0434\u0435\u043b\u0430\u043b\u0438 set \u0434\u043b\u044f FormGroup. \u0421\u043d\u0438\u0437\u0443 \u0443 \u043d\u0430\u0441 \u0441\u0431\u043e\u0440\u043a\u0430 \u0441\u0430\u043c\u043e\u0433\u043e \u0432\u0438\u0434\u0436\u0435\u0442\u0430, build-\u043c\u0435\u0442\u043e\u0434. \u0414\u0430\u043b\u0435\u0435 \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u044b \u043f\u043e\u043b\u044f ReactiveTextField \u0438 \u043a\u043d\u043e\u043f\u043a\u0430 Submit.<\/p>\n<p>\u041a\u0441\u0442\u0430\u0442\u0438, \u0441\u0442\u043e\u0438\u0442 \u0441\u043a\u0430\u0437\u0430\u0442\u044c \u0435\u0449\u0435 \u043e\u0431 \u043e\u0434\u043d\u043e\u0439 \u0445\u043e\u0440\u043e\u0448\u0435\u0439 \u0448\u0442\u0443\u043a\u0435. \u041c\u044b \u043c\u043e\u0436\u0435\u043c \u0434\u0435\u043b\u0430\u0442\u044c \u043d\u0430\u0448\u0438 \u0444\u043e\u0440\u043c\u044b \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u00ab\u0442\u0443\u043f\u044b\u043c\u0438\u00bb \u2014 \u0431\u0435\u0437 \u043a\u0430\u043a\u043e\u0439-\u043b\u0438\u0431\u043e \u043b\u043e\u0433\u0438\u043a\u0438 \u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0430 \u0431\u044d\u043a\u0435\u043d\u0434:<\/p>\n<pre><code class=\"dart\">void _onSubmit() {   widget.callback(form.value) }<\/code><\/pre>\n<p>\u041c\u044b \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u043c \u0432\u0438\u0434\u0436\u0435\u0442 \u0444\u043e\u0440\u043c\u044b \u0432 callback-\u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0438 \u043f\u043e\u0442\u043e\u043c \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u043c \u0435\u0435 \u043d\u0430\u0432\u0435\u0440\u0445, \u043d\u0430 submit, \u0442\u043e \u0435\u0441\u0442\u044c \u0441\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u0438. \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u0443 \u0444\u043e\u0440\u043c\u0443 \u0431\u0443\u0434\u0435\u0442 \u043e\u0447\u0435\u043d\u044c \u0443\u0434\u043e\u0431\u043d\u043e \u0438 \u043f\u0440\u043e\u0441\u0442\u043e, \u0431\u0435\u0437 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u0441\u043b\u043e\u0436\u043d\u043e\u0439 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0438. \u0415\u0441\u043b\u0438 \u0431\u044b \u0432\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438 \u043a\u0430\u043a\u043e\u0439-\u043d\u0438\u0431\u0443\u0434\u044c dependency injection, \u043f\u043e\u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043b\u0438\u0441\u044c \u0431\u044b \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u0443\u0441\u0438\u043b\u0438\u044f, \u0447\u0442\u043e\u0431\u044b \u0445\u043e\u0440\u043e\u0448\u043e \u0432\u0441\u0451 \u0437\u0430\u043c\u043e\u043a\u0430\u0442\u044c. \u0410 \u0437\u0434\u0435\u0441\u044c \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u043d\u0430\u0432\u0435\u0440\u0445.<\/p>\n<p>\u0412 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043d\u0438\u0436\u0435 \u043c\u044b \u00ab\u043f\u0440\u043e\u0433\u0440\u0435\u0432\u0430\u0435\u043c\u00bb \u043d\u0430\u0448 \u0432\u0438\u0434\u0436\u0435\u0442 \u2014 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u043c \u0442\u0443\u0434\u0430 LoginForm:<\/p>\n<pre><code class=\"dart\">void main| ) {   testwidgets('LoginForm should pass with correct values', (tester) async {      await tester.pumpWidget( const MaterialApp(       home: Scaffold(body: LoginForm()),     ));      await tester.enterText(find.byKey(const Key'email')), 'etc@test.qa');     await tester.enterText(find.byKey(const Key('password')), 'password');      await tester.tap(find.byKey(const Key('submit')));      await tester.pump();      expect (find.text('etc@test.qa'), findsOneWidget);      final LoginFormState loginFormState = tester.state(find.byType(LoginForm));      expect(loginFormState.form.valid, true);   }): }<\/code><\/pre>\n<p>\u041a\u0441\u0442\u0430\u0442\u0438, \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u044e\u0441\u044c \u0435\u0449\u0435 \u043d\u0430 \u043e\u0434\u043d\u043e\u043c \u0432\u0430\u0436\u043d\u043e\u043c \u043c\u043e\u043c\u0435\u043d\u0442\u0435. \u0417\u0430\u0447\u0435\u043c \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u043a\u043b\u044e\u0447\u0438 key \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043f\u043e\u043b\u044f? \u0427\u0442\u043e\u0431\u044b \u0447\u0435\u0440\u0435\u0437 widget testing \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c\u0441\u044f \u043a \u044d\u0442\u043e\u043c\u0443 \u043f\u043e\u043b\u044e.<\/p>\n<p>\u0412\u0435\u0440\u043d\u0435\u043c\u0441\u044f \u043a \u043f\u0440\u0438\u043c\u0435\u0440\u0443 \u0432\u044b\u0448\u0435. \u0412 \u043d\u0435\u043c \u043c\u044b \u043e\u0431\u0440\u0430\u0449\u0430\u0435\u043c\u0441\u044f \u043a \u043f\u043e\u043b\u044f\u043c email \u0438 password, \u0432\u0432\u043e\u0434\u0438\u043c \u043a\u0430\u043a\u0438\u0435-\u0442\u043e \u0434\u0430\u043d\u043d\u044b\u0435 \u0438 \u043c\u043e\u0436\u0435\u043c \u043d\u0430\u0436\u0430\u0442\u044c \u043a\u043d\u043e\u043f\u043a\u0443 Submit. \u041f\u043e\u0442\u043e\u043c \u0434\u0435\u043b\u0430\u0435\u043c pump, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u043e\u0438\u0437\u043e\u0448\u043b\u0438 \u043d\u0443\u0436\u043d\u044b\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f, \u0438 \u0434\u0430\u043b\u044c\u0448\u0435 \u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u0447\u0442\u043e \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u043f\u043e\u043b\u0435 \u0441 \u0432\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u043c \u043f\u043e\u0447\u0442\u043e\u0432\u044b\u043c \u0430\u0434\u0440\u0435\u0441\u043e\u043c. \u042d\u0442\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043e\u043f\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u0430.<\/p>\n<p>\u0414\u0430\u043b\u0435\u0435 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0444\u043e\u0440\u043c\u044b \u0438 \u043c\u043e\u0436\u0435\u043c \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c, \u0447\u0442\u043e \u043e\u043d\u0430 \u0432\u0430\u043b\u0438\u0434\u043d\u0430 \u2014 \u0443 \u043d\u0435\u0435 \u0435\u0441\u0442\u044c \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e valid. \u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u0440\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u044b\u0445 \u0444\u043e\u0440\u043c \u043e\u0447\u0435\u043d\u044c \u043c\u043e\u0449\u043d\u0430\u044f, \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u043c\u043d\u043e\u0433\u043e \u0440\u0430\u0437\u043d\u044b\u0445 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u043c\u043e\u0436\u043d\u043e \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0435\u0441\u043b\u0438 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u044b\u043c \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u043c \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0442\u0430\u043a, \u0431\u0443\u0434\u0442\u043e \u043c\u044b \u043f\u043e\u043b\u0435 \u0442\u0440\u043e\u0433\u0430\u043b\u0438 \u0438\u043b\u0438 \u043d\u0435 \u0442\u0440\u043e\u0433\u0430\u043b\u0438, \u044d\u0442\u0430 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0443\u0436\u0435 \u0435\u0441\u0442\u044c \u0432 \u0441\u0430\u043c\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0435.<\/p>\n<p>\u0422\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0444\u043e\u0440\u043c\u0443 \u0438\u0437 \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u043c\u043e\u0436\u043d\u043e \u043d\u0430 \u044e\u043d\u0438\u0442-\u0443\u0440\u043e\u0432\u043d\u0435. \u041c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u043e\u0434\u043d\u044f\u0442\u044c \u0435\u0435, \u0438 \u043e\u043d\u0430 \u0437\u0430\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442: \u043f\u043e\u0441\u043b\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u043c\u043e\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0441\u0440\u0430\u0437\u0443 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0438, \u0431\u0435\u0437 \u043f\u043e\u0434\u043d\u044f\u0442\u0438\u044f \u0432\u0438\u0434\u0436\u0435\u0442\u0430.<\/p>\n<h3>\u0418\u0442\u043e\u0433\u0438<\/h3>\n<p>\u0412\u0441\u0435 \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u044b\u0435 \u0432 \u0441\u0442\u0430\u0442\u044c\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u043e\u0431\u044b\u0447\u043d\u044b\u0445 \u0444\u043e\u0440\u043c \u0440\u0435\u0448\u0435\u043d\u044b \u0432 \u0440\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u044b\u0445 \u0444\u043e\u0440\u043c\u0430\u0445. \u0412\u0441\u044e \u0444\u043e\u0440\u043c\u0443 \u0441\u0440\u0430\u0437\u0443 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u0431\u0435\u0437 \u043e\u0433\u0440\u043e\u043c\u043d\u043e\u0433\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u043a\u043e\u0434\u0430 \u0438 \u0435\u0433\u043e \u0434\u0443\u0431\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f. \u041c\u044b \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u044b. \u0412\u0441\u044f \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044f \u043b\u0435\u0436\u0438\u0442 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e \u0432 \u043a\u043b\u0430\u0441\u0441\u0430\u0445. \u041d\u0435 \u043d\u0443\u0436\u043d\u044b onChanged \u0438 onSave \u043a\u043e\u043b\u0431\u044d\u043a\u0438, \u043d\u0435 \u043d\u0430\u0434\u043e \u0441\u043b\u0435\u0434\u0438\u0442\u044c \u0437\u0430 dispose \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u043e\u0432.<\/p>\n<p>\u041f\u043e\u043c\u0438\u043c\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c, \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0438 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430. \u0423 \u043d\u0430\u0441 \u0442\u0435\u043f\u0435\u0440\u044c \u0435\u0441\u0442\u044c \u0434\u0435\u043a\u043b\u0430\u0440\u0430\u0442\u0438\u0432\u043d\u043e\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043e\u0448\u0438\u0431\u043e\u043a. \u0412\u0430\u043b\u0438\u0434\u0430\u0442\u043e\u0440\u044b \u0432\u044b\u043d\u0435\u0441\u0435\u043d\u044b, \u043c\u043e\u0434\u0435\u043b\u044c \u0438 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u044b \u2014 \u044d\u0442\u043e \u0443\u0434\u043e\u0431\u043d\u043e \u0438 \u043f\u043e\u043d\u044f\u0442\u043d\u043e \u0441 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438. \u0422\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0442\u0430\u043a\u0436\u0435 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u043f\u0440\u043e\u0449\u0435. \u0418 \u043d\u0430\u043a\u043e\u043d\u0435\u0446, \u0443 \u043d\u0430\u0441 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u043c\u0435\u043d\u044c\u0448\u0435 \u043a\u043e\u0434\u0430 \u2014 \u0430 \u0437\u043d\u0430\u0447\u0438\u0442, \u0438 \u043c\u0435\u043d\u044c\u0448\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c.<\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/767006\/\"> https:\/\/habr.com\/ru\/articles\/767006\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0412 \u044d\u0442\u043e\u043c \u043f\u043e\u0441\u0442\u0435 \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u043e \u0440\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u044b\u0445 \u0444\u043e\u0440\u043c\u0430\u0445 \u0432\u043e Flutter \u0438 \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u0434\u0435\u043b\u0430\u0442\u044c \u0444\u043e\u0440\u043c\u044b \u0441 \u043c\u0435\u043d\u044c\u0448\u0438\u043c\u0438 \u0442\u0440\u0443\u0434\u043e\u0437\u0430\u0442\u0440\u0430\u0442\u0430\u043c\u0438 \u0432 \u0446\u0435\u043b\u043e\u043c. \u041d\u0430\u0447\u043d\u0443 \u0441 \u043e\u0431\u044b\u0447\u043d\u044b\u0445 \u0444\u043e\u0440\u043c \u0438 \u0438\u0445 \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u0432\u043e Flutter, \u0437\u0430\u0442\u0435\u043c \u043f\u0435\u0440\u0435\u0439\u0434\u0443 \u043a \u0440\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u044b\u043c \u0444\u043e\u0440\u043c\u0430\u043c, \u0438\u0445 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044e \u0438 \u043f\u043e\u0434\u0432\u0435\u0434\u0443 \u0438\u0442\u043e\u0433\u0438.<\/p>\n<figure class=\"full-width\"><\/figure>\n<p>\u0412\u043e Flutter \u044f \u043d\u0430\u0447\u0438\u043d\u0430\u043b \u0441 \u043e\u0431\u044b\u0447\u043d\u044b\u0445 \u0444\u043e\u0440\u043c. \u041f\u043e\u043b\u0443\u0447\u0430\u043b\u043e\u0441\u044c \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u043c\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0435\u0449\u0435 \u0438 \u0434\u0443\u0431\u043b\u0438\u0440\u043e\u0432\u0430\u043b\u0441\u044f. \u041f\u043e\u0442\u043e\u043c \u043f\u0440\u043e\u0431\u043e\u0432\u0430\u043b \u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u0438 \u0444\u043e\u0440\u043c\u044b \u0441 \u043d\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435\u043c \u043c\u043e\u0434\u0435\u043b\u0438 \u043f\u043e onChange: \u0441\u0442\u0430\u043b\u043e \u043b\u0443\u0447\u0448\u0435, \u043d\u043e \u0432\u0441\u0451 \u0440\u0430\u0432\u043d\u043e \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0445\u043e\u0440\u043e\u0448\u043e. \u0411\u044b\u043b\u043e \u0443\u0434\u0438\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e, \u043a\u0430\u043a \u043c\u043d\u043e\u0433\u043e \u043e\u0434\u043d\u043e\u0442\u0438\u043f\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u043b\u043e\u0441\u044c \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430.<\/p>\n<pre><code class=\"dart\">class MyCustomFormState extends State &lt;MyCustomForm> {    final _formKey = GlobalKey&lt;FormState>();    @override   Widget build(BuildContext context) {     return Form(       key: _formKey,       child: const Column(         children: &lt;Widget>[           \/\/ Add TextFormFields and ElevatedButton here.         ],       ),     );   } }<\/code><\/pre>\n<p>\u0412\u043e\u0442 \u043f\u0440\u0438\u043c\u0435\u0440 \u043e\u0431\u044b\u0447\u043d\u043e\u0439 \u0444\u043e\u0440\u043c\u044b. \u041c\u044b \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u0444\u043e\u0440\u043c\u0443, \u043f\u0440\u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c formKey \u0438 \u0434\u0430\u043b\u044c\u0448\u0435 \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u044f\u0435\u043c \u0432\u0438\u0434\u0436\u0435\u0442\u044b. \u0412\u043e\u0442, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432\u0438\u0434\u0436\u0435\u0442 TextFormField:<\/p>\n<pre><code class=\"dart\">TextFormField(   validator: (value) {     if (value == null || value.isEmpty) {       return 'Please enter some text';     }     return null;   }, ),<\/code><\/pre>\n<p>\u0417\u0434\u0435\u0441\u044c \u0443 \u043d\u0430\u0441 \u043f\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f inline-\u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044f \u2014 \u0438 \u044d\u0442\u043e \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430, \u0445\u043e\u0442\u044f \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044e \u0438 \u043c\u043e\u0436\u043d\u043e \u0441\u043f\u0440\u044f\u0442\u0430\u0442\u044c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e \u0432 \u0444\u0430\u0439\u043b \u0438\u043b\u0438 \u043c\u0435\u0442\u043e\u0434.<\/p>\n<pre><code class=\"dart\">ElevatedButton(   onPressed: () {     if (_formKey.currentState!.validate()) {       ScaffoldMessenger.of(context).showSnackBar(         const SnackBar(content: Text('Processing Data')),       );     }   },   child: const Text('Submit'), ),<\/code><\/pre>\n<p>\u0412 \u044d\u0442\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043c\u044b \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c, \u0432\u0430\u043b\u0438\u0434\u043d\u044b \u043b\u0438 \u0444\u043e\u0440\u043c\u044b (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u043e \u043a\u043b\u0438\u043a\u0443 \u043d\u0430 \u043a\u043d\u043e\u043f\u043a\u0443), \u0438 \u043f\u043e\u0442\u043e\u043c \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u043a\u0430\u043a\u0438\u0435-\u0442\u043e \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f. \u0412\u0441\u0451 \u0431\u0443\u0434\u0442\u043e \u0431\u044b \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e, \u043d\u043e \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u043e\u0441\u0442\u043e \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0434\u0432\u0430 \u043f\u043e\u043b\u044f \u043d\u0430 \u0431\u044d\u043a\u0435\u043d\u0434, \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u043f\u0440\u043e\u043f\u0438\u0441\u0430\u0442\u044c \u0434\u0432\u0430 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430, \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438\u0445 \u0438 \u043d\u0435 \u0437\u0430\u0431\u044b\u0442\u044c dispose. \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u043d\u0435\u043c\u0430\u043b\u043e \u043a\u043e\u0434\u0430:<\/p>\n<pre><code class=\"dart\">class _HomePageState extends State&lt;HomePage> {   final _formKey = GlobalKey&lt;FormState>();    late final TextEditingController _emailController;   late final TextEditingController _passwordController;    @override   void initState() {     super. initState();     _emailController = TextEditingController();     _passwordController = TextEditingController();   }    @override   void dispose() {     _emailController.dispose();     _passwordController.dispose();     super.dispose();   }<\/code><\/pre>\n<p>\u0415\u0441\u043b\u0438 \u0432\u0430\u0448\u0430 \u0444\u043e\u0440\u043c\u0430 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0445\u043e\u0442\u044f \u0431\u044b 5-10 \u043f\u043e\u043b\u0435\u0439, \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0434\u0438\u043a\u043e\u0432\u0430\u0442\u043e. \u0418\u0442\u043e\u0433\u043e\u0432\u044b\u0439 \u0441\u043f\u0438\u0441\u043e\u043a \u043f\u0440\u043e\u0431\u043b\u0435\u043c:<\/p>\n<ul>\n<li>\n<p>\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0432\u0441\u044e \u0444\u043e\u0440\u043c\u0443 \u0441\u0440\u0430\u0437\u0443 \u2014 \u043d\u0430\u0434\u043e \u0434\u043e\u0441\u0442\u0430\u0432\u0430\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0441 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430, \u043f\u0440\u0438 \u0431\u043e\u043b\u044c\u0448\u043e\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u043e\u043b\u0435\u0439 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u0441\u043b\u043e\u0436\u043d\u043e.<\/p>\n<\/li>\n<li>\n<p>\u041d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u044b.<\/p>\n<\/li>\n<li>\n<p>\u041d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c inline-\u043a\u043e\u0434 \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0438.<\/p>\n<\/li>\n<li>\n<p>\u041d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c onChanged \u0438 onSave \u043a\u043e\u043b\u0431\u044d\u043a\u0438, \u0447\u0442\u043e\u0431\u044b \u043d\u0430\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u044c.<\/p>\n<\/li>\n<li>\n<p>\u041d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c dispose \u0434\u043b\u044f \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u043e\u0432.<\/p>\n<\/li>\n<\/ul>\n<h3>\u0420\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u044b\u0435 \u0444\u043e\u0440\u043c\u044b<\/h3>\n<p>\u0410\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u2014 \u044d\u0442\u043e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 <a href=\"https:\/\/pub.dev\/packages\/reactive_forms\"><u>reactive_forms<\/u><\/a>, \u0432\u043e \u043c\u043d\u043e\u0433\u043e\u043c \u0441\u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0430\u044f \u0438\u0437 Angular. \u0415\u0441\u043b\u0438 \u0432\u044b \u0431\u0443\u0434\u0435\u0442\u0435 \u0433\u0443\u0433\u043b\u0438\u0442\u044c \u0440\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u044b\u0435 \u0444\u043e\u0440\u043c\u044b, \u0442\u043e \u0441\u043d\u0430\u0447\u0430\u043b\u0430, \u0441\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e, \u043f\u043e\u043f\u0430\u0434\u0435\u0442\u0435 \u043d\u0430 \u0440\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u044b\u0435 \u0444\u043e\u0440\u043c\u044b Angular, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0445\u043e\u0440\u043e\u0448\u043e \u0437\u0430\u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u043e\u0432\u0430\u043b\u0438 \u0441\u0435\u0431\u044f \u043d\u0430 \u0444\u0440\u043e\u043d\u0442\u0435\u043d\u0434\u0435.\u00a0<\/p>\n<pre><code class=\"dart\">class LoginFormState extends State&lt;LoginForm> {    final form = FormGroup ({     'email': FormControl&lt;String>(       validators: [         Validators.required,         Validators.email       ]),     'password': FormControl&lt;String>(       validators: [         Validators.required       ]),   }); }<\/code><\/pre>\n<p>\u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0440\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u044b\u0445 \u0444\u043e\u0440\u043c \u043f\u0440\u043e\u0441\u0442\u0430: \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0433\u0440\u0443\u043f\u043f\u0443 FormGroup \u0438 \u0432 \u043d\u0435\u0439 FormControl \u2014 \u044d\u0442\u043e \u043f\u043e\u043b\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0432\u043b\u043e\u0436\u0438\u0442\u044c \u0432 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 Map. \u0415\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u0438\u043c\u0435\u0435\u0442\u0441\u044f \u043a\u0430\u043a\u0430\u044f-\u0442\u043e \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u044c \u0432 \u0432\u0438\u0434\u0435 \u043c\u0430\u0441\u0441\u0438\u0432\u0430, \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c FormArray \u0432\u043c\u0435\u0441\u0442\u043e FormGroup, \u0438 \u0442\u0430\u043c \u0443\u0436\u0435 \u0431\u0443\u0434\u0443\u0442 \u0441\u0432\u043e\u0438 \u043c\u0435\u0442\u043e\u0434\u044b.<\/p>\n<p>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0444\u043e\u0440\u043c\u044b \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u2014 \u0447\u0435\u0440\u0435\u0437 setState \u0438\u043b\u0438 \u0434\u0440\u0443\u0433\u0438\u043c \u043f\u0440\u0438\u0432\u044b\u0447\u043d\u044b\u043c \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u043c:<\/p>\n<pre><code class=\"dart\">this.form.value = {   'name': 'John',   'email': 'john@email.com', };<\/code><\/pre>\n<p>\u0423 reactive_forms \u0435\u0441\u0442\u044c \u0441\u0432\u043e\u0438 \u043e\u0431\u0435\u0440\u0442\u043a\u0438 \u0434\u043b\u044f \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u0432\u0438\u0434\u0436\u0435\u0442\u043e\u0432 \u0438 \u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a. \u041c\u043e\u0436\u043d\u043e \u043e\u0431\u0435\u0440\u043d\u0443\u0442\u044c \u0438 \u0441\u0432\u043e\u0438 \u0432\u0438\u0434\u0436\u0435\u0442\u044b. \u041f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0438 \u0432\u0438\u0434 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0445 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043e\u0432 \u043d\u0435 \u043c\u0435\u043d\u044f\u044e\u0442\u0441\u044f, \u043e\u043d\u0438 \u043f\u0440\u043e\u0441\u0442\u043e \u0440\u0430\u0441\u0448\u0438\u0440\u044f\u044e\u0442\u0441\u044f \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u043c\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u043c\u0438, \u0447\u0442\u043e\u0431\u044b \u0432\u0441\u0451 \u0440\u0430\u0431\u043e\u0442\u0430\u043b\u043e.<\/p>\n<pre><code class=\"dart\">@override Widget build(BuildContext context) {   return ReactiveForm(     formGroup: this.form,     child: Column(       children: &lt;Widget> [         ReactiveTextField(           formControlName: 'email'         ),         ReactiveTextField(           formControlName: 'password',           obscureText: true,         ),       ],     ),   ); }<\/code><\/pre>\n<p>\u0412 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043c\u044b \u0432\u0438\u0434\u0438\u043c, \u0447\u0442\u043e formControlName \u2014 \u044d\u0442\u043e \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u043f\u043e\u043b\u0435, \u0433\u0434\u0435 \u043c\u044b \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c, \u0441 \u043a\u0430\u043a\u0438\u043c\u0438 \u0432\u0438\u0434\u0436\u0435\u0442\u0430\u043c\u0438 \u0431\u0443\u0434\u0435\u0442 \u043c\u0430\u043f\u0438\u0442\u044c\u0441\u044f \u043d\u0430\u0448\u0430 \u0444\u043e\u0440\u043c\u0430.<\/p>\n<p>\u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u0443\u0436\u0435 \u00ab\u0438\u0437 \u043a\u043e\u0440\u043e\u0431\u043a\u0438\u00bb \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0432\u0430\u043b\u0438\u0434\u0430\u0442\u043e\u0440\u044b: \u0432\u044b\u0448\u0435 \u0432 \u043a\u043e\u0434\u0435 \u0431\u044b\u043b\u0438 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u044b required \u0438 email. \u041c\u044b \u043c\u043e\u0436\u0435\u043c \u0432\u0437\u044f\u0442\u044c \u0438\u0445 \u0438 \u0441\u0440\u0430\u0437\u0443 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f. \u041d\u0435 \u043d\u0443\u0436\u043d\u043e \u043f\u0438\u0441\u0430\u0442\u044c inline-\u043a\u043e\u0434 \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0438, \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u0430\u043c\u0438\u0445 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439:<\/p>\n<pre><code class=\"dart\">children: &lt;Widget>[   ReactiveTextField(     formControlName: 'email',     validationMessages: {       'required': (error) => 'The email must not be empty',       'email': (error) => 'The email value must be a valid email'     },   ),   ReactiveTextField(     formControlName: 'password',     obscureText: true,     validationMessages: {       'required': (error) => 'The password must not be empty'       'minLength': (error) => 'The password must have at least 8 characters'     },   ), ],<\/code><\/pre>\n<p>\u0422\u0430\u043a\u0436\u0435 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u0442\u044c, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043a\u043d\u043e\u043f\u043a\u0443 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438, \u0435\u0441\u043b\u0438 \u043d\u0430\u0448\u0430 \u0444\u043e\u0440\u043c\u0430 \u043d\u0435\u0432\u0430\u043b\u0438\u0434\u043d\u0430. \u041f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 form.valid \u043f\u0440\u043e\u0441\u0442\u043e:<\/p>\n<pre><code class=\"dart\">ElevatedButton(   onPressed: form.valid ? _onSubmit : null,   child: const Text (\"Submit\"), )<\/code><\/pre>\n<p>\u041c\u043e\u0436\u0435\u043c \u043f\u0438\u0441\u0430\u0442\u044c \u0438 \u0441\u0432\u043e\u0438, \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0435 \u0432\u0430\u043b\u0438\u0434\u0430\u0442\u043e\u0440\u044b:<\/p>\n<pre><code class=\"dart\">class MustMatchValidator extends Validator&lt;dynamic> {   final String controlName;   final String matchingControlName;    MustMatchValidator ( {     required this.controlName,     required this.matchingControlName, }) : super();    @override   Map&lt;String, dynamic>? validate (AbstractControl&lt;dynamic> control) {     final form = control as FormGroup;      final formControl = form.control(controlName);     final matchingFormControl = form.control(matchingControlName);      if (formControl.value != matchingFormControl.value) {       matchingFormControl.setErrors({'mustMatch': true});       matchingFormControl.markAsTouched();     } else {       matchingFormControl.removeError('mustMatch');     }      return null;   } }<\/code><\/pre>\n<p>\u0412 \u044d\u0442\u043e\u043c \u0432\u0430\u043b\u0438\u0434\u0430\u0442\u043e\u0440\u0435 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0432\u043e\u043e\u0431\u0449\u0435 \u0432\u0441\u0435\u0439 FormGroup, \u0438, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043a\u0440\u043e\u0441\u0441-\u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044e \u043c\u0435\u0436\u0434\u0443 \u0434\u0432\u0443\u043c\u044f \u043f\u043e\u043b\u044f\u043c\u0438. \u0412\u043e\u043e\u0431\u0449\u0435, \u0432\u0430\u043b\u0438\u0434\u0430\u0442\u043e\u0440 \u0432\u044b\u0448\u0435 \u0432\u0437\u044f\u0442 \u00ab\u0438\u0437 \u043a\u043e\u0440\u043e\u0431\u043a\u0438\u00bb; \u044f \u043f\u0440\u0438\u0432\u0435\u043b \u044d\u0442\u043e\u0442 \u043f\u0440\u0438\u043c\u0435\u0440 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c, \u043a\u0430\u043a\u0430\u044f \u044d\u0442\u043e \u043c\u043e\u0449\u043d\u0430\u044f \u0448\u0442\u0443\u043a\u0430, \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u043b\u043e\u0436\u043d\u0443\u044e \u043b\u043e\u0433\u0438\u043a\u0443 \u0437\u0434\u0435\u0441\u044c \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c.<\/p>\n<pre><code class=\"dart\">final form = FormGroup({   'email': FormControl&lt;String>(validators: [Validators.required, Validators.email]),   'password': FormControl&lt;String>(validators: [Validators.required, Validators.minLength(8)]),   'passwordConfirmation': FormControl&lt;String>(), }, validators: [   MustMatchValidator(controlName: 'password', matchingControlName: 'passwordConfirmation' ) ]);<\/code><\/pre>\n<p>\u0410 \u0432\u043e\u0442 \u043a\u0430\u043a \u0432\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0439 \u0432\u0430\u043b\u0438\u0434\u0430\u0442\u043e\u0440: \u043c\u044b \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u0434\u0432\u0430 \u043f\u043e\u043b\u044f, \u0447\u0442\u043e \u0441 \u0447\u0435\u043c \u0434\u043e\u043b\u0436\u043d\u043e \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u0442\u044c, \u0438 \u043e\u043d \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442. \u041c\u043e\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043d\u0430 passwordConfirmation \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0442\u044c\u0441\u044f.<\/p>\n<pre><code class=\"dart\">final form = FormGroup({   'cardNumber': FormControl&lt;String>(     validators: [       Validators.composeOR( [         Validators.pattern(americanExpressCardPattern),         Validators.pattern(masterCardPattern),         Validators. pattern(visaCardPattern),       ])     ],   ), });<\/code><\/pre>\n<p>\u0412 \u0440\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u044b\u0445 \u0444\u043e\u0440\u043c\u0430\u0445 \u043f\u0440\u0435\u0434\u0443\u0441\u043c\u043e\u0442\u0440\u0435\u043d \u0438 \u0443\u0434\u043e\u0431\u043d\u044b\u0439 \u043a\u043e\u043c\u043f\u043e\u0437\u0435\u0440 \u0434\u043b\u044f \u0432\u0430\u043b\u0438\u0434\u0430\u0442\u043e\u0440\u043e\u0432, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0438\u0439 \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0438\u0442\u044c \u043f\u0430\u0442\u0442\u0435\u0440\u043d\u044b \u0434\u043b\u044f \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0438. \u042d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c composeOR, \u043a\u0430\u043a \u0432 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u2014 \u0442\u043e\u0433\u0434\u0430 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0442\u044c\u0441\u044f \u00ab\u0447\u0442\u043e-\u0442\u043e \u0438\u0437\u00bb. \u0418\u043b\u0438 \u043f\u0440\u043e\u0441\u0442\u043e compose \u2014 \u0442\u043e\u0433\u0434\u0430 \u0431\u0443\u0434\u0443\u0442 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0442\u044c\u0441\u044f \u00ab\u0432\u0441\u0435\u00bb. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0435\u0441\u043b\u0438 \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u0435\u0449\u0435\u0439 \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e.<\/p>\n<pre><code class=\"dart\">final Login login = Login(   email: form.control('email').value,   password: form.control('password').value);  \u2026  final Login login = Login.fromJson(form.value);<\/code><\/pre>\n<p>\u041c\u044b \u043c\u043e\u0436\u0435\u043c \u0441 \u043a\u0430\u0436\u0434\u043e\u0433\u043e control \u0434\u043e\u0441\u0442\u0430\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0438 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0434\u043b\u044f \u043d\u0438\u0445 set \u2014 \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, form.control \u0438 email.value \u0432 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0432\u044b\u0448\u0435. \u041b\u0438\u0431\u043e, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0441\u0430\u043c\u0430 \u0444\u043e\u0440\u043c\u0430 \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u0432 Map&lt;String, dynamic>, \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434\u044b fromJson \u043c\u043e\u0434\u0435\u043b\u0438: \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c set \u0432\u0441\u0435\u0439 \u0444\u043e\u0440\u043c\u044b \u043d\u0430 \u043a\u043b\u0430\u0441\u0441 \u043c\u043e\u0434\u0435\u043b\u0438, \u043a\u0430\u043a \u0432\u043e \u0432\u0442\u043e\u0440\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435. \u042d\u0442\u043e \u0443\u0434\u043e\u0431\u043d\u043e, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043d\u0430\u043c \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0432\u0441\u0451 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u0438 \u043c\u0430\u043f\u0438\u0442\u044c \u043f\u043e\u043b\u044f.<\/p>\n<p>\u0412\u043e\u0442 \u043b\u0438\u0448\u044c \u0447\u0430\u0441\u0442\u044c \u0432\u0438\u0434\u0436\u0435\u0442\u043e\u0432, \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0445 \u0432 \u0440\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u044b\u0445 \u0444\u043e\u0440\u043c\u0430\u0445:<\/p>\n<ul>\n<li>\n<p>ReactiveTextField<\/p>\n<\/li>\n<li>\n<p>ReactiveDropdownField<\/p>\n<\/li>\n<li>\n<p>ReactiveSwitch<\/p>\n<\/li>\n<li>\n<p>ReactiveCheckbox<\/p>\n<\/li>\n<li>\n<p>ReactiveRadio<\/p>\n<\/li>\n<li>\n<p>ReactiveSlider<\/p>\n<\/li>\n<li>\n<p>ReactiveCheckboxListTile<\/p>\n<\/li>\n<li>\n<p>ReactiveSwitchListTile<\/p>\n<\/li>\n<li>\n<p>ReactiveRadioListTile<\/p>\n<\/li>\n<li>\n<p>ReactiveDatePicker<\/p>\n<\/li>\n<li>\n<p>ReactiveTimePicker<\/p>\n<\/li>\n<\/ul>\n<p>\u0415\u0441\u0442\u044c \u0435\u0449\u0435 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u043f\u0430\u043a\u0435\u0442 <a href=\"https:\/\/pub.dev\/packages\/reactive_forms_widgets\"><u>reactive_forms_widgets<\/u><\/a>, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u0432\u0441\u0435 \u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u0435 \u0432\u0438\u0434\u0436\u0435\u0442\u044b.<\/p>\n<h3>\u0422\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435<\/h3>\n<p>\u041a\u043e\u0435-\u0447\u0442\u043e \u0441\u0442\u043e\u0438\u0442 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u0438 \u043f\u0440\u043e \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435. \u0412\u043e\u0437\u044c\u043c\u0435\u043c \u0434\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0444\u043e\u0440\u043c\u0443:<\/p>\n<pre><code class=\"dart\">class LoginFormState extends State&lt;LoginForm> {   final form = FormGroup({     'email': FormControl&lt;String>(validators: [Validators.required, Validators.email]),     'password': FormControl&lt;String>(validators: [Validators.required]),   });    @override   Widget build(BuildContext context) {     return ReactiveForm       formGroup: form,       child: Column(         children: &lt;Widget> [           ReactiveTextField(             key: const Key('email'),             formControlName: 'email',           ),           ReactiveTextField(             key: const Key('password'),             formControlName: 'password',             obscureText: true,           ),           ElevatedButton(             key: const Key('submit'),             onPressed: form.valid ? _onSubmit : null,             child: const Text('Submit'),           ),         ],<\/code><\/pre>\n<p>\u0421\u0432\u0435\u0440\u0445\u0443 \u043c\u044b \u0441\u0434\u0435\u043b\u0430\u043b\u0438 set \u0434\u043b\u044f FormGroup. \u0421\u043d\u0438\u0437\u0443 \u0443 \u043d\u0430\u0441 \u0441\u0431\u043e\u0440\u043a\u0430 \u0441\u0430\u043c\u043e\u0433\u043e \u0432\u0438\u0434\u0436\u0435\u0442\u0430, build-\u043c\u0435\u0442\u043e\u0434. \u0414\u0430\u043b\u0435\u0435 \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u044b \u043f\u043e\u043b\u044f ReactiveTextField \u0438 \u043a\u043d\u043e\u043f\u043a\u0430 Submit.<\/p>\n<p>\u041a\u0441\u0442\u0430\u0442\u0438, \u0441\u0442\u043e\u0438\u0442 \u0441\u043a\u0430\u0437\u0430\u0442\u044c \u0435\u0449\u0435 \u043e\u0431 \u043e\u0434\u043d\u043e\u0439 \u0445\u043e\u0440\u043e\u0448\u0435\u0439 \u0448\u0442\u0443\u043a\u0435. \u041c\u044b \u043c\u043e\u0436\u0435\u043c \u0434\u0435\u043b\u0430\u0442\u044c \u043d\u0430\u0448\u0438 \u0444\u043e\u0440\u043c\u044b \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u00ab\u0442\u0443\u043f\u044b\u043c\u0438\u00bb \u2014 \u0431\u0435\u0437 \u043a\u0430\u043a\u043e\u0439-\u043b\u0438\u0431\u043e \u043b\u043e\u0433\u0438\u043a\u0438 \u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0430 \u0431\u044d\u043a\u0435\u043d\u0434:<\/p>\n<pre><code class=\"dart\">void _onSubmit() {   widget.callback(form.value) }<\/code><\/pre>\n<p>\u041c\u044b \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u043c \u0432\u0438\u0434\u0436\u0435\u0442 \u0444\u043e\u0440\u043c\u044b \u0432 callback-\u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0438 \u043f\u043e\u0442\u043e\u043c \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u043c \u0435\u0435 \u043d\u0430\u0432\u0435\u0440\u0445, \u043d\u0430 submit, \u0442\u043e \u0435\u0441\u0442\u044c \u0441\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u0438. \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u0443 \u0444\u043e\u0440\u043c\u0443 \u0431\u0443\u0434\u0435\u0442 \u043e\u0447\u0435\u043d\u044c \u0443\u0434\u043e\u0431\u043d\u043e \u0438<\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-357325","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/357325","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=357325"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/357325\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=357325"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=357325"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=357325"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}