Merge branch 'worktree-agent-aa9ed772f90c7c7b3'
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import '../../../../core/error_advice.dart';
|
||||
import '../../../../ui/status/error_notice.dart';
|
||||
|
||||
import '../../domain/chat_default_name.dart';
|
||||
|
||||
@@ -63,8 +65,12 @@ class ChatCatalogFields extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if (loading) return const Text('Loading directories…');
|
||||
if (error != null) {
|
||||
return _message('Unable to load chat options: $error');
|
||||
if (error case final error?) {
|
||||
// A common failure says what to do; its raw detail stays behind
|
||||
// Details. Anything else reads as before.
|
||||
return errorAdvice(error) == null
|
||||
? _message(Text('Unable to load chat options: $error'))
|
||||
: _message(ErrorNotice(error: error));
|
||||
}
|
||||
final choices = chatDirectoryChoices(directories);
|
||||
String directoryLabel(String choice) =>
|
||||
@@ -113,11 +119,11 @@ class ChatCatalogFields extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _message(String text) {
|
||||
Widget _message(Widget text) {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(text),
|
||||
text,
|
||||
Align(
|
||||
alignment: AlignmentDirectional.centerStart,
|
||||
child: TextButton(onPressed: onRetry, child: const Text('Retry')),
|
||||
|
||||
@@ -14,6 +14,7 @@ import '../folder_picker/folder_picker_route.dart';
|
||||
import 'chat_create_dialog_frame.dart';
|
||||
import 'chat_create_fields.dart';
|
||||
import 'chat_prompt_chooser.dart';
|
||||
import '../../../../ui/status/error_notice.dart';
|
||||
|
||||
/// The instructions field's helper and the creation-time model behavior.
|
||||
const String chatCreateInstructionsHelper =
|
||||
@@ -419,12 +420,9 @@ class _CreateChatDialogState extends State<CreateChatDialog> {
|
||||
key: const Key('chat-create-start-in'),
|
||||
),
|
||||
],
|
||||
if (_formError != null) ...[
|
||||
if (_formError case final error?) ...[
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
_formError!,
|
||||
style: TextStyle(color: Theme.of(context).colorScheme.error),
|
||||
),
|
||||
ErrorNotice(error: error),
|
||||
],
|
||||
],
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user