Flutter 在颤振中获得容器内部的咔哒声 堆栈( 儿童:[ getChartView(widget.globalData.chartSelectValue), 容器( 装饰:盒子装饰( 边界:边界( 颜色:HexColor(“#0C1C3B”),//堆栈( 儿童:[ 手势检测器( 子:容器( 装饰:盒子装饰( 边界:边界( 颜色:HexColor(#0C1C3B”), 宽度:10.0, ), ), 宽度:MediaQuery.of(context).size.width, 高度:MediaQuery.of(context).size.height-280, ), onTap:() { getChartView(widget.globalData.chartSelectValue); }, ) ], ),
是的,我得到了我的答案。这不是一个好的解决方案,但它完全满足了我现在的需要:)Flutter 在颤振中获得容器内部的咔哒声 堆栈( 儿童:[ getChartView(widget.globalData.chartSelectValue), 容器( 装饰:盒子装饰( 边界:边界( 颜色:HexColor(“#0C1C3B”),//堆栈( 儿童:[ 手势检测器( 子:容器( 装饰:盒子装饰( 边界:边界( 颜色:HexColor(#0C1C3B”), 宽度:10.0, ), ), 宽度:MediaQuery.of(context).size.width, 高度:MediaQuery.of(context).size.height-280, ), onTap:() { getChartView(widget.globalData.chartSelectValue); }, ) ], ),,flutter,dart,flutter-layout,Flutter,Dart,Flutter Layout,是的,我得到了我的答案。这不是一个好的解决方案,但它完全满足了我现在的需要:) 堆栈( 儿童:[ getChartView(widget.globalData.chartSelectValue), 容器( 装饰:盒子装饰( 边界:边界( 颜色:HexColor(“#0C1C3B”),//您可能需要检查您的层次结构,您的视图在彼此上方呈现的方式会导致您正在使用堆栈。另一个视图可能会获得冲动,而不是getChartView(..),或者您可以使用InkWell,它将处理点击事件并设置动作动画 Ink
堆栈(
儿童:[
getChartView(widget.globalData.chartSelectValue),
容器(
装饰:盒子装饰(
边界:边界(
颜色:HexColor(“#0C1C3B”),//您可能需要检查您的层次结构,您的视图在彼此上方呈现的方式会导致您正在使用堆栈。另一个视图可能会获得冲动,而不是getChartView(..),或者您可以使用InkWell,它将处理点击事件并设置动作动画
InkWell(
onTap: () {
getChartView(widget.globalData.chartSelectValue);
},
child: Container(
decoration: BoxDecoration(
border: Border.all(
color: HexColor("#0C1C3B"),
width: 10.0,
),
),
width: MediaQuery.of(context).size.width,
height: MediaQuery.of(context).size.height - 280,
),
),
试试看,我想你没有完全理解我的问题。我必须在堆栈内的小部件>>两个大小相同,我只需要getChartView()周围的框架。你想实现getChartView(widget.globalData.chartSelectValue)
这个方法,这将返回一个小部件,对吗?谢谢你的时间。我想要一个getChartView周围的框架。
Stack(
children: <Widget>[
getChartView(widget.globalData.chartSelectValue),
Container(
decoration: BoxDecoration(
border: Border.all(
color: HexColor("#0C1C3B"), // <--- border color
width: 10.0,
),
),
width: 10,
height: MediaQuery.of(context).size.height - 260,
),
Align(
alignment: Alignment.centerRight,
child: Container(
decoration: BoxDecoration(
border: Border.all(
color: HexColor("#0C1C3B"), // <--- border color
width: 10.0,
),
),
width: 10,
height: MediaQuery.of(context).size.height - 260,
),
),
Align(
alignment: Alignment.bottomCenter,
child: Container(
decoration: BoxDecoration(
border: Border.all(
color: HexColor("#0C1C3B"), // <--- border color
width: 10.0,
),
),
width: MediaQuery.of(context).size.width,
height: 10,
),
),
Align(
alignment: Alignment.topCenter,
child: Container(
decoration: BoxDecoration(
border: Border.all(
color: HexColor("#0C1C3B"), // <--- border color
width: 10.0,
),
),
width: MediaQuery.of(context).size.width,
height: 10,
),
),
Align(
alignment: Alignment.bottomRight,
child: Container(
alignment: Alignment.center,
color: Colors.transparent,
width: 85,
height: 35,
child: Image.asset(
"assets/img/ic_logo.png",
width: 20.0,
height: 20.0,
alignment: Alignment.center,
),
),
),
],),
InkWell(
onTap: () {
getChartView(widget.globalData.chartSelectValue);
},
child: Container(
decoration: BoxDecoration(
border: Border.all(
color: HexColor("#0C1C3B"),
width: 10.0,
),
),
width: MediaQuery.of(context).size.width,
height: MediaQuery.of(context).size.height - 280,
),
),