Flutter 2.5更新后,listview只在移動平臺上滾動。當我在網頁上打開它時,它不會滾動。它在以前的版本中作業正常。我試了一下滾動物理學,但沒有用。你建議我怎么做? 對不起,我的英語不好。
。
return SizedBox(
高度。400,
孩子。ListView.builder(
物理學。ClampingScrollPhysics()。
滾動方向。Axis.horizontal,
// ignore: unnecessary_null_comparisonnull ? 0 : items.length。
itemBuilder。(context, index) {
return GestureDetector(
onTap: () {
LoginForm()。
},
child: 容器()
margin:
EdgeInsets.symmetric(horizontal: 20, vertical: 6)。)
孩子。SizedBox(
寬度: 400,
高度。50。
孩子。堆疊(
適合。StackFit.expand,
children: <Widget>[
容器(
裝飾。BoxDecoration(
borderRadius:
borderRadius.all(Radius.round(20.0))。
boxShadow: [
BoxShadow(
color: fromCssColor(
items[index].color.toString())。
// color: Colors.black38,
偏移。Offset(2.0, 2.0) 。
blurRadius: 5.0。
spreadRadius: 1.0)
]),
),
ClipRRect(
borderRadius:
borderRadius.all(Radius.round(20.0))。
孩子。Image.asset(
items[index].image.toString(),
適合。BoxFit.cover,
),
),
容器(
裝飾。BoxDecoration(
borderRadius:
borderRadius.all(Radius.round(20.0))。
梯度。LinearGradient(
開始。Alignment.topCenter,
結束。Alignment.bottomCenter,
顏色:[
Colors.transparent,
Colors.black45
]))
),
],
),
),
uj5u.com熱心網友回復:
Flutter 2.5總結
ScrollBehaviors現在允許或不允許從指定的 PointerDeviceKinds。ScrollBehavior.dragDevices,默認情況下,允許 滾動部件可以被所有的PointerDeviceKinds拖動,除了 PointerDeviceKind.mouse.
。
//設定整個應用程式的ScrollBehavior。
MaterialApp(
scrollBehavior: MyCustomScrollBehavior()。
// ...
);
class MyCustomScrollBehavior extends MaterialScrollBehavior {
///覆寫行為方法和getters,如dragDevices。
@override{
Set<PointerDeviceKind> get dragDevices => {
PointerDeviceKind.touch,
PointerDeviceKind.mouse,
};
}
參考文獻。檔案
轉載請註明出處,本文鏈接:https://www.uj5u.com/qiye/315506.html
標籤:
