Have conflict with go_router
MICKEY88661 opened this issue · 5 comments
Version
2.6.0
Library
feedback
Flutter channel
stable
Flutter version
3.7.3
Platform
Android, iOS
Details
The keyboard will be pop out immediately when my app is using go_router
as well.
source code
import 'package:flutter/material.dart';
import 'package:feedback/feedback.dart';
import 'package:go_router/go_router.dart';
void main() {
runApp(
BetterFeedback(
child: MyApp(),
),
);
}
class MyApp extends StatelessWidget {
MyApp({super.key});
// named routes
late final _router = GoRouter(
routes: [
GoRoute(
path: '/',
builder: (context, state) => const MyHomePage(title: 'Flutter Demo Home Page'),
),
],
);
@override
Widget build(BuildContext context) {
return MaterialApp.router(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
routerConfig: _router,
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({super.key, required this.title});
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.headlineMedium,
),
ElevatedButton(
onPressed: () {
BetterFeedback.of(context).show((UserFeedback feedback) {
print('object');
});
},
child: Text('feedback'),
),
ElevatedButton(
onPressed: () {
showModalBottomSheet(
context: context,
builder: (context) {
return Container(
height: MediaQuery.of(context).size.height / 2,
child: Center(child: TextField()),
);
},
);
},
child: Text('BottomSheet'),
)
],
),
),
floatingActionButton: FloatingActionButton(
onPressed: _incrementCounter,
tooltip: 'Increment',
child: const Icon(Icons.add),
),
);
}
}
Emulator.-.table_tone.2023-06-01.14-53-12.mp4
Steps to reproduce
- show BetterFeedback
- click the TextField
Output of flutter doctor -v
[√] Flutter (Channel stable, 3.7.3, on Microsoft Windows [Version 10.0.19045.2965], locale en-US)
• Flutter version 3.7.3 on channel stable at C:\Development\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 9944297138 (4 months ago), 2023-02-08 15:46:04 -0800
• Engine revision 248290d6d5
• Dart version 2.19.2
• DevTools version 2.20.1
[√] Windows Version (Installed version of Windows is version 10 or higher)
[√] Android toolchain - develop for Android devices (Android SDK version 33.0.2)
• Android SDK at C:\Users\MickeyYang\AppData\Local\Android\sdk
• Platform android-33-ext4, build-tools 33.0.2
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 11.0.15+0-b2043.56-9505619)
• All Android licenses accepted.
[√] Chrome - develop for the web
• Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe
[√] Visual Studio - develop for Windows (Visual Studio Build Tools 2019 16.11.23)
• Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools
• Visual Studio Build Tools 2019 version 16.11.33214.272
• Windows 10 SDK version 10.0.19041.0
[√] Android Studio (version 2022.1)
• Android Studio at C:\Program Files\Android\Android Studio
• 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 11.0.15+0-b2043.56-9505619)
[√] VS Code (version 1.78.2)
• VS Code at C:\Users\MickeyYang\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.64.0
[√] Connected device (4 available)
• sdk gphone64 x86 64 (mobile) • emulator-5554 • android-x64 • Android 13 (API 33) (emulator)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.19045.2965]
• Chrome (web) • chrome • web-javascript • Google Chrome 113.0.5672.127
• Edge (web) • edge • web-javascript • Microsoft Edge 113.0.1774.57
[√] HTTP Host Availability
• All required HTTP hosts are available
• No issues found!
I also have issues related to go_router. I wrapped MaterialApp.router() with BetterFeedback component. Sometimes it works fine when doing routing, sometimes it triggers an exception.
Version Info
flutter: stable 3.16.5
feedback: ^3.0.0
Exception
══╡ EXCEPTION CAUGHT BY GESTURE ╞═══════════════════════════════════════════════════════════════════
The following assertion was thrown while handling a gesture:
No GoRouter found in context
'package:go_router/src/router.dart':
Failed assertion: line 507 pos 12: 'inherited != null'
When the exception was thrown, this was the stack:
#2 GoRouter.of (package:go_router/src/router.dart:507:12)
#3 GoRouterHelper.pushNamed (package:go_router/src/misc/extensions.dart:59:16)
#4 _TrendyCollectionViewState.build.<anonymous closure>.<anonymous closure>.<anonymous closure>.<anonymous closure>
(package:clubspace/features/trendy_avatar/presentation/pages/trendy_collections.dart:129:31)
#5 SelectAccountPopupView.build.<anonymous closure>
(package:clubspace/features/trendy_avatar/presentation/views/select_platform_popup.dart:91:37)
#6 PlatformGridWidget.build.<anonymous closure>.<anonymous closure>
(package:clubspace/features/trendy_avatar/presentation/widgets/platform_grid.dart:51:30)
#7 PlatformItemWidget.build.<anonymous closure> (package:clubspace/features/trendy_avatar/presentation/widgets/platfrom_item.dart:30:20)
#8 GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:275:24)
#9 TapGestureRecognizer.handleTapUp (package:flutter/src/gestures/tap.dart:652:11)
#10 BaseTapGestureRecognizer._checkUp (package:flutter/src/gestures/tap.dart:309:5)
#11 BaseTapGestureRecognizer.handlePrimaryPointer (package:flutter/src/gestures/tap.dart:242:7)
#12 PrimaryPointerGestureRecognizer.handleEvent (package:flutter/src/gestures/recognizer.dart:630:9)
#13 PointerRouter._dispatch (package:flutter/src/gestures/pointer_router.dart:98:12)
#14 PointerRouter._dispatchEventToRoutes.<anonymous closure> (package:flutter/src/gestures/pointer_router.dart:143:9)
#15 _LinkedHashMapMixin.forEach (dart:collection-patch/compact_hash.dart:633:13)
#16 PointerRouter._dispatchEventToRoutes (package:flutter/src/gestures/pointer_router.dart:141:18)
#17 PointerRouter.route (package:flutter/src/gestures/pointer_router.dart:127:7)
#18 GestureBinding.handleEvent (package:flutter/src/gestures/binding.dart:488:19)
#19 GestureBinding.dispatchEvent (package:flutter/src/gestures/binding.dart:468:22)
#20 RendererBinding.dispatchEvent (package:flutter/src/rendering/binding.dart:439:11)
#21 GestureBinding._handlePointerEventImmediately (package:flutter/src/gestures/binding.dart:413:7)
#22 GestureBinding.handlePointerEvent (package:flutter/src/gestures/binding.dart:376:5)
#23 GestureBinding._flushPointerEventQueue (package:flutter/src/gestures/binding.dart:323:7)
#24 GestureBinding._handlePointerDataPacket (package:flutter/src/gestures/binding.dart:292:9)
#25 _invoke1 (dart:ui/hooks.dart:328:13)
#26 PlatformDispatcher._dispatchPointerDataPacket (dart:ui/platform_dispatcher.dart:410:7)
#27 _dispatchPointerDataPacket (dart:ui/hooks.dart:262:31)
(elided 2 frames from class _AssertionError)
Handler: "onTap"
Recognizer:
TapGestureRecognizer#b76f3
════════════════════════════════════════════════════════════════════════════════════════════════════
I have issues with go_router/BetterFeedback too. Swipe back gesture (at least with CupertinoPage on iOS) does not work when MaterialApp.router() is wrapped with BetterFeedback component.
Any update?
I'm also having a problem with the swipe back gesture on iOS but I'm not using go_router though.
The swipe back works, but not all the time. Approximately 4 out of 5 tries doesn't work, then it suddenly work with no difference in the way I'm making the gesture.
This problem appeared after wrapping MaterialApp
with BetterFeedback
widget. The issue disappears if I remove BetterFeedback
.
I'm on feedback version 3.0.0
.
Hi @SharbelOkzan, @WiRight, @brain0verfl0w, @yushengguo557, and mainly @MICKEY88661 wich create the issue.
Can you guys please test this again with latest version (3.1.0), this bugs (or at least ver very very similar ones) was fixed in PR #293 and I belive this are one of the fixed ones in the process
(sorry but I had not time right now to test it)