Advertisement
Guest User

Untitled

a guest
Jun 17th, 2019
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.61 KB | None | 0 0
  1. class RecipientCard extends StatelessWidget {
  2. const RecipientCard({Key key, this.recipient}) : super(key: key);
  3.  
  4. final recipient;
  5.  
  6. @override
  7. Widget build(BuildContext context) {
  8. bool selected = false;
  9. return Card(
  10. child: Row(
  11. children: <Widget>[
  12. Container(
  13. decoration: new BoxDecoration(
  14. borderRadius: new BorderRadius.only(
  15. topLeft: const Radius.circular(4.0),
  16. bottomLeft: const Radius.circular(4.0),
  17. ),
  18. ),
  19. width: 40.0,
  20. height: 50.0,
  21. // Should be able to toggle the icons here
  22. child: selected ?
  23. IconButton(
  24. icon: Icon(Icons.check),
  25. onPressed: () {
  26. selected = false;
  27. },
  28. ) :
  29. IconButton(
  30. icon: Icon(Icons.check_box_outline_blank) ,
  31. onPressed: () {
  32. selected = true;
  33. print(selected);
  34. },
  35. ),
  36. ),
  37. Expanded(
  38. child: Container(
  39. padding: EdgeInsets.all(10.0),
  40. child: Text.rich(
  41. TextSpan(children: [
  42. TextSpan(text: '${recipient.recipientName}:', style: TextStyle(
  43. color: Theme.of(context).primaryColor,
  44. fontWeight: FontWeight.bold)),
  45. TextSpan(text: ' ${recipient.recipientCity} ${recipient.recipientCountry}, Number: ${recipient.recipientPhone}, ${recipient.recipientBank} ${recipient.receiveVia} ',)
  46. ]),
  47. style: TextStyle(
  48. fontSize: 14.0,
  49. ),
  50. ),
  51. ),
  52. ),
  53. ],
  54. ),
  55. );
  56. }
  57. }
  58.  
  59. return ListView.builder(
  60. shrinkWrap: true,
  61. itemCount: recipients.length,
  62. itemBuilder: (BuildContext context, int index) {
  63. Recipient recipient = recipients[index];
  64. return Dismissible(
  65. key: Key(recipient.id),
  66. onDismissed: (DismissDirection direction) {
  67. removeRecipient(recipient, state);
  68. },
  69. child: RecipientCard(recipient: recipient),
  70. background: Container(color: Colors.red),
  71. );
  72. },
  73. );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement