如何在同一<widget>
内融合两个孩子Stack()
>例如,将其融合...
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(
答案 0 :(得分:0)
将列表平化为列表的...
运算符呢?例如:
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(),
],
)
);
}