Skip to content

Commit 826e5f5

Browse files
authored
Merge pull request #421 from sinfo/staging
Update 1.0.18
2 parents e06c13a + de19ec4 commit 826e5f5

File tree

2 files changed

+22
-37
lines changed

2 files changed

+22
-37
lines changed

frontend/lib/components/DisplayContactCompany.dart

Lines changed: 20 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@ import 'package:flutter/material.dart';
22
import 'package:frontend/models/contact.dart';
33
import 'package:frontend/models/company.dart';
44
import 'package:frontend/components/EditContact.dart';
5-
import 'package:frontend/services/authService.dart';
65
import 'package:frontend/services/contactService.dart';
7-
import 'package:provider/provider.dart';
86
import 'InformationBox.dart';
97

108
class 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

frontend/lib/routes/company/CreateRep.dart

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -212,9 +212,8 @@ class _CreateRepState extends State<CreateRep> {
212212
final representative = _Reps[index];
213213
return ListTile(
214214
key: Key(representative.id.toString()),
215-
leading: Icon(Icons
216-
.person), // Add your representative image here
217-
title: Text(representative.name ?? 'N/A'),
215+
leading: Icon(Icons.person), // Add your representative image here
216+
title: SelectableText(representative.name),
218217
trailing: Row(
219218
mainAxisSize: MainAxisSize.min,
220219
children: [

0 commit comments

Comments
 (0)