提交 38d60d25 authored 作者: yueweilu's avatar yueweilu

Merge remote-tracking branch 'origin/test' into test

...@@ -6,7 +6,7 @@ class SearchController extends GetxController { ...@@ -6,7 +6,7 @@ class SearchController extends GetxController {
controlFinishRefresh: true, controlFinishRefresh: true,
); );
late TextEditingController searchController = TextEditingController(); late TextEditingController searchController = TextEditingController();
bool showHistory = true;
// 搜索记录数组 // 搜索记录数组
List<String> records = []; List<String> records = [];
// 书籍数组 // 书籍数组
......
...@@ -8,7 +8,6 @@ class SearchPage extends StatefulWidget { ...@@ -8,7 +8,6 @@ class SearchPage extends StatefulWidget {
} }
class _SearchPageState extends State<SearchPage> { class _SearchPageState extends State<SearchPage> {
bool showHistory = true; // 根据条件设置为true或false
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return GetBuilder<SearchController>( return GetBuilder<SearchController>(
...@@ -27,7 +26,7 @@ class _SearchPageState extends State<SearchPage> { ...@@ -27,7 +26,7 @@ class _SearchPageState extends State<SearchPage> {
// context.pushNamed(Routes.msgs); // context.pushNamed(Routes.msgs);
}, },
onEditingComplete: () { onEditingComplete: () {
showHistory = false; controller.showHistory = false;
controller.search(); controller.search();
// FocusScope.of(context).unfocus(); // FocusScope.of(context).unfocus();
FocusNode blankNode = FocusNode(); FocusNode blankNode = FocusNode();
...@@ -51,17 +50,37 @@ class _SearchPageState extends State<SearchPage> { ...@@ -51,17 +50,37 @@ class _SearchPageState extends State<SearchPage> {
) )
], ],
), ),
body: buildListView(controller), body:
buildListView(controller),
), ),
); );
} }
Widget buildListView(SearchController controller) { Widget buildListView(SearchController controller) {
if (showHistory) { if (controller.showHistory) {
// 如果条件为true,显示历史搜索记录 // 如果条件为true,显示历史搜索记录
return BuildHistory(controller: controller); return BuildHistory(controller: controller);
} else { } else {
// 如果条件为false,显示搜索到的书籍 // 如果条件为false,显示搜索到的书籍
if(controller.books.isEmpty){
return
SingleChildScrollView(
child:Container(
padding: EdgeInsets.only(top: 110.w),
alignment: Alignment.center,
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
SizedBox(height: 152.w, width: 195.w,
child: Image.asset( 'assets/images/none.png',),),
SizedBox(height: 13.w,),
Text('暂无图书,请检查输入内容',style: TextStyle(fontSize: 14.w,color: Colours.c9),),
],
),
),
);
}else{
return ListView.builder( return ListView.builder(
// shrinkWrap: true, // shrinkWrap: true,
// physics: NeverScrollableScrollPhysics(), // physics: NeverScrollableScrollPhysics(),
...@@ -85,6 +104,8 @@ class _SearchPageState extends State<SearchPage> { ...@@ -85,6 +104,8 @@ class _SearchPageState extends State<SearchPage> {
); );
}); });
} }
}
} }
hideSoftKeyboard(BuildContext context) { hideSoftKeyboard(BuildContext context) {
......
...@@ -2,7 +2,6 @@ part of search; ...@@ -2,7 +2,6 @@ part of search;
class BuildHistory extends StatefulWidget { class BuildHistory extends StatefulWidget {
final SearchController controller; final SearchController controller;
const BuildHistory({ const BuildHistory({
Key? key, Key? key,
required this.controller, required this.controller,
...@@ -65,6 +64,13 @@ class _BuildHistoryState extends State<BuildHistory> { ...@@ -65,6 +64,13 @@ class _BuildHistoryState extends State<BuildHistory> {
}else { }else {
return searchList.map((e){ return searchList.map((e){
return GestureDetector( return GestureDetector(
onTap: () {
// showHistory = false;
widget.controller.searchController.text =e;
widget.controller.showHistory = false;
widget.controller.search();
Console.log('点击了-$e');
},
child: Container( child: Container(
height: 27, height: 27,
decoration: BoxDecoration( decoration: BoxDecoration(
......
...@@ -15,19 +15,20 @@ class BuildItem extends StatelessWidget { ...@@ -15,19 +15,20 @@ class BuildItem extends StatelessWidget {
margin: EdgeInsets.only(left: 10.w,top: 10.w,right: 5.w), margin: EdgeInsets.only(left: 10.w,top: 10.w,right: 5.w),
child: Stack( child: Stack(
children: [ children: [
Container( // Image.asset(model.type ==1?'assets/images/coupon_yes.png':'assets/images/coupon_no.png',
child:Image.asset( // fit: BoxFit.contain,
// width: double.infinity,),
Image.asset(
'assets/images/coupon_bg.png', 'assets/images/coupon_bg.png',
fit: BoxFit.contain, fit: BoxFit.contain,
width: double.infinity, width: double.infinity,
) ,
), ),
Container( SizedBox(
height: 105.w, height: 105.w,
child: Row( child: Row(
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
Container( SizedBox(
width:120.w , width:120.w ,
height: 100.w, height: 100.w,
child: Column( child: Column(
...@@ -160,55 +161,14 @@ class BuildItem extends StatelessWidget { ...@@ -160,55 +161,14 @@ class BuildItem extends StatelessWidget {
], ],
), ),
), ),
], ],
), ),
], ],
), ),
],), ],),
// 去除操作按钮区域的内边距 // 去除操作按钮区域的内边距
actionsPadding: EdgeInsets.zero, actionsPadding: EdgeInsets.zero,
/* actions: <Widget>[
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly, // 或者使用MainAxisAlignment.spaceEvenly
children: [
GestureDetector(
onTap: () => Navigator.of(context).pop(),
child: const Text(
'取消',
style: TextStyle(
fontSize: 12,
fontWeight: Fonts.medium,
color: Colours.c6,
),
),
),
Container(
height: 39.5.w, // 设置分割线的高度
width: 1, // 设置分割线的宽度
color: Colours.cLine, // 设置分割线的颜色
),
GestureDetector(
onTap: () {
controller.cancelPay();
Navigator.of(context).pop();
Navigator.pop(context);
},
child: const Text(
'确定',
style: TextStyle(
fontSize: 12,
fontWeight: Fonts.medium,
color: Colours.cAB1941,
),
),
),
],
),
],*/
); );
}, },
); );
...@@ -221,19 +181,6 @@ class BuildItem extends StatelessWidget { ...@@ -221,19 +181,6 @@ class BuildItem extends StatelessWidget {
), ),
], ],
), ),
/* Column(
crossAxisAlignment: CrossAxisAlignment.end,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Gaps.vGaps10,
Text('优惠券使用规则',style: TextStyle(fontSize: 10.w,height: 1.5,color: Colours.cAB1941),
maxLines: 1,overflow: TextOverflow.ellipsis,),
],
),*/
], ],
), ),
), ),
......
...@@ -29,6 +29,7 @@ class UserInfoController extends GetxController { ...@@ -29,6 +29,7 @@ class UserInfoController extends GetxController {
Toast.show('修改成功'); Toast.show('修改成功');
userInfo.headImg = img; userInfo.headImg = img;
update(); update();
Get.put(MineController()).getInfo();
} }
} }
......
library user_info; library user_info;
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_book/pages/mine/index.dart';
import 'package:flutter_book/theme.dart'; import 'package:flutter_book/theme.dart';
import 'package:flutter_book/utils/index.dart'; import 'package:flutter_book/utils/index.dart';
import 'package:flutter_book/widgets/index.dart'; import 'package:flutter_book/widgets/index.dart';
......
...@@ -12,6 +12,7 @@ class UserNickController extends GetxController { ...@@ -12,6 +12,7 @@ class UserNickController extends GetxController {
Toast.show('修改成功'); Toast.show('修改成功');
userInfo.name = nick ; userInfo.name = nick ;
update(); update();
Get.put(MineController()).getInfo();
} }
} }
} }
...@@ -10,6 +10,7 @@ import 'package:get/get_state_manager/src/simple/get_controllers.dart'; ...@@ -10,6 +10,7 @@ import 'package:get/get_state_manager/src/simple/get_controllers.dart';
import '../../apis/index.dart'; import '../../apis/index.dart';
import '../../models/index.dart'; import '../../models/index.dart';
import '../mine/index.dart';
import '../user_gender/index.dart'; import '../user_gender/index.dart';
part 'view.dart'; part 'view.dart';
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论