topNav method
Implementation
Widget topNav(TopResources ti) {
Widget inner = AnimatedContainer(
duration: ti.globalDuration,
margin: (){
EdgeInsets margin = ti.frame.vertical ? EdgeInsets.zero : const EdgeInsets.only(right: 20);
if(ti.frame.vertical && !ti.frame.expanded){
margin += const EdgeInsets.only(bottom: 20);
}
return margin;
}(),
child: AnimatedAlign(
duration: ti.globalDuration,
alignment: ti.frame.expanded ? Alignment.center : Alignment.centerLeft,
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
const SizedBox.square(
dimension: 50,
child: Center(
child: Icon(Icons.menu),
)
),
Text(_title == "" ? widget.appName : _title,
style: Theme.of(context).textTheme.titleMedium,
),
]
)
)
);
if(widget.floatingItem != null){
inner = Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(
child: inner
),
if(vertical) AnimatedSwitcher(
duration: ti.globalDuration,
transitionBuilder: (child, anim) =>
SizeTransition(
sizeFactor: anim,
axis: Axis.horizontal,
axisAlignment: -1.0,
child: child
),
child: !ti.frame.expanded ?
widget.floatingItem : null
)
],
);
}
return SizedOverflowBox(
alignment: Alignment.topLeft,
size: const Size.fromHeight(50),
child: InkResponse(
highlightShape: BoxShape.rectangle,
containedInkWell: true,
onTap: () => expanded = !_expanded,
child: inner,
)
);
}