import 'package:cpt_payment/router/page/payment_page_router.dart';
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 'package:widgets/utils/dark_theme_util.dart';

import 'offline_payment_view_model.dart';

@RoutePage()
class OfflinePaymentPage extends HookConsumerWidget {
  final String? popTargetRouter;

  const OfflinePaymentPage({
    Key? key,
    @PathParam() required this.popTargetRouter,
  }) : super(key: key);

  //启动并关闭其他栈
  static void startWithPop({required String? popTargetRouter}) {
    appRouter.pushAndPopUntil(
      OfflinePaymentPageRoute(popTargetRouter: popTargetRouter),
      predicate: (route) {
        return route.settings.name == popTargetRouter;
      },
    );
  }

  @override
  Widget build(BuildContext context, WidgetRef ref) {
    final viewModel = ref.read(offlinePaymentViewModelProvider.notifier);

    return Scaffold(
      appBar: MyAppBar.appBar(context, S.current.payment),
      backgroundColor: context.appColors.backgroundWhite,
      body: SizedBox(
        width: double.infinity,
        child: Column(
          children: [
            //图片
            const MyAssetImage(
              Assets.paymentOfflinePaymentIcon,
              width: 236.5,
              height: 182,
            ).marginOnly(top: 60),

            //支付成功
            MyTextView(
              S.current.offline_payment,
              fontSize: 16,
              marginBottom: 30,
              marginTop: 30,
              isFontMedium: true,
              textColor: context.appColors.textBlack,
            ),
          ],
        ),
      ),
    );
  }
}
