【问题标题】:how to implement textfield inside tile flutter如何在瓷砖颤动中实现文本字段
【发布时间】:2021-06-25 00:16:17
【问题描述】:

嗨,我需要设计这个页面

但我是 Flutter 的新手,所以我很难做到这一点

这是我的尝试

Container (
      child: Column (
        children: <Widget> [
          Container(
            margin: EdgeInsets.all(20),
            child: Text(
              "Source Account",

              style: TextStyle(fontSize: 30,
                  color: Color(0xff8aa1ba)),
            ),
          ),
          Container(
            height: 100,
            child: Card(


              color: Color(0xff343b4b),

              clipBehavior: Clip.antiAlias,

              elevation: 10,
              margin: EdgeInsets.all(7),
              child: Column(
                children: <Widget>[
                  ListTile(

                    title: Text("Main Account 123456",


                      style: TextStyle(
                          color: Colors.white,
                          fontSize: 15, fontWeight: FontWeight.bold),textAlign: TextAlign.left,),
                    subtitle: Text("  Available Balance \n 10.000.9 KWD" ,
                      style: TextStyle(
                          color: Colors.white,
                          fontSize: 15, fontWeight: FontWeight.bold),textAlign: TextAlign.right,),
                  ),

                ],
              ),
            ),

          
          ),

        ],
      ),
    )

任何人都可以帮助我实现这一点,或者让我了解如何在列表磁贴或卡片中实现文本字段

【问题讨论】:

标签: flutter dart flutter-layout


【解决方案1】:

在您的标题中添加一行。所以用这样的东西替换你的代码:

ListTile(
        title: Row(
          children: <Widget>[
            Expanded(
              child: TextField(
                // your TextField's Content
              ),
            ),
          ],
        ),

【讨论】:

    【解决方案2】:
      Card(color: Colors.grey, child: Container(
          padding: EdgeInsets.symmetric(vertical: 4, horizontal: 8), child: Column(
            mainAxisSize: MainAxisSize.min,
            children: [
            Row(
              mainAxisAlignment: MainAxisAlignment.spaceBetween,
              children: [
                Text("Loans", style: TextStyle(color: Colors.white, fontWeight: FontWeight.w500,),),
                Column(children: [
                  Icon(Icons.add),
                  Text("Amount", style: TextStyle(color: Colors.white,),)
                ])
              ]
            ),
            Container(
              decoration: BoxDecoration(
                border: Border.all(color: Colors.black), 
                borderRadius: BorderRadius.circular(2),
              ),
              padding: EdgeInsets.symmetric(horizontal: 16),
              child: TextField(
                decoration: InputDecoration(
                  border: InputBorder.none,
                ),
                style: TextStyle(color: Colors.white),
                textAlign: TextAlign.end,
              ),
            )
          ]),
        ),)
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-12-14
      • 1970-01-01
      • 1970-01-01
      • 2021-04-10
      • 2021-03-04
      • 1970-01-01
      相关资源
      最近更新 更多