Example #1
0
        Widget _build(BuildContext context, BoxConstraints constraints)
        {
            Size size = constraints.biggest;

            float?tColumnToRow =
                1.0f - ((size.height - this.midHeight) /
                        (this.maxHeight - this.midHeight))?.clamp(0.0f, 1.0f);


            float?tCollapsed =
                1.0f - ((size.height - this.minHeight) /
                        (this.midHeight - this.minHeight))?.clamp(0.0f, 1.0f);

            float _indicatorOpacity(int index)
            {
                return(1.0f - this._selectedIndexDelta(index) * 0.5f);
            }

            float?_titleOpacity(int index)
            {
                return(1.0f - this._selectedIndexDelta(index) * tColumnToRow * 0.5f);
            }

            float?_titleScale(int index)
            {
                return(1.0f - this._selectedIndexDelta(index) * tColumnToRow * 0.15f);
            }

            List <Widget> children = new List <Widget>(this.sectionCards);

            for (int index = 0; index < this.sections.Count; index++)
            {
                Section section = this.sections[index];
                children.Add(new LayoutId(
                                 id: $"title{index}",
                                 child: new SectionTitle(
                                     section: section,
                                     scale: _titleScale(index),
                                     opacity: _titleOpacity(index)
                                     )
                                 ));
            }

            for (int index = 0; index < this.sections.Count; index++)
            {
                children.Add(new LayoutId(
                                 id: $"indicator{index}",
                                 child: new SectionIndicator(
                                     opacity: _indicatorOpacity(index)
                                     )
                                 ));
            }

            return(new CustomMultiChildLayout(
                       layoutDelegate: new _AllSectionsLayout(
                           translation: new Alignment((this.selectedIndex.value - this.sectionIndex) * 2.0f - 1.0f ?? 0.0f,
                                                      -1.0f),
                           tColumnToRow: tColumnToRow ?? 0.0f,
                           tCollapsed: tCollapsed ?? 0.0f,
                           cardCount: this.sections.Count,
                           selectedIndex: this.selectedIndex.value
                           ),
                       children: children
                       ));
        }
Example #2
0
 public bool Equals(Section other)
 {
     return(this.title == other.title);
 }