123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309 |
- import 'package:cs_resources/generated/assets.dart';
- import 'package:cs_resources/generated/l10n.dart';
- import 'package:cs_resources/theme/app_colors_theme.dart';
- import 'package:flutter/material.dart';
- import 'package:auto_route/auto_route.dart';
- import 'package:hooks_riverpod/hooks_riverpod.dart';
- import 'package:router/ext/auto_router_extensions.dart';
- import 'package:widgets/ext/ex_widget.dart';
- import 'package:widgets/my_appbar.dart';
- import 'package:widgets/my_load_image.dart';
- import 'package:widgets/my_text_view.dart';
- import '../../router/page/facility_page_router.dart';
- import 'facility_detail_view_model.dart';
- @RoutePage()
- class FacilityDetailPage extends HookConsumerWidget {
- const FacilityDetailPage({Key? key}) : super(key: key);
- //启动当前页面
- static void startInstance({BuildContext? context}) {
- if (context != null) {
- context.router.push(const FacilityDetailPageRoute());
- } else {
- appRouter.push(const FacilityDetailPageRoute());
- }
- }
- @override
- Widget build(BuildContext context, WidgetRef ref) {
- final viewModel = ref.watch(facilityDetailViewModelProvider.notifier);
- final state = ref.watch(facilityDetailViewModelProvider);
- return Scaffold(
- appBar: MyAppBar.appBar(context, "Kids party room", backgroundColor: context.appColors.whiteBG),
- backgroundColor: context.appColors.backgroundDark,
- body: SingleChildScrollView(
- scrollDirection: Axis.vertical,
- physics: const BouncingScrollPhysics(),
- child: Column(
- mainAxisSize: MainAxisSize.max,
- crossAxisAlignment: CrossAxisAlignment.center,
- children: [
- //顶部的信息展示
- _buildHeaderWidget(context, ref),
- //预定
- _buildDetailItem(
- context,
- ref,
- S.current.book,
- Assets.facilityConfirmDateIcon,
- 28.5,
- 29,
- "Tue,24 Oct 2023",
- null,
- "05:00 PM-10:00 PM",
- null,
- ),
- //设施
- _buildDetailItem(
- context,
- ref,
- S.current.facility,
- Assets.facilityConfirmFacilityIcon,
- 25.0,
- 30.5,
- "Kids party room",
- null,
- "Blue room",
- null,
- ),
- //付款
- _buildDetailItem(
- context,
- ref,
- S.current.payment,
- Assets.facilityConfirmPaymentIcon,
- 27.0,
- 22.0,
- "Booking Fee",
- "10.80",
- S.current.total,
- "\$10.80",
- ),
- // 押金
- _buildDetailItem(
- context,
- ref,
- S.current.deposit,
- Assets.facilityConfirmDepositIcon,
- 28.0,
- 26.5,
- "On Hold",
- "\$100.00",
- null,
- null,
- ),
- ],
- ),
- ),
- );
- }
- Widget _buildHeaderWidget(BuildContext context, WidgetRef ref) {
- return Container(
- width: double.infinity,
- color: context.appColors.whiteBG,
- margin: const EdgeInsets.only(bottom: 7.5),
- child: Column(
- children: [
- //成功图片
- const MyAssetImage(
- Assets.facilityPaymentSuccessIcon,
- width: 54,
- height: 54,
- ).marginOnly(top: 11, bottom: 13),
- //支付成功
- MyTextView(
- S.current.booking_successful,
- fontSize: 18,
- marginBottom: 3,
- isFontMedium: true,
- textColor: context.appColors.textPrimary,
- ),
- MyTextView(
- S.current.have_fun,
- fontSize: 18,
- marginBottom: 19,
- isFontMedium: true,
- textColor: context.appColors.textPrimary,
- ),
- //支付金额
- MyTextView(
- S.current.fee_paid,
- fontSize: 15,
- isFontRegular: true,
- textColor: context.appColors.textBlack,
- ),
- MyTextView(
- "\$10.80",
- fontSize: 15,
- isFontRegular: true,
- textColor: context.appColors.textPrimary,
- ),
- //付款类型与时间
- Row(
- mainAxisSize: MainAxisSize.min,
- children: [
- MyTextView(
- "Master card ending",
- fontSize: 15,
- isFontRegular: true,
- textColor: context.appColors.textBlack,
- ),
- MyTextView(
- "9423",
- fontSize: 15,
- isFontMedium: true,
- textColor: context.appColors.textBlack,
- ),
- ],
- ).marginOnly(top: 12),
- Row(
- mainAxisSize: MainAxisSize.min,
- children: [
- MyTextView(
- S.current.paid_on,
- fontSize: 15,
- isFontRegular: true,
- textColor: context.appColors.textBlack,
- ),
- MyTextView(
- "24 Oct 2023 at 02:19 PM",
- fontSize: 15,
- isFontMedium: true,
- textColor: context.appColors.textBlack,
- ),
- ],
- ).marginOnly(top: 5),
- Divider(height: 0.5, color: context.appColors.dividerDefault).marginOnly(top: 14, bottom: 14),
- //押金
- MyTextView(
- S.current.deposit_released_caps,
- fontSize: 15,
- isFontRegular: true,
- textColor: context.appColors.textBlack,
- ),
- MyTextView(
- "\$100.00",
- fontSize: 15,
- marginTop: 5,
- isFontRegular: true,
- textColor: context.appColors.textPrimary,
- ),
- const SizedBox(height: 23),
- ],
- ),
- );
- }
- //Item的列表
- Widget _buildDetailItem(
- BuildContext context,
- WidgetRef ref,
- String title,
- String iconPath,
- double iconWidth,
- double iconHeight,
- String line1Txt,
- String? line1Content,
- String? line2Txt,
- String? line2Content,
- ) {
- return Container(
- width: double.infinity,
- height: 92.5,
- padding: const EdgeInsets.only(left: 20, right: 20),
- margin: const EdgeInsets.only(left: 15, right: 15, top: 7.5, bottom: 7.5),
- decoration: BoxDecoration(
- color: context.appColors.whiteBG,
- borderRadius: BorderRadius.circular(6.0), // 圆角
- boxShadow: [
- BoxShadow(
- color: const Color(0xFFB8BFD9).withOpacity(0.3), // 阴影颜色
- offset: const Offset(0, 3), // 阴影的偏移量
- blurRadius: 8.0, // 模糊半径
- spreadRadius: 3.0, // 扩散半径
- ),
- ],
- ),
- child: Center(
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- mainAxisSize: MainAxisSize.min,
- children: [
- MyTextView(
- title,
- textColor: context.appColors.textBlack,
- fontSize: 16,
- marginBottom: 7,
- isFontMedium: true,
- ),
- Row(
- mainAxisSize: MainAxisSize.max,
- children: [
- MyAssetImage(
- iconPath,
- width: iconWidth,
- height: iconHeight,
- ).marginOnly(right: 15),
- Column(
- mainAxisSize: MainAxisSize.min,
- children: [
- Row(
- children: [
- MyTextView(
- line1Txt,
- textColor: context.appColors.textBlack,
- fontSize: 14,
- isFontRegular: true,
- ).expanded(),
- MyTextView(
- line1Content ?? "",
- textColor: context.appColors.textBlack,
- fontSize: 14,
- isFontRegular: true,
- ),
- ],
- ),
- Visibility(
- visible: line2Txt != null,
- child: Row(
- children: [
- MyTextView(
- line2Txt ?? "",
- textColor: context.appColors.textBlack,
- fontSize: 14,
- isFontRegular: true,
- ).expanded(),
- MyTextView(
- line2Content ?? "",
- textColor: context.appColors.textBlack,
- fontSize: 14,
- isFontRegular: true,
- ),
- ],
- ).marginOnly(top: 6),
- ),
- ],
- ).expanded(),
- ],
- ),
- ],
- ),
- ),
- );
- }
- }
|