我正在尝试使用PageView内的ScrollView在颤动中实现此效果:
但是当我滚动到第二页时,我被卡住了,不能再回头了。
示例代码:
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
debugShowCheckedModeBanner: false,
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: Scaffold(
appBar: AppBar(
title: Text("Demo"),
),
body: PageView(
scrollDirection: Axis.vertical,
children:[
Container(color: Colors.red),
ListView(
children:[
Container(color: Colors.yellow, height:300),
Container(color: Colors.green, height:300),
]
)
],
),
),
);
}
}
当ScrollView到达末尾时,如何将onDrag事件发送到PageView?
listview不能与pageviewer一起使用,因此使用wrap Widget而不是listview,像这样,
PageView(
scrollDirection: Axis.vertical,
children:[
Container(color: Colors.red),
Wrap(
children:[
Container(color: Colors.yellow, height:300),
Container(color: Colors.green, height:300),
]
)
],
),