list.dart 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  1. import 'package:flutter/material.dart';
  2. import 'package:go_router/go_router.dart';
  3. import 'package:namer_app/data.dart';
  4. class ListPage extends StatelessWidget {
  5. const ListPage({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. '${date.hour}:${date.minute}',
  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. // DateTime now = DateTime.now();
  116. // String date = DateFormat('kk:mm').format(now);
  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. }