ueman / feedback

A simple widget for getting better feedback.
https://pub.dev/packages/feedback
400 stars 98 forks source link

Dialogs cannot close when pressing device back button #194

Open mrgzi opened 2 years ago

mrgzi commented 2 years ago

Version

2.4.1

Library

feedback

Flutter channel

stable

Flutter version

2.10.4

Platform

Android

Details

I don't know what is the exact reason, I realize when using this package, dialogs doesn't close when pressing the back button. Instead of closing dialog, its navigating to the previous screen.

Steps to reproduce


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

void main() {
  runApp(const BetterFeedback(child: MyApp()));
}

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: const MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({Key? key, required this.title}) : super(key: key);

  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  int _counter = 0;

  void _incrementCounter() {
    setState(() {
      _counter++;
    });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            const Text(
              'You have pushed the button this many times:',
            ),
            Text(
              '$_counter',
              style: Theme.of(context).textTheme.headline4,
            ),
          ],
        ),
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: () {
          showDialog(
              context: context,
              builder: (_) {
                return AlertDialog(
                  title: Text("Dialog"),
                  content: Container(),
                );
              });
        },
        tooltip: 'Increment',
        child: const Icon(Icons.add),
      ),
    );
  }
}

Output of flutter doctor -v

[✓] Flutter (Channel stable, 2.10.4, on macOS 12.1 21C52 darwin-x64, locale en)
• Flutter version 2.10.4 at /Users/xx/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision c860cba910 (13 days ago), 2022-03-25 00:23:12 -0500
• Engine revision 57d3bac3dd
• Dart version 2.16.2
• DevTools version 2.9.2

[✓] Android toolchain - develop for Android devices (Android SDK version 32.0.0)
• Android SDK at /Users/xx/Library/Android/sdk
• Platform android-31, build-tools 32.0.0
• ANDROID_SDK_ROOT = /Users/xx/Library/Android/sdk
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)
• All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 13.2.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• CocoaPods version 1.10.1

[✓] Android Studio (version 4.1)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)

[✓] VS Code (version 1.66.0)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.38.1

[✓] Connected device (2 available)
• Redmi Note 8 Pro (mobile) • fyau4xxx • android-arm64 • Android 11 (API 30)
• macOS (desktop) • macos • darwin-x64 • macOS 12.1 21C52 darwin-x64

[✓] HTTP Host Availability
• All required HTTP hosts are available
mubiru-simeon commented 2 years ago

Same issue here. It completely messes up dialog boxes and any packages that use dialog boxes. I was using flutterwave for payments and it was a mess. The payments system crashed so much, i had to remove this really cool feedback system i had gronw to love.

JesusHdez960717 commented 8 months ago

I have the exact same bug, (according to my research) It was introduced in 2.1.0 with the feature: The back button now intelligently reverses drawings and closes the drawing mode. link

THE ONLY SOLUTION for my was to use the version 2.0.0. In this version the plugin work perfect :+1:

JesusHdez960717 commented 7 months ago

Similar to #205

JesusHdez960717 commented 6 months ago

hi @mubiru-simeon, and specially @mrgzi, the initial creator of the issue, the PR that solves this bug is finally merged (#293), if you want test it again with the latest version (3.1.0) to make sure and in case the bug is not reproduced any more, feel free to close this issue