Flutter SinglechildScrollview无法正常工作
我希望打开键盘时滚动页面可以工作,但是当打开键盘时它不起作用,用户需要查看他的键入内容,我正在制作登录页面,当键盘打开时,ScrollView将工作,我在另一个项目中使用了相同的代码,但是它在那里工作,它在我的项目中不起作用,这可能是什么原因?
编辑:我想做的是,当键盘弹出时,我应该能够滚动屏幕
我的代码:
Scaffold(
resizeToAvoidBottomInset: true,
body: Stack(
children: [
SafeArea(
child: SingleChildScrollView(
controller: scrollController,
child: Container(
padding: MediaQuery.of(context).size.width > webScreenSize
? EdgeInsets.symmetric(
horizontal: MediaQuery.of(context).size.width / 3)
: const EdgeInsets.symmetric(
horizontal: 15,
),
height: deviceHeight,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Padding(
padding: const EdgeInsets.only(top: 35.0),
child: SvgPicture.asset(
"assets/bahce.svg",
color: primaryColor,
height: 64.0,
),
),
Container(
height: deviceHeight * 0.65,
width: double.infinity,
margin: EdgeInsets.symmetric(horizontal: 20),
child: LayoutBuilder(
builder: (ctx, contsraints) {
return Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
SizedBox(
height: contsraints.maxHeight * 0.01,
),
Container(
.......
),
SizedBox(
height: contsraints.maxHeight * 0.05,
),
Container(
height: contsraints.maxHeight * 0.12,
...................
),
Container(
width: double.infinity,
height: contsraints.maxHeight * 0.12,
......button
),
SizedBox(
height: contsraints.maxHeight * 0.15,
),
RichText(
text: TextSpan(
......,
children: [
TextSpan(
..onTap = navigateToSignup,
),
],
),
),
],
);
},
),
),
],
),
),
),
),
],
),
);
I want the scroll page to work when the keyboard is opened, but it does not work when the keyboard is opened, the user needs to see what he is typing, I am making a login page, when the keyboard opens, the scrollview will work, I used the same code in my other project, but it works there, it just does not work in my project, what could be the reason for this?
Edit: What I want to do is, when the keyboard pops up, I should be able to scroll the screen
My Code:
Scaffold(
resizeToAvoidBottomInset: true,
body: Stack(
children: [
SafeArea(
child: SingleChildScrollView(
controller: scrollController,
child: Container(
padding: MediaQuery.of(context).size.width > webScreenSize
? EdgeInsets.symmetric(
horizontal: MediaQuery.of(context).size.width / 3)
: const EdgeInsets.symmetric(
horizontal: 15,
),
height: deviceHeight,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Padding(
padding: const EdgeInsets.only(top: 35.0),
child: SvgPicture.asset(
"assets/bahce.svg",
color: primaryColor,
height: 64.0,
),
),
Container(
height: deviceHeight * 0.65,
width: double.infinity,
margin: EdgeInsets.symmetric(horizontal: 20),
child: LayoutBuilder(
builder: (ctx, contsraints) {
return Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
SizedBox(
height: contsraints.maxHeight * 0.01,
),
Container(
.......
),
SizedBox(
height: contsraints.maxHeight * 0.05,
),
Container(
height: contsraints.maxHeight * 0.12,
...................
),
Container(
width: double.infinity,
height: contsraints.maxHeight * 0.12,
......button
),
SizedBox(
height: contsraints.maxHeight * 0.15,
),
RichText(
text: TextSpan(
......,
children: [
TextSpan(
..onTap = navigateToSignup,
),
],
),
),
],
);
},
),
),
],
),
),
),
),
],
),
);
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
直接删除其他韦德格人作为身体的孩子
Remove other widgers directly use sigle child scroll view as a child of body