listblock.dart 5.6 KB

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