listblock.dart 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242
  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. AvailableMenu(),
  92. GridView.builder(
  93. shrinkWrap: true,
  94. gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
  95. crossAxisCount: 4, childAspectRatio: 16 / 9),
  96. itemBuilder: (context, index) => Column(
  97. mainAxisAlignment: MainAxisAlignment.spaceEvenly,
  98. children: [
  99. gambar(items[index]),
  100. Text(items[index].type),
  101. ],
  102. ),
  103. itemCount: items.length,
  104. ),
  105. ],
  106. ),
  107. ),
  108. ]));
  109. }
  110. Container gambar(Data items) {
  111. return Container(
  112. decoration: BoxDecoration(
  113. border: Border.all(color: items.color),
  114. borderRadius: BorderRadius.all(Radius.circular(20)),
  115. color: items.color.withOpacity(0.4)),
  116. padding: const EdgeInsets.all(5.0),
  117. child: Image.asset(
  118. items.image,
  119. width: 36,
  120. height: 36,
  121. fit: BoxFit.cover,
  122. ),
  123. );
  124. }
  125. }
  126. class Data {
  127. String type;
  128. Color color;
  129. String image;
  130. Data({required this.type, required this.color, required this.image});
  131. }
  132. var date = DateTime.now();
  133. class AvailableMenu extends StatelessWidget {
  134. const AvailableMenu({
  135. Key? key,
  136. }) : super(key: key);
  137. @override
  138. Widget build(BuildContext context) {
  139. return Container(
  140. padding: const EdgeInsets.all(5.0),
  141. child: Row(
  142. children: [
  143. Text(
  144. 'Available Menu',
  145. textAlign: TextAlign.left,
  146. style: TextStyle(
  147. fontWeight: FontWeight.bold, color: Color(0xff292D32)),
  148. ),
  149. ],
  150. ),
  151. );
  152. }
  153. }
  154. class TopMenu extends StatelessWidget {
  155. const TopMenu({
  156. Key? key,
  157. }) : super(key: key);
  158. @override
  159. Widget build(BuildContext context) {
  160. return Container(
  161. padding: const EdgeInsets.all(5.0),
  162. child: Row(
  163. children: [
  164. Text(
  165. 'Top Menu',
  166. textAlign: TextAlign.left,
  167. style: TextStyle(
  168. fontWeight: FontWeight.bold, color: Color(0xff292D32)),
  169. ),
  170. Expanded(
  171. child: Column(
  172. mainAxisAlignment: MainAxisAlignment.center,
  173. children: [
  174. Container(
  175. color: Color(0xff292D32).withOpacity(0.15),
  176. height: 1,
  177. width: 24,
  178. ),
  179. ],
  180. ),
  181. ),
  182. ElevatedButton(
  183. style: ElevatedButton.styleFrom(
  184. backgroundColor: Color(0xff078C84).withOpacity(0.1)),
  185. onPressed: () {
  186. print('Customize');
  187. },
  188. child: Text(
  189. 'Customize',
  190. style: TextStyle(
  191. color: Color(0xff078C84), fontWeight: FontWeight.w300),
  192. ))
  193. ],
  194. ),
  195. );
  196. }
  197. }
  198. class IconAdd extends StatelessWidget {
  199. const IconAdd({
  200. Key? key,
  201. }) : super(key: key);
  202. @override
  203. Widget build(BuildContext context) {
  204. return Icon(
  205. Icons.add_circle,
  206. color: Colors.red,
  207. );
  208. }
  209. }
  210. class IconDelete extends StatelessWidget {
  211. const IconDelete({
  212. Key? key,
  213. }) : super(key: key);
  214. @override
  215. Widget build(BuildContext context) {
  216. return Row(
  217. mainAxisSize: MainAxisSize.min,
  218. children: [
  219. Icon(
  220. Icons.remove_circle,
  221. color: Colors.red,
  222. ),
  223. SizedBox(width: 10),
  224. Icon(Icons.menu),
  225. ],
  226. );
  227. }
  228. }