我有一个定位的小部件,它有一个容器作为孩子。容器有一个作为子项的Listview.seperated,但是listview没有滚动。我试图更改bottom属性的值,但是在一定范围的值中,listview的顶部具有很小的滚动空间,但其他位置不会影响滚动。
body: Stack(
overflow: Overflow.visible,
children: <Widget>[
Container(
height: screenSize.height * 0.2 + 150,
width: screenSize.width,
color: Color.fromRGBO(43, 49, 109, 1.0),
),
Positioned(
left: 20,
top: -25,
child: Lottie.asset('assets/gerdali.json',
height: 400,
width: 400,
repeat: false
)),
Positioned(
top: screenSize.height * 0.2 + 20 ,
bottom: -screenSize.height,
right:0.0 ,
left: 0.0,
child: Container(
height: screenSize.height,
width: screenSize.width,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(80.0),
topRight: Radius.circular(80.0)
)
),
child: ListView.separated(
padding: EdgeInsets.only(left: 20.0,right: 20.0,top:80.0),
itemBuilder:(context,index){
return TextField(
decoration: InputDecoration(
filled: true,
fillColor: Colors.white,
hintText: "",
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(40.0)
)
),
);
},
separatorBuilder: (BuildContext,int index){
return SizedBox(
height: 10.0,
);
},
itemCount: 8),
),
),
Positioned(
top: screenSize.height * 0.2 - 60 ,
left: screenSize.width / 2 - 75,
child: RawMaterialButton(
padding: EdgeInsets.all(40.0),
fillColor: Colors.white,
shape: CircleBorder(
side: BorderSide(
color: Colors.black,
width: 1.0
)
),
elevation: 0.0,
child: Icon(
Icons.camera_alt,
color: Colors.grey,
size: 70.0,
),
onPressed: (){},
),)
],
答案 0 :(得分:0)
您可以检查此代码,我只是单独设置了一个滚动视图以手动对其进行调整。
Widget build(BuildContext context) {
final screenSize = MediaQuery.of(context).size;
return Scaffold(
body: Stack(
overflow: Overflow.visible,
children: <Widget>[
Positioned(
top: 0,
child: Container(
height: screenSize.height * 0.2 + 150,
width: screenSize.width,
color: Color.fromRGBO(43, 49, 109, 1.0),
),
),
Positioned(
left: 20,
top: -25,
child: Image.asset('assets/gerdali.json',
height: 400, width: 400, repeat: false)),
Positioned(
top: screenSize.height * 0.2 + 20,
bottom: -screenSize.height,
right: 0.0,
left: 0.0,
child: Container(
height: screenSize.height - (screenSize.height * 0.2 + 20),
width: screenSize.width,
decoration: BoxDecoration(
color: Colors.red,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(80.0),
topRight: Radius.circular(80.0))),
child: Column(
children: [
SizedBox(
height: 50,
),
Container(
height: screenSize.height - (screenSize.height * 0.2 + 70),
width: screenSize.width,
child: ListView.separated(
padding:
EdgeInsets.only(left: 20.0, right: 20.0, top: 30.0),
itemBuilder: (context, index) {
return TextField(
decoration: InputDecoration(
filled: true,
fillColor: Colors.white,
hintText: "",
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(40.0))),
);
},
separatorBuilder: (BuildContext, int index) {
return SizedBox(
height: 10.0,
);
},
itemCount: 10),
),
],
),
),
),
Positioned(
top: screenSize.height * 0.2 - 60,
left: screenSize.width / 2 - 75,
child: RawMaterialButton(
padding: EdgeInsets.all(40.0),
fillColor: Colors.white,
shape: CircleBorder(
side: BorderSide(color: Colors.black, width: 1.0)),
elevation: 0.0,
child: Icon(
Icons.camera_alt,
color: Colors.grey,
size: 70.0,
),
onPressed: () {},
),
),
],
),
);
}