|
@@ -1,7 +1,13 @@
|
|
|
+import 'package:cpt_property/modules/property/page/property_page.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:shared/utils/log_utils.dart';
|
|
|
+import 'package:widgets/ext/ex_widget.dart';
|
|
|
+import 'package:widgets/my_load_image.dart';
|
|
|
+import 'package:widgets/widget_export.dart';
|
|
|
+import 'package:cs_resources/generated/assets.dart';
|
|
|
|
|
|
import '../../../router/page/property_page_router.dart';
|
|
|
import '../vm/property_news_vm.dart';
|
|
@@ -19,14 +25,140 @@ class PropertyNewsPage extends HookConsumerWidget {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ Widget _buildItemLeftSection(BuildContext context,WidgetRef ref, String item, _vm) {
|
|
|
+ return Container(
|
|
|
+ // color: Colors.blue,
|
|
|
+ width: 100,
|
|
|
+ height: 117.5,
|
|
|
+ child: const Center(
|
|
|
+ child: MyAssetImage(
|
|
|
+ Assets.propertyNewsItemBg,
|
|
|
+ width: 60.5,
|
|
|
+ height: 50.5,
|
|
|
+ ),
|
|
|
+ )
|
|
|
+ ).marginOnly(right: 17.5);
|
|
|
+ }
|
|
|
+
|
|
|
+ Widget _buildItemRightSection(BuildContext context,WidgetRef ref, String item, _vm) {
|
|
|
+ return Container(
|
|
|
+ color: Colors.white,
|
|
|
+ padding: EdgeInsets.only(top: 10.5, bottom: 10.5),
|
|
|
+ child: Container(
|
|
|
+ child: Stack(
|
|
|
+ children: [
|
|
|
+ const Column(
|
|
|
+ mainAxisAlignment: MainAxisAlignment.start,
|
|
|
+ crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
+ children: [
|
|
|
+ Row(
|
|
|
+ children: [
|
|
|
+ Expanded(
|
|
|
+ child: Text(
|
|
|
+ "Developer'snew homesales shrink to lowest forthe",
|
|
|
+ maxLines: 2, // 设置最大行数为2
|
|
|
+ overflow: TextOverflow.ellipsis, // 超出部分用省略号表示
|
|
|
+ style: TextStyle(fontSize: 16.0, color: Colors.black, fontWeight: FontWeight.w500), // 设置字体大小
|
|
|
+ ),
|
|
|
+ )
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ SizedBox(height: 10.5),
|
|
|
+ Row(
|
|
|
+ children: [
|
|
|
+ Expanded(
|
|
|
+ child: Text(
|
|
|
+ 'New home sales in August shrank 64% and are downand are downand are downand are down and are down',
|
|
|
+ maxLines: 2, // 设置最大行数为2
|
|
|
+ overflow: TextOverflow.ellipsis, // 超出部分用省略号表示
|
|
|
+ style: TextStyle(fontSize: 12.0, color: Colors.black), // 设置字体大小
|
|
|
+ ),
|
|
|
+ )
|
|
|
+ ]
|
|
|
+ ),
|
|
|
+ SizedBox(height: 12.5),
|
|
|
+ Row(
|
|
|
+ children: [
|
|
|
+ Expanded(
|
|
|
+ child: Text(
|
|
|
+ '1H Ago',
|
|
|
+ maxLines: 1, // 设置最大行数为2
|
|
|
+ overflow: TextOverflow.ellipsis, // 超出部分用省略号表示
|
|
|
+ style: TextStyle(fontSize: 12.0, color: Colors.black), // 设置字体大小
|
|
|
+ ),
|
|
|
+ )
|
|
|
+ ]
|
|
|
+ ),
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ Positioned(
|
|
|
+ right: 5,
|
|
|
+ bottom: 0,
|
|
|
+ child: const MyAssetImage(Assets.propertyCollection,width:22,height: 20.5,).onTap((){
|
|
|
+ Log.d("点击了收藏按钮");
|
|
|
+ }),
|
|
|
+ ),
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ // listitem
|
|
|
+ Widget _buildNewsItem(BuildContext context,WidgetRef ref, String item, _vm) {
|
|
|
+ return Row(
|
|
|
+ mainAxisAlignment: MainAxisAlignment.center,
|
|
|
+ crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
+ mainAxisSize: MainAxisSize.max,
|
|
|
+ children: [
|
|
|
+ Container(
|
|
|
+ width: MediaQuery.of(context).size.width - 30,
|
|
|
+ margin: const EdgeInsets.only(left: 15,right: 15,top: 12.5),
|
|
|
+ child: Row(
|
|
|
+ mainAxisAlignment: MainAxisAlignment.start,
|
|
|
+ crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
+ children: [
|
|
|
+ _buildItemLeftSection(context, ref, item, _vm),
|
|
|
+ Expanded(child: _buildItemRightSection(context, ref, item, _vm)),
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ ).constrained(
|
|
|
+ minHeight: 117.5,
|
|
|
+ ),
|
|
|
+ ],
|
|
|
+ ).onTap((){
|
|
|
+ // 去详情
|
|
|
+ _vm.goNewsDetail(item);
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ // list
|
|
|
+ Widget _buildNewsList(BuildContext context, WidgetRef ref, _vm) {
|
|
|
+ List items = List.generate(20, (index) => "Item $index");
|
|
|
+ return ListView.builder(
|
|
|
+ itemCount: items.length,
|
|
|
+ itemBuilder: (context, index) {
|
|
|
+ return _buildNewsItem(context, ref, items[index], _vm);
|
|
|
+ },
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
@override
|
|
|
Widget build(BuildContext context, WidgetRef ref) {
|
|
|
final _vm = ref.read(propertyNewsVmProvider.notifier);
|
|
|
|
|
|
return Scaffold(
|
|
|
// appBar: AppBar(title: Text("资产")),
|
|
|
- body: Center(
|
|
|
- child: Text("房屋news的主页面"),
|
|
|
+ body: Container(
|
|
|
+ child: EasyRefresh(
|
|
|
+ onLoad: () async{
|
|
|
+ _vm.initListData();
|
|
|
+ },
|
|
|
+ onRefresh: () async{
|
|
|
+ _vm.refreshListData();
|
|
|
+ },
|
|
|
+ child: _buildNewsList(context, ref, _vm),
|
|
|
+ )
|
|
|
),
|
|
|
);
|
|
|
}
|