listblock.dart 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  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. SizedBox(
  66. width: 60,
  67. height: 60,
  68. child: gambar(items[index]),
  69. ),
  70. Text(items[index]['type']),
  71. ],
  72. ),
  73. itemCount: 7,
  74. ),
  75. AvailableMenu(),
  76. GridView.builder(
  77. shrinkWrap: true,
  78. gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
  79. crossAxisCount: 4, childAspectRatio: 16 / 9),
  80. itemBuilder: (context, index) => Column(
  81. mainAxisAlignment: MainAxisAlignment.spaceEvenly,
  82. children: [
  83. SizedBox(
  84. width: 60,
  85. height: 60,
  86. child: gambar(items[index]),
  87. ),
  88. Text(items[index]['type']),
  89. ],
  90. ),
  91. itemCount: items.length,
  92. ),
  93. ],
  94. ),
  95. ),
  96. ]));
  97. }
  98. Container gambar(items) {
  99. return Container(
  100. decoration: BoxDecoration(
  101. border: Border.all(color: items['color']),
  102. borderRadius: BorderRadius.all(Radius.circular(20)),
  103. color: items['color'].withOpacity(0.4)),
  104. padding: const EdgeInsets.all(5.0),
  105. child: Image.asset(
  106. items['image'],
  107. fit: BoxFit.cover,
  108. ),
  109. );
  110. }
  111. }
  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: () => context.go('/account'),
  154. child: Text(
  155. 'Customize',
  156. style: TextStyle(
  157. color: Color(0xff078C84), fontWeight: FontWeight.w300),
  158. ))
  159. ],
  160. ),
  161. );
  162. }
  163. }