From bc86ba832cd2c09f2cd11c48b08871e32c89bd04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Rom=C3=A3o?= Date: Tue, 28 Nov 2023 14:53:35 +0000 Subject: [PATCH] fixes done --- .../lib/components/DisplayContactCompany.dart | 54 +++++++------------ frontend/lib/routes/company/CreateRep.dart | 5 +- 2 files changed, 22 insertions(+), 37 deletions(-) diff --git a/frontend/lib/components/DisplayContactCompany.dart b/frontend/lib/components/DisplayContactCompany.dart index 29f1793d..bdd90c69 100644 --- a/frontend/lib/components/DisplayContactCompany.dart +++ b/frontend/lib/components/DisplayContactCompany.dart @@ -2,9 +2,7 @@ import 'package:flutter/material.dart'; import 'package:frontend/models/contact.dart'; import 'package:frontend/models/company.dart'; import 'package:frontend/components/EditContact.dart'; -import 'package:frontend/services/authService.dart'; import 'package:frontend/services/contactService.dart'; -import 'package:provider/provider.dart'; import 'InformationBox.dart'; class DisplayContactsCompany extends StatefulWidget { @@ -26,38 +24,26 @@ class _DisplayContactsState extends State { this.contact = contactService.getContact(widget.rep.contactID); } - _isEditable(Contact cont) { - return FutureBuilder( - future: Provider.of(context).role, - builder: (context, snapshot) { - if (snapshot.hasData) { - Role r = snapshot.data as Role; - - if (r == Role.ADMIN || r == Role.COORDINATOR || r == Role.MEMBER) { - return FloatingActionButton.extended( - onPressed: () async { - final bool? shouldRefresh = await Navigator.push( - context, - MaterialPageRoute( - builder: (context) => - EditContact(contact: cont, person: widget.rep), - ), - ); - if (shouldRefresh ?? false) { - this.contact = - contactService.getContact(widget.rep.contactID); - setState(() {}); - } - }, - label: const Text('Edit Contacts'), - icon: const Icon(Icons.edit), - backgroundColor: Color(0xff5C7FF2), - ); - } else - return Container(); - } else - return Container(); - }); + _isEditable(Contact cont) { + return FloatingActionButton.extended( + onPressed: () async { + final bool? shouldRefresh = await Navigator.push( + context, + MaterialPageRoute( + builder: (context) => + EditContact(contact: cont, person: widget.rep), + ), + ); + if (shouldRefresh ?? false) { + this.contact = + contactService.getContact(widget.rep.contactID); + setState(() {}); + } + }, + label: const Text('Edit Contacts'), + icon: const Icon(Icons.edit), + backgroundColor: Color(0xff5C7FF2), + ); } @override diff --git a/frontend/lib/routes/company/CreateRep.dart b/frontend/lib/routes/company/CreateRep.dart index a450f83d..75486fb0 100644 --- a/frontend/lib/routes/company/CreateRep.dart +++ b/frontend/lib/routes/company/CreateRep.dart @@ -212,9 +212,8 @@ class _CreateRepState extends State { final representative = _Reps[index]; return ListTile( key: Key(representative.id.toString()), - leading: Icon(Icons - .person), // Add your representative image here - title: Text(representative.name ?? 'N/A'), + leading: Icon(Icons.person), // Add your representative image here + title: SelectableText(representative.name), trailing: Row( mainAxisSize: MainAxisSize.min, children: [