Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flutter里面有个输入框,输入了以后头部顶起来了 #1984

Open
m897329202aa opened this issue Mar 8, 2024 · 4 comments
Open

Comments

@m897329202aa
Copy link

Flutter里面有个输入框,输入了以后头部顶起来了,如果只运行Flutter端代码就可以,要是Android和Flutter一起跑起来就不正常了,整个页面会顶起来。现在把原生的代码AndroidManifest.xml里面的
645C6CFB-CABA-4099-BA43-FE036C406296
全部试了一遍都不行
这个是代码class FarmDetailPage extends StatefulWidget {
const FarmDetailPage({super.key});

@OverRide
State createState() => _FarmDetailPageState();
}

class _FarmDetailPageState extends State {

@OverRide
Widget build(BuildContext context) {
return Scaffold(
resizeToAvoidBottomInset: false, // 添加这一行
appBar: const CustomAppBar(title: "牧场档案"),
body: SingleChildScrollView(
child: Container(
decoration: const BoxDecoration(color: MyColor.yellowFACD91),
child: Column(
children: [
const SizedBox(
height: 40,
child: Center(
child: Text("2023-07-01 后将无法修改和删除",
style:
TextStyle(color: MyColor.yellowFFF0DB, fontSize: 14)),
),
),
Container(
height: 50,
margin: const EdgeInsets.only(left: 15),
child: const Align(
alignment: Alignment.centerLeft,
child: Text("养殖场信息",
style: TextStyle(
color: MyColor.colorFF333333,
fontSize: 15,
fontWeight: FontWeight.bold)),
),
),
Container(
height: 60,
decoration: const BoxDecoration(
color: Colors.white,
borderRadius:
BorderRadiusDirectional.all(Radius.circular(10))),
child: Column(
children: [
SizedBox(
height: 60,
child: Row(
children: [
const SizedBox(width: 15),
const Align(
alignment: Alignment.centerLeft,
child: Text("牧场类型",
style: TextStyle(
fontSize: 15,
color: MyColor.colorFF666666)),
),
const SizedBox(width: 10),
Expanded(
flex: 1, child: InputText(onSearch: (value) {
})),
const SizedBox(width: 15),
],
),
)
],
),
)
],
),
),
),
);
}
}

InputText这个源码class InputText extends StatefulWidget {
final ValueChanged onSearch;
String? searchHint;

InputText({super.key, this.searchHint = "请输入", required this.onSearch});

@OverRide
State createState() => _InputTextState();
}

class _InputTextState extends State {
late TextEditingController _controller;

@OverRide
void initState() {
super.initState();
_controller = TextEditingController();
}

@OverRide
Widget build(BuildContext context) {
return TextField(
controller: _controller,
textAlignVertical: TextAlignVertical.center,
textAlign: TextAlign.end,
onChanged: (value) {
widget.onSearch(value);
},
decoration: InputDecoration(
filled: true,
fillColor: MyColor.colorF5f7fa,
contentPadding: const EdgeInsetsDirectional.all(10),
hintText: widget.searchHint,
isDense: true,
isCollapsed: true,
counterStyle: const TextStyle(color: Colors.black),
),
);
}
}

@m897329202aa
Copy link
Author

使用的FlutterBoost版本是: flutter_boost:
git:
url: 'https://github.com/alibaba/flutter_boost.git'
ref: '4.4.2'

  4.4.2

@joechan-cq
Copy link
Collaborator

我是用上面的代码+4.5.4并没有复现你说的问题,你可以用最新的版本试一下

@m897329202aa
Copy link
Author

你好,请问你的是单独Flutter跑起来测试的吗?我这单独Flutter跑起来没有问题,就是混合开发以后Android+Flutter混合开发跑起来就有问题了

@joechan-cq
Copy link
Collaborator

用example混合项目跑起来看的。你可以试试把你的代码,放到example中去,能不能复现。能的话,提供一下修改后的整个项目源码

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants