akshathjain / sliding_up_panel

A draggable Flutter widget that makes implementing a SlidingUpPanel much easier!
https://pub.dartlang.org/packages/sliding_up_panel
Other
1.36k stars 378 forks source link

Collapsed widget still blocks touch events for panel with AppBar #228

Open sabetAI opened 3 years ago

sabetAI commented 3 years ago

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):

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 commented 3 years ago

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

JakeHadley commented 3 years ago

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