简体   繁体   English

我想用listview创建一个颤动的应用程序

[英]I want to create a flutter app with a listview

I need to create an app that looks like this Flutter design . 我需要创建一个看起来像这个Flutter设计的应用程序。

I'm struggling to place the text where I want. 我正在努力将文字放在我想要的地方。 This is my code so far 到目前为止这是我的代码

     body: Padding(
    padding: const EdgeInsets.all(0.1),
    child: new Container(
      child: new Center(
       child: new ListView(

          children: <Widget>[

            new Card(//card 1

              child: new Container(
                color: Colors.grey,
                padding: new EdgeInsets.only(
                    left: 160.0, top: 0.01, right: 160.0, bottom: 0.01),
                child: new Column(

                  children: <Widget>[
                    new Text('My Profile')
                  ],
                ),
              ),
            ),

          ],
        ),

      )
    ),
  )

Your large padding of 160 made it seem like the text was centered on my device. 160大填充使得文本看起来像是在我的设备上。 You can always align the text to the left inside Column s by setting crossAxisAlignment to CrossAxisAlignment.start . 你总是可以对齐文本向左内侧Column通过设定S1 crossAxisAlignmentCrossAxisAlignment.start

This code should produce some output that is similar to your drawing (I also removed some unnecessary Center s, Container s and Padding s): 这段代码应该产生一些类似于你的绘图的输出(我还删除了一些不必要的CenterContainerPadding ):

Scaffold(
  appBar: AppBar(),
  body: ListView(
    padding: const EdgeInsets.all(0.1),
    children: <Widget>[
      Card(
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.start,
          children: <Widget>[
            Container(
              padding: const EdgeInsets.symmetric(horizontal: 16),
              width: double.infinity,
              color: Colors.grey,
              child: Text('My Profile'),
            ),
            Padding(
              padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
              child: Text('My text\nMy text\nMy text\nMy text'),
            ),
          ],
        ),
      ),
    ],
  ),
);

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

相关问题 我想在 Flutter 上创建这样的应用栏 - i want to create like this app bar on Flutter 我想应用 Flutter ListView - I want to apply Flutter ListView 我想在 flutter 中创建一个带有 firebase 的列表视图,它将显示标题副标题和图像,并且当用户单击将打开 web 视图的列表视图时 - i want to create a listview with firebase in flutter that will show title subtitle and image and when user click on listview that will open a webview 我想在 flutter 中创建一个聊天应用程序 - I want to create a chatapp in flutter 如何用flutter创建一个超级应用? 可以用包来做吗..我想要一个可以引用其他应用程序的应用程序 - How to create a super app with flutter? Is it possible to do it with packages.. I want an app that will reference other apps 我想在 Flutter 中创建为照片抽屉 - I want to create as a photo drawer in Flutter Flutter - 我想创建自定义 TextFomrField 边框 - Flutter - I want to create a custom TextFomrField border 我想在 flutter 中创建一个曲线底部应用栏? - I want to create a curve bottom appbar in flutter? 我想解决在 Flutter App 中构建失败的问题 - I want to solve the failure of build in Flutter App 我想更改 flutter 应用程序的背景颜色? - I want to change the background color of a flutter app?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM