Advertisement
Guest User

Untitled

a guest
Aug 18th, 2019
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.66 KB | None | 0 0
  1.  
  2. class DrugsListView extends StatefulWidget {
  3. @override
  4. _DrugsListViewState createState() => _DrugsListViewState();
  5. }
  6.  
  7. class _DrugsListViewState extends State<DrugsListView> {
  8. var DrugList = [
  9. {
  10. "name_drug":"Panadol Night",
  11. "subtitle_drug":"Take 1 tablet",
  12. "time_drug":"Sunday 7:00 AM",
  13. "picture_drug":"img/drug.png",
  14. },
  15. {
  16. "name_drug":"Lipitor",
  17. "subtitle_drug":"Take 1 tablet",
  18. "time_drug":"Sunday 7:00 AM",
  19. "picture_drug":"img/lipitor.jpg",
  20. },
  21.  
  22. ];
  23. @override
  24. Widget build(BuildContext context) {
  25. return ListView.builder(
  26. itemCount: DrugList.length,
  27. itemBuilder:(context,index){
  28. return SingleDrugView(
  29. name_drug_view:DrugList[index]["name_drug"],
  30. subtitle_drug_view:DrugList[index]["subtitle_drug"],
  31. time_drug_view:DrugList[index]["time_drug"],
  32. picture_drug_view:DrugList[index]["picture_drug"]
  33. );
  34. });
  35. }
  36. }
  37. class SingleDrugView extends StatelessWidget {
  38. final name_drug_view;
  39. final subtitle_drug_view;
  40. final time_drug_view;
  41. final picture_drug_view;
  42. SingleDrugView ({
  43. this.name_drug_view,
  44. this.subtitle_drug_view,
  45. this.time_drug_view,
  46. this.picture_drug_view,
  47. });
  48. @override
  49. Widget build(BuildContext context) {
  50. return Container(
  51. decoration: new BoxDecoration(
  52. border: new Border(
  53. bottom: new BorderSide(
  54. color: Colors.grey.shade200,
  55. )
  56. )
  57. ),
  58. child: ListTile(
  59. leading: GestureDetector(
  60. onTap: (){},
  61. child: new Image.asset(picture_drug_view,
  62. width: 40,
  63. height: 50,
  64. ),
  65. ),
  66. title: GestureDetector(
  67. onTap: (){},
  68. child: Text(name_drug_view),
  69. ),
  70. subtitle: new Column(
  71. children: <Widget>[
  72. new Row(
  73. children: <Widget>[
  74. Padding(
  75. padding: const EdgeInsets.all(1.0),
  76. child: Text(subtitle_drug_view),
  77. ),
  78. new Padding(
  79. padding: EdgeInsets.fromLTRB(10, 8.0, 8.0, 8.0),
  80. child: Icon(Icons.alarm,size: 12.0,color: Colors.grey,),
  81. ),
  82. Padding(
  83. padding: EdgeInsets.all(1.0),
  84. child: new Text(time_drug_view),
  85. ),
  86. ],
  87. )
  88. ],
  89. ),
  90.  
  91. trailing: GestureDetector(
  92. onTap: (){},
  93. child:Icon(Icons.keyboard_arrow_right,size: 14,color: Colors.grey,),
  94. ),
  95.  
  96. ),
  97. );
  98. }
  99. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement