{"id":368515,"date":"2024-05-21T03:44:17","date_gmt":"2024-05-21T03:44:17","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=368515"},"modified":"-0001-11-30T00:00:00","modified_gmt":"2024-05-21T03:44:17","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=368515","title":{"rendered":"<span>\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0433\u0438\u0440\u043e\u0441\u043a\u043e\u043f\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043f\u0430\u0440\u0430\u043b\u043b\u0430\u043a\u0441-\u044d\u0444\u0444\u0435\u043a\u0442 \u0432\u043e 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>\u041d\u0435\u0434\u0430\u0432\u043d\u043e \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u043b, \u043a\u0430\u043a \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043f\u0430\u0440\u0430\u043b\u043b\u0430\u043a\u0441 \u044d\u0444\u0444\u0435\u043a\u0442 \u043f\u0440\u0438 \u0441\u043a\u0440\u043e\u043b\u043b\u0435 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0432\u0438\u0434\u0436\u0435\u0442\u0430 CustomPaint<\/p>\n<div class=\"embed_link embed_layout-right\">\n<div class=\"embed__thumb\" style=\"background-image: url(&quot;https:\/\/habr.com\/share\/publication\/794004\/6bd506da6fa4691d60f084d673b33371\/&quot;);\"><\/div>\n<div class=\"embed__caption\">\n<div class=\"embed__caption-title\"><span>\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043f\u0430\u0440\u0430\u043b\u043b\u0430\u043a\u0441-\u044d\u0444\u0444\u0435\u043a\u0442 \u0432\u043e Flutter \u0441 CustomPaint<\/span><\/div>\n<div class=\"embed__caption-description\">\u0412 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u043c \u043c\u0438\u0440\u0435 \u043c\u043e\u0431\u0438\u043b\u044c\u043d\u043e\u0439 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438, \u0433\u0434\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043a \u0434\u0435\u0442\u0430\u043b\u044f\u043c \u0438 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 \u0438\u0433\u0440\u0430\u044e\u0442 \u043a\u043b\u044e&#8230;<\/div>\n<p><a href=\"https:\/\/habr.com\/ru\/articles\/794004\/\" target=\"_blank\" rel=\"noopener noreferrer nofollow\" class=\"embed__caption-link\">habr.com<\/a><\/div>\n<\/div>\n<p>\u0421\u0435\u0433\u043e\u0434\u043d\u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443, \u043a\u0430\u043a, \u0441\u0434\u0435\u043b\u0430\u0432 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0430\u043f\u0433\u0440\u0435\u0439\u0434, \u043c\u043e\u0436\u043d\u043e \u043e\u0436\u0438\u0432\u0438\u0442\u044c \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0443 \u043f\u0440\u0438 \u043f\u0440\u043e\u0441\u0442\u043e\u043c \u043d\u0430\u043a\u043b\u043e\u043d\u0435 \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u0430.<\/p>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/7a3\/7ee\/74c\/7a37ee74c23b260a1a17b0744f148858.gif\" alt=\"\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\" title=\"\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\" width=\"320\" height=\"569\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/7a3\/7ee\/74c\/7a37ee74c23b260a1a17b0744f148858.gif\"\/><\/p>\n<div><figcaption>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442<\/figcaption><\/div>\n<\/figure>\n<hr\/>\n<p>\u0412\u0441\u043f\u043e\u043c\u043d\u0438\u043c, \u0447\u0442\u043e \u0443\u0436\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043e:<\/p>\n<ol>\n<li>\n<p>\u042d\u043a\u0440\u0430\u043d \u0441\u043e \u0441\u043f\u0438\u0441\u043a\u043e\u043c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432, \u0433\u0434\u0435 \u043a\u0430\u0436\u0434\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 &#8212; \u044d\u0442\u043e \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0430 \u0441 \u043f\u043e\u0434\u043f\u0438\u0441\u044c\u044e<\/p>\n<\/li>\n<li>\n<p>\u0411\u044d\u043a\u0433\u0440\u0430\u0443\u043d\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0442\u0430\u043a\u0436\u0435 \u0441\u043c\u0435\u0449\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u0438 \u0441\u043a\u0440\u043e\u043b\u043b\u0435, \u043d\u043e \u0447\u0443\u0442\u044c \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u0435\u0435, \u0447\u0435\u043c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0432 \u0441\u043f\u0438\u0441\u043a\u0435<\/p>\n<\/li>\n<\/ol>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u0434<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"dart\">import 'dart:math' show Random; import 'dart:ui' as ui;  import 'package:flutter\/material.dart';  class ParallaxScreen extends StatefulWidget {   const ParallaxScreen({super.key});    @override   State&lt;ParallaxScreen> createState() => _ParallaxScreenState(); }  class _ParallaxScreenState extends State&lt;ParallaxScreen> {   \/\/ get an array of random ids   late final List&lt;int> ids = List.generate(10, (index) => Random().nextInt(500));    \/\/ controller to handle scrolling of items   final ScrollController _scrollController = ScrollController();    @override   void dispose() {     _scrollController.dispose();     super.dispose();   }    @override   Widget build(BuildContext context) {     return Scaffold(       body: _Background(         scrollController: _scrollController,         child: ListView.builder(           controller: _scrollController,           itemCount: ids.length,           itemBuilder: (context, index) {             final int id = ids[index];             return ItemCard(id: id);           },         ),       ),     );   } }  class ItemCard extends StatelessWidget {   const ItemCard({     super.key,     required this.id,   });    final int id;    @override   Widget build(BuildContext context) {     return Container(       margin: const EdgeInsets.symmetric(         horizontal: 20,         vertical: 20,       ),       clipBehavior: Clip.hardEdge,       width: double.maxFinite,       height: 300,       decoration: BoxDecoration(         color: Colors.grey.withOpacity(0.4),         borderRadius: BorderRadius.circular(20),         boxShadow: const [           BoxShadow(             color: Colors.black12,             blurRadius: 10,             spreadRadius: 5,           ),         ],       ),       child: Stack(         children: [           Image.network(             'https:\/\/picsum.photos\/id\/$id\/500\/300', \/\/ get an image from network by id             width: double.maxFinite,           ),           Positioned(             left: 20,             bottom: 20,             child: Text(               'Image $id',               style: const TextStyle(                 color: Colors.white,                 fontSize: 24,                 fontWeight: FontWeight.bold,               ),             ),           ),         ],       ),     );   } }  class _Background extends StatefulWidget {   const _Background({     required this.child,     required this.scrollController,   });   final Widget child;   final ScrollController scrollController;    @override   State&lt;_Background> createState() => _BackgroundState(); }  class _BackgroundState extends State&lt;_Background> {   @override   void initState() {     super.initState();     _loadImage();   }    ui.Image? _image;   \/\/ logic for downloaiding an image as ui.Image object   Future&lt;void> _loadImage() async {     const imageProvider = NetworkImage('https:\/\/picsum.photos\/id\/307\/600\/4000'); \/\/ get background image. You can use anyone you want     final ImageStreamListener listener = ImageStreamListener((info, _) {       setState(() {         _image = info.image;       });     });     final ImageStream stream = imageProvider.resolve(const ImageConfiguration());     stream.addListener(listener);   }    @override   void dispose() {     _image?.dispose();     super.dispose();   }    @override   Widget build(BuildContext context) {     return CustomPaint(       painter: _image != null ? _BackgroundImagePainter(widget.scrollController, _image!) : null,       child: widget.child,     );   } }  class _BackgroundImagePainter extends CustomPainter {   final ScrollController controller;   final ui.Image image;   const _BackgroundImagePainter(this.controller, this.image) : super(repaint: controller);    @override   void paint(Canvas canvas, Size size) {     final imageWidth = image.width.toDouble();     final imageHeight = image.height.toDouble();     final aspectRatio = imageWidth \/ imageHeight;      final src = Rect.fromLTWH(       0,       0,       imageWidth,       imageHeight,     );     final deltaY = -controller.offset * 0.6;     final dst = Rect.fromLTWH(       0,       deltaY,       size.width,       size.width \/ aspectRatio,     );     canvas.drawImageRect(       image,       src,       dst,       Paint()..filterQuality = FilterQuality.high,     );   }    @override   bool shouldRepaint(_BackgroundImagePainter oldDelegate) => controller.offset != oldDelegate.controller.offset; } <\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u0427\u0442\u043e\u0431\u044b \u0440\u0435\u0430\u0433\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u0430 \u043d\u0430\u043a\u043b\u043e\u043d\u044b \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u0430, \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0441 \u0434\u0430\u0442\u0447\u0438\u043a\u043e\u0432 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0434\u0430\u043d\u043d\u044b\u0439 \u043a\u0435\u0439\u0441 \u0430\u043a\u0442\u0443\u0430\u043b\u0435\u043d \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430\u0445 \u0441 \u0430\u043a\u0441\u0435\u043b\u0435\u0440\u043e\u043c\u0435\u0442\u0440\u043e\u043c \u0438 \u0433\u0438\u0440\u043e\u0441\u043a\u043e\u043f\u043e\u043c<\/p>\n<p><strong>\u0410\u043a\u0441\u0435\u043b\u0435\u0440\u043e\u043c\u0435\u0442\u0440<\/strong> &#8212; \u0435\u0441\u043b\u0438 \u0441\u0443\u043f\u0435\u0440 \u043f\u0440\u043e\u0441\u0442\u043e, \u0442\u043e \u044d\u0442\u043e \u0434\u0430\u0442\u0447\u0438\u043a, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u0437\u043c\u0435\u0440\u044f\u0435\u0442 \u0443\u0441\u043a\u043e\u0440\u0435\u043d\u0438\u0435 (\u0430\u043a\u0441\u0435\u043b\u0435\u0440\u0430\u0446\u0438\u044e) \u043f\u0440\u0438 \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u0438 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430 \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0432 \u0442\u0440\u0435\u0445 \u043f\u0440\u043e\u0435\u043a\u0446\u0438\u044f\u0445. \u0415\u0434\u0438\u043d\u0438\u0446\u0430 \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u044f \u0438\u043b\u0438 <strong>\u043c\/c^2, <\/strong>\u0438\u043b\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043e\u0442 0 \u0434\u043e 1 (\u043d\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0443\u0441\u043a\u043e\u0440\u0435\u043d\u0438\u044f \u0441\u0432\u043e\u0431\u043e\u0434\u043d\u043e\u0433\u043e \u043f\u0430\u0434\u0435\u043d\u0438\u044f 9.8 \u043c\/\u0441^2). \u0415\u0441\u043b\u0438, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0442\u0435\u043b\u0435\u0444\u043e\u043d \u043b\u0435\u0436\u0438\u0442 \u043d\u0430 \u0441\u0442\u043e\u043b\u0435, \u0442\u043e \u043f\u043e \u043e\u0441\u0438 Z \u0430\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0443\u0441\u043a\u043e\u0440\u0435\u043d\u0438\u044f \u0431\u0443\u0434\u0435\u0442 \u043b\u0438\u0431\u043e 9.8, \u043b\u0438\u0431\u043e 1<\/p>\n<p><strong>\u0413\u0438\u0440\u043e\u0441\u043a\u043e\u043f<\/strong> &#8212; \u0434\u0430\u0442\u0447\u0438\u043a, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442, \u0441 \u043a\u0430\u043a\u043e\u0439 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c\u044e \u043f\u043e\u0432\u0435\u0440\u043d\u0443\u043b\u0438 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0442\u0430\u043a\u043e\u0439-\u0442\u043e \u043e\u0441\u0438. \u0415\u0434\u0438\u043d\u0438\u0446\u0430 \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u044f \u0438\u043b\u0438 <strong>\u00b0\/\u0441<\/strong>, \u0438\u043b\u0438 <strong>\u0440\u0430\u0434\/\u0441.<\/strong> \u0415\u0441\u043b\u0438 \u0442\u0435\u043b\u043e \u0432 \u043f\u043e\u043a\u043e\u0435, \u0442\u043e \u0434\u0430\u0442\u0447\u0438\u043a \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043d\u0443\u043b\u0435\u0432\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f<\/p>\n<h2>\u0421\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438<\/h2>\n<p>\u0414\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u0441 \u044d\u0442\u0438\u0445 \u0434\u0430\u0442\u0447\u0438\u043a\u043e\u0432 \u0435\u0441\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0433\u043e\u0442\u043e\u0432\u044b\u0445 \u0440\u0435\u0448\u0435\u043d\u0438\u0439 \u043d\u0430 pub.dev<\/p>\n<h4>flutter_sensors<\/h4>\n<div class=\"embed_link\">\n<div class=\"embed__thumb\" style=\"background-image: url(&quot;https:\/\/pub.dev\/static\/hash-8da4fn9n\/img\/pub-dev-icon-cover-image.png&quot;);\"><\/div>\n<div class=\"embed__caption\">\n<div class=\"embed__caption-title\"><span>flutter_sensors | Flutter package<\/span><\/div>\n<p><a href=\"https:\/\/pub.dev\/packages\/flutter_sensors\" target=\"_blank\" rel=\"noopener noreferrer nofollow\" class=\"embed__caption-link\">pub.dev<\/a><\/div>\n<\/div>\n<p>\u042d\u0442\u043e \u043f\u0440\u0438\u043c\u0435\u0440 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u0435\u0437 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0439 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0443\u0436\u0435 \u0431\u043e\u043b\u0435\u0435 2-\u0445 \u043b\u0435\u0442, \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0432 \u0442\u0435\u043a\u0443\u0449\u0435\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 flutter \u0438 dart \u0438 \u0432\u043f\u043e\u043b\u043d\u0435 \u0434\u043e\u0441\u0442\u043e\u0439\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u0441\u0432\u043e\u0438 \u0437\u0430\u0434\u0430\u0447\u0438. \u0412 \u0440\u0430\u043d\u043d\u0438\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u0445 \u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0441\u044f \u0438\u043c\u0435\u043d\u043d\u043e \u044d\u0442\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u043e\u0439<\/p>\n<h4>sensors_plus<\/h4>\n<div class=\"embed_link\">\n<div class=\"embed__thumb\" style=\"background-image: url(&quot;https:\/\/pub.dev\/static\/hash-8da4fn9n\/img\/pub-dev-icon-cover-image.png&quot;);\"><\/div>\n<div class=\"embed__caption\">\n<div class=\"embed__caption-title\"><span>sensors_plus | Flutter package<\/span><\/div>\n<p><a href=\"https:\/\/pub.dev\/packages\/sensors_plus\" target=\"_blank\" rel=\"noopener noreferrer nofollow\" class=\"embed__caption-link\">pub.dev<\/a><\/div>\n<\/div>\n<p>\u042d\u0442\u043e \u043f\u0440\u0438\u043c\u0435\u0440 \u0434\u0440\u0443\u0433\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438, \u0443 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043f\u0440\u043e\u0449\u0435 API, \u043f\u043e \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044e \u0441 flutter_sensors, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u044e\u0442\u0441\u044f \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u0439 \u0432 AndroidManifest.xml \u0434\u043b\u044f Android \u0438\u043b\u0438 info.plist \u0434\u043b\u044f iOS. <br \/>\u0415\u0449\u0435 \u043e\u0434\u043d\u043e \u043e\u0442\u043b\u0438\u0447\u0438\u0435, \u0447\u0442\u043e \u043f\u0440\u0438 \u0440\u0430\u0441\u0447\u0435\u0442\u0435 \u0443\u0441\u043a\u043e\u0440\u0435\u043d\u0438\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0440\u0430\u0437\u043d\u044b\u0435 \u0435\u0434\u0438\u043d\u0438\u0446\u044b. \u042d\u0442\u043e \u0441\u0442\u043e\u0438\u0442 \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c \u043f\u0440\u0438 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0438 \u0441 \u043e\u0434\u043d\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u043a\u0438 \u043d\u0430 \u0434\u0440\u0443\u0433\u0443\u044e.<\/p>\n<p>\u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f sensors_plus<\/p>\n<h2>\u0411\u044b\u0441\u0442\u0440\u044b\u0439 \u0430\u043f\u0433\u0440\u0435\u0439\u0434<\/h2>\n<ol>\n<li>\n<p>\u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 sensors_plus \u0432 pubspec.yaml<\/p>\n<\/li>\n<\/ol>\n<pre><code class=\"yaml\">name: parallax_with_sensors_example description: \"A new Flutter project.\" publish_to: \"none\" version: 0.1.0  environment:   sdk: \">=3.2.6 &lt;4.0.0\"  dependencies:   flutter:     sdk: flutter   sensors_plus: any # Add this line  dev_dependencies:   flutter_lints: ^2.0.0   flutter_test:     sdk: flutter  flutter:   uses-material-design: true <\/code><\/pre>\n<ol start=\"2\">\n<li>\n<p>\u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0438\u043c\u043f\u043e\u0440\u0442 \u0432 \u0444\u0430\u0439\u043b, \u0433\u0434\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d \u0432\u0438\u0434\u0436\u0435\u0442 \u044d\u043a\u0440\u0430\u043d\u0430<\/p>\n<\/li>\n<\/ol>\n<pre><code class=\"dart\">import 'dart:async'; import 'dart:ui' as ui;  import 'package:flutter\/material.dart'; import 'package:sensors_plus\/sensors_plus.dart'; \/\/ add this line<\/code><\/pre>\n<ol start=\"3\">\n<li>\n<p>\u041f\u043e\u043f\u0440\u0430\u0432\u0438\u043c \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e ParallaxScreen <\/p>\n<\/li>\n<\/ol>\n<pre><code class=\"dart\">  @override   Widget build(BuildContext context) {     return StreamBuilder&lt;AccelerometerEvent>(         stream: accelerometerEventStream(samplingPeriod: SensorInterval.uiInterval),         builder: (context, snapshot) {           final x = snapshot.data?.x ?? 0;           final y = snapshot.data?.y ?? 0;           return AnimatedContainer(             duration: const Duration(milliseconds: 100),             transform: Matrix4.identity()..translate(x * 10, y * 10),             child: CustomPaint(               painter: _image != null ? _BackgroundImagePainter(widget.scrollController, _image!) : null,               child: widget.child,             ),           );         });   }<\/code><\/pre>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/d6f\/6c3\/921\/d6f6c39212551642aa4c98e2e9368a57.gif\" alt=\"\u0410\u043a\u0441\u0435\u043b\u0435\u0440\u043e\u043c\u0435\u0442\u0440. \u041f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442\u0441\u044f\" title=\"\u0410\u043a\u0441\u0435\u043b\u0435\u0440\u043e\u043c\u0435\u0442\u0440. \u041f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442\u0441\u044f\" width=\"320\" height=\"569\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/d6f\/6c3\/921\/d6f6c39212551642aa4c98e2e9368a57.gif\"\/><\/p>\n<div><figcaption>\u0410\u043a\u0441\u0435\u043b\u0435\u0440\u043e\u043c\u0435\u0442\u0440. \u041f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442\u0441\u044f<\/figcaption><\/div>\n<\/figure>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/605\/c5f\/d44\/605c5fd44bedad73c0803c4810adaf1a.gif\" alt=\"\u0413\u0438\u0440\u043e\u0441\u043a\u043e\u043f. \u041f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0441\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f\" title=\"\u0413\u0438\u0440\u043e\u0441\u043a\u043e\u043f. \u041f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0441\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f\" width=\"320\" height=\"569\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/605\/c5f\/d44\/605c5fd44bedad73c0803c4810adaf1a.gif\"\/><\/p>\n<div><figcaption>\u0413\u0438\u0440\u043e\u0441\u043a\u043e\u043f. \u041f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0441\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f<\/figcaption><\/div>\n<\/figure>\n<p><strong>\u0427\u0442\u043e \u0438\u043c\u0435\u0435\u043c \u043f\u0440\u0438 \u0442\u0430\u043a\u043e\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438:<\/strong><\/p>\n<ol>\n<li>\n<p>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c <code>StreamBuilder<\/code>, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u0434\u0430\u0442\u0447\u0438\u043a\u043e\u0432 \u043f\u043e\u0441\u0442\u0443\u043f\u0430\u044e\u0442 \u0432 \u0432\u0438\u0434\u0435 \u0441\u0442\u0440\u0438\u043c\u0430; <br \/>\u0414\u043b\u044f \u0442\u0435\u0445, \u043a\u0442\u043e \u043d\u0435 \u0441\u0438\u043b\u044c\u043d\u043e \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u0435\u0442\u0441\u044f \u0432 \u0441\u0442\u0440\u0438\u043c\u0430\u0445 \u0432 dart, \u043d\u043e \u0437\u043d\u0430\u043a\u043e\u043c, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0441 YouTube (\u0422\u044b\u0422\u0440\u0443\u0431\u0430), \u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u043e\u0432\u0435\u0441\u0442\u0438 \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u044e \u0441\u043e \u0441\u0442\u0440\u0438\u043c\u0430\u043c\u0438, \u043a\u043e\u0433\u0434\u0430 \u0432 \u0434\u0440\u0443\u0433\u043e\u043c \u043a\u043e\u043d\u0446\u0435 \u0437\u0435\u043c\u043d\u043e\u0433\u043e \u0448\u0430\u0440\u0430 \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u0431\u043b\u043e\u0433\u0435\u0440 \u0447\u0442\u043e-\u0442\u043e \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442, \u0430 \u0432\u0441\u0435 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438 \u043c\u043e\u0433\u0443\u0442 \u044d\u0442\u043e \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u0438. \u0422\u0430\u043c \u0431\u043b\u043e\u0433\u0435\u0440 \u0437\u0430\u043a\u0438\u0434\u044b\u0432\u0430\u0435\u0442, \u0433\u0440\u0443\u0431\u043e \u0433\u043e\u0432\u043e\u0440\u044f, \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0443 \u0432 \u0442\u0440\u0443\u0431\u0443 (<code>Sink<\/code>), \u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u044e\u0442 \u044d\u0442\u0443 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0443 \u0438\u0437 \u0442\u0440\u0443\u0431\u044b (<code>Stream<\/code>).<br \/>\u0421 \u0434\u0430\u0442\u0447\u0438\u043a\u0430\u043c\u0438 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0435: \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0441\u043e\u0431\u0438\u0440\u0430\u044e\u0442\u0441\u044f \u0434\u0430\u043d\u043d\u044b\u0435 \u0441 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0439 \u0447\u0430\u0441\u0442\u043e\u0442\u043e\u0439 \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u044e\u0442\u0441\u044f \u0432 <code>Sink<\/code>. \u041a\u0442\u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u0441\u044f \u043a <code>Stream<\/code> \u044d\u0442\u043e\u0439 \u0442\u0440\u0443\u0431\u044b, \u0442\u043e\u0442 \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u044d\u0442\u0438 \u0434\u0430\u043d\u043d\u044b\u0435<\/p>\n<\/li>\n<li>\n<p>\u0414\u0430\u043d\u043d\u044b\u0435 \u043f\u043e\u0441\u0442\u0443\u043f\u0430\u044e\u0442 \u0432 \u0432\u0438\u0434\u0435 \u0435\u0434\u0438\u043d\u0438\u0446\/\u0434\u0435\u0441\u044f\u0442\u043e\u043a, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0434\u043b\u044f \u043f\u043e\u0432\u044b\u0448\u0435\u043d\u0438\u044f \u0447\u0443\u0432\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0443\u043c\u043d\u043e\u0436\u0430\u0435\u043c \u043d\u0430 10 (\u043d\u0430 \u0432\u0430\u0448\u0435 \u0443\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u0438\u0435)<\/p>\n<\/li>\n<li>\n<p>\u041f\u043e\u043b\u0435\u043c <code>samplingPeriod<\/code> \u0437\u0430\u0434\u0430\u0435\u0442\u0441\u044f \u0447\u0430\u0441\u0442\u043e\u0442\u0430, \u0441 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0441\u043e\u0431\u0438\u0440\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0441 \u0434\u0430\u0442\u0447\u0438\u043a\u043e\u0432 <\/p>\n<\/li>\n<li>\n<p>\u0412 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043a\u043e\u0434\u0430 \u0434\u0430\u043d\u043d\u044b\u0435 \u0431\u0435\u0440\u0443\u0442\u0441\u044f \u0441 \u0430\u043a\u0441\u0435\u043b\u0435\u0440\u043e\u043c\u0435\u0442\u0440\u0430. \u041f\u0440\u0438 \u0442\u0430\u043a\u043e\u043c \u0432\u044b\u0431\u043e\u0440\u0435 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442\u0441\u044f \u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0438 \u043f\u043e\u0441\u043b\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u043d\u0430\u043a\u043b\u043e\u043d\u0430. \u0415\u0441\u043b\u0438, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0433\u0438\u0440\u043e\u0441\u043a\u043e\u043f, \u0442\u043e \u043f\u043e\u0441\u043b\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u0432\u0440\u0430\u0449\u0435\u043d\u0438\u044f \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0430 \u0432\u0435\u0440\u043d\u0435\u0442\u0441\u044f \u0432 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0435 \u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435.<br \/>\u0422\u0443\u0442 \u0442\u043e\u0436\u0435 \u043a\u0430\u0436\u0434\u044b\u0439 \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u0442 \u043f\u043e\u0434 \u0441\u0432\u043e\u0438 \u0446\u0435\u043b\u0438<\/p>\n<\/li>\n<li>\n<p><code>AnimatedContainer<\/code> &#8212; \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0441\u0442\u043e \u0434\u043b\u044f \u043f\u043b\u0430\u0432\u043d\u043e\u0441\u0442\u0438 \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u0438<\/p>\n<\/li>\n<\/ol>\n<p>\u0412\u0430\u0440\u0438\u0430\u043d\u0442, \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0441\u043f\u0438\u0441\u043e\u043a \u0441\u0442\u0430\u0442\u0438\u0447\u043d\u044b\u043c \u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0443 \u043d\u0430 \u0431\u044d\u043a\u0433\u0440\u0430\u0443\u043d\u0434\u0435:<\/p>\n<pre><code class=\"dart\">  @override   Widget build(BuildContext context) {     return Stack(       children: [         StreamBuilder&lt;AccelerometerEvent>(             stream: accelerometerEventStream(samplingPeriod: SensorInterval.uiInterval),             builder: (context, snapshot) {               final x = snapshot.data?.x ?? 0;               final y = snapshot.data?.y ?? 0;               return AnimatedContainer(                 duration: const Duration(milliseconds: 100),                 transform: Matrix4.identity()..translate(x * 10, y * 10),                 child: CustomPaint(                   size: Size.infinite,                   painter: _image != null ? _BackgroundImagePainter(widget.scrollController, _image!) : null,                 ),               );             }),         widget.child,       ],     );   }<\/code><\/pre>\n<hr\/>\n<h2>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h2>\n<p>\u0421\u0435\u0433\u043e\u0434\u043d\u044f \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043b\u0438 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442, \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043e\u0442\u0437\u044b\u0432\u0447\u0438\u0432\u043e\u0441\u0442\u044c \u043f\u0440\u0438 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0438 \u0441 \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u043c \u043c\u0438\u0440\u043e\u043c \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0433\u0438\u0440\u043e\u0441\u043a\u043e\u043f\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u043f\u0430\u0440\u0430\u043b\u043b\u0430\u043a\u0441 \u044d\u0444\u0444\u0435\u043a\u0442\u0430<\/p>\n<p>\u0415\u0441\u043b\u0438 \u043f\u043e\u043d\u0440\u0430\u0432\u0438\u043b\u0441\u044f \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b, \u043f\u043e\u0441\u0442\u0430\u0432\u044c\u0442\u0435 \u2b06\ufe0f, \u0447\u0442\u043e\u0431\u044b \u044f \u043f\u043e\u043d\u0438\u043c\u0430\u043b, \u0447\u0442\u043e \u0442\u0435\u043c\u0430 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u0430 \u0438 \u043f\u0438\u0441\u0430\u043b \u0431\u043e\u043b\u044c\u0448\u0435 \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0445 \u0441\u0442\u0430\u0442\u0435\u0439<\/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\/794512\/\"> https:\/\/habr.com\/ru\/articles\/794512\/<\/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>\u041d\u0435\u0434\u0430\u0432\u043d\u043e \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u043b, \u043a\u0430\u043a \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043f\u0430\u0440\u0430\u043b\u043b\u0430\u043a\u0441 \u044d\u0444\u0444\u0435\u043a\u0442 \u043f\u0440\u0438 \u0441\u043a\u0440\u043e\u043b\u043b\u0435 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0432\u0438\u0434\u0436\u0435\u0442\u0430 CustomPaint<\/p>\n<div class=\"embed_link embed_layout-right\">\n<div class=\"embed__thumb\" style=\"background-image: url(&quot;https:\/\/habr.com\/share\/publication\/794004\/6bd506da6fa4691d60f084d673b33371\/&quot;);\"><\/div>\n<div class=\"embed__caption\">\n<div class=\"embed__caption-title\"><span>\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043f\u0430\u0440\u0430\u043b\u043b\u0430\u043a\u0441-\u044d\u0444\u0444\u0435\u043a\u0442 \u0432\u043e Flutter \u0441 CustomPaint<\/span><\/div>\n<div class=\"embed__caption-description\">\u0412 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u043c \u043c\u0438\u0440\u0435 \u043c\u043e\u0431\u0438\u043b\u044c\u043d\u043e\u0439 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438, \u0433\u0434\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043a \u0434\u0435\u0442\u0430\u043b\u044f\u043c \u0438 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 \u0438\u0433\u0440\u0430\u044e\u0442 \u043a\u043b\u044e&#8230;<\/div>\n<p><a href=\"https:\/\/habr.com\/ru\/articles\/794004\/\" target=\"_blank\" rel=\"noopener noreferrer nofollow\" class=\"embed__caption-link\">habr.com<\/a><\/div>\n<\/div>\n<p>\u0421\u0435\u0433\u043e\u0434\u043d\u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443, \u043a\u0430\u043a, \u0441\u0434\u0435\u043b\u0430\u0432 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0430\u043f\u0433\u0440\u0435\u0439\u0434, \u043c\u043e\u0436\u043d\u043e \u043e\u0436\u0438\u0432\u0438\u0442\u044c \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0443 \u043f\u0440\u0438 \u043f\u0440\u043e\u0441\u0442\u043e\u043c \u043d\u0430\u043a\u043b\u043e\u043d\u0435 \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u0430.<\/p>\n<figure class=\"\">\n<div><figcaption>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442<\/figcaption><\/div>\n<\/figure>\n<hr\/>\n<p>\u0412\u0441\u043f\u043e\u043c\u043d\u0438\u043c, \u0447\u0442\u043e \u0443\u0436\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043e:<\/p>\n<ol>\n<li>\n<p>\u042d\u043a\u0440\u0430\u043d \u0441\u043e \u0441\u043f\u0438\u0441\u043a\u043e\u043c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432, \u0433\u0434\u0435 \u043a\u0430\u0436\u0434\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 &#8212; \u044d\u0442\u043e \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0430 \u0441 \u043f\u043e\u0434\u043f\u0438\u0441\u044c\u044e<\/p>\n<\/li>\n<li>\n<p>\u0411\u044d\u043a\u0433\u0440\u0430\u0443\u043d\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0442\u0430\u043a\u0436\u0435 \u0441\u043c\u0435\u0449\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u0438 \u0441\u043a\u0440\u043e\u043b\u043b\u0435, \u043d\u043e \u0447\u0443\u0442\u044c \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u0435\u0435, \u0447\u0435\u043c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0432 \u0441\u043f\u0438\u0441\u043a\u0435<\/p>\n<\/li>\n<\/ol>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u0434<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"dart\">import 'dart:math' show Random; import 'dart:ui' as ui;  import 'package:flutter\/material.dart';  class ParallaxScreen extends StatefulWidget {   const ParallaxScreen({super.key});    @override   State&lt;ParallaxScreen> createState() => _ParallaxScreenState(); }  class _ParallaxScreenState extends State&lt;ParallaxScreen> {   \/\/ get an array of random ids   late final List&lt;int> ids = List.generate(10, (index) => Random().nextInt(500));    \/\/ controller to handle scrolling of items   final ScrollController _scrollController = ScrollController();    @override   void dispose() {     _scrollController.dispose();     super.dispose();   }    @override   Widget build(BuildContext context) {     return Scaffold(       body: _Background(         scrollController: _scrollController,         child: ListView.builder(           controller: _scrollController,           itemCount: ids.length,           itemBuilder: (context, index) {             final int id = ids[index];             return ItemCard(id: id);           },         ),       ),     );   } }  class ItemCard extends StatelessWidget {   const ItemCard({     super.key,     required this.id,   });    final int id;    @override   Widget build(BuildContext context) {     return Container(       margin: const EdgeInsets.symmetric(         horizontal: 20,         vertical: 20,       ),       clipBehavior: Clip.hardEdge,       width: double.maxFinite,       height: 300,       decoration: BoxDecoration(         color: Colors.grey.withOpacity(0.4),         borderRadius: BorderRadius.circular(20),         boxShadow: const [           BoxShadow(             color: Colors.black12,             blurRadius: 10,             spreadRadius: 5,           ),         ],       ),       child: Stack(         children: [           Image.network(             'https:\/\/picsum.photos\/id\/$id\/500\/300', \/\/ get an image from network by id             width: double.maxFinite,           ),           Positioned(             left: 20,             bottom: 20,             child: Text(               'Image $id',               style: const TextStyle(                 color: Colors.white,                 fontSize: 24,                 fontWeight: FontWeight.bold,               ),             ),           ),         ],       ),     );   } }  class _Background extends StatefulWidget {   const _Background({     required this.child,     required this.scrollController,   });   final Widget child;   final ScrollController scrollController;    @override   State&lt;_Background> createState() => _BackgroundState(); }  class _BackgroundState extends State&lt;_Background> {   @override   void initState() {     super.initState();     _loadImage();   }    ui.Image? _image;   \/\/ logic for downloaiding an image as ui.Image object   Future&lt;void> _loadImage() async {     const imageProvider = NetworkImage('https:\/\/picsum.photos\/id\/307\/600\/4000'); \/\/ get background image. You can use anyone you want     final ImageStreamListener listener = ImageStreamListener((info, _) {       setState(() {         _image = info.image;       });     });     final ImageStream stream = imageProvider.resolve(const ImageConfiguration());     stream.addListener(listener);   }    @override   void dispose() {     _image?.dispose();     super.dispose();   }    @override   Widget build(BuildContext context) {     return CustomPaint(       painter: _image != null ? _BackgroundImagePainter(widget.scrollController, _image!) : null,       child: widget.child,     );   } }  class _BackgroundImagePainter extends CustomPainter {   final ScrollController controller;   final ui.Image image;   const _BackgroundImagePainter(this.controller, this.image) : super(repaint: controller);    @override   void paint(Canvas canvas, Size size) {     final imageWidth = image.width.toDouble();     final imageHeight = image.height.toDouble();     final aspectRatio = imageWidth \/ imageHeight;      final src = Rect.fromLTWH(       0,       0,       imageWidth,       imageHeight,     );     final deltaY = -controller.offset * 0.6;     final dst = Rect.fromLTWH(       0,       deltaY,       size.width,       size.width \/ aspectRatio,     );     canvas.drawImageRect(       image,       src,       dst,       Paint()..filterQuality = FilterQuality.high,     );   }    @override   bool shouldRepaint(_BackgroundImagePainter oldDelegate) => controller.offset != oldDelegate.controller.offset; } <\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u0427\u0442\u043e\u0431\u044b \u0440\u0435\u0430\u0433\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u0430 \u043d\u0430\u043a\u043b\u043e\u043d\u044b \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u0430, \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0441 \u0434\u0430\u0442\u0447\u0438\u043a\u043e\u0432 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0434\u0430\u043d\u043d\u044b\u0439 \u043a\u0435\u0439\u0441 \u0430\u043a\u0442\u0443\u0430\u043b\u0435\u043d \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430\u0445 \u0441 \u0430\u043a\u0441\u0435\u043b\u0435\u0440\u043e\u043c\u0435\u0442\u0440\u043e\u043c \u0438 \u0433\u0438\u0440\u043e\u0441\u043a\u043e\u043f\u043e\u043c<\/p>\n<p><strong>\u0410\u043a\u0441\u0435\u043b\u0435\u0440\u043e\u043c\u0435\u0442\u0440<\/strong> &#8212; \u0435\u0441\u043b\u0438 \u0441\u0443\u043f\u0435\u0440 \u043f\u0440\u043e\u0441\u0442\u043e, \u0442\u043e \u044d\u0442\u043e \u0434\u0430\u0442\u0447\u0438\u043a, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u0437\u043c\u0435\u0440\u044f\u0435\u0442 \u0443\u0441\u043a\u043e\u0440\u0435\u043d\u0438\u0435 (\u0430\u043a\u0441\u0435\u043b\u0435\u0440\u0430\u0446\u0438\u044e) \u043f\u0440\u0438 \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u0438 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430 \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0432 \u0442\u0440\u0435\u0445 \u043f\u0440\u043e\u0435\u043a\u0446\u0438\u044f\u0445. \u0415\u0434\u0438\u043d\u0438\u0446\u0430 \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u044f \u0438\u043b\u0438 <strong>\u043c\/c^2, <\/strong>\u0438\u043b\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043e\u0442 0 \u0434\u043e 1 (\u043d\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0443\u0441\u043a\u043e\u0440\u0435\u043d\u0438\u044f \u0441\u0432\u043e\u0431\u043e\u0434\u043d\u043e\u0433\u043e \u043f\u0430\u0434\u0435\u043d\u0438\u044f 9.8 \u043c\/\u0441^2). \u0415\u0441\u043b\u0438, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0442\u0435\u043b\u0435\u0444\u043e\u043d \u043b\u0435\u0436\u0438\u0442 \u043d\u0430 \u0441\u0442\u043e\u043b\u0435, \u0442\u043e \u043f\u043e \u043e\u0441\u0438 Z \u0430\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0443\u0441\u043a\u043e\u0440\u0435\u043d\u0438\u044f \u0431\u0443\u0434\u0435\u0442 \u043b\u0438\u0431\u043e 9.8, \u043b\u0438\u0431\u043e 1<\/p>\n<p><strong>\u0413\u0438\u0440\u043e\u0441\u043a\u043e\u043f<\/strong> &#8212; \u0434\u0430\u0442\u0447\u0438\u043a, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442, \u0441 \u043a\u0430\u043a\u043e\u0439 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c\u044e \u043f\u043e\u0432\u0435\u0440\u043d\u0443\u043b\u0438 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0442\u0430\u043a\u043e\u0439-\u0442\u043e \u043e\u0441\u0438. \u0415\u0434\u0438\u043d\u0438\u0446\u0430 \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u044f \u0438\u043b\u0438 <strong>\u00b0\/\u0441<\/strong>, \u0438\u043b\u0438 <strong>\u0440\u0430\u0434\/\u0441.<\/strong> \u0415\u0441\u043b\u0438 \u0442\u0435\u043b\u043e \u0432 \u043f\u043e\u043a\u043e\u0435, \u0442\u043e \u0434\u0430\u0442\u0447\u0438\u043a \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043d\u0443\u043b\u0435\u0432\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f<\/p>\n<h2>\u0421\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438<\/h2>\n<p>\u0414\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u0441 \u044d\u0442\u0438\u0445 \u0434\u0430\u0442\u0447\u0438\u043a\u043e\u0432 \u0435\u0441\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0433\u043e\u0442\u043e\u0432\u044b\u0445 \u0440\u0435\u0448\u0435\u043d\u0438\u0439 \u043d\u0430 pub.dev<\/p>\n<h4>flutter_sensors<\/h4>\n<div class=\"embed_link\">\n<div class=\"embed__thumb\" style=\"background-image: url(&quot;https:\/\/pub.dev\/static\/hash-8da4fn9n\/img\/pub-dev-icon-cover-image.png&quot;);\"><\/div>\n<div class=\"embed__caption\">\n<div class=\"embed__caption-title\"><span>flutter_sensors | Flutter package<\/span><\/div>\n<p><a href=\"https:\/\/pub.dev\/packages\/flutter_sensors\" target=\"_blank\" rel=\"noopener noreferrer nofollow\" class=\"embed__caption-link\">pub.dev<\/a><\/div>\n<\/div>\n<p>\u042d\u0442\u043e \u043f\u0440\u0438\u043c\u0435\u0440 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u0435\u0437 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0439 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0443\u0436\u0435 \u0431\u043e\u043b\u0435\u0435 2-\u0445 \u043b\u0435\u0442, \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0432 \u0442\u0435\u043a\u0443\u0449\u0435\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 flutter \u0438 dart \u0438 \u0432\u043f\u043e\u043b\u043d\u0435 \u0434\u043e\u0441\u0442\u043e\u0439\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u0441\u0432\u043e\u0438 \u0437\u0430\u0434\u0430\u0447\u0438. \u0412 \u0440\u0430\u043d\u043d\u0438\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u0445 \u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0441\u044f \u0438\u043c\u0435\u043d\u043d\u043e \u044d\u0442\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u043e\u0439<\/p>\n<h4>sensors_plus<\/h4>\n<div class=\"embed_link\">\n<div class=\"embed__thumb\" style=\"background-image: url(&quot;https:\/\/pub.dev\/static\/hash-8da4fn9n\/img\/pub-dev-icon-cover-image.png&quot;);\"><\/div>\n<div class=\"embed__caption\">\n<div class=\"embed__caption-title\"><span>sensors_plus | Flutter package<\/span><\/div>\n<p><a href=\"https:\/\/pub.dev\/packages\/sensors_plus\" target=\"_blank\" rel=\"noopener noreferrer nofollow\" class=\"embed__caption-link\">pub.dev<\/a><\/div>\n<\/div>\n<p>\u042d\u0442\u043e \u043f\u0440\u0438\u043c\u0435\u0440 \u0434\u0440\u0443\u0433\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438, \u0443 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043f\u0440\u043e\u0449\u0435 API, \u043f\u043e \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044e \u0441 flutter_sensors, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u044e\u0442\u0441\u044f \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u0439 \u0432 AndroidManifest.xml \u0434\u043b\u044f Android \u0438\u043b\u0438 info.plist \u0434\u043b\u044f iOS. <br \/>\u0415\u0449\u0435 \u043e\u0434\u043d\u043e \u043e\u0442\u043b\u0438\u0447\u0438\u0435, \u0447\u0442\u043e \u043f\u0440\u0438 \u0440\u0430\u0441\u0447\u0435\u0442\u0435 \u0443\u0441\u043a\u043e\u0440\u0435\u043d\u0438\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0440\u0430\u0437\u043d\u044b\u0435 \u0435\u0434\u0438\u043d\u0438\u0446\u044b. \u042d\u0442\u043e \u0441\u0442\u043e\u0438\u0442 \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c \u043f\u0440\u0438 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0438 \u0441 \u043e\u0434\u043d\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u043a\u0438 \u043d\u0430 \u0434\u0440\u0443\u0433\u0443\u044e.<\/p>\n<p>\u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f sensors_plus<\/p>\n<h2>\u0411\u044b\u0441\u0442\u0440\u044b\u0439 \u0430\u043f\u0433\u0440\u0435\u0439\u0434<\/h2>\n<ol>\n<li>\n<p>\u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 sensors_plus \u0432 pubspec.yaml<\/p>\n<\/li>\n<\/ol>\n<pre><code class=\"yaml\">name: parallax_with_sensors_example description: \"A new Flutter project.\" publish_to: \"none\" version: 0.1.0  environment:   sdk: \">=3.2.6 &lt;4.0.0\"  dependencies:   flutter:     sdk: flutter   sensors_plus: any # Add this line  dev_dependencies:   flutter_lints: ^2.0.0   flutter_test:     sdk: flutter  flutter:   uses-material-design: true <\/code><\/pre>\n<ol start=\"2\">\n<li>\n<p>\u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0438\u043c\u043f\u043e\u0440\u0442 \u0432 \u0444\u0430\u0439\u043b, \u0433\u0434\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d \u0432\u0438\u0434\u0436\u0435\u0442 \u044d\u043a\u0440\u0430\u043d\u0430<\/p>\n<\/li>\n<\/ol>\n<pre><code class=\"dart\">import 'dart:async'; import 'dart:ui' as ui;  import 'package:flutter\/material.dart'; import 'package:sensors_plus\/sensors_plus.dart'; \/\/ add this line<\/code><\/pre>\n<ol start=\"3\">\n<li>\n<p>\u041f\u043e\u043f\u0440\u0430\u0432\u0438\u043c \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e ParallaxScreen <\/p>\n<\/li>\n<\/ol>\n<pre><code class=\"dart\">  @override   Widget build(BuildContext context) {     return StreamBuilder&lt;AccelerometerEvent>(         stream: accelerometerEventStream(samplingPeriod: SensorInterval.uiInterval),         builder: (context, snapshot) {           final x = snapshot.data?.x ?? 0;           final y = snapshot.data?.y ?? 0;           return AnimatedContainer(             duration: const Duration(milliseconds: 100),             transform: Matrix4.identity()..translate(x * 10, y * 10),             child: CustomPaint(               painter: _image != null ? _BackgroundImagePainter(widget.scrollController, _image!) : null,               child: widget.child,             ),           );         });   }<\/code><\/pre>\n<figure class=\"\">\n<div><figcaption>\u0410\u043a\u0441\u0435\u043b\u0435\u0440\u043e\u043c\u0435\u0442\u0440. \u041f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442\u0441\u044f<\/figcaption><\/div>\n<\/figure>\n<figure class=\"\">\n<div><figcaption>\u0413\u0438\u0440\u043e\u0441\u043a\u043e\u043f. \u041f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0441\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f<\/figcaption><\/div>\n<\/figure>\n<p><strong>\u0427\u0442\u043e \u0438\u043c\u0435\u0435\u043c \u043f\u0440\u0438 \u0442\u0430\u043a\u043e\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438:<\/strong><\/p>\n<ol>\n<li>\n<p>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c <code>StreamBuilder<\/code>, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u0434\u0430\u0442\u0447\u0438\u043a\u043e\u0432 \u043f\u043e\u0441\u0442\u0443\u043f\u0430\u044e\u0442 \u0432 \u0432\u0438\u0434\u0435 \u0441\u0442\u0440\u0438\u043c\u0430; <br \/>\u0414\u043b\u044f \u0442\u0435\u0445, \u043a\u0442\u043e \u043d\u0435 \u0441\u0438\u043b\u044c\u043d\u043e \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u0435\u0442\u0441\u044f \u0432 \u0441\u0442\u0440\u0438\u043c\u0430\u0445 \u0432 dart, \u043d\u043e \u0437\u043d\u0430\u043a\u043e\u043c, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0441 YouTube (\u0422\u044b\u0422\u0440\u0443\u0431\u0430), \u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u043e\u0432\u0435\u0441\u0442\u0438 \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u044e \u0441\u043e \u0441\u0442\u0440\u0438\u043c\u0430\u043c\u0438, \u043a\u043e\u0433\u0434\u0430 \u0432 \u0434\u0440\u0443\u0433\u043e\u043c \u043a\u043e\u043d\u0446\u0435 \u0437\u0435\u043c\u043d\u043e\u0433\u043e \u0448\u0430\u0440\u0430 \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u0431\u043b\u043e\u0433\u0435\u0440 \u0447\u0442\u043e-\u0442\u043e \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442, \u0430 \u0432\u0441\u0435 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438 \u043c\u043e\u0433\u0443\u0442 \u044d\u0442\u043e \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u0438. \u0422\u0430\u043c \u0431\u043b\u043e\u0433\u0435\u0440 \u0437\u0430\u043a\u0438\u0434\u044b\u0432\u0430\u0435\u0442, \u0433\u0440\u0443\u0431\u043e \u0433\u043e\u0432\u043e\u0440\u044f, \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0443 \u0432 \u0442\u0440\u0443\u0431\u0443 (<code>Sink<\/code>), \u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u044e\u0442 \u044d\u0442\u0443 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0443 \u0438\u0437 \u0442\u0440\u0443\u0431\u044b (<code>Stream<\/code>).<br \/>\u0421 \u0434\u0430\u0442\u0447\u0438\u043a\u0430\u043c\u0438 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0435: \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0441\u043e\u0431\u0438\u0440\u0430\u044e\u0442\u0441\u044f \u0434\u0430\u043d\u043d\u044b\u0435 \u0441 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0439 \u0447\u0430\u0441\u0442\u043e\u0442\u043e\u0439 \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u044e\u0442\u0441\u044f \u0432 <code>Sink<\/code>. \u041a\u0442\u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u0441\u044f \u043a <code>Stream<\/code> \u044d\u0442\u043e\u0439 \u0442\u0440\u0443\u0431\u044b, \u0442\u043e\u0442 \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u044d\u0442\u0438 \u0434\u0430\u043d\u043d\u044b\u0435<\/p>\n<\/li>\n<li>\n<p>\u0414\u0430\u043d\u043d\u044b\u0435 \u043f\u043e\u0441\u0442\u0443\u043f\u0430\u044e\u0442 \u0432 \u0432\u0438\u0434\u0435 \u0435\u0434\u0438\u043d\u0438\u0446\/\u0434\u0435\u0441\u044f\u0442\u043e\u043a, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0434\u043b\u044f \u043f\u043e\u0432\u044b\u0448\u0435\u043d\u0438\u044f \u0447\u0443\u0432\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0443\u043c\u043d\u043e\u0436\u0430\u0435\u043c \u043d\u0430 10 (\u043d\u0430 \u0432\u0430\u0448\u0435 \u0443\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u0438\u0435)<\/p>\n<\/li>\n<li>\n<p>\u041f\u043e\u043b\u0435\u043c <code>samplingPeriod<\/code> \u0437\u0430\u0434\u0430\u0435\u0442\u0441\u044f \u0447\u0430\u0441\u0442\u043e\u0442\u0430, \u0441 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0441\u043e\u0431\u0438\u0440\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0441 \u0434\u0430\u0442\u0447\u0438\u043a\u043e\u0432 <\/p>\n<\/li>\n<li>\n<p>\u0412 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043a\u043e\u0434\u0430 \u0434\u0430\u043d\u043d\u044b\u0435 \u0431\u0435\u0440\u0443\u0442\u0441\u044f \u0441 \u0430\u043a\u0441\u0435\u043b\u0435\u0440\u043e\u043c\u0435\u0442\u0440\u0430. \u041f\u0440\u0438 \u0442\u0430\u043a\u043e\u043c \u0432\u044b\u0431\u043e\u0440\u0435 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442\u0441\u044f \u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0438 \u043f\u043e\u0441\u043b\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u043d\u0430\u043a\u043b\u043e\u043d\u0430. \u0415\u0441\u043b\u0438, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0433\u0438\u0440\u043e\u0441\u043a\u043e\u043f, \u0442\u043e \u043f\u043e\u0441\u043b\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u0432\u0440\u0430\u0449\u0435\u043d\u0438\u044f \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0430 \u0432\u0435\u0440\u043d\u0435\u0442\u0441\u044f \u0432 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0435 \u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435.<br \/>\u0422\u0443\u0442 \u0442\u043e\u0436\u0435 \u043a\u0430\u0436\u0434\u044b\u0439 \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u0442 \u043f\u043e\u0434 \u0441\u0432\u043e\u0438 \u0446\u0435\u043b\u0438<\/p>\n<\/li>\n<li>\n<p><code>AnimatedContainer<\/code> &#8212; \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0441\u0442\u043e \u0434\u043b\u044f \u043f\u043b\u0430\u0432\u043d\u043e\u0441\u0442\u0438 \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u0438<\/p>\n<\/li>\n<\/ol>\n<p>\u0412\u0430\u0440\u0438\u0430\u043d\u0442, \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0441\u043f\u0438\u0441\u043e\u043a \u0441\u0442\u0430\u0442\u0438\u0447\u043d\u044b\u043c \u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0443 \u043d\u0430 \u0431\u044d\u043a\u0433\u0440\u0430\u0443\u043d\u0434\u0435:<\/p>\n<pre><code class=\"dart\">  @override   Widget build(BuildContext context) {     return Stack(       children: [         StreamBuilder&lt;AccelerometerEvent>(             stream: accelerometerEventStream(samplingPeriod: SensorInterval.uiInterval),             builder: (context, snapshot) {               final x = snapshot.data?.x ?? 0;               final y = snapshot.data?.y ?? 0;               return AnimatedContainer(                 duration: const Duration(milliseconds: 100),                 transform: Matrix4.identity()..translate(x * 10, y * 10),                 child: CustomPaint(                   size: Size.infinite,                   painter: _image != null ? _BackgroundImagePainter(widget.scrollController, _image!) : null,                 ),               );             }),         widget.child,       ],     );   }<\/code><\/pre>\n<hr\/>\n<h2>\u0417\u0430\u043a\u043b<\/h><\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-368515","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/368515","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=368515"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/368515\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=368515"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=368515"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=368515"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}