listblock.dart 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245
  1. import 'package:flutter/material.dart';
  2. // import 'package:flutter_layout_grid/flutter_layout_grid.dart';
  3. class ListBlockPage extends StatelessWidget {
  4. const ListBlockPage({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. Container(
  69. decoration: BoxDecoration(
  70. color: Colors.white,
  71. borderRadius: BorderRadius.only(
  72. topLeft: Radius.circular(16),
  73. topRight: Radius.circular(16)),
  74. border: Border.all(color: Color(0xff078C84))),
  75. child: Column(
  76. children: [
  77. TopMenu(),
  78. GridView.builder(
  79. shrinkWrap: true,
  80. gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
  81. crossAxisCount: 4, childAspectRatio: 16 / 9),
  82. itemBuilder: (context, index) => Column(
  83. mainAxisAlignment: MainAxisAlignment.spaceEvenly,
  84. children: [
  85. gambar(items[index]),
  86. Text(items[index].type),
  87. ],
  88. ),
  89. itemCount: items.length,
  90. ),
  91. // Divider(
  92. // thickness: 8,
  93. // ),
  94. AvailableMenu(),
  95. GridView.builder(
  96. shrinkWrap: true,
  97. gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
  98. crossAxisCount: 4, childAspectRatio: 16 / 9),
  99. itemBuilder: (context, index) => Column(
  100. mainAxisAlignment: MainAxisAlignment.spaceEvenly,
  101. children: [
  102. gambar(items[index]),
  103. Text(items[index].type),
  104. ],
  105. ),
  106. itemCount: items.length,
  107. ),
  108. ],
  109. ),
  110. ),
  111. ]));
  112. }
  113. Container gambar(Data items) {
  114. return Container(
  115. decoration: BoxDecoration(
  116. border: Border.all(color: items.color),
  117. borderRadius: BorderRadius.all(Radius.circular(20)),
  118. color: items.color.withOpacity(0.4)),
  119. padding: const EdgeInsets.all(5.0),
  120. child: Image.asset(
  121. items.image,
  122. width: 36,
  123. height: 36,
  124. fit: BoxFit.cover,
  125. ),
  126. );
  127. }
  128. }
  129. class Data {
  130. String type;
  131. Color color;
  132. String image;
  133. Data({required this.type, required this.color, required this.image});
  134. }
  135. var date = DateTime.now();
  136. class AvailableMenu extends StatelessWidget {
  137. const AvailableMenu({
  138. Key? key,
  139. }) : super(key: key);
  140. @override
  141. Widget build(BuildContext context) {
  142. return Container(
  143. padding: const EdgeInsets.all(5.0),
  144. child: Row(
  145. children: [
  146. Text(
  147. 'Available Menu',
  148. textAlign: TextAlign.left,
  149. style: TextStyle(
  150. fontWeight: FontWeight.bold, color: Color(0xff292D32)),
  151. ),
  152. ],
  153. ),
  154. );
  155. }
  156. }
  157. class TopMenu extends StatelessWidget {
  158. const TopMenu({
  159. Key? key,
  160. }) : super(key: key);
  161. @override
  162. Widget build(BuildContext context) {
  163. return Container(
  164. padding: const EdgeInsets.all(5.0),
  165. child: Row(
  166. children: [
  167. Text(
  168. 'Top Menu',
  169. textAlign: TextAlign.left,
  170. style: TextStyle(
  171. fontWeight: FontWeight.bold, color: Color(0xff292D32)),
  172. ),
  173. Expanded(
  174. child: Column(
  175. mainAxisAlignment: MainAxisAlignment.center,
  176. children: [
  177. Container(
  178. color: Color(0xff292D32).withOpacity(0.15),
  179. height: 1,
  180. width: 24,
  181. ),
  182. ],
  183. ),
  184. ),
  185. ElevatedButton(
  186. style: ElevatedButton.styleFrom(
  187. backgroundColor: Color(0xff078C84).withOpacity(0.1)),
  188. onPressed: () {
  189. print('Customize');
  190. },
  191. child: Text(
  192. 'Customize',
  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. }