File tree 1 file changed +12
-12
lines changed
1 file changed +12
-12
lines changed Original file line number Diff line number Diff line change @@ -151,15 +151,23 @@ class _MessageListState extends State<MessageList> {
151
151
});
152
152
}
153
153
154
- void _scrollChanged () {
155
- final scrollPosition = scrollController.position;
156
- if (scrollPosition.extentBefore == 0 ) {
154
+ void _common (ScrollMetrics scrollMetrics) {
155
+ if (scrollMetrics.extentBefore == 0 ) {
157
156
_scrollToBottomVisibleValue.value = false ;
158
157
} else {
159
158
_scrollToBottomVisibleValue.value = true ;
160
159
}
161
160
}
162
161
162
+ void _scrollChanged () {
163
+ _common (scrollController.position);
164
+ }
165
+
166
+ bool _metricsChanged (ScrollMetricsNotification scrollMetricsNotification) {
167
+ _common (scrollMetricsNotification.metrics);
168
+ return true ;
169
+ }
170
+
163
171
@override
164
172
Widget build (BuildContext context) {
165
173
assert (model != null );
@@ -180,15 +188,7 @@ class _MessageListState extends State<MessageList> {
180
188
child: ConstrainedBox (
181
189
constraints: const BoxConstraints (maxWidth: 760 ),
182
190
child: NotificationListener <ScrollMetricsNotification >(
183
- onNotification: (scrollMetricsNotification) {
184
- final metrics = scrollMetricsNotification.metrics;
185
- if (metrics.extentBefore == 0 ) {
186
- _scrollToBottomVisibleValue.value = false ;
187
- } else {
188
- _scrollToBottomVisibleValue.value = true ;
189
- }
190
- return true ;
191
- },
191
+ onNotification: _metricsChanged,
192
192
child: Stack (
193
193
children: < Widget > [
194
194
_buildListView (context),
You can’t perform that action at this time.
0 commit comments