listblock.dart 5.4 KB

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