Closed Zudah228 closed 11 months ago
Web の Issue から、手動で移行 https://github.com/FlutterKaigi/2023/issues/214
iOS で画面の上をタップしたら、最上部にスクロールするアクションが実現できる。
ScrollView.primary
assert(!(controller != null && (primary ?? false)))
primary: true
controller
PrimaryScrollController
InheritedWidget
ScrollController
ScrollView
https://github.com/flutter/flutter/issues/85603#issuecomment-876798161
対応しました! PRの補足は下記記事に。 https://zenn.dev/koji_1009/articles/53962fc717c8ae
Web の Issue から、手動で移行 https://github.com/FlutterKaigi/2023/issues/214
Describe
iOS で画面の上をタップしたら、最上部にスクロールするアクションが実現できる。
参考
ScrollView.primary
assert(!(controller != null && (primary ?? false)))
がある(primary: true
の時は、controller
を渡してはいけない)ので、controller
を渡している場合は、工夫が必要。新しい
PrimaryScrollController
でラップする。PrimaryScrollController
はInheritedWidget
なので、サブツリーの振る舞いを変えられる。ScrollController
があるので、そこに使いたいScrollController
を渡す。ScrollView.primary
を true にする。PrimaryScrollController
と同じScrollController
を、primary にしたいScrollView
に渡す。Screenshots
Environment
Additional context