{"id":338977,"date":"2022-09-28T15:00:34","date_gmt":"2022-09-28T15:00:34","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=338977"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=338977","title":{"rendered":"<span>Flutter: \u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0442\u0435\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f<\/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, \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u0438 Habr! \u0412 \u043d\u0430\u0447\u0430\u043b\u0435 \u044f \u0445\u043e\u0447\u0443 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0430\u043a\u0446\u0435\u043d\u0442 \u043d\u0430 \u0442\u043e\u043c, \u0447\u0442\u043e \u0441\u0442\u0430\u0442\u044c\u044f \u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0430 \u0434\u043b\u044f \u043d\u043e\u0432\u0438\u0447\u043a\u043e\u0432, \u043e\u0434\u043d\u0430\u043a\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u043e\u043b\u0435\u0437\u043d\u043e\u0439 \u0434\u043b\u044f \u0431\u043e\u043b\u0435\u0435 \u043e\u043f\u044b\u0442\u043d\u044b\u0445 \u043a\u043e\u043b\u043b\u0435\u0433. \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u043f\u0440\u043e \u0442\u043e, \u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0435 \u0442\u0435\u043c\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u043a\u0430\u043a\u0438\u0435 \u043e\u0448\u0438\u0431\u043a\u0438 \u043e\u0431\u044b\u0447\u043d\u043e \u0434\u0435\u043b\u0430\u044e\u0442 \u043d\u043e\u0432\u0438\u0447\u043a\u0438 \u0438 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u044e, \u043a\u0430\u043a \u043f\u043e \u043c\u043d\u0435, \u044d\u043b\u0435\u0433\u0430\u043d\u0442\u043d\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0442\u0435\u043c.<\/p>\n<h2>\u0427\u0442\u043e \u0442\u0430\u043a\u043e\u0435 \u0442\u0435\u043c\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f<\/h2>\n<p>\u0422\u0435\u043c\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u2014 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044f \u0432\u0441\u0435\u0445 \u0441\u0442\u0438\u043b\u0435\u0439 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u0435\u0442 \u0435\u043c\u0443 \u043f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u0432\u0438\u0434. \u042d\u0442\u043e \u0432\u0441\u0435 \u0446\u0432\u0435\u0442\u0430 \u0432\u0430\u0448\u0438\u0445 \u0432\u0438\u0434\u0436\u0435\u0442\u043e\u0432, \u0432\u0441\u0435 \u0433\u0440\u0430\u0434\u0438\u0435\u043d\u0442\u044b, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0441\u0442\u0438\u043b\u0438 \u0442\u0435\u043a\u0441\u0442\u0430, \u043a\u043d\u043e\u043f\u043e\u043a \u0438 \u0442.\u0434. \u0415\u0441\u043b\u0438 \u043f\u0440\u043e\u0432\u043e\u0434\u0438\u0442\u044c \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u044e \u0441 \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u043e\u043c, \u0442\u043e \u044d\u0442\u043e \u0432\u0441\u044f \u043e\u0434\u0435\u0436\u0434\u0430 \u043d\u0430 \u043d\u0435\u043c.  <\/p>\n<h2>\u041a\u0430\u043a\u0438\u0435 \u043e\u0448\u0438\u0431\u043a\u0438 \u0434\u043e\u043f\u0443\u0441\u043a\u0430\u044e\u0442 \u043d\u043e\u0432\u0438\u0447\u043a\u0438, \u0441\u0442\u0438\u043b\u0438\u0437\u0438\u0440\u0443\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435<\/h2>\n<p>\u042f \u0441\u0447\u0438\u0442\u0430\u044e,\u00a0 \u0447\u0442\u043e \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e \u043d\u043e\u0432\u0438\u0447\u043a\u043e\u0432 \u043d\u0430\u0440\u0443\u0448\u0430\u044e\u0442 \u043f\u0440\u0438\u043d\u0446\u0438\u043f <strong>DRY<\/strong>(Don\u2019t repeat yourself). \u041e\u0447\u0435\u043d\u044c \u0447\u0430\u0441\u0442\u043e \u0432 \u043a\u043e\u0434\u0435 \u043c\u043e\u0436\u043d\u043e \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u043f\u043e\u0434\u043e\u0431\u043d\u0443\u044e \u043a\u0430\u0440\u0442\u0438\u043d\u0443.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/485\/f90\/f8f\/485f90f8ffcf1283db517afefbcccb09.png\" width=\"890\" height=\"618\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/485\/f90\/f8f\/485f90f8ffcf1283db517afefbcccb09.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u041a\u0430\u043a \u0432\u0438\u0434\u043d\u043e \u0438\u0437 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0438 \u0432\u044b\u0448\u0435, \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0435 \u0441\u0442\u0438\u043b\u0438 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b \u0438 \u0437\u0430\u043d\u0438\u043c\u0430\u044e\u0442 \u0441\u0443\u043c\u043c\u0430\u0440\u043d\u043e 10 \u0441\u0442\u0440\u043e\u043a \u043a\u043e\u0434\u0430. \u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u044c\u0442\u0435, \u0435\u0441\u043b\u0438 \u0432 \u043a\u043e\u043b\u043e\u043d\u043a\u0435 \u043d\u0435 \u0434\u0432\u0430 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0445 \u043f\u043e\u043b\u044f, \u0430 \u0434\u0435\u0441\u044f\u0442\u044c \ud83d\ude42<\/p>\n<p>\u0421\u0430\u043c\u044b\u043c \u043f\u0440\u043e\u0441\u0442\u044b\u043c \u0440\u0435\u0448\u0435\u043d\u0438\u0435\u043c \u044d\u0442\u043e\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0442\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 <strong>AppTextStyles<\/strong> \u0441\u043e \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u043c \u043f\u043e\u043b\u0435\u043c \u0438 \u043f\u043e\u0442\u043e\u043c \u043f\u0438\u0441\u0430\u0442\u044c style: AppTextStyles.yourStyle.  <\/p>\n<p>\u0423 \u0442\u0430\u043a\u043e\u0433\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0435\u0441\u0442\u044c \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u043a \u2014 \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u0443 \u043d\u0430\u0441 \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438 \u0431\u043e\u043b\u044c\u0448\u0435, \u0447\u0435\u043c \u043e\u0434\u043d\u0430 \u0442\u0435\u043c\u0430? \u0421\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043a\u043b\u0430\u0441\u0441\u044b <strong>AppDarkTextStyles<\/strong>\/<strong>AppLightTextStyles<\/strong> \u0438 \u043f\u043e\u0442\u043e\u043c, \u0437\u0430\u0434\u0430\u0432\u0430\u044f \u0441\u0442\u0438\u043b\u044c \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u043e\u043c\u0443 \u0432\u0438\u0434\u0436\u0435\u0442\u0443, \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c, \u043a\u0430\u043a\u0430\u044f \u0441\u0435\u0439\u0447\u0430\u0441 \u0442\u0435\u043a\u0443\u0449\u0430\u044f \u0442\u0435\u043c\u0430 \u0438 \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u044d\u0442\u043e\u0433\u043e \u0432\u044b\u0431\u0438\u0440\u0430\u0442\u044c \u043d\u0443\u0436\u043d\u0443\u044e \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u0443. \u041f\u043e \u0441\u0443\u0442\u0438, \u043f\u0440\u0438 \u043a\u0430\u0436\u0434\u043e\u043c \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u0438 \u0441\u0442\u0438\u043b\u044f \u043d\u0443\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u043f\u0438\u0441\u0430\u0442\u044c <strong>\u0442\u0435\u0440\u043d\u0430\u0440\u043d\u044b\u0439 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440<\/strong>. \u041d\u0435 \u0434\u0443\u043c\u0430\u044e, \u0447\u0442\u043e \u044d\u0442\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0445\u043e\u0440\u043e\u0448\u043e.  <\/p>\n<p>\u0412\u043e Flutter \u0435\u0441\u0442\u044c \u043a\u0440\u0430\u0441\u0438\u0432\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u044d\u0442\u043e\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u2014 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <strong>\u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0439 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u0442\u0435\u043c<\/strong>. \u0412 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043e, \u0447\u0442\u043e \u0442\u0435\u043c\u044b \u043d\u0443\u0436\u043d\u044b \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u0441\u0442\u0438\u043b\u044f\u043c\u0438 \u043f\u043e \u0432\u0441\u0435\u043c\u0443 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044e. \u0412 MaterialApp \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0437\u0430\u0434\u0430\u0442\u044c \u0442\u0435\u043c\u0443 \u0447\u0435\u0440\u0435\u0437 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e theme. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0432\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442 \u0442\u0438\u043f\u0430 <strong>ThemeData<\/strong>, \u0433\u0434\u0435 \u0432\u044b \u0443\u043a\u0430\u0436\u0435\u0442\u0435 \u0432\u0441\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0441\u0442\u0438\u043b\u0438 \u0438 \u0446\u0432\u0435\u0442\u0430. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0432\u0441\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0435 \u0441\u0442\u0438\u043b\u0438 \u0432 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0435 textTheme.   <\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e, \u043c\u043e\u0436\u043d\u043e \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c\u0441\u044f \u043a \u043d\u0443\u0436\u043d\u043e\u043c\u0443 \u0441\u0442\u0438\u043b\u044e \u0447\u0435\u0440\u0435\u0437 Theme.of(context).textTheme. \u0412 \u0442\u0430\u043a\u043e\u043c \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0441 \u0442\u0435\u043c, \u0447\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0442\u0435\u0440\u043d\u0430\u0440\u043d\u044b\u0439 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0442\u0435\u043c\u044b, \u0440\u0435\u0448\u0435\u043d\u0430.  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u0434\u0440\u0443\u0433\u0430\u044f \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c. \u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c \u0432\u044b \u0437\u0430\u0434\u0430\u043b\u0438 \u0432\u0441\u0435 27 \u0441\u0432\u043e\u0439\u0441\u0442\u0432 TextTheme \u0438 \u0432\u0430\u043c \u0432\u0441\u0435 \u0440\u0430\u0432\u043d\u043e \u043c\u0430\u043b\u043e:) \u0423 \u0432\u0430\u0441 \u0435\u0441\u0442\u044c \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043d\u043e\u0432\u044b\u0439 \u0441\u0442\u0438\u043b\u044c, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u043c\u0435\u0442\u043e\u0434 <strong>copyWith()<\/strong> \u043f\u0440\u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0438 \u0441\u0442\u0438\u043b\u044f \u043a \u0432\u0438\u0434\u0436\u0435\u0442\u0443, \u043e\u0434\u043d\u0430\u043a\u043e \u044d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u0441\u043e\u0440\u044f\u0442\u044c build \u043c\u0435\u0442\u043e\u0434. \u0418\u043b\u0438 \u0432\u0430\u043c \u0431\u0430\u043d\u0430\u043b\u044c\u043d\u043e \u043d\u0435 \u043d\u0440\u0430\u0432\u0438\u0442\u044c\u0441\u044f \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u0441\u0432\u043e\u0439\u0441\u0442\u0432 TextTheme. \u0412\u043e Flutter \u043d\u0430 \u044d\u0442\u043e\u0442 \u0441\u0447\u0435\u0442 \u0442\u043e\u0436\u0435 \u0435\u0441\u0442\u044c \u0440\u0435\u0448\u0435\u043d\u0438\u0435 &#8212; Theme Extensions!  <\/p>\n<h2>\u042d\u043b\u0435\u0433\u0430\u043d\u0442\u043d\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0442\u0435\u043c<\/h2>\n<p><strong>Theme Extensions<\/strong> \u2014 \u044d\u0442\u043e \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u043e\u0435 \u0434\u043e\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043a \u0442\u0435\u043c\u0435. \u0411\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u044d\u0442\u043e\u043c\u0443 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u0443 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0434\u043e\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043a \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u043e\u0439 \u0442\u0435\u043c\u0435, \u043a \u0446\u0432\u0435\u0442\u0430\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0438\u043b\u0438 \u043f\u0440\u043e\u043f\u0438\u0441\u0430\u0442\u044c \u0432\u0441\u0435 \u0433\u0440\u0430\u0434\u0438\u0435\u043d\u0442\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0432\u00a0 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438. \u041f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043c\u043e\u044e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u043f\u0430\u043f\u043a\u0438 \u0441 \u0442\u0435\u043c\u043e\u0439.  <\/p>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/b72\/b20\/86d\/b72b2086ddbdf1dfee1e13c6ebb49cdf.png\" width=\"302\" height=\"264\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/b72\/b20\/86d\/b72b2086ddbdf1dfee1e13c6ebb49cdf.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0424\u0430\u0439\u043b theme.dart \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u0444\u0430\u0439\u043b, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0441\u043e\u0431\u0440\u0430\u043d\u044b \u0432\u0441\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438.  <\/p>\n<pre><code class=\"dart\">import 'package:flutter\/material.dart';  part 'src\/constants.dart'; part 'src\/dark_theme.dart'; part 'src\/light_theme.dart'; part 'src\/text_theme.dart'; part 'src\/theme_colors.dart'; part 'src\/theme_text_styles.dart'; part 'src\/theme_gradients.dart';<\/code><\/pre>\n<p>\u0412 \u0444\u0430\u0439\u043b\u0430\u0445 light_theme.dart \u0438 dark_theme.dart \u0441\u043e\u0437\u0434\u0430\u044e\u0442\u0441\u044f \u0441\u0432\u0435\u0442\u043b\u0430\u044f \u0438 \u0442\u0435\u043c\u043d\u0430\u044f \u0442\u0435\u043c\u044b. \u0414\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u043f\u043e\u043a\u0430\u0436\u0443 \u0441\u0432\u0435\u0442\u043b\u0443\u044e \u0442\u0435\u043c\u0443.  <\/p>\n<pre><code class=\"dart\">part of '..\/theme.dart';  ThemeData createLightTheme() {   return ThemeData(     textTheme: createTextTheme(),     brightness: Brightness.light,     scaffoldBackgroundColor: AppColors.white,     extensions: &lt;ThemeExtension&lt;dynamic>>[       ThemeColors.light,       ThemeTextStyles.light,       ThemeGradients.light,     ],     dialogTheme: DialogTheme(       backgroundColor: AppColors.white,       titleTextStyle: headline1.copyWith(         color: AppColors.black,         fontSize: 20,         fontWeight: FontWeight.w500,       ),       contentTextStyle: headline1.copyWith(         color: AppColors.black,       ),     ),     focusColor: Colors.blue.withOpacity(0.2),     appBarTheme: AppBarTheme(backgroundColor: Colors.white),   ); } <\/code><\/pre>\n<p>\u0412 \u0444\u0430\u0439\u043b\u0435 text_theme.dart \u0441\u043e\u0437\u0434\u0430\u0435\u0442\u0441\u044f \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u0430\u044f \u0442\u0435\u043c\u0430, \u0445\u043e\u0442\u044f \u0432 \u0441\u0430\u043c\u043e\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438 \u044f \u043d\u0438 \u0440\u0430\u0437\u0443 \u043d\u0435 \u043e\u0431\u0440\u0430\u0449\u0430\u044e\u0441\u044c \u043a headline1 \u0438\u043b\u0438 \u0434\u0440\u0443\u0433\u0438\u043c \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430\u043c.  <\/p>\n<pre><code class=\"dart\">part of '..\/theme.dart';  TextTheme createTextTheme() {   return const TextTheme(     headline1: headline1,     headline2: headline2,   ); } <\/code><\/pre>\n<p>constants.dart \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0432 \u0441\u0435\u0431\u0435 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u043d\u044b\u0435 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0435 \u0441\u0442\u0438\u043b\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u044f \u043f\u043e\u0442\u043e\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e \u0432 theme_text_styles.dart, \u0438 \u043a\u043b\u0430\u0441\u0441 AppColors, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043f\u0440\u043e\u043f\u0438\u0441\u0430\u043d\u044b \u0431\u0430\u0437\u043e\u0432\u044b\u0435 \u0446\u0432\u0435\u0442\u0430 \u0447\u0435\u0440\u0435\u0437 \u043a\u043b\u0430\u0441\u0441 Colors, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0440\u0430\u0437\u043d\u044b\u0435 \u043e\u0442\u0442\u0435\u043d\u043a\u0438. \u0412 \u044d\u0442\u043e\u043c \u043c\u0435\u0441\u0442\u0435 \u043c\u043e\u0436\u0435\u0442 \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u0443\u0442\u044c \u0432\u043e\u043f\u0440\u043e\u0441: \u0437\u0430\u0447\u0435\u043c \u043f\u0440\u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u0431\u0430\u0437\u043e\u0432\u044b\u0435 \u0446\u0432\u0435\u0442\u0430? \u042f \u044d\u0442\u043e \u0434\u0435\u043b\u0430\u044e \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0432 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u043c \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u043f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u044f Colors \u0438 AppColors. \u042d\u0442\u043e \u0434\u0435\u043b\u043e \u0432\u043a\u0443\u0441\u0430 \ud83d\ude42  <\/p>\n<pre><code class=\"dart\">part of '..\/theme.dart';  const headline1 = TextStyle(fontWeight: FontWeight.w400, fontSize: 16); const headline2 = TextStyle(fontWeight: FontWeight.w400, fontSize: 14);  abstract class AppColors {   static const white = Colors.white;   static const black = Colors.black;   static const blue = Colors.blue;    static const red = Colors.red;   static const darkerRed = Color(0xFFCB5A5E);    static const grey = Colors.grey;   static const darkerGrey = Color(0xFF6C6C6C);   static const darkestGrey = Color(0xFF626262);   static const lighterGrey = Color(0xFF959595);   static const lightGrey = Color(0xFF5d5d5d);    static const lighterDark = Color(0xFF272727);   static const lightDark = Color(0xFF1b1b1b);    static const purpleAccent = Colors.purpleAccent; } <\/code><\/pre>\n<p>\u041f\u0435\u0440\u0435\u0439\u0434\u0435\u043c \u043a \u0441\u0430\u043c\u043e\u043c\u0443 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u043c\u0443 \u043c\u043e\u043c\u0435\u043d\u0442\u0443 \u2014 Theme Extensions. \u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c, \u0443 \u043c\u0435\u043d\u044f \u0435\u0441\u0442\u044c \u043a\u043d\u043e\u043f\u043a\u0430 \u0444\u0438\u043b\u044c\u0442\u0440\u0430 \u0438 \u0435\u0435 \u0446\u0432\u0435\u0442 \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f \u043e\u0442 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0445 \u0446\u0432\u0435\u0442\u043e\u0432 ThemeData. \u0417\u0434\u0435\u0441\u044c \u043d\u0430 \u043f\u043e\u043c\u043e\u0449\u044c \u043f\u0440\u0438\u0445\u043e\u0434\u044f\u0442 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f.\u00a0 \u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043d\u0438\u0445 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0441\u043e\u0437\u0434\u0430\u0442\u044c <strong>Color filterButtonFillColor<\/strong> \u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0435\u0433\u043e \u0447\u0435\u0440\u0435\u0437 BuildContext. \u0412 \u044d\u0442\u043e\u043c \u0436\u0435 \u043a\u043b\u0430\u0441\u0441\u0435 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u0440\u043e\u043f\u0438\u0441\u0430\u0442\u044c \u043a\u0430\u043a\u043e\u0439 \u0446\u0432\u0435\u0442 \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0432 \u0441\u0432\u0435\u0442\u043b\u043e\u0439 \u0438 \u0442\u0435\u043c\u043d\u043e\u0439 \u0442\u0435\u043c\u0430\u0445.    <\/p>\n<pre><code class=\"dart\">part of '..\/theme.dart';  class ThemeColors extends ThemeExtension&lt;ThemeColors> {   final Color filterButtonFillColor;    const ThemeColors({     required this.filterButtonFillColor,   });    @override   ThemeExtension&lt;ThemeColors> copyWith({     Color? filterButtonFillColor,   }) {     return ThemeColors(       filterButtonFillColor:           filterButtonFillColor ?? this.filterButtonFillColor,     );   }    @override   ThemeExtension&lt;ThemeColors> lerp(     ThemeExtension&lt;ThemeColors>? other,     double t,   ) {     if (other is! ThemeColors) {       return this;     }      return ThemeColors(       filterButtonFillColor:           Color.lerp(filterButtonFillColor, other.filterButtonFillColor, t)!,     );   }    static get light => ThemeColors(         filterButtonFillColor: AppColors.grey,       );    static get dark => ThemeColors(         filterButtonFillColor: AppColors.white,       ); } <\/code><\/pre>\n<p>\u041f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u043c \u0448\u0430\u0433\u043e\u043c \u0441\u0442\u043e\u0438\u0442 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u0441\u0432\u0435\u0442\u043b\u043e\u0439 \u0438 \u0442\u0435\u043c\u043d\u044b\u0445 \u0442\u0435\u043c.  <\/p>\n<pre><code class=\"dart\">return ThemeData(     textTheme: createTextTheme(),     brightness: Brightness.light,     scaffoldBackgroundColor: AppColors.white,     extensions: &lt;ThemeExtension&lt;dynamic>>[       ThemeColors.light,       ThemeTextStyles.light,       ThemeGradients.light,     ],   );<\/code><\/pre>\n<p>\u042f \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u0446\u0432\u0435\u0442\u043e\u0432, \u0434\u043b\u044f \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0445 \u0441\u0442\u0438\u043b\u0435\u0439 \u0438 \u0433\u0440\u0430\u0434\u0438\u0435\u043d\u0442\u043e\u0432. \u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0439 \u043d\u0430\u043c \u0446\u0432\u0435\u0442 \u0447\u0435\u0440\u0435\u0437 <strong>Theme.of(context).extension&lt;ThemeColors>!.neededColor<\/strong>. \u041e\u0434\u043d\u0430\u043a\u043e, \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u043f\u0438\u0441\u0430\u0442\u044c \u0442\u0430\u043a\u0443\u044e \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044e \u043a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437, \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f \u043d\u0430\u0434 BuildContext \u0438 \u043f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u043f\u0438\u0441\u0430\u0442\u044c context.color \u0438\u043b\u0438 context.text \u0438 \u0442.\u0434.<\/p>\n<pre><code class=\"dart\">import 'package:flutter\/material.dart'; import 'package:flutter_gen\/gen_l10n\/app_localizations.dart'; import 'package:meta_app\/presentation\/themes\/theme.dart';  extension BuildContextExt on BuildContext {   AppLocalizations get localizations => AppLocalizations.of(this)!;    ThemeTextStyles get text => Theme.of(this).extension&lt;ThemeTextStyles>()!;    ThemeColors get color => Theme.of(this).extension&lt;ThemeColors>()!;    ThemeGradients get gradient => Theme.of(this).extension&lt;ThemeGradients>()!;    bool get isDarkMode => Theme.of(this).brightness == Brightness.dark; } <\/code><\/pre>\n<p>\u0412 \u043a\u043e\u043d\u0446\u0435 \u0441\u0442\u0430\u0442\u044c\u0438 \u0445\u043e\u0447\u0443 \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c \u0432\u0430\u0448\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0432\u0435\u0449\u0438:   <\/p>\n<ol>\n<li>\n<p>\u0412 Theme Extensions \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u0442\u043d\u043e\u0441\u044f\u0442\u0441\u044f \u043a \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u043c\u0443 \u0432\u0438\u0434\u0436\u0435\u0442\u0443. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0443 \u0432\u0430\u0441 \u0435\u0441\u0442\u044c \u0432\u0438\u0434\u0436\u0435\u0442 Content \u0438 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0435 \u0441\u0442\u0438\u043b\u0438 \u0434\u043b\u044f \u043d\u0435\u0433\u043e \u043b\u0443\u0447\u0448\u0435 \u0432\u0441\u0435\u0433\u043e \u043d\u0430\u0437\u044b\u0432\u0430\u0442\u044c contentStatus, contentTitle\u2026  <\/p>\n<\/li>\n<li>\n<p>\u041d\u0435 \u043f\u043e\u043b\u0435\u043d\u0438\u0442\u0435\u0441\u044c \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0437\u043d\u044b\u0445 \u0441\u0442\u0438\u043b\u0435\u0439. \u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c, \u0443 \u0432\u0430\u0441 \u0432 Row \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u044c\u0441\u044f \u0434\u0432\u0435 \u043a\u043d\u043e\u043f\u043a\u0438 \u0441 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u043c \u0446\u0432\u0435\u0442\u043e\u043c. \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043e\u0434\u0438\u043d \u0446\u0432\u0435\u0442 \u0432 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f\u0445, \u043e\u0434\u043d\u0430\u043a\u043e \u0435\u0441\u043b\u0438 \u043f\u043e\u0442\u043e\u043c \u0434\u0438\u0437\u0430\u0439\u043d\u0435\u0440 \u043f\u043e\u043c\u0435\u043d\u044f\u0435\u0442 \u0446\u0432\u0435\u0442 \u043f\u0435\u0440\u0432\u043e\u0439 \u043a\u043d\u043e\u043f\u043a\u0438 \u0438 \u0432\u044b \u0435\u0433\u043e \u0438\u0437\u043c\u0435\u043d\u0435\u0442\u0435 \u0432 \u043a\u043e\u0434\u0435, \u0442\u043e \u0441\u0440\u0430\u0437\u0443 \u043f\u043e\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u0446\u0432\u0435\u0442 \u0434\u0440\u0443\u0433\u043e\u0439. \u0418 \u0432\u0430\u043c \u0432\u0441\u0435 \u0440\u0430\u0432\u043d\u043e \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e.  <\/p>\n<\/li>\n<li>\n<p>\u041f\u0440\u043e\u0431\u0443\u0439\u0442\u0435 \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c! \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0442\u0430\u043a\u0436\u0435 extension \u0434\u043b\u044f ButtonStyles \u0438 \u0434\u0440\u0443\u0433\u0438\u0445 \u0441\u0442\u0438\u043b\u0435\u0439.   <\/p>\n<\/li>\n<\/ol>\n<p>\u041d\u0430 \u044d\u0442\u043e\u043c \u0443 \u043c\u0435\u043d\u044f \u0432\u0441\u0435. \u041d\u0430\u0434\u0435\u044e\u0441\u044c \u0441\u0442\u0430\u0442\u044c\u044f \u0431\u044b\u043b\u0430 \u043f\u043e\u043b\u0435\u0437\u043d\u043e\u0439 \u043a\u0430\u043a \u0438 \u0434\u043b\u044f \u043d\u043e\u0432\u0438\u0447\u043a\u043e\u0432, \u0442\u0430\u043a \u0438 \u043e\u043f\u044b\u0442\u043d\u044b\u0435 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u0447\u0442\u043e-\u0442\u043e \u0438\u0437 \u043d\u0435\u0435 \u043f\u043e\u0447\u0435\u0440\u043f\u043d\u0443\u043b\u0438. \u041e\u0441\u0442\u0430\u0432\u043b\u044f\u044e <a href=\"https:\/\/github.com\/vovaklh\/MyApps\/tree\/dev\/lib\/presentation\/themes\" rel=\"noopener noreferrer nofollow\">\u0441\u0441\u044b\u043b\u043a\u0443<\/a> \u043d\u0430 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439, \u0433\u0434\u0435 \u043c\u043e\u0436\u043d\u043e \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0442\u0435\u043c. <\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"v-portal\" style=\"display:none;\"><\/div>\n<\/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\/post\/690572\/\"> https:\/\/habr.com\/ru\/post\/690572\/<\/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, \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u0438 Habr! \u0412 \u043d\u0430\u0447\u0430\u043b\u0435 \u044f \u0445\u043e\u0447\u0443 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0430\u043a\u0446\u0435\u043d\u0442 \u043d\u0430 \u0442\u043e\u043c, \u0447\u0442\u043e \u0441\u0442\u0430\u0442\u044c\u044f \u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0430 \u0434\u043b\u044f \u043d\u043e\u0432\u0438\u0447\u043a\u043e\u0432, \u043e\u0434\u043d\u0430\u043a\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u043e\u043b\u0435\u0437\u043d\u043e\u0439 \u0434\u043b\u044f \u0431\u043e\u043b\u0435\u0435 \u043e\u043f\u044b\u0442\u043d\u044b\u0445 \u043a\u043e\u043b\u043b\u0435\u0433. \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u043f\u0440\u043e \u0442\u043e, \u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0435 \u0442\u0435\u043c\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u043a\u0430\u043a\u0438\u0435 \u043e\u0448\u0438\u0431\u043a\u0438 \u043e\u0431\u044b\u0447\u043d\u043e \u0434\u0435\u043b\u0430\u044e\u0442 \u043d\u043e\u0432\u0438\u0447\u043a\u0438 \u0438 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u044e, \u043a\u0430\u043a \u043f\u043e \u043c\u043d\u0435, \u044d\u043b\u0435\u0433\u0430\u043d\u0442\u043d\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0442\u0435\u043c.<\/p>\n<h2>\u0427\u0442\u043e \u0442\u0430\u043a\u043e\u0435 \u0442\u0435\u043c\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f<\/h2>\n<p>\u0422\u0435\u043c\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u2014 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044f \u0432\u0441\u0435\u0445 \u0441\u0442\u0438\u043b\u0435\u0439 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u0435\u0442 \u0435\u043c\u0443 \u043f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u0432\u0438\u0434. \u042d\u0442\u043e \u0432\u0441\u0435 \u0446\u0432\u0435\u0442\u0430 \u0432\u0430\u0448\u0438\u0445 \u0432\u0438\u0434\u0436\u0435\u0442\u043e\u0432, \u0432\u0441\u0435 \u0433\u0440\u0430\u0434\u0438\u0435\u043d\u0442\u044b, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0441\u0442\u0438\u043b\u0438 \u0442\u0435\u043a\u0441\u0442\u0430, \u043a\u043d\u043e\u043f\u043e\u043a \u0438 \u0442.\u0434. \u0415\u0441\u043b\u0438 \u043f\u0440\u043e\u0432\u043e\u0434\u0438\u0442\u044c \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u044e \u0441 \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u043e\u043c, \u0442\u043e \u044d\u0442\u043e \u0432\u0441\u044f \u043e\u0434\u0435\u0436\u0434\u0430 \u043d\u0430 \u043d\u0435\u043c.  <\/p>\n<h2>\u041a\u0430\u043a\u0438\u0435 \u043e\u0448\u0438\u0431\u043a\u0438 \u0434\u043e\u043f\u0443\u0441\u043a\u0430\u044e\u0442 \u043d\u043e\u0432\u0438\u0447\u043a\u0438, \u0441\u0442\u0438\u043b\u0438\u0437\u0438\u0440\u0443\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435<\/h2>\n<p>\u042f \u0441\u0447\u0438\u0442\u0430\u044e,\u00a0 \u0447\u0442\u043e \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e \u043d\u043e\u0432\u0438\u0447\u043a\u043e\u0432 \u043d\u0430\u0440\u0443\u0448\u0430\u044e\u0442 \u043f\u0440\u0438\u043d\u0446\u0438\u043f <strong>DRY<\/strong>(Don\u2019t repeat yourself). \u041e\u0447\u0435\u043d\u044c \u0447\u0430\u0441\u0442\u043e \u0432 \u043a\u043e\u0434\u0435 \u043c\u043e\u0436\u043d\u043e \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u043f\u043e\u0434\u043e\u0431\u043d\u0443\u044e \u043a\u0430\u0440\u0442\u0438\u043d\u0443.<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u041a\u0430\u043a \u0432\u0438\u0434\u043d\u043e \u0438\u0437 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0438 \u0432\u044b\u0448\u0435, \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0435 \u0441\u0442\u0438\u043b\u0438 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b \u0438 \u0437\u0430\u043d\u0438\u043c\u0430\u044e\u0442 \u0441\u0443\u043c\u043c\u0430\u0440\u043d\u043e 10 \u0441\u0442\u0440\u043e\u043a \u043a\u043e\u0434\u0430. \u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u044c\u0442\u0435, \u0435\u0441\u043b\u0438 \u0432 \u043a\u043e\u043b\u043e\u043d\u043a\u0435 \u043d\u0435 \u0434\u0432\u0430 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0445 \u043f\u043e\u043b\u044f, \u0430 \u0434\u0435\u0441\u044f\u0442\u044c \ud83d\ude42<\/p>\n<p>\u0421\u0430\u043c\u044b\u043c \u043f\u0440\u043e\u0441\u0442\u044b\u043c \u0440\u0435\u0448\u0435\u043d\u0438\u0435\u043c \u044d\u0442\u043e\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0442\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 <strong>AppTextStyles<\/strong> \u0441\u043e \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u043c \u043f\u043e\u043b\u0435\u043c \u0438 \u043f\u043e\u0442\u043e\u043c \u043f\u0438\u0441\u0430\u0442\u044c style: AppTextStyles.yourStyle.  <\/p>\n<p>\u0423 \u0442\u0430\u043a\u043e\u0433\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0435\u0441\u0442\u044c \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u043a \u2014 \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u0443 \u043d\u0430\u0441 \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438 \u0431\u043e\u043b\u044c\u0448\u0435, \u0447\u0435\u043c \u043e\u0434\u043d\u0430 \u0442\u0435\u043c\u0430? \u0421\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043a\u043b\u0430\u0441\u0441\u044b <strong>AppDarkTextStyles<\/strong>\/<strong>AppLightTextStyles<\/strong> \u0438 \u043f\u043e\u0442\u043e\u043c, \u0437\u0430\u0434\u0430\u0432\u0430\u044f \u0441\u0442\u0438\u043b\u044c \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u043e\u043c\u0443 \u0432\u0438\u0434\u0436\u0435\u0442\u0443, \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c, \u043a\u0430\u043a\u0430\u044f \u0441\u0435\u0439\u0447\u0430\u0441 \u0442\u0435\u043a\u0443\u0449\u0430\u044f \u0442\u0435\u043c\u0430 \u0438 \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u044d\u0442\u043e\u0433\u043e \u0432\u044b\u0431\u0438\u0440\u0430\u0442\u044c \u043d\u0443\u0436\u043d\u0443\u044e \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u0443. \u041f\u043e \u0441\u0443\u0442\u0438, \u043f\u0440\u0438 \u043a\u0430\u0436\u0434\u043e\u043c \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u0438 \u0441\u0442\u0438\u043b\u044f \u043d\u0443\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u043f\u0438\u0441\u0430\u0442\u044c <strong>\u0442\u0435\u0440\u043d\u0430\u0440\u043d\u044b\u0439 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440<\/strong>. \u041d\u0435 \u0434\u0443\u043c\u0430\u044e, \u0447\u0442\u043e \u044d\u0442\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0445\u043e\u0440\u043e\u0448\u043e.  <\/p>\n<p>\u0412\u043e Flutter \u0435\u0441\u0442\u044c \u043a\u0440\u0430\u0441\u0438\u0432\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u044d\u0442\u043e\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u2014 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <strong>\u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0439 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u0442\u0435\u043c<\/strong>. \u0412 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043e, \u0447\u0442\u043e \u0442\u0435\u043c\u044b \u043d\u0443\u0436\u043d\u044b \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u0441\u0442\u0438\u043b\u044f\u043c\u0438 \u043f\u043e \u0432\u0441\u0435\u043c\u0443 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044e. \u0412 MaterialApp \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0437\u0430\u0434\u0430\u0442\u044c \u0442\u0435\u043c\u0443 \u0447\u0435\u0440\u0435\u0437 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e theme. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0432\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442 \u0442\u0438\u043f\u0430 <strong>ThemeData<\/strong>, \u0433\u0434\u0435 \u0432\u044b \u0443\u043a\u0430\u0436\u0435\u0442\u0435 \u0432\u0441\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0441\u0442\u0438\u043b\u0438 \u0438 \u0446\u0432\u0435\u0442\u0430. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0432\u0441\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0435 \u0441\u0442\u0438\u043b\u0438 \u0432 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0435 textTheme.   <\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e, \u043c\u043e\u0436\u043d\u043e \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c\u0441\u044f \u043a \u043d\u0443\u0436\u043d\u043e\u043c\u0443 \u0441\u0442\u0438\u043b\u044e \u0447\u0435\u0440\u0435\u0437 Theme.of(context).textTheme. \u0412 \u0442\u0430\u043a\u043e\u043c \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0441 \u0442\u0435\u043c, \u0447\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0442\u0435\u0440\u043d\u0430\u0440\u043d\u044b\u0439 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0442\u0435\u043c\u044b, \u0440\u0435\u0448\u0435\u043d\u0430.  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u0434\u0440\u0443\u0433\u0430\u044f \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c. \u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c \u0432\u044b \u0437\u0430\u0434\u0430\u043b\u0438 \u0432\u0441\u0435 27 \u0441\u0432\u043e\u0439\u0441\u0442\u0432 TextTheme \u0438 \u0432\u0430\u043c \u0432\u0441\u0435 \u0440\u0430\u0432\u043d\u043e \u043c\u0430\u043b\u043e:) \u0423 \u0432\u0430\u0441 \u0435\u0441\u0442\u044c \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043d\u043e\u0432\u044b\u0439 \u0441\u0442\u0438\u043b\u044c, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u043c\u0435\u0442\u043e\u0434 <strong>copyWith()<\/strong> \u043f\u0440\u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0438 \u0441\u0442\u0438\u043b\u044f \u043a \u0432\u0438\u0434\u0436\u0435\u0442\u0443, \u043e\u0434\u043d\u0430\u043a\u043e \u044d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u0441\u043e\u0440\u044f\u0442\u044c build \u043c\u0435\u0442\u043e\u0434. \u0418\u043b\u0438 \u0432\u0430\u043c \u0431\u0430\u043d\u0430\u043b\u044c\u043d\u043e \u043d\u0435 \u043d\u0440\u0430\u0432\u0438\u0442\u044c\u0441\u044f \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u0441\u0432\u043e\u0439\u0441\u0442\u0432 TextTheme. \u0412\u043e Flutter \u043d\u0430 \u044d\u0442\u043e\u0442 \u0441\u0447\u0435\u0442 \u0442\u043e\u0436\u0435 \u0435\u0441\u0442\u044c \u0440\u0435\u0448\u0435\u043d\u0438\u0435 &#8212; Theme Extensions!  <\/p>\n<h2>\u042d\u043b\u0435\u0433\u0430\u043d\u0442\u043d\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0442\u0435\u043c<\/h2>\n<p><strong>Theme Extensions<\/strong> \u2014 \u044d\u0442\u043e \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u043e\u0435 \u0434\u043e\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043a \u0442\u0435\u043c\u0435. \u0411\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u044d\u0442\u043e\u043c\u0443 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u0443 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0434\u043e\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043a \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u043e\u0439 \u0442\u0435\u043c\u0435, \u043a \u0446\u0432\u0435\u0442\u0430\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0438\u043b\u0438 \u043f\u0440\u043e\u043f\u0438\u0441\u0430\u0442\u044c \u0432\u0441\u0435 \u0433\u0440\u0430\u0434\u0438\u0435\u043d\u0442\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0432\u00a0 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438. \u041f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043c\u043e\u044e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u043f\u0430\u043f\u043a\u0438 \u0441 \u0442\u0435\u043c\u043e\u0439.  <\/p>\n<figure class=\"\"><figcaption><\/figcaption><\/figure>\n<p>\u0424\u0430\u0439\u043b theme.dart \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u0444\u0430\u0439\u043b, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0441\u043e\u0431\u0440\u0430\u043d\u044b \u0432\u0441\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438.  <\/p>\n<pre><code class=\"dart\">import 'package:flutter\/material.dart';  part 'src\/constants.dart'; part 'src\/dark_theme.dart'; part 'src\/light_theme.dart'; part 'src\/text_theme.dart'; part 'src\/theme_colors.dart'; part 'src\/theme_text_styles.dart'; part 'src\/theme_gradients.dart';<\/code><\/pre>\n<p>\u0412 \u0444\u0430\u0439\u043b\u0430\u0445 light_theme.dart \u0438 dark_theme.dart \u0441\u043e\u0437\u0434\u0430\u044e\u0442\u0441\u044f \u0441\u0432\u0435\u0442\u043b\u0430\u044f \u0438 \u0442\u0435\u043c\u043d\u0430\u044f \u0442\u0435\u043c\u044b. \u0414\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u043f\u043e\u043a\u0430\u0436\u0443 \u0441\u0432\u0435\u0442\u043b\u0443\u044e \u0442\u0435\u043c\u0443.  <\/p>\n<pre><code class=\"dart\">part of '..\/theme.dart';  ThemeData createLightTheme() {   return ThemeData(     textTheme: createTextTheme(),     brightness: Brightness.light,     scaffoldBackgroundColor: AppColors.white,     extensions: &lt;ThemeExtension&lt;dynamic>>[       ThemeColors.light,       ThemeTextStyles.light,       ThemeGradients.light,     ],     dialogTheme: DialogTheme(       backgroundColor: AppColors.white,       titleTextStyle: headline1.copyWith(         color: AppColors.black,         fontSize: 20,         fontWeight: FontWeight.w500,       ),       contentTextStyle: headline1.copyWith(         color: AppColors.black,       ),     ),     focusColor: Colors.blue.withOpacity(0.2),     appBarTheme: AppBarTheme(backgroundColor: Colors.white),   ); } <\/code><\/pre>\n<p>\u0412 \u0444\u0430\u0439\u043b\u0435 text_theme.dart \u0441\u043e\u0437\u0434\u0430\u0435\u0442\u0441\u044f \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u0430\u044f \u0442\u0435\u043c\u0430, \u0445\u043e\u0442\u044f \u0432 \u0441\u0430\u043c\u043e\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438 \u044f \u043d\u0438 \u0440\u0430\u0437\u0443 \u043d\u0435 \u043e\u0431\u0440\u0430\u0449\u0430\u044e\u0441\u044c \u043a headline1 \u0438\u043b\u0438 \u0434\u0440\u0443\u0433\u0438\u043c \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430\u043c.  <\/p>\n<pre><code class=\"dart\">part of '..\/theme.dart';  TextTheme createTextTheme() {   return const TextTheme(     headline1: headline1,     headline2: headline2,   ); } <\/code><\/pre>\n<p>constants.dart \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0432 \u0441\u0435\u0431\u0435 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u043d\u044b\u0435 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0435 \u0441\u0442\u0438\u043b\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u044f \u043f\u043e\u0442\u043e\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e \u0432 theme_text_styles.dart, \u0438 \u043a\u043b\u0430\u0441\u0441 AppColors, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043f\u0440\u043e\u043f\u0438\u0441\u0430\u043d\u044b \u0431\u0430\u0437\u043e\u0432\u044b\u0435 \u0446\u0432\u0435\u0442\u0430 \u0447\u0435\u0440\u0435\u0437 \u043a\u043b\u0430\u0441\u0441 Colors, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0440\u0430\u0437\u043d\u044b\u0435 \u043e\u0442\u0442\u0435\u043d\u043a\u0438. \u0412 \u044d\u0442\u043e\u043c \u043c\u0435\u0441\u0442\u0435 \u043c\u043e\u0436\u0435\u0442 \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u0443\u0442\u044c \u0432\u043e\u043f\u0440\u043e\u0441: \u0437\u0430\u0447\u0435\u043c \u043f\u0440\u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u0431\u0430\u0437\u043e\u0432\u044b\u0435 \u0446\u0432\u0435\u0442\u0430? \u042f \u044d\u0442\u043e \u0434\u0435\u043b\u0430\u044e \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0432 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u043c \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u043f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u044f Colors \u0438 AppColors. \u042d\u0442\u043e \u0434\u0435\u043b\u043e \u0432\u043a\u0443\u0441\u0430 \ud83d\ude42  <\/p>\n<pre><code class=\"dart\">part of '..\/theme.dart';  const headline1 = TextStyle(fontWeight: FontWeight.w400, fontSize: 16); const headline2 = TextStyle(fontWeight: FontWeight.w400, fontSize: 14);  abstract class AppColors {   static const white = Colors.white;   static const black = Colors.black;   static const blue = Colors.blue;    static const red = Colors.red;   static const darkerRed = Color(0xFFCB5A5E);    static const grey = Colors.grey;   static const darkerGrey = Color(0xFF6C6C6C);   static const darkestGrey = Color(0xFF626262);   static const lighterGrey = Color(0xFF959595);   static const lightGrey = Color(0xFF5d5d5d);    static const lighterDark = Color(0xFF272727);   static const lightDark = Color(0xFF1b1b1b);    static const purpleAccent = Colors.purpleAccent; } <\/code><\/pre>\n<p>\u041f\u0435\u0440\u0435\u0439\u0434\u0435\u043c \u043a \u0441\u0430\u043c\u043e\u043c\u0443 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u043c\u0443 \u043c\u043e\u043c\u0435\u043d\u0442\u0443 \u2014 Theme Extensions. \u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c, \u0443 \u043c\u0435\u043d\u044f \u0435\u0441\u0442\u044c \u043a\u043d\u043e\u043f\u043a\u0430 \u0444\u0438\u043b\u044c\u0442\u0440\u0430 \u0438 \u0435\u0435 \u0446\u0432\u0435\u0442 \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f \u043e\u0442 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0445 \u0446\u0432\u0435\u0442\u043e\u0432 ThemeData. \u0417\u0434\u0435\u0441\u044c \u043d\u0430 \u043f\u043e\u043c\u043e\u0449\u044c \u043f\u0440\u0438\u0445\u043e\u0434\u044f\u0442 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f.\u00a0 \u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043d\u0438\u0445 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0441\u043e\u0437\u0434\u0430\u0442\u044c <strong>Color filterButtonFillColor<\/strong> \u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0435\u0433\u043e \u0447\u0435\u0440\u0435\u0437 BuildContext. \u0412 \u044d\u0442\u043e\u043c \u0436\u0435 \u043a\u043b\u0430\u0441\u0441\u0435 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u0440\u043e\u043f\u0438\u0441\u0430\u0442\u044c \u043a\u0430\u043a\u043e\u0439 \u0446\u0432\u0435\u0442 \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0432 \u0441\u0432\u0435\u0442\u043b\u043e\u0439 \u0438 \u0442\u0435\u043c\u043d\u043e\u0439 \u0442\u0435\u043c\u0430\u0445.    <\/p>\n<pre><code class=\"dart\">part of '..\/theme.dart';  class ThemeColors extends ThemeExtension&lt;ThemeColors> {   final Color filterButtonFillColor;    const ThemeColors({     required this.filterButtonFillColor,   });    @override   ThemeExtension&lt;ThemeColors> copyWith({     Color? filterButtonFillColor,   }) {     return ThemeColors(       filterButtonFillColor:           filterButtonFillColor ?? this.filterButtonFillColor,     );   }    @override   ThemeExtension&lt;ThemeColors> lerp(     ThemeExtension&lt;ThemeColors>? other,     double t,   ) {     if (other is! ThemeColors) {       return this;     }      return ThemeColors(       filterButtonFillColor:           Color.lerp(filterButtonFillColor, other.filterButtonFillColor, t)!,     );   }    static get light => ThemeColors(         filterButtonFillColor: AppColors.grey,       );    static get dark => ThemeColors(         filterButtonFillColor: AppColors.white,       ); } <\/code><\/pre>\n<p>\u041f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u043c \u0448\u0430\u0433\u043e\u043c \u0441\u0442\u043e\u0438\u0442 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u0441\u0432\u0435\u0442\u043b\u043e\u0439 \u0438 \u0442\u0435\u043c\u043d\u044b\u0445 \u0442\u0435\u043c.  <\/p>\n<pre><code class=\"dart\">return ThemeData(     textTheme: createTextTheme(),     brightness: Brightness.light,     scaffoldBackgroundColor: AppColors.white,     extensions: &lt;ThemeExtension&lt;dynamic>>[       ThemeColors.light,       ThemeTextStyles.light,       ThemeGradients.light,     ],   );<\/code><\/pre>\n<p>\u042f \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u0446\u0432\u0435\u0442\u043e\u0432, \u0434\u043b\u044f \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0445 \u0441\u0442\u0438\u043b\u0435\u0439 \u0438 \u0433\u0440\u0430\u0434\u0438\u0435\u043d\u0442\u043e\u0432. \u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0439 \u043d\u0430\u043c \u0446\u0432\u0435\u0442 \u0447\u0435\u0440\u0435\u0437 <strong>Theme.of(context).extension&lt;ThemeColors>!.neededColor<\/strong>. \u041e\u0434\u043d\u0430\u043a\u043e, \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u043f\u0438\u0441\u0430\u0442\u044c \u0442\u0430\u043a\u0443\u044e \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044e \u043a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437, \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f \u043d\u0430\u0434 BuildContext \u0438 \u043f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u043f\u0438\u0441\u0430\u0442\u044c context.color \u0438\u043b\u0438 context.text \u0438 \u0442.\u0434.<\/p>\n<pre><code class=\"dart\">import 'package:flutter\/material.dart'; import 'package:flutter_gen\/gen_l10n\/app_localizations.dart'; import 'package:meta_app\/presentation\/themes\/theme.dart';  extension BuildContextExt on BuildContext {   AppLocalizations get localizations => AppLocalizations.of(this)!;    ThemeTextStyles get text => Theme.of(this).extension&lt;ThemeTextStyles>()!;    ThemeColors get color => Theme.of(this).extension&lt;ThemeColors>()!;    ThemeGradients get gradient => Theme.of(this).extension&lt;ThemeGradients>()!;    bool get isDarkMode => Theme.of(this).brightness == Brightness.dark; } <\/code><\/pre>\n<p>\u0412 \u043a\u043e\u043d\u0446\u0435 \u0441\u0442\u0430\u0442\u044c\u0438 \u0445\u043e\u0447\u0443 \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c \u0432\u0430\u0448\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0432\u0435\u0449\u0438:   <\/p>\n<ol>\n<li>\n<p>\u0412 Theme Extensions \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u0442\u043d\u043e\u0441\u044f\u0442\u0441\u044f \u043a \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u043c\u0443 \u0432\u0438\u0434\u0436\u0435\u0442\u0443. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0443 \u0432\u0430\u0441 \u0435\u0441\u0442\u044c \u0432\u0438\u0434\u0436\u0435\u0442 Content \u0438 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0435 \u0441\u0442\u0438\u043b\u0438 \u0434\u043b\u044f \u043d\u0435\u0433\u043e \u043b\u0443\u0447\u0448\u0435 \u0432\u0441\u0435\u0433\u043e \u043d\u0430\u0437\u044b\u0432\u0430\u0442\u044c contentStatus, contentTitle\u2026  <\/p>\n<\/li>\n<li>\n<p>\u041d\u0435 \u043f\u043e\u043b\u0435\u043d\u0438\u0442\u0435\u0441\u044c \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0437\u043d\u044b\u0445 \u0441\u0442\u0438\u043b\u0435\u0439. \u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c, \u0443 \u0432\u0430\u0441 \u0432 Row \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u044c\u0441\u044f \u0434\u0432\u0435 \u043a\u043d\u043e\u043f\u043a\u0438 \u0441 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u043c \u0446\u0432\u0435\u0442\u043e\u043c. \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043e\u0434\u0438\u043d \u0446\u0432\u0435\u0442 \u0432 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f\u0445, \u043e\u0434\u043d\u0430\u043a\u043e \u0435\u0441\u043b\u0438 \u043f\u043e\u0442\u043e\u043c \u0434\u0438\u0437\u0430\u0439\u043d\u0435\u0440 \u043f\u043e\u043c\u0435\u043d\u044f\u0435\u0442 \u0446\u0432\u0435\u0442 \u043f\u0435\u0440\u0432\u043e\u0439 \u043a\u043d\u043e\u043f\u043a\u0438 \u0438 \u0432\u044b \u0435\u0433\u043e \u0438\u0437\u043c\u0435\u043d\u0435\u0442\u0435 \u0432 \u043a\u043e\u0434\u0435, \u0442\u043e \u0441\u0440\u0430\u0437\u0443 \u043f\u043e\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u0446\u0432\u0435\u0442 \u0434\u0440\u0443\u0433\u043e\u0439. \u0418 \u0432\u0430\u043c \u0432\u0441\u0435 \u0440\u0430\u0432\u043d\u043e \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e.  <\/p>\n<\/li>\n<li>\n<p>\u041f\u0440\u043e\u0431\u0443\u0439\u0442\u0435 \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c! \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0442\u0430\u043a\u0436\u0435 extension \u0434\u043b\u044f ButtonStyles \u0438 \u0434\u0440\u0443\u0433\u0438\u0445 \u0441\u0442\u0438\u043b\u0435\u0439.   <\/p>\n<\/li>\n<\/ol>\n<p>\u041d\u0430 \u044d\u0442\u043e\u043c \u0443 \u043c\u0435\u043d\u044f \u0432\u0441\u0435. \u041d\u0430\u0434\u0435\u044e\u0441\u044c \u0441\u0442\u0430\u0442\u044c\u044f \u0431\u044b\u043b\u0430 \u043f\u043e\u043b\u0435\u0437\u043d\u043e\u0439 \u043a\u0430\u043a \u0438 \u0434\u043b\u044f \u043d\u043e\u0432\u0438\u0447\u043a\u043e\u0432, \u0442\u0430\u043a \u0438 \u043e\u043f\u044b\u0442\u043d\u044b\u0435 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u0447\u0442\u043e-\u0442\u043e \u0438\u0437 \u043d\u0435\u0435 \u043f\u043e\u0447\u0435\u0440\u043f\u043d\u0443\u043b\u0438. \u041e\u0441\u0442\u0430\u0432\u043b\u044f\u044e <a href=\"https:\/\/github.com\/vovaklh\/MyApps\/tree\/dev\/lib\/presentation\/themes\" rel=\"noopener noreferrer nofollow\">\u0441\u0441\u044b\u043b\u043a\u0443<\/a> \u043d\u0430 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439, \u0433\u0434\u0435 \u043c\u043e\u0436\u043d\u043e \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0442\u0435\u043c. <\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"v-portal\" style=\"display:none;\"><\/div>\n<\/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\/post\/690572\/\"> https:\/\/habr.com\/ru\/post\/690572\/<\/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-338977","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/338977","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=338977"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/338977\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=338977"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=338977"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=338977"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}