【发布时间】:2019-07-22 22:39:03
【问题描述】:
我尝试将带有文本的容器放在 Stack 子级之外,但它仍然位于堆栈中的其他子级之下。我应该如何解决这个问题?
import 'package:flutter/material.dart';
class StoreFront extends StatefulWidget {
@override
_StoreFrontState createState() => _StoreFrontState();
}
class _StoreFrontState extends State<StoreFront> {
@override
Widget build(BuildContext context) {
return Container(
height: 150,
child: ListView(
scrollDirection: Axis.horizontal,
children: <Widget>[
Container(
margin: EdgeInsets.only(bottom: 10.0),
height: 80.0,
child: Stack(
children: <Widget>[
Container(
height: 800,
width: 370,
decoration: BoxDecoration(borderRadius: BorderRadius.all(Radius.circular(250.0))),
child: Image(
image: AssetImage("assets/images/newlookfront.png"),
fit: BoxFit.fill,
),
),
Positioned(
bottom: 60,
left: 65.0,
child: Row(
children: <Widget>[
Text("NEW LOOK", style: TextStyle(color: Colors.white70, fontSize: 35.0),)
],
),
),
],
),
),
Container(
child: Row(
children: <Widget>[
Text("New Look")
],
),
),
],
),
);
}
}
【问题讨论】: