【发布时间】:2020-10-03 20:37:11
【问题描述】:
大家好,我需要你的帮助,我只想在键盘弹出时隐藏图像小部件, 但是当我单击文本字段并打开键盘时,它会一直关闭,你能帮我解决这个问题吗?我附上我的代码谢谢!
import 'package:flutter/material.dart';
import 'package:ovsursadmin/screens/authentication/login_card.dart';
class Login extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.blue[900],
body: Container(
decoration: BoxDecoration(
image: DecorationImage(
image: ExactAssetImage('assets/bg-admin.png'),
fit: BoxFit.cover,
colorFilter: ColorFilter.mode(Colors.blue[900].withOpacity(0.1), BlendMode.dstATop),
)
),
child: SafeArea(
child: Container(
child : Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
SizedBox(height: 10.0,),
// this code i want to fix it keeps closing the keyboard when pops
MediaQuery.of(context).viewInsets.bottom != 0 ? Container() : Image.asset('assets/urs.png',
height: 100,
width: 100,),
SizedBox(height: 25.0,),
Text('Admin Login', style: TextStyle(color: Colors.white),),
Text('Online Voting System', style: TextStyle(color: Colors.white),),
LoginCard(),
],
)
),
),
),
);
}
}
This is my problem it keeps closing when you click the text field and open the keyboard
【问题讨论】:
-
在您的情况下通过关闭或打开方式弹出?
-
是的,打开键盘,
标签: image flutter keyboard widget hide