import 'package:flutter/material.dart'; import 'package:get/get.dart'; import 'package:marco/controller/directory/directory_controller.dart'; import 'package:marco/controller/project_controller.dart'; import 'package:marco/helpers/widgets/my_spacing.dart'; import 'package:marco/helpers/widgets/my_text.dart'; import 'package:marco/view/directory/directory_view.dart'; import 'package:marco/view/directory/notes_view.dart'; class DirectoryMainScreen extends StatelessWidget { DirectoryMainScreen({super.key}); final DirectoryController controller = Get.put(DirectoryController()); @override Widget build(BuildContext context) { return Scaffold( backgroundColor: Colors.white, appBar: PreferredSize( preferredSize: const Size.fromHeight(72), child: AppBar( backgroundColor: const Color(0xFFF5F5F5), elevation: 0.5, automaticallyImplyLeading: false, titleSpacing: 0, title: Padding( padding: MySpacing.xy(16, 0), child: Row( crossAxisAlignment: CrossAxisAlignment.center, children: [ IconButton( icon: const Icon(Icons.arrow_back_ios_new, color: Colors.black, size: 20), onPressed: () => Get.offNamed('/dashboard'), ), MySpacing.width(8), Expanded( child: Column( crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.min, children: [ MyText.titleLarge( 'Directory', fontWeight: 700, color: Colors.black, ), MySpacing.height(2), GetBuilder( builder: (projectController) { final projectName = projectController .selectedProject?.name ?? 'Select Project'; return Row( children: [ const Icon(Icons.work_outline, size: 14, color: Colors.grey), MySpacing.width(4), Expanded( child: MyText.bodySmall( projectName, fontWeight: 600, overflow: TextOverflow.ellipsis, color: Colors.grey[700], ), ), ], ); }, ), ], ), ), ], ), ), ), ), body: SafeArea( child: Column( children: [ // Toggle between Directory and Notes Padding( padding: MySpacing.xy(8, 5), child: Obx(() { final isNotesView = controller.isNotesView.value; return Row( mainAxisAlignment: MainAxisAlignment.end, children: [ IconButton( tooltip: 'Directory View', onPressed: () => controller.isNotesView.value = false, icon: Icon( Icons.contacts, color: !isNotesView ? Colors.red : Colors.grey, ), ), IconButton( tooltip: 'Notes View', onPressed: () => controller.isNotesView.value = true, icon: Icon( Icons.notes, color: isNotesView ? Colors.red : Colors.grey, ), ), ], ); }), ), // Main View Expanded( child: Obx(() => controller.isNotesView.value ? NotesView() : DirectoryView()), ), ], ), ), ); } }