fix: clarify project registration controls

This commit is contained in:
Hamza Ayed
2026-10-04 03:28:30 +03:00
parent a91b35de1f
commit 40731f01d9
3 changed files with 49 additions and 9 deletions
@@ -1097,7 +1097,7 @@ class _ChatPageState extends State<ChatPage> {
),
),
IconButton(
tooltip: 'تسجيل مشروع جديد',
tooltip: 'إضافة مشروع موجود إلى القائمة',
visualDensity: VisualDensity.compact,
onPressed: chat.isSending ? null : _addWorkspaceProject,
icon: const Icon(Icons.create_new_folder_outlined, size: 19),
@@ -1108,7 +1108,7 @@ class _ChatPageState extends State<ChatPage> {
TextButton.icon(
onPressed: chat.isSending ? null : _addWorkspaceProject,
icon: const Icon(Icons.add, size: 16),
label: const Text('تسجيل مشروع جديد'),
label: const Text('إضافة مجلد مشروع موجود'),
style: TextButton.styleFrom(
alignment: Alignment.centerRight,
padding: const EdgeInsets.symmetric(horizontal: 4, vertical: 6),
@@ -1407,11 +1407,18 @@ class _ChatPageState extends State<ChatPage> {
),
),
SizedBox(width: compact ? 2 : 12),
IconButton.filledTonal(
onPressed: chat.isSending ? null : _addWorkspaceProject,
tooltip: 'تسجيل مشروع من مجلد موجود',
icon: const Icon(Icons.create_new_folder_outlined),
),
if (constraints.maxWidth >= 900)
FilledButton.tonalIcon(
onPressed: chat.isSending ? null : _addWorkspaceProject,
icon: const Icon(Icons.create_new_folder_outlined),
label: const Text('إضافة مجلد مشروع'),
)
else
IconButton.filledTonal(
onPressed: chat.isSending ? null : _addWorkspaceProject,
tooltip: 'إضافة مجلد مشروع موجود',
icon: const Icon(Icons.create_new_folder_outlined),
),
IconButton(
onPressed: _chooseWorkspace,
tooltip:
@@ -169,7 +169,7 @@ void main() {
expect(find.text('مساعدك المحلي'), findsOneWidget);
expect(find.text('مشاريعي'), findsOneWidget);
expect(find.byTooltip('تسجيل مشروع جديد'), findsOneWidget);
expect(find.byTooltip('إضافة مشروع موجود إلى القائمة'), findsOneWidget);
expect(tester.takeException(), isNull);
await chatCubit.setDarkMode(true);
@@ -210,7 +210,39 @@ void main() {
await tester.pumpAndSettle();
expect(find.text('مشاريعي'), findsNothing);
expect(find.byTooltip('تسجيل مشروع من مجلد موجود'), findsOneWidget);
expect(find.byTooltip('إضافة مجلد مشروع موجود'), findsOneWidget);
expect(tester.takeException(), isNull);
await chatCubit.close();
});
testWidgets('wide desktop shows a labeled project registration action', (
tester,
) async {
tester.view.physicalSize = const Size(1500, 900);
tester.view.devicePixelRatio = 1;
addTearDown(tester.view.resetPhysicalSize);
addTearDown(tester.view.resetDevicePixelRatio);
final api = _TestApiRepository();
final chatCubit = ChatCubit(
api,
settingsStore: LocalSettingsStore.inMemory(),
);
await tester.pumpWidget(
MultiRepositoryProvider(
providers: [RepositoryProvider<ApiRepository>.value(value: api)],
child: MultiBlocProvider(
providers: [
BlocProvider.value(value: chatCubit),
BlocProvider(create: (_) => VoiceCubit(api, AudioRecorder())),
],
child: const SovereignApp(),
),
),
);
await tester.pumpAndSettle();
expect(find.text('إضافة مجلد مشروع'), findsOneWidget);
expect(tester.takeException(), isNull);
await chatCubit.close();
});