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

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

......@@ -6,7 +6,7 @@ class SearchController extends GetxController {
controlFinishRefresh: true,
);
late TextEditingController searchController = TextEditingController();
bool showHistory = true;
// 搜索记录数组
List<String> records = [];
// 书籍数组
......
......@@ -8,7 +8,6 @@ class SearchPage extends StatefulWidget {
}
class _SearchPageState extends State<SearchPage> {
bool showHistory = true; // 根据条件设置为true或false
@override
Widget build(BuildContext context) {
return GetBuilder<SearchController>(
......@@ -27,7 +26,7 @@ class _SearchPageState extends State<SearchPage> {
// context.pushNamed(Routes.msgs);
},
onEditingComplete: () {
showHistory = false;
controller.showHistory = false;
controller.search();
// FocusScope.of(context).unfocus();
FocusNode blankNode = FocusNode();
......@@ -51,17 +50,37 @@ class _SearchPageState extends State<SearchPage> {
)
],
),
body: buildListView(controller),
body:
buildListView(controller),
),
);
}
Widget buildListView(SearchController controller) {
if (showHistory) {
if (controller.showHistory) {
// 如果条件为true,显示历史搜索记录
return BuildHistory(controller: controller);
} else {
// 如果条件为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(
// shrinkWrap: true,
// physics: NeverScrollableScrollPhysics(),
......@@ -85,6 +104,8 @@ class _SearchPageState extends State<SearchPage> {
);
});
}
}
}
hideSoftKeyboard(BuildContext context) {
......
......@@ -2,7 +2,6 @@ part of search;
class BuildHistory extends StatefulWidget {
final SearchController controller;
const BuildHistory({
Key? key,
required this.controller,
......@@ -65,6 +64,13 @@ class _BuildHistoryState extends State<BuildHistory> {
}else {
return searchList.map((e){
return GestureDetector(
onTap: () {
// showHistory = false;
widget.controller.searchController.text =e;
widget.controller.showHistory = false;
widget.controller.search();
Console.log('点击了-$e');
},
child: Container(
height: 27,
decoration: BoxDecoration(
......
......@@ -15,19 +15,20 @@ class BuildItem extends StatelessWidget {
margin: EdgeInsets.only(left: 10.w,top: 10.w,right: 5.w),
child: Stack(
children: [
Container(
child:Image.asset(
// Image.asset(model.type ==1?'assets/images/coupon_yes.png':'assets/images/coupon_no.png',
// fit: BoxFit.contain,
// width: double.infinity,),
Image.asset(
'assets/images/coupon_bg.png',
fit: BoxFit.contain,
width: double.infinity,
) ,
),
Container(
SizedBox(
height: 105.w,
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Container(
SizedBox(
width:120.w ,
height: 100.w,
child: Column(
......@@ -160,55 +161,14 @@ class BuildItem extends StatelessWidget {
],
),
),
],
),
],
),
],),
// 去除操作按钮区域的内边距
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 {
),
],
),
/* 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 {
Toast.show('修改成功');
userInfo.headImg = img;
update();
Get.put(MineController()).getInfo();
}
}
......
library user_info;
import 'package:flutter/material.dart';
import 'package:flutter_book/pages/mine/index.dart';
import 'package:flutter_book/theme.dart';
import 'package:flutter_book/utils/index.dart';
import 'package:flutter_book/widgets/index.dart';
......
......@@ -12,6 +12,7 @@ class UserNickController extends GetxController {
Toast.show('修改成功');
userInfo.name = nick ;
update();
Get.put(MineController()).getInfo();
}
}
}
......@@ -10,6 +10,7 @@ import 'package:get/get_state_manager/src/simple/get_controllers.dart';
import '../../apis/index.dart';
import '../../models/index.dart';
import '../mine/index.dart';
import '../user_gender/index.dart';
part 'view.dart';
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论