contact_card.dart 2.0 KB

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