简体   繁体   English

如何在 appbar 操作小部件内部添加文本字段?

[英]How to add textfield in inside appbar action widget?

When i am trying to add textfield in Appbar, inside action widget, its showing error like "RenderBox was not laid out: RenderRepaintBoundary#a81ba NEEDS-LAYOUT NEEDS-PAINT", Have u guys anyone know how to add textfield in appbar, inside actions, please add,当我尝试在 Appbar 中添加文本字段时,在操作小部件内,它显示错误,如“RenderBox 未布局:RenderRepaintBoundary#a81ba NEEDS-LAYOUT NEEDS-PAINT”,你们有没有人知道如何在 appbar 中添加文本字段,在操作中, 请加,

When i am trying to add当我试图添加

             actions:[
            TextField()
               ],

The error is like错误就像

               ════════ Exception caught by rendering library 
                ═════════════════════════════════
        RenderBox was not laid out: RenderRepaintBoundary#a81ba NEEDS-LAYOUT NEEDS-PAINT
          'package:flutter/src/rendering/box.dart':
     package:flutter/…/rendering/box.dart:1
      Failed assertion: line 1982 pos 12: 'hasSize'

You need to give it some width ( height is optional) like:你需要给它一些widthheight是可选的),比如:

actions: [
  SizedBox(
    width: 50,
    child: TextField(),
  )
]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM