【问题标题】:Align Persistentfooterbutton of Scaffold to the right side将 Scaffold 的 Persistentfooterbuttons 对齐到右侧
【发布时间】:2020-06-27 12:32:17
【问题描述】:

我想显示一个列表,并在其下方显示一个持久页脚,一个包含一些行的列。我使用 Scaffold 的 persistentFooterButtons。

与我得到的最接近的是:

但我无法将字段右对齐。 当我使用 Align 或 Spacer 时,小部件消失了。

persistentFooterButtons 的内容。

FittedBox(
  child: Column(
    children: <Widget>[
      FlatButton(
        onPressed: () {
          Navigator.pushNamed(context, RouteName.BAUSTELLEN);
        },
        child: Align(
          alignment: Alignment.bottomLeft,
          child: Text('Bestellen'),
        ),
      ),
      Row(
        children: <Widget>[
          Text('$priceInfo '),
          MyFutureBuilder(
            future: sum,
            builder: (context, double sum) {
              var mySum = formatDoubleNumber(sum);
              return Text('$mySum');
            },
          ),
          Container(
            width: ImpexStyle.horizontalPadding,
          ),
        ],
      ),
      Row(
        children: <Widget>[
          Text('Ihr Einkaufsrahmen '),
          Text(
            '$einkaufsrahmen',
            style: TextStyle(
                color: einkaufsrahmen == 0 ? Colors.red : Colors.black),
          ),
          Container(
            width: ImpexStyle.horizontalPadding,
          ),
        ],
      ),
    ],
  ),
);

如果我将元素直接放到persitentFooterButtons,这就是我得到的,文本散落一地,我的列表没有显示。

和守则

Scaffold(
  body: WarenkorbListe(),
  persistentFooterButtons: <Widget>[
    // WarenkorbFooter(),
              FlatButton(
        onPressed: () {
          Navigator.pushNamed(context, RouteName.BAUSTELLEN);
        },
        child: Align(
          alignment: Alignment.bottomLeft,
          child: Text('Bestellen'),
        ),
      ),
      Row(
        children: <Widget>[
          Text('$priceInfo '),
          Container(
            width: ImpexStyle.horizontalPadding,
          ),
        ],
      ),
      Row(
        children: <Widget>[
          Text('Ihr Einkaufsrahmen '),
          Text(
            '$einkaufsrahmen',
            style: TextStyle(
                color: einkaufsrahmen == 0 ? Colors.red : Colors.black),
          ),
          Container(
            width: ImpexStyle.horizontalPadding,
          ),
        ],
      ),

  ],
);

【问题讨论】:

    标签: flutter footer persistent scaffold


    【解决方案1】:

    尝试与您的列对齐

    FittedBox(
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.end, // this
        children: <Widget>[
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-03-25
      • 1970-01-01
      • 2022-12-29
      • 2017-04-27
      • 2018-07-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多