list.dart 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  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 ListPage extends StatelessWidget {
  6. const ListPage({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. toolbarHeight: 44,
  14. title: Text(
  15. date,
  16. // '${date.hour}:${date.minute}',
  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. SingleChildScrollView(
  42. child: 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. Column(
  59. children: List.generate(
  60. 7,
  61. (i) => SizedBox(
  62. child: ListTile(
  63. leading: gambar(items[i]),
  64. title: Text(items[i].type),
  65. subtitle: Text(
  66. 'Description of ${items[i].type.toLowerCase()}'),
  67. trailing: IconDelete(),
  68. ),
  69. )),
  70. ),
  71. Divider(
  72. thickness: 8,
  73. ),
  74. AvailableMenu(),
  75. Column(
  76. children: List.generate(
  77. items.length,
  78. (i) => SizedBox(
  79. child: ListTile(
  80. leading: gambar(items[i]),
  81. title: Text(items[i].type),
  82. subtitle: Text(
  83. 'Description of ${items[i].type.toLowerCase()}'),
  84. trailing: IconAdd(),
  85. ),
  86. )),
  87. )
  88. ],
  89. ),
  90. ),
  91. ),
  92. ]));
  93. }
  94. Container gambar(items) {
  95. return Container(
  96. decoration: BoxDecoration(
  97. border: Border.all(color: items.color),
  98. borderRadius: BorderRadius.all(Radius.circular(20)),
  99. color: items.color.withOpacity(0.4)),
  100. padding: const EdgeInsets.all(5.0),
  101. child: Image.asset(
  102. items.image,
  103. width: 36,
  104. height: 36,
  105. fit: BoxFit.cover,
  106. ),
  107. );
  108. }
  109. }
  110. class Data {
  111. String type;
  112. Color color;
  113. String image;
  114. Data({required this.type, required this.color, required this.image});
  115. }
  116. var date = formatDate(DateTime.now(), [HH, ':', nn]);
  117. // var date = DateTime.now();
  118. class AvailableMenu extends StatelessWidget {
  119. const AvailableMenu({
  120. Key? key,
  121. }) : super(key: key);
  122. @override
  123. Widget build(BuildContext context) {
  124. return Container(
  125. padding: const EdgeInsets.all(5.0),
  126. child: Row(
  127. children: [
  128. Text(
  129. 'Available Menu',
  130. textAlign: TextAlign.left,
  131. style: TextStyle(
  132. fontWeight: FontWeight.bold, color: Color(0xff292D32)),
  133. ),
  134. ],
  135. ),
  136. );
  137. }
  138. }
  139. class TopMenu extends StatelessWidget {
  140. const TopMenu({
  141. Key? key,
  142. }) : super(key: key);
  143. @override
  144. Widget build(BuildContext context) {
  145. return Container(
  146. padding: const EdgeInsets.all(5.0),
  147. child: Row(
  148. children: [
  149. Text(
  150. 'Top Menu',
  151. textAlign: TextAlign.left,
  152. style: TextStyle(
  153. fontWeight: FontWeight.bold, color: Color(0xff292D32)),
  154. ),
  155. Spacer(),
  156. ElevatedButton(
  157. style: ElevatedButton.styleFrom(
  158. backgroundColor: Color(0xff078C84).withOpacity(0.1)),
  159. onPressed: () => context.go('/list/listblock'),
  160. child: Text(
  161. 'Done',
  162. style: TextStyle(
  163. color: Color(0xff078C84), fontWeight: FontWeight.w300),
  164. ))
  165. ],
  166. ),
  167. );
  168. }
  169. }
  170. class IconAdd extends StatelessWidget {
  171. const IconAdd({
  172. Key? key,
  173. }) : super(key: key);
  174. @override
  175. Widget build(BuildContext context) {
  176. return Icon(
  177. Icons.add_circle,
  178. color: Colors.red,
  179. );
  180. }
  181. }
  182. class IconDelete extends StatelessWidget {
  183. const IconDelete({
  184. Key? key,
  185. }) : super(key: key);
  186. @override
  187. Widget build(BuildContext context) {
  188. return Row(
  189. mainAxisSize: MainAxisSize.min,
  190. children: [
  191. Icon(
  192. Icons.remove_circle,
  193. color: Colors.red,
  194. ),
  195. SizedBox(width: 10),
  196. Icon(Icons.menu),
  197. ],
  198. );
  199. }
  200. }