提交 0bbfc72e authored 作者: yueweilu's avatar yueweilu

图书馆界面优化

上级 62702350
......@@ -64,7 +64,8 @@ abstract class LibraryAPI {
final result = await HttpService.to.post(
'/v1/book/category/getBookList',
params: params
params: params,
showLoading: true
);
if (result.data is! Map && result.data['list'] is! List) return [];
return List.generate(result.data['list'].length, (index){
......
......@@ -33,7 +33,7 @@ class _BuildItemState extends State<BuildItem> {
Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(widget.model.name??'',style: TextStyle(fontSize: 14.w,color: widget.model.seen ==0? Colours.c3:Colours.c9,fontWeight: Fonts.medium,height: 1.4),),
Text(widget.model.name??'',style: TextStyle(fontSize: 14.w,color: widget.model.seen ==0? Colours.c3:Colours.c9,fontWeight: Fonts.medium,height: 2),),
Gaps.hGaps5,
widget.model.isReading == 1? Container(
height: 17,
......@@ -76,7 +76,7 @@ class _BuildItemState extends State<BuildItem> {
return Container(
color: Colors.white,
padding: const EdgeInsets.only(left: 60),
child: Text(model.name??'',style:TextStyle(fontSize: 12,color: model.seen ==0? Colours.c3:Colours.c9,height: 1.6),),
child: Text(model.name??'',style:TextStyle(fontSize: 12,color: model.seen ==0? Colours.c3:Colours.c9,height: 2),),
);
}
}
......@@ -15,15 +15,15 @@ class BuildItem extends StatelessWidget {
padding: EdgeInsets.only(left: 15.w, top: 15.w,right: 10.w,bottom: 15.w),
decoration: BoxDecoration(
color: Colors.white,
boxShadow: const [
boxShadow: [
BoxShadow(
color: Colours.cC7,
offset: Offset(0, 3),
blurRadius: 4,
color: Colours.cC7.withOpacity(0.5),
offset: Offset(3.w, 0.w),
blurRadius: 4.w,
spreadRadius: 0,
),
],
borderRadius: BorderRadius.circular(8)
borderRadius: BorderRadius.circular(8.w)
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
......@@ -31,13 +31,13 @@ class BuildItem extends StatelessWidget {
Row(
children: [
Container(
width: 35,
height: 35,
width: 35.w,
height: 35.w,
decoration: BoxDecoration(
color: Colors.cyan,
borderRadius: BorderRadius.circular(17.5)
borderRadius: BorderRadius.circular(17.5.w)
),
child: CustomImage.network(url: model.usersImg??''),
child: CustomImage.network(url: model.usersImg??'',radius: 17.5.w,),
),
Gaps.hGaps10,
Expanded(
......@@ -47,9 +47,9 @@ class BuildItem extends StatelessWidget {
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(model.users??'',style: const TextStyle(fontSize: 12,height: 1.3,color: Colours.c9),),
Text(model.users??'',style: TextStyle(fontSize: 12.w,height: 1.3,color: Colours.c9),),
// Spacer(),
Text(model.createTime??'',style: const TextStyle(fontSize: 12,height: 1.3,color: Colours.c9),)
Text(model.createTime??'',style: TextStyle(fontSize: 12.w,height: 1.3,color: Colours.c9),)
],
),
AbsorbPointer(
......@@ -57,10 +57,10 @@ class BuildItem extends StatelessWidget {
child: CustomRating(
max: 5,
score:model.rating!.toDouble() ,
star: const Star(
star: Star(
progress: 7,
fillColor: AppTheme.primary,
size: 12,
size: 12.w,
emptyColor: Colours.cE2,
), onRating: (double ) {},
),
......@@ -71,7 +71,7 @@ class BuildItem extends StatelessWidget {
],
),
Gaps.vGaps15,
Text(model.comments??'',style: const TextStyle(fontSize: 14,height: 1.5,color: Colours.c3),)
Text(model.comments??'',style: TextStyle(fontSize: 14.w,height: 1.5,color: Colours.c3),)
],
),
),
......
......@@ -82,6 +82,7 @@ class LibraryController extends GetxController with GetTickerProviderStateMixin{
// 获取标签数据
_getLabels();
_getAds();
onRefresh();
super.onReady();
}
......@@ -154,7 +155,16 @@ class LibraryController extends GetxController with GetTickerProviderStateMixin{
}
model.selected = true;
selectedLabel = model;
update();
onRefresh();
}
void selectCategory(FilterModel model){
for (FilterModel m in filterCategories){
m.selected = false;
}
model.selected = true;
selectedCategory = model;
onRefresh();
}
/// 获取广告数据
......
......@@ -35,24 +35,61 @@ class _LibraryPageState extends State<LibraryPage> {
return Stack(
children: [
Column(
mainAxisSize: MainAxisSize.max,
children: [
_buildTab(controller),
// _buildTab(controller),
Row(
children: [
Expanded(child: _buildCategory()),
GestureDetector(
onTap: (){
controller.setShow(controller.show);
},
child: Container(
padding: EdgeInsets.symmetric(horizontal: 10.w),
alignment: Alignment.center,
height: 38.w,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Container(
width: 12.w,
height: 12.w,
// color: Colors.red,
alignment: Alignment.center,
child: Image.asset(
'assets/images/filter.png',
),
),
Gaps.hGaps5,
Text('筛选',style: TextStyle(color: Colours.c9,fontSize: 14.w,height: 1.5),)
],
),
// width: 75,
),
)
],
),
_buildLabel(),
Expanded(
child: CustomPullScrollView(
controller: controller.refreshController,
onRefresh: controller.onRefresh,
onLoading: controller.onLoading,
child: SingleChildScrollView(
child: Column(
children: [
controller.ads.isNotEmpty?Container(
color: Colors.cyan,
child: BuildBanner(items:controller.ads)
):const SizedBox(),
Container(
// color: Colors.red,
child: Expanded(
child: CustomPullScrollView(
controller: controller.refreshController,
// onRefresh: controller.onRefresh,
onLoading: controller.onLoading,
child: SingleChildScrollView(
child: Column(
mainAxisSize: MainAxisSize.max,
children: [
controller.ads.isNotEmpty?Container(
color: Colors.cyan,
child: BuildBanner(items:controller.ads)
):const SizedBox(),
LibraryContentPage(controller: controller,)
],
LibraryContentPage(controller: controller,)
],
),
),
),
),
......@@ -97,6 +134,33 @@ class _LibraryPageState extends State<LibraryPage> {
);
}
Widget _buildCategory(){
return Container(
height: 38,
child: GetBuilder<LibraryController>(
init: LibraryController(),
builder: (controller) =>ListView.builder(
scrollDirection: Axis.horizontal,
itemBuilder: (BuildContext context, int index){
FilterModel model = controller.filterCategories[index];
return GestureDetector(
onTap: (){
controller.selectCategory(model);
},
child: Container(
padding: EdgeInsets.symmetric(vertical: 10.w,horizontal: 10.w),
color: model.selected?const Color(0xFFC02D55).withOpacity(0.08):Colors.white,
alignment: Alignment.center,
child: Text(model.name??'',style: model.selected?TextStyle(fontSize: 14.w,color: AppTheme.primary,fontWeight: Fonts.medium,):TextStyle(fontSize: 14.w,color: Colours.c9,),),
),
);
},
itemCount: controller.filterCategories.length
)
),
);
}
PreferredSizeWidget _buildTab(LibraryController controller){
return PreferredSize(
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论