|
@@ -1,13 +1,17 @@
|
|
|
|
+import 'package:cpt_rewards/modules/rewards_detail/rewards_detail_page.dart';
|
|
import 'package:cs_resources/theme/app_colors_theme.dart';
|
|
import 'package:cs_resources/theme/app_colors_theme.dart';
|
|
import 'package:cs_resources/theme/theme_config.dart';
|
|
import 'package:cs_resources/theme/theme_config.dart';
|
|
|
|
+import 'package:domain/entity/rewards_search_entity.dart';
|
|
import 'package:flutter/cupertino.dart';
|
|
import 'package:flutter/cupertino.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:auto_route/auto_route.dart';
|
|
import 'package:auto_route/auto_route.dart';
|
|
|
|
+import 'package:flutter_hooks/flutter_hooks.dart';
|
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
|
import 'package:router/ext/auto_router_extensions.dart';
|
|
import 'package:router/ext/auto_router_extensions.dart';
|
|
import 'package:shared/utils/log_utils.dart';
|
|
import 'package:shared/utils/log_utils.dart';
|
|
import 'package:shared/utils/color_utils.dart';
|
|
import 'package:shared/utils/color_utils.dart';
|
|
import 'package:widgets/ext/ex_widget.dart';
|
|
import 'package:widgets/ext/ex_widget.dart';
|
|
|
|
+import 'package:widgets/load_state_layout.dart';
|
|
import 'package:widgets/my_appbar.dart';
|
|
import 'package:widgets/my_appbar.dart';
|
|
import 'package:widgets/my_load_image.dart';
|
|
import 'package:widgets/my_load_image.dart';
|
|
import 'package:widgets/shatter/picker_container.dart';
|
|
import 'package:widgets/shatter/picker_container.dart';
|
|
@@ -31,91 +35,121 @@ class RewardsSearchPage extends HookConsumerWidget {
|
|
}
|
|
}
|
|
|
|
|
|
Widget _buildItemLeftSection(BuildContext context, WidgetRef ref, item, _vm) {
|
|
Widget _buildItemLeftSection(BuildContext context, WidgetRef ref, item, _vm) {
|
|
|
|
+ int point = item!['point'] ?? 0;
|
|
|
|
+ int originalPoint = item!['original_point'] ?? 0;
|
|
|
|
+ int id = item!['id'];
|
|
return Column(
|
|
return Column(
|
|
children: [
|
|
children: [
|
|
Column(
|
|
Column(
|
|
- crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
- mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
|
|
+ crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
children: [
|
|
- const Center(
|
|
|
|
- child: Text(
|
|
|
|
- 'SHOW THE VERIFICATION CODE TO YOUR MERCHANT',
|
|
|
|
- textAlign: TextAlign.center,
|
|
|
|
- style: TextStyle(
|
|
|
|
- fontSize: 20.0,
|
|
|
|
- color: Colors.black,
|
|
|
|
- fontWeight: FontWeight.w500),
|
|
|
|
- ),
|
|
|
|
|
|
+ MyLoadImage(
|
|
|
|
+ item?['resources']?[0] ?? '',
|
|
|
|
+ width: MediaQuery.of(context).size.width,
|
|
|
|
+ height: 150,
|
|
),
|
|
),
|
|
Text(
|
|
Text(
|
|
- 'VERIFICATION CODE',
|
|
|
|
- style: TextStyle(
|
|
|
|
- fontSize: 18.0,
|
|
|
|
- color: ColorUtils.string2Color('#54638C'),
|
|
|
|
- fontWeight: FontWeight.w500),
|
|
|
|
- ).marginOnly(top: 35, bottom: 20),
|
|
|
|
- Text(
|
|
|
|
- '778890',
|
|
|
|
- style: TextStyle(
|
|
|
|
- fontSize: 36.0,
|
|
|
|
- color: ColorUtils.string2Color('#4161D0'),
|
|
|
|
|
|
+ maxLines: 1, // 设置最大行数为2
|
|
|
|
+ overflow: TextOverflow.ellipsis, // 超出部分用省略号表示
|
|
|
|
+ item?['name'] ?? '',
|
|
|
|
+ style: const TextStyle(
|
|
|
|
+ fontSize: 16.0,
|
|
|
|
+ color: Colors.black,
|
|
fontWeight: FontWeight.w500),
|
|
fontWeight: FontWeight.w500),
|
|
|
|
+ ).marginOnly(bottom: 5, top: 10),
|
|
|
|
+ Row(
|
|
|
|
+ children: [
|
|
|
|
+ Text(
|
|
|
|
+ '$point',
|
|
|
|
+ style: const TextStyle(
|
|
|
|
+ fontSize: 19.0,
|
|
|
|
+ color: Colors.black,
|
|
|
|
+ fontWeight: FontWeight.w500),
|
|
|
|
+ ),
|
|
|
|
+ Text(
|
|
|
|
+ '$originalPoint',
|
|
|
|
+ style: TextStyle(
|
|
|
|
+ decoration: TextDecoration.lineThrough,
|
|
|
|
+ decorationColor: ColorUtils.string2Color('#000000'),
|
|
|
|
+ decorationStyle: TextDecorationStyle.solid,
|
|
|
|
+ fontSize: 12.0,
|
|
|
|
+ color: ColorUtils.string2Color('#000000'),
|
|
|
|
+ fontWeight: FontWeight.w400),
|
|
|
|
+ ).marginOnly(left: 5, right: 5),
|
|
|
|
+ const Text(
|
|
|
|
+ 'Points',
|
|
|
|
+ style: TextStyle(
|
|
|
|
+ fontSize: 13.0,
|
|
|
|
+ color: Colors.black,
|
|
|
|
+ fontWeight: FontWeight.w400),
|
|
|
|
+ ),
|
|
|
|
+ ],
|
|
),
|
|
),
|
|
],
|
|
],
|
|
- ),
|
|
|
|
|
|
+ ).onTap(() {
|
|
|
|
+ RewardsDetailPage.startInstance(id: id);
|
|
|
|
+ }),
|
|
],
|
|
],
|
|
- );
|
|
|
|
|
|
+ ).paddingOnly(top: 0);
|
|
}
|
|
}
|
|
|
|
|
|
// listitem
|
|
// listitem
|
|
- Widget _buildSaleItem(BuildContext context, WidgetRef ref, item, _vm) {
|
|
|
|
- return Column(
|
|
|
|
- children: [
|
|
|
|
- Container(
|
|
|
|
- decoration: const BoxDecoration(
|
|
|
|
- color: Colors.white,
|
|
|
|
- borderRadius: BorderRadius.all(Radius.circular(6.0)),
|
|
|
|
- boxShadow: [
|
|
|
|
- BoxShadow(
|
|
|
|
- color: Color.fromRGBO(184, 191, 217, 0.3), blurRadius: 6)
|
|
|
|
- ],
|
|
|
|
|
|
+ Widget _buildSaleItem(BuildContext context, WidgetRef ref, _vm, item) {
|
|
|
|
+ return Container(
|
|
|
|
+ decoration: const BoxDecoration(
|
|
|
|
+ color: Colors.white,
|
|
|
|
+ borderRadius: BorderRadius.all(Radius.circular(6.0)),
|
|
|
|
+ boxShadow: [
|
|
|
|
+ BoxShadow(color: Color.fromRGBO(184, 191, 217, 0.3), blurRadius: 6)
|
|
|
|
+ ],
|
|
|
|
+ ),
|
|
|
|
+ child: Column(
|
|
|
|
+ children: [
|
|
|
|
+ SizedBox(
|
|
|
|
+ width: MediaQuery.of(context).size.width - 30,
|
|
|
|
+ height: 235,
|
|
|
|
+ // margin: const EdgeInsets.only(left: 15, right: 15, top: 12.5),
|
|
|
|
+ child: Column(
|
|
|
|
+ crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
+ mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
+ children: [
|
|
|
|
+ _buildItemLeftSection(context, ref, item, _vm)
|
|
|
|
+ .marginOnly(bottom: 5),
|
|
|
|
+ ],
|
|
|
|
+ ).paddingOnly(left: 20, right: 20),
|
|
|
|
+ ).constrained(
|
|
|
|
+ minHeight: 235,
|
|
),
|
|
),
|
|
- width: MediaQuery.of(context).size.width - 30,
|
|
|
|
- height: 250,
|
|
|
|
- // margin: const EdgeInsets.only(left: 15, right: 15, top: 12.5),
|
|
|
|
- child: Column(
|
|
|
|
- crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
- mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
- children: [_buildItemLeftSection(context, ref, item, _vm)],
|
|
|
|
- ).paddingOnly(left: 26, right: 26, top: 40),
|
|
|
|
- ),
|
|
|
|
- ],
|
|
|
|
|
|
+ ],
|
|
|
|
+ ),
|
|
).marginOnly(left: 15, bottom: 15, right: 15);
|
|
).marginOnly(left: 15, bottom: 15, right: 15);
|
|
}
|
|
}
|
|
|
|
|
|
- // list
|
|
|
|
- Widget _buildSaleList(BuildContext context, WidgetRef ref, _vm) {
|
|
|
|
- List itemsList = _vm.state.list.toList();
|
|
|
|
- return _buildSaleItem(context, ref, itemsList[0], _vm);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
// SearchOf
|
|
// SearchOf
|
|
- Widget _buildSearchOf(BuildContext context, WidgetRef ref, _vm) {
|
|
|
|
- List itemsList = _vm.state.list.toList();
|
|
|
|
|
|
+ Widget _buildSearchOf(BuildContext context, WidgetRef ref, _vm, detailInfo) {
|
|
|
|
+ List recent = detailInfo.recent;
|
|
|
|
+ List trending = detailInfo.trending;
|
|
|
|
+ List<RewardsSearchRewards> rewards = detailInfo.rewards;
|
|
return Column(
|
|
return Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
children: [
|
|
children: [
|
|
- _buildSearchRecent(context, ref, _vm),
|
|
|
|
- _buildSearchTrending(context, ref, _vm),
|
|
|
|
- _buildSearchRecently(context, ref, _vm),
|
|
|
|
|
|
+ recent.length > 0
|
|
|
|
+ ? _buildSearchRecent(context, ref, _vm, recent)
|
|
|
|
+ : Container(),
|
|
|
|
+ trending.length > 0
|
|
|
|
+ ? _buildSearchTrending(context, ref, _vm, trending)
|
|
|
|
+ : Container(),
|
|
|
|
+ rewards.length > 0
|
|
|
|
+ ? _buildSearchRecently(context, ref, _vm, rewards)
|
|
|
|
+ : Container(),
|
|
],
|
|
],
|
|
);
|
|
);
|
|
}
|
|
}
|
|
|
|
|
|
// Recent
|
|
// Recent
|
|
- Widget _buildSearchRecent(BuildContext context, WidgetRef ref, _vm) {
|
|
|
|
- List itemsList = _vm.state.list.toList();
|
|
|
|
|
|
+ Widget _buildSearchRecent(BuildContext context, WidgetRef ref, _vm, recent) {
|
|
|
|
+ // List itemsList = _vm.state.list.toList();
|
|
return Column(
|
|
return Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
@@ -131,14 +165,15 @@ class RewardsSearchPage extends HookConsumerWidget {
|
|
direction: Axis.horizontal, // 水平方向排列
|
|
direction: Axis.horizontal, // 水平方向排列
|
|
spacing: 10.0, // 子组件之间的间距
|
|
spacing: 10.0, // 子组件之间的间距
|
|
runSpacing: 15.0, // 子组件行与行之间的间距
|
|
runSpacing: 15.0, // 子组件行与行之间的间距
|
|
- children: List.generate(4, (index) {
|
|
|
|
- return _buildSearchRecentItem(context, ref, _vm);
|
|
|
|
|
|
+ children: List.generate(recent.length, (index) {
|
|
|
|
+ return _buildSearchRecentItem(context, ref, _vm, recent[index]);
|
|
}))
|
|
}))
|
|
],
|
|
],
|
|
).marginOnly(bottom: 20);
|
|
).marginOnly(bottom: 20);
|
|
}
|
|
}
|
|
|
|
|
|
- Widget _buildSearchRecentItem(BuildContext context, WidgetRef ref, _vm) {
|
|
|
|
|
|
+ Widget _buildSearchRecentItem(
|
|
|
|
+ BuildContext context, WidgetRef ref, _vm, recent) {
|
|
return Container(
|
|
return Container(
|
|
decoration: const BoxDecoration(
|
|
decoration: const BoxDecoration(
|
|
color: Colors.white,
|
|
color: Colors.white,
|
|
@@ -146,18 +181,21 @@ class RewardsSearchPage extends HookConsumerWidget {
|
|
),
|
|
),
|
|
padding: const EdgeInsets.all(10),
|
|
padding: const EdgeInsets.all(10),
|
|
child: Text(
|
|
child: Text(
|
|
- 'Dragon bowl',
|
|
|
|
|
|
+ recent,
|
|
style: TextStyle(
|
|
style: TextStyle(
|
|
fontSize: 14.0,
|
|
fontSize: 14.0,
|
|
color: ColorUtils.string2Color('#969696'),
|
|
color: ColorUtils.string2Color('#969696'),
|
|
fontWeight: FontWeight.w400),
|
|
fontWeight: FontWeight.w400),
|
|
),
|
|
),
|
|
- );
|
|
|
|
|
|
+ ).onTap(() {
|
|
|
|
+ _vm.searchIn(recent);
|
|
|
|
+ });
|
|
}
|
|
}
|
|
|
|
|
|
// Trending
|
|
// Trending
|
|
- Widget _buildSearchTrending(BuildContext context, WidgetRef ref, _vm) {
|
|
|
|
- List itemsList = _vm.state.list.toList();
|
|
|
|
|
|
+ Widget _buildSearchTrending(
|
|
|
|
+ BuildContext context, WidgetRef ref, _vm, trending) {
|
|
|
|
+ // List itemsList = _vm.state.list.toList();
|
|
return Column(
|
|
return Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
@@ -173,14 +211,16 @@ class RewardsSearchPage extends HookConsumerWidget {
|
|
direction: Axis.horizontal, // 水平方向排列
|
|
direction: Axis.horizontal, // 水平方向排列
|
|
spacing: 10.0, // 子组件之间的间距
|
|
spacing: 10.0, // 子组件之间的间距
|
|
runSpacing: 15.0, // 子组件行与行之间的间距
|
|
runSpacing: 15.0, // 子组件行与行之间的间距
|
|
- children: List.generate(4, (index) {
|
|
|
|
- return _buildSearchTrendingItem(context, ref, _vm);
|
|
|
|
|
|
+ children: List.generate(trending.length, (index) {
|
|
|
|
+ return _buildSearchTrendingItem(
|
|
|
|
+ context, ref, _vm, trending[index]);
|
|
}))
|
|
}))
|
|
],
|
|
],
|
|
).marginOnly(bottom: 20);
|
|
).marginOnly(bottom: 20);
|
|
}
|
|
}
|
|
|
|
|
|
- Widget _buildSearchTrendingItem(BuildContext context, WidgetRef ref, _vm) {
|
|
|
|
|
|
+ Widget _buildSearchTrendingItem(
|
|
|
|
+ BuildContext context, WidgetRef ref, _vm, trending) {
|
|
return Container(
|
|
return Container(
|
|
decoration: const BoxDecoration(
|
|
decoration: const BoxDecoration(
|
|
color: Colors.white,
|
|
color: Colors.white,
|
|
@@ -196,7 +236,7 @@ class RewardsSearchPage extends HookConsumerWidget {
|
|
height: 14,
|
|
height: 14,
|
|
).marginOnly(right: 5),
|
|
).marginOnly(right: 5),
|
|
Text(
|
|
Text(
|
|
- 'Dragon bowl',
|
|
|
|
|
|
+ trending,
|
|
style: TextStyle(
|
|
style: TextStyle(
|
|
fontSize: 14.0,
|
|
fontSize: 14.0,
|
|
color: ColorUtils.string2Color('#969696'),
|
|
color: ColorUtils.string2Color('#969696'),
|
|
@@ -204,12 +244,15 @@ class RewardsSearchPage extends HookConsumerWidget {
|
|
),
|
|
),
|
|
],
|
|
],
|
|
),
|
|
),
|
|
- );
|
|
|
|
|
|
+ ).onTap(() {
|
|
|
|
+ _vm.searchIn(trending);
|
|
|
|
+ });
|
|
}
|
|
}
|
|
|
|
|
|
// Recently
|
|
// Recently
|
|
- Widget _buildSearchRecently(BuildContext context, WidgetRef ref, _vm) {
|
|
|
|
- List itemsList = _vm.state.list.toList();
|
|
|
|
|
|
+ Widget _buildSearchRecently(
|
|
|
|
+ BuildContext context, WidgetRef ref, _vm, rewards) {
|
|
|
|
+ // List itemsList = _vm.state.list.toList();
|
|
return Column(
|
|
return Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
@@ -224,14 +267,18 @@ class RewardsSearchPage extends HookConsumerWidget {
|
|
Column(
|
|
Column(
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
- children: List.generate(2, (index) {
|
|
|
|
- return _buildSearchItem(context, ref, _vm);
|
|
|
|
|
|
+ children: List.generate(rewards.length, (index) {
|
|
|
|
+ return _buildSearchItem(context, ref, _vm, rewards[index]);
|
|
}))
|
|
}))
|
|
],
|
|
],
|
|
);
|
|
);
|
|
}
|
|
}
|
|
|
|
|
|
- Widget _buildSearchItem(BuildContext context, WidgetRef ref, _vm) {
|
|
|
|
|
|
+ Widget _buildSearchItem(BuildContext context, WidgetRef ref, _vm, item) {
|
|
|
|
+ RewardsSearchRewards itm = item;
|
|
|
|
+ int point = itm.point ?? 0;
|
|
|
|
+ int originalPoint = itm.originalPoint ?? 0;
|
|
|
|
+ int id = itm.id;
|
|
return Container(
|
|
return Container(
|
|
// width: MediaQuery.of(context).size.width / 2 - 25,
|
|
// width: MediaQuery.of(context).size.width / 2 - 25,
|
|
// height: 240,
|
|
// height: 240,
|
|
@@ -245,43 +292,34 @@ class RewardsSearchPage extends HookConsumerWidget {
|
|
),
|
|
),
|
|
child: Column(
|
|
child: Column(
|
|
children: [
|
|
children: [
|
|
- const MyAssetImage(
|
|
|
|
- Assets.rewardsRewardsIndex1,
|
|
|
|
- // width: 110,
|
|
|
|
- height: 149,
|
|
|
|
|
|
+ MyLoadImage(
|
|
|
|
+ item.resources?[0] ?? '',
|
|
|
|
+ width: MediaQuery.of(context).size.width,
|
|
|
|
+ height: 150,
|
|
),
|
|
),
|
|
Column(
|
|
Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
children: [
|
|
- const Text(
|
|
|
|
|
|
+ Text(
|
|
maxLines: 1, // 设置最大行数为2
|
|
maxLines: 1, // 设置最大行数为2
|
|
overflow: TextOverflow.ellipsis, // 超出部分用省略号表示
|
|
overflow: TextOverflow.ellipsis, // 超出部分用省略号表示
|
|
- 'Cute children multifunctional ……',
|
|
|
|
- style: TextStyle(
|
|
|
|
|
|
+ item.name ?? '',
|
|
|
|
+ style: const TextStyle(
|
|
fontSize: 15.0,
|
|
fontSize: 15.0,
|
|
color: Colors.black,
|
|
color: Colors.black,
|
|
fontWeight: FontWeight.w500),
|
|
fontWeight: FontWeight.w500),
|
|
- ),
|
|
|
|
- Text(
|
|
|
|
- maxLines: 1, // 设置最大行数为2
|
|
|
|
- overflow: TextOverflow.ellipsis, // 超出部分用省略号表示
|
|
|
|
- 'Hong Ye Group Co., Ltd',
|
|
|
|
- style: TextStyle(
|
|
|
|
- fontSize: 13.0,
|
|
|
|
- color: ColorUtils.string2Color('#808DAF'),
|
|
|
|
- fontWeight: FontWeight.w400),
|
|
|
|
- ).marginOnly(bottom: 5),
|
|
|
|
|
|
+ ).marginOnly(bottom: 5, top: 10),
|
|
Row(
|
|
Row(
|
|
children: [
|
|
children: [
|
|
- const Text(
|
|
|
|
- '300',
|
|
|
|
- style: TextStyle(
|
|
|
|
|
|
+ Text(
|
|
|
|
+ '$point',
|
|
|
|
+ style: const TextStyle(
|
|
fontSize: 18.0,
|
|
fontSize: 18.0,
|
|
color: Colors.black,
|
|
color: Colors.black,
|
|
fontWeight: FontWeight.w500),
|
|
fontWeight: FontWeight.w500),
|
|
),
|
|
),
|
|
Text(
|
|
Text(
|
|
- '350',
|
|
|
|
|
|
+ '$originalPoint',
|
|
style: TextStyle(
|
|
style: TextStyle(
|
|
decoration: TextDecoration.lineThrough,
|
|
decoration: TextDecoration.lineThrough,
|
|
decorationColor: ColorUtils.string2Color('#808DAF'),
|
|
decorationColor: ColorUtils.string2Color('#808DAF'),
|
|
@@ -302,28 +340,93 @@ class RewardsSearchPage extends HookConsumerWidget {
|
|
],
|
|
],
|
|
).paddingOnly(top: 12, left: 12, right: 12)
|
|
).paddingOnly(top: 12, left: 12, right: 12)
|
|
],
|
|
],
|
|
- )).marginOnly(bottom: 13);
|
|
|
|
|
|
+ )).marginOnly(bottom: 13).onTap(() {
|
|
|
|
+ RewardsDetailPage.startInstance(id: id);
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // list
|
|
|
|
+ Widget _buildSaleList(BuildContext context, WidgetRef ref, _vm) {
|
|
|
|
+ final state = ref.watch(rewardsSearchVmProvider);
|
|
|
|
+ return SliverList(
|
|
|
|
+ delegate: SliverChildBuilderDelegate((context, index) {
|
|
|
|
+ return _buildSaleItem(context, ref, _vm, state.list![index]);
|
|
|
|
+ }, childCount: state.list!.length));
|
|
}
|
|
}
|
|
|
|
|
|
@override
|
|
@override
|
|
Widget build(BuildContext context, WidgetRef ref) {
|
|
Widget build(BuildContext context, WidgetRef ref) {
|
|
final _vm = ref.read(rewardsSearchVmProvider.notifier);
|
|
final _vm = ref.read(rewardsSearchVmProvider.notifier);
|
|
final state = ref.watch(rewardsSearchVmProvider);
|
|
final state = ref.watch(rewardsSearchVmProvider);
|
|
|
|
+ bool searchIs = state.searchIs ?? true;
|
|
|
|
+ RewardsSearchEntity? detailInfo = state.detailInfo;
|
|
|
|
+ useEffect(() {
|
|
|
|
+ // 组件挂载时执行 - 执行接口请求
|
|
|
|
+ Future.microtask(() => _vm.initPageData());
|
|
|
|
+ return () {
|
|
|
|
+ // 组件卸载时执行
|
|
|
|
+ Log.d("property_news_page 组件卸载时执行");
|
|
|
|
+ };
|
|
|
|
+ }, []);
|
|
return Scaffold(
|
|
return Scaffold(
|
|
- appBar: MyAppBar.searchAppBar(context,
|
|
|
|
|
|
+ appBar: MyAppBar.searchAppBar(context, onSearch: (value) {
|
|
|
|
+ _vm.searchIn(value);
|
|
|
|
+ },
|
|
|
|
+ value: state.keyword,
|
|
backgroundColor: Colors.white,
|
|
backgroundColor: Colors.white,
|
|
systemUiOverlayStyle:
|
|
systemUiOverlayStyle:
|
|
ThemeConfig.systemUiOverlayStyleLightThemeBlack),
|
|
ThemeConfig.systemUiOverlayStyleLightThemeBlack),
|
|
- body: SingleChildScrollView(
|
|
|
|
- scrollDirection: Axis.vertical,
|
|
|
|
- physics: const BouncingScrollPhysics(),
|
|
|
|
- clipBehavior: Clip.none,
|
|
|
|
- child: Container(
|
|
|
|
- width: MediaQuery.of(context).size.width,
|
|
|
|
- color: ColorUtils.string2Color('#F2F3F6'),
|
|
|
|
- padding: const EdgeInsets.only(top: 20, left: 15, right: 15),
|
|
|
|
- child: _buildSearchOf(context, ref, _vm)),
|
|
|
|
- ),
|
|
|
|
|
|
+ body: searchIs
|
|
|
|
+ ? LoadStateLayout(
|
|
|
|
+ state: state.loadingState,
|
|
|
|
+ errorMessage: state.errorMessage,
|
|
|
|
+ errorRetry: () {
|
|
|
|
+ _vm.retryRequest();
|
|
|
|
+ },
|
|
|
|
+ successWidget: SingleChildScrollView(
|
|
|
|
+ scrollDirection: Axis.vertical,
|
|
|
|
+ physics: const BouncingScrollPhysics(),
|
|
|
|
+ clipBehavior: Clip.none,
|
|
|
|
+ child: Container(
|
|
|
|
+ width: MediaQuery.of(context).size.width,
|
|
|
|
+ color: ColorUtils.string2Color('#F2F3F6'),
|
|
|
|
+ padding:
|
|
|
|
+ const EdgeInsets.only(top: 20, left: 15, right: 15),
|
|
|
|
+ child: _buildSearchOf(context, ref, _vm, detailInfo)),
|
|
|
|
+ ))
|
|
|
|
+ : Container(
|
|
|
|
+ child: Column(
|
|
|
|
+ children: [
|
|
|
|
+ Expanded(
|
|
|
|
+ child: EasyRefresh(
|
|
|
|
+ controller: _vm.refreshController,
|
|
|
|
+ // 上拉加载
|
|
|
|
+ onLoad: () async {
|
|
|
|
+ Log.d("----onLoad");
|
|
|
|
+ _vm.loadMore();
|
|
|
|
+ },
|
|
|
|
+ // 下拉刷新
|
|
|
|
+ onRefresh: () async {
|
|
|
|
+ Log.d("----onRefresh");
|
|
|
|
+ _vm.onRefresh();
|
|
|
|
+ },
|
|
|
|
+ child: Container(
|
|
|
|
+ color: ColorUtils.string2Color('#F2F3F6'),
|
|
|
|
+ padding: const EdgeInsets.only(top: 15),
|
|
|
|
+ child: LoadStateLayout(
|
|
|
|
+ state: state.loadingState,
|
|
|
|
+ errorMessage: state.errorMessage,
|
|
|
|
+ errorRetry: () {
|
|
|
|
+ _vm.retryRequest();
|
|
|
|
+ },
|
|
|
|
+ successSliverWidget: [
|
|
|
|
+ _buildSaleList(context, ref, _vm)
|
|
|
|
+ ])),
|
|
|
|
+ ),
|
|
|
|
+ )
|
|
|
|
+ ],
|
|
|
|
+ ),
|
|
|
|
+ ),
|
|
);
|
|
);
|
|
}
|
|
}
|
|
}
|
|
}
|