{"id":385497,"date":"2024-06-29T06:08:48","date_gmt":"2024-06-29T06:08:48","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=385497"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=385497","title":{"rendered":"<span>\u041c\u0430\u0441\u043a\u0438 \u0432\u0432\u043e\u0434\u0430 \u043d\u043e\u043c\u0435\u0440\u0430 \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u0430 \u043d\u0430 Flutter<\/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\u0441\u0435\u043c \u043f\u0440\u0438\u0432\u0435\u0442. \u041d\u0443\u0436\u043d\u043e \u043f\u043e\u0433\u043e\u0432\u043e\u0440\u0438\u0442\u044c \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043f\u0440\u043e \u0442\u0430\u043a\u0443\u044e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0443\u044e \u0438 \u043e\u0431\u044b\u0434\u0435\u043d\u043d\u0443\u044e \u0447\u0430\u0441\u0442\u044c \u043b\u044e\u0431\u043e\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u043a\u0430\u043a \u0432\u0432\u043e\u0434 \u043d\u043e\u043c\u0435\u0440\u0430 \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f. \u0420\u0435\u0447\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043e \u0440\u043e\u0441\u0441\u0438\u0439\u0441\u043a\u0438\u0445 \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u0430\u0445. \u041a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u0431\u044b, \u0447\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u0440\u043e\u0449\u0435? \u0421\u0442\u0430\u0432\u0438\u043c \u0432 \u043d\u0430\u0447\u0430\u043b\u043e \u0441\u0442\u0440\u043e\u043a\u0438 + \u0438\u043b\u0438 \u0434\u0430\u0436\u0435 +7 \u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u0442\u0435\u043b\u0435\u0444\u043e\u043d \u043d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 9. \u0414\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u043a\u0438\u043d\u0443\u0442\u044c \u0438 \u043c\u0430\u0441\u043a\u0443 \u0438 \u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u0431\u044b \u0432\u0441\u0435 \u0445\u043e\u0440\u043e\u0448\u043e. \u041d\u043e \u043d\u0435\u0442 \u0438\u043d\u043e\u0433\u0434\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438 <s>\u0434\u043b\u043e\u0431<\/s>&#8230;. \u0441\u043c\u043e\u0442\u0440\u044f\u0442 \u043d\u0435 \u0442\u0443\u0434\u0430 \u0438 \u043f\u0438\u0448\u0443\u0442 \u0441 8 \u0438\u043b\u0438 \u0441 7 \u0438 \u0432\u0441\u0435. \u0411\u0435\u0437 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0435\u0440\u0432\u0438\u0441 \u0438 \u0434\u0430\u0442\u044c \u043d\u0430\u043c \u0434\u0435\u043d\u0435\u0433 \u043d\u0430 <s>\u0434\u043e\u0448\u0438\u043a<\/s>  \u043d\u0430 \u0441\u043c\u0443\u0437\u0438. \u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432 \u0438\u0437 \u0434\u0440\u0443\u0433\u0438\u0445 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432:<\/p>\n<details class=\"spoiler\">\n<summary>\u041a\u0430\u043a \u044d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0432 wildberries<\/summary>\n<div class=\"spoiler__content\">\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/c2c\/b7d\/21e\/c2cb7d21e368f7ca718741bdccc38c68.gif\" alt=\"\u041b\u043e\u0433\u0438\u043a\u0430 \u043f\u0440\u043e\u0441\u0442\u0430: \u0441\u0442\u0430\u0432\u0438\u043c + \u0430 \u0434\u0430\u043b\u044c\u0448\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0441\u0430\u043c \u043f\u043e\u0439\u043c\u0435\u0442 \u0447\u0442\u043e \u0432\u0432\u043e\u0434\u0438\u0442\u044c.\" title=\"\u041b\u043e\u0433\u0438\u043a\u0430 \u043f\u0440\u043e\u0441\u0442\u0430: \u0441\u0442\u0430\u0432\u0438\u043c + \u0430 \u0434\u0430\u043b\u044c\u0448\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0441\u0430\u043c \u043f\u043e\u0439\u043c\u0435\u0442 \u0447\u0442\u043e \u0432\u0432\u043e\u0434\u0438\u0442\u044c.\" width=\"464\" height=\"817\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/c2c\/b7d\/21e\/c2cb7d21e368f7ca718741bdccc38c68.gif\"\/><\/p>\n<div><figcaption>\u041b\u043e\u0433\u0438\u043a\u0430 \u043f\u0440\u043e\u0441\u0442\u0430: \u0441\u0442\u0430\u0432\u0438\u043c + \u0430 \u0434\u0430\u043b\u044c\u0448\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0441\u0430\u043c \u043f\u043e\u0439\u043c\u0435\u0442 \u0447\u0442\u043e \u0432\u0432\u043e\u0434\u0438\u0442\u044c.<\/figcaption><\/div>\n<\/figure>\n<\/div>\n<\/details>\n<details class=\"spoiler\">\n<summary>\u041a\u0430\u043a \u044d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0432 \u0422\u0438\u043d\u044c\u043a\u043e\u0444\u0444<\/summary>\n<div class=\"spoiler__content\">\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/2f2\/dba\/a00\/2f2dbaa00659c97f2d5fc858fd2a4139.gif\" width=\"464\" height=\"824\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/2f2\/dba\/a00\/2f2dbaa00659c97f2d5fc858fd2a4139.gif\"\/><\/figure>\n<\/p>\n<\/div>\n<\/details>\n<h2>\u0417\u0430\u0434\u0430\u0447\u0430<\/h2>\n<p>\u041c\u044b \u0434\u0435\u043b\u0430\u0435\u043c \u043f\u0430\u043a\u0435\u0442 \u0434\u043b\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u0438\u0437 \u0420\u043e\u0441\u0441\u0438\u0438 \u0438 \u043f\u0430\u0440\u044b \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0445 \u0438\u043d\u043e\u0441\u0442\u0440\u0430\u043d\u0446\u0435\u0432. \u041d\u0430\u0448\u0438 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f:<\/p>\n<ul>\n<li>\n<p>\u041f\u043e\u043b\u0435 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u043f\u0443\u0441\u0442\u043e\u0435. \u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0441\u0430\u043c \u0440\u0435\u0448\u0430\u0435\u0442 \u0447\u0442\u043e \u0438 \u043a\u0430\u043a \u0432\u0432\u043e\u0434\u0438\u0442\u044c<\/p>\n<\/li>\n<li>\n<p>\u043f\u0440\u0438 \u0432\u0432\u043e\u0434\u0435 7,8,9 \u0434\u043e\u043b\u0436\u043d\u0430 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043c\u0430\u0441\u043a\u0430 \u0440\u043e\u0441\u0441\u0438\u0439\u0441\u043a\u0438\u0445 \u043d\u043e\u043c\u0435\u0440\u043e\u0432 (\u0425 (\u0425\u0425\u0425) \u0425\u0425\u0425-\u0425\u0425-\u0425\u0425),<\/p>\n<\/li>\n<li>\n<p>\u0432 \u043c\u0430\u0441\u043a\u0443 \u043c\u043e\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0432\u0432\u0435\u0441\u0442\u0438 \u0438 \u0438\u043d\u043e\u0441\u0442\u0440\u0430\u043d\u043d\u044b\u0439 \u043d\u043e\u043c\u0435\u0440. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 +1 <\/p>\n<\/li>\n<\/ul>\n<h2>\u0412\u0440\u0435\u043c\u044f \u0441\u0442\u0443\u0447\u0430\u0442\u044c \u043f\u043e \u041a\u043b\u0430\u0432\u0438\u0430\u0442\u0443\u0440\u0435<\/h2>\n<p>\u0414\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u0430\u0441\u043b\u0435\u0434\u043d\u0438\u043a\u0430 TextInputFormatter. \u0415\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0432 \u043b\u044e\u0431\u043e\u0435 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u043e\u0435 \u043f\u043e\u043b\u0435 \u0432 inputFormatters.\u0410 \u043f\u043e\u0442\u043e\u043c \u0432\u044b\u0442\u0430\u0449\u0438\u0442\u044c \u0432\u0441\u044e \u043d\u0443\u0436\u043d\u0443\u044e \u043d\u0430\u043c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e.<\/p>\n<pre><code class=\"dart\">class RuPhoneInputFormatter extends TextInputFormatter{   @override   TextEditingValue formatEditUpdate(TextEditingValue oldValue, TextEditingValue newValue) {        } }<\/code><\/pre>\n<p>\u0414\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u044b <\/p>\n<ol>\n<li>\n<p>\u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f \u0434\u043b\u044f \u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f<\/p>\n<\/li>\n<li>\n<p>\u0444\u043b\u0430\u0433 \u0440\u043e\u0441\u0441\u0438\u0439\u0441\u043a\u0438 \u043b\u0438 \u044d\u0442\u043e \u043d\u043e\u043c\u0435\u0440<\/p>\n<\/li>\n<li>\n<p>\u043c\u0435\u0442\u043e\u0434 \u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u0443\u044e\u0449\u0438\u0439 \u043d\u043e\u043c\u0435\u0440<\/p>\n<\/li>\n<li>\n<p>\u0433\u0435\u0442\u0442\u0435\u0440 \u0447\u0438\u0441\u0442\u043e\u0433\u043e \u043d\u043e\u043c\u0435\u0440\u0430 (\u043d\u043e\u043c\u0435\u0440 \u0431\u0435\u0437 \u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f. \u0414\u043b\u044f \u0440\u043e\u0441\u0441\u0438\u0439\u0441\u043a\u0438\u0445 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0441 9, \u0434\u043b\u044f \u0438\u043d\u043e\u0441\u0442\u0440\u0430\u043d\u043d\u044b\u0445 c \u043f\u0435\u0440\u0432\u043e\u0439 \u0446\u0438\u0444\u0440\u044b \u0432 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u043e\u043c \u043f\u043e\u043b\u0435) <\/p>\n<\/li>\n<\/ol>\n<h3>\u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043d\u0443\u0436\u043d\u044b\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0438 \u0434\u0435\u0444\u043e\u043b\u0442\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f (\u0432\u0434\u0440\u0443\u0433 \u043c\u044b \u043d\u043e\u043c\u0435\u0440 \u0443\u0436\u0435 \u0437\u043d\u0430\u0435\u043c) <\/h3>\n<pre><code class=\"dart\">class RuPhoneInputFormatter extends TextInputFormatter{   \/\/\u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0442\u0435\u043b\u0435\u0444\u043e\u043d   String _formattedPhone = \"\";   \/\/\u0420\u043e\u0441\u0441\u0438\u0439\u0441\u043a\u0438\u0439 \u043b\u0438 \u043d\u043e\u043c\u0435\u0440   bool _isRu=false;    \/\/\u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u043d\u043e\u043c\u0435\u0440 \u043f\u043e \u0434\u0435\u0444\u043e\u043b\u0442\u0443   RuPhoneInputFormatter({     String? initialText,   }) {     if (initialText != null) {       formatEditUpdate(           TextEditingValue.empty, TextEditingValue(text: initialText));     }   }      \/\/\/\u0418\u0435\u0442\u043e\u0434 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043d\u044b\u0439 \u0442\u0435\u043b\u0435\u0444\u043e\u043d   String getMaskedPhone() {     return _formattedPhone;   }   \/\/\/\u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0447\u0438\u0441\u0442\u044b\u0439 \u0442\u0435\u043b\u0435\u0444\u043e\u043d. \u0434\u043b\u044f \u0420\u043e\u0441\u0441\u0438\u0438 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0441 9   String getClearPhone() {     if(_formattedPhone.isEmpty){       return '';     }     if(!_isRu){       return _formattedPhone.replaceAll(RegExp(r'\\D'), '');     }     return _formattedPhone.replaceAll(RegExp(r'\\D'), '').substring(         1,         (_formattedPhone.replaceAll(RegExp(r'\\D'), '').length >= 11)             ? 11             : _formattedPhone.replaceAll(RegExp(r'\\D'), '').length);   }   \/\/\/\u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 \u0437\u0430\u043f\u043e\u043b\u043d\u0438\u043b \u043b\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0442\u0435\u043b\u0435\u0444\u043e\u043d. \u0410\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u0420\u043e\u0441\u0441\u0438\u0439\u0441\u043a\u0438\u0445 \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u043e\u0432   bool isDone(){     if(!_isRu){       return true;     }     return (_formattedPhone.replaceAll(RegExp(r'\\D'), '').length>10);   }   \/\/\/\u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0444\u043b\u0430\u0433 \u0420\u043e\u0441\u0441\u0438\u0439\u0441\u043a\u0438 \u043b\u0438 \u043d\u043e\u043c\u0435\u0440   get isRussian=>_isRu; }<\/code><\/pre>\n<h3>\u041f\u0438\u0448\u0435\u043c \u043c\u0435\u0442\u043e\u0434 \u0434\u043b\u044f \u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f<\/h3>\n<p>\u043c\u0435\u0442\u043e\u0434 \u0434\u043e\u043b\u0436\u0435\u043d \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c \u043f\u0435\u0440\u0432\u044b\u0435 \u0446\u0438\u0444\u0440\u044b \u0438 \u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0435\u0441\u043b\u0438 \u044d\u0442\u043e 7,8,9<\/p>\n<pre><code class=\"dart\">String _formattingPhone(String text){   \/\/\u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043a\u0430 \u043f\u0440\u043e\u0442\u0438\u0430 \u0431\u0443\u043a\u0432. \u0432 \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0446\u0438\u0444\u0440\u044b     text=text.replaceAll(RegExp(r'\\D'), '');     if(text.isNotEmpty){       String phone='';       \/\/\u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u0440\u043e\u0441\u0441\u0438\u0439\u0441\u043a\u0438 \u043b\u0438 \u043d\u043e\u043c\u0435\u0440       if(['7','8','9'].contains(text[0])){         _isRu=true;         \/\/\u0435\u0441\u043b\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043d\u0430\u0447\u0430\u043b \u0441 9, \u0442\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u043c 7         if(text[0]=='9'){           text='7$text';         }         \/\/\u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u043d\u0443\u0436\u0435\u043d \u043b\u0438 +         String firstSymbols=(text[0]=='8') ? '8':'+7';         \/\/\u0441\u0430\u043c\u043e \u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435         phone='$firstSymbols ';         if(text.length>1){           phone+='(${text.substring(1,(text.length&lt;4)?text.length:4)}';         }if(text.length>=5){           phone+=') ${text.substring(4,(text.length&lt;7)?text.length:7)}';         }         if(text.length>=8){           phone+='-${text.substring(7,(text.length&lt;9)?text.length:9)}';         }         if(text.length>=10){           phone+='-${text.substring(9,(text.length&lt;11)?text.length:11)}';         }         return phone;       }else{         _isRu=false;         return '+$text';       }     }     return '';   }<\/code><\/pre>\n<h3>\u0421\u043e\u0431\u0438\u0440\u0430\u0435\u043c \u0432\u0441\u0435 \u0432 \u043a\u0443\u0447\u0443 <\/h3>\n<p>\u0414\u043e\u0431\u0430\u0432\u0438\u043c \u043a\u043e\u0434 \u0434\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u0430<\/p>\n<pre><code class=\"dart\">@override   TextEditingValue formatEditUpdate(TextEditingValue oldValue, TextEditingValue newValue) {     String text=newValue.text.replaceAll(RegExp(r'\\D'), '');     int selectionStart=oldValue.selection.end;      \/\/\u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u0441\u0442\u0435\u0440\u0430\u0435\u0442 \u043b\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0432\u0441\u0435 \u0441\u0438\u043c\u0432\u043e\u043b\u044b?     if(oldValue.text=='${newValue.text} '){       _formattedPhone='';       return TextEditingValue(           text: _formattedPhone,           selection: TextSelection(               baseOffset: _formattedPhone.length,               extentOffset: _formattedPhone.length,               affinity: newValue.selection.affinity,               isDirectional: newValue.selection.isDirectional           )       );     }      \/\/\u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u0443\u0435\u0442 \u043b\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0442\u0435\u043b\u0435\u0444\u043e\u043d \u0433\u0434\u0435 \u0442\u043e \u043f\u043e \u0441\u0435\u0440\u0435\u0434\u0438\u043d\u0435?     if(selectionStart!=_formattedPhone.length){       _formattedPhone= _formattingPhone(text);       \/\/\u0435\u0441\u043b\u0438 \u0434\u0430, \u0442\u043e \u043d\u0435 \u043f\u0435\u0440\u0435\u043a\u0438\u0434\u044b\u0432\u0430\u0435\u043c \u043a\u0443\u0440\u0441\u043e\u0432 \u0432 \u0441\u0430\u043c\u044b\u0439 \u043a\u043e\u043d\u0435\u0446        return TextEditingValue(           text: _formattedPhone,           selection: TextSelection(               baseOffset: newValue.selection.baseOffset,               extentOffset: newValue.selection.extentOffset,               affinity: newValue.selection.affinity,               isDirectional: newValue.selection.isDirectional           )       );     }      _formattedPhone= _formattingPhone(text);      \/\/\u0435\u0441\u043b\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043f\u0440\u043e\u0441\u0442\u043e \u0432\u0432\u043e\u0434\u0438\u0442 \u0442\u0435\u043b\u0435\u0444\u043e\u043d,      \/\/\u0442\u043e \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0438\u043c \u043a\u0443\u0440\u0441\u043e\u0440 \u0432 \u043a\u043e\u043d\u0435\u0446 \u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438     return TextEditingValue(         text: _formattedPhone,         selection: TextSelection(             baseOffset: _formattedPhone.length,             extentOffset: _formattedPhone.length,             affinity: newValue.selection.affinity,             isDirectional: newValue.selection.isDirectional         )     );   }<\/code><\/pre>\n<h2>\u0418\u0442\u043e\u0433\u0438<\/h2>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/d88\/4cb\/70e\/d884cb70e7691dd6af434bec84394c69.gif\" alt=\"\u043f\u0440\u0438\u043c\u0435\u0440 \u0440\u0430\u0431\u043e\u0442\u044b \u0432\u0438\u0434\u0436\u0435\u0442\u0430. \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0441\u0432\u043e\u0431\u043e\u0434\u0435\u043d \u043f\u0440\u0438 \u0432\u0432\u043e\u0434\u0435 \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u0430. \u0422\u0430\u043a \u0436\u0435 \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u043b\u0430\u0441\u044c \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u0438 \u0438\u043d\u043e\u0441\u0442\u0440\u0430\u043d\u043d\u044b\u0445 \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u043e\u0432.\" title=\"\u043f\u0440\u0438\u043c\u0435\u0440 \u0440\u0430\u0431\u043e\u0442\u044b \u0432\u0438\u0434\u0436\u0435\u0442\u0430. \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0441\u0432\u043e\u0431\u043e\u0434\u0435\u043d \u043f\u0440\u0438 \u0432\u0432\u043e\u0434\u0435 \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u0430. \u0422\u0430\u043a \u0436\u0435 \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u043b\u0430\u0441\u044c \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u0438 \u0438\u043d\u043e\u0441\u0442\u0440\u0430\u043d\u043d\u044b\u0445 \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u043e\u0432.\" width=\"562\" height=\"1280\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/d88\/4cb\/70e\/d884cb70e7691dd6af434bec84394c69.gif\"\/><\/p>\n<div><figcaption>\u043f\u0440\u0438\u043c\u0435\u0440 \u0440\u0430\u0431\u043e\u0442\u044b \u0432\u0438\u0434\u0436\u0435\u0442\u0430. \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0441\u0432\u043e\u0431\u043e\u0434\u0435\u043d \u043f\u0440\u0438 \u0432\u0432\u043e\u0434\u0435 \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u0430. \u0422\u0430\u043a \u0436\u0435 \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u043b\u0430\u0441\u044c \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u0438 \u0438\u043d\u043e\u0441\u0442\u0440\u0430\u043d\u043d\u044b\u0445 \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u043e\u0432.<\/figcaption><\/div>\n<\/figure>\n<h2>\u0410 \u0447\u0442\u043e \u0434\u0430\u043b\u044c\u0448\u0435?<\/h2>\n<p>\u0432 \u043f\u043b\u0430\u043d\u0430\u0445 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043c\u0430\u0441\u043a\u0438 \u0432\u0441\u0435\u0445 \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u043e\u0432 \u0441\u0442\u0440\u0430\u043d \u0421\u041d\u0413. <\/p>\n<h2>\u041f\u0430\u043a\u0435\u0442<\/h2>\n<p>\u0414\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u0432\u0441\u0435 \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0438 <a href=\"https:\/\/github.com\/Kotelnikovekb\/ru_phone_formatter\" rel=\"noopener noreferrer nofollow\">\u0442\u0443\u0442<\/a><\/p>\n<p>\u0410 \u0435\u0449\u0435 \u0435\u0441\u0442\u044c \u043f\u0430\u043a\u0435\u0442 \u043d\u0430 pub.dev <a href=\"https:\/\/pub.dev\/packages\/ru_phone_formatter\" rel=\"noopener noreferrer nofollow\">\u0442\u0443\u0442<\/a><\/p>\n<p>\u041f\u043e\u0434\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u0430\u0432\u0442\u043e\u0440\u0430 <a href=\"https:\/\/www.donationalerts.com\/r\/mryurideveloper\" rel=\"noopener noreferrer nofollow\">\u0442\u0443\u0442<\/a><\/p>\n<p>\u0412\u0434\u043e\u0445\u043d\u043e\u0432\u0435\u043d\u0438\u0435 \u0447\u0435\u0440\u043f\u0430\u043b \u0432 \u0432\u0438\u0434\u043e\u0441\u0438\u043a\u0435 \u043d\u0430 <a href=\"https:\/\/www.youtube.com\/watch?v=Lxj_v5z0xRE&amp;t=3108s\" rel=\"noopener noreferrer nofollow\">\u042e\u0442\u0443\u0431\u0435<\/a><\/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\/729216\/\"> https:\/\/habr.com\/ru\/articles\/729216\/<\/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\u0441\u0435\u043c \u043f\u0440\u0438\u0432\u0435\u0442. \u041d\u0443\u0436\u043d\u043e \u043f\u043e\u0433\u043e\u0432\u043e\u0440\u0438\u0442\u044c \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043f\u0440\u043e \u0442\u0430\u043a\u0443\u044e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0443\u044e \u0438 \u043e\u0431\u044b\u0434\u0435\u043d\u043d\u0443\u044e \u0447\u0430\u0441\u0442\u044c \u043b\u044e\u0431\u043e\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u043a\u0430\u043a \u0432\u0432\u043e\u0434 \u043d\u043e\u043c\u0435\u0440\u0430 \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f. \u0420\u0435\u0447\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043e \u0440\u043e\u0441\u0441\u0438\u0439\u0441\u043a\u0438\u0445 \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u0430\u0445. \u041a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u0431\u044b, \u0447\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u0440\u043e\u0449\u0435? \u0421\u0442\u0430\u0432\u0438\u043c \u0432 \u043d\u0430\u0447\u0430\u043b\u043e \u0441\u0442\u0440\u043e\u043a\u0438 + \u0438\u043b\u0438 \u0434\u0430\u0436\u0435 +7 \u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u0442\u0435\u043b\u0435\u0444\u043e\u043d \u043d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 9. \u0414\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u043a\u0438\u043d\u0443\u0442\u044c \u0438 \u043c\u0430\u0441\u043a\u0443 \u0438 \u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u0431\u044b \u0432\u0441\u0435 \u0445\u043e\u0440\u043e\u0448\u043e. \u041d\u043e \u043d\u0435\u0442 \u0438\u043d\u043e\u0433\u0434\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438 <s>\u0434\u043b\u043e\u0431<\/s>&#8230;. \u0441\u043c\u043e\u0442\u0440\u044f\u0442 \u043d\u0435 \u0442\u0443\u0434\u0430 \u0438 \u043f\u0438\u0448\u0443\u0442 \u0441 8 \u0438\u043b\u0438 \u0441 7 \u0438 \u0432\u0441\u0435. \u0411\u0435\u0437 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0435\u0440\u0432\u0438\u0441 \u0438 \u0434\u0430\u0442\u044c \u043d\u0430\u043c \u0434\u0435\u043d\u0435\u0433 \u043d\u0430 <s>\u0434\u043e\u0448\u0438\u043a<\/s>  \u043d\u0430 \u0441\u043c\u0443\u0437\u0438. \u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432 \u0438\u0437 \u0434\u0440\u0443\u0433\u0438\u0445 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432:<\/p>\n<details class=\"spoiler\">\n<summary>\u041a\u0430\u043a \u044d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0432 wildberries<\/summary>\n<div class=\"spoiler__content\">\n<figure class=\"\">\n<div><figcaption>\u041b\u043e\u0433\u0438\u043a\u0430 \u043f\u0440\u043e\u0441\u0442\u0430: \u0441\u0442\u0430\u0432\u0438\u043c + \u0430 \u0434\u0430\u043b\u044c\u0448\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0441\u0430\u043c \u043f\u043e\u0439\u043c\u0435\u0442 \u0447\u0442\u043e \u0432\u0432\u043e\u0434\u0438\u0442\u044c.<\/figcaption><\/div>\n<\/figure>\n<\/div>\n<\/details>\n<details class=\"spoiler\">\n<summary>\u041a\u0430\u043a \u044d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0432 \u0422\u0438\u043d\u044c\u043a\u043e\u0444\u0444<\/summary>\n<div class=\"spoiler__content\">\n<figure class=\"\"><\/figure>\n<\/p>\n<\/div>\n<\/details>\n<h2>\u0417\u0430\u0434\u0430\u0447\u0430<\/h2>\n<p>\u041c\u044b \u0434\u0435\u043b\u0430\u0435\u043c \u043f\u0430\u043a\u0435\u0442 \u0434\u043b\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u0438\u0437 \u0420\u043e\u0441\u0441\u0438\u0438 \u0438 \u043f\u0430\u0440\u044b \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0445 \u0438\u043d\u043e\u0441\u0442\u0440\u0430\u043d\u0446\u0435\u0432. \u041d\u0430\u0448\u0438 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f:<\/p>\n<ul>\n<li>\n<p>\u041f\u043e\u043b\u0435 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u043f\u0443\u0441\u0442\u043e\u0435. \u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0441\u0430\u043c \u0440\u0435\u0448\u0430\u0435\u0442 \u0447\u0442\u043e \u0438 \u043a\u0430\u043a \u0432\u0432\u043e\u0434\u0438\u0442\u044c<\/p>\n<\/li>\n<li>\n<p>\u043f\u0440\u0438 \u0432\u0432\u043e\u0434\u0435 7,8,9 \u0434\u043e\u043b\u0436\u043d\u0430 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043c\u0430\u0441\u043a\u0430 \u0440\u043e\u0441\u0441\u0438\u0439\u0441\u043a\u0438\u0445 \u043d\u043e\u043c\u0435\u0440\u043e\u0432 (\u0425 (\u0425\u0425\u0425) \u0425\u0425\u0425-\u0425\u0425-\u0425\u0425),<\/p>\n<\/li>\n<li>\n<p>\u0432 \u043c\u0430\u0441\u043a\u0443 \u043c\u043e\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0432\u0432\u0435\u0441\u0442\u0438 \u0438 \u0438\u043d\u043e\u0441\u0442\u0440\u0430\u043d\u043d\u044b\u0439 \u043d\u043e\u043c\u0435\u0440. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 +1 <\/p>\n<\/li>\n<\/ul>\n<h2>\u0412\u0440\u0435\u043c\u044f \u0441\u0442\u0443\u0447\u0430\u0442\u044c \u043f\u043e \u041a\u043b\u0430\u0432\u0438\u0430\u0442\u0443\u0440\u0435<\/h2>\n<p>\u0414\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u0430\u0441\u043b\u0435\u0434\u043d\u0438\u043a\u0430 TextInputFormatter. \u0415\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0432 \u043b\u044e\u0431\u043e\u0435 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u043e\u0435 \u043f\u043e\u043b\u0435 \u0432 inputFormatters.\u0410 \u043f\u043e\u0442\u043e\u043c \u0432\u044b\u0442\u0430\u0449\u0438\u0442\u044c \u0432\u0441\u044e \u043d\u0443\u0436\u043d\u0443\u044e \u043d\u0430\u043c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e.<\/p>\n<pre><code class=\"dart\">class RuPhoneInputFormatter extends TextInputFormatter{   @override   TextEditingValue formatEditUpdate(TextEditingValue oldValue, TextEditingValue newValue) {        } }<\/code><\/pre>\n<p>\u0414\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u044b <\/p>\n<ol>\n<li>\n<p>\u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f \u0434\u043b\u044f \u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f<\/p>\n<\/li>\n<li>\n<p>\u0444\u043b\u0430\u0433 \u0440\u043e\u0441\u0441\u0438\u0439\u0441\u043a\u0438 \u043b\u0438 \u044d\u0442\u043e \u043d\u043e\u043c\u0435\u0440<\/p>\n<\/li>\n<li>\n<p>\u043c\u0435\u0442\u043e\u0434 \u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u0443\u044e\u0449\u0438\u0439 \u043d\u043e\u043c\u0435\u0440<\/p>\n<\/li>\n<li>\n<p>\u0433\u0435\u0442\u0442\u0435\u0440 \u0447\u0438\u0441\u0442\u043e\u0433\u043e \u043d\u043e\u043c\u0435\u0440\u0430 (\u043d\u043e\u043c\u0435\u0440 \u0431\u0435\u0437 \u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f. \u0414\u043b\u044f \u0440\u043e\u0441\u0441\u0438\u0439\u0441\u043a\u0438\u0445 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0441 9, \u0434\u043b\u044f \u0438\u043d\u043e\u0441\u0442\u0440\u0430\u043d\u043d\u044b\u0445 c \u043f\u0435\u0440\u0432\u043e\u0439 \u0446\u0438\u0444\u0440\u044b \u0432 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u043e\u043c \u043f\u043e\u043b\u0435) <\/p>\n<\/li>\n<\/ol>\n<h3>\u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043d\u0443\u0436\u043d\u044b\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0438 \u0434\u0435\u0444\u043e\u043b\u0442\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f (\u0432\u0434\u0440\u0443\u0433 \u043c\u044b \u043d\u043e\u043c\u0435\u0440 \u0443\u0436\u0435 \u0437\u043d\u0430\u0435\u043c) <\/h3>\n<pre><code class=\"dart\">class RuPhoneInputFormatter extends TextInputFormatter{   \/\/\u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0442\u0435\u043b\u0435\u0444\u043e\u043d   String _formattedPhone = \"\";   \/\/\u0420\u043e\u0441\u0441\u0438\u0439\u0441\u043a\u0438\u0439 \u043b\u0438 \u043d\u043e\u043c\u0435\u0440   bool _isRu=false;    \/\/\u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u043d\u043e\u043c\u0435\u0440 \u043f\u043e \u0434\u0435\u0444\u043e\u043b\u0442\u0443   RuPhoneInputFormatter({     String? initialText,   }) {     if (initialText != null) {       formatEditUpdate(           TextEditingValue.empty, TextEditingValue(text: initialText));     }   }      \/\/\/\u0418\u0435\u0442\u043e\u0434 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043d\u044b\u0439 \u0442\u0435\u043b\u0435\u0444\u043e\u043d   String getMaskedPhone() {     return _formattedPhone;   }   \/\/\/\u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0447\u0438\u0441\u0442\u044b\u0439 \u0442\u0435\u043b\u0435\u0444\u043e\u043d. \u0434\u043b\u044f \u0420\u043e\u0441\u0441\u0438\u0438 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0441 9   String getClearPhone() {     if(_formattedPhone.isEmpty){       return '';     }     if(!_isRu){       return _formattedPhone.replaceAll(RegExp(r'\\D'), '');     }     return _formattedPhone.replaceAll(RegExp(r'\\D'), '').substring(         1,         (_formattedPhone.replaceAll(RegExp(r'\\D'), '').length >= 11)             ? 11             : _formattedPhone.replaceAll(RegExp(r'\\D'), '').length);   }   \/\/\/\u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 \u0437\u0430\u043f\u043e\u043b\u043d\u0438\u043b \u043b\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0442\u0435\u043b\u0435\u0444\u043e\u043d. \u0410\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u0420\u043e\u0441\u0441\u0438\u0439\u0441\u043a\u0438\u0445 \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u043e\u0432   bool isDone(){     if(!_isRu){       return true;     }     return (_formattedPhone.replaceAll(RegExp(r'\\D'), '').length>10);   }   \/\/\/\u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0444\u043b\u0430\u0433 \u0420\u043e\u0441\u0441\u0438\u0439\u0441\u043a\u0438 \u043b\u0438 \u043d\u043e\u043c\u0435\u0440   get isRussian=>_isRu; }<\/code><\/pre>\n<h3>\u041f\u0438\u0448\u0435\u043c \u043c\u0435\u0442\u043e\u0434 \u0434\u043b\u044f \u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f<\/h3>\n<p>\u043c\u0435\u0442\u043e\u0434 \u0434\u043e\u043b\u0436\u0435\u043d \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c \u043f\u0435\u0440\u0432\u044b\u0435 \u0446\u0438\u0444\u0440\u044b \u0438 \u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0435\u0441\u043b\u0438 \u044d\u0442\u043e 7,8,9<\/p>\n<pre><code class=\"dart\">String _formattingPhone(String text){   \/\/\u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043a\u0430 \u043f\u0440\u043e\u0442\u0438\u0430 \u0431\u0443\u043a\u0432. \u0432 \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0446\u0438\u0444\u0440\u044b     text=text.replaceAll(RegExp(r'\\D'), '');     if(text.isNotEmpty){       String phone='';       \/\/\u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u0440\u043e\u0441\u0441\u0438\u0439\u0441\u043a\u0438 \u043b\u0438 \u043d\u043e\u043c\u0435\u0440       if(['7','8','9'].contains(text[0])){         _isRu=true;         \/\/\u0435\u0441\u043b\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043d\u0430\u0447\u0430\u043b \u0441 9, \u0442\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u043c 7         if(text[0]=='9'){           text='7$text';         }         \/\/\u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u043d\u0443\u0436\u0435\u043d \u043b\u0438 +         String firstSymbols=(text[0]=='8') ? '8':'+7';         \/\/\u0441\u0430\u043c\u043e \u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435         phone='$firstSymbols ';         if(text.length>1){           phone+='(${text.substring(1,(text.length&lt;4)?text.length:4)}';         }if(text.length>=5){           phone+=') ${text.substring(4,(text.length&lt;7)?text.length:7)}';         }         if(text.length>=8){           phone+='-${text.substring(7,(text.length&lt;9)?text.length:9)}';         }         if(text.length>=10){           phone+='-${text.substring(9,(text.length&lt;11)?text.length:11)}';         }         return phone;       }else{         _isRu=false;         return '+$text';       }     }     return '';   }<\/code><\/pre>\n<h3>\u0421\u043e\u0431\u0438\u0440\u0430\u0435\u043c \u0432\u0441\u0435 \u0432 \u043a\u0443\u0447\u0443 <\/h3>\n<p>\u0414\u043e\u0431\u0430\u0432\u0438\u043c \u043a\u043e\u0434 \u0434\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u0430<\/p>\n<pre><code class=\"dart\">@override   TextEditingValue formatEditUpdate(TextEditingValue oldValue, TextEditingValue newValue) {     String text=newValue.text.replaceAll(RegExp(r'\\D'), '');     int selectionStart=oldValue.selection.end;      \/\/\u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u0441\u0442\u0435\u0440\u0430\u0435\u0442 \u043b\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0432\u0441\u0435 \u0441\u0438\u043c\u0432\u043e\u043b\u044b?     if(oldValue.text=='${newValue.text} '){       _formattedPhone='';       return TextEditingValue(           text: _formattedPhone,           selection: TextSelection(               baseOffset: _formattedPhone.length,               extentOffset: _formattedPhone.length,               affinity: newValue.selection.affinity,               isDirectional: newValue.selection.isDirectional           )       );     }      \/\/\u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u0443\u0435\u0442 \u043b\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0442\u0435\u043b\u0435\u0444\u043e\u043d \u0433\u0434\u0435 \u0442\u043e \u043f\u043e \u0441\u0435\u0440\u0435\u0434\u0438\u043d\u0435?     if(selectionStart!=_formattedPhone.length){       _formattedPhone= _formattingPhone(text);       \/\/\u0435\u0441\u043b\u0438 \u0434\u0430, \u0442\u043e \u043d\u0435 \u043f\u0435\u0440\u0435\u043a\u0438\u0434\u044b\u0432\u0430\u0435\u043c \u043a\u0443\u0440\u0441\u043e\u0432 \u0432 \u0441\u0430\u043c\u044b\u0439 \u043a\u043e\u043d\u0435\u0446        return TextEditingValue(           text: _formattedPhone,           selection: TextSelection(               baseOffset: newValue.selection.baseOffset,               extentOffset: newValue.selection.extentOffset,               affinity: newValue.selection.affinity,               isDirectional: newValue.selection.isDirectional           )       );     }      _formattedPhone= _formattingPhone(text);      \/\/\u0435\u0441\u043b\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043f\u0440\u043e\u0441\u0442\u043e \u0432\u0432\u043e\u0434\u0438\u0442 \u0442\u0435\u043b\u0435\u0444\u043e\u043d,      \/\/\u0442\u043e \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0438\u043c \u043a\u0443\u0440\u0441\u043e\u0440 \u0432 \u043a\u043e\u043d\u0435\u0446 \u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438     return TextEditingValue(         text: _formattedPhone,         selection: TextSelection(             baseOffset: _formattedPhone.length,             extentOffset: _formattedPhone.length,             affinity: newValue.selection.affinity,             isDirectional: newValue.selection.isDirectional         )     );   }<\/code><\/pre>\n<h2>\u0418\u0442\u043e\u0433\u0438<\/h2>\n<figure class=\"full-width\">\n<div><figcaption>\u043f\u0440\u0438\u043c\u0435\u0440 \u0440\u0430\u0431\u043e\u0442\u044b \u0432\u0438\u0434\u0436\u0435\u0442\u0430. \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0441\u0432\u043e\u0431\u043e\u0434\u0435\u043d \u043f\u0440\u0438 \u0432\u0432\u043e\u0434\u0435 \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u0430. \u0422\u0430\u043a \u0436\u0435 \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u043b\u0430\u0441\u044c \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u0438 \u0438\u043d\u043e\u0441\u0442\u0440\u0430\u043d\u043d\u044b\u0445 \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u043e\u0432.<\/figcaption><\/div>\n<\/figure>\n<h2>\u0410 \u0447\u0442\u043e \u0434\u0430\u043b\u044c\u0448\u0435?<\/h2>\n<p>\u0432 \u043f\u043b\u0430\u043d\u0430\u0445 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043c\u0430\u0441\u043a\u0438 \u0432\u0441\u0435\u0445 \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u043e\u0432 \u0441\u0442\u0440\u0430\u043d \u0421\u041d\u0413. <\/p>\n<h2>\u041f\u0430\u043a\u0435\u0442<\/h2>\n<p>\u0414\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u0432\u0441\u0435 \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0438 <a href=\"https:\/\/github.com\/Kotelnikovekb\/ru_phone_formatter\" rel=\"noopener noreferrer nofollow\">\u0442\u0443\u0442<\/a><\/p>\n<p>\u0410 \u0435\u0449\u0435 \u0435\u0441\u0442\u044c \u043f\u0430\u043a\u0435\u0442 \u043d\u0430 pub.dev <a href=\"https:\/\/pub.dev\/packages\/ru_phone_formatter\" rel=\"noopener noreferrer nofollow\">\u0442\u0443\u0442<\/a><\/p>\n<p>\u041f\u043e\u0434\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u0430\u0432\u0442\u043e\u0440\u0430 <a href=\"https:\/\/www.donationalerts.com\/r\/mryurideveloper\" rel=\"noopener noreferrer nofollow\">\u0442\u0443\u0442<\/a><\/p>\n<p>\u0412\u0434\u043e\u0445\u043d\u043e\u0432\u0435\u043d\u0438\u0435 \u0447\u0435\u0440\u043f\u0430\u043b \u0432 \u0432\u0438\u0434\u043e\u0441\u0438\u043a\u0435 \u043d\u0430 <a href=\"https:\/\/www.youtube.com\/watch?v=Lxj_v5z0xRE&amp;t=3108s\" rel=\"noopener noreferrer nofollow\">\u042e\u0442\u0443\u0431\u0435<\/a><\/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\/729216\/\"> https:\/\/habr.com\/ru\/articles\/729216\/<\/a><br \/><\/br><\/br><\/p>\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-385497","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/385497","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=385497"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/385497\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=385497"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=385497"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=385497"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}