Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
B
book-app
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
EzijingWeb
book-app
Commits
85a7a09e
提交
85a7a09e
authored
3月 26, 2024
作者:
yueweilu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
筛选
上级
6172ac79
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
71 行增加
和
66 行删除
+71
-66
controller.dart
lib/pages/library/controller.dart
+14
-9
view.dart
lib/pages/library/view.dart
+57
-57
没有找到文件。
lib/pages/library/controller.dart
浏览文件 @
85a7a09e
...
...
@@ -21,7 +21,7 @@ class LibraryController extends GetxController with GetTickerProviderStateMixin{
late
FilterModel
selectedDown
=
FilterModel
();
late
TabController
tabController
=
TabController
(
length:
categories
.
length
,
vsync:
this
);
//
late TabController tabController = TabController(length:categories.length, vsync: this);
final
EasyRefreshController
refreshController
=
EasyRefreshController
(
controlFinishLoad:
true
,
...
...
@@ -107,7 +107,7 @@ class LibraryController extends GetxController with GetTickerProviderStateMixin{
@override
void
onClose
()
{
tabController
.
dispose
();
//
tabController.dispose();
refreshController
.
dispose
();
super
.
onClose
();
}
...
...
@@ -144,10 +144,10 @@ class LibraryController extends GetxController with GetTickerProviderStateMixin{
/// 确定
void
sureFilter
(){
WidgetsBinding
.
instance
!.
addPostFrameCallback
((
_
)
{
tabController
.
animateTo
(
3
);
// 你想要的标签索引
});
update
();
//
WidgetsBinding.instance!.addPostFrameCallback((_) {
//
tabController.animateTo(3); // 你想要的标签索引
//
});
//
update();
for
(
FilterModel
model
in
filterCategories
){
if
(
model
.
selected
){
selectedCategory
=
model
;
...
...
@@ -203,8 +203,8 @@ class LibraryController extends GetxController with GetTickerProviderStateMixin{
void
_getTabs
()
async
{
categories
=
await
LibraryAPI
.
categories
();
tabController
.
dispose
();
tabController
=
TabController
(
length:
categories
.
length
,
vsync:
this
);
//
tabController.dispose();
//
tabController = TabController(length:categories.length, vsync: this);
filterCategories
=
categories
.
map
((
model
)
{
return
FilterModel
(
id:
model
.
categoryId
.
toString
(),
name:
model
.
name
??
''
,
selected:
model
.
selected
);
...
...
@@ -328,6 +328,11 @@ class LibraryController extends GetxController with GetTickerProviderStateMixin{
sortField
=
selectedDown
.
id
??
''
;
}
String
isFree
=
''
;
if
(
selectedFree
.
selected
==
true
){
isFree
=
selectedFree
.
id
??
''
;
}
if
(
isRefresh
)
_page
=
1
;
// 网路请求
final
result
=
await
LibraryAPI
.
books
(
...
...
@@ -335,7 +340,7 @@ class LibraryController extends GetxController with GetTickerProviderStateMixin{
limit:
_limit
,
categoryId:
selectedCategory
.
id
??
''
,
labelId:
selectedLabel
.
id
??
''
,
isFree:
selectedFree
.
id
??
''
,
isFree:
isFree
,
sortField:
sortField
,
sort
:
sort
// sort:selectedDown.id!.isEmpty?'':selectedDown.up ==true?'desc':'asc'
...
...
lib/pages/library/view.dart
浏览文件 @
85a7a09e
...
...
@@ -178,63 +178,63 @@ class _LibraryPageState extends State<LibraryPage> {
}
PreferredSizeWidget
_buildTab
(
LibraryController
controller
){
return
PreferredSize
(
preferredSize:
Size
.
fromHeight
(
48
.
w
),
child:
Container
(
color:
Colors
.
white
,
child:
Row
(
children:
[
// TabBar放在左侧
Expanded
(
child:
TabBar
(
indicator:
BoxDecoration
(
border:
const
Border
(
bottom:
BorderSide
(
color:
Colors
.
transparent
,
width:
0.0
)),
// 将指示器的底边框颜色设置为透明
color:
const
Color
(
0xFFC02D55
).
withOpacity
(
0.08
)
),
labelStyle:
TextStyle
(
color:
AppTheme
.
primary
,
fontSize:
14
.
w
,
height:
1.5
,
fontWeight:
Fonts
.
medium
),
unselectedLabelColor:
Colours
.
c9
,
unselectedLabelStyle:
TextStyle
(
color:
Colours
.
c9
,
fontSize:
14
.
w
,
height:
1.5
),
controller:
controller
.
tabController
,
isScrollable:
true
,
tabs:
controller
.
filterCategories
.
map
((
model
){
return
Tab
(
text:
model
.
name
);
}).
toList
(),
),
),
// 筛选按钮放在右侧
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,
),
)
],
),
),
);
}
//
PreferredSizeWidget _buildTab(LibraryController controller){
//
return PreferredSize(
//
preferredSize: Size.fromHeight(48.w),
//
child: Container(
//
color: Colors.white,
//
child: Row(
//
children: [
//
// TabBar放在左侧
//
Expanded(
//
child: TabBar(
//
indicator: BoxDecoration(
//
border: const Border(bottom: BorderSide(color: Colors.transparent, width: 0.0)), // 将指示器的底边框颜色设置为透明
//
color: const Color(0xFFC02D55).withOpacity(0.08)
//
),
//
labelStyle: TextStyle(color: AppTheme.primary,fontSize: 14.w,height: 1.5,fontWeight: Fonts.medium),
//
unselectedLabelColor: Colours.c9,
//
unselectedLabelStyle: TextStyle(color: Colours.c9,fontSize: 14.w,height: 1.5),
//
controller: controller.tabController,
//
isScrollable: true,
//
tabs: controller.filterCategories.map((model){
//
return Tab(text: model.name);
//
}).toList(),
//
),
//
),
//
// 筛选按钮放在右侧
//
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,
//
),
//
)
//
],
//
),
//
),
//
);
//
}
// @override
// bool get wantKeepAlive => true;
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论