首页 > 解决方案 > 如何在任何列表视图项目中间添加卡片 - 颤动?

问题描述

我正在尝试这样做(图片)我正在尝试创建一个博客页面,我需要在 ListView 本身中进行一些即时修改(管理端)。

试过(代码) ... 可扩展的 ListView - 加载和滚动也需要时间 - 其中包含 Textfield 和其中的一些按钮(更新、删除和取消)

import 'package:flutter/material.dart';

class ExpandableList extends StatefulWidget {
  @override
  _ExpandableListState createState() => _ExpandableListState();
}

class _ExpandableListState extends State<ExpandableList> {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: new Scaffold(
        body: new ListView.builder(
          itemCount: 20,
          itemBuilder: (context, i) {
            return new ExpansionTile(
              title: new Text('item$i', style: new TextStyle(fontSize: 20.0, fontWeight: FontWeight.bold, fontStyle: FontStyle.italic),),
              children: <Widget>[
                new Column(
                  children: [TextField(),
                  Row(
                    children: [
                      IconButton(icon: Icon(Icons.update), onPressed: null),
                      IconButton(icon: Icon(Icons.remove), onPressed: null),
                      IconButton(icon: Icon(Icons.cancel), onPressed: null)
                    ],
                  )],
                ),
              ],
            );
          },
        ),
      ),
    );
  }
}

我的要求是在我(仅)单击的项目下方获取该卡,否则不应使用该项目列表进行预构建。

标签: androidflutterlistviewdart

解决方案


推荐阅读