【问题标题】:How to add text at right to screen?如何在屏幕右侧添加文字?
【发布时间】:2022-11-04 17:50:38
【问题描述】:

我想在右侧添加报告问题文本我尝试了位置小部件,但它不起作用我做什么?

我试图实现-

代码-

Positioned(
right: 0,
child: Row(
children: [
    Icon(Icons.report, color: Color(0xff0E5487),),
    TextButton(onPressed: () => {}, child: Text("Report Question",
        style: cstmTextStyle(fs: 18, fc:Color(0xff0E5487) ),)),
],
),),

【问题讨论】:

  • 你能添加你的完整代码吗?
  • 您是否尝试过 mainAxisAlignment: MainAxisAlignment.end,在行小部件上

标签: flutter


【解决方案1】:

我的建议是使用ColumnSpacer 小部件而不是Stack。 我给你举了一个例子:

      Column(
          children: [
            Row(
              mainAxisSize: MainAxisSize.max,
              children: [
                Container(
                  color: Colors.green,
                  width: 160,
                  height: 160,
                ),
                const Spacer(),
                Container(
                  color: Colors.green,
                  width: 160,
                  height: 160,
                )
              ],
            ),
            const SizedBox(height: 8,),
            Row(
              mainAxisSize: MainAxisSize.max,
              children: const [
                Spacer(),
                Placeholder(fallbackWidth: 32, fallbackHeight: 32,),
                SizedBox(width: 8,),
                Text('Report Question')
              ],
            )
          ],
        ),

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-11-20
    • 1970-01-01
    • 1970-01-01
    • 2023-02-25
    • 1970-01-01
    • 2023-02-22
    • 1970-01-01
    相关资源
    最近更新 更多