refactor: Enhance onboarding process in chat and app startup providers
- Integrated autofocus management for the composer in both chat and onboarding contexts to improve user experience. - Added error handling for focus management to ensure smooth onboarding transitions. - Updated modal bottom sheet handling to restore autofocus state after onboarding completion, enhancing usability across the app.
This commit is contained in:
@@ -190,6 +190,14 @@ class _ChatPageState extends ConsumerState<ChatPage> {
|
||||
}
|
||||
|
||||
void _showOnboarding() {
|
||||
try {
|
||||
ref.read(composerAutofocusEnabledProvider.notifier).set(false);
|
||||
} catch (_) {}
|
||||
try {
|
||||
FocusManager.instance.primaryFocus?.unfocus();
|
||||
SystemChannels.textInput.invokeMethod('TextInput.hide');
|
||||
} catch (_) {}
|
||||
|
||||
showModalBottomSheet(
|
||||
context: context,
|
||||
backgroundColor: Colors.transparent,
|
||||
@@ -204,7 +212,12 @@ class _ChatPageState extends ConsumerState<ChatPage> {
|
||||
),
|
||||
child: const OnboardingSheet(),
|
||||
),
|
||||
);
|
||||
).whenComplete(() {
|
||||
if (!mounted) return;
|
||||
try {
|
||||
ref.read(composerAutofocusEnabledProvider.notifier).set(true);
|
||||
} catch (_) {}
|
||||
});
|
||||
}
|
||||
|
||||
Future<void> _checkAndLoadDemoConversation() async {
|
||||
|
||||
Reference in New Issue
Block a user