@@ -2,9 +2,7 @@ import 'package:flutter/material.dart';
2
2
import 'package:frontend/models/contact.dart' ;
3
3
import 'package:frontend/models/company.dart' ;
4
4
import 'package:frontend/components/EditContact.dart' ;
5
- import 'package:frontend/services/authService.dart' ;
6
5
import 'package:frontend/services/contactService.dart' ;
7
- import 'package:provider/provider.dart' ;
8
6
import 'InformationBox.dart' ;
9
7
10
8
class DisplayContactsCompany extends StatefulWidget {
@@ -26,38 +24,26 @@ class _DisplayContactsState extends State<DisplayContactsCompany> {
26
24
this .contact = contactService.getContact (widget.rep.contactID);
27
25
}
28
26
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
+ );
61
47
}
62
48
63
49
@override
0 commit comments