我需要你的帮助,我有一个移动应用程序,当键入输入字段,键盘覆盖输入字段,它不滚动用户输入文本。请参阅下面正在讨论的代码。下面是一个示例,你能告诉问题出在哪里吗?(注意这是一款扑扑app)
AppTextField( controller: emailController, focus: emailFocus, textFieldType: TextFieldType.EMAIL, decoration: inputDecoration(context, hint: appLocalization.translate('email')), nextFocus: widget.phoneNumber != null ? null : passFocus, errorThisFieldRequired: appLocalization.translate('field_Required'), errorInvalidEmail: appLocalization.translate('email_Validation'), maxLines: 1, cursorColor: colorPrimary, ).paddingBottom(16),
您需要将scrollview设置为父SingleChildScrollView,然后在子级中设置登录和注册字段,如下所示:
import 'package:flutter/material.dart';
import 'package:fluttertoast/fluttertoast.dart';
class LoginScreen extends StatefulWidget {
@override
_LoginScreen createState() => _LoginScreen();
}
class _LoginScreen extends State<LoginScreen> {
final _formKey = GlobalKey<FormState>();
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white,
appBar: AppBar(
title: Text("Login"),
),
body: Form(
child: SingleChildScrollView(
key: _formKey,
physics: ClampingScrollPhysics(),
child: Container(
padding: const EdgeInsets.only(bottom: 8),
child: Column(
children: <Widget>[
Container(
padding: const EdgeInsets.fromLTRB(15, 0, 15, 0),
child: Align(
alignment: Alignment.topCenter,
// child: TextField(decoration: InputDecoration(labelText: 'Full name')),
child: TextFormField(
validator: (value) {
if (value == null || value.isEmpty) {
return 'Please enter email';
}
return null;
},
decoration: InputDecoration(
labelText: 'Email',
labelStyle: TextStyle(
color: Colors.blue,
fontSize: 16,
fontStyle: FontStyle.normal),
enabledBorder: UnderlineInputBorder(
borderSide: BorderSide(color: Colors.blue),
),
),
// autofocus: true,
),
),
),
Container(
padding: const EdgeInsets.fromLTRB(15, 0, 15, 0),
child: Align(
alignment: Alignment.topCenter,
// child: TextField(decoration: InputDecoration(labelText: 'Full name')),
child: TextFormField(
validator: (value) {
if (value == null || value.isEmpty) {
return 'Please enter password';
}
return null;
},
obscureText: true,
// obscuringCharacter: "*",
decoration: InputDecoration(
labelText: 'Password',
labelStyle: TextStyle(
color: Colors.blue,
fontSize: 16,
fontStyle: FontStyle.normal),
enabledBorder: UnderlineInputBorder(
borderSide: BorderSide(
color: Colors.blue,
),
),
),
),
),
),
Container(
padding: const EdgeInsets.fromLTRB(15, 30, 15, 20),
child: Align(
alignment: Alignment.center,
child: SizedBox(
width: double.maxFinite,
height: 45,
child: ElevatedButton(
child: Text('LOGIN'),
style: ElevatedButton.styleFrom(
primary: Colors.blue,
onPrimary: Colors.white,
textStyle: TextStyle(
color: Colors.black,
fontSize: 17,
fontStyle: FontStyle.normal),
),
onPressed: () {
// Toast.show('LOGIN...', context);
Fluttertoast.showToast(
msg: "LOGIN...",
toastLength: Toast.LENGTH_SHORT,
gravity: ToastGravity.BOTTOM,
timeInSecForIosWeb: 1,
backgroundColor: Colors.grey,
textColor: Colors.white,
fontSize: 16.0);
if (_formKey.currentState!.validate()) {
// If the form is valid, display a Snackbar.
Scaffold.of(context).showSnackBar(
SnackBar(content: Text('Validation Success!')));
} else {
Scaffold.of(context).showSnackBar(
SnackBar(content: Text('Validation error!')));
}
},
),
),
),
),
],
),
),
),
),
);
}
}
试用这段代码,希望对您有帮助。
安装帮助 有关安装问题的帮助信息,请访问安装支持中心,网址是 www.adobe.com/go/cs4install_cn。 许可激活 在安装过程中,您的 Adobe 软件会联系 Adobe 以完成许可激活过程。不会传输个人数据。有关产品激活的详细信息,请访问 Adobe 官方网站 www.adobe.com/go/activation_cn。 单用户零售许可激活支持两台计算机。例如,您可以在办公
我正在做一个使用优步Cadence Java客户端的项目。如何从代码中获取注册活动的列表? 谢谢你。
问题内容: 我有一个用CSS3进行动画处理的条形图,当前该动画在页面加载时激活。 我的问题是,由于之前有很多内容,因此给定的条形图不在屏幕上,因此当用户向下滚动到该条形图时,动画已经结束。 我正在寻找通过CSS3或jQuery仅在查看者看到图表时激活条形图上的CSS3动画的方法。 如果在页面加载后立即快速向下滚动,则可以看到该动画。 另外,我不知道这是否重要,但是我在页面上有此条形图的多个实例。
问题内容: 我有一个网站,有一个用户系统。我想将wordpress的用户系统集成到该网站的系统中,但是我仍然想使用该网站的注册/登录页面。我不希望任何人都能使用Wordpress的登录或注册表格进行登录或注册。相反,当他们尝试访问Wordpress中的登录/注册页面时,我希望这些页面将它们重定向到我自己的登录/注册页面。 有什么办法吗?我已经尝试过Google,但是我所能找到的只是在用户登录或注册
问题内容: 我想要在spring成功注册后自动登录:我有一个受保护的页面,需要登录才能访问它们,我要在注册后跳过登录页面并进行自动登录,以便用户可以看到受保护的页面有我吗?我正在使用spring 3.0,spring security 3.0.2,该怎么做? 问题答案: 可以通过以下方式(半伪代码)通过spring安全性完成此操作: 更新:仅包含注册后如何创建会话
我正在尝试在用户注册后自动登录。 我的用户注册方法: 我的用户实体模型: 用户注册成功并记录在数据库中。但要登录,将显示以下错误: SessionGuard中的ErrorException。php第407行:传递给illumb\Auth\SessionGuard::login()的参数1必须是illumb\Contracts\Auth\authenticable的实例,给定的App\User\u实