diff --git a/lib/constants/api.dart b/lib/constants/api.dart index 7c123913..2d07bbc8 100644 --- a/lib/constants/api.dart +++ b/lib/constants/api.dart @@ -1,3 +1,5 @@ +import 'package:aku_new_community/pages/setting_page/blacklist_page/blacklist_page.dart'; + class API { ///HOST static const String host = 'http://121.41.26.225:8006'; diff --git a/lib/constants/saas_api.dart b/lib/constants/saas_api.dart index 5a99d6b0..52b807b4 100644 --- a/lib/constants/saas_api.dart +++ b/lib/constants/saas_api.dart @@ -100,6 +100,15 @@ class _User { ///修改用户头像 String get updateAvatar => '/app/user/updateAvatarImg'; + + ///查询黑名单列表 + String get blackList => '/app/user/community/blackList/list'; + + ///取消拉黑用户 + String get cancelBlock => '/app/user/community/blackList/cancelBlock'; + + ///拉黑用户 + String get Block => '/app/user/community/blackList/block'; } class _Login { @@ -107,7 +116,7 @@ class _Login { String get quit => '/app/user/quit'; ///app用户注销 - String get logOut =>'/app/user/logout'; + String get logOut => '/app/user/logout'; ///查询所有小区信息 String get allCommunity => '/app/login/findAllCommunity'; @@ -447,9 +456,10 @@ class _Facilities { String get cancel => '/app/user/facilities/cancel'; } -class _Updater{ +class _Updater { ///查询最新的app版本 String get findNewVersion => '/app/version/findNewVersion'; + ///添加新的app版本 String get insert => '/app/version/insert'; } diff --git a/lib/model/user/blacklist_model.dart b/lib/model/user/blacklist_model.dart new file mode 100644 index 00000000..4943ca4c --- /dev/null +++ b/lib/model/user/blacklist_model.dart @@ -0,0 +1,25 @@ +import 'package:json_annotation/json_annotation.dart'; +import 'package:equatable/equatable.dart'; + +part 'blacklist_model.g.dart'; + + +@JsonSerializable() +class BlacklistModel extends Equatable { + int id; + List imgList; + String name; + + factory BlacklistModel.fromJson(Map json) => + _$BlacklistModelFromJson(json); + + + BlacklistModel({ + required this.id, + required this.imgList, + required this.name, + }); + + @override + List get props => [id, imgList, name,]; +} \ No newline at end of file diff --git a/lib/model/user/blacklist_model.g.dart b/lib/model/user/blacklist_model.g.dart new file mode 100644 index 00000000..00706b1e --- /dev/null +++ b/lib/model/user/blacklist_model.g.dart @@ -0,0 +1,14 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'blacklist_model.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +BlacklistModel _$BlacklistModelFromJson(Map json) => + BlacklistModel( + id: json['id'] as int, + imgList: json['imgList'] as List, + name: json['name'] as String, + ); diff --git a/lib/pages/setting_page/blacklist_page/blacklist_func.dart b/lib/pages/setting_page/blacklist_page/blacklist_func.dart new file mode 100644 index 00000000..4a8810a3 --- /dev/null +++ b/lib/pages/setting_page/blacklist_page/blacklist_func.dart @@ -0,0 +1,40 @@ +import 'package:aku_new_community/constants/saas_api.dart'; +import 'package:aku_new_community/model/user/blacklist_model.dart'; +import 'package:aku_new_community/utils/network/base_list_model.dart'; +import 'package:aku_new_community/utils/network/base_model.dart'; +import 'package:aku_new_community/utils/network/net_util.dart'; + +class BlackListFunc { + ///获取黑名单列表 + static Future> getBlackList() async { + BaseListModel model = await NetUtil().getList( + SAASAPI.user.blackList, + params: { + 'pageNum': 1, + 'size': 9, + }, + ); + if (model.rows.length == 0) return []; + return model.rows.map((e) => BlacklistModel.fromJson(e)).toList(); + } + + ///取消拉黑用户 + static Future cancelBlock(int userId) async { + var base = await NetUtil().get(SAASAPI.user.cancelBlock, + params: { + 'userId': userId, + }, + showMessage: true); + return base.success; + } + + ///拉黑用户 + static Future Block(int userId) async { + var base = await NetUtil().get(SAASAPI.user.Block, + params: { + 'userId': userId, + }, + showMessage: true); + return base.success; + } +} diff --git a/lib/pages/setting_page/blacklist_page/blacklist_page.dart b/lib/pages/setting_page/blacklist_page/blacklist_page.dart new file mode 100644 index 00000000..412445af --- /dev/null +++ b/lib/pages/setting_page/blacklist_page/blacklist_page.dart @@ -0,0 +1,216 @@ +import 'package:aku_new_community/base/base_style.dart'; +import 'package:aku_new_community/gen/assets.gen.dart'; +import 'package:aku_new_community/model/user/blacklist_model.dart'; +import 'package:aku_new_community/pages/setting_page/blacklist_page/blacklist_func.dart'; + +import 'package:aku_new_community/widget/dialog/bee_custom_dialog.dart'; +import 'package:aku_new_community/widget/others/user_tool.dart'; + +import 'package:flutter/material.dart'; + +import 'package:aku_new_community/utils/headers.dart'; +import 'package:aku_new_community/widget/bee_scaffold.dart'; +import 'package:flutter_easyrefresh/easy_refresh.dart'; +import 'package:get/get.dart'; + +class blackListPage extends StatefulWidget { + blackListPage({Key? key}) : super(key: key); + + @override + _blackListPageState createState() => _blackListPageState(); +} + +class _blackListPageState extends State { + List blackList = []; + + // List blackList2 = [ + // { + // 'id': 1, + // 'name': '天天', + // 'img': [ + // Assets.images.vegetableBanner.path, + // Assets.images.vegetableBanner.path + // ] + // }, + // { + // 'id': 1, + // 'name': '天天', + // 'img': [ + // Assets.images.vegetableBanner.path, + // Assets.images.vegetableBanner.path + // ] + // }, + // { + // 'id': 1, + // 'name': '天天', + // 'img': [ + // Assets.images.vegetableBanner.path, + // Assets.images.vegetableBanner.path + // ] + // } + // ]; + final EasyRefreshController _refreshController = EasyRefreshController(); + + @override + void initState() { + super.initState(); + + // ///动态appbar导致 refresh组件刷新判出现问题 首次刷新手动触发 + // Future.delayed(Duration(milliseconds: 0), () async { + // await _refresh(); + // setState(() {}); + // }); + } + + @override + void dispose() { + _refreshController.dispose(); + super.dispose(); + } + + // Future _refresh() async { + // blackList = await BlackListFunc.getBlackList(); + // } + + @override + Widget build(BuildContext context) { + return BeeScaffold( + title: '黑名单列表', + body: Column( + children: [ + Container( + color: Color(0xF000000).withOpacity(0.06), + width: MediaQuery.of(context).size.width, + height: 75.w, + alignment: Alignment.center, + child: Text.rich(TextSpan(children: [ + TextSpan( + text: '点击', + style: + TextStyle(fontSize: 24.sp, color: Color(0xA6000000))), + TextSpan( + text: ' 移出黑名单 ', + style: TextStyle(fontSize: 24.sp, color: Colors.blue)), + TextSpan( + text: '即可在社区中显示对方的动态', + style: + TextStyle(fontSize: 24.sp, color: Color(0xA6000000))), + ])), + ), + Expanded( + child: EasyRefresh( + firstRefresh: true, + header: MaterialHeader(), + footer: MaterialFooter(), + controller: _refreshController, + onRefresh: () async { + blackList = await BlackListFunc.getBlackList(); + // blackList = [ + // BlacklistModel( + // id: 0, + // imgList: [Assets.images.vegetableBanner.path], + // name: '张天天') + // ]; + setState(() {}); + // _page + }, + onLoad: () async {}, + child: ListView.builder( + itemBuilder: (context, index) { + return _blackList(blackList[index]); + }, + itemCount: blackList.length, + ))) + ], + )); + } + + _blackList(BlacklistModel model) { + return Column( + children: [ + ListTile( + leading: Container( + width: 88.w, + height: 88.w, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(40), + image: DecorationImage( + image: ExactAssetImage( + R.ASSETS_IMAGES_PLACEHOLDER_WEBP ?? model.imgList.first, + ), + fit: BoxFit.cover)), + ), + title: Text( + _getText(model.name), + style: TextStyle(fontSize: 28.sp, color: ktextSubColor), + ), + trailing: GestureDetector( + onTap: () async { + await Get.dialog( + BeeCustomDialog( + height: 247.w, + content: Padding( + padding: EdgeInsets.only(top: 64.w), + child: Text( + '确认将该用户移出黑名单列表吗', + style: UserTool.myAppStyle.dialogContentText, + )), + actions: [ + MaterialButton( + onPressed: () { + Get.back(); + }, + child: Text('考虑一下', + style: TextStyle( + fontSize: 28.w, + color: Colors.black.withOpacity(0.45))), + ), + MaterialButton( + onPressed: () async { + var cancelBlock = + await BlackListFunc.cancelBlock(model.id); + if (cancelBlock) { + Get.back(); + _refreshController.callRefresh(); + } + }, + child: Text('确认移出', + style: UserTool.myAppStyle.dialogActionButtonText), + ), + ], + ), + // barrierDismissible: false, + ); + }, + child: '移出黑名单'.text.size(24.sp).color(Colors.blue).make()), + ), + Divider() + ], + ); + } + + _getText(String name) { + String name2 = name.substring(0, 1); + for (var i = 0; i < name.length - 1; i++) { + name2 += '*'; + } + return name2; + } +// _blackList(BlacklistModel model) { +// return ListTile( +// leading: Container( +// width: 88.w, +// height: 88.w, +// decoration: BoxDecoration( +// borderRadius: BorderRadius.circular(40), +// image: DecorationImage( +// image: ExactAssetImage(model.imgList.first), +// fit: BoxFit.cover)), +// ), +// title: model.name.text.size(20.sp).color(ktextSubColor).make(), +// subtitle: GestureDetector( +// onTap: () {}, +// child: '移出黑名单'.text.size(24.sp).color(Colors.blue).make()), +// ); +// } +} diff --git a/lib/pages/setting_page/settings_page.dart b/lib/pages/setting_page/settings_page.dart index 28973073..dac667ad 100644 --- a/lib/pages/setting_page/settings_page.dart +++ b/lib/pages/setting_page/settings_page.dart @@ -19,6 +19,7 @@ import 'package:aku_new_community/widget/bee_scaffold.dart'; import 'package:aku_new_community/widget/others/user_tool.dart'; import 'account_manager_page.dart'; +import 'blacklist_page/blacklist_page.dart'; import 'feedback_page/feedback_page.dart'; class SettingsPage extends StatefulWidget { @@ -155,6 +156,10 @@ class _SettingsPageState extends State { title: '隐私政策', onTap: () => Get.to(() => PrivacyPage()), ), + _buildTile( + title: '社区黑名单', + onTap: () => Get.to(() => blackListPage()), + ), ].sepWidget( separate: Divider( indent: 32.w, diff --git a/lib/pages/sign/login/other_login_page.dart b/lib/pages/sign/login/other_login_page.dart index cf778411..2403e2fd 100644 --- a/lib/pages/sign/login/other_login_page.dart +++ b/lib/pages/sign/login/other_login_page.dart @@ -1,3 +1,4 @@ +import 'package:aku_new_community/utils/headers.dart'; import 'package:flutter/material.dart'; import 'package:bot_toast/bot_toast.dart'; @@ -190,9 +191,15 @@ class _OtherLoginPageState extends State { BotToast.showText(text: base.msg); } }, - text: clockTimer.timerStart - ? '${clockTimer.second}秒后重新获取' - : '获取验证码'), + text: + clockTimer.timerStart ? '${clockTimer.second}秒后重新获取' : '获取验证码'), + 32.hb, + IconButton( + icon: Icon(Icons.ac_unit_outlined), + onPressed: () { + //Get.to(() => RootPage()); + }, + ), 24.w.heightBox, Row( mainAxisAlignment: MainAxisAlignment.center, diff --git a/lib/ui/community/community_views/event_detail_page.dart b/lib/ui/community/community_views/event_detail_page.dart index 4f8df288..48373144 100644 --- a/lib/ui/community/community_views/event_detail_page.dart +++ b/lib/ui/community/community_views/event_detail_page.dart @@ -1,5 +1,6 @@ import 'dart:math'; +import 'package:aku_new_community/pages/setting_page/blacklist_page/blacklist_func.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -120,17 +121,11 @@ class _EventDetailPageState extends State { actions: [ (CommunityPopButton( isMyself: _isMyself, - onSelect: (dynamic _) async { + onSelect: (int value) async { if (LoginUtil.isNotLogin) return; - if (!_isMyself) { - VoidCallback cancel = BotToast.showLoading(); - await Future.delayed( - Duration(milliseconds: 500 + Random().nextInt(500))); - cancel(); - BotToast.showText(text: '举报成功'); - } else { - bool? result = await Get.dialog(CupertinoAlertDialog( - title: '你确定删除吗'.text.isIntrinsic.make(), + if (value == 3) { + await Get.dialog(CupertinoAlertDialog( + title: '你确定要拉黑他吗'.text.isIntrinsic.make(), actions: [ CupertinoDialogAction( child: '取消'.text.black.isIntrinsic.make(), @@ -138,15 +133,43 @@ class _EventDetailPageState extends State { ), CupertinoDialogAction( child: '确定'.text.color(Colors.orange).isIntrinsic.make(), - onPressed: () => Get.back(result: true), + onPressed: () async { + var isShielding = + await BlackListFunc.Block(widget.dynamicId); + if (isShielding) { + Get.back(); + } + }, ), ], )); + } else { + if (!_isMyself) { + VoidCallback cancel = BotToast.showLoading(); + await Future.delayed( + Duration(milliseconds: 500 + Random().nextInt(500))); + cancel(); + BotToast.showText(text: '举报成功'); + } else { + bool? result = await Get.dialog(CupertinoAlertDialog( + title: '你确定删除吗'.text.isIntrinsic.make(), + actions: [ + CupertinoDialogAction( + child: '取消'.text.black.isIntrinsic.make(), + onPressed: () => Get.back(), + ), + CupertinoDialogAction( + child: '确定'.text.color(Colors.orange).isIntrinsic.make(), + onPressed: () => Get.back(result: true), + ), + ], + )); - if (result == true) { - await CommunityFunc.deleteDynamic(widget.dynamicId); - Get.back(); - widget.refresh!(); + if (result == true) { + await CommunityFunc.deleteDynamic(widget.dynamicId); + Get.back(); + widget.refresh!(); + } } } }, @@ -300,9 +323,9 @@ class _EventDetailPageState extends State { ); } - Widget _commentWidget(CommentListModel model, int rootIndex){ - final userProvider = Provider.of(context); - return GestureDetector( + Widget _commentWidget(CommentListModel model, int rootIndex) { + final userProvider = Provider.of(context); + return GestureDetector( onTap: () { _rootId = model.id; _parentId = model.id; @@ -361,9 +384,9 @@ class _EventDetailPageState extends State { ), Spacer(), CommunityPopButton( - isMyself: userProvider.userInfoModel?.id==model.createId, + isMyself: userProvider.userInfoModel?.id == model.createId, onSelect: (value) async { - if (userProvider.userInfoModel?.id==model.createId) { + if (userProvider.userInfoModel?.id == model.createId) { await CommunityFunc.deleteComment(model.id); _refreshController.callRefresh(); } diff --git a/lib/ui/community/community_views/widgets/chat_card.dart b/lib/ui/community/community_views/widgets/chat_card.dart index e5226df4..f35c11c4 100644 --- a/lib/ui/community/community_views/widgets/chat_card.dart +++ b/lib/ui/community/community_views/widgets/chat_card.dart @@ -1,5 +1,6 @@ import 'dart:math'; +import 'package:aku_new_community/pages/setting_page/blacklist_page/blacklist_func.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -144,7 +145,10 @@ class _ChatCardState extends State { ), 20.wb, GestureDetector( - onTap: () => Get.to(EventDetailPage(dynamicId: widget.model.id,createId: widget.model.createId,)), + onTap: () => Get.to(EventDetailPage( + dynamicId: widget.model.id, + createId: widget.model.createId, + )), child: Material( color: Colors.transparent, child: Row( @@ -247,20 +251,13 @@ class _ChatCardState extends State { ], ), Spacer(), - CommunityPopButton( isMyself: _isMyself, - onSelect: (dynamic _) async { + onSelect: (int value) async { if (LoginUtil.isNotLogin) return; - if (!_isMyself) { - VoidCallback cancel = BotToast.showLoading(); - await Future.delayed( - Duration(milliseconds: 500 + Random().nextInt(500))); - cancel(); - BotToast.showText(text: '举报成功'); - } else { - bool? result = await Get.dialog(CupertinoAlertDialog( - title: '你确定删除吗'.text.isIntrinsic.make(), + if (value == 3) { + await Get.dialog(CupertinoAlertDialog( + title: '你确定要拉黑他吗'.text.isIntrinsic.make(), actions: [ CupertinoDialogAction( child: '取消'.text.black.isIntrinsic.make(), @@ -269,14 +266,45 @@ class _ChatCardState extends State { CupertinoDialogAction( child: '确定'.text.color(Colors.orange).isIntrinsic.make(), - onPressed: () => Get.back(result: true), + onPressed: () async { + var isShielding = + await BlackListFunc.Block(widget.model.id); + if (isShielding) { + Get.back(); + } + }, ), ], )); - - if (result == true) { - await CommunityFunc.deleteDynamic(widget.model.id); - widget.refresh(); + } else { + if (!_isMyself) { + VoidCallback cancel = BotToast.showLoading(); + await Future.delayed( + Duration(milliseconds: 500 + Random().nextInt(500))); + cancel(); + BotToast.showText(text: '举报成功'); + } else { + bool? result = await Get.dialog(CupertinoAlertDialog( + title: '你确定删除吗'.text.isIntrinsic.make(), + actions: [ + CupertinoDialogAction( + child: '取消'.text.black.isIntrinsic.make(), + onPressed: () => Get.back(), + ), + CupertinoDialogAction( + child: '确定' + .text + .color(Colors.orange) + .isIntrinsic + .make(), + onPressed: () => Get.back(result: true), + ), + ], + )); + if (result == true) { + await CommunityFunc.deleteDynamic(widget.model.id); + widget.refresh(); + } } } }, @@ -334,6 +362,10 @@ class CommunityPopButton extends StatelessWidget { shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8.w)), itemBuilder: (context) { return [ + PopupMenuItem( + child: '拉黑'.text.isIntrinsic.make(), + value: 3, + ), isMyself ? PopupMenuItem( child: '删除'.text.isIntrinsic.make(), diff --git a/lib/ui/market/market_page.dart b/lib/ui/market/market_page.dart index de4f0887..7e2dcc1e 100644 --- a/lib/ui/market/market_page.dart +++ b/lib/ui/market/market_page.dart @@ -1,6 +1,8 @@ import 'dart:ui' as ui; +import 'package:aku_new_community/provider/user_provider.dart'; import 'package:aku_new_community/ui/market/vegetable_market/seasonal_vegetables.dart'; +import 'package:aku_new_community/utils/hive_store.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:card_swiper/card_swiper.dart'; @@ -493,7 +495,9 @@ class _MarketPageState extends State return GestureDetector( onTap: () { ///创建中 - Get.to(() => SeasonalVegetables()); + Get.to(() => SeasonalVegetables( + searchText: '', + )); }, child: Assets.images.vegetableBanner.image(width: 712.w, height: 200.w), ); @@ -1048,6 +1052,15 @@ class _MarketPageState extends State )); } + ///保存搜索记录 + saveSearchListToSharedPreferences(String value) async { + final userProvider = Provider.of(Get.context!, listen: false); + + HiveStore.appBox!.put( + userProvider.userInfoModel?.id.toString() ?? '' + "userSearhHistory", + value); + } + _goodsTitle( Widget normalTypeButton, Widget salesTypeButton, diff --git a/lib/ui/market/search/search_goods_page.dart b/lib/ui/market/search/search_goods_page.dart index b71634ca..33324aa6 100644 --- a/lib/ui/market/search/search_goods_page.dart +++ b/lib/ui/market/search/search_goods_page.dart @@ -556,6 +556,7 @@ class SearchGoodsPageState extends State { setState(() {}); } + ///热销 _hotGoodsCard(GoodsPopularModel goodsItem, int index) { return GestureDetector( onTap: () { diff --git a/lib/ui/market/vegetable_market/seasonal_vegetables.dart b/lib/ui/market/vegetable_market/seasonal_vegetables.dart index cc223917..d75ea265 100644 --- a/lib/ui/market/vegetable_market/seasonal_vegetables.dart +++ b/lib/ui/market/vegetable_market/seasonal_vegetables.dart @@ -17,7 +17,10 @@ import '../../../gen/assets.gen.dart'; import '../search/search_goods_page.dart'; class SeasonalVegetables extends StatefulWidget { - const SeasonalVegetables({Key? key}) : super(key: key); + final String searchText; + + const SeasonalVegetables({Key? key, required this.searchText}) + : super(key: key); @override _SeasonalVegetablesState createState() => _SeasonalVegetablesState(); @@ -53,7 +56,7 @@ class _SeasonalVegetablesState extends State { @override Widget build(BuildContext context) { - final userProvider = Provider.of(context, listen: false); + //final userProvider = Provider.of(context, listen: false); final normalTypeButton = MaterialButton( onPressed: () { _orderType = OrderType.NORMAL; @@ -130,17 +133,17 @@ class _SeasonalVegetablesState extends State { '价格', style: TextStyle( color: _orderType == OrderType.PRICE_HIGH || - _orderType == OrderType.PRICE_LOW + _orderType == OrderType.PRICE_LOW ? kBalckSubColor : ktextPrimary, fontSize: _orderType == OrderType.PRICE_HIGH || - _orderType == OrderType.PRICE_LOW + _orderType == OrderType.PRICE_LOW ? 32.sp : 28.sp, - // fontWeight: _orderType == OrderType.PRICE_HIGH || - // _orderType == OrderType.PRICE_LOW - // ? FontWeight.bold - // : FontWeight.normal, + fontWeight: _orderType == OrderType.PRICE_HIGH || + _orderType == OrderType.PRICE_LOW + ? FontWeight.bold + : FontWeight.normal, ), ), // Icon( @@ -226,33 +229,33 @@ class _SeasonalVegetablesState extends State { fontWeight: FontWeight.w300), prefixIcon: _showCategory ? GestureDetector( - child: Container( - padding: EdgeInsets.only(left: 18.w, right: 18.w), - margin: EdgeInsets.all(12.w), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(40.w), - color: Color(0xFFF2F2F2)), - child: Row( - mainAxisSize: MainAxisSize.min, - children: [ - Text( - '生鲜果蔬', - // widget.categoryName ?? '', - style: TextStyle( - color: ktextSubColor, - fontSize: 24.sp, + child: Container( + padding: EdgeInsets.only(left: 18.w, right: 18.w), + margin: EdgeInsets.all(12.w), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(40.w), + color: Color(0xFFF2F2F2)), + child: Row( + mainAxisSize: MainAxisSize.min, + children: [ + Text( + '生鲜果蔬', + //widget.categoryName ?? '', + style: TextStyle( + color: ktextSubColor, + fontSize: 24.sp, + ), + ), + Icon( + Icons.close, + color: Colors.grey[500], + size: 30.w, + ) + ], ), + height: 44.w, ), - Icon( - Icons.close, - color: Colors.grey[500], - size: 30.w, - ) - ], - ), - height: 44.w, - ), - ) + ) : null, //isDense: true, @@ -272,15 +275,14 @@ class _SeasonalVegetablesState extends State { 20.wb, GestureDetector( onTap: () { + if (TextUtils.isEmpty(_searchText)) return; + _startSearch = true; + _contentFocusNode.unfocus(); + _searchText = _searchText.trimLeft(); + _searchText = _searchText.trimRight(); + remember(); + saveSearchListToSharedPreferences(_searchHistory); _refreshController.callRefresh(); - // if (TextUtils.isEmpty(_searchText)) return; - // _startSearch = true; - // _contentFocusNode.unfocus(); - // _searchText = _searchText.trimLeft(); - // _searchText = _searchText.trimRight(); - // remember(); - // saveSearchListToSharedPreferences(_searchHistory); - setState(() {}); }, child: Text( @@ -299,6 +301,8 @@ class _SeasonalVegetablesState extends State { child: _goodsTitle(normalTypeButton, salesTypeButton, priceButton, listButton)), ), + _searchHistoryWidget(), + 10.hb, Expanded( child: EasyRefresh( firstRefresh: true, @@ -315,29 +319,28 @@ class _SeasonalVegetablesState extends State { child: _onLoad ? const SizedBox() : vegetablesList.isEmpty - ? _getListNull() - : ListView.builder( - itemBuilder: (context, index) { - return Text(''); - }, - itemCount: vegetablesList.length, - ))) + ? _getListNull() + : ListView.builder( + itemBuilder: (context, index) { + return Text(''); + }, + itemCount: vegetablesList.length, + ))) ], )); } - _goodsTitle(Widget normalTypeButton, - Widget salesTypeButton, - Widget priceButton, - Widget listButton,) { + _goodsTitle( + Widget normalTypeButton, + Widget salesTypeButton, + Widget priceButton, + Widget listButton, + ) { return Container( height: 90.w, alignment: Alignment.centerLeft, color: Colors.white, - width: MediaQuery - .of(context) - .size - .width, + width: MediaQuery.of(context).size.width, child: Container( alignment: Alignment.centerLeft, height: 60.w, @@ -389,9 +392,8 @@ class _SeasonalVegetablesState extends State { _editingController.text = text; _searchText = text; setState(() {}); - FocusManager.instance.primaryFocus!.unfocus(); - _refreshController1.callRefresh(); + _refreshController.callRefresh(); }, label: Text(text), selected: false, @@ -403,58 +405,55 @@ class _SeasonalVegetablesState extends State { return _searchHistory.length == 0 ? SizedBox() : Container( - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - mainAxisSize: MainAxisSize.min, - children: [ - 36.hb, - Container( - child: Container( - margin: EdgeInsets.only(left: 15, bottom: 5), - child: Row( - children: [ - Text( - '历史搜索', - style: TextStyle( - color: Colors.black, - fontSize: 16, - ), - ), - Spacer(), - (_searchHistory.length > 0) - ? GestureDetector( - onTap: () { - _searchHistory = []; - saveSearchListToSharedPreferences( - _searchHistory); - setState(() {}); - }, - child: Image.asset( - R.ASSETS_ICONS_DELETE_PNG, - width: 40.w, - height: 40.w, - ), - ) - : Container(), - 36.wb, - ], - )), - ), - Container( - width: MediaQuery - .of(context) - .size - .width, - padding: EdgeInsets.only(left: 10, right: 10), - child: Wrap( - children: choiceChipList, + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + 36.hb, + Container( + child: Container( + margin: EdgeInsets.only(left: 15, bottom: 5), + child: Row( + children: [ + Text( + '历史搜索', + style: TextStyle( + color: Colors.black, + fontSize: 16, + ), + ), + Spacer(), + (_searchHistory.length > 0) + ? GestureDetector( + onTap: () { + _searchHistory = []; + saveSearchListToSharedPreferences( + _searchHistory); + setState(() {}); + }, + child: Image.asset( + R.ASSETS_ICONS_DELETE_PNG, + width: 40.w, + height: 40.w, + ), + ) + : Container(), + 36.wb, + ], + )), + ), + Container( + width: MediaQuery.of(context).size.width, + padding: EdgeInsets.only(left: 10, right: 10), + child: Wrap( + children: choiceChipList, + ), + ), + // Spacer() + 24.hb, + ], ), - ), - // Spacer() - 24.hb, - ], - ), - ); + ); } ///获取搜索记录 diff --git a/lib/widget/bee_scaffold.dart b/lib/widget/bee_scaffold.dart index 5282fba8..b8691947 100644 --- a/lib/widget/bee_scaffold.dart +++ b/lib/widget/bee_scaffold.dart @@ -74,7 +74,6 @@ class BeeScaffold extends StatelessWidget { actions: actions, bottom: appBarBottom, titleSpacing: titleSpacing, - ); return AnnotatedRegion( diff --git a/lib/widget/dialog/bee_custom_dialog.dart b/lib/widget/dialog/bee_custom_dialog.dart index 6a56caf2..30921b03 100644 --- a/lib/widget/dialog/bee_custom_dialog.dart +++ b/lib/widget/dialog/bee_custom_dialog.dart @@ -7,16 +7,21 @@ class BeeCustomDialog extends StatelessWidget { final Widget content; final double? width; final double? height; + const BeeCustomDialog( - {Key? key, required this.actions, required this.content, this.width, this.height}) + {Key? key, + required this.actions, + required this.content, + this.width, + this.height}) : super(key: key); @override Widget build(BuildContext context) { return Center( child: Container( - width: width?? 600.w, - height:height?? 700.w, + width: width ?? 600.w, + height: height ?? 700.w, clipBehavior: Clip.antiAliasWithSaveLayer, decoration: BoxDecoration( color: Colors.white, @@ -30,11 +35,13 @@ class BeeCustomDialog extends StatelessWidget { end: Alignment.bottomCenter, stops: [ 0, - 0.3, + 0.35, ], colors: [ Color(0x33FBE541), - Colors.white, + Color(0x33FBE541).withOpacity(0.01), + + //Colors.white, ])), child: Column( children: [