listView项目滑动右打开新屏幕
如何通过在listView
项目的右侧打开新屏幕,类似于snapchat
app。这是我想实现的视频链接。 link
我试图使用ListView Slidable检查,但是没有选择到新屏幕上的选项。 以下是两个屏幕的示例飞镖代码。通过刷listView
项目,我想打开testpage.dart
屏幕。如何在颤抖中实现这一目标?
firstpage.dart
ListView.builder(
itemCount: 10,
shrinkWrap: true,
scrollDirection: Axis.vertical,
itemBuilder: (BuildContext context, int index) {
return Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
children: [
Row(
children: [
ClipOval(
child: Image.network(
'https://googleflutter.com/sample_image.jpg',
width: 50,
height: 50,
fit: BoxFit.cover,
),
),
Padding(
padding: const EdgeInsets.only(
right: 10.0),
child: Column(
children: [
Row(
mainAxisAlignment:
MainAxisAlignment
.spaceBetween,
children: [
Text(
'Person 1',
style: TextStyle(
color: Colors.red
),
),
const FittedBox(
fit: BoxFit.fitWidth,
child: Text(
'last seen at 8:22 PM'
)
],
),
Padding(
padding: const EdgeInsets.only(
top: 5.0),
child: SizedBox(
width: MediaQuery.of(context)
.size
.width *
0.50,
child:Text('test'),
),
)
],
),
),],),],),);}),
testpage.dart
class TestPage extends StatefulWidget {
const TestPage({Key? key}) : super(key: key);
@override
State<TestPage> createState() => _TestPageState();
}
class _TestPageState extends State<TestPage> {
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.redAccent,
body: Container(),
);
}
}
How to open new screen by swiping to the right of listview
item similar to as snapchat
app. This is the video link that i want to achieve this.
link
I tried to check with listview slidable but there is no option for navigating to new screen.
Below is the sample dart code of two screens. By swiping right of listview
item i want to open TestPage.dart
screen. How to achieve this in Flutter?
FirstPage.dart
ListView.builder(
itemCount: 10,
shrinkWrap: true,
scrollDirection: Axis.vertical,
itemBuilder: (BuildContext context, int index) {
return Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
children: [
Row(
children: [
ClipOval(
child: Image.network(
'https://googleflutter.com/sample_image.jpg',
width: 50,
height: 50,
fit: BoxFit.cover,
),
),
Padding(
padding: const EdgeInsets.only(
right: 10.0),
child: Column(
children: [
Row(
mainAxisAlignment:
MainAxisAlignment
.spaceBetween,
children: [
Text(
'Person 1',
style: TextStyle(
color: Colors.red
),
),
const FittedBox(
fit: BoxFit.fitWidth,
child: Text(
'last seen at 8:22 PM'
)
],
),
Padding(
padding: const EdgeInsets.only(
top: 5.0),
child: SizedBox(
width: MediaQuery.of(context)
.size
.width *
0.50,
child:Text('test'),
),
)
],
),
),],),],),);}),
TestPage.dart
class TestPage extends StatefulWidget {
const TestPage({Key? key}) : super(key: key);
@override
State<TestPage> createState() => _TestPageState();
}
class _TestPageState extends State<TestPage> {
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.redAccent,
body: Container(),
);
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以通过这样使用可忽视的小部件来做到这一点:
You can do it by using Dismissible widget like this: