feat: 优化前端 UI 与交互体验
This commit is contained in:
@@ -16,6 +16,7 @@ import '../../../messages/data/inbox_api.dart';
|
||||
import '../../data/voice_recorder.dart';
|
||||
import '../../../chat/ui/widgets/ui_schema_renderer.dart';
|
||||
import '../../../../shared/widgets/app_loading_indicator.dart';
|
||||
import '../../../../shared/widgets/app_pull_refresh_feedback.dart';
|
||||
import '../../../../shared/widgets/message_composer.dart';
|
||||
import '../../../../shared/widgets/toast/toast.dart';
|
||||
import '../../../../shared/widgets/toast/toast_type.dart';
|
||||
@@ -95,6 +96,7 @@ class _HomeScreenState extends State<HomeScreen>
|
||||
bool _isTranscribing = false;
|
||||
bool _isCancelGestureActive = false;
|
||||
bool _isSendingMessage = false;
|
||||
bool _isPullRefreshing = false;
|
||||
int _unreadCount = 0;
|
||||
final List<XFile> _selectedImages = [];
|
||||
|
||||
@@ -210,7 +212,7 @@ class _HomeScreenState extends State<HomeScreen>
|
||||
const Positioned.fill(child: _HomeEmptyStateAmbient())
|
||||
else
|
||||
Positioned.fill(
|
||||
child: RefreshIndicator(
|
||||
child: RefreshIndicator.noSpinner(
|
||||
onRefresh: () => _onRefresh(context),
|
||||
child: ListView.builder(
|
||||
controller: _scrollController,
|
||||
@@ -260,6 +262,10 @@ class _HomeScreenState extends State<HomeScreen>
|
||||
alignment: Alignment.bottomLeft,
|
||||
child: _buildWaitingIndicator(currentStage: state.currentStage),
|
||||
),
|
||||
Align(
|
||||
alignment: Alignment.topCenter,
|
||||
child: AppPullRefreshFeedback(visible: _isPullRefreshing),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -347,7 +353,19 @@ class _HomeScreenState extends State<HomeScreen>
|
||||
}
|
||||
|
||||
Future<void> _onRefresh(BuildContext context) async {
|
||||
await context.read<ChatBloc>().loadMoreHistory();
|
||||
if (_isPullRefreshing) {
|
||||
return;
|
||||
}
|
||||
if (mounted) {
|
||||
setState(() => _isPullRefreshing = true);
|
||||
}
|
||||
try {
|
||||
await context.read<ChatBloc>().loadMoreHistory();
|
||||
} finally {
|
||||
if (mounted) {
|
||||
setState(() => _isPullRefreshing = false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void _onLoadMore(BuildContext context) {
|
||||
|
||||
Reference in New Issue
Block a user