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

bqucvtff  于 4个月前  发布在  Flutter
关注(0)|答案(5)|浏览(56)

Flutter里面有个输入框,输入了以后头部顶起来了,如果只运行Flutter端代码就可以,要是Android和Flutter一起跑起来就不正常了,整个页面会顶起来。现在把原生的代码AndroidManifest.xml里面的

全部试了一遍都不行
这个是代码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),
),
);
}
}

aiazj4mn

aiazj4mn1#

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

4.4.2
9udxz4iz

9udxz4iz2#

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

muk1a3rh

muk1a3rh3#

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

ee7vknir

ee7vknir4#

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

vsdwdz23

vsdwdz235#

同问,请问后来怎么解决的

相关问题