flutter得Positioned出现不生效得情况
class stack_item extends StatelessWidget{
BuildContext? get context => null;
@override
Widget build(BuildContext context){
late final screenSize = MediaQuery.of(context!).size;
late final screenW = screenSize.width;
late final screenH = screenSize.height;
print("h:$screenH,w:$screenW");
return Container(
width:screenW
,height:screenH,
child:Scaffold(
body: Stack(
fit: StackFit.expand,
children: [
Positioned(
left:0.0,
top: 0.0,
child: NavShow(width_temp: screenW,height_temp: screenH,)),
Positioned(bottom:0.0,left:0.0,child:nav_bottom_show(width_temp: screenW,height_temp: screenH,) ),
Positioned(left: 0.5,bottom: 0.0,child: Sliders_item(width_temp: screenW,height_temp: screenH,),),
Positioned(right: 0.2,top: 0.0,child: top_nav(width_temp: screenW,height_temp: screenH,),)
],
)),
);
}
}
最后得组件中得top_nav出现了不生效得情况
也就右上角得蓝色区域没有发生位移