listblock.dart 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  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({Key? key}) : super(key: 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(color: Color(0xff078C84)),
  41. ),
  42. Container(
  43. decoration: BoxDecoration(
  44. color: Colors.white,
  45. borderRadius: BorderRadius.only(
  46. topLeft: Radius.circular(16),
  47. topRight: Radius.circular(16)),
  48. border: Border.all(color: Color(0xff078C84))),
  49. child: Column(
  50. children: [
  51. Container(
  52. margin: EdgeInsets.symmetric(vertical: 5),
  53. color: Color(0xff292D32).withOpacity(0.15),
  54. height: 1,
  55. width: 24,
  56. ),
  57. TopMenu(),
  58. GridView.builder(
  59. shrinkWrap: true,
  60. gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
  61. crossAxisCount: 4, childAspectRatio: 16 / 9),
  62. itemBuilder: (context, index) => Column(
  63. mainAxisAlignment: MainAxisAlignment.spaceEvenly,
  64. children: [
  65. InkWell(
  66. onTap: () =>
  67. context.go("/search/${items[index]['type']}"),
  68. child: SizedBox(
  69. width: 60,
  70. height: 60,
  71. child: gambar(items[index]),
  72. ),
  73. ),
  74. Text(items[index]['type']),
  75. ],
  76. ),
  77. itemCount: 7,
  78. ),
  79. AvailableMenu(),
  80. GridView.builder(
  81. shrinkWrap: true,
  82. gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
  83. crossAxisCount: 4, childAspectRatio: 16 / 9),
  84. itemBuilder: (context, index) => Column(
  85. mainAxisAlignment: MainAxisAlignment.spaceEvenly,
  86. children: [
  87. InkWell(
  88. onTap: () =>
  89. context.go("/search/${items[index]['type']}"),
  90. child: SizedBox(
  91. width: 60,
  92. height: 60,
  93. child: gambar(items[index]),
  94. ),
  95. ),
  96. Text(items[index]['type']),
  97. ],
  98. ),
  99. itemCount: items.length,
  100. ),
  101. ],
  102. ),
  103. ),
  104. ]));
  105. }
  106. Container gambar(items) {
  107. return Container(
  108. decoration: BoxDecoration(
  109. border: Border.all(color: items['color']),
  110. borderRadius: BorderRadius.all(Radius.circular(20)),
  111. color: items['color'].withOpacity(0.4)),
  112. padding: const EdgeInsets.all(5.0),
  113. child: Image.asset(
  114. items['image'],
  115. fit: BoxFit.cover,
  116. ),
  117. );
  118. }
  119. }
  120. class AvailableMenu extends StatelessWidget {
  121. const AvailableMenu({
  122. Key? key,
  123. }) : super(key: key);
  124. @override
  125. Widget build(BuildContext context) {
  126. return Container(
  127. padding: const EdgeInsets.all(5.0),
  128. child: Row(
  129. children: [
  130. Text(
  131. 'Available Menu',
  132. textAlign: TextAlign.left,
  133. style: TextStyle(
  134. fontWeight: FontWeight.bold, color: Color(0xff292D32)),
  135. ),
  136. ],
  137. ),
  138. );
  139. }
  140. }
  141. class TopMenu extends StatelessWidget {
  142. const TopMenu({
  143. Key? key,
  144. }) : super(key: key);
  145. @override
  146. Widget build(BuildContext context) {
  147. return Container(
  148. padding: const EdgeInsets.all(5.0),
  149. child: Row(
  150. children: [
  151. Text(
  152. 'Top Menu',
  153. textAlign: TextAlign.left,
  154. style: TextStyle(
  155. fontWeight: FontWeight.bold, color: Color(0xff292D32)),
  156. ),
  157. Spacer(),
  158. ElevatedButton(
  159. style: ElevatedButton.styleFrom(
  160. backgroundColor: Color(0xff078C84).withOpacity(0.1)),
  161. onPressed: () => context.go('/account'),
  162. child: Text(
  163. 'Customize',
  164. style: TextStyle(
  165. color: Color(0xff078C84), fontWeight: FontWeight.w300),
  166. ))
  167. ],
  168. ),
  169. );
  170. }
  171. }