listblock.dart 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  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. class ListBlockPage extends StatelessWidget {
  6. const ListBlockPage({Key? key}) : super(key: key);
  7. @override
  8. Widget build(BuildContext context) {
  9. return Scaffold(
  10. appBar: AppBar(
  11. backgroundColor: Color(0xff078C84),
  12. automaticallyImplyLeading: false,
  13. elevation: 0,
  14. toolbarHeight: 44,
  15. title: Text(
  16. date,
  17. style: TextStyle(color: Colors.white, fontSize: 15),
  18. ),
  19. actions: [
  20. Icon(
  21. Icons.signal_cellular_alt,
  22. color: Colors.white,
  23. ),
  24. Icon(
  25. Icons.wifi,
  26. color: Colors.white,
  27. ),
  28. RotatedBox(
  29. quarterTurns: -3,
  30. child: Icon(
  31. Icons.battery_std,
  32. color: Colors.white,
  33. ),
  34. )
  35. ],
  36. ),
  37. body: Stack(children: [
  38. Container(
  39. decoration: BoxDecoration(color: Color(0xff078C84)),
  40. ),
  41. Container(
  42. decoration: BoxDecoration(
  43. color: Colors.white,
  44. borderRadius: BorderRadius.only(
  45. topLeft: Radius.circular(16),
  46. topRight: Radius.circular(16)),
  47. border: Border.all(color: Color(0xff078C84))),
  48. child: Column(
  49. children: [
  50. Container(
  51. margin: EdgeInsets.symmetric(vertical: 5),
  52. color: Color(0xff292D32).withOpacity(0.15),
  53. height: 1,
  54. width: 24,
  55. ),
  56. TopMenu(),
  57. GridView.builder(
  58. shrinkWrap: true,
  59. gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
  60. crossAxisCount: 4, childAspectRatio: 16 / 9),
  61. itemBuilder: (context, index) => Column(
  62. mainAxisAlignment: MainAxisAlignment.spaceEvenly,
  63. children: [
  64. gambar(items[index]),
  65. Text(items[index].type),
  66. ],
  67. ),
  68. itemCount: 7,
  69. ),
  70. AvailableMenu(),
  71. GridView.builder(
  72. shrinkWrap: true,
  73. gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
  74. crossAxisCount: 4, childAspectRatio: 16 / 9),
  75. itemBuilder: (context, index) => Column(
  76. mainAxisAlignment: MainAxisAlignment.spaceEvenly,
  77. children: [
  78. gambar(items[index]),
  79. Text(items[index].type),
  80. ],
  81. ),
  82. itemCount: items.length,
  83. ),
  84. ],
  85. ),
  86. ),
  87. ]));
  88. }
  89. Container gambar(items) {
  90. return Container(
  91. decoration: BoxDecoration(
  92. border: Border.all(color: items.color),
  93. borderRadius: BorderRadius.all(Radius.circular(20)),
  94. color: items.color.withOpacity(0.4)),
  95. padding: const EdgeInsets.all(5.0),
  96. child: Image.asset(
  97. items.image,
  98. width: 36,
  99. height: 36,
  100. fit: BoxFit.cover,
  101. ),
  102. );
  103. }
  104. }
  105. class Data {
  106. String type;
  107. Color color;
  108. String image;
  109. Data({required this.type, required this.color, required this.image});
  110. }
  111. var date = formatDate(DateTime.now(), [HH, ':', nn]);
  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. }