Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/233.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 滑动条上的颤振滑动列表重叠_Android_Android Studio_Flutter_Dart_Flutter Layout - Fatal编程技术网

Android 滑动条上的颤振滑动列表重叠

Android 滑动条上的颤振滑动列表重叠,android,android-studio,flutter,dart,flutter-layout,Android,Android Studio,Flutter,Dart,Flutter Layout,我试图在SliverAppBar上重叠一个SliverList几个像素。我希望FlexibleSpaceBar中的图像位于我的SliverList的半径之下。我只能得到半径。无法将滑动列表重叠到滑动条上 返回自定义滚动视图( 物理:弹跳CrollPhysics(), 条子:[ 滑杆( 背景颜色:颜色。透明, 标高:0.0, 扩展高度:获取比例Creenheight(350), 自动嵌入:false, 对,, 是的, 领先:集装箱( 填充:来自LTRB(8.0,8.0,0.0,0.0)的边缘设置,

我试图在
SliverAppBar
上重叠一个
SliverList
几个像素。我希望
FlexibleSpaceBar
中的图像位于我的
SliverList
的半径之下。我只能得到半径。无法将
滑动列表
重叠到
滑动条

返回自定义滚动视图(
物理:弹跳CrollPhysics(),
条子:[
滑杆(
背景颜色:颜色。透明,
标高:0.0,
扩展高度:获取比例Creenheight(350),
自动嵌入:false,
对,,
是的,
领先:集装箱(
填充:来自LTRB(8.0,8.0,0.0,0.0)的边缘设置,
孩子:大小盒子(
高度:屏幕宽度(40),
宽度:宽度(40),
孩子:扁平按钮(
形状:圆形矩形边框(
边界半径:边界半径。圆形(60),
),
颜色:颜色,白色,
填充:EdgeInsets.zero,
子:图标(图标、箭头、背面),
onPressed:()=>Navigator.pop(上下文),
),
),
),
行动:[
容器(
填充:从LTRB(0.0,8.0,8.0,0.0)开始的边缘设置,
孩子:大小盒子(
高度:屏幕宽度(40),
宽度:宽度(40),
孩子:扁平按钮(
形状:圆形矩形边框(
边界半径:边界半径。圆形(60),
),
颜色:颜色,白色,
填充:EdgeInsets.zero,
子:图标(图标。更多内容),
onPressed:(){}
),
),
),
],
flexibleSpace:FlexibleSpaceBar(
//标题:文本(_event.title),
标题:对,
拉伸模式:[
StretchMode.zoomBackground
],
背景:堆栈(
fit:StackFit.expand,
儿童:[
Image.asset('assets/images/events/sunset.jpg',fit:BoxFit.cover),
装饰盒(
装饰:盒子装饰(
梯度:线性梯度(
开始:对齐(0.0,0.5),
结束:对齐(0.0,0.0),
颜色:[
颜色(0x60000000),
颜色(0x00000000),
],
),
),
),
]
)
)
),
银表(
委托:SliverChildListDelegate([
纵队(
儿童:[
容器(
填充:仅限边缘集(顶部:GetPrototaleTesCreenheight(20),底部:GetPrototaleTesCreenheight(100)),
子:事件描述(事件:_事件),
装饰:盒子装饰(
颜色:颜色(0xFFF5F6F9),
borderRadius:仅限borderRadius(
左上:半径。圆形(40),
右上角:半径。圆形(40),
),
boxShadow:[
箱形阴影(
颜色:颜色。灰色。不透明度(0.5),
扩展半径:5,
半径:7,
偏移量:偏移量(0,0),//更改阴影的位置
),
],
)
),
],
)
]),
)
]
);

是否要使用变通解决方案? 我的解决方案是将SliverList的顶部放在
SliverAppBar

唯一的问题是可伸缩空间的淡出动画(向下滚动时)会影响顶部栏。(因为它位于
可伸缩空间

由于
SliverAppBar
高程高于
SliverList
。对小部件的任何缩放或转换都会得到与预期相反的结果(SliverAppBar重叠在SliverList上)

我使用
stack
将顶部放在FlexibleSpaceBar内,将collapseMode设置为
collapseMode.pin
,并将对齐设置为
对齐。底部中心

SliverAppBar(
  ...
  flexibleSpace: FlexibleSpaceBar(
    collapseMode: CollapseMode.pin,
    ...
    background: Stack(
      ...
      children: [
        ...
        Align(
          alignment: Alignment.bottomCenter,
          child: Container(
            child: Container(
              height: _height, // 40
            ),
            decoration: BoxDecoration(
              color: Color(0xFFF5F6F9),
              borderRadius: BorderRadius.only(
                topLeft: Radius.circular(40),
                topRight: Radius.circular(40),
              ),
              boxShadow: [
                BoxShadow(
                  color: Colors.grey.withOpacity(0.5),
                  spreadRadius: 5,
                  blurRadius: 7,
                  offset: Offset(0, 0), // changes position of shadow
                ),
              ],
            ),
          ),
        ),
      ]
     ...
如果您需要像默认设置那样使用
collapseMode:collapseMode.parallax
,则在滚动过程中,
\u高度需要是动态的

void initState(){
  _scrollController = ScrollController()..addListener(() {
    setState(() {
      _height = math.max(_scrollController.offset*_topBarFactor +_topBarHeight,_topBarHeight);
    });
}
});

这是你的问题的答案吗?嗨@yellowgray,我试过了,但没用
void initState(){
  _scrollController = ScrollController()..addListener(() {
    setState(() {
      _height = math.max(_scrollController.offset*_topBarFactor +_topBarHeight,_topBarHeight);
    });
}
});