property_ioan_page.dart 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423
  1. import 'package:cs_resources/generated/assets.dart';
  2. import 'package:cs_resources/theme/app_colors_theme.dart';
  3. import 'package:flutter/material.dart';
  4. import 'package:auto_route/auto_route.dart';
  5. import 'package:flutter_hooks/flutter_hooks.dart';
  6. import 'package:hooks_riverpod/hooks_riverpod.dart';
  7. import 'package:plugin_platform/engine/toast/toast_engine.dart';
  8. import 'package:router/ext/auto_router_extensions.dart';
  9. import 'package:shared/utils/color_utils.dart';
  10. import 'package:widgets/ext/ex_widget.dart';
  11. import 'package:widgets/load_state_layout.dart';
  12. import 'package:widgets/my_button.dart';
  13. import 'package:widgets/my_load_image.dart';
  14. import 'package:widgets/my_text_view.dart';
  15. import '../../../router/page/property_page_router.dart';
  16. import 'property_ioan_vm.dart';
  17. @RoutePage()
  18. class PropertyIoanPage extends HookConsumerWidget {
  19. const PropertyIoanPage({Key? key}) : super(key: key);
  20. //启动当前页面
  21. static void startInstance({BuildContext? context}) {
  22. if (context != null) {
  23. context.router.push(const PropertyIoanPageRoute());
  24. } else {
  25. appRouter.push(const PropertyIoanPageRoute());
  26. }
  27. }
  28. Widget _buildContentTopAdviceSection(BuildContext context,WidgetRef ref, _vm){
  29. return Column(
  30. children: [
  31. MyTextView(
  32. "YY Home",
  33. textColor: context.appColors.textBlack,
  34. fontSize: 27,
  35. isFontMedium: true,
  36. textAlign: TextAlign.center,
  37. ),
  38. MyTextView(
  39. "Find the best home loan for you",
  40. textColor: context.appColors.textBlack,
  41. fontSize: 16,
  42. isFontRegular: true,
  43. marginBottom: 14,
  44. textAlign: TextAlign.center,
  45. ),
  46. Container(
  47. width: double.infinity,
  48. height: 210,
  49. decoration: BoxDecoration(
  50. borderRadius: BorderRadius.circular(0),
  51. color: ColorUtils.string2Color('#FEFEFE'),
  52. image: const DecorationImage(
  53. image: AssetImage('packages/cs_resources/${Assets.propertyHomeLoanBg}'), // 使用包中的资源
  54. fit: BoxFit.cover,
  55. ),
  56. ),
  57. child: Column(
  58. children: [
  59. MyTextView(
  60. "YY Home exclusive rates:",
  61. textColor: ColorUtils.string2Color('#FEFEFE'),
  62. fontSize: 15,
  63. boxWidth: 237,
  64. boxHeight: 35,
  65. alignment: Alignment.center,
  66. textAlign: TextAlign.center,
  67. marginTop: 5.5,
  68. backgroundColor: ColorUtils.string2Color('#4161D0')
  69. ),
  70. Expanded(
  71. child: Row(
  72. mainAxisAlignment: MainAxisAlignment.center,
  73. children: [
  74. Container(
  75. width: 105,
  76. height: 105,
  77. padding: const EdgeInsets.all(5),
  78. color: ColorUtils.string2Color('#4161D0'),
  79. child: Column(
  80. mainAxisAlignment: MainAxisAlignment.center,
  81. crossAxisAlignment: CrossAxisAlignment.center,
  82. children: [
  83. MyTextView(
  84. _vm.state.lowestFloatingRate,
  85. textColor: ColorUtils.string2Color('#FEFEFE'),
  86. fontSize: 30,
  87. ),
  88. MyTextView(
  89. "Lowest Floating Rate",
  90. textColor: ColorUtils.string2Color('#FEFEFE'),
  91. fontSize: 14,
  92. textAlign: TextAlign.center,
  93. ),
  94. ]
  95. )
  96. ),
  97. Container(
  98. width: 105,
  99. height: 105,
  100. padding: const EdgeInsets.all(5),
  101. color: ColorUtils.string2Color('#4161D0'),
  102. margin: const EdgeInsets.only(left: 18),
  103. child: Column(
  104. mainAxisAlignment: MainAxisAlignment.center,
  105. crossAxisAlignment: CrossAxisAlignment.center,
  106. children: [
  107. MyTextView(
  108. _vm.state.lowestFixedRate,
  109. textColor: ColorUtils.string2Color('#FEFEFE'),
  110. fontSize: 30,
  111. ),
  112. MyTextView(
  113. "Lowest Floating Rate",
  114. textColor: ColorUtils.string2Color('#FEFEFE'),
  115. fontSize: 14,
  116. textAlign: TextAlign.center,
  117. ),
  118. ]
  119. )
  120. ),
  121. ],
  122. ),
  123. ),
  124. ],
  125. ),
  126. ),
  127. MyTextView(
  128. "Check out what others are offering:",
  129. textColor: ColorUtils.string2Color('#FEFEFE'),
  130. fontSize: 15,
  131. boxWidth: double.infinity,
  132. boxHeight: 40.5,
  133. alignment: Alignment.center,
  134. textAlign: TextAlign.center,
  135. backgroundColor: ColorUtils.string2Color('#4161D0'),
  136. ),
  137. const SizedBox(height: 20),
  138. Row(
  139. mainAxisAlignment: MainAxisAlignment.start,
  140. children: [
  141. MyLoadImage(
  142. Assets.propertyAdvicePic,
  143. width: 132,
  144. // height: 122.5,
  145. ),
  146. Expanded(
  147. child: Container(
  148. // color: Colors.red,
  149. padding: const EdgeInsets.only(left: 20,right: 20),
  150. child: Column(
  151. // mainAxisAlignment: MainAxisAlignment.end,
  152. crossAxisAlignment: CrossAxisAlignment.start,
  153. children: [
  154. Row(
  155. mainAxisAlignment: MainAxisAlignment.center,
  156. children: [
  157. MyTextView(
  158. "Floating",
  159. textColor: context.appColors.textBlack,
  160. fontSize: 14,
  161. textAlign: TextAlign.center,
  162. ),
  163. MyTextView(
  164. "Fixed",
  165. textColor: context.appColors.textBlack,
  166. fontSize: 14,
  167. textAlign: TextAlign.center,
  168. marginLeft: 50.5,
  169. ),
  170. ],
  171. ),
  172. // const SizedBox(height: 10),
  173. Expanded(child: Column(
  174. mainAxisAlignment: MainAxisAlignment.center,
  175. children: [
  176. Row(
  177. mainAxisAlignment: MainAxisAlignment.center,
  178. children: [
  179. MyTextView(
  180. "3.08%",
  181. textColor: context.appColors.textBlack,
  182. fontSize: 16,
  183. textAlign: TextAlign.center,
  184. isFontMedium: true,
  185. marginLeft: 15,
  186. ),
  187. MyTextView(
  188. "2.50%",
  189. textColor: context.appColors.textBlack,
  190. fontSize: 16,
  191. textAlign: TextAlign.center,
  192. isFontMedium: true,
  193. marginLeft: 50.5,
  194. ),
  195. ],
  196. ),
  197. Row(
  198. mainAxisAlignment: MainAxisAlignment.center,
  199. children: [
  200. MyTextView(
  201. "3.08%",
  202. textColor: context.appColors.textBlack,
  203. fontSize: 16,
  204. textAlign: TextAlign.center,
  205. isFontMedium: true,
  206. marginLeft: 15,
  207. ),
  208. MyTextView(
  209. "2.50%",
  210. textColor: context.appColors.textBlack,
  211. fontSize: 16,
  212. textAlign: TextAlign.center,
  213. isFontMedium: true,
  214. marginLeft: 50.5,
  215. ),
  216. ],
  217. ).marginOnly(top: 15),
  218. Row(
  219. mainAxisAlignment: MainAxisAlignment.center,
  220. children: [
  221. MyTextView(
  222. "3.08%",
  223. textColor: context.appColors.textBlack,
  224. fontSize: 16,
  225. textAlign: TextAlign.center,
  226. isFontMedium: true,
  227. marginLeft: 15,
  228. ),
  229. MyTextView(
  230. "2.50%",
  231. textColor: context.appColors.textBlack,
  232. fontSize: 16,
  233. textAlign: TextAlign.center,
  234. isFontMedium: true,
  235. marginLeft: 47.5,
  236. ),
  237. ],
  238. ).marginOnly(top: 15),
  239. ],
  240. ))
  241. ],
  242. ),
  243. ),
  244. ),
  245. ],
  246. ).constrained(height: 160),
  247. ],
  248. );
  249. }
  250. Widget _buildContentMiddleTextSection(BuildContext context,WidgetRef ref, _vm) {
  251. return Column(
  252. children: [
  253. MyTextView(
  254. "The right advice to help you choose the best package in the market!",
  255. textColor: context.appColors.textBlack,
  256. fontSize: 18,
  257. isFontMedium: true,
  258. marginTop: 20,
  259. marginBottom: 20,
  260. textAlign: TextAlign.center,
  261. ),
  262. MyTextView(
  263. "-No Hidden Fees, We Are Out ToHelp You!-Interest Savings With Lowest RatesGuarantee-One-Stop Access to All The BanksPackages",
  264. textColor: context.appColors.textBlack,
  265. fontSize: 15,
  266. textAlign: TextAlign.center,
  267. marginBottom: 20,
  268. ),
  269. ],
  270. );
  271. }
  272. Widget _buildContentOfferSection(BuildContext context,WidgetRef ref, _vm) {
  273. final offerTextInfoList = _vm.state.offerTextInfoList.map((value) => value).toList();
  274. return Container(
  275. width: double.infinity,
  276. child: Column(
  277. children: [
  278. MyTextView(
  279. "What do we offer?",
  280. textColor: context.appColors.textBlack,
  281. fontSize: 18,
  282. isFontMedium: true,
  283. marginTop: 16.5,
  284. marginBottom: 16.5,
  285. ),
  286. Wrap(
  287. children: List.generate(offerTextInfoList.length, (index){
  288. return Container(
  289. width: MediaQuery.of(context).size.width / 2 - 30,
  290. margin: const EdgeInsets.only(right: 15,bottom: 15),
  291. padding: const EdgeInsets.only(left: 15,right: 15,top:15,bottom:15,),
  292. // decoration: BoxDecoration(
  293. // borderRadius: BorderRadius.circular(10),
  294. // color: ColorUtils.string2Color('#F5F5F5'),
  295. // ),
  296. child: Column(
  297. children: [
  298. MyLoadImage(
  299. offerTextInfoList[index]["icon"],
  300. width: offerTextInfoList[index]["iconWidth"],
  301. height: offerTextInfoList[index]["iconHeight"],
  302. ),
  303. const SizedBox(height: 13,),
  304. MyTextView(
  305. offerTextInfoList[index]["title"],
  306. fontSize: 15,
  307. textColor: context.appColors.textBlack,
  308. textAlign: TextAlign.center,
  309. ),
  310. ]
  311. ),
  312. );
  313. }),
  314. ),
  315. ]
  316. ),
  317. );
  318. }
  319. Widget _buildContentBottomPartnersSection(BuildContext context,WidgetRef ref, _vm) {
  320. return Column(
  321. mainAxisAlignment: MainAxisAlignment.center,
  322. crossAxisAlignment: CrossAxisAlignment.center,
  323. children: [
  324. MyTextView(
  325. "Our Partners",
  326. textColor: context.appColors.textBlack,
  327. fontSize: 18,
  328. isFontMedium: true,
  329. marginBottom: 16.5,
  330. ),
  331. MyLoadImage(Assets.propertyOurPartners,),
  332. ],
  333. );
  334. }
  335. Widget _buildCotentBox(BuildContext context,WidgetRef ref, _vm) {
  336. return Column(
  337. children: [
  338. _buildContentTopAdviceSection(context, ref, _vm),
  339. const SizedBox(height: 15,),
  340. _buildContentMiddleTextSection(context, ref, _vm),
  341. const SizedBox(height: 15,),
  342. _buildContentOfferSection(context, ref, _vm),
  343. const SizedBox(height: 15,),
  344. _buildContentBottomPartnersSection(context, ref, _vm),
  345. ],
  346. );
  347. }
  348. @override
  349. Widget build(BuildContext context, WidgetRef ref) {
  350. final _vm = ref.read(propertyIoanVmProvider.notifier);
  351. final state = ref.watch(propertyIoanVmProvider);
  352. useEffect((){
  353. _vm.initPageData();
  354. return () {};
  355. }, []);
  356. return Scaffold(
  357. backgroundColor: ColorUtils.string2Color("#F2F3F6"),
  358. // appBar: AppBar(title: Text("资产")),
  359. body: Column(
  360. children: [
  361. Expanded(
  362. child: LoadStateLayout(
  363. state: state.loadingState,
  364. errorMessage: state.errorMessage,
  365. errorRetry: () {
  366. _vm.retryRequest();
  367. },
  368. successWidget: SingleChildScrollView(
  369. scrollDirection: Axis.vertical,
  370. physics: const BouncingScrollPhysics(),
  371. clipBehavior: Clip.none,
  372. child: Padding(
  373. padding: const EdgeInsets.only(left: 15,right: 15,top: 15),
  374. child: _buildCotentBox(context, ref, _vm),
  375. )
  376. ),
  377. )
  378. ),
  379. // Visibility(
  380. // visible: state.loadingState == LoadState.State_Success,
  381. // child: Container(
  382. // height: 50,
  383. // color: ColorUtils.string2Color('#4161D0'),
  384. // child: Row(
  385. // mainAxisAlignment: MainAxisAlignment.center,
  386. // children: [
  387. // // MyLoadImage(Assets.propertyIoanItemBg,width: 60,height: 50,),
  388. // const SizedBox(width: 10,),
  389. // MyTextView(
  390. // "Request a Quote",
  391. // fontSize: 16,
  392. // textColor: Colors.white,
  393. // isFontMedium: true,
  394. // ),
  395. // ],
  396. // ),
  397. // ).onTap((){
  398. // _vm.handlerRequestQuote(context);
  399. // }),
  400. // )
  401. ],
  402. ),
  403. );
  404. }
  405. }