下面是我的候选人_个人资料_屏幕. dart。
键盘打开时,我的文本字段被隐藏!
希望很快就能找到解决办法。
import 'package:flutter/material.dart';
import 'package:job_ifaserp/candidate_module/resouces/candidate_header.dart';
import 'package:job_ifaserp/commons/custom_wdgets.dart';
import 'models/candidate_master.dart';
class CandidateProfileScreen extends StatelessWidget {
final String? emailID;
final CandidateMaster? canMast;
CandidateProfileScreen({Key? key, this.canMast, this.emailID})
: super(key: key);
TextEditingController txtCandidateName = TextEditingController();
TextEditingController txtCandidateEmail = TextEditingController();
TextEditingController txtCandidateContact = TextEditingController();
TextEditingController txtCandidateSkill = TextEditingController();
TextEditingController txtCandidateAbout = TextEditingController();
@override
Widget build(BuildContext context) {
return Scaffold(
resizeToAvoidBottomInset: true,
appBar: AppBar(title: const Text('Jobseeker Profile'),),
body: Stack(
children: [
CandidateHeader(canMast: canMast, emailID: emailID),
Positioned(
top: 150,
left: 40,
child: Container(
width: 300,
height: 200,
child: const Text(
'Update Profile',
style: TextStyle(
fontSize: 25, fontWeight: FontWeight.bold),
),
)),
Positioned(
top: 190,
left: 40,
child: Container(
width: 350,
height: 75,
child: RoundedInput(icon: Icons.person,
hint: canMast!.can_name.toString(),
txtController: txtCandidateName,
onChangeText: (_) {})
)),
Positioned(
top: 250,
left: 40,
child: Container(
width: 350,
height: 75,
child: RoundedInput(icon: Icons.email,
hint: canMast!.can_email.toString(),
txtController: txtCandidateEmail,
onChangeText: (_) {})
)),
Positioned(
top: 310,
left: 40,
child: Container(
width: 350,
height: 75,
child: RoundedInput(icon: Icons.mobile_friendly,
hint: canMast!.can_mobn.toString(),
txtController: txtCandidateContact,
onChangeText: (_) {})
)),
Positioned(
top: 370,
left: 40,
//bottom: 310,
child: Container(
width: 350,
height: 75,
child: RoundedInput(icon: Icons.person_add,
hint: 'Your skill',
txtController: txtCandidateSkill,
onChangeText: (_) {})
)),
Positioned(
top: 430,
left: 40,
// bottom: 175,
child: Container(
width: 350,
height: 150,
child: RoundedInput(icon: Icons.tag,
hint: 'About me / Profile tag',
txtController: txtCandidateAbout,
onChangeText: (_) {})
)),
Positioned(
top: 600,
left: 80,
child: Container(
width: 250,
height: 60,
child: RoundedButton(title: 'Update', onPressRoundButton: () {})
)),
Positioned(
top: 670,
left: 80,
child: Container(
width: 250,
height: 60,
child: RoundedButton(title: 'Back', onPressRoundButton: () {
Navigator.pop(context);
})
)),
],
),
);
}
}
candidate_profile_screen.dart](https://i.stack.imgur.com/oWg0q.jpg)
我试过SingleChildScrollView,但没有效果。我也试过用AnimatedContainer Package ,但找不到方法。
我希望当键盘发生在屏幕上,而编辑文本字段,然后小部件不应该隐藏在键盘下。
1条答案
按热度按时间esyap4oy1#
我得到的答案如下。
我使用
height: MediaQuery.of(context).size.height
属性将AnimatedContainer
小部件与AnimatedContainer
Package 在一起。然后用
SingleChildScrollView
PackageAnimatedContainer
同时将
resizeToAvoidBottomInset: true
放在Scaffold
下面我的新代码如下
希望也会为你工作。
谢谢。