Android 摆动式集装箱
我有一个容器,其中包含一些车辆数据的列表视图,当我向上滚动时,只有容器中的数据向上移动,我想移动整个容器。我不希望我的UI像那样,整个容器应该向上移动,请帮助我,另一部分是我使用了收缩包装,如果我的列表只有一个值,它会出现在我的屏幕中央,我不想这样做Android 摆动式集装箱,android,dart,flutter,Android,Dart,Flutter,我有一个容器,其中包含一些车辆数据的列表视图,当我向上滚动时,只有容器中的数据向上移动,我想移动整个容器。我不希望我的UI像那样,整个容器应该向上移动,请帮助我,另一部分是我使用了收缩包装,如果我的列表只有一个值,它会出现在我的屏幕中央,我不想这样做 new SingleChildScrollView( child: new Container( padding: EdgeInsets.only(left: 24.0, right: 24.0,top: 25.0,bottom: 25
new SingleChildScrollView(
child: new Container(
padding: EdgeInsets.only(left: 24.0, right: 24.0,top: 25.0,bottom: 25.0),
child: new PhysicalModel(
borderRadius: new BorderRadius.circular(20.0),
color: Colors.white,
shadowColor: Colors.grey,
elevation: 0.0,
shape: BoxShape.rectangle,
child:new ListView(
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
children: List.generate(
this._allVehiclesData.length,
(i) => new GestureDetector(
onTap: (){
_id = this._allVehiclesData[i]["vehicle"]["_id"];
Navigator.push(context, new MaterialPageRoute(builder: (context) => new SingleVehicleDashboard(value:_id)));
},
child: new Card(
elevation: 0.0,
child:new Container(
padding: const EdgeInsets.only(top:30.0,left: 30.0,right: 30.0),
child: Row(
children: [
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
child: new Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
this._allVehiclesData[i]["vehicle"]["registration"] != null?
Text(
this._allVehiclesData[i]["vehicle"]["registration"],
style: TextStyle(
fontSize: 20.0,
color: Color(0xFF454f63),
),
):
Text(
'New Vehicle',
style: TextStyle(
fontSize: 20.0,
color: Color(0xFF454f63),
),
),
new Container(
// padding: EdgeInsets.only(left: 50.0),
child: status(i),
),
],
),
),
Text('',
style: TextStyle(
fontSize: 8.0,
),
),
Container(
child: new Row(
children: <Widget>[
new IconTheme(
data: new IconThemeData(
color: Colors.grey,
),
child: Image.asset('assets/person.png'),
),
new Container(
child: new Text(this._allVehiclesData[i]["driver"]["fullname"],
style: TextStyle(
fontSize: 16.0,
color: Color(0xFF78849e),
) ,
)
),
],
),
),
Container(
child: new Column(
children: <Widget>[
new Text(''),
new Container(
child: new Text('',
style: TextStyle(
fontSize: 5.0,
) ,
)
),
],
),
),
Container(
child:
this._allVehiclesData[i]["temperature"] != "null" && this._allVehiclesData[i]["fuel"] != "null"?
new Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
new Row(
children: <Widget>[
new IconTheme(
data: new IconThemeData(
color: Color(0xFF78849e),
size: 20.0,
),
child: Icon(Icons.ac_unit),
),
new Container(
child: new Text((' '+this._allVehiclesData[i]["temperature"].toString()+' C'),
style: TextStyle(
fontSize: 16.0,
color: Color(0xFF78849e),
) ,
)
),
],
),
new Row(
children: <Widget>[
new IconTheme(
data: new IconThemeData(
color: Color(0xFF78849e),
size: 20.0,
),
child: Icon(Icons.local_gas_station),
),
new Container(
child: new Text((this._allVehiclesData[i]["fuel"].toString()),
style: TextStyle(
fontSize: 16.0,
color: Color(0xFF78849e),
) ,
)
),
],
),
],
):
this._allVehiclesData[i]["temperature"] !="null"?
new Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
new Row(
children: <Widget>[
new IconTheme(
data: new IconThemeData(
color: Color(0xFF78849e),
),
child: Icon(Icons.ac_unit),
),
new Container(
child: new Text((this._allVehiclesData[i]["temperature"].toString()+' C'),
style: TextStyle(
fontSize: 16.0,
color: Color(0xFF78849e),
) ,
)
),
],
),
],
):
this._allVehiclesData[i]["fuel"] !="null"?
new Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
new Row(
children: <Widget>[
new IconTheme(
data: new IconThemeData(
color: Color(0xFF78849e),
),
child: Icon(Icons.local_gas_station),
),
new Container(
child: new Text((this._allVehiclesData[i]["fuel"].toString()),
style: TextStyle(
fontSize: 16.0,
color: Color(0xFF78849e),
) ,
)
),
],
),
],
):new Text(''),
),
new Text('',style: TextStyle(fontSize: 7.0)),
new Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
new IconTheme(
data: new IconThemeData(
color: Color(0xFF78849e),
),
child: Icon(Icons.location_on),
),
Expanded(
child: new Text((this._allVehiclesData[i]["address"] == null ||
this._allVehiclesData[i]["address"] == 'Not determined') ?
"No data available" : this._allVehiclesData[i]["address"]["LongLabel"],
style: TextStyle(
letterSpacing: 0.5,
height: 1.0,
fontSize: 16.0,
color: Color(0xFF78849e),
),
),
),
],
),
Text(''),
Divider(
height: 3.0,
color: Color(0xFFf4f4f6),
),
],
),
),
],
),
),
),
),
),
)
),
)
)
newsingleChildScrollView(
子容器:新容器(
填充:仅限边设置(左:24.0,右:24.0,顶部:25.0,底部:25.0),
儿童:新的物理模型(
边界半径:新边界半径。圆形(20.0),
颜色:颜色,白色,
阴影颜色:颜色。灰色,
标高:0.0,
形状:BoxShape.rectangle,
子:新列表视图(
收缩膜:对,
物理学:NeverscrollableScroll物理学(),
子项:List.generate(
此._allVehiclesData.length,
(i) =>新的手势检测器(
onTap:(){
_id=此。_allVehiclesData[i][“vehicle”][“id”];
Navigator.push(上下文,newmaterialpageroute(builder:(context)=>newsinglevehicledashboard(值:_id));
},
孩子:新卡(
标高:0.0,
子容器:新容器(
填充:仅限常量边集(顶部:30.0,左侧:30.0,右侧:30.0),
孩子:排(
儿童:[
扩大(
子:列(
crossAxisAlignment:crossAxisAlignment.start,
儿童:[
容器(
孩子:新的一排(
mainAxisAlignment:mainAxisAlignment.spaceBetween,
儿童:[
这._allVehiclesData[i][“vehicle”][“registration”]!=null?
正文(
本._所有车辆数据[i][“车辆”][“登记”],
样式:TextStyle(
字体大小:20.0,
颜色:颜色(0xFF454f63),
),
):
正文(
“新车”,
样式:TextStyle(
字体大小:20.0,
颜色:颜色(0xFF454f63),
),
),
新容器(
//填充:仅限边缘设置(左:50.0),
儿童:身份(i),
),
],
),
),
文本(“”,
样式:TextStyle(
字体大小:8.0,
),
),
容器(
孩子:新的一排(
儿童:[
新IconTheme(
数据:新的IconThemeData(
颜色:颜色。灰色,
),
子项:Image.asset('assets/person.png'),
),
新容器(
子项:新文本(此._allVehiclesData[i][“driver”][“fullname”],
样式:TextStyle(
字体大小:16.0,
颜色:颜色(0xFF78849e),
) ,
)
),
],
),
),
容器(
子:新列(
儿童:[
新文本(“”),
新容器(
子:新文本(“”,
样式:TextStyle(
字体大小:5.0,
) ,
)
),
],
),
),
容器(
儿童:
此。_allVehiclesData[i][“温度”!=“零”&此。_allVehiclesData[i][“燃料”]!=“零”?
新行(
mainAxisAlignment:mainAxisAlignment.spaceBetween,
儿童:[
新行(
儿童:[
新IconTheme(
数据:新的IconThemeData(
颜色:颜色(0xFF78849e),
尺寸:20.0,
),
子:图标(图标。ac_单元),
),
新容器(
子项:新文本(“”+this._allVehiclesData[i][“temperature”].toString()+“C”),
样式:TextStyle(
字体大小:16.0,
颜色:颜色(0xFF78849e),
) ,
)
),
],
),
shrinkWrap: true,
physics: NeverScrollableScrollPhysics()
body: SingleChildScrollView(
child: new Container(
padding: EdgeInsets.only(left: 24.0, right: 24.0, top: 25.0),
child: new PhysicalModel(
borderRadius: new BorderRadius.only(
topLeft: Radius.circular(20.0), topRight: Radius.circular(20.0)),
color: Colors.white,
shadowColor: Colors.grey,
elevation: 1.0,
shape: BoxShape.rectangle,
child: new ListView(
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
.....