listblock.dart 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  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. gambar(items[index]),
  66. Text(items[index]['type']),
  67. ],
  68. ),
  69. itemCount: 7,
  70. ),
  71. AvailableMenu(),
  72. GridView.builder(
  73. shrinkWrap: true,
  74. gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
  75. crossAxisCount: 4, childAspectRatio: 16 / 9),
  76. itemBuilder: (context, index) => Column(
  77. mainAxisAlignment: MainAxisAlignment.spaceEvenly,
  78. children: [
  79. gambar(items[index]),
  80. Text(items[index]['type']),
  81. ],
  82. ),
  83. itemCount: items.length,
  84. ),
  85. ],
  86. ),
  87. ),
  88. ]));
  89. }
  90. Container gambar(items) {
  91. return Container(
  92. decoration: BoxDecoration(
  93. border: Border.all(color: items['color']),
  94. borderRadius: BorderRadius.all(Radius.circular(20)),
  95. color: items['color'].withOpacity(0.4)),
  96. padding: const EdgeInsets.all(5.0),
  97. child: Image.asset(
  98. items['image'],
  99. width: 36,
  100. height: 36,
  101. fit: BoxFit.cover,
  102. ),
  103. );
  104. }
  105. }
  106. class AvailableMenu extends StatelessWidget {
  107. const AvailableMenu({
  108. Key? key,
  109. }) : super(key: key);
  110. @override
  111. Widget build(BuildContext context) {
  112. return Container(
  113. padding: const EdgeInsets.all(5.0),
  114. child: Row(
  115. children: [
  116. Text(
  117. 'Available Menu',
  118. textAlign: TextAlign.left,
  119. style: TextStyle(
  120. fontWeight: FontWeight.bold, color: Color(0xff292D32)),
  121. ),
  122. ],
  123. ),
  124. );
  125. }
  126. }
  127. class TopMenu extends StatelessWidget {
  128. const TopMenu({
  129. Key? key,
  130. }) : super(key: key);
  131. @override
  132. Widget build(BuildContext context) {
  133. return Container(
  134. padding: const EdgeInsets.all(5.0),
  135. child: Row(
  136. children: [
  137. Text(
  138. 'Top Menu',
  139. textAlign: TextAlign.left,
  140. style: TextStyle(
  141. fontWeight: FontWeight.bold, color: Color(0xff292D32)),
  142. ),
  143. Spacer(),
  144. ElevatedButton(
  145. style: ElevatedButton.styleFrom(
  146. backgroundColor: Color(0xff078C84).withOpacity(0.1)),
  147. onPressed: () => context.go('/account'),
  148. child: Text(
  149. 'Customize',
  150. style: TextStyle(
  151. color: Color(0xff078C84), fontWeight: FontWeight.w300),
  152. ))
  153. ],
  154. ),
  155. );
  156. }
  157. }