@@ -2,9 +2,7 @@ import 'package:flutter/material.dart';
22import 'package:frontend/models/contact.dart' ;
33import 'package:frontend/models/company.dart' ;
44import 'package:frontend/components/EditContact.dart' ;
5- import 'package:frontend/services/authService.dart' ;
65import 'package:frontend/services/contactService.dart' ;
7- import 'package:provider/provider.dart' ;
86import 'InformationBox.dart' ;
97
108class DisplayContactsCompany extends StatefulWidget {
@@ -26,38 +24,26 @@ class _DisplayContactsState extends State<DisplayContactsCompany> {
2624 this .contact = contactService.getContact (widget.rep.contactID);
2725 }
2826
29- _isEditable (Contact cont) {
30- return FutureBuilder (
31- future: Provider .of <AuthService >(context).role,
32- builder: (context, snapshot) {
33- if (snapshot.hasData) {
34- Role r = snapshot.data as Role ;
35-
36- if (r == Role .ADMIN || r == Role .COORDINATOR || r == Role .MEMBER ) {
37- return FloatingActionButton .extended (
38- onPressed: () async {
39- final bool ? shouldRefresh = await Navigator .push <bool >(
40- context,
41- MaterialPageRoute (
42- builder: (context) =>
43- EditContact (contact: cont, person: widget.rep),
44- ),
45- );
46- if (shouldRefresh ?? false ) {
47- this .contact =
48- contactService.getContact (widget.rep.contactID);
49- setState (() {});
50- }
51- },
52- label: const Text ('Edit Contacts' ),
53- icon: const Icon (Icons .edit),
54- backgroundColor: Color (0xff5C7FF2 ),
55- );
56- } else
57- return Container ();
58- } else
59- return Container ();
60- });
27+ _isEditable (Contact cont) {
28+ return FloatingActionButton .extended (
29+ onPressed: () async {
30+ final bool ? shouldRefresh = await Navigator .push <bool >(
31+ context,
32+ MaterialPageRoute (
33+ builder: (context) =>
34+ EditContact (contact: cont, person: widget.rep),
35+ ),
36+ );
37+ if (shouldRefresh ?? false ) {
38+ this .contact =
39+ contactService.getContact (widget.rep.contactID);
40+ setState (() {});
41+ }
42+ },
43+ label: const Text ('Edit Contacts' ),
44+ icon: const Icon (Icons .edit),
45+ backgroundColor: Color (0xff5C7FF2 ),
46+ );
6147 }
6248
6349 @override
0 commit comments