property_ioan_page.dart 15 KB

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