flutter - 使用Flutter向下滚动时如何隐藏带有动画的小部件

标签 flutter dart

我有两个Icons Buttons的问题,如下图所示:
Icons Buttons
当我向下滚动直到另一个小部件(例如, map 或Graph)出现时,这里的问题Icons Buttons如下图所示:
result
所以我有一个想法是在向下滚动时隐藏这些按钮,在滚动带有动画的应用程序时再次显示它们,但是我不知道该怎么做。
这与下面的相关代码:

return Scaffold(
        body: Stack(
          alignment: AlignmentDirectional.bottomCenter,
          children: [
            Container(
              height: double.infinity,
              child: SingleChildScrollView(
                child: Column(
                  children: [
                    Padding(
                      padding: const EdgeInsets.only(
                        top: 85,
                        left: 10,
                      ),
                      child: Column(
                        crossAxisAlignment: CrossAxisAlignment.stretch,
                        children: <Widget>[
                          Text(
                            'Sim information',
                            style: TextStyle(fontWeight: FontWeight.bold),
                          ),
                          DataTable(
                            headingRowHeight: 20,
                            columnSpacing: 83,
                            dataRowHeight: double.parse('20'),
                            columns: [
                              DataColumn(
                                  label: Text(
                                'Sim operator',
                                style: TextStyle(color: Colors.black),
                              )),
                              DataColumn(
                                label: Row(
                                  children: <Widget>[
                                    Text(
                                      simInfo.operator == null
                                          ? ' '
                                          : simInfo.operator,
                                      style: TextStyle(color: Colors.black),
                                    ),
                                  ],
                                ),
                              ),
                            ],
                            rows: [
                              DataRow(cells: [
                                DataCell(Row(
                                    Text('ICCID'),
                                  ],
                                )),
                                DataCell(
                                    Text(simInfo == null ? '' : simInfo.iccid)),
                              ]),
                            ],
                          ),
                        ],
                      ),
                    ),
                    //Network provider
                    Padding(
                      padding: const EdgeInsets.only(
                        top: 20,
                        left: 10,
                      ),
                      child: Column(
                        crossAxisAlignment: CrossAxisAlignment.stretch,
                        children: <Widget>[
                          Text(
                            'Network Provider',
                            style: TextStyle(fontWeight: FontWeight.bold),
                          ),
                          DataTable(
                            headingRowHeight: 20,
                            columnSpacing: 120,
                            dataRowHeight: double.parse('20'),
                            columns: [
                              DataColumn(
                                  label: Text(
                                'Operator',
                                style: TextStyle(color: Colors.black),
                              )),
                              DataColumn(
                                label: Text(
                                  simInfo == null ? '' : simInfo.operator,
                                  style: TextStyle(color: Colors.black),
                                ),
                              ),
                            ],
                            rows: [
                              DataRow(cells: [
                                DataCell(Row(
                                  children: <Widget>[
                                    Text('MCC'),
                                  ],
                                )),
                                DataCell(
                                  Text(simInfo == null
                                      ? ''
                                      : simInfo.mcc.toString()),
                                ),
                              ]),
                              DataRow(cells: [
                                DataCell(Text('MNC')),
                                DataCell(
                                  Text(simInfo == null
                                      ? ''
                                      : simInfo.mnc.toString()),
                                ),
                              ]),
                            ],
                          ),
                        ],
                      ),
                    ),
                    //Serving Cell
                    Padding(
                      padding: const EdgeInsets.only(
                        top: 20,
                        left: 10,
                      ),
                      child: Column(
                        crossAxisAlignment: CrossAxisAlignment.stretch,
                        children: <Widget>[
                          Text(
                            'Serving Cell',
                            style: TextStyle(fontWeight: FontWeight.bold),
                          ),
                          DataTable(
                              columnSpacing: 120,
                              headingRowHeight: 20,
                              dataRowHeight: double.parse('20'),
                              columns: [
                                DataColumn(
                                    label: Text(
                                  'Data type',
                                  style: TextStyle(color: Colors.black),
                                )),
                                DataColumn(
                                  label: Text(
                                    _baseStation == null
                                        ? ''
                                        : _baseStation.type.toString(),
                                    style: TextStyle(color: Colors.black),
                                  ),
                                ),
                              ],
                              rows: [
                                DataRow(cells: [
                                  DataCell(
                                    Text('TYPE'),
                                  ),
                                  DataCell(
                                    Text(_baseStation.type.toString()),
                                  ),
                                ]),
                                DataRow(cells: [
                                  DataCell(
                                    Text('CId'),
                                  ),
                                  DataCell(
                                    Text(_baseStation.cid.toString()),
                                  ),
                                ]),
                                DataRow(cells: [
                                  DataCell(
                                    Text('TAC'),
                                  ),
                                  DataCell(
                                    Text(_baseStation == null
                                        ? ''
                                        : _baseStation.tac.toString()),
                                  ),
                                ]),
                                DataRow(cells: [
                                  DataCell(
                                    Text('PCI'),
                                  ),
                                  DataCell(
                                    Text(_baseStation.bsicPscPci.toString()),
                                  ),
                                ]),
                                DataRow(cells: [
                                  DataCell(
                                    Text('LAC'),
                                  ),
                                  DataCell(
                                    Text(_baseStation.lac.toString()),
                                  ),
                                ]),
                                DataRow(cells: [
                                  DataCell(
                                    Text('MCC'),
                                  ),
                                  DataCell(
                                    Text(_baseStation.mcc.toString()),
                                  ),
                                ]),
                                DataRow(cells: [
                                  DataCell(
                                    Text('MNC'),
                                  ),
                                  DataCell(
                                    Text(_baseStation.mnc.toString()),
                                  ),
                                ]),
                              ]),
                          if (_baseStation.type == 'GSM')
                            Padding(
                              padding: const EdgeInsets.only(
                                left: 0,
                              ),
                              child: GSMStationFields(_baseStation),
                            ),
                          if (_baseStation.type == 'LTE')
                            Padding(
                              padding: const EdgeInsets.only(
                                left: 0,
                              ),
                              child: LTEStationFields(_baseStation),
                            ),
                        ],
                      ),
                    ),
                    Padding(
                      padding: const EdgeInsets.only(top: 20),
                      child: SignalStrengthGraph(),
                    ),
                  ],
                ),
              ),
            ),
            if (activeSlotsSize > 1)
              Positioned(
                bottom: 0,
                child: SizedBox(
                  width: MediaQuery.of(context).size.width,
                  child: RadioBtnSim(changeSlot),
                ),
              ),
          ],
        ),
      );
这是我称之为问题的小部件部分:
Padding(
                      padding: const EdgeInsets.only(top: 20),
                      child: SignalStrengthGraph(),
                    ),
那么,还有其他解决方案或想法可以解决此问题吗?
我希望这足够清楚,有人建议我:)

最佳答案

您可以将Visibility小部件与动画一起使用,并为可见性动画提供时间。

关于flutter - 使用Flutter向下滚动时如何隐藏带有动画的小部件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63596727/

相关文章:

Flutter 删除 GridView 行之间的空间

android - Flutter Audioplayer APK版本不起作用

dart - 如何按调用顺序运行多个异步函数(FIFO?)

flutter - 如何在 Google 表格中接受可变数量的参数

flutter - 状态错误 : field does not exist within the DocumentSnapshotPlatform Flutter Firestore

firebase - 使用Firestore快照中的StreamController的StreamBuilder

java - 无法在 "/Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/jarsigner"找到可执行文件

flutter - 无法使用Provider.of(context)调用类方法

flutter - 打开键盘时如何推送所有内容

ios - 如何在 Flutter 中的原生 iOS 代码中使用打印方法?