listblock.dart 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  1. import 'package:flutter/material.dart';
  2. import 'package:namer_app/data.dart';
  3. import 'package:date_format/date_format.dart';
  4. class ListBlockPage extends StatelessWidget {
  5. const ListBlockPage({Key? key}) : super(key: key);
  6. @override
  7. Widget build(BuildContext context) {
  8. return Scaffold(
  9. appBar: AppBar(
  10. backgroundColor: Color(0xff078C84),
  11. automaticallyImplyLeading: false,
  12. toolbarHeight: 44,
  13. title: Text(
  14. date,
  15. // '${date.hour}:${date.minute}',
  16. style: TextStyle(color: Colors.white, fontSize: 15),
  17. ),
  18. actions: [
  19. Icon(
  20. Icons.signal_cellular_alt,
  21. color: Colors.white,
  22. ),
  23. Icon(
  24. Icons.wifi,
  25. color: Colors.white,
  26. ),
  27. RotatedBox(
  28. quarterTurns: -3,
  29. child: Icon(
  30. Icons.battery_std,
  31. color: Colors.white,
  32. ),
  33. )
  34. ],
  35. ),
  36. body: Stack(children: [
  37. Container(
  38. decoration: BoxDecoration(color: Color(0xff078C84)),
  39. ),
  40. Container(
  41. decoration: BoxDecoration(
  42. color: Colors.white,
  43. borderRadius: BorderRadius.only(
  44. topLeft: Radius.circular(16),
  45. topRight: Radius.circular(16)),
  46. border: Border.all(color: Color(0xff078C84))),
  47. child: Column(
  48. children: [
  49. Container(
  50. margin: EdgeInsets.symmetric(vertical: 5),
  51. color: Color(0xff292D32).withOpacity(0.15),
  52. height: 1,
  53. width: 24,
  54. ),
  55. TopMenu(),
  56. GridView.builder(
  57. shrinkWrap: true,
  58. gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
  59. crossAxisCount: 4, childAspectRatio: 16 / 9),
  60. itemBuilder: (context, index) => Column(
  61. mainAxisAlignment: MainAxisAlignment.spaceEvenly,
  62. children: [
  63. gambar(items[index]),
  64. Text(items[index].type),
  65. ],
  66. ),
  67. itemCount: 7,
  68. ),
  69. AvailableMenu(),
  70. GridView.builder(
  71. shrinkWrap: true,
  72. gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
  73. crossAxisCount: 4, childAspectRatio: 16 / 9),
  74. itemBuilder: (context, index) => Column(
  75. mainAxisAlignment: MainAxisAlignment.spaceEvenly,
  76. children: [
  77. gambar(items[index]),
  78. Text(items[index].type),
  79. ],
  80. ),
  81. itemCount: items.length,
  82. ),
  83. ],
  84. ),
  85. ),
  86. ]));
  87. }
  88. Container gambar(items) {
  89. return Container(
  90. decoration: BoxDecoration(
  91. border: Border.all(color: items.color),
  92. borderRadius: BorderRadius.all(Radius.circular(20)),
  93. color: items.color.withOpacity(0.4)),
  94. padding: const EdgeInsets.all(5.0),
  95. child: Image.asset(
  96. items.image,
  97. width: 36,
  98. height: 36,
  99. fit: BoxFit.cover,
  100. ),
  101. );
  102. }
  103. }
  104. class Data {
  105. String type;
  106. Color color;
  107. String image;
  108. Data({required this.type, required this.color, required this.image});
  109. }
  110. var date = formatDate(DateTime.now(), [HH, ':', nn]);
  111. // var date = DateTime.now();
  112. class AvailableMenu extends StatelessWidget {
  113. const AvailableMenu({
  114. Key? key,
  115. }) : super(key: key);
  116. @override
  117. Widget build(BuildContext context) {
  118. return Container(
  119. padding: const EdgeInsets.all(5.0),
  120. child: Row(
  121. children: [
  122. Text(
  123. 'Available Menu',
  124. textAlign: TextAlign.left,
  125. style: TextStyle(
  126. fontWeight: FontWeight.bold, color: Color(0xff292D32)),
  127. ),
  128. ],
  129. ),
  130. );
  131. }
  132. }
  133. class TopMenu extends StatelessWidget {
  134. const TopMenu({
  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. 'Top Menu',
  145. textAlign: TextAlign.left,
  146. style: TextStyle(
  147. fontWeight: FontWeight.bold, color: Color(0xff292D32)),
  148. ),
  149. Spacer(),
  150. ElevatedButton(
  151. style: ElevatedButton.styleFrom(
  152. backgroundColor: Color(0xff078C84).withOpacity(0.1)),
  153. onPressed: () {
  154. print('Customize');
  155. },
  156. child: Text(
  157. 'Customize',
  158. style: TextStyle(
  159. color: Color(0xff078C84), fontWeight: FontWeight.w300),
  160. ))
  161. ],
  162. ),
  163. );
  164. }
  165. }
  166. class IconAdd extends StatelessWidget {
  167. const IconAdd({
  168. Key? key,
  169. }) : super(key: key);
  170. @override
  171. Widget build(BuildContext context) {
  172. return Icon(
  173. Icons.add_circle,
  174. color: Colors.red,
  175. );
  176. }
  177. }
  178. class IconDelete extends StatelessWidget {
  179. const IconDelete({
  180. Key? key,
  181. }) : super(key: key);
  182. @override
  183. Widget build(BuildContext context) {
  184. return Row(
  185. mainAxisSize: MainAxisSize.min,
  186. children: [
  187. Icon(
  188. Icons.remove_circle,
  189. color: Colors.red,
  190. ),
  191. SizedBox(width: 10),
  192. Icon(Icons.menu),
  193. ],
  194. );
  195. }
  196. }