Skip to content

Commit

Permalink
fix: Add loading when scroll to index
Browse files Browse the repository at this point in the history
  • Loading branch information
drminh2807 committed Nov 15, 2023
1 parent f62da30 commit 6850343
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions lib/pages/chat/chat.dart
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ import 'package:flutter/material.dart';
import 'package:flutter/scheduler.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:flutter_keyboard_visibility/flutter_keyboard_visibility.dart';
import 'package:future_loading_dialog/future_loading_dialog.dart';

import 'package:go_router/go_router.dart';
import 'package:image_picker/image_picker.dart';
Expand Down Expand Up @@ -1059,9 +1060,12 @@ class ChatController extends State<Chat>
}

Future scrollToIndex(int index, {bool highlight = false}) async {
await scrollController.scrollToIndex(
index,
preferPosition: AutoScrollPosition.middle,
await showFutureLoadingDialog(
context: context,
future: () => scrollController.scrollToIndex(
index,
preferPosition: AutoScrollPosition.middle,
),
);
if (highlight) {
await scrollController.highlight(
Expand Down

0 comments on commit 6850343

Please sign in to comment.