Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/109.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 当用户向上滚动时,无法单击SliverPersistentHeader上的操作按钮_Android_Ios_Flutter_Flutter Layout_Flutter Sliver - Fatal编程技术网

Android 当用户向上滚动时,无法单击SliverPersistentHeader上的操作按钮

Android 当用户向上滚动时,无法单击SliverPersistentHeader上的操作按钮,android,ios,flutter,flutter-layout,flutter-sliver,Android,Ios,Flutter,Flutter Layout,Flutter Sliver,我正在构建一个使用SliverPersistentHeader的颤振应用程序,并添加了一些覆盖SliverPersistentHeader的操作按钮。但该应用程序遇到了一个问题,当用户向上滚动时,操作按钮无法单击。我不想使用SliverAppBar,因为我无法将卡片小部件覆盖在它上面。因此,我使用了SliverPersistentHeader,因为它可以在上面放置一个卡片小部件 如您所见,这是我试图固定SliverPersistentHeader的输出。这样用户可以在向上滚动时看到操作按钮。但

我正在构建一个使用
SliverPersistentHeader
的颤振应用程序,并添加了一些覆盖
SliverPersistentHeader
的操作按钮。但该应用程序遇到了一个问题,当用户向上滚动时,操作按钮无法单击。我不想使用
SliverAppBar
,因为我无法将卡片小部件覆盖在它上面。因此,我使用了
SliverPersistentHeader
,因为它可以在上面放置一个卡片小部件

如您所见,这是我试图固定
SliverPersistentHeader
的输出。这样用户可以在向上滚动时看到操作按钮。但不幸的是,我无法点击该操作按钮

下面是代码。请注意,我将
SliverPersistenHeader
包装在
NestedScrollView
DefaultTabController

SliverPersistentHeader(
        delegate: MySliverAppBar(
       /// pass data by here
                  
        expandedHeight: 230,          
       ),
    pinned: true,
    floating: true,
 ),
这是
SliverPersistentHeaderDelegate

@override
Widget build(
  BuildContext context, double shrinkOffset, bool overlapsContent) {
const Color _devider_color = Color(0xff425262);
final _actionButtonColor = Theme.of(context).cardColor.withOpacity(0.7);
return Stack(
  fit: StackFit.expand,
  overflow: Overflow.visible,
  children: [
    Image.network(
      clanProfile.mainImage == null ? _clanLogo : clanProfile.mainImage,
      fit: BoxFit.cover,
    ),

    Positioned(
      top: 0,
      left: 12,
      child: InkWell(
        onTap: () {
          Navigator.pop(context);
        },
        child: SafeArea(
          child: Container(
              height: 50,
              width: 50,
              decoration: BoxDecoration(
                borderRadius: BorderRadius.circular(25),
                color: _actionButtonColor,
              ),
              child: Icon(Icons.arrow_back_ios)),
        ),
      ),
    ),
    Positioned(
      top: 0,
      right: 12,
      child: SafeArea(
        child: Row(
          children: [
            InkWell(
              onTap: () {
                Navigator.of(context).pushNamed(MembersListPage.routeName,
                    arguments: MembersListPageArguments(
                      members: members,
                      masterId: masterId,
                    ));
              },
              child: Container(
                height: 50,
                width: 50,
                decoration: BoxDecoration(
                  borderRadius: BorderRadius.circular(25),
                  color: _actionButtonColor,
                ),
                child: Icon(Icons.info),
              ),
            ),
            PaddingSmall(isHorizontal: true),
            Visibility(
              visible: isClanMaster && true,
              child: Row(
                children: <Widget>[
                  InkWell(
                    onTap: () {
                      Navigator.pushNamed(
                              context, EditClanPagePage.routeName,
                              arguments: EditClanPagePageArgument(
                                  clanPageModel: clanProfile))
                          .then((Object message) {
                        if (message == 'Success') {
                          load();
                        }
                      });
                    },
                    child: Container(
                        height: 50,
                        width: 50,
                        decoration: BoxDecoration(
                          borderRadius: BorderRadius.circular(25),
                          color: _actionButtonColor,
                        ),
                        child: Icon(Icons.edit)),
                  ),
                  PaddingSmall(isHorizontal: true),
                  InkWell(
                    onTap: () {
                      generateInviteLink().then((value) {
                        _showInviteDialogue(
                            context: context, message: value);
                      });
                    },
                    child: Container(
                      height: 50,
                      width: 100,
                      alignment: Alignment.center,
                      decoration: BoxDecoration(
                        borderRadius: BorderRadius.circular(25),
                        color: _actionButtonColor,
                      ),
                      child: Text(
                        'Invite ',
                        style: TextStyle(
                            color: Colors.white,
                            fontSize: 14,
                            fontWeight: FontWeight.bold),
                      ),
                    ),
                  ),
                ],
              ),
            ),
          ],
        ),
      ),
    ),
    Center(
      child: Opacity(
        opacity: shrinkOffset / expandedHeight,
        child: Text(
          name,
          style: TextStyle(
            color: Colors.white,
            fontWeight: FontWeight.w700,
            fontSize: 23,
          ),
        ),
      ),
    ),
    Positioned(
      // top: 60,
      top: expandedHeight / 1.3 - shrinkOffset,
      left: constants.padding_large,
      right: constants.padding_large,
      child: _buildUserDetailOverlayContainer(),
        ),
      ),
    ),
  ],
);
 }
@覆盖
小部件构建(
BuildContext上下文、双收缩偏移、布尔重叠内容){
常量颜色_设备_颜色=颜色(0xff425262);
最终的_actionButtonColor=Theme.of(context).cardColor.withOpacity(0.7);
返回堆栈(
fit:StackFit.expand,
溢出:溢出。可见,
儿童:[
图像网络(
clanProfile.mainImage==null?\u clanLogo:clanProfile.mainImage,
适合:BoxFit.cover,
),
定位(
排名:0,
左:12,,
孩子:InkWell(
onTap:(){
Navigator.pop(上下文);
},
儿童:安全区(
子:容器(
身高:50,
宽度:50,
装饰:盒子装饰(
边界半径:边界半径。圆形(25),
颜色:_actionButton颜色,
),
子:图标(图标.箭头\返回\ ios)),
),
),
),
定位(
排名:0,
右:12,
儿童:安全区(
孩子:排(
儿童:[
墨水池(
onTap:(){
Navigator.of(context.pushNamed)(MembersListPage.routeName,
参数:MembersListPageArguments(
成员:成员,
masterId:masterId,
));
},
子:容器(
身高:50,
宽度:50,
装饰:盒子装饰(
边界半径:边界半径。圆形(25),
颜色:_actionButton颜色,
),
子:图标(Icons.info),
),
),
PaddingSmall(水平方向:真),
可见度(
可见:isClanMaster&&true,
孩子:排(
儿童:[
墨水池(
onTap:(){
Navigator.pushNamed(
上下文,EditClanPagePage.routeName,
参数:EditClanPageArgument(
clanPageModel:clanProfile)
.then((对象消息){
如果(消息==“成功”){
加载();
}
});
},
子:容器(
身高:50,
宽度:50,
装饰:盒子装饰(
边界半径:边界半径。圆形(25),
颜色:_actionButton颜色,
),
子:图标(Icons.edit)),
),
PaddingSmall(水平方向:真),
墨水池(
onTap:(){
generateInviteLink()。然后((值){
_表演对话(
上下文:上下文,消息:值);
});
},
子:容器(
身高:50,
宽度:100,
对齐:对齐.center,
装饰:盒子装饰(
边界半径:边界半径。圆形(25),
颜色:_actionButton颜色,
),
子:文本(
“邀请”,
样式:TextStyle(
颜色:颜色,白色,
尺寸:14,
fontWeight:fontWeight.bold),
),
),
),
],
),
),
],
),
),
),
居中(
子对象:不透明度(
不透明度:收缩偏移/展开高度,
子:文本(
名称
样式:TextStyle(
颜色:颜色,白色,
fontWeight:fontWeight.w700,
尺寸:23,
),
),
),
),
定位(
//排名:60,
顶部:展开高度/1.3-收缩偏移,
左:常量。填充_大,
右:常量。填充_大,
子项:\u buildUserDetailOverlyContainer(),
),
),
),
],
);
}
我之所以使用
SliverPersistentHeader
over
SliverAppBar
,是因为我想在它上面放置一张卡片。 这是它的样子
很难说,因为您的代码示例不完整。但我认为堆栈中的最后一个小部件,位于带有按钮行的小部件上。 试着交换它们