Ejemplo n.º 1
0
        IEnumerable <Widget> _detailItemsFor(Section section)
        {
            IEnumerable <Widget> detailItems = section.details.Select <SectionDetail, Widget>((SectionDetail detail) => {
                return(new SectionDetailView(detail: detail));
            });

            return(ListTile.divideTiles(context: this.context, tiles: detailItems));
        }
Ejemplo n.º 2
0
        public override Widget build(BuildContext context)
        {
            string layoutText   = _dense ? " \u2013 Dense" : "";
            string itemTypeText = "";

            switch (_itemType)
            {
            case _MaterialListType.oneLine:
            case _MaterialListType.oneLineWithAvatar:
                itemTypeText = "Single-line";
                break;

            case _MaterialListType.twoLine:
                itemTypeText = "Two-line";
                break;

            case _MaterialListType.threeLine:
                itemTypeText = "Three-line";
                break;
            }

            IEnumerable <Widget> listTiles = items.Select <string, Widget>((string item) => buildListTile(context, item));

            if (_showDividers)
            {
                listTiles = ListTile.divideTiles(context: context, tiles: listTiles);
            }

            return(new Scaffold(
                       key: scaffoldKey,
                       appBar: new AppBar(
                           title: new Text($"Scrolling list\n{itemTypeText}{layoutText}"),
                           actions: new List <Widget>
            {
                new MaterialDemoDocumentationButton(ListDemo.routeName),
                new IconButton(
                    icon: new Icon(Icons.sort_by_alpha),
                    tooltip: "Sort",
                    onPressed: () =>
                {
                    setState(() =>
                    {
                        _reverseSort = !_reverseSort;
                        items.Sort((string a, string b) => _reverseSort ? b.CompareTo(a) : a.CompareTo(b));
                    });
                }
                    ),
                new IconButton(
                    icon: new Icon(
                        Theme.of(context).platform == RuntimePlatform.IPhonePlayer
                                    ? Icons.more_horiz
                                    : Icons.more_vert
                        ),
                    tooltip: "Show menu",
                    onPressed: _bottomSheet == null ? _showConfigurationSheet : (VoidCallback)null
                    )
            }
                           ),
                       body: new Scrollbar(
                           child: new ListView(
                               padding: EdgeInsets.symmetric(vertical: _dense ? 4.0f : 8.0f),
                               children: listTiles.ToList()
                               )
                           )
                       ));
        }