feedback
feedback copied to clipboard
ScrollController not attached to any scroll views.
Version
2.5.0
Library
feedback
Flutter channel
stable
Flutter version
3.0.5
Platform
Android
Details
When trying to open a custom Feedback widget, I'm seeing the following logs:
======== Exception caught by scheduler library =====================================================
The following assertion was thrown during a scheduler callback:
ScrollController not attached to any scroll views.
'package:flutter/src/widgets/scroll_controller.dart':
Failed assertion: line 107 pos 12: '_positions.isNotEmpty'
Either the assertion indicates an error in the framework itself, or we should provide substantially more information in this error message to help you determine and fix the underlying cause.
In either case, please report this assertion by filing a bug on GitHub:
https://github.com/flutter/flutter/issues/new?template=2_bug.md
When the exception was thrown, this was the stack:
#2 ScrollController.position (package:flutter/src/widgets/scroll_controller.dart:107:12)
#3 _DraggableScrollableSheetScrollController.position (package:flutter/src/widgets/draggable_scrollable_sheet.dart:750:13)
#4 _DraggableScrollableSheetState._replaceExtent.<anonymous closure> (package:flutter/src/widgets/draggable_scrollable_sheet.dart:681:27)
#5 SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1146:15)
#6 SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1091:9)
#7 SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:997:5)
#11 _invoke (dart:ui/hooks.dart:151:10)
#12 PlatformDispatcher._drawFrame (dart:ui/platform_dispatcher.dart:308:5)
#13 _drawFrame (dart:ui/hooks.dart:115:31)
(elided 5 frames from class _AssertionError and dart:async)
====================================================================================================
We're not using any scroll controller in the custom view, so I'm not really sure why there's a scroll controller attached there, or how to just ignore it (we don't need scroll for our custom feedback provider)
Steps to reproduce
Add the BetterFeedback widget like this:
class SampleApp extends StatelessWidget {
return MultiBlocProvider(
...
child: BetterFeedback(
feedbackBuilder: (BuildContext context, OnSubmit onSubmit, _) {
return FeedbackWidget(onSubmit: onSubmit);
},
localizationsDelegates: const <LocalizationsDelegate<dynamic>>[
AppLocalizations.delegate,
GlobalCupertinoLocalizations.delegate,
GlobalMaterialLocalizations.delegate,
],
child: MaterialApp(...),
),
);
}
And add a custom feedback provider like this:
class FeedbackWidget extends StatefulWidget {
const FeedbackWidget({
required this.onSubmit,
super.key,
});
final OnSubmit onSubmit;
@override
State<FeedbackWidget> createState() => _FeedbackWidgetState();
}
class _FeedbackWidgetState extends State<FeedbackWidget> {
late AppLocalizations l10n;
late TextEditingController _controller;
@override
void initState() {
super.initState();
_controller = TextEditingController();
}
@override
void didChangeDependencies() {
super.didChangeDependencies();
l10n = context.l10n;
}
@override
void dispose() {
_controller.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
Flexible(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 16),
child: TextField(
controller: _controller,
decoration: InputDecoration(
label: Text(l10n.feedbackInputLabel),
border: const OutlineInputBorder(),
),
),
),
),
OutlinedButton(
label: l10n.actionSubmit,
onPressed: () => widget.onSubmit(_controller.text),
),
],
);
}
}
Output of flutter doctor -v
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 3.0.5, on Microsoft Windows [Versi¢n 10.0.22000.832], locale es-ES)
[√] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
[√] Chrome - develop for the web
[√] Android Studio (version 2021.2)
[√] VS Code (version 1.68.1)
[√] Connected device (3 available)
[√] HTTP Host Availability
• No issues found!
Just saw you can avoid that error by setting this:
BetterFeedback(
theme: FeedbackThemeData(
sheetIsDraggable: false,
),
),
But I didn't find anything in the docs for that, so maybe docs can be improved for that