<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by LinXunFeng on Medium]]></title>
        <description><![CDATA[Stories by LinXunFeng on Medium]]></description>
        <link>https://medium.com/@linxunfeng?source=rss-ec01a09c277------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*mnGmtCDJkyuJoQBR.jpg</url>
            <title>Stories by LinXunFeng on Medium</title>
            <link>https://medium.com/@linxunfeng?source=rss-ec01a09c277------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 22 Nov 2026 18:17:48 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@linxunfeng/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Scan a Competitor’s App and Its Whole Tech Stack Is Exposed ]]></title>
            <link>https://medium.com/@linxunfeng/scan-a-competitors-app-and-its-whole-tech-stack-is-exposed-d0073fba9fc8?source=rss-ec01a09c277------2</link>
            <guid isPermaLink="false">https://medium.com/p/d0073fba9fc8</guid>
            <category><![CDATA[lynx]]></category>
            <category><![CDATA[react-native]]></category>
            <category><![CDATA[jetpack-compose]]></category>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[hermes]]></category>
            <dc:creator><![CDATA[LinXunFeng]]></dc:creator>
            <pubDate>Mon, 16 Nov 2026 01:39:19 GMT</pubDate>
            <atom:updated>2026-11-16T01:39:19.883Z</atom:updated>
            <content:encoded><![CDATA[<h3>1. Introduction</h3><p>FlutterEye is our little tool for finding out which apps on your phone are built with Flutter, including their Flutter version and the packages they depend on. Since late October it has gone through several releases (1.0.4 → 1.0.7). It now recognizes far more than Flutter: React Native, Unity, Cocos, Compose and others are all detected, so we renamed it to <strong>Stack Eye</strong>.</p><p>Here’s what it looks like now:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*f1-OgDWUg1ui0_EJI-svSg.png" /></figure><p>Below we walk through the changes in this order: new features → experience improvements → bug fixes.</p><h3>2. New Features</h3><h4>2.1 Detect Every App</h4><p>The home screen no longer lists only Flutter apps. <strong><em>It now lists every installed app</em></strong>, and each one is tagged with the frameworks and native technologies it uses:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7A6qZ_VX5xt8ZiLPlJWEQQ.png" /></figure><ul><li>When an app uses several frameworks at once, all of them are shown</li><li>Flutter apps still show their Flutter / Dart version, channel and dependencies</li><li>Cocos apps show their engine version</li><li>Filter by framework and native tech (multi-select) on the home screen, and search by app name or package name</li><li>Sorting moved into the filter panel, with new options: install time, update time and size</li><li>The list shows each app’s size and ABI support directly</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4vv2Sv-xHcL0U_UR0qZ3Sw.png" /></figure><h4>2.2 16 KB Page Size Check</h4><p>The details page has a new “Native libraries” card. It lists every .so in the app and checks whether each one can run on devices with a 16 KB page size. The result is <strong>Ready</strong>, <strong>Not ready</strong> or <strong>Not applicable</strong>, and every library that fails is flagged with the reason. It also tells you whether the app ships 64-bit libraries.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xN-8DbA5kKozZUxhW5Rkwg.jpeg" /></figure><h4>2.3 Analyze Local APKs</h4><p>You can now analyze .apk, .apks and .xapk files directly, opened in any of three ways:</p><ul><li>Pick a file inside the app</li><li>“Share” it to `Stack Eye` from another app</li><li>“Open with” from a file manager</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OqswAwiM7K0u3q_2YROYnw.jpeg" /></figure><h4>2.4 Flutter Inspection</h4><p>The details page of a Flutter app has a new “Flutter inspection” card:</p><ul><li><strong>Rendering engine</strong>: Impeller or Skia</li><li><strong>Code size</strong>: how much space the Dart code and the engine take</li><li><strong>Obfuscation:</strong> whether the code was obfuscated at build time</li><li>Latest stable: compared against the current stable release</li></ul><p>The dependency list also moved to its own page, opened from this card.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sKtEER0YGYDwHGMfoRNrmw.jpeg" /></figure><h4>2.5 App Details</h4><p>The details page now covers much more about each app:</p><ul><li><strong>Basics</strong>: install source, SDK versions, install and update time, signing certificate</li><li><strong>Third-party SDKs</strong>: which common third-party SDKs the app includes, with detection rules updated remotely</li><li><strong>Permissions</strong>: every permission is labeled with its protection level, such as granted at install, requires user approval, or system only</li><li><strong>Screen adaptation:</strong> multi-window, resizing, orientation lock and picture-in-picture support</li><li>Components: Activity, Service, Receiver and Provider are marked as exported or not, with their intent-filters and ready-to-use call examples for adb, Kotlin, Java and Flutter</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*E1dA9LgQroTDFM_yTYmk6g.png" /></figure><h4>2.6 Dashboard</h4><p>The dashboard is regrouped around all apps into four sections: Overview, Frameworks, Native tech, and Build &amp; Compliance. It shows the framework distribution, AGP version distribution, 16 KB readiness ratio and 64-bit support. Flutter version distribution, popular dependencies and Cocos engine versions live in the Frameworks section.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1BimuX6cqYE59CjHPEXPDw.png" /></figure><h4>2.7 Export</h4><ul><li><strong>App report</strong>: share a single app’s report as an image or Markdown</li><li><strong>Package users</strong>: see which apps on your phone use a given Flutter package, with big names like Google, Tencent and Alibaba highlighted and listed first. Export it as an image or Markdown — handy for your own package’s README</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*f_eo7NAJ8yD_T290Y9FrFg.png" /></figure><h3>3. Improvements and Fixes</h3><h4>3.1 Experience Improvements</h4><ul><li><strong>Brand-new UI</strong>: every page redesigned in a minimal style, with light and dark themes following the system</li><li><strong>Faster scanning</strong>: on launch it syncs the version table and detection rules once, waiting at most 5 seconds; on timeout it scans with local data and the new data takes effect on the next launch. After that, only newly installed or updated apps are parsed</li><li><strong>Fast scrolling</strong>: the home screen and dependency list have a draggable scroll thumb, so you can jump to the bottom no matter how many apps there are</li><li><strong>Loading skeleton</strong>: the list shows a skeleton while loading</li><li><strong>Smoother icons</strong>: icons you scroll back to appear instantly instead of flashing blank, and opening the details page no longer stutters</li><li><strong>Tidier entry points</strong>: APK analysis and the dashboard moved into the floating menu at the bottom right, and an explanation pops up before your first analysis</li><li><strong>Size display</strong>: matches the way system settings show sizes</li></ul><h4>3.2 Bug Fixes</h4><ul><li>Fixed some apk files failing to load</li><li>Fixed stable Flutter releases being detected as pre-releases</li><li>Fixed the screen briefly going landscape before switching back to portrait when launched with the phone held sideways</li><li>Fixed the floating button icon turning black in dark mode, and the icon background on the details page being hard to see</li><li>Fixed the copy toast in the component list being hidden behind the panel</li><li>Fixed the list jumping back and forth while dragging the fast-scroll thumb</li><li>Fixed the generation time at the bottom of the report image sharing a line with other content, and the English export button text wrapping</li><li>Fixed screenshots piling up in the cache after sharing images</li></ul><h3>4. Wrapping Up</h3><ul><li>All analysis happens on your device; Stack Eye needs permission to see your installed apps to scan them</li><li>The package name hasn’t changed, so existing users can simply update</li></ul><p>That’s all for this post — thanks for your support! If you run into any problems, or there’s a framework you’d like it to detect, let us know in the comments or on <a href="https://github.com/FullStackAction/stack_eye">https://github.com/FullStackAction/stack_eye</a> 😁</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d0073fba9fc8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Flutter - Initial Anchor And Optimization For Detail Pages]]></title>
            <link>https://medium.com/@linxunfeng/flutter-initial-anchor-and-optimization-for-detail-pages-86aa5b9c4186?source=rss-ec01a09c277------2</link>
            <guid isPermaLink="false">https://medium.com/p/86aa5b9c4186</guid>
            <category><![CDATA[anchor]]></category>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[modules]]></category>
            <category><![CDATA[details]]></category>
            <category><![CDATA[open-source]]></category>
            <dc:creator><![CDATA[LinXunFeng]]></dc:creator>
            <pubDate>Sat, 20 Sep 2025 07:03:58 GMT</pubDate>
            <atom:updated>2025-09-20T07:03:58.053Z</atom:updated>
            <content:encoded><![CDATA[<h3>I. Foreword</h3><p>This is a small feature I needed to implement for a recent requirement. The product manager wanted the detail page to open and automatically scroll to a specific module’s position after a notification is tapped.</p><p>Building upon the linked scrolling effect already implemented in the previous article, <a href="https://medium.com/@linxunfeng/flutter-syncing-detail-page-tabbar-with-modules-nailed-it-60f2ca67e100">Flutter - Syncing Detail Page TabBar with Modules? Nailed It!</a>, we now just need to implement the initial anchor feature and solve the issue where the anchored module gets pushed down by asynchronously loaded modules.</p><p>You can try the corresponding demo online:<br><a href="https://fluttercandies.github.io/flutter_scrollview_observer/#/detail">https://fluttercandies.github.io/flutter_scrollview_observer/#/detail</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0TlTzQXhuAVOlzR35KH0-g.gif" /></figure><p>As shown in the GIF, after entering the detail page, it scrolls to Module 7. Then, Module 3 and Module 6 are displayed after their data is fetched asynchronously. During this process, Module 7 remains in its current position without being pushed down.</p><p>OK, let’s see how to implement this feature using my open-source library.</p><p><a href="https://github.com/fluttercandies/flutter_scrollview_observer">https://github.com/fluttercandies/flutter_scrollview_observer</a></p><h3>II. Implementation</h3><h4>Initial Anchor</h4><p>Create two necessary controllers.</p><pre>ScrollController scrollController = ScrollController();<br><br>late ListObserverController observerController = ListObserverController(<br> controller: scrollController,<br>);</pre><p>If your ListView has all the data from the beginning, you can simply set the initialIndex as follows:</p><pre>late ListObserverController observerController = ListObserverController(<br> controller: scrollController,<br>)<br> // Set the initial anchor index<br> ..initialIndex = 3;</pre><p>If you need to set an offset, you can use initialIndexModel.</p><pre>late ListObserverController observerController = ListObserverController(<br> controller: scrollController,<br>)<br> ..initialIndexModel = ObserverIndexPositionModel(<br>   index: 3,<br>   offset: (_) =&gt; navBarHeight,<br> );</pre><p>However, our example today is a bit more complex, as some modules of the ListView are loaded dynamically.</p><p>To display the page faster, we first show the basic data upon request, and then separately request larger data interfaces and refresh the corresponding module views.</p><p>After obtaining the basic data required for the page, call the following <em>initIndexPositionForListView</em> method to initialize the anchor.</p><pre>// Basic data requested<br>// Initialize anchor<br>initIndexPositionForListView();<br><br>// Update view<br>update();</pre><pre>void initIndexPositionForListView() {<br>  // Default to Module 1<br>  final defaultIndexModel = ObserverIndexPositionModel(<br>    index: 0,<br>  );<br>  ObserverIndexPositionModel indexModel = defaultIndexModel;<br><br>  () {<br>    final moduleAnchor = state.defaultModuleAnchor;<br>    if (moduleAnchor == null) return;<br><br>    // Do not process asynchronously loaded modules<br>    if (state.asyncLoadModuleTypes.contains(moduleAnchor)) return;<br>    indexModel = ObserverIndexPositionModel(<br>      index: state.moduleTypes.indexOf(moduleAnchor),<br>      offset: (_) =&gt; state.navBarHeight,<br>    );<br>  }();<br><br>  state.observerController.initialIndexModel = indexModel;<br>}</pre><p>At this point, the initial anchor feature for non-asynchronously loaded modules is complete.</p><h4>Asynchronous Loading</h4><p>The <em>initIndexPositionForListView</em> method mentioned above skips the processing of asynchronous data modules. Therefore, when the initial anchor passed to the detail page is an asynchronously loaded module, you need to detect it and scroll to the corresponding position after the data is successfully requested.</p><pre>/// Check for initial anchor<br>void checkAnchorForListView(DetailModuleType moduleType) async {<br>  final moduleAnchor = state.defaultModuleAnchor;<br>  // No initial anchor<br>  if (moduleAnchor == null) return;<br>  // Initial anchor does not match the current module<br>  if (moduleType != moduleAnchor) return;<br>  if (!state.moduleTypes.contains(moduleType)) return;<br>  // Find and scroll to the corresponding module position<br>  final index = state.moduleTypes.indexOf(moduleType);<br>  await WidgetsBinding.instance.endOfFrame;<br>  state.observerController.animateTo(<br>    index: index,<br>    duration: const Duration(milliseconds: 300),<br>    curve: Curves.easeInOut,<br>    offset: (_) =&gt; state.navBarHeight,<br>  );<br>}</pre><p>Taking Module 3, which loads data asynchronously, as an example:</p><pre>void loadAsyncData() {<br>  // Simulate data request<br>  await Future.delayed(const Duration(seconds: 2));<br><br>  // Data requested<br>  if (state.isDisposed) return;<br>  state.haveDataForModule3 = true;<br><br>  // Update Module 3 view<br>  update([DetailUpdateType.module3]);<br><br>  // Check if it is the initial anchor<br>  checkAnchorForListView(DetailModuleType.module3);<br>}</pre><p>Let’s see the effect we have so far.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qnCxXqgjOdNN88OE6mtyxg.gif" /></figure><p>After entering the detail page, it automatically scrolls to Module 7. However, as Module 3 and Module 6 successively request data and display their views, Module 7 is pushed down. Next, we will optimize this issue!</p><h4>Maintaining Position</h4><p>Create the necessary controller.</p><pre>late ChatScrollObserver keepPositionObserver = ChatScrollObserver(<br>  observerController,<br>);</pre><p>Adjust the ListView’s physics.</p><pre>// Use the physics provided by ChatScrollObserver<br>ScrollPhysics _physics = ChatObserverClampingScrollPhysics(<br>  observer: state.keepPositionObserver,<br>);<br>// If there was an original physics setting, for example, from a refresh component, you can combine them using applyTo<br>if (physics != null) {<br>  _physics = physics.applyTo(_physics);<br>}<br><br>Widget resultWidget = ListView.separated(<br>  controller: state.scrollController,<br>  // Set physics<br>  physics: _physics,<br>  ...<br>);<br><br>resultWidget = ListViewObserver(<br>  controller: state.observerController,<br>  ...<br>  child: resultWidget,<br>);</pre><p>Adjust the module’s update method.</p><pre>void updateAndKeepPositionForListView([<br>  List&lt;Object&gt;? ids,<br>]) {<br>  () async {<br>    // Force observe the ListView<br>    final result = await state.observerController.dispatchOnceObserve(<br>      isForce: true,<br>      isDependObserveCallback: false,<br>    );<br>    final observeResult = result.observeResult;<br>    if (observeResult == null) return;<br>    final firstChild = observeResult.firstChild;<br>    if (firstChild == null) return;<br>    // Get the index of the first currently visible item<br>    // Note: The modules on the detail page are fixed from the beginning. When there is no data, the view displays a SizedBox.<br>    // Therefore, the module indices never change!!!<br>    final refItemIndex = firstChild.index;<br>    // Call standby to maintain the position<br>    state.keepPositionObserver.standby(<br>      mode: ChatScrollObserverHandleMode.specified,<br>      refItemIndex: refItemIndex,<br>      refItemIndexAfterUpdate: refItemIndex,<br>    );<br>  }();<br><br>  // Original view update logic<br>  update(ids);<br>}</pre><p>Here, we take Module 3 which loads data asynchronously as an example.</p><pre>void loadAsyncData() {<br>  // Simulate data request<br>  await Future.delayed(const Duration(seconds: 2));<br>  ...<br><br>  // Comment out the original update logic<br>  // update([DetailUpdateType.module3]);<br>  // Change to call updateAndKeepPositionForListView<br>  updateAndKeepPositionForListView([DetailUpdateType.module3]);<br><br>  // Check if it is the initial anchor<br>  checkAnchorForListView(DetailModuleType.module3);<br>}</pre><p>Alright, we’re all done!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0TlTzQXhuAVOlzR35KH0-g.gif" /></figure><h3>III. Points to Note</h3><h4>Initial Anchor Failure</h4><p>Note: initialIndexModel is used when jumpTo is executed in the next frame after ListViewObserver’s initState. Therefore, do not build it before the data is requested to avoid the failure of the initial anchor functionality.</p><pre>Widget _buildBody() {<br>  // Data not yet requested<br>  if (state.isRequesting) {<br>    // Return a loading view<br>    return _buildPageLoading();<br>  }<br>  // Data has been requested<br>  return Stack(<br>    children: [<br>      // The ListView wrapped by ListViewObserver<br>      const DetailListView(),<br>      // Top navigation bar<br>      const Positioned(<br>        top: 0,<br>        left: 0,<br>        right: 0,<br>        child: DetailNavBar(),<br>      ),<br>      // A loading indicator to cover the page for a delayed display<br>      _buildLoading(),<br>    ],<br>  );<br>}</pre><h4>View Flickering</h4><p>Regarding _buildLoading in the Stack, because jumpTo occurs in the next frame, you will see a flicker (display then scroll). Therefore, after the data is requested, you can first update the page and then use a delay to remove the loading indicator.</p><pre>bool showLoading = true;<br><br>Widget _buildLoading() {<br>  return GetBuilder&lt;DetailLogic&gt;(<br>    tag: logicTag,<br>    id: DetailUpdateType.loading,<br>    builder: (_) {<br>      if (!state.showLoading) return const SizedBox.shrink();<br><br>      return Positioned.fill(<br>        child: Container(<br>          color: Colors.white,<br>          child: const CupertinoActivityIndicator(),<br>        ),<br>      );<br>    },<br>  );<br>}</pre><pre>// Data has been requested<br>update();<br><br>// Use a delay to remove the loading indicator<br>await Future.delayed(const Duration(milliseconds: 100));<br>state.showLoading = false;<br>update([DetailUpdateType.loading]);</pre><h4>Limitations of Maintaining Position</h4><p>The main logic is to find the first visible item before updating the module view, use it as a reference object, find it again after the view is updated, and restore its position by comparing the offset.</p><p>Therefore, the referenced item must be rendered both before and after the update! Being rendered is not the same as being visible, as it could be in the cache extent.</p><p>Thus, you need to set an appropriate cacheExtent for your ListView.</p><h3>IV. Conclusion</h3><p>Through the explanation of the above example, I believe you have a clearer understanding of how to use `scrollview_observer`. Open source is not easy, so if you find this library useful, please don’t hesitate to give it a Star 👍 and show your support!</p><p>GitHub: <a href="https://github.com/fluttercandies/flutter_scrollview_observer">https://github.com/fluttercandies/flutter_scrollview_observer</a></p><p>This is the end of this article. Thank you for your support, and see you next time! 👋</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=86aa5b9c4186" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Flutter - Syncing Detail Page TabBar with Modules? Nailed It!]]></title>
            <link>https://medium.com/@linxunfeng/flutter-syncing-detail-page-tabbar-with-modules-nailed-it-60f2ca67e100?source=rss-ec01a09c277------2</link>
            <guid isPermaLink="false">https://medium.com/p/60f2ca67e100</guid>
            <category><![CDATA[modules]]></category>
            <category><![CDATA[listview]]></category>
            <category><![CDATA[details]]></category>
            <category><![CDATA[tab-bar]]></category>
            <category><![CDATA[open-source]]></category>
            <dc:creator><![CDATA[LinXunFeng]]></dc:creator>
            <pubDate>Sun, 07 Sep 2025 07:46:47 GMT</pubDate>
            <atom:updated>2025-09-07T07:46:47.815Z</atom:updated>
            <content:encoded><![CDATA[<h3>I. Introduction</h3><p>As shown in the image, this is a very common feature found on the product detail pages of apps like Taobao, Vipshop, and Pupu.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UrhqA-P7M92eIvslXUBwQA.png" /></figure><p>A simple demo is available online: <a href="https://fluttercandies.github.io/flutter_scrollview_observer/#/detail"><br></a><a href="https://fluttercandies.github.io/flutter_scrollview_observer/#/detail](https://fluttercandies.github.io/flutter_scrollview_observer/#/detail)">https://fluttercandies.github.io/flutter_scrollview_observer/#/detail</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*z1P5lQi2ZY3DxeYpU4isVw.gif" /></figure><p>OK, let’s see how to quickly implement this feature using my open-source library.</p><p><a href="https://github.com/fluttercandies/flutter_scrollview_observer](https://github.com/fluttercandies/flutter_scrollview_observer)">https://github.com/fluttercandies/flutter_scrollview_observer</a></p><h3>II. Structure</h3><p>The page structure is simple. The main body is a ListView, and the DetailNavBar is implemented using a TabBar, which is overlaid on top of the ListView.</p><pre>return Stack(<br>  children: [<br>    const DetailListView(),<br>    const Positioned(<br>      top: 0,<br>      left: 0,<br>      right: 0,<br>      child: DetailNavBar(),<br>    ),<br>  ],<br>);</pre><h3>III. Implementation</h3><p>First, let’s implement the functionality to update the index of the DetailNavBar during scrolling.</p><h4>1. Configure Observation</h4><p>Create two necessary controllers.</p><pre>ScrollController scrollController = ScrollController();<br><br>late ListObserverController observerController = ListObserverController(<br>  controller: scrollController,<br>)<br>    // Do not cache the offset of items<br>    //<br>    // Since my ListView has dynamically loaded modules, the module offsets are not fixed,<br>    // so this is set to false.<br>    // If all modules in your ListView are fixed, it is recommended to set this to true.<br>    // This allows for direct value retrieval for jumping next time, avoiding calculation.<br>    ..cacheJumpIndexOffset = false;</pre><p>Wrap the ListView with ListViewObserver for observation.</p><pre>// ListView (No major changes needed, any implementation works)<br>Widget resultWidget = ListView.separated(<br>  ...<br>);<br><br>// Wrap the ListView with ListViewObserver for observation<br>resultWidget = ListViewObserver(<br>  // observation controller<br>  controller: state.observerController,<br>  // The height of DetailNavBar<br>  dynamicLeadingOffset: () =&gt; state.navBarHeight,<br>  // Observation result callback<br>  onObserve: logic.onObserveForListView,<br>  // Only listen to and process the first-level scroll notification, i.e., notification.depth == 0<br>  scrollNotificationPredicate: defaultScrollNotificationPredicate,<br>  child: resultWidget,<br>);</pre><p>Let’s focus on two parameters here.</p><p>1. <strong><em>dynamicLeadingOffset</em></strong>: This is used to set the offset for calculating the visible area, represented by the green line in the figure. Generally, to determine if a ListView item is the first one, we check if it touches the green line. The larger the value returned by <em>dynamicLeadingOffset</em>, the further down the green line is offset, the smaller the calculated visible area becomes, and the first item changes accordingly.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zmmoeHYrY3ZadsGQ-Sv_3A.png" /></figure><p>Therefore, <em>dynamicLeadingOffset</em> here returns the height of the DetailNavBar, <em>state.navBarHeight</em>, which means the visible area is calculated from below the DetailNavBar to determine the first item.</p><p>2. <strong><em>scrollNotificationPredicate</em></strong>: This is used to determine whether to process scroll notifications. Internally, ListViewObserver listens for scroll notifications to trigger observation. However, in some scenarios, such as when an item contains a carousel, the carousel also emits scroll notifications on each page turn, but its depth is greater than 0. This can be used to determine if the current scroll notification is from the observed ListView. defaultScrollNotificationPredicate is a built-in Flutter method, and its code is as follows:</p><pre>/// A [ScrollNotificationPredicate] that checks whether<br>/// `notification.depth == 0`, which means that the notification<br>/// did not bubble through any intervening scrolling widgets.<br>bool defaultScrollNotificationPredicate(ScrollNotification notification) {<br>  return notification.depth == 0;<br>}</pre><p>To avoid changing the behavior of previous versions, <em>scrollview_observer</em> does not set this as the default value, so it needs to be configured manually.</p><h4>2. Handle Observation Results</h4><p>In the <em>onObserve</em> callback method of ListViewObserver, we can get the observation result. With this result, we can calculate the index that should be set for the current DetailNavBar.</p><p>Here, <em>scrollview_observer</em> has already encapsulated the calculation logic into the <em>ObserverUtils.calcAnchorTabIndex</em> method. You can call it as follows.</p><pre>void onObserveForListView(ListViewObserveModel result) {<br>  final navBarTabController = state.navBarTabController;<br>  if (navBarTabController == null) return;<br><br>  // Calculate the index of the TabBar<br>  final index = ObserverUtils.calcAnchorTabIndex(<br>    observeModel: result,<br>    tabIndexes: state.navBarTabs.map((e) =&gt; e.index).toList(),<br>    currentTabIndex: navBarTabController.index,<br>  );<br>  // Update the index of the TabBar<br>  updateNavBarTabIndex(index);<br>}<br><br>void updateNavBarTabIndex(int index) {<br>  final navBarTabController = state.navBarTabController;<br>  if (navBarTabController == null) return;<br>  navBarTabController.index = index;<br>}</pre><p><strong>Parameter Description</strong></p><ul><li>The ListView has 8 modules, with corresponding indices from 0 to 7.</li><li>The DetailNavBar displays tabs for modules 1, 4, and 7, corresponding to module indices [0, 3, 6].</li></ul><p>The <em>tabIndexes</em> in the <em>calcAnchorTabIndex</em> method above is passed as [0, 3, 6], which then calculates the corresponding [0, 1, 2] for the DetailNavBar.</p><h4>3. Handle Tap to Jump</h4><pre>void handleNavBarTabTap(int index) {<br>  if (!state.scrollController.hasClients) return;<br><br>  final tabModel = state.navBarTabs[index];<br>  final moduleIndex = tabModel.index;<br>  <br>  // First module, jump directly to the top<br>  if (moduleIndex == 0) {<br>    state.scrollController.jumpTo(0);<br>    return;<br>  }<br>  // Other modules<br>  state.observerController.jumpTo(<br>    index: moduleIndex,<br>    offset: (_) =&gt; state.navBarHeight,<br>  );<br>}</pre><p>When tapping to jump to the first module, we know the offset, so we can just use <em>scrollController.jumpTo(0)</em> to avoid unnecessary calculations.</p><p>When tapping to jump to other modules, use <em>observerController.jumpTo</em>. The <em>offset</em> parameter is used to set how much to offset downwards. Here, it returns the height of the DetailNavBar, <em>state.navBarHeight</em>, which means scrolling to the position below the DetailNavBar.</p><h3>IV. Conclusion</h3><p>Through the explanation of the example above, I believe you have a clearer understanding of how to use <em>scrollview_observer</em>. Open source is not easy. If you also find this library useful, please don’t hesitate to give it a Star 👍 and show your support!</p><p>GitHub: <a href="https://github.com/fluttercandies/flutter_scrollview_observer">https://github.com/fluttercandies/flutter_scrollview_observer</a></p><p>This is the end of this article. Thank you for your support, and see you next time! 👋</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=60f2ca67e100" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Flutter — Stiff Animation in chat_bottom_container? Let’s Make It Silky-Smooth This Time]]></title>
            <link>https://medium.com/@linxunfeng/flutter-how-to-customize-animations-in-chat-bottom-container-251b0d97a067?source=rss-ec01a09c277------2</link>
            <guid isPermaLink="false">https://medium.com/p/251b0d97a067</guid>
            <category><![CDATA[open-source]]></category>
            <category><![CDATA[keyboard]]></category>
            <category><![CDATA[animation]]></category>
            <category><![CDATA[chat]]></category>
            <category><![CDATA[github]]></category>
            <dc:creator><![CDATA[LinXunFeng]]></dc:creator>
            <pubDate>Mon, 21 Jul 2025 13:55:03 GMT</pubDate>
            <atom:updated>2025-07-21T14:04:51.457Z</atom:updated>
            <content:encoded><![CDATA[<h3>Flutter - Stiff Animation in chat_bottom_container? Let’s Make It Silky-Smooth This Time</h3><h3>1. Overview</h3><ul><li><a href="https://medium.com/@linxunfeng/flutter-smooth-switching-between-chat-keyboard-and-panel-8b921d5f52a8">Flutter — Smooth switching between chat keyboard and panel</a></li><li><a href="https://medium.com/@linxunfeng/flutter-a-powerful-upgrade-for-smooth-switching-between-chat-keyboard-and-panel-08ebb2f5e57a">Flutter — A powerful upgrade for smooth switching between chat keyboard and panel</a></li></ul><p>It’s been almost a year since the above two articles were published. The latest version at that time was <em>0.2.0</em>, and now, <a href="https://pub.dev/packages/chat_bottom_container"><em>chat_bottom_container</em></a><em> </em>welcomes version <em>0.4.0</em>.</p><p>This update mainly introduces the feature of a custom bottom container, which means the container’s structure can be completely defined externally. So, what can we do with this feature?</p><ul><li>Maintain the state of the panel view</li><li>Implement any animation (this time, if anyone says the animation is stiff, it’s your own problem 😒)</li></ul><h3>2. Demo</h3><p>As usual, here are the demo GIFs to give you a direct impression~</p><p><strong>Fade</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WgCGHhDBO-zA1f3uiD9cUA.gif" /></figure><p><strong>Cube</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mvhQOQkmpxxvGrVvJUq49Q.gif" /></figure><p><strong>Concentric</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LecVT92_md8oX3BcL-PSvA.gif" /></figure><p><strong>Rotation</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-q1jz_ccYrsxMm1WKZE-lw.gif" /></figure><p><strong>ZoomIn</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Om53O1Ez0uhiQGIvfFf7Zg.gif" /></figure><h3>3. Integration</h3><p>Add <a href="https://pub.dev/packages/chat_bottom_container">chat_bottom_container</a> to your pubspec.yaml file:</p><pre>dependencies:<br>  chat_bottom_container: ^0.4.0</pre><p>You can copy the latest version from <a href="http://pub.dev/">pub.dev</a>: <a href="https://pub.dev/packages/chat_bottom_container">https://pub.dev/packages/chat_bottom_container</a></p><p>For Android, you need to add the jitpack repository to your project’s root build.gradle file:</p><pre>allprojects {<br>  repositories {<br>    ...<br>    maven { url &#39;https://jitpack.io&#39; }<br>  }<br>}</pre><h3>4. Usage</h3><p>The page structure is as follows:</p><pre>return Scaffold(<br>  resizeToAvoidBottomInset: false,<br>  appBar: _buildAppBar(),<br>  body: const Column(<br>    mainAxisAlignment: MainAxisAlignment.center,<br>    children: [<br>      // List<br>      Expanded(child: ChatAnimationListView()),<br>      // Function bar (input field, emoji button, tool button, etc.)<br>      ChatAnimationPanelBar(),<br>      // Bottom container<br>      ChatAnimationPanelContainer(),<br>    ],<br>  ),<br>);</pre><p>Here, we mainly focus on the bottom container <em>ChatAnimationPanelContainer</em>.</p><p>The corresponding panel type enum:</p><pre>enum ChatAnimationPanelType {<br>  none,<br>  keyboard,<br>  emoji,<br>  tool,<br>}</pre><p>The implementation of the bottom container:</p><pre>ChatBottomPanelContainer&lt;ChatAnimationPanelType&gt;(<br>  // ChatBottomPanelContainerController (required)<br>  controller: state.controller,<br>  // FocusNode (required)<br>  inputFocusNode: state.inputFocusNode,<br>  // Panel type change callback (implement as needed, mainly to record the current panel type)<br>  onPanelTypeChange: logic.onPanelTypeChange,<br>  // Custom container callback<br>  customPanelContainer: (panelType, data) {<br>    if (!mounted) return const SizedBox.shrink();<br><br>    Widget? container = state.customPanelContainer;<br>    if (container != null) {<br>      // Already created, refresh the custom container. You can refresh only the child widgets inside the custom container as needed.<br>      logic.update([<br>        ChatAnimationUpdateType.customPanelContainer,<br>      ]);<br>      return container;<br>    }<br>    // Not created, so create it<br>    container = const ChatAnimationFadePanelContainer();<br>    // Record it<br>    state.customPanelContainer = container;<br>    return container;<br>  },<br>);</pre><p>Here, we take <em>Fade</em> from the demo GIFs as an example, which is <em>ChatAnimationFadePanelContainer</em>. It mainly uses the <em>animated_size_and_fade</em> third-party packageto implement the switching animation.</p><pre>// ChatAnimationFadePanelContainer<br><br>@override<br>Widget build(BuildContext context) {<br>  return GetBuilder&lt;ChatAnimationLogic&gt;(<br>    tag: logicTag,<br>    id: ChatAnimationUpdateType.customPanelContainer,<br>    builder: (_) {<br>      if (!mounted) return const SizedBox.shrink();<br>      // Build the view for the corresponding type<br>      // e.g., regular safe area, keyboard placeholder view, emoji panel, tool panel, etc.<br>      Widget resultWidget = logic.buildPanelWidget(<br>        state.currentPanelType,<br>        useKeyboardHeight: false,<br>      );<br>      // Wrap with AnimatedSizeAndFade to implement the switching animation<br>      resultWidget = AnimatedSizeAndFade(<br>        fadeDuration: const Duration(milliseconds: 500),<br>        sizeDuration: const Duration(milliseconds: 300),<br>        child: resultWidget,<br>      );<br>      return resultWidget;<br>    },<br>  );<br>}</pre><p>So far, the general usage of implementing a custom container via <em>customPanelContainer</em> has been demonstrated.</p><p>However, I believe the smart you will ask: do I have to customize it completely? Can I keep some views implemented by <a href="https://pub.dev/packages/chat_bottom_container"><em>chat_bottom_container</em></a> for me? For example, the regular safe area and the keyboard placeholder view.</p><p>Of course, you can. Next, let’s talk about some details.</p><h3>5. Details</h3><h4>Building Built-in Panels</h4><pre>enum ChatBottomPanelType {<br>  // Regular safe area<br>  none,<br>  // Keyboard placeholder view<br>  keyboard,<br>  // Other panels (Emoji, Tool)<br>  other,<br>}<br><br>Widget? buildInPanel(ChatBottomPanelType panelType) {<br>  switch (panelType) {<br>    case ChatBottomPanelType.none:<br>      return _state?.buildSafeArea.call();<br>    case ChatBottomPanelType.keyboard:<br>      return _state?.buildKeyboardPlaceholderPanel.call();<br>    case ChatBottomPanelType.other:<br>      return _state?.buildOtherPanel.call();<br>  }<br>}</pre><p>By calling the <em>buildInPanel</em> method of <em>ChatBottomPanelContainerController</em> and passing <em>.none</em> or <em>.keyboard</em>, you can get the corresponding built-in panel view. Passing <em>.other</em> gets the view returned by the external <em>otherPanelWidget</em> callback, which is <em>null</em> if not implemented.</p><p>Here is the sample code for building the view of the corresponding type:</p><pre>Widget buildPanelWidget(<br>  ChatAnimationPanelType type,<br>  ...<br>) {<br>  final panelController = state.controller;<br><br>  ...<br>  Widget resultWidget;<br>  switch (type) {<br>    case ChatAnimationPanelType.none:<br>      // Regular safe area<br>      resultWidget = panelController.buildInPanel(ChatBottomPanelType.none) ??<br>          const SizedBox();<br>      ...<br>      break;<br>    case ChatAnimationPanelType.keyboard:<br>      // Keyboard placeholder view<br>      resultWidget = panelController.buildInPanel(ChatBottomPanelType.keyboard) ??<br>          const SizedBox.shrink();<br>      ...<br>      break;<br>    case ChatAnimationPanelType.emoji:<br>      // Emoji panel<br>      resultWidget = ChatAnimationEmojiPanel(<br>        ...<br>      );<br>      break;<br>    case ChatAnimationPanelType.tool:<br>      // Tool panel<br>      resultWidget = ChatAnimationToolPanel(<br>        ...<br>      );<br>      break;<br>  }<br>  ...<br><br>  // Set the key, which is very important for AnimatedSwitcher<br>  resultWidget = SizedBox(<br>    key: ValueKey(&#39;$type&#39;),<br>    width: double.infinity,<br>    child: resultWidget,<br>  );<br><br>  return resultWidget;<br>}</pre><h4>AnimatedSwitcher</h4><p>If you use <em>AnimatedSwitcher</em> to implement panel switching animations, it is recommended that you set a key (usually <em>ValueKey</em>) for each panel, as shown in the code above. This is to prevent <em>AnimatedSwitcher</em> from thinking that the panels before and after the switch are the same, which would cause the animation to fail.</p><h4>Maintaining Panel View State</h4><p>Whether the panel’s state can be maintained actually depends on your layout implementation. For example, you can use <em>IndexedStack</em>. If you want to maintain the state while having animations, you can find a corresponding animation library, such as <em>transitioned_indexed_stack</em> used in the example.</p><h3>6. Finally</h3><p>Alright, the above is the update content of this package. If you have other useful animation packages, feel free to leave a comment and share with everyone 🫶</p><p>As usual, here is the GitHub address: <a href="https://github.com/LinXunFeng/flutter_chat_packages/tree/main/packages/chat_bottom_container">https://github.com/LinXunFeng/flutter_chat_packages/tree/main/packages/chat_bottom_container</a>. If you have any problems with integration, you can check the <em>Example</em> code in the link.</p><p>Open source is not easy. If you also find this library useful, please don’t hesitate to give it a Star 👍 and support it!</p><p>This is the end of this article. Thank you for your support, and see you next time! 👋</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=251b0d97a067" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Flutter - Parallax effect in PageView]]></title>
            <link>https://medium.com/@linxunfeng/flutter-parallax-effect-in-pageview-ccff6b0b34aa?source=rss-ec01a09c277------2</link>
            <guid isPermaLink="false">https://medium.com/p/ccff6b0b34aa</guid>
            <category><![CDATA[flutter-pageview]]></category>
            <category><![CDATA[parallax]]></category>
            <category><![CDATA[open-source]]></category>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[github]]></category>
            <dc:creator><![CDATA[LinXunFeng]]></dc:creator>
            <pubDate>Sun, 10 Nov 2024 12:47:39 GMT</pubDate>
            <atom:updated>2024-11-10T12:52:21.718Z</atom:updated>
            <content:encoded><![CDATA[<iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FjZTOhGW83Pg%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DjZTOhGW83Pg&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FjZTOhGW83Pg%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/eed424fc9c76028bad30f6df6d4b26de/href">https://medium.com/media/eed424fc9c76028bad30f6df6d4b26de/href</a></iframe><h3>Overview</h3><p>In the previous article <a href="https://medium.com/@linxunfeng/flutter-offset-effect-in-pageview-cec39572d56a">Flutter - Offset effect in PageView</a>, the specific steps required to observe PageView have been explained in detail. Today, based on this, we will continue to implement a cool parallax effect, as shown in the figure below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*y8egIjgfKbtjUKlW.gif" /></figure><h3>Implementation</h3><h4>The basic page</h4><pre>late PageController pageController;<br><br>/// Image Data<br>List&lt;String&gt; pageItemBgPicList = [<br>  &#39;xxxxxx&#39;,<br>  ...<br>];<br><br>int get pageItemCount =&gt; pageItemBgPicList.length;<br><br>@override<br>void initState() {<br>  super.initState();<br>  <br>  pageController = PageController(<br>    // Initialize the page index.<br>    initialPage: 4,<br>    // The fraction of the viewport that each page should occupy.<br>    viewportFraction: 0.9,<br>  );<br>}</pre><p>Build PageView</p><pre>Widget _buildPageView() {<br>  Widget resultWidget = PageView.builder(<br>    controller: pageController,<br>    itemBuilder: (context, index) {<br>      return _buildPageItem(index);<br>    },<br>    itemCount: pageItemCount,<br>  );<br>  <br>  ...<br>  return resultWidget;<br>}</pre><p>Build item</p><pre>Widget _buildPageItem(int index) {<br>  Widget resultWidget = Stack(<br>    alignment: AlignmentDirectional.center,<br>    children: [<br>      Positioned(<br>        left: 0,<br>        right: 0,<br>        top: 0,<br>        bottom: 0,<br>        child: _buildPageItemBgPicView(index),<br>      ),<br>      const SizedBox.expand(),<br>      _buildNum(index),<br>    ],<br>  );<br>  resultWidget = Container(<br>    margin: const EdgeInsets.symmetric(horizontal: 8),<br>    clipBehavior: Clip.antiAlias,<br>    decoration: BoxDecoration(<br>      color: Colors.blue[50],<br>      borderRadius: BorderRadius.circular(10),<br>    ),<br>    child: resultWidget,<br>  );<br>  return resultWidget;<br>}<br><br>// Background image<br>Widget _buildPageItemBgPicView(int index) {<br>  return Image.network(<br>    pageItemBgPicList[index],<br>    fit: BoxFit.cover,<br>  );<br>}</pre><h4>Implementation analysis</h4><pre>Widget _buildPageItemBgPicView(int index) {<br>  return Image.network(<br>    pageItemBgPicList[index],<br>    fit: BoxFit.cover,<br>    // x and y are both centered<br>    alignment: Alignment(0, 0),<br>    // x aligns left, y aligns center<br>    // alignment: Alignment(-1, 0),<br>    // x aligns right, y aligns center<br>    // alignment: Alignment(1, 0),<br>  );<br>);</pre><p>The above _buildPageItemBgPicView simply displays the picture. The fit is BoxFit.cover . Its function is to enlarge the picture in equal proportions and then fill the entire container.</p><p>Here is a comparison of various filling modes:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/606/1*W0Z9rK3viTHOoawydq3yOw.png" /></figure><p>Next let’s talk about alignment , because it is the key to achieving the parallax effect.</p><p>The alignment is used to define the alignment within the boundary. The constructor is Alignment(this.x, this.y) , and the value range of x and y is [-1, 1] .</p><p>For example:</p><ul><li>When the value is (-1.0, -1.0) , the image will be aligned to the upper left corner of its layout bounds.</li><li>When the value is (1.0, 1.0) , the image will be aligned to the lower right corner of its layout bounds.</li></ul><p>However, this article only needs to use x , as shown in the following figure as an example.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*6_bneE7_EYsvikdG.jpeg" /></figure><p><strong>left_center</strong></p><ul><li>Alignment(-1, 0)</li><li>Align the image to the left</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*DirvaYDajgwhPZcM.png" /></figure><p><strong>center</strong></p><ul><li>Alignment(0, 0)</li><li>Align the image to the center</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*FMOw-cYu4eM6SCwL.png" /></figure><p><strong>right_center</strong></p><ul><li>Alignment(1, 0)</li><li>Align the image to the right</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*brjDPc17ZLPdtBOA.png" /></figure><p>Here we take the center as an example:</p><ul><li>The view with the white border in the middle is item.</li><li>The blurred effect on both sides is the invisible area of ​​the image on item.</li></ul><p>Here again the parallax effect are attached for easy understanding.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Bz1vDICk5Ikz186P.gif" /></figure><ul><li>At the beginning, Page4 is on the far right. At this time, alignment is Alignment(-1, 0) , and the picture shows the content on the far left ( left_center )</li><li>In the process of slowly moving into the middle and fully displaying it, alignment.x keeps increasing until it is 0 , that is Alignment(0, 0) , and the picture shows the content in the middle ( center )</li><li>Then continue to slowly move out to the left, and its alignment.x continues to increase until it is 1 , that is Alignment(1, 0) . The picture shows the rightmost content ( right_center )</li></ul><p>So the implementation of parallax is very simple, which is to continuously adjust alignment.x , with the range being [-1, 1] . So how to calculate this value during the sliding process?</p><p>The <a href="https://github.com/fluttercandies/flutter_scrollview_observer">scrollview_observer</a> I wrote is used here again: <a href="https://github.com/fluttercandies/flutter_scrollview_observer">https://github.com/fluttercandies/flutter_scrollview_observer</a></p><p>Observe PageView</p><p>Let’s adjust item first</p><pre>// Image data<br>List&lt;String&gt; pageItemBgPicList = [<br>  &#39;xxxxxx&#39;,<br>  ...<br>];<br><br>int get pageItemCount =&gt; pageItemBgPicList.length;<br><br>/// Stores the alignment.x of each item<br>List&lt;ValueNotifier&lt;double&gt;&gt; pageItemBgPicAlignmentXList = [];<br><br>@override<br>void initState() {<br>  super.initState();<br><br>  ...<br>  // Create a corresponding number of ValueNotifier&lt;double&gt; according<br>  // to the number of items<br>  pageItemBgPicAlignmentXList = List.generate(<br>    pageItemCount,<br>    (index) {<br>      return ValueNotifier&lt;double&gt;(0);<br>    },<br>  );<br>  ...<br>}</pre><pre>Widget _buildPageItemBgPicView(int index) {<br>  // Use ValueListenableBuilder to listen to the alignment.x of the<br>  // corresponding index and refresh the widget.<br>  return ValueListenableBuilder(<br>    valueListenable: pageItemBgPicAlignmentXList[index],<br>    builder: (BuildContext context, double alignmentX, Widget? child) {<br>      return Image.network(<br>        pageItemBgPicList[index],<br>        fit: BoxFit.cover,<br>        alignment: Alignment(alignmentX, 0),<br>      );<br>    },<br>  );<br>}</pre><p>The next step is to observe PageView . The usage is very simple:</p><ol><li>Use ListViewObserver to wrap PageView .</li><li>Set triggerOnObserveType to .directly , so that directly return the obtained observation data without displaying item changes and comparing them.</li><li>In the observation result callback onObserve , take out the relevant data (index, displayPercentage, etc.) of item for calculation.</li></ol><pre>final observerController = ListObserverController();<br><br>Widget _buildPageView() {<br>  Widget resultWidget = PageView.builder(<br>    ...<br>  );<br>  resultWidget = ListViewObserver(<br>    controller: observerController,<br>    child: resultWidget,<br>    triggerOnObserveType: ObserverTriggerOnObserveType.directly,<br>    onObserve: (resultModel) {<br>      final displayingChildModelList = resultModel.displayingChildModelList;<br>      for (var itemModel in displayingChildModelList) {<br>        // Take out the index of item<br>        final itemIndex = itemModel.index;<br>        // Take out the displayPercentage of item<br>        final itemDisplayPercentage = itemModel.displayPercentage;<br><br>        // Calculate unsigned alignment.x<br>        double itemAlignmentX = 1 - itemDisplayPercentage;<br>        <br>        // Calculate signed alignment.x<br>        if (itemModel.leadingMarginToViewport &gt; 0) {<br>          itemAlignmentX = -itemAlignmentX;<br>        }<br>        <br>        // Determine the value range<br>        if (itemAlignmentX &gt; 1) {<br>          itemAlignmentX = 1;<br>        } else if (itemAlignmentX &lt; -1) {<br>          itemAlignmentX = -1;<br>        }<br>        <br>        // Assign value<br>        pageItemBgPicAlignmentXList[itemIndex].value = itemAlignmentX;<br>      }<br>    },<br>    customTargetRenderSliverType: (renderObj) {<br>      return renderObj is RenderSliverFillViewport;<br>    },<br>  );<br><br>  ...<br>  return resultWidget;<br>}</pre><p><strong>About the calculation of unsigned </strong><strong>alignment.x</strong></p><ol><li>Whether it is sliding from the left to the middle or from the right to the middle, displayPercentage of item is 0 -&gt; 1 .</li><li>The corresponding alignment.x is 1 -&gt; 0 or -1 -&gt; 0 , and after removing the symbol is 1 -&gt; 0 too.</li></ol><p>So here subtract itemDisplayPercentage from 1 to get unsigned alignment.x .</p><p>The next question is, when alignment.x == 1 , how do you know whether item slides out from the left or the right?</p><p><strong>About the calculation of </strong><strong>alignment.x symbol</strong></p><p>With <a href="https://github.com/fluttercandies/flutter_scrollview_observer">scrollview_observer</a> , everything becomes very simple again. Here we have to mention two very useful properties in the observation result.</p><ul><li>leadingMarginToViewport : The distance between item and the top of the viewport.</li><li>trailingMarginToViewport : The distance between item the tail of the viewport.</li></ul><p>Here we only need to use one of them, for example, using leadingMarginToViewport . When the top left side of item touches the viewport of PageView , its value is 0 . If it continues to move out to the left, the value will become a negative number. If we move it to the right, and the value will be a positive number, as shown in the figure below.</p><p><strong>Slide out left</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/972/0*zJhXxhq2eEdgIkOK.png" /></figure><ul><li>Alignment(1, 0)</li><li>leadingMarginToViewport: -300</li></ul><p>Full display</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/637/0*9DsGxTGRMQPuhL8B.png" /></figure><ul><li>Alignment(0, 0)</li><li>leadingMarginToViewport: 0</li></ul><p><strong>Slide out right</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/972/0*hYAfMiG4x_pwq6nK.png" /></figure><ul><li>Alignment(-1, 0)</li><li>leadingMarginToViewport: 375</li></ul><p>Obviously, when leadingMarginToViewport &gt; 0 , alignment.x &lt; 0 , that is, the alignment.x symbol is calculated as follows:</p><pre>if (itemModel.leadingMarginToViewport &gt; 0) {<br>  itemAlignmentX = -itemAlignmentX;<br>}</pre><p>Okay, we are done.</p><p>Complete code link: <a href="https://github.com/fluttercandies/flutter_scrollview_observer/blob/main/example/lib/features/pageview/pageview_demo/pageview_parallax_page.dart">https://github.com/fluttercandies/flutter_scrollview_observer/blob/main/example/lib/features/pageview/pageview_demo/pageview_parallax_page.dart</a></p><h3>Finally</h3><p>Through the explanation of the above example, I believe you will have a clearer understanding of the use of <a href="https://github.com/fluttercandies/flutter_scrollview_observer">scrollview_observer</a>. If you also find this package useful, please give it a star 👍</p><p>GitHub: <a href="https://github.com/fluttercandies/flutter_scrollview_observer">https://github.com/fluttercandies/flutter_scrollview_observer</a></p><p>Author: <a href="https://github.com/LinXunFeng">https://github.com/LinXunFeng</a></p><h3>Series</h3><ul><li><a href="https://medium.com/@linxunfeng/flutter-gets-the-items-information-those-are-currently-displaying-in-scrollview-6cb4f27f2536">Flutter — Getting the items information those are currently displaying in ScrollView</a></li><li><a href="https://medium.com/@linxunfeng/flutter-scrolling-to-a-specific-item-in-the-scrollview-b89d3f10eee0">Flutter — Scrolling to a specific item in the ScrollView！🔥</a></li><li><a href="https://medium.com/@linxunfeng/flutter-quickly-implement-the-effect-of-the-chat-session-list-perfect-68c8acea4568">Flutter — Quickly implement the effect of the chat session list, perfect 💯</a></li><li><a href="https://medium.com/@linxunfeng/flutter-new-upgrade-supports-observing-scrollview-built-by-third-package-2e5af3d84c64">Flutter — New upgrade😱Supports observing ScrollView built by third package💪</a></li><li><a href="https://medium.com/@linxunfeng/flutter-play-alternately-waterfall-flow-video-015279bc8e14">Flutter — Play alternately waterfall flow video 🎞</a></li><li><a href="https://medium.com/@linxunfeng/flutter-keep-im-message-position-greatly-upgraded-supports-generative-messages-like-chatgpt-2b199a7b14e7">Flutter — Keep IM message position greatly upgraded (supports generative messages like ChatGPT) 🤖</a></li><li><a href="https://medium.com/@linxunfeng/flutter-anti-occlusion-of-form-in-scrollview-ad8bde15e18d">Flutter — Anti-occlusion of form in ScrollView 🗒</a></li><li><a href="https://medium.com/@linxunfeng/flutter-quickly-achieve-half-view-exposure-statistic-097fd4b237ef">Flutter — Quickly achieve half-view exposure statistic 📊</a></li><li><a href="https://medium.com/@linxunfeng/flutter-how-to-quickly-implement-an-contact-list-page-azlist-829bbef12d8f">Flutter — How to quickly implement an contact list page (azlist) 📓</a></li><li><a href="https://medium.com/@linxunfeng/flutter-supports-observing-nestedscrollview-with-greater-compatibility-86f49dce7955">Flutter — Supports observing NestedScrollView, with greater compatibility 😈</a></li><li><a href="https://medium.com/@linxunfeng/flutter-offset-effect-in-pageview-cec39572d56a">Flutter — Offset effect in PageView</a></li><li><a href="https://medium.com/@linxunfeng/flutter-parallax-effect-in-pageview-ccff6b0b34aa">Flutter — Parallax effect in PageView</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ccff6b0b34aa" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Flutter - Offset effect in PageView]]></title>
            <link>https://medium.com/@linxunfeng/flutter-offset-effect-in-pageview-cec39572d56a?source=rss-ec01a09c277------2</link>
            <guid isPermaLink="false">https://medium.com/p/cec39572d56a</guid>
            <category><![CDATA[github]]></category>
            <category><![CDATA[effect]]></category>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[flutter-pageview]]></category>
            <category><![CDATA[open-source]]></category>
            <dc:creator><![CDATA[LinXunFeng]]></dc:creator>
            <pubDate>Sat, 09 Nov 2024 02:48:52 GMT</pubDate>
            <atom:updated>2024-11-09T02:54:53.866Z</atom:updated>
            <content:encoded><![CDATA[<iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FTk943QC1vVM%3Fstart%3D27%26feature%3Doembed%26start%3D27&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DTk943QC1vVM&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FTk943QC1vVM%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/8ff63cf6c1119257d95e9085cf750f3b/href">https://medium.com/media/8ff63cf6c1119257d95e9085cf750f3b/href</a></iframe><h3>Overview</h3><p>When you click on a pin on the map, the corresponding PageView needs to be displayed at the bottom of the page. You can also switch its cards left and right, and the current card needs to be stand out during the switching process, as shown below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*qHW1_b0QvUkt_37m.gif" /></figure><p>Next, let’s talk about the specific implementation.</p><h3>Implementation</h3><h4>The basic page</h4><pre>late PageController pageController;<br><br>/// The number of items.<br>int pageItemCount = 10;<br><br>@override<br>void initState() {<br>  super.initState();<br>  pageController = PageController(<br>    // Initialize the page index.<br>    initialPage: 4,<br>    // The fraction of the viewport that each page should occupy.<br>    viewportFraction: 0.9,<br>  );<br>}<br><br>@override<br>Widget build(BuildContext context) {<br>  return Scaffold(<br>    appBar: AppBar(<br>      title: const Text(&quot;PageView&quot;),<br>    ),<br>    body: Stack(<br>      children: [<br>        // The map view<br>        _buildMap(),<br>        // The bottom PageView<br>        Positioned(<br>          left: 0,<br>          right: 0,<br>          bottom: 0,<br>          child: _buildPageView(),<br>        ),<br>      ],<br>    ),<br>  );<br>}</pre><p>The specific code of the PageView at the bottom is as follows:</p><pre>Widget _buildPageView() {<br>  Widget resultWidget = PageView.builder(<br>    controller: pageController,<br>    itemBuilder: (context, index) {<br>      // Build the item<br>      Widget resultWidget = Container(<br>        decoration: BoxDecoration(<br>          color: Colors.blue[100],<br>          borderRadius: BorderRadius.circular(4),<br>        ),<br>        alignment: Alignment.center,<br>        child: Text(&quot;Page $index&quot;),<br>      );<br>      // Set the left and right margins of the item<br>      resultWidget = Container(<br>        margin: const EdgeInsets.symmetric(horizontal: 8),<br>        child: resultWidget,<br>      );<br>      return resultWidget;<br>    },<br>    itemCount: pageItemCount,<br>  );<br>  // Fixed height<br>  resultWidget = SizedBox(<br>    height: 300,<br>    child: resultWidget,<br>  );<br>  return resultWidget;<br>}</pre><p>The above widget layout is very simple for everyone, just take a look at it. The next step is how to achieve this offset effect.</p><h4>Observe PageView</h4><p>What is used here is <a href="https://github.com/fluttercandies/flutter_scrollview_observer">scrollview_observer</a> I wrote.</p><p>Usage is very simple:</p><ol><li>Use ListViewObserver to wrap PageView .</li><li>Set triggerOnObserveType to .directly , so that directly return the obtained observation data without displaying item changes and comparing them.</li><li>In the observation result callback onObserve , take out the relevant data (index, displayPercentage, etc.) of item for calculation.</li></ol><pre>final observerController = ListObserverController();<br><br>Widget _buildPageView() {<br>  Widget resultWidget = PageView.builder(<br>    ...<br>  );<br><br>  // Use ListViewObserver to wrap PageView<br>  resultWidget = ListViewObserver(<br>    controller: observerController,<br>    child: resultWidget,<br>    // Directly return the obtained observation data<br>    triggerOnObserveType: ObserverTriggerOnObserveType.directly,<br>    // Handle the observation result<br>    onObserve: (resultModel) {<br>      final displayingChildModelList = resultModel.displayingChildModelList;<br>      for (var itemModel in displayingChildModelList) {<br>        // Take out the index of item<br>        final itemIndex = itemModel.index;<br>        // Take out the displayPercentage of item<br>        final itemDisplayPercentage = itemModel.displayPercentage;<br>        // Calculate offset<br>        final offsetY = (1 - itemDisplayPercentage) * offsetYDelta;<br>        pageItemOffsetYList[itemIndex].value = offsetY;<br>      }<br>    },<br>    // Specify the RenderSliver to observe<br>    customTargetRenderSliverType: (renderObj) {<br>      return renderObj is RenderSliverFillViewport;<br>    },<br>  );<br>  <br>  ...<br>  return resultWidget;<br>}</pre><blockquote>triggerOnObserveType and customTargetRenderSliverType are described in detail in the previous article <a href="https://medium.com/@linxunfeng/flutter-new-upgrade-supports-observing-scrollview-built-by-third-package-2e5af3d84c64">Flutter — New upgrade😱Supports observing ScrollView built by third package💪</a>, so they will not be repeated here.</blockquote><p>An important note here is that ListViewObserver observe ListView and SliverList by default, but it does not mean that it can only observe them. As long as the internal tree structure is consistent, it can be observed. If the structure is consistent but RenderSliver is not SliverList, you can specify the corresponding RenderSliver type through customTargetRenderSliverType, such as PageView here, the RenderSliver type is RenderSliverFillViewport .</p><p>Attached here are screenshots of the tree structures of PageView and ListView . Look at Widget Details Tree, you should be able to feel what structural consistency means.</p><ul><li>PageView</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*a_iU0PG_znQgj5NR.png" /></figure><ul><li>ListView</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*vAiRj3eZDIQSzhpR.png" /></figure><h4>Offset effect</h4><pre>// The maximum offset of an item<br>double offsetYDelta = 50;<br>// Record the offset of the item<br>List&lt;ValueNotifier&lt;double&gt;&gt; pageItemOffsetYList = [];<br><br>@override<br>void initState() {<br>  super.initState();<br>  ...<br>  // Initialization<br>  pageItemOffsetYList = List.generate(<br>    pageItemCount,<br>    (index) {<br>      return ValueNotifier&lt;double&gt;(0);<br>    },<br>  );<br>  <br>  // Delay 100ms to trigger an observation<br>  Future.delayed(const Duration(milliseconds: 100)).then((_) {<br>    observerController.dispatchOnceObserve();<br>  });<br>}<br><br>Widget _buildPageView() {<br>  Widget resultWidget = PageView.builder(<br>    controller: pageController,<br>    itemBuilder: (context, index) {<br>      Widget itemWidget = Container(<br>        ...<br>      );<br>      <br>      // Only refresh item<br>      Widget resultWidget = ValueListenableBuilder(<br>        valueListenable: pageItemOffsetYList[index],<br>        builder: (BuildContext context, double offsetY, Widget? child) {<br>          // The offset changes<br>          return Transform.translate(<br>            offset: Offset(0, offsetY),<br>            child: itemWidget,<br>          );<br>        },<br>      );<br>      <br>      resultWidget = Container(<br>        ...<br>      );<br>      return resultWidget;<br>    },<br>    itemCount: pageItemCount,<br>  );<br><br>  resultWidget = ListViewObserver(<br>    ...<br>    onObserve: (resultModel) {<br>      final displayingChildModelList = resultModel.displayingChildModelList;<br>      for (var itemModel in displayingChildModelList) {<br>        // Take out the index of item<br>        final itemIndex = itemModel.index;<br>        // Take out the displayPercentage of item<br>        final itemDisplayPercentage = itemModel.displayPercentage;<br>        // Calculate offsetY of item<br>        //<br>        // The interval relationship between the item&#39;s displayPercentage<br>        // and offset is as follows<br>        // <br>        // * displayPercentage: [0, 1]<br>        // * offsetY: [50, 0]<br>        final offsetY = (1 - itemDisplayPercentage) * offsetYDelta;<br>        // Update the offsetY of the current item<br>        pageItemOffsetYList[itemIndex].value = offsetY;<br>      }<br>    },<br>    ...<br>  );<br>  <br>  resultWidget = SizedBox(<br>    height: 300,<br>    child: resultWidget,<br>  );<br>  return resultWidget;<br>}</pre><p>Key variable</p><ul><li>offsetYDelta : the maximum offsetY of item, here is 50 .</li><li>pageItemOffsetYList : it records the current offsetY of each item.</li></ul><p>Update item offset</p><ul><li>Combine pageItemOffsetYList and ValueListenableBuilder to partially refresh item.</li><li>Calculate the offsetY of item in onObserve and update the corresponding value with index in pageItemOffsetYList .</li><li>The item &#39;s displayPercentage ( [0, 1] ) is inversely proportional to the offsetY ( [50, 0] ), so the offsetY equals (1 - itemDisplayPercentage) * offsetYDelta.</li></ul><h3>Finally</h3><p>Through the explanation of the above example, I believe you will have a clearer understanding of the use of <a href="https://github.com/fluttercandies/flutter_scrollview_observer">scrollview_observer</a>. If you also find this package useful, please give it a star 👍</p><p>GitHub: <a href="https://github.com/fluttercandies/flutter_scrollview_observer">https://github.com/fluttercandies/flutter_scrollview_observer</a></p><p>Author: <a href="https://github.com/LinXunFeng">https://github.com/LinXunFeng</a></p><h3>Series</h3><ul><li><a href="https://medium.com/@linxunfeng/flutter-gets-the-items-information-those-are-currently-displaying-in-scrollview-6cb4f27f2536">Flutter — Getting the items information those are currently displaying in ScrollView</a></li><li><a href="https://medium.com/@linxunfeng/flutter-scrolling-to-a-specific-item-in-the-scrollview-b89d3f10eee0">Flutter — Scrolling to a specific item in the ScrollView！🔥</a></li><li><a href="https://medium.com/@linxunfeng/flutter-quickly-implement-the-effect-of-the-chat-session-list-perfect-68c8acea4568">Flutter — Quickly implement the effect of the chat session list, perfect 💯</a></li><li><a href="https://medium.com/@linxunfeng/flutter-new-upgrade-supports-observing-scrollview-built-by-third-package-2e5af3d84c64">Flutter — New upgrade😱Supports observing ScrollView built by third package💪</a></li><li><a href="https://medium.com/@linxunfeng/flutter-play-alternately-waterfall-flow-video-015279bc8e14">Flutter — Play alternately waterfall flow video 🎞</a></li><li><a href="https://medium.com/@linxunfeng/flutter-keep-im-message-position-greatly-upgraded-supports-generative-messages-like-chatgpt-2b199a7b14e7">Flutter — Keep IM message position greatly upgraded (supports generative messages like ChatGPT) 🤖</a></li><li><a href="https://medium.com/@linxunfeng/flutter-anti-occlusion-of-form-in-scrollview-ad8bde15e18d">Flutter — Anti-occlusion of form in ScrollView 🗒</a></li><li><a href="https://medium.com/@linxunfeng/flutter-quickly-achieve-half-view-exposure-statistic-097fd4b237ef">Flutter — Quickly achieve half-view exposure statistic 📊</a></li><li><a href="https://medium.com/@linxunfeng/flutter-how-to-quickly-implement-an-contact-list-page-azlist-829bbef12d8f">Flutter — How to quickly implement an contact list page (azlist) 📓</a></li><li><a href="https://medium.com/@linxunfeng/flutter-supports-observing-nestedscrollview-with-greater-compatibility-86f49dce7955">Flutter — Supports observing NestedScrollView, with greater compatibility 😈</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cec39572d56a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Flutter - A powerful upgrade for smooth switching between chat keyboard and panel]]></title>
            <link>https://medium.com/@linxunfeng/flutter-a-powerful-upgrade-for-smooth-switching-between-chat-keyboard-and-panel-08ebb2f5e57a?source=rss-ec01a09c277------2</link>
            <guid isPermaLink="false">https://medium.com/p/08ebb2f5e57a</guid>
            <category><![CDATA[chat]]></category>
            <category><![CDATA[panel]]></category>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[emoji]]></category>
            <category><![CDATA[keyboard]]></category>
            <dc:creator><![CDATA[LinXunFeng]]></dc:creator>
            <pubDate>Tue, 20 Aug 2024 15:25:10 GMT</pubDate>
            <atom:updated>2024-08-20T15:25:10.006Z</atom:updated>
            <content:encoded><![CDATA[<iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2F6bYr3ryvtpk%3Fstart%3D15%26feature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D6bYr3ryvtpk&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2F6bYr3ryvtpk%2Fhqdefault.jpg&amp;key=d04bfffea46d4aeda930ec88cc64b87c&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/a45531a59ba1fe0fe28c1df09eb5bdf6/href">https://medium.com/media/a45531a59ba1fe0fe28c1df09eb5bdf6/href</a></iframe><h3>Overview</h3><p>It has been more than one month since the first available version of <a href="https://github.com/LinXunFeng/flutter_chat_packages/tree/main/packages/chat_bottom_container">chat_bottom_container</a> ( 0.0.2 ) was released. During this period, we have also made some optimizations and adjustments based on everyone&#39;s feedback. Today we will take stock of what optimizations we have made. What new functions have been added, and list some common operations.</p><p>Please note</p><ul><li>This article only introduces the updated optimizations and functions. For basic usage, please check: <a href="https://medium.com/@linxunfeng/flutter-smooth-switching-between-chat-keyboard-and-panel-8b921d5f52a8">Flutter - Smooth switching between chat keyboard and panel</a></li><li>As of the time of publication of this article, the latest version is 0.2.0 . You can follow me to get the latest information. ❤️</li></ul><blockquote>Open source is not easy. If you think this package is useful, please give it a Star 👍 and support it!</blockquote><blockquote><a href="https://github.com/LinXunFeng/flutter_chat_packages">https://github.com/LinXunFeng/flutter_chat_packages</a></blockquote><h3>Usage</h3><h4>Adjust keyboard height listener management logic</h4><p>Before version 0.1.0 , only the normal situation (page stack) was considered. When the keyboard height changes, only the listen callback on the top of the stack is called.</p><p>But in fact, there is another common scenario that breaks this rule, which is the floating chat page. It will always be on the app. Maybe in order to quickly expand the chat page from the floating ball, it is just hidden when it is folded, without destroying the page. In this case, it is still on the top of the stack in the listener management, so after it is folded, the keyboard height listener of the previous chat page will become invalid.</p><p>This was fixed in version 0.1.0 , and all listen callbacks will be called internally in reverse order.</p><p>However, you don’t have to worry that this change will cause unnecessary rebuild on other chat pages, because the keyboard height listen callback will first determine whether the input box has focus, and if not, it will return directly.</p><h4>Compatible with external keyboard</h4><p>When an external keyboard is connected, the soft keyboard will disappear and the height will drop to 0 . Here you can use the iOS simulator combined with Toggle Software Keyboard (shortcut key: cmd + k ) to simulate the effect of connecting and disconnecting the external keyboard.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xNueqVm5oe2VLKAAJyQU-w.gif" /></figure><h4>Hide panel</h4><p>Some friends said that they don’t know how to hide the panel programmatically. It’s actually very simple, just two steps.</p><ol><li>Make the input box lose focus.</li><li>Update internal state to ChatBottomPanelType.none.</li></ol><pre>hidePanel() {<br>  // before 0.2.0<br>  inputFocusNode.unfocus();<br>  if (ChatBottomPanelType.none == controller.currentPanelType) return;<br>  controller.updatePanelType(ChatBottomPanelType.none);<br>  <br>  // afeter 0.2.0<br>  controller.updatePanelType(<br>    ChatBottomPanelType.none,<br>    forceHandleFocus: ChatBottomHandleFocus.unfocus,<br>  );<br>}</pre><h4>Customize bottom safe area height</h4><p>By default, chat_bottom_container will automatically add the bottom safe area height for you when panelType is .none , but in some scenarios you may not want this. For example:</p><ul><li>Regarding the bottom safe area height of Android, many friends simply and rudely set the fixed height.</li><li>Homepage has BottomNavigationBar at the bottom, which does not require a safe area height.</li></ul><p>Here, you can customize this height by setting the safeAreaBottom parameter to 0 as follows.</p><pre>return ChatBottomPanelContainer&lt;PanelType&gt;(<br>  ...<br>  safeAreaBottom: 0,<br>  ...<br>);</pre><h4>Adjust keyboard panel height</h4><p>Such as the chat page located on the homepage in the example.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/375/1*z5oWmt2_t9QywSKnfRgVzw.png" /></figure><p>When the keyboard pops up, as shown below.</p><p>Actual result</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/375/1*yrYR2n8dbzTjWlKEmFHksg.png" /></figure><p>Expected result</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/375/1*QS_lXcPWVbOh0tsKFMqDNw.png" /></figure><p>Obviously, we want the height of the keyboard container to be minus the fixed height of BottomNavigationBar at the bottom of the outer layer.</p><p>ChatBottomPanelContainer provides a changeKeyboardPanelHeight callback, in which the current keyboard height can be obtained. You can return the appropriate keyboard container height by calculating.</p><pre>return ChatBottomPanelContainer&lt;PanelType&gt;(<br>  ...<br>  changeKeyboardPanelHeight: (keyboardHeight) {<br>    final renderObj = bottomNavigationBarKey.currentContext?.findRenderObject();<br>    if (renderObj is! RenderBox) return keyboardHeight;<br>    return keyboardHeight - renderObj.size.height;<br>  },<br>  ...<br>);</pre><h4>Cache keyboard height</h4><p>Let’s first look at what happens before keyboard height caching is implemented?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*phpNvJwGgEUfkX7P.gif" /></figure><p>In the picture above, I have entered the chat page three times in total.</p><ul><li>The first time I clicked on the keyboard and then switched to the emoji panel, the experience was quite good.</li><li>In order to avoid passing by without noticing, the second and third operations are the same. First pop up the emoji panel, and then switch to the keyboard. You can see that it will jitter when switching to the keyboard.</li></ul><p>This is because every time you enter the chat page, the height of the keyboard is the initial value 0. In version 0.2.0 , this was optimized and the keyboard height caching logic was added to avoid the jitter as much as possible.</p><blockquote>❗️ But it should be noted that if you uninstall and reinstall App, the cache will be lost, which means you may still see a jitter at most once.</blockquote><p>In addition, you can also use this cached keyboard height to achieve the effect of keeping the emoji panel and keyboard height consistent, so that the experience will be better when switching. 😉</p><pre>Widget _buildEmojiPickerPanel() {<br>  // If the keyboard height has not been cached, the default height is 300.<br>  double height = 300;<br>  final keyboardHeight = controller.keyboardHeight;<br>  if (keyboardHeight != 0) {<br>    height = keyboardHeight;<br>  }<br><br>  return Container(<br>    padding: EdgeInsets.zero,<br>    height: height,<br>    color: Colors.blue[50],<br>    child: const Center(<br>      child: Text(&#39;Emoji Panel&#39;),<br>    ),<br>  );<br>}</pre><p>The effect is as follows</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dpm_4BYy87DzT8DC2U52MQ.gif" /></figure><h4>Support input box to get focus when displaying emoji panel</h4><p>This is also an important point to improve user experience. The effect is shown in the picture above.</p><p>First set your input box as follows</p><pre>bool readOnly = false;<br>TextEditingController textEditingController = TextEditingController();<br><br>...<br>TextField(<br>  controller: textEditingController,<br>  focusNode: inputFocusNode,<br>  // When it is set to true, the keyboard is not displayed. Default is false.<br>  readOnly: readOnly,<br>  // In order to show the cursor after getting the focus, set it to true so<br>  // that it is not affected by readOnly.<br>  showCursor: true,<br>),<br>...</pre><p>The next step is to switch the emoji panel</p><pre>switchToEmojiPanel() {<br>  readOnly = true;<br>  // Here you can just refresh the input box.<br>  setState(() {});<br><br>  // Waiting for next frame.<br>  WidgetsBinding.instance.addPostFrameCallback((timeStamp) {<br>    controller.updatePanelType(<br>      // Internally switch to other panel type.<br>      ChatBottomPanelType.other,<br>      // To associate with an external panel type (emoji panel).<br>      data: PanelType.emoji,<br>      // Input box gets focus.<br>      forceHandleFocus: ChatBottomHandleFocus.requestFocus,<br>    );<br>  });<br>}</pre><p>In the updatePanelType method, if you switch to the .other panel type, it will help you perform the loss of focus operation, so a forceHandleFocus parameter is provided here. If you are not satisfied with the way the focus is handled inside the method, you can use it to force how focus is handled.</p><h3>Finally</h3><p>Okay, the above is the updated content of the package. As usual, GitHub address is attached: <a href="https://github.com/LinXunFeng/flutter_chat_packages/tree/main/packages/chat_bottom_container">https://github.com/LinXunFeng/flutter_chat_packages/tree/main/packages/chat_bottom_container</a> . If you have any questions about usage, you can check the demo code in the link.</p><p>Open source is not easy. If you think this package is useful, please give it a Star 👍 and support it!</p><p>This article ends here. Thank you all for your support. See you next time! 👋</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=08ebb2f5e57a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Flutter - Smooth switching between chat keyboard and panel]]></title>
            <link>https://medium.com/@linxunfeng/flutter-smooth-switching-between-chat-keyboard-and-panel-8b921d5f52a8?source=rss-ec01a09c277------2</link>
            <guid isPermaLink="false">https://medium.com/p/8b921d5f52a8</guid>
            <category><![CDATA[keyboard]]></category>
            <category><![CDATA[chat]]></category>
            <category><![CDATA[panel]]></category>
            <category><![CDATA[flutter]]></category>
            <dc:creator><![CDATA[LinXunFeng]]></dc:creator>
            <pubDate>Wed, 10 Jul 2024 01:51:30 GMT</pubDate>
            <atom:updated>2024-07-11T04:33:17.354Z</atom:updated>
            <content:encoded><![CDATA[<iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2F1rcVHCv2S8M%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D1rcVHCv2S8M&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2F1rcVHCv2S8M%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/40f85c31092156c272722f7047ca234a/href">https://medium.com/media/40f85c31092156c272722f7047ca234a/href</a></iframe><h3>Overview</h3><p>I believe everyone will encounter this problem when you make a chat app, that is, how to implement smooth switching between the keyboard and other panels on the chat page. This problem has also been raised by issue , such as</p><ul><li><a href="https://github.com/flutter/flutter/issues/121059">https://github.com/flutter/flutter/issues/121059</a></li><li><a href="https://github.com/flutter/flutter/issues/32583">https://github.com/flutter/flutter/issues/32583</a></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/852/0*ArSct67xbieYBuWx.gif" /></figure><p>It can be seen that when switching from the emoji panel to the keyboard, it will jitter, which affects the user experience.</p><p>But several years have passed and it still hasn’t been solved. In addition, I also have this little trouble, so I developed this <a href="https://pub.dev/packages/chat_bottom_container">chat_bottom_container</a> together with GitLqr (GitHub: <a href="https://github.com/GitLqr">github.com/GitLqr</a>) to help us implement this smooth switching effect quickly.</p><h3>Effect</h3><p>Let’s take a look at the effect first, so that everyone can feel it intuitively~</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*WaUd7K66LsnXzRQk.gif" /></figure><p>OK, let’s take a look at how to use it.</p><h3>Integration</h3><p>Add chat_bottom_container to your pubspec.yaml file.</p><pre>dependencies:<br>  chat_bottom_container: latest_version</pre><p>Please copy the latest version on pub.dev , the link is: <a href="https://pub.dev/packages/chat_bottom_container">https://pub.dev/packages/chat_bottom_container</a></p><p>The Android side needs to add the jitpack to the root build.gradle file of your project at the end of repositories.</p><pre>allprojects {<br>  repositories {<br>    ...<br>    maven { url &#39;https://jitpack.io&#39; }<br>  }<br>}</pre><p>Import chat_bottom_container where needed:</p><pre>import &#39;package:chat_bottom_container/chat_bottom_container.dart&#39;;</pre><h3>Use</h3><h4>Page Layout</h4><p>The first thing you need to do is determine the overall page layout.</p><pre>@override<br>Widget build(BuildContext context) {<br>  return Scaffold(<br>    // Set to false<br>    resizeToAvoidBottomInset: false,<br>    body: Column(<br>      mainAxisAlignment: MainAxisAlignment.center,<br>      children: [<br>        Expanded(<br>          child: ListView.builder(<br>            ...<br>          ),<br>        ),<br>        // Input box view<br>        _buildInputView(),<br>        // Bottom panel container<br>        _buildPanelContainer(),<br>      ],<br>    ),<br>  );<br>}</pre><p>Here are two points to note:</p><ol><li>Place the bottom container at the bottom.</li><li>The resizeToAvoidBottomInset must be set to false .</li></ol><h4>Bottom container</h4><p>There are various styles of input box view, so I won’t go into them here. You can implement them however you like. Next, let’s take a look at how to use the <a href="https://pub.dev/packages/chat_bottom_container">chat_bottom_container</a> package to implement the bottom container. The code is as follows:</p><pre>/// Custom bottom panel type<br>enum PanelType {<br>  none,<br>  keyboard,<br>  emoji,<br>  tool,<br>}<br><br>/// The controller of chat_bottom_container, it is used to inform<br>/// chat_bottom_container that the panel type needs to be switched.<br>/// Note: The generic PanelType is passed here to associate with the external<br>/// panel type.<br>final controller = ChatBottomPanelContainerController&lt;PanelType&gt;();<br><br>/// The focus object of the input box.<br>final FocusNode inputFocusNode = FocusNode();<br><br>/// Record the current bottom panel type.<br>PanelType currentPanelType = PanelType.none;<br><br>Widget _buildPanelContainer() {<br>  return ChatBottomPanelContainer&lt;PanelType&gt;(<br>    controller: controller,<br>    inputFocusNode: inputFocusNode,<br>    otherPanelWidget: (type) {<br>      // Return the customized panel view.<br>      if (type == null) return const SizedBox.shrink();<br>      switch (type) {<br>        case PanelType.emoji: // emoji panel<br>          return _buildEmojiPickerPanel();<br>        case PanelType.tool: // tools panel<br>          return _buildToolPanel();<br>        default:<br>          return const SizedBox.shrink();<br>      }<br>    },<br>    onPanelTypeChange: (panelType, data) {<br>      // This callback can be used to record the current panel type<br>      // (this operation is not necessary~)<br>      // panelType: There are three types of panels defined in <br>      //            chat_bottom_container（.none|.keyboard|.other）.<br>      // data: External custom bottom panel type.<br>      switch (panelType) {<br>        case ChatBottomPanelType.none:<br>          currentPanelType = PanelType.none;<br>          break;<br>        case ChatBottomPanelType.keyboard:<br>          currentPanelType = PanelType.keyboard;<br>          break;<br>        case ChatBottomPanelType.other:<br>          if (data == null) return;<br>          switch (data) {<br>            case PanelType.emoji:<br>              currentPanelType = PanelType.emoji;<br>              break;<br>            case PanelType.tool:<br>              currentPanelType = PanelType.tool;<br>              break;<br>            default:<br>              currentPanelType = PanelType.none;<br>              break;<br>          }<br>          break;<br>      }<br>    },<br>    // Bottom panel container background color.<br>    panelBgColor: panelBgColor,<br>  );<br>}</pre><p>There are only three internally defined panel types.</p><pre>enum ChatBottomPanelType {<br>  none,<br>  keyboard,<br>  other,<br>}</pre><p>Because <a href="https://pub.dev/packages/chat_bottom_container">chat_bottom_container</a> doesn&#39;t care how many external panel types you have besides the keyboard, it is uniformly regarded as ChatBottomPanelType.other here.</p><p>It is impossible for us business developers not to care, so when we click the emoji panel button, we call controller.updatePanelType to switch the bottom panel type, and pass in the external customized PanelType for the parameter data , as shown in the following code.</p><pre>controller.updatePanelType(<br>  // Set the current bottom panel type of ChatBottomPanelContainer.<br>  // Can be passed to ChatBottomPanelType.keyboard | ChatBottomPanelType.other | ChatBottomPanelType.none<br>  ChatBottomPanelType.other,<br>  // Callback will include the PanelType customized by external developers,<br>  // this parameter must be passed when ChatBottomPanelType.other.<br>  data: PanelType.emoji, // PanelType.tool<br>);</pre><p>So the generics mentioned above are to associate the type of parameter data in the otherPanelWidget and onPanelTypeChange callbacks for our convenience.</p><h3>Finally</h3><p>Okay, the above are the core usage steps of this package. I have published the <a href="https://pub.dev/packages/chat_bottom_container">chat_bottom_container</a> package to GitHub : <a href="https://github.com/LinXunFeng/flutter_chat_packages/tree/main/packages/chat_bottom_container">https://github.com/LinXunFeng/flutter_chat_packages/tree/main/packages/chat_bottom_container</a>.</p><p>Open source is not easy. If you also think this package is useful, please give it a Star 👍 .</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8b921d5f52a8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Flutter - Supports observing NestedScrollView, with greater compatibility ]]></title>
            <link>https://medium.com/@linxunfeng/flutter-supports-observing-nestedscrollview-with-greater-compatibility-86f49dce7955?source=rss-ec01a09c277------2</link>
            <guid isPermaLink="false">https://medium.com/p/86f49dce7955</guid>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[dart]]></category>
            <category><![CDATA[github]]></category>
            <category><![CDATA[open-source]]></category>
            <dc:creator><![CDATA[LinXunFeng]]></dc:creator>
            <pubDate>Sun, 07 Jul 2024 06:55:10 GMT</pubDate>
            <atom:updated>2024-11-10T12:59:36.094Z</atom:updated>
            <content:encoded><![CDATA[<h3>Overview</h3><p>Time files so fast, it has been 9 months since the last article introducing the function of <a href="https://github.com/fluttercandies/flutter_scrollview_observer">scrollview_observer</a>, and now <a href="https://github.com/fluttercandies/flutter_scrollview_observer">scrollview_observer</a> has also arrived 1.21.0 version, now let’s take a look at what has been updated.</p><p>GitHub: <a href="https://github.com/fluttercandies/flutter_scrollview_observer">https://github.com/fluttercandies/flutter_scrollview_observer</a></p><h3>Function points</h3><p>Support NestedScrollView</p><p>The following two marjor functions of scrollview_observer are now supported for NestedScrollView, as shown in the following figure.</p><ul><li><a href="https://medium.com/@linxunfeng/flutter-gets-the-items-information-those-are-currently-displaying-in-scrollview-6cb4f27f2536">Flutter — Getting the items information those are currently displaying in ScrollView</a></li><li><a href="https://medium.com/@linxunfeng/flutter-scrolling-to-a-specific-item-in-the-scrollview-b89d3f10eee0">Flutter — Scrolling to a specific item in the ScrollView！🔥</a></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SW1mgorc8O7eifZh_oUW-Q.gif" /></figure><blockquote>Wait for the next article to introduce the steps in detail :)</blockquote><h3>Support center</h3><p>As shown in the following code, in some scenarios, you may set center of CustomScrollView to implement the chat message page.</p><pre>Widget _buildScrollView() {<br>  return CustomScrollView(<br>    center: _centerKey,<br>    anchor: 1,<br>    controller: scrollController,<br>    slivers: [<br>      _buildSliverListView(<br>        color: Colors.redAccent,<br>        onBuild: (ctx) {<br>          _sliverListCtx1 = ctx;<br>        },<br>      ),<br>      _buildSliverListView(<br>        color: Colors.blueGrey,<br>        onBuild: (ctx) {<br>          _sliverListCtx2 = ctx;<br>        },<br>      ),<br>      // center<br>      SliverPadding(padding: EdgeInsets.zero, key: _centerKey),<br>      _buildSliverListView(<br>        color: Colors.teal,<br>        onBuild: (ctx) {<br>          _sliverListCtx3 = ctx;<br>        },<br>      ),<br>      _buildSliverListView(<br>        color: Colors.purple,<br>        onBuild: (ctx) {<br>          _sliverListCtx4 = ctx;<br>        },<br>      ),<br>    ],<br>  );<br>}</pre><p>But you want to use the jumpTo index function of item. Don’t worry, <a href="https://github.com/fluttercandies/flutter_scrollview_observer">scrollview_observer</a> has good compatibility and is already supported in the 1.19.1 version. And no additional steps are required.</p><h3>observeIntervalForScrolling</h3><p>I believe everyone still remembers that there are three timings for automatically triggering observation:</p><ul><li>scrollStart</li><li>scrollUpdate</li><li>scrollEnd</li></ul><p>Among them, scrollUpdate triggers observation too frequently. In fact, the results of many observations will not be much different. In most usage scenarios, it is not very important to us.</p><p>For this reason, in this update, a new observeIntervalForScrolling property is added to ObserverController , which is used to set the interval for triggering observation, thereby greatly reducing unnecessary observation calculations.</p><p>There are two points to note:</p><ul><li>In order not to change the previous behavior, the default value is Duration.zero , so you need to adjust it by yourself. It is recommended to set it to Duration(milliseconds: 500) .</li><li>This property is only valid for scrollUpdate .</li></ul><h3>visibleMainAxisSize</h3><blockquote>The display size of item</blockquote><p>As shown, each item has a fixed height of 200, and their corresponding visibleMainAxisSize in ListView.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jkrxfF109YHYfYlxF3gEnA.png" /></figure><h3>visibleFraction</h3><blockquote>The visible fraction of item within sliver.</blockquote><blockquote>Calculation formula: visibleFraction = visibleMainAxisSize / paintExtent</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*i8lOyajL1hGiGMkx43G_uw.png" /></figure><p>As shown in the figure, the current visible space of SliverList is paintExtent and the visibleMainAxisSize of item20 is 30 , so the visibleFraction of item20 is 30/376 .</p><h3>SliverObserveContext</h3><p>Used to get BuildContext of sliver , which is very useful in scenarios of observing the sliver .</p><p>As follows CustomScrollView configures multiple sliver .</p><pre>Widget _buildScrollView() {<br>  return CustomScrollView(<br>    controller: scrollController,<br>    physics: const ClampingScrollPhysics(),<br>    slivers: [<br>      // banner<br>      SliverPersistentHeader(...),<br>      // any widget in the middle<br>      SliverObserveContextToBoxAdapter(...),<br>      // tabBar<br>      SliverPersistentHeader(...),<br>      // build some SliverGird<br>      ...List.generate(modelList.length, (mainIndex) {<br>        return _buildSectionGridView(mainIndex);<br>      }),<br>    ],<br>  );<br>}</pre><p>We need to observe which SliverGrid is currently the first, and then update the selected index of TabBar synchronously.</p><pre>/// Record each Sliver&#39;s index and BuildContext.<br>Map&lt;int, BuildContext&gt; sliverIndexCtxMap = {};<br><br>SliverViewObserver(<br>  controller: sliverObserverController,<br>  sliverContexts: () =&gt; sliverIndexCtxMap.values.toList(),<br>  child: child,<br>  onObserveViewport: (result) {<br>    ...<br>  },<br>);</pre><p>But during the development process, we are likely to add another layer of Sliver to SliverGrid to add decoration, spacing, etc., while onObserveViewport only recognizes the outermost layer sliver , so here we use SliverObserveContext to wrap it and become the outermost layer. In its onObserve callback, we can get the corresponding BuildContext and record it.</p><pre>Widget _buildSectionGridView(int mainIndex) {<br>  Widget resultWidget = SliverGrid(<br>    gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(...),<br>    delegate: SliverChildBuilderDelegate(<br>      (BuildContext context, int index) {<br>        // Got the BuildContext of SliverGrid<br>        return Container(<br>          ...<br>        );<br>      },<br>      childCount: 10,<br>    ),<br>  );<br>  resultWidget = SliverPadding(<br>    padding: const EdgeInsets.all(8),<br>    sliver: resultWidget,<br>  );<br>  // Wrap it with SliverObserveContext at the outermost layer to obtain<br>  // the BuildContext of the outer layer.<br>  resultWidget = SliverObserveContext(<br>    onObserve: (context) {<br>      sliverIndexCtxMap[mainIndex] = context;<br>    },<br>    child: resultWidget,<br>  );<br>  return resultWidget;<br>}</pre><h3>Keep IM message position</h3><p>The keep position function currently has three modes to choose from</p><pre>enum ChatScrollObserverHandleMode {<br>  /// Regular mode<br>  /// Such as inserting or deleting messages.<br>  normal,<br><br>  /// Generative mode<br>  /// Such as ChatGPT streaming messages.<br>  generative,<br><br>  /// Specified mode<br>  /// You can specify the index of the reference message in this mode.<br>  specified,<br>}</pre><p>This update is about the specified mode. Because the original refItemRelativeIndex and refItemRelativeIndexAfterUpdate parameters can only express relative indexes, but cannot express the reference coordinate system, they are abandoned.</p><p>Added refItemIndex and refItemIndexAfterUpdate , and combined with refIndexType to better specify the reference to item .</p><p>Let’s first take a look at the type definition of refIndexType .</p><pre>enum ChatScrollObserverRefIndexType {<br>  ///     relativeIndex        trailing<br>  ///<br>  ///           6         |     item16    | cacheExtent<br>  ///   ----------------- -----------------<br>  ///           5         |     item15    |<br>  ///           4         |     item14    |<br>  ///           3         |     item13    | displaying<br>  ///           2         |     item12    |<br>  ///           1         |     item11    |<br>  ///   ----------------- -----------------<br>  ///           0         |     item10    | cacheExtent &lt;---- start<br>  ///<br>  ///                          leading<br>  relativeIndexStartFromCacheExtent,<br><br>  ///     relativeIndex        trailing<br>  ///<br>  ///           5         |     item16    | cacheExtent<br>  ///   ----------------- -----------------<br>  ///           4         |     item15    |<br>  ///           3         |     item14    |<br>  ///           2         |     item13    | displaying<br>  ///           1         |     item12    |<br>  ///           0         |     item11    |             &lt;---- start<br>  ///   ----------------- -----------------<br>  ///          -1         |     item10    | cacheExtent<br>  ///<br>  ///                          leading<br>  relativeIndexStartFromDisplaying,<br><br>  /// Directly specify the index of item.<br>  itemIndex,<br>}</pre><p>As above, there are a total of three reference modes for you to choose from.</p><ul><li>relativeIndexStartFromCacheExtent : Calculate the index starting from item in the rendering area. This mode is generally used for chat message insertion, because the inserted message must be at 0 . What remains unchanged before and after the inserted message is the original latest message, and its index changes from 0 to 1 , then refItemIndex can be set to 0 , and refItemIndexAfterUpdate can be set to 1 .</li><li>elativeIndexStartFromCacheExtent : Calculate the index starting from item in the display area. This mode is relatively rarely used. It is usually combined with the observation function, because through the observation function, we can easily know which item are being displayed. Suppose you change content of the first item, but does not want to affect the offset of the second displayed item , then this mode is just suitable for the current scenario. Because the second displayed item remains unchanged before and after the change, refItemIndex is set to 1 , and refItemIndexAfterUpdate is also set to 1.</li><li>itemIndex : The easiest to understand mode among the three modes. You specify the index of item used for reference, such as item11 above has changed. If we want to maintain the position, we can use the unchanged item12 as a reference, so refItemIndex and refItemIndexAfterUpdate are both set to 12 .</li></ul><p>Remember, no matter which reference mode you choose, one thing you need to pay attention to is that the specified reference item needs to be rendered before and after the change, so as to ensure that the function of keeping position can take effect normally!</p><h3>Finally</h3><p>Through the explanation of the above examples, I believe you will have a clearer understanding of the use of <a href="https://github.com/fluttercandies/flutter_scrollview_observer">scrollview_observer</a> . Open source is not easy. If you also find this package useful, please give it a Star 👍</p><p>GitHub: <a href="https://github.com/fluttercandies/flutter_scrollview_observer">https://github.com/fluttercandies/flutter_scrollview_observer</a></p><p>Author: <a href="https://github.com/LinXunFeng">https://github.com/LinXunFeng</a></p><p>This article ends here. Thank you all for your support. See you next time! 👋</p><h3>Series</h3><ul><li><a href="https://medium.com/@linxunfeng/flutter-gets-the-items-information-those-are-currently-displaying-in-scrollview-6cb4f27f2536">Flutter — Getting the items information those are currently displaying in ScrollView</a></li><li><a href="https://medium.com/@linxunfeng/flutter-scrolling-to-a-specific-item-in-the-scrollview-b89d3f10eee0">Flutter — Scrolling to a specific item in the ScrollView！🔥</a></li><li><a href="https://medium.com/@linxunfeng/flutter-quickly-implement-the-effect-of-the-chat-session-list-perfect-68c8acea4568">Flutter — Quickly implement the effect of the chat session list, perfect 💯</a></li><li><a href="https://medium.com/@linxunfeng/flutter-new-upgrade-supports-observing-scrollview-built-by-third-package-2e5af3d84c64">Flutter — New upgrade😱Supports observing ScrollView built by third package💪</a></li><li><a href="https://medium.com/@linxunfeng/flutter-play-alternately-waterfall-flow-video-015279bc8e14">Flutter — Play alternately waterfall flow video 🎞</a></li><li><a href="https://medium.com/@linxunfeng/flutter-keep-im-message-position-greatly-upgraded-supports-generative-messages-like-chatgpt-2b199a7b14e7">Flutter — Keep IM message position greatly upgraded (supports generative messages like ChatGPT) 🤖</a></li><li><a href="https://medium.com/@linxunfeng/flutter-anti-occlusion-of-form-in-scrollview-ad8bde15e18d">Flutter — Anti-occlusion of form in ScrollView 🗒</a></li><li><a href="https://medium.com/@linxunfeng/flutter-quickly-achieve-half-view-exposure-statistic-097fd4b237ef">Flutter — Quickly achieve half-view exposure statistic 📊</a></li><li><a href="https://medium.com/@linxunfeng/flutter-how-to-quickly-implement-an-contact-list-page-azlist-829bbef12d8f">Flutter — How to quickly implement an contact list page (azlist) 📓</a></li><li><a href="https://medium.com/@linxunfeng/flutter-supports-observing-nestedscrollview-with-greater-compatibility-86f49dce7955">Flutter — Supports observing NestedScrollView, with greater compatibility 😈</a></li><li><a href="https://medium.com/@linxunfeng/flutter-offset-effect-in-pageview-cec39572d56a">Flutter — Offset effect in PageView</a></li><li><a href="https://medium.com/@linxunfeng/flutter-parallax-effect-in-pageview-ccff6b0b34aa">Flutter — Parallax effect in PageView</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=86f49dce7955" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Flutter - How to quickly implement an contact list page (azlist) ]]></title>
            <link>https://medium.com/@linxunfeng/flutter-how-to-quickly-implement-an-contact-list-page-azlist-829bbef12d8f?source=rss-ec01a09c277------2</link>
            <guid isPermaLink="false">https://medium.com/p/829bbef12d8f</guid>
            <category><![CDATA[dart]]></category>
            <category><![CDATA[github]]></category>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[contact]]></category>
            <category><![CDATA[open-source]]></category>
            <dc:creator><![CDATA[LinXunFeng]]></dc:creator>
            <pubDate>Sun, 19 Nov 2023 08:03:48 GMT</pubDate>
            <atom:updated>2024-11-10T12:58:51.890Z</atom:updated>
            <content:encoded><![CDATA[<h3>Overview</h3><p>I believe everyone is familiar with the contact list page function. To achieve this effect, you may directly use existing open source packages, such as: <a href="https://github.com/flutterchina/azlistview">azlistview</a>. These packages are excellent and can quickly help us complete function development, but there will be some minor problems, such as:</p><ul><li>It relies on some other third-party packages (such as: <em>scrollable_positioned_list</em>), but the limited version may conflict with those in your own project.</li><li>Some refresh widgets may not be supported (such as: easy_refresh)</li><li>Customization of function and layout is limited (for example: <em>Header</em> and <em>Footer</em> cannot be customized, list items have no check function)</li></ul><p>What’s even more terrible is that if one day the product colleague suddenly requires the display to be switched between <em>ListView</em> mode and <em>GridView</em> mode. 😭<br>Therefore, it is most reliable and highly flexible to stick to the ScrollView officially provided by Flutter. In this article, follow my pace and let’s quickly create a contact list.</p><p>Let’s take a look at the effect first:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*hlu5rGmot_VWJlj5.gif" /></figure><h3>Difficulty analysis</h3><p>At a glance, the above effect shows that the difficulties involved are the following two:</p><ul><li>Data positioning, anti-jumping</li><li>Letter list interaction</li></ul><h4>Data positioning</h4><p>When sliding the letter list on the right to jump to the position of the data module corresponding to the letter, you need to consider the data length. If the amount of data is enough, the data content will naturally be displayed from the top. However, if the amount of data is not enough, scroll to the maximum offset of the <em>ScrollView</em>. To put it bluntly, it means to display the data at the bottom of the <em>ScrollView</em> and keep the page motionless. Here we need to consider how to avoid the jumping problem.</p><p>However, today our protagonist(<a href="https://github.com/fluttercandies/flutter_scrollview_observer">flutter_scrollview_observer</a>) has already helped us deal with this jumping problem, so this is no longer a difficulty. We can just adjust <strong><em>jumpTo</em></strong> in the code.</p><h4>Letter list</h4><p>When a finger touches the letter list view, the corresponding index and the corresponding offset of the letter item view need to be returned in real time, so that the cursor view can be suspended to the corresponding position.</p><p>For finger touch, you can use the official widget <em>GestureDetector</em>. This widget provides some touch callbacks, such as <em>onVerticalDragUpdate</em>. We can get the offset of the finger in the letter list view through the <em>details</em> parameter in the callback, we can get it directly through <em>details.localPosition.dy</em>.</p><p>Here comes the key point, how do we know the corresponding index at this time based on the finger offset obtained above? 🧐</p><p>To change our thinking, we can use <a href="https://github.com/fluttercandies/flutter_scrollview_observer">flutter_scrollview_observer</a> to get the first item currently displayed. If we do not intervene in the calculation, the first item will definitely always be A. Therefore, we also need to specify an offset to start calculation in real time, so that we can normally obtain our ideal data of the first item being displayed.</p><p>Next, let’s start practicing together.</p><h3>Practical part</h3><h4>Contact data</h4><p>Since our focus is on how to process the view display, we simply generate the data. I believe that how to process the real data will not be difficult for everyone.</p><pre>/// Contact model<br>class AzListContactModel {<br>  // Store the corresponding letters<br>  final String section;<br>  // All contact names under this letter<br>  final List&lt;String&gt; names;<br><br>  AzListContactModel({<br>    required this.section,<br>    required this.names,<br>  });<br>}<br><br>/// Store all contact model<br>List&lt;AzListContactModel&gt; contactList = [];<br><br>/// Generate contact data<br>generateContactData() {<br>  // Traverse and generate A-Z data in ASCII code<br>  final a = const Utf8Codec().encode(&quot;A&quot;).first;<br>  final z = const Utf8Codec().encode(&quot;Z&quot;).first;<br>  int pointer = a;<br>  while (pointer &gt;= a &amp;&amp; pointer &lt;= z) {<br>    final character = const Utf8Codec().decode(Uint8List.fromList([pointer]));<br>    contactList.add(<br>      AzListContactModel(<br>        section: character,<br>        // In order to test the situation where the amount of data is not enough, a maximum of 8 elements are set here.<br>        names: List.generate(Random().nextInt(8), (index) {<br>          return &#39;$character-$index&#39;;<br>        }),<br>      ),<br>    );<br>    pointer++;<br>  }<br>}</pre><h4>Page Layout</h4><pre>// The controller corresponding to the ScrollView<br>ScrollController scrollController = ScrollController();<br><br>// The controller corresponding to the SliverViewObserver<br>// Here you need to pass in scrollController so that the jumpTo method of observerController can take effect.<br>// The internal jump function is implemented using ScrollController.<br>SliverObserverController observerController = SliverObserverController(controller: scrollController);<br><br>// BuildContext Map that stores the letter index and the corresponding sliver<br>Map&lt;int, BuildContext&gt; sliverContextMap = {};</pre><p>The contact <em>ScrollView</em> is implemented using <em>CustomScrollView</em>. <em>slivers</em> stores a list of contacts corresponding to all letters <em>SliverList</em>.</p><pre>Stack(<br>  children: [<br>    // Observe the ScrollView<br>    SliverViewObserver(<br>      controller: observerController,<br>      sliverContexts: () {<br>        // Return the BuildContext of all slivers corresponding to the letter module.<br>        // Because we want to observe all lists, all are returned here.<br>        return sliverContextMap.values.toList();<br>      },<br>      // Contact ScrollView<br>      child: CustomScrollView(<br>        ...<br>        controller: scrollController,<br>        slivers: contactList.mapIndexed((i, e) {<br>          return _buildSliver(index: i, model: e);<br>        }).toList(),<br>      ),<br>    ),<br>    // Floating cursor<br>    _buildCursor(),<br>    // Letter list view<br>    Positioned(<br>      top: 0,<br>      bottom: 0,<br>      right: 0,<br>      child: _buildIndexBar(),<br>    ),<br>  ],<br>),</pre><p>Build contact SliverList for each letter</p><pre>Widget _buildSliver({<br>  required int index,<br>  required AzListContactModel model,<br>}) {<br>  // If there is no data, return SliverToBoxAdapter<br>  final names = model.names;<br>  if (names.isEmpty) return const SliverToBoxAdapter();<br>  <br>  // Create a SliverList (of course you can create a SliverGrid)<br>  Widget resultWidget = SliverList(<br>    delegate: SliverChildBuilderDelegate(<br>      (context, itemIndex) {<br>        // Store the BuildContext corresponding to SliverList<br>        if (sliverContextMap[index] == null) {<br>          sliverContextMap[index] = context;<br>        }<br>        // Return to the item view<br>        return AzListItemView(name: names[itemIndex]);<br>      },<br>      childCount: names.length,<br>    ),<br>  );<br>  // Use the flutter_sticky_header package to implement letter floating view<br>  resultWidget = SliverStickyHeader(<br>    header: Container(<br>      height: 44.0,<br>      color: const Color.fromARGB(255, 243, 244, 246),<br>      padding: const EdgeInsets.symmetric(horizontal: 16.0),<br>      alignment: Alignment.centerLeft,<br>      child: Text(<br>        model.section,<br>        style: const TextStyle(color: Colors.black54),<br>      ),<br>    ),<br>    sliver: resultWidget,<br>  );<br>  return resultWidget;<br>}</pre><h4>Letter List View</h4><p>The main code to build the letter list view is as follows:</p><pre>/// The key of the parent view of the letter list view, <br>/// used to obtain the offset of the letter view later.<br>final indexBarContainerKey = GlobalKey();<br><br>/// Get all letters from contact data<br>List&lt;String&gt; get symbols =&gt; contactList.map((e) =&gt; e.section).toList();<br><br>Widget _buildIndexBar() {<br>  return Container(<br>    key: indexBarContainerKey,<br>    ...<br>    child: AzListIndexBar(<br>      // The key of the parent view, just remember it, it will be used below<br>      parentKey: indexBarContainerKey,<br>      // letter data<br>      symbols: symbols,<br>      onSelectionUpdate: (index, cursorOffset) {<br>        // The callback of touch start and touch sliding<br>        ...<br>      },<br>      onSelectionEnd: () {<br>        // The callback of touch end and touch cancel<br>        ...<br>      },<br>    ),<br>  );<br>}</pre><p>The above two callbacks are used to update the cursor view, so we won’t talk about them here.</p><p>Next, let’s talk about the key code of <strong><em>AzListIndexBar.</em></strong></p><pre>/// The controller required to observe ScrollView<br>ListObserverController observerController = ListObserverController();<br><br>/// Record the offset of the current finger<br>double observeOffset = 0;<br><br>// Overall layout of letter list view<br>@override<br>Widget build(BuildContext context) {<br>  // Use ListViewObserver to observe ListView<br>  Widget resultWidget = ListViewObserver(<br>    // The observed ScrollView<br>    child: _buildListView(),<br>    controller: observerController,<br>    // Dynamically returns the offset of the current finger, <br>    // which is used to specify the offset to start calculation, <br>    // so that the ideal first item can be obtained by observation.<br>    dynamicLeadingOffset: () =&gt; observeOffset,<br>  );<br>  // Touch listening<br>  resultWidget = GestureDetector(<br>    onVerticalDragDown: _onGestureHandler,<br>    onVerticalDragUpdate: _onGestureHandler,<br>    onVerticalDragCancel: _onGestureEnd,<br>    onVerticalDragEnd: _onGestureEnd,<br>    child: resultWidget,<br>  );<br>  return resultWidget;<br>}</pre><p>Let’s start simple. After releasing your finger, you need to hide the cursor, but this is not part of the letter list view, so you only need to notify the outside through a callback..</p><pre>// Touch end/cancel<br>_onGestureEnd([_]) {<br>  // Directly tell the outside that touch is over.<br>  widget.onSelectionEnd?.call();<br>}</pre><p>When the finger presses and slides, the title on the cursor needs to be displayed and updated, so on the letter list view side, some data can be provided to the outside.</p><pre>// Handling start touch and touch slide<br>// This method is the core<br>_onGestureHandler(dynamic details) async {<br>  // The type of details may be DragDownDetails or DragUpdateDetails<br>  // These two types have no parent class, but they both have a localPosition<br>  // of the same type, which stores the offset of the current finger on the <br>  // list, so for convenience, the type is declared as dynamic here.<br>  if (details is! DragUpdateDetails &amp;&amp; details is! DragDownDetails) return;<br>  observeOffset = details.localPosition.dy;<br><br>  // Trigger an observation<br>  // By using await you can get the observation results there<br>  final result = await observerController.dispatchOnceObserve(<br>    // In the ListViewObserver above, we did not implement the onObserve and<br>    // onObserveAll callbacks<br>    // By default, if the callback is not implemented, it will not be observed,<br>    // so here is set to false for isDependObserveCallback, so that you can<br>    // observe directly without relying on the implementation of the callback.<br>    isDependObserveCallback: false,<br>  );<br>  final observeResult = result.observeResult;<br>  // The observation result is null, indicating that the first item has not<br>  // changed this time. For example: it was the letter A in the last<br>  // observation, and it is still the letter A this time.<br>  // <br>  // By default, the observation results are compared internally. If you want<br>  // to return the data directly without comparing each observation, you can<br>  // set isForce to true in the dispatchOnceObserve method above.<br>  if (observeResult == null) return;<br><br>  // Get the data of the first item<br>  final firstChildModel = observeResult.firstChild;<br>  if (firstChildModel == null) return;<br>  // The index of the first item<br>  final firstChildIndex = firstChildModel.index;<br><br>  // Take out the RenderObject corresponding to the letter view<br>  final firstChildRenderObj = firstChildModel.renderObject;<br>  // Calculate the offset of the center point of the current letter relative<br>  // to the upper left corner of the parent view. We mainly take the y value<br>  // <br>  // ancestor: Pass in the RenderObject of the ancestor view as the reference<br>  // coordinate system<br>  final firstChildRenderObjOffset = firstChildRenderObj.localToGlobal(<br>    Offset.zero,<br>    ancestor: widget.parentKey.currentContext?.findRenderObject(),<br>  );<br>  // After calculation, the data is returned through the onSelectionUpdate<br>  // callback.<br>  final cursorOffset = Offset(<br>    firstChildRenderObjOffset.dx,<br>    firstChildRenderObjOffset.dy + firstChildModel.size.width * 0.5,<br>  );<br>  widget.onSelectionUpdate?.call(<br>    firstChildIndex,<br>    cursorOffset,<br>  );<br>}</pre><h4>Update Cursor</h4><p>Now let’s go back and look at the two touch callbacks</p><pre>/// Cursor data model<br>class AzListCursorInfoModel {<br>  /// Letter<br>  final String title;<br>  <br>  /// The offset of letter center point<br>  final Offset offset;<br><br>  AzListCursorInfoModel({<br>    required this.title,<br>    required this.offset,<br>  });<br>}</pre><pre>// The data model of the cursor is stored here.<br>ValueNotifier&lt;AzListCursorInfoModel?&gt; cursorInfo = ValueNotifier(null);<br><br>Widget _buildIndexBar() {<br>  return Container(<br>    ...<br>    child: AzListIndexBar(<br>      parentKey: indexBarContainerKey,<br>      symbols: symbols,<br>      onSelectionUpdate: (index, cursorOffset) {<br>        // Update the cursor data to show the cursor<br>        cursorInfo.value = AzListCursorInfoModel(<br>          title: symbols[index],<br>          offset: cursorOffset,<br>        );<br>        // Get the BuildContext of SliverList, the contact list view<br>        // corresponding to the letter<br>        final sliverContext = sliverContextMap[index];<br>        if (sliverContext == null) return;<br>        // Jump to the first item of the corresponding letter section<br>        // <br>        // The jumpTo method handles the jumping problem internally, just call<br>        // it!<br>        observerController.jumpTo(<br>          index: 0,<br>          sliverContext: sliverContext,<br>        );<br>      },<br>      onSelectionEnd: () {<br>        // Clear cursor data and hide cursor<br>        cursorInfo.value = null;<br>      },<br>    ),<br>  );<br>}</pre><p>The code to build the cursor view is as follows</p><pre>Widget _buildCursor() {<br>  // Implement partial refresh view based on changes in cursorInfo data<br>  return ValueListenableBuilder&lt;AzListCursorInfoModel?&gt;(<br>    valueListenable: cursorInfo,<br>    builder: (<br>      BuildContext context,<br>      AzListCursorInfoModel? value,<br>      Widget? child,<br>    ) {<br>      Widget resultWidget = Container();<br>      double top = 0;<br>      double right = indexBarWidth + 8;<br>      if (value == null) {<br>        // No cursor data, hidden cursor<br>        resultWidget = const SizedBox.shrink();<br>      } else {<br>        // There is cursor data, display AzListCursor view<br>        double titleSize = 80;<br>        // Based on the y value of the center point offset of the current<br>        // letter view, subtract the height of the cursor view to get the top<br>        // offset of the cursor.<br>        top = value.offset.dy - titleSize * 0.5;<br>        resultWidget = AzListCursor(size: titleSize, title: value.title);<br>      }<br>      resultWidget = Positioned(<br>        top: top,<br>        right: right,<br>        child: resultWidget,<br>      );<br>      return resultWidget;<br>    },<br>  );<br>}</pre><p>There is nothing important in the cursor view <strong><em>AzListCursor</em></strong>, so I won’t explain it. You can implement it arbitrarily.</p><p>Demo link: <a href="https://github.com/fluttercandies/flutter_scrollview_observer/tree/main/example/lib/features/scene/azlist_demo">azlist_demo</a></p><p>Through the explanation of the above example, I believe you will have a clearer understanding of the use of <a href="https://github.com/fluttercandies/flutter_scrollview_observer">scrollview_observer</a>. If you also find this package useful, please give it a star 👍</p><p>GitHub: <a href="https://github.com/fluttercandies/flutter_scrollview_observer">https://github.com/fluttercandies/flutter_scrollview_observer</a></p><p>Author: <a href="https://github.com/LinXunFeng">https://github.com/LinXunFeng</a></p><h3>Series</h3><ul><li><a href="https://medium.com/@linxunfeng/flutter-gets-the-items-information-those-are-currently-displaying-in-scrollview-6cb4f27f2536">Flutter — Getting the items information those are currently displaying in ScrollView</a></li><li><a href="https://medium.com/@linxunfeng/flutter-scrolling-to-a-specific-item-in-the-scrollview-b89d3f10eee0">Flutter — Scrolling to a specific item in the ScrollView！🔥</a></li><li><a href="https://medium.com/@linxunfeng/flutter-quickly-implement-the-effect-of-the-chat-session-list-perfect-68c8acea4568">Flutter — Quickly implement the effect of the chat session list, perfect 💯</a></li><li><a href="https://medium.com/@linxunfeng/flutter-new-upgrade-supports-observing-scrollview-built-by-third-package-2e5af3d84c64">Flutter — New upgrade😱Supports observing ScrollView built by third package💪</a></li><li><a href="https://medium.com/@linxunfeng/flutter-play-alternately-waterfall-flow-video-015279bc8e14">Flutter — Play alternately waterfall flow video 🎞</a></li><li><a href="https://medium.com/@linxunfeng/flutter-keep-im-message-position-greatly-upgraded-supports-generative-messages-like-chatgpt-2b199a7b14e7">Flutter — Keep IM message position greatly upgraded (supports generative messages like ChatGPT) 🤖</a></li><li><a href="https://medium.com/@linxunfeng/flutter-anti-occlusion-of-form-in-scrollview-ad8bde15e18d">Flutter — Anti-occlusion of form in ScrollView 🗒</a></li><li><a href="https://medium.com/@linxunfeng/flutter-quickly-achieve-half-view-exposure-statistic-097fd4b237ef">Flutter — Quickly achieve half-view exposure statistic 📊</a></li><li><a href="https://medium.com/@linxunfeng/flutter-how-to-quickly-implement-an-contact-list-page-azlist-829bbef12d8f">Flutter — How to quickly implement an contact list page (azlist) 📓</a></li><li><a href="https://medium.com/@linxunfeng/flutter-supports-observing-nestedscrollview-with-greater-compatibility-86f49dce7955">Flutter — Supports observing NestedScrollView, with greater compatibility 😈</a></li><li><a href="https://medium.com/@linxunfeng/flutter-offset-effect-in-pageview-cec39572d56a">Flutter — Offset effect in PageView</a></li><li><a href="https://medium.com/@linxunfeng/flutter-parallax-effect-in-pageview-ccff6b0b34aa">Flutter — Parallax effect in PageView</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=829bbef12d8f" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>