一、效果图
二、 实现方式
获取固定在顶部筛选头部Widget
在屏幕上的位置和它的高度 在弹窗中通过获取到的高度进行内容显示区域定位 巧用AnimatedContainer
组件实现下拉动画效果 最后在底部加上黑色蒙层
unawaited (
showDialog (
context: context,
useSafeArea: false ,
barrierColor: Colors. transparent,
builder: ( _) {
return Padding (
padding: EdgeInsets. only ( top: startY) ,
child: Column (
children: [
ColoredBox (
color: Colors. white,
child: Column (
children: [
Container (
height: 1 ,
margin: const EdgeInsets. symmetric ( horizontal: 16 ) ,
color: const Color ( 0xfff6f7f9 ) . withOpacity ( 0.8 ) ,
) ,
ValueListenableBuilder< double> (
valueListenable: _notifier,
builder: ( context, value, child) {
return AnimatedContainer (
height: value,
curve: Curves. fastEaseInToSlowEaseOut,
duration: const Duration ( milliseconds: 300 ) ,
child: child,
) ;
} ,
child: widget. content,
) ,
] ,
) ,
) ,
Expanded (
child: GestureDetector (
onTap: _close,
behavior: HitTestBehavior. opaque,
child: Container (
color: Colors. black. withOpacity ( 0.7 ) ,
) ,
) ,
) ,
] ,
) ,
) ;
} ,
) ,
) ;