[英]Flutter two children: <Widget> inside same Stack()
如何在同一個Stack()
融合兩個孩子<widget>
> 例如,融合這個......
Stack(
children: <Widget>[
GoogleMap(
initialCameraPosition:
CameraPosition(target: LatLng(currentLocation.latitude,
currentLocation.longitude), zoom: 17),
onMapCreated: _onMapCreated,
myLocationEnabled: true,
mapType: _currentMapType,
markers: Set<Marker>.of(markers.values),
),
Padding(
有了這個:
Stack(
children: <Widget>[
// Replace this container with your Map widget
Container(
color: Colors.black,
),
Positioned(
將列表扁平化為列表的...
運算符呢...
例如:
List<Widget> getFirstStackChildren() {
return [
Text("first stack first child"),
Text("first stack second child")
];
}
List<Widget> getSecondStackChildren() {
return [
Text("second stack first child"),
Text("second stack second child")
];
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: Stack(
children: <Widget>[
...getFirstStackChildren(),
...getSecondStackChildren(),
],
)
);
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.