contact_card.dart 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. import 'package:flutter/material.dart';
  2. import 'bottom_sheet_text.dart';
  3. class ContactCard extends StatelessWidget {
  4. ContactCard(
  5. {this.imagePath,
  6. this.email,
  7. this.infection,
  8. this.contactUsername,
  9. this.contactTime,
  10. this.contactLocation});
  11. final String imagePath;
  12. final String email;
  13. final String infection;
  14. final String contactUsername;
  15. final DateTime contactTime;
  16. final String contactLocation;
  17. @override
  18. Widget build(BuildContext context) {
  19. return Card(
  20. elevation: 3.0,
  21. shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10.0)),
  22. child: ListTile(
  23. leading: CircleAvatar(
  24. backgroundImage: AssetImage(imagePath),
  25. ),
  26. trailing: Icon(Icons.more_horiz),
  27. title: Text(
  28. email,
  29. style: TextStyle(
  30. color: Colors.deepPurple[700],
  31. fontWeight: FontWeight.bold,
  32. ),
  33. ),
  34. subtitle: Text(infection),
  35. onTap: () => showModalBottomSheet(
  36. context: context,
  37. builder: (builder) {
  38. return Padding(
  39. padding: EdgeInsets.symmetric(vertical: 50.0, horizontal: 10.0),
  40. child: Column(
  41. children: <Widget>[
  42. BottomSheetText(
  43. question: 'Username', result: contactUsername),
  44. SizedBox(height: 5.0),
  45. BottomSheetText(
  46. question: 'Contact Time',
  47. result: contactTime.toString()),
  48. SizedBox(height: 5.0),
  49. BottomSheetText(
  50. question: 'Contact Location', result: contactLocation),
  51. SizedBox(height: 5.0),
  52. BottomSheetText(question: 'Times Contacted', result: '3'),
  53. ],
  54. ),
  55. );
  56. }),
  57. ),
  58. );
  59. }
  60. }