facility_detail_page.dart 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309
  1. import 'package:cs_resources/generated/assets.dart';
  2. import 'package:cs_resources/generated/l10n.dart';
  3. import 'package:cs_resources/theme/app_colors_theme.dart';
  4. import 'package:flutter/material.dart';
  5. import 'package:auto_route/auto_route.dart';
  6. import 'package:hooks_riverpod/hooks_riverpod.dart';
  7. import 'package:router/ext/auto_router_extensions.dart';
  8. import 'package:widgets/ext/ex_widget.dart';
  9. import 'package:widgets/my_appbar.dart';
  10. import 'package:widgets/my_load_image.dart';
  11. import 'package:widgets/my_text_view.dart';
  12. import '../../router/page/facility_page_router.dart';
  13. import 'facility_detail_view_model.dart';
  14. @RoutePage()
  15. class FacilityDetailPage extends HookConsumerWidget {
  16. const FacilityDetailPage({Key? key}) : super(key: key);
  17. //启动当前页面
  18. static void startInstance({BuildContext? context}) {
  19. if (context != null) {
  20. context.router.push(const FacilityDetailPageRoute());
  21. } else {
  22. appRouter.push(const FacilityDetailPageRoute());
  23. }
  24. }
  25. @override
  26. Widget build(BuildContext context, WidgetRef ref) {
  27. final viewModel = ref.watch(facilityDetailViewModelProvider.notifier);
  28. final state = ref.watch(facilityDetailViewModelProvider);
  29. return Scaffold(
  30. appBar: MyAppBar.appBar(context, "Kids party room", backgroundColor: context.appColors.whiteBG),
  31. backgroundColor: context.appColors.backgroundDark,
  32. body: SingleChildScrollView(
  33. scrollDirection: Axis.vertical,
  34. physics: const BouncingScrollPhysics(),
  35. child: Column(
  36. mainAxisSize: MainAxisSize.max,
  37. crossAxisAlignment: CrossAxisAlignment.center,
  38. children: [
  39. //顶部的信息展示
  40. _buildHeaderWidget(context, ref),
  41. //预定
  42. _buildDetailItem(
  43. context,
  44. ref,
  45. S.current.book,
  46. Assets.facilityConfirmDateIcon,
  47. 28.5,
  48. 29,
  49. "Tue,24 Oct 2023",
  50. null,
  51. "05:00 PM-10:00 PM",
  52. null,
  53. ),
  54. //设施
  55. _buildDetailItem(
  56. context,
  57. ref,
  58. S.current.facility,
  59. Assets.facilityConfirmFacilityIcon,
  60. 25.0,
  61. 30.5,
  62. "Kids party room",
  63. null,
  64. "Blue room",
  65. null,
  66. ),
  67. //付款
  68. _buildDetailItem(
  69. context,
  70. ref,
  71. S.current.payment,
  72. Assets.facilityConfirmPaymentIcon,
  73. 27.0,
  74. 22.0,
  75. "Booking Fee",
  76. "10.80",
  77. S.current.total,
  78. "\$10.80",
  79. ),
  80. // 押金
  81. _buildDetailItem(
  82. context,
  83. ref,
  84. S.current.deposit,
  85. Assets.facilityConfirmDepositIcon,
  86. 28.0,
  87. 26.5,
  88. "On Hold",
  89. "\$100.00",
  90. null,
  91. null,
  92. ),
  93. ],
  94. ),
  95. ),
  96. );
  97. }
  98. Widget _buildHeaderWidget(BuildContext context, WidgetRef ref) {
  99. return Container(
  100. width: double.infinity,
  101. color: context.appColors.whiteBG,
  102. margin: const EdgeInsets.only(bottom: 7.5),
  103. child: Column(
  104. children: [
  105. //成功图片
  106. const MyAssetImage(
  107. Assets.facilityPaymentSuccessIcon,
  108. width: 54,
  109. height: 54,
  110. ).marginOnly(top: 11, bottom: 13),
  111. //支付成功
  112. MyTextView(
  113. S.current.booking_successful,
  114. fontSize: 18,
  115. marginBottom: 3,
  116. isFontMedium: true,
  117. textColor: context.appColors.textPrimary,
  118. ),
  119. MyTextView(
  120. S.current.have_fun,
  121. fontSize: 18,
  122. marginBottom: 19,
  123. isFontMedium: true,
  124. textColor: context.appColors.textPrimary,
  125. ),
  126. //支付金额
  127. MyTextView(
  128. S.current.fee_paid,
  129. fontSize: 15,
  130. isFontRegular: true,
  131. textColor: context.appColors.textBlack,
  132. ),
  133. MyTextView(
  134. "\$10.80",
  135. fontSize: 15,
  136. isFontRegular: true,
  137. textColor: context.appColors.textPrimary,
  138. ),
  139. //付款类型与时间
  140. Row(
  141. mainAxisSize: MainAxisSize.min,
  142. children: [
  143. MyTextView(
  144. "Master card ending",
  145. fontSize: 15,
  146. isFontRegular: true,
  147. textColor: context.appColors.textBlack,
  148. ),
  149. MyTextView(
  150. "9423",
  151. fontSize: 15,
  152. isFontMedium: true,
  153. textColor: context.appColors.textBlack,
  154. ),
  155. ],
  156. ).marginOnly(top: 12),
  157. Row(
  158. mainAxisSize: MainAxisSize.min,
  159. children: [
  160. MyTextView(
  161. S.current.paid_on,
  162. fontSize: 15,
  163. isFontRegular: true,
  164. textColor: context.appColors.textBlack,
  165. ),
  166. MyTextView(
  167. "24 Oct 2023 at 02:19 PM",
  168. fontSize: 15,
  169. isFontMedium: true,
  170. textColor: context.appColors.textBlack,
  171. ),
  172. ],
  173. ).marginOnly(top: 5),
  174. Divider(height: 0.5, color: context.appColors.dividerDefault).marginOnly(top: 14, bottom: 14),
  175. //押金
  176. MyTextView(
  177. S.current.deposit_released_caps,
  178. fontSize: 15,
  179. isFontRegular: true,
  180. textColor: context.appColors.textBlack,
  181. ),
  182. MyTextView(
  183. "\$100.00",
  184. fontSize: 15,
  185. marginTop: 5,
  186. isFontRegular: true,
  187. textColor: context.appColors.textPrimary,
  188. ),
  189. const SizedBox(height: 23),
  190. ],
  191. ),
  192. );
  193. }
  194. //Item的列表
  195. Widget _buildDetailItem(
  196. BuildContext context,
  197. WidgetRef ref,
  198. String title,
  199. String iconPath,
  200. double iconWidth,
  201. double iconHeight,
  202. String line1Txt,
  203. String? line1Content,
  204. String? line2Txt,
  205. String? line2Content,
  206. ) {
  207. return Container(
  208. width: double.infinity,
  209. height: 92.5,
  210. padding: const EdgeInsets.only(left: 20, right: 20),
  211. margin: const EdgeInsets.only(left: 15, right: 15, top: 7.5, bottom: 7.5),
  212. decoration: BoxDecoration(
  213. color: context.appColors.whiteBG,
  214. borderRadius: BorderRadius.circular(6.0), // 圆角
  215. boxShadow: [
  216. BoxShadow(
  217. color: const Color(0xFFB8BFD9).withOpacity(0.3), // 阴影颜色
  218. offset: const Offset(0, 3), // 阴影的偏移量
  219. blurRadius: 8.0, // 模糊半径
  220. spreadRadius: 3.0, // 扩散半径
  221. ),
  222. ],
  223. ),
  224. child: Center(
  225. child: Column(
  226. crossAxisAlignment: CrossAxisAlignment.start,
  227. mainAxisSize: MainAxisSize.min,
  228. children: [
  229. MyTextView(
  230. title,
  231. textColor: context.appColors.textBlack,
  232. fontSize: 16,
  233. marginBottom: 7,
  234. isFontMedium: true,
  235. ),
  236. Row(
  237. mainAxisSize: MainAxisSize.max,
  238. children: [
  239. MyAssetImage(
  240. iconPath,
  241. width: iconWidth,
  242. height: iconHeight,
  243. ).marginOnly(right: 15),
  244. Column(
  245. mainAxisSize: MainAxisSize.min,
  246. children: [
  247. Row(
  248. children: [
  249. MyTextView(
  250. line1Txt,
  251. textColor: context.appColors.textBlack,
  252. fontSize: 14,
  253. isFontRegular: true,
  254. ).expanded(),
  255. MyTextView(
  256. line1Content ?? "",
  257. textColor: context.appColors.textBlack,
  258. fontSize: 14,
  259. isFontRegular: true,
  260. ),
  261. ],
  262. ),
  263. Visibility(
  264. visible: line2Txt != null,
  265. child: Row(
  266. children: [
  267. MyTextView(
  268. line2Txt ?? "",
  269. textColor: context.appColors.textBlack,
  270. fontSize: 14,
  271. isFontRegular: true,
  272. ).expanded(),
  273. MyTextView(
  274. line2Content ?? "",
  275. textColor: context.appColors.textBlack,
  276. fontSize: 14,
  277. isFontRegular: true,
  278. ),
  279. ],
  280. ).marginOnly(top: 6),
  281. ),
  282. ],
  283. ).expanded(),
  284. ],
  285. ),
  286. ],
  287. ),
  288. ),
  289. );
  290. }
  291. }