list.dart 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245
  1. import 'package:flutter/material.dart';
  2. import 'package:go_router/go_router.dart';
  3. class ListPage extends StatelessWidget {
  4. const ListPage({Key? key}) : super(key: key);
  5. @override
  6. Widget build(BuildContext context) {
  7. final List<Data> items = [
  8. Data(
  9. type: 'Foods & Drinks',
  10. color: Color(0xffCCA600),
  11. image: 'assets/images/food.png'),
  12. Data(
  13. type: 'Services',
  14. color: Color(0xff90D8F9),
  15. image: 'assets/images/service.png'),
  16. Data(
  17. type: 'Additional',
  18. color: Color(0xffAACEE0),
  19. image: 'assets/images/additional.png'),
  20. Data(
  21. type: 'First Aid',
  22. color: Color(0xffFF1111),
  23. image: 'assets/images/firstaid.png'),
  24. Data(
  25. type: 'Ticket',
  26. color: Color(0xff5ED8F6),
  27. image: 'assets/images/ticket.png'),
  28. Data(
  29. type: 'Vacation',
  30. color: Color(0xffCCA600),
  31. image: 'assets/images/vacation.png'),
  32. Data(
  33. type: 'Transportation',
  34. color: Color(0xff6C8BA5),
  35. image: 'assets/images/transportation.png'),
  36. ];
  37. return Scaffold(
  38. appBar: AppBar(
  39. backgroundColor: Color(0xff078C84),
  40. automaticallyImplyLeading: false,
  41. toolbarHeight: 44,
  42. title: Text(
  43. '${date.hour}:${date.minute}',
  44. style: TextStyle(color: Colors.white, fontSize: 15),
  45. ),
  46. actions: [
  47. Icon(
  48. Icons.signal_cellular_alt,
  49. color: Colors.white,
  50. ),
  51. Icon(
  52. Icons.wifi,
  53. color: Colors.white,
  54. ),
  55. RotatedBox(
  56. quarterTurns: -3,
  57. child: Icon(
  58. Icons.battery_std,
  59. color: Colors.white,
  60. ),
  61. )
  62. ],
  63. ),
  64. body: Stack(children: [
  65. Container(
  66. decoration: BoxDecoration(color: Color(0xff078C84)),
  67. ),
  68. SingleChildScrollView(
  69. child: Container(
  70. decoration: BoxDecoration(
  71. color: Colors.white,
  72. borderRadius: BorderRadius.only(
  73. topLeft: Radius.circular(16),
  74. topRight: Radius.circular(16)),
  75. border: Border.all(color: Color(0xff078C84))),
  76. child: Column(
  77. children: [
  78. TopMenu(),
  79. Column(
  80. children: List.generate(
  81. items.length,
  82. (i) => SizedBox(
  83. child: ListTile(
  84. leading: gambar(items[i]),
  85. title: Text(items[i].type),
  86. subtitle: Text(
  87. 'Description of ${items[i].type.toLowerCase()}'),
  88. trailing: IconDelete(),
  89. ),
  90. )),
  91. ),
  92. Divider(
  93. thickness: 8,
  94. ),
  95. AvailableMenu(),
  96. Column(
  97. children: List.generate(
  98. items.length,
  99. (i) => SizedBox(
  100. child: ListTile(
  101. leading: gambar(items[i]),
  102. title: Text(items[i].type),
  103. subtitle: Text(
  104. 'Description of ${items[i].type.toLowerCase()}'),
  105. trailing: IconAdd(),
  106. ),
  107. )),
  108. )
  109. ],
  110. ),
  111. ),
  112. ),
  113. ]));
  114. }
  115. Container gambar(Data items) {
  116. return Container(
  117. decoration: BoxDecoration(
  118. border: Border.all(color: items.color),
  119. borderRadius: BorderRadius.all(Radius.circular(20)),
  120. color: items.color.withOpacity(0.4)),
  121. padding: const EdgeInsets.all(5.0),
  122. child: Image.asset(
  123. items.image,
  124. width: 36,
  125. height: 36,
  126. fit: BoxFit.cover,
  127. ),
  128. );
  129. }
  130. }
  131. class Data {
  132. String type;
  133. Color color;
  134. String image;
  135. Data({required this.type, required this.color, required this.image});
  136. }
  137. var date = DateTime.now();
  138. class AvailableMenu extends StatelessWidget {
  139. const AvailableMenu({
  140. Key? key,
  141. }) : super(key: key);
  142. @override
  143. Widget build(BuildContext context) {
  144. return Container(
  145. padding: const EdgeInsets.all(5.0),
  146. child: Row(
  147. children: [
  148. Text(
  149. 'Available Menu',
  150. textAlign: TextAlign.left,
  151. style: TextStyle(
  152. fontWeight: FontWeight.bold, color: Color(0xff292D32)),
  153. ),
  154. ],
  155. ),
  156. );
  157. }
  158. }
  159. class TopMenu extends StatelessWidget {
  160. const TopMenu({
  161. Key? key,
  162. }) : super(key: key);
  163. @override
  164. Widget build(BuildContext context) {
  165. return Container(
  166. padding: const EdgeInsets.all(5.0),
  167. child: Row(
  168. children: [
  169. Text(
  170. 'Top Menu',
  171. textAlign: TextAlign.left,
  172. style: TextStyle(
  173. fontWeight: FontWeight.bold, color: Color(0xff292D32)),
  174. ),
  175. Expanded(
  176. child: Column(
  177. mainAxisAlignment: MainAxisAlignment.center,
  178. children: [
  179. Container(
  180. color: Color(0xff292D32).withOpacity(0.15),
  181. height: 1,
  182. width: 24,
  183. ),
  184. ],
  185. ),
  186. ),
  187. ElevatedButton(
  188. style: ElevatedButton.styleFrom(
  189. backgroundColor: Color(0xff078C84).withOpacity(0.1)),
  190. onPressed: () => context.go('/listblock'),
  191. child: Text(
  192. 'Done',
  193. style: TextStyle(
  194. color: Color(0xff078C84), fontWeight: FontWeight.w300),
  195. ))
  196. ],
  197. ),
  198. );
  199. }
  200. }
  201. class IconAdd extends StatelessWidget {
  202. const IconAdd({
  203. Key? key,
  204. }) : super(key: key);
  205. @override
  206. Widget build(BuildContext context) {
  207. return Icon(
  208. Icons.add_circle,
  209. color: Colors.red,
  210. );
  211. }
  212. }
  213. class IconDelete extends StatelessWidget {
  214. const IconDelete({
  215. Key? key,
  216. }) : super(key: key);
  217. @override
  218. Widget build(BuildContext context) {
  219. return Row(
  220. mainAxisSize: MainAxisSize.min,
  221. children: [
  222. Icon(
  223. Icons.remove_circle,
  224. color: Colors.red,
  225. ),
  226. SizedBox(width: 10),
  227. Icon(Icons.menu),
  228. ],
  229. );
  230. }
  231. }