list.dart 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  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. 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. 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. class AvailableMenu extends StatelessWidget {
  118. const AvailableMenu({
  119. Key? key,
  120. }) : super(key: key);
  121. @override
  122. Widget build(BuildContext context) {
  123. return Container(
  124. padding: const EdgeInsets.all(5.0),
  125. child: Row(
  126. children: [
  127. Text(
  128. 'Available Menu',
  129. textAlign: TextAlign.left,
  130. style: TextStyle(
  131. fontWeight: FontWeight.bold, color: Color(0xff292D32)),
  132. ),
  133. ],
  134. ),
  135. );
  136. }
  137. }
  138. class TopMenu extends StatelessWidget {
  139. const TopMenu({
  140. Key? key,
  141. }) : super(key: key);
  142. @override
  143. Widget build(BuildContext context) {
  144. return Container(
  145. padding: const EdgeInsets.all(5.0),
  146. child: Row(
  147. children: [
  148. Text(
  149. 'Top Menu',
  150. textAlign: TextAlign.left,
  151. style: TextStyle(
  152. fontWeight: FontWeight.bold, color: Color(0xff292D32)),
  153. ),
  154. Spacer(),
  155. ElevatedButton(
  156. style: ElevatedButton.styleFrom(
  157. backgroundColor: Color(0xff078C84).withOpacity(0.1)),
  158. onPressed: () => context.go('/list/listblock'),
  159. child: Text(
  160. 'Done',
  161. style: TextStyle(
  162. color: Color(0xff078C84), fontWeight: FontWeight.w300),
  163. ))
  164. ],
  165. ),
  166. );
  167. }
  168. }
  169. class IconAdd extends StatelessWidget {
  170. const IconAdd({
  171. Key? key,
  172. }) : super(key: key);
  173. @override
  174. Widget build(BuildContext context) {
  175. return IconButton(
  176. color: Colors.red,
  177. onPressed: () {},
  178. icon: Icon(Icons.add_circle),
  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. IconButton(
  192. icon: Icon(Icons.remove_circle),
  193. color: Colors.red,
  194. onPressed: () {},
  195. ),
  196. SizedBox(width: 10),
  197. IconButton(
  198. onPressed: () {},
  199. icon: Icon(Icons.menu),
  200. )
  201. ],
  202. );
  203. }
  204. }