我正在尝试在具有响应宽度和高度的容器内显示图像。
这是我的代码:
...
child: Column (
mainAxisSize: MainAxisSize.min,
children: [
Row (
children: [
Padding (
padding: EdgeInsets.all(20),
child: Container(
height: MediaQuery.of(context).size.height *.3,
width: MediaQuery.of(context).size.width * 1,
padding: const EdgeInsets.all(15),
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage("assets/images/gunung.jpg"),
fit: BoxFit.cover,
...
Run Code Online (Sandbox Code Playgroud)
这是输出:
有什么解决办法吗?
我正在 ios 模拟器中运行我的应用程序,但为什么当我单击文本字段时我的键盘突然不显示?在我修复我的应用程序图标之前,它工作得很好。
尝试删除该应用并重新安装,但仍然不起作用。当我在 Android 上运行该应用程序并单击同一文本字段时,会显示键盘。
这是代码:
TextField(
keyboardType: TextInputType.multiline,
controller: inputTextController,
onChanged: (text) {
if (!_isWriting){
_isWriting = true;
//update typing status when type messages
var msg = {};
msg["api_key"] = apiKey;
msg["type"] = "status_typing";
msg["id_sender"] = idUser;
msg["id_receiver"] = idReceiver;
msg["room_id"] = conversation!.roomId;
String msgString = json.encode(msg);
homes.channel.sink.add(msgString);
setState((){});
Future.delayed(Duration(seconds: 2)).whenComplete((){
_isWriting = false;
setState((){});
});
}
},
maxLines: null,
style: TextStyle(
color: Colors.black,
),
decoration: InputDecoration(
contentPadding: EdgeInsets.only(top: 13, bottom: 13),
border: InputBorder.none,
hintText: 'Type a message', …Run Code Online (Sandbox Code Playgroud)