104 lines
2.9 KiB
Dart
104 lines
2.9 KiB
Dart
import 'package:cpd_ss23/Search/profile_company.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:url_launcher/url_launcher_string.dart';
|
|
|
|
class AllWorkersWidget extends StatefulWidget {
|
|
final String userID;
|
|
final String userName;
|
|
final String userEmail;
|
|
final String phoneNumber;
|
|
final String userImageUrl;
|
|
|
|
const AllWorkersWidget({
|
|
required this.userID,
|
|
required this.userName,
|
|
required this.userEmail,
|
|
required this.phoneNumber,
|
|
required this.userImageUrl,
|
|
});
|
|
|
|
@override
|
|
State<AllWorkersWidget> createState() => _AllWorkersWidgetState();
|
|
}
|
|
|
|
class _AllWorkersWidgetState extends State<AllWorkersWidget> {
|
|
void _mailTo() async {
|
|
var mailUrl = "mailto: ${widget.userEmail}";
|
|
print("widget.userEmail ${widget.userEmail}");
|
|
|
|
if (await canLaunchUrlString(mailUrl)) {
|
|
await launchUrlString(mailUrl);
|
|
} else {
|
|
print("error");
|
|
throw "Error Occured";
|
|
}
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Card(
|
|
elevation: 8,
|
|
color: Colors.white10,
|
|
margin: const EdgeInsets.symmetric(horizontal: 20, vertical: 6),
|
|
child: ListTile(
|
|
onTap: () {
|
|
Navigator.pushReplacement(
|
|
context,
|
|
MaterialPageRoute(
|
|
builder: (context) => ProfileScreen(userID: widget.userID)));
|
|
},
|
|
contentPadding:
|
|
const EdgeInsets.symmetric(horizontal: 20, vertical: 10),
|
|
leading: Container(
|
|
padding: const EdgeInsets.only(right: 12),
|
|
decoration: const BoxDecoration(
|
|
border: Border(
|
|
right: BorderSide(width: 1),
|
|
),
|
|
),
|
|
child: CircleAvatar(
|
|
backgroundColor: Colors.transparent,
|
|
radius: 20,
|
|
child: Image.network(widget.userImageUrl == null
|
|
? "https://st4.depositphotos.com/4329009/19956/v/600/depositphotos_199564354-stock-illustration-creative-vector-illustration-default-avatar.jpg"
|
|
: widget.userImageUrl),
|
|
),
|
|
),
|
|
title: Text(
|
|
widget.userName,
|
|
maxLines: 2,
|
|
overflow: TextOverflow.ellipsis,
|
|
style: const TextStyle(
|
|
fontWeight: FontWeight.bold,
|
|
color: Colors.white,
|
|
),
|
|
),
|
|
subtitle: const Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
children: [
|
|
Text(
|
|
"Visit Profile",
|
|
maxLines: 2,
|
|
overflow: TextOverflow.ellipsis,
|
|
style: TextStyle(
|
|
color: Colors.grey,
|
|
),
|
|
)
|
|
],
|
|
),
|
|
trailing: IconButton(
|
|
icon: const Icon(
|
|
Icons.mail_outline,
|
|
size: 30,
|
|
color: Colors.grey,
|
|
),
|
|
onPressed: () {
|
|
_mailTo();
|
|
},
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|