当我实现的时候,singlechildscrollview把所有的东西都推高了,有没有什么我可以做的来禁用bu的,或者有没有其他更简单的技术?
return Background(
child: SingleChildScrollView(
child: Column(
mainAxisAlignment:MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Text(
"Welcome to my App",
style: TextStyle(fontWeight: FontWeight.bold, color: kPrimaryColor,),
),
Center(
child: SvgPicture.asset(
"assets/icons/chat.svg",
height: size.height * 0.45,
),
),
SizedBox(height: size.height * 0.03),
RoundedButton(
text: "LOGIN",
press:
(){Navigator.push(context, MaterialPageRoute(builder: (context){
return LoginScreen();},),);},
),
RoundedButton(
text: "SIGN UP",
color: kPrimaryightColor,
textColor: Colors.black,
press: (){},
),
],
),
),
);发布于 2020-12-26 23:05:09
试试这个:
mainAxisAlignment:MainAxisAlignment.spaceEvenly,
crossAxisAlignment: CrossAxisAlignment.stetch,发布于 2020-12-26 23:40:07
您可以在列的顶部小部件上添加SizedBox(height: 100)小部件,也可以只编辑crossAxisAlignment & mainAxisAlignment
如下所示:
return Background(
child: SingleChildScrollView(
child: Column(
mainAxisAlignment:MainAxisAlignment.spaceEvenly,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
Text(
"Welcome to my App",
style: TextStyle(fontWeight: FontWeight.bold, color: kPrimaryColor,),
),
Center(
child: SvgPicture.asset(
"assets/icons/chat.svg",
height: size.height * 0.45,
),
),
SizedBox(height: size.height * 0.03),
RoundedButton(
text: "LOGIN",
press:
(){Navigator.push(context, MaterialPageRoute(builder: (context){
return LoginScreen();},),);},
),
RoundedButton(
text: "SIGN UP",
color: kPrimaryightColor,
textColor: Colors.black,
press: (){},
),
],
),
),
);https://stackoverflow.com/questions/65457454
复制相似问题