cpd_job_app/lib/Widgets/all_companies_widget.dart

104 lines
2.9 KiB
Dart
Raw Normal View History

2023-06-20 03:23:54 +02:00
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 {
2023-06-20 20:52:00 +02:00
{
final Uri params = Uri(
scheme: "mailto",
path: widget.userEmail,
query: "subject=Hey from JobFinder",
2023-06-20 20:52:00 +02:00
);
final url = params.toString();
launchUrlString(url);
2023-06-20 03:23:54 +02:00
}
}
@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();
},
),
),
);
}
}