list.dart 5.8 KB

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