123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139 |
- 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/cupertino.dart';
- import 'package:plugin_platform/engine/dialog/dialog_engine.dart';
- import 'package:plugin_platform/engine/toast/toast_engine.dart';
- import 'package:riverpod_annotation/riverpod_annotation.dart';
- import 'package:shared/utils/color_utils.dart';
- import 'package:shared/utils/log_utils.dart';
- import 'package:widgets/load_state_layout.dart';
- import 'package:widgets/my_text_view.dart';
- import 'package:widgets/widget_export.dart';
- import 'package:widgets/dialog/dialog_content_wrap.dart';
- import './property_ioan_state.dart';
- part 'property_ioan_vm.g.dart';
- @riverpod
- class PropertyIoanVm extends _$PropertyIoanVm {
- bool _needShowPlaceholder = false; //是否展示LoadingView
- // Refresh 控制器
- final EasyRefreshController refreshController = EasyRefreshController(
- controlFinishRefresh: true, //允许刷新
- controlFinishLoad: true, //允许加载
- );
- PropertyIoanState initState() {
- return PropertyIoanState(
- lowestFloatingRate: "3.79%",
- lowestFixedRate: "2.48%",
- othersOfferingPic: "",
- othersOfferingInfoList: [
- {
- "floating": "3.08%",
- "fixed": "3.79%",
- },
- {
- "floating": "3.08%",
- "fixed": "3.79%",
- }
- ],
- offerTextInfoList: [
- {"title": S.current.new_homeLoans, "icon": Assets.propertyNewHomeLoans, "iconWidth": 46.0, "iconHeight": 42.5},
- {"title": S.current.refinancing, "icon": Assets.propertyRefinancing, "iconWidth": 37.0, "iconHeight": 41.5},
- {"title": S.current.home_equity_loans, "icon": Assets.propertyHomeEquityLoans, "iconWidth": 41.5, "iconHeight": 42.5},
- {"title": S.current.conveyancing_lawyer, "icon": Assets.propertyConveyancingLawyer, "iconWidth": 42.0, "iconHeight": 42.0},
- {"title": S.current.approval_in_principle, "icon": Assets.propertyApproval, "iconWidth": 41.0, "iconHeight": 39.0},
- {"title": S.current.overseas_home_loan, "icon": Assets.propertyOverseasHomeLoan, "iconWidth": 36.0, "iconHeight": 39.0}
- ],
- );
- }
- @override
- PropertyIoanState build() {
- // 引入数据仓库
- // propertyIoanRepository = ref.read(propertyIoanRepositoryProvider);
- // 初始化状态
- PropertyIoanState state = initState();
- // 初始化列表数据
- return state;
- }
- //刷新页面状态
- void changeLoadingState(LoadState loadState, String? errorMsg) {
- state = state.copyWith(loadingState: loadState, errorMessage: errorMsg);
- }
- // 重试请求
- Future retryRequest() async {
- _needShowPlaceholder = true;
- featchData();
- }
- // 初始化页面数据
- initPageData() {
- Log.d("----property_news_vm-----initPageData");
- featchData();
- }
- Future featchData() async {
- await Future.delayed(const Duration(milliseconds: 1500));
- //更新展示的状态
- changeLoadingState(LoadState.State_Success, null);
- // 最后赋值
- _needShowPlaceholder = false;
- }
- requestQuoteConfirmAction() {
- Log.d("点击了确定");
- DialogEngine.dismiss(tag: "requestQuote");
- }
- requestQuoteCancelAction() {
- Log.d("点击了取消");
- }
- handlerRequestQuote(BuildContext context) async {
- Log.d("点击了请求报价");
- // ToastEngine.show("暂未开放");
- await DialogEngine.show(
- tag: "requestQuote",
- position: DialogPosition.bottom,
- widget: DialogContentWrap(
- confirmAction: requestQuoteConfirmAction,
- cancelAction: requestQuoteCancelAction,
- messageBuilder: (context) {
- return Container(
- padding: const EdgeInsets.only(left: 15, right: 15),
- child: Column(mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [
- MyTextView(
- "Submit Request?",
- textColor: context.appColors.textBlack,
- textAlign: TextAlign.left,
- fontWeight: FontWeight.w500,
- fontSize: 21,
- // maxLines: 5,
- marginBottom: 20,
- ),
- MyTextView(
- "A mortgage specialist will be incontact to help you compare theatest housing loan rates and tosecure the best package that suitsyour need",
- textColor: ColorUtils.string2Color('#666666'),
- textAlign: TextAlign.left,
- // maxLines: 5,
- ),
- MyTextView(
- "This is a complementary servicebrought to you by YY Home",
- textColor: ColorUtils.string2Color('#666666'),
- textAlign: TextAlign.left,
- // maxLines: 5,
- marginTop: 15,
- ),
- ]));
- },
- ),
- );
- }
- }
|