listblock.dart 4.9 KB

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