sliding_up_panel icon indicating copy to clipboard operation
sliding_up_panel copied to clipboard

Collapsed widget still blocks touch events for panel with AppBar

Open sabetAI opened this issue 4 years ago • 2 comments
trafficstars

Describe the bug If the collapsed widget for SlidingUpPanel is an AppBar with pressable buttons, the collapsed AppBar buttons still trigger instead of the raised AppBar buttons. For some reason IgnorePointer isn't working on your implementation?

To Reproduce

  1. Run example code.
  2. onPressed triggers for IconButton in collapsed widget, not panel widget.

Expected behavior The buttons for the AppBar in the panel should trigger instead of the collapsed AppBar

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: An
  • Flutter Version: Channel master, 2.1.0-11.0.pre.13
  • sliding_up_panel: 1.0.2

Sample main.dart

import 'package:flutter/material.dart';
import 'package:sliding_up_panel/sliding_up_panel.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: MyHomePage(),
    );
  }
}

class MyHomePage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('Test'),
      ),
      bottomNavigationBar: SlidingUpPanel(
          minHeight: 45,
          maxHeight: 450,
          collapsed: AppBar(
              title: Text(
                'Collapsed',
                style: TextStyle(
                    color: Colors.black87,
                    fontWeight: FontWeight.bold,
                    fontSize: 16),
              ),
              leading: IconButton(
                icon: Icon(
                  Icons.sort,
                  color: Colors.black,
                ),
                onPressed: () {},
              ),
              actions: [
                IconButton(
                  icon: Icon(
                    Icons.search_off_outlined,
                    color: Colors.black,
                  ),
                  onPressed: () {
                    print('COLLAPSE');
                  },
                )
              ]),
          panel: Container(height: 450, child: RaisedAppBar())),
    );
  }
}

class RaisedAppBar extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return AppBar(
        title: Text(
          'Raised',
          style: TextStyle(
              color: Colors.black87, fontWeight: FontWeight.bold, fontSize: 16),
        ),
        leading: IconButton(
          icon: Icon(
            Icons.sort,
            color: Colors.black,
          ),
          onPressed: () {},
        ),
        actions: [
          IconButton(
            icon: Icon(
              Icons.search_off_outlined,
              color: Colors.black,
            ),
            onPressed: () {
              print('RAISE');
            },
          )
        ]);
  }
}

sabetAI avatar Mar 06 '21 20:03 sabetAI

IgnorePointer works when wrapped around an AppBar stacked on another AppBar (gist), so not sure what the problem is.

sabetAI avatar Mar 06 '21 20:03 sabetAI

I'm experiencing this as well without an AppBar. No matter what, the collapsed widget, even when hidden will block touches. I can verify this with the widget inspector showing the boundaries of the collapsed widget. This makes the collapsed widget impossible to use if I have stuff sitting behind the hidden collapsed. Major problem. @akshathjain @uintdev @s0nerik

JakeHadley avatar Jun 27 '21 03:06 JakeHadley