-
Notifications
You must be signed in to change notification settings - Fork 731
Open
Description
1、放到ListView中,把swiper滑动到非首个。
2、把ListView滑动到底部。
3、然后把ListView滑到顶部查看swiper。
现象:swiper自动回到第一个!
期望:保持swiper用户滑动的位置。
import 'package:flutter/material.dart';
import 'package:flutter_swiper/flutter_swiper.dart';
void main() => runApp(new MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return new MaterialApp(
title: 'Flutter Demo',
theme: new ThemeData(
primarySwatch: Colors.blue,
),
home: new MyHomePage(title: 'Flutter Demo Home Page'),
);
}
}
class MyHomePage extends StatefulWidget {
MyHomePage({Key key, this.title}) : super(key: key);
final String title;
@override
_MyHomePageState createState() => new _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
return new Scaffold(
appBar: new AppBar(
title: new Text(widget.title),
),
body: ListView(
children: <Widget>[
Container(
width: double.infinity,
height: 400,
decoration: BoxDecoration(
color: Colors.green,
),
child: new Swiper(
itemBuilder: (BuildContext context,int index){
return new Image.network("http://via.placeholder.com/350x150",fit: BoxFit.fill,);
},
itemCount: 3,
pagination: new SwiperPagination(),
control: new SwiperControl(),
),
),
Container(
width: double.infinity,
height: 1500,
decoration: BoxDecoration(
color: Colors.blue,
),
),
],
)
);
}
}
Metadata
Metadata
Assignees
Labels
No labels