Skip to content

Commit

Permalink
Tip 220
Browse files Browse the repository at this point in the history
  • Loading branch information
bizz84 committed Dec 20, 2024
1 parent 8efc7c0 commit 83e9304
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ This repo now has a companion app! [Download it here](https://fluttertips.dev/)
| ID | View on GitHub (this repo) | X Post | LinkedIn Post | Bluesky Post | Link on [codewithandrea.com](https://codewithandrea.com/) |
| -- |-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| ------ | ------------- | ------------ | ------------------------------------------------------------------------------------------------------------------------------------ |
| 220 | [The ListWheelScrollView Widget](tips/0220-list-wheel-scroll-view/index.md) | [link](https://x.com/biz84/status/1870061289114087814) | [link](https://www.linkedin.com/posts/andreabizzotto_did-you-know-if-you-need-to-select-between-activity-7275827511219945472-cYEH) | [link](https://bsky.app/profile/codewithandrea.com/post/3ldqaaejlx22e) | |
| 219 | [Color API Deprecations in Flutter 3.27](tips/0219-color-deprecations-flutter-3.27/index.md) | [link](https://x.com/biz84/status/1869357562979893444) | [link](https://www.linkedin.com/posts/andreabizzotto_did-you-know-to-support-the-latest-wide-activity-7275123561881645057-LsKH) | [link](https://bsky.app/profile/codewithandrea.com/post/3ldldwzh6l22f) | |
| 218 | [Text Style with Tabular Figures](tips/0218-text-style-tabular-figures/index.md) | [link](https://x.com/biz84/status/1868692579648487611) | [link](https://www.linkedin.com/posts/andreabizzotto_did-you-know-if-you-want-to-render-fixed-activity-7274458459914350593-YkSx) | [link](https://bsky.app/profile/codewithandrea.com/post/3ldgqe64qzs24) | |
| 217 | [Digits Separators in Dart 3.6](tips/0217-digits-separators/index.md) | [link](https://x.com/biz84/status/1867505284002000962) | [link](https://www.linkedin.com/posts/andreabizzotto_did-you-know-since-dart-36-flutter-327-activity-7273271119049068544-gQuB) | [link](https://bsky.app/profile/codewithandrea.com/post/3ld6ioxq5x22f) | |
Expand Down
2 changes: 1 addition & 1 deletion tips/0219-color-deprecations-flutter-3.27/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Learn more about this breaking change here:

| Previous | Next |
| -------- | ---- |
| [Text Style with Tabular Figures](../0218-text-style-tabular-figures/index.md) | |
| [Text Style with Tabular Figures](../0218-text-style-tabular-figures/index.md) | [The ListWheelScrollView Widget](../0220-list-wheel-scroll-view/index.md) |

<!-- TWITTER|https://x.com/biz84/status/1869357562979893444 -->
<!-- LINKEDIN|https://www.linkedin.com/posts/andreabizzotto_did-you-know-to-support-the-latest-wide-activity-7275123561881645057-LsKH -->
Expand Down
Binary file added tips/0220-list-wheel-scroll-view/220.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
57 changes: 57 additions & 0 deletions tips/0220-list-wheel-scroll-view/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# The ListWheelScrollView Widget

Did you know?

If you need to select between a small list of values but have limited vertical space, you can use a `ListWheelScrollView`. 🎯

Pro Tip: use `FixedExtentScrollPhysics` to snap to the nearest item when the user stops scrolling. 👍

![](220.gif)

<!--
ListWheelScrollView.useDelegate(
// Size of each item in the main axis
itemExtent: 100,
// Ratio between the diameter and the viewport height
diameterRatio: 1.5,
// Controller to control the scroll position
controller: FixedExtentScrollController(
initialItem: selectedIndex,
),
// Snap to nearest item when the user stops scrolling
physics: const FixedExtentScrollPhysics(),
// Callback when the user selects an item
onSelectedItemChanged: onSelectedItemChanged,
// List of items to display
childDelegate: ListWheelChildBuilderDelegate(
childCount: timezones.length,
builder: (context, index) => TimeZoneDisplayCard(
timezone: timezones[index],
isSelected: selectedIndex == index,
),
),
)
-->

How to use:

- call the regular `ListWheelScrollView` constructor and pass a list of children.
- call `ListWheelScrollView.useDelegate` and pass a `ListWheelChildDelegate`.

For all the details, check the official docs:

- [ListWheelScrollView class](https://api.flutter.dev/flutter/widgets/ListWheelScrollView-class.html)


---

| Previous | Next |
| -------- | ---- |
| [Color API Deprecations in Flutter 3.27](../0219-color-deprecations-flutter-3.27/index.md) | |


<!-- TWITTER|https://x.com/biz84/status/1870061289114087814 -->
<!-- LINKEDIN|https://www.linkedin.com/posts/andreabizzotto_did-you-know-if-you-need-to-select-between-activity-7275827511219945472-cYEH -->
<!-- BLUESKY|https://bsky.app/profile/codewithandrea.com/post/3ldqaaejlx22e -->

0 comments on commit 83e9304

Please sign in to comment.