Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
B
book-app
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
EzijingWeb
book-app
Commits
ea5b1d3f
提交
ea5b1d3f
authored
1月 21, 2024
作者:
yueweilu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
图书馆界面还是有问题
上级
47cdef08
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
16 个修改的文件
包含
445 行增加
和
295 行删除
+445
-295
common.dart
lib/apis/common.dart
+3
-3
library.dart
lib/apis/library.dart
+25
-7
item.dart
lib/pages/book_category/widgets/item.dart
+3
-2
controller.dart
lib/pages/book_detail/controller.dart
+1
-0
view.dart
lib/pages/book_detail/view.dart
+18
-14
view.dart
lib/pages/book_info/view.dart
+2
-1
content_controller.dart
lib/pages/library/content_controller.dart
+83
-0
controller.dart
lib/pages/library/controller.dart
+4
-74
index.dart
lib/pages/library/index.dart
+4
-2
test.dart
lib/pages/library/test.dart
+112
-0
view.dart
lib/pages/library/view.dart
+0
-0
content.dart
lib/pages/library/widgets/content.dart
+16
-31
list_controller.dart
lib/pages/library/widgets/list_controller.dart
+0
-0
controller.dart
lib/pages/library_content/controller.dart
+100
-90
index.dart
lib/pages/library_content/index.dart
+18
-18
view.dart
lib/pages/library_content/view.dart
+56
-53
没有找到文件。
lib/apis/common.dart
浏览文件 @
ea5b1d3f
...
...
@@ -145,10 +145,10 @@ abstract class CommonAPI {
'is_select'
:
love
},
);
if
(
result
.
data
is
!
Map
&&
result
.
data
[
'is_success'
]
==
1
){
return
tru
e
;
if
(
result
.
data
is
!
Map
||
result
.
data
[
'is_success'
]
==
0
){
return
fals
e
;
}
return
fals
e
;
return
tru
e
;
}
/// 10、上传文件
...
...
lib/apis/library.dart
浏览文件 @
ea5b1d3f
...
...
@@ -37,16 +37,34 @@ abstract class LibraryAPI {
String
sortField
=
''
,
String
sort
=
''
,
String
isFree
=
''
,
String
labelId
=
''
,
required
String
categoryId
})
async
{
Map
<
String
,
dynamic
>
params
=
{
'page'
:
page
,
'limit'
:
limit
,
'category_id'
:
categoryId
};
if
(
sortField
.
isNotEmpty
){
params
[
'sort_field'
]
=
sortField
;
}
if
(
sort
.
isNotEmpty
){
params
[
'sort'
]
=
sort
;
}
if
(
isFree
.
isNotEmpty
){
params
[
'is_free'
]
=
isFree
;
}
if
(
sort
.
isNotEmpty
){
params
[
'sort'
]
=
sort
;
}
if
(
labelId
.
isNotEmpty
){
params
[
'label_id'
]
=
labelId
;
}
final
result
=
await
HttpService
.
to
.
post
(
'/v1/book/category/getBookList'
,
params:
{
'page'
:
page
,
'page_size'
:
limit
,
// 'sort_field':sortField,
// 'sort':sort,
// 'is_free':isFree
},
params:
params
);
if
(
result
.
data
is
!
Map
&&
result
.
data
[
'list'
]
is
!
List
)
return
[];
return
List
.
generate
(
result
.
data
[
'list'
].
length
,
(
index
){
...
...
lib/pages/book_category/widgets/item.dart
浏览文件 @
ea5b1d3f
...
...
@@ -24,7 +24,7 @@ class _BuildItemState extends State<BuildItem> {
});
},
child:
Container
(
margin
:
EdgeInsets
.
symmetric
(
horizontal:
15
.
w
),
padding
:
EdgeInsets
.
symmetric
(
horizontal:
15
.
w
),
height:
30
.
w
,
color:
Colors
.
white
,
child:
Row
(
...
...
@@ -74,7 +74,8 @@ class _BuildItemState extends State<BuildItem> {
Widget
_buildSection
(
ChapterModel
model
){
return
Container
(
margin:
const
EdgeInsets
.
only
(
left:
60
),
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
),),
);
}
...
...
lib/pages/book_detail/controller.dart
浏览文件 @
ea5b1d3f
...
...
@@ -63,6 +63,7 @@ class BookDetailController extends GetxController with GetSingleTickerProviderSt
}
bool
result
=
await
CommonAPI
.
love
(
bookId:
bookId
,
love:
isCollection
.
toString
());
print
(
'================================
$result
'
);
if
(
result
)
{
_getBookDetails
();
}
...
...
lib/pages/book_detail/view.dart
浏览文件 @
ea5b1d3f
...
...
@@ -56,17 +56,20 @@ class _BookDetailPageState extends State<BookDetailPage> with SingleTickerProvid
height:
2
,
color:
const
Color
(
0xFFF9F9F9
),
),
TabBar
(
labelColor:
AppTheme
.
primary
,
// isScrollable: true,
labelStyle:
TextStyle
(
fontSize:
15
.
w
,
height:
1.4
,
fontWeight:
Fonts
.
medium
),
unselectedLabelColor:
Colours
.
c9
,
unselectedLabelStyle:
TextStyle
(
fontSize:
15
.
w
,
height:
1.4
),
indicatorSize:
TabBarIndicatorSize
.
label
,
indicatorColor:
AppTheme
.
primary
,
tabs:
controller
.
tabs
,
physics:
const
NeverScrollableScrollPhysics
(),
controller:
controller
.
tabController
,
Container
(
color:
Colors
.
white
,
child:
TabBar
(
labelColor:
AppTheme
.
primary
,
// isScrollable: true,
labelStyle:
TextStyle
(
fontSize:
15
.
w
,
height:
1.4
,
fontWeight:
Fonts
.
medium
),
unselectedLabelColor:
Colours
.
c9
,
unselectedLabelStyle:
TextStyle
(
fontSize:
15
.
w
,
height:
1.4
),
indicatorSize:
TabBarIndicatorSize
.
label
,
indicatorColor:
AppTheme
.
primary
,
tabs:
controller
.
tabs
,
physics:
const
NeverScrollableScrollPhysics
(),
controller:
controller
.
tabController
,
),
),
Expanded
(
child:
TabBarView
(
...
...
@@ -74,8 +77,8 @@ class _BookDetailPageState extends State<BookDetailPage> with SingleTickerProvid
children:
[
BookCategoryPage
(
chapters:
controller
.
chapters
,),
Container
(
margin
:
EdgeInsets
.
only
(
left:
15
.
w
,
right:
15
.
w
,
top:
12
.
w
),
// color: Colors.lightBlu
e,
padding
:
EdgeInsets
.
only
(
left:
15
.
w
,
right:
15
.
w
,
top:
12
.
w
),
color:
Colors
.
whit
e
,
child:
Text
(
controller
.
bookDetails
.
content
??
''
,
style:
TextStyle
(
fontSize:
12
.
w
,
height:
1.5
,
color:
Colours
.
c3
),),
),
BookInfoPage
(
model:
controller
.
bookDetails
,)
...
...
@@ -87,7 +90,8 @@ class _BookDetailPageState extends State<BookDetailPage> with SingleTickerProvid
),
bottomNavigationBar:
SafeArea
(
child:
Container
(
margin:
EdgeInsets
.
symmetric
(
horizontal:
15
.
w
),
color:
Colors
.
white
,
padding:
EdgeInsets
.
symmetric
(
horizontal:
15
.
w
,
vertical:
10
.
w
),
child:
Row
(
mainAxisAlignment:
MainAxisAlignment
.
spaceEvenly
,
children:
[
...
...
lib/pages/book_info/view.dart
浏览文件 @
ea5b1d3f
...
...
@@ -10,7 +10,8 @@ class BookInfoPage extends StatelessWidget {
@override
Widget
build
(
BuildContext
context
)
{
return
Container
(
margin:
EdgeInsets
.
symmetric
(
horizontal:
15
.
w
,
vertical:
18
.
w
),
color:
Colors
.
white
,
padding:
EdgeInsets
.
symmetric
(
horizontal:
15
.
w
,
vertical:
18
.
w
),
child:
Column
(
children:
[
// 评分容器
...
...
lib/pages/library/content_controller.dart
0 → 100644
浏览文件 @
ea5b1d3f
part of
library
;
class
LibraryContentController
extends
GetxController
{
final
EasyRefreshController
refreshController
=
EasyRefreshController
(
controlFinishLoad:
true
,
controlFinishRefresh:
true
,
);
// 图书列表数据
List
<
CourseModel
>
books
=
[];
final
int
_limit
=
20
;
int
_page
=
1
;
bool
_noMore
=
false
;
@override
void
onClose
()
{
refreshController
.
dispose
();
super
.
onClose
();
}
/// 收藏 与 取消收藏
void
love
({
required
String
bookId
,
required
num
isCollection
})
async
{
if
(
isCollection
==
0
){
isCollection
=
1
;
}
else
{
isCollection
=
0
;
}
bool
result
=
await
CommonAPI
.
love
(
bookId:
bookId
,
love:
isCollection
.
toString
());
if
(
result
)
{
onRefresh
();
}
}
/// 获取图书列表数据
Future
<
void
>
_getBooks
([
bool
isRefresh
=
false
])
async
{
if
(
isRefresh
)
_page
=
1
;
// 网路请求
final
result
=
await
LibraryAPI
.
books
(
page:
_page
,
limit:
_limit
,
categoryId:
''
,
);
// 如果是刷新 清理数据
if
(
isRefresh
)
books
.
clear
();
books
.
addAll
(
result
);
_page
++;
_noMore
=
result
.
length
<
_limit
;
update
();
}
void
onRefresh
()
async
{
try
{
await
_getBooks
(
true
);
refreshController
.
finishRefresh
(
IndicatorResult
.
success
);
refreshController
.
resetFooter
();
}
catch
(
error
)
{
refreshController
.
finishRefresh
(
IndicatorResult
.
fail
);
}
}
void
onLoading
()
async
{
if
(
_noMore
)
{
refreshController
.
finishLoad
(
IndicatorResult
.
noMore
);
return
;
}
try
{
await
_getBooks
();
refreshController
.
finishLoad
();
}
catch
(
error
)
{
refreshController
.
finishLoad
(
IndicatorResult
.
fail
);
}
}
}
\ No newline at end of file
lib/pages/library/controller.dart
浏览文件 @
ea5b1d3f
part of
library
;
class
LibraryController
extends
GetxController
with
GetTickerProviderStateMixin
{
final
EasyRefreshController
refreshController
=
EasyRefreshController
(
controlFinishLoad:
true
,
controlFinishRefresh:
true
,
);
// 分类数据
List
<
CategoryModel
>
categories
=
[];
// 标签数据
List
<
LabelModel
>
labels
=
[];
// 图书列表数据
List
<
CourseModel
>
books
=
[];
// 广告数组
List
<
AdModel
>
ads
=
[];
...
...
@@ -20,9 +14,7 @@ class LibraryController extends GetxController with GetTickerProviderStateMixin{
late
TabController
tabController
=
TabController
(
length:
categories
.
length
,
vsync:
this
);
final
int
_limit
=
20
;
int
_page
=
1
;
bool
_noMore
=
false
;
late
AnimationController
_controller
;
bool
_show
=
false
;
...
...
@@ -62,33 +54,15 @@ class LibraryController extends GetxController with GetTickerProviderStateMixin{
// 获取标签数据
_getLabels
();
_getAds
();
onRefresh
();
super
.
onReady
();
}
@override
void
onClose
()
{
tabController
.
dispose
();
refreshController
.
dispose
();
super
.
onClose
();
}
/// 收藏 与 取消收藏
void
love
({
required
String
bookId
,
required
num
isCollection
})
async
{
if
(
isCollection
==
0
){
isCollection
=
1
;
}
else
{
isCollection
=
0
;
}
bool
result
=
await
CommonAPI
.
love
(
bookId:
bookId
,
love:
isCollection
.
toString
());
if
(
result
)
{
onRefresh
();
}
}
//
void
selectLabel
(
LabelModel
model
){
for
(
LabelModel
m
in
labels
){
...
...
@@ -118,52 +92,9 @@ class LibraryController extends GetxController with GetTickerProviderStateMixin{
labels
=
await
LibraryAPI
.
labels
();
selectedLabel
=
labels
.
first
;
selectedLabel
.
selected
=
true
;
update
();
}
/// 获取图书列表数据
Future
<
void
>
_getBooks
([
bool
isRefresh
=
false
])
async
{
if
(
isRefresh
)
_page
=
1
;
// 网路请求
final
result
=
await
LibraryAPI
.
books
(
page:
_page
,
limit:
_limit
);
// 如果是刷新 清理数据
if
(
isRefresh
)
books
.
clear
();
books
.
addAll
(
result
);
_page
++;
_noMore
=
result
.
length
<
_limit
;
update
();
}
void
onRefresh
()
async
{
try
{
await
_getBooks
(
true
);
refreshController
.
finishRefresh
(
IndicatorResult
.
success
);
refreshController
.
resetFooter
();
}
catch
(
error
)
{
refreshController
.
finishRefresh
(
IndicatorResult
.
fail
);
}
update
([
'label'
]);
}
void
onLoading
()
async
{
if
(
_noMore
)
{
refreshController
.
finishLoad
(
IndicatorResult
.
noMore
);
return
;
}
try
{
await
_getBooks
();
refreshController
.
finishLoad
();
}
catch
(
error
)
{
refreshController
.
finishLoad
(
IndicatorResult
.
fail
);
}
}
}
\ No newline at end of file
lib/pages/library/index.dart
浏览文件 @
ea5b1d3f
...
...
@@ -24,4 +24,6 @@ part 'controller.dart';
part
'widgets/cell.dart'
;
part
'widgets/content.dart'
;
part
'widgets/subject.dart'
;
part
'widgets/filter.dart'
;
\ No newline at end of file
part
'widgets/filter.dart'
;
part
'test.dart'
;
part
'content_controller.dart'
;
\ No newline at end of file
lib/pages/library/test.dart
0 → 100644
浏览文件 @
ea5b1d3f
part of
library
;
class
TestPage
extends
StatefulWidget
{
const
TestPage
({
Key
?
key
})
:
super
(
key:
key
);
@override
State
<
LibraryPage
>
createState
()
=>
_LibraryPageState
();
}
class
_TestPageState
extends
State
<
TestPage
>
with
AutomaticKeepAliveClientMixin
{
//AutomaticKeepAliveClientMixin
@override
Widget
build
(
BuildContext
context
)
{
return
Scaffold
(
appBar:
AppBar
(
title:
Text
(
'分类'
),
bottom:
PreferredSize
(
preferredSize:
Size
.
fromHeight
(
48
.
w
),
child:
Container
(
child:
Row
(
children:
[
// TabBar放在左侧
Expanded
(
child:
TabBar
(
tabs:
[
Tab
(
text:
'Tab 1'
),
Tab
(
text:
'Tab 2'
),
Tab
(
text:
'Tab 3'
),
Tab
(
text:
'Tab 4'
),
Tab
(
text:
'Tab 5'
),
],
),
),
// 筛选按钮放在右侧
IconButton
(
icon:
Icon
(
Icons
.
filter_list
),
onPressed:
()
{
// 处理筛选按钮点击事件
},
),
],
),
),
)
),
body:
Column
(
children:
[
Container
(
height:
43
,
// 设置标签栏的高度
color:
Colors
.
cyan
,
// 设置标签栏的颜色
// child: // 添加你的横向滑动标签组件
),
Expanded
(
child:
CustomScrollView
(
slivers:
[
// // 横向滑动的标签
// SliverToBoxAdapter(
// child: Container(
// height: 43, // 设置标签栏的高度
// color: Colors.grey, // 设置标签栏的颜色
// // child: // 添加你的横向滑动标签组件
// ),
// ),
// 广告位
SliverToBoxAdapter
(
child:
Container
(
height:
100
,
// 设置广告位的高度
color:
Colors
.
grey
,
// 设置广告位的颜色
)
),
SliverFillRemaining
(
child:
TabBarView
(
children:
[
// Tab 1 对应的内容
Container
(
color:
Colors
.
red
,
),
// Tab 2 对应的内容
Container
(
color:
Colors
.
green
,
),
// Tab 3 对应的内容
Container
(
color:
Colors
.
blue
,
),
Container
(
color:
Colors
.
blue
,
),
Container
(
color:
Colors
.
blue
,
),
],
),
),
],
),
),
],
),
);
}
@override
bool
get
wantKeepAlive
=>
true
;
}
lib/pages/library/view.dart
浏览文件 @
ea5b1d3f
差异被折叠。
点击展开。
lib/pages/library/widgets/content.dart
浏览文件 @
ea5b1d3f
part of
library
;
class
LibraryContentPage
extends
StatefulWidget
{
final
LibraryController
controller
;
final
LibraryCont
entCont
roller
controller
;
// final CategoryModel categoryModel;
const
LibraryContentPage
({
Key
?
key
,
...
...
@@ -16,36 +16,21 @@ class LibraryContentPage extends StatefulWidget {
class
_LibraryContentPageState
extends
State
<
LibraryContentPage
>
with
AutomaticKeepAliveClientMixin
{
@override
Widget
build
(
BuildContext
context
)
{
return
CustomPullScrollView
(
controller:
widget
.
controller
.
refreshController
,
onRefresh:
widget
.
controller
.
onRefresh
,
onLoading:
widget
.
controller
.
onLoading
,
child:
ListView
.
builder
(
// shrinkWrap: true,
// physics: NeverScrollableScrollPhysics(),
scrollDirection:
Axis
.
vertical
,
itemCount:
widget
.
controller
.
books
.
length
,
itemBuilder:
(
BuildContext
context
,
int
index
)
{
// if (index == 0){
// return Container(
// color: Colors.transparent,
// padding: const EdgeInsets.symmetric(horizontal: 10),
// child: BuildBanner(items: widget.controller.ads,),
// );
// }
// else {
CourseModel
model
=
widget
.
controller
.
books
[
index
];
return
GestureDetector
(
onTap:
(){
context
.
pushNamed
(
Routes
.
bookDetail
,
queryParameters:
{
'book_id'
:
model
.
bookId
.
toString
()});
},
child:
LibraryCell
(
model:
model
,
onTap:
(){
widget
.
controller
.
love
(
bookId:
model
.
bookId
.
toString
(),
isCollection:
model
.
isCollection
!);
},),
);
}
// },
),
return
ListView
.
builder
(
// shrinkWrap: true,
physics:
const
NeverScrollableScrollPhysics
(),
itemCount:
widget
.
controller
.
books
.
length
,
itemBuilder:
(
BuildContext
context
,
int
index
)
{
CourseModel
model
=
widget
.
controller
.
books
[
index
];
return
GestureDetector
(
onTap:
(){
context
.
pushNamed
(
Routes
.
bookDetail
,
queryParameters:
{
'book_id'
:
model
.
bookId
.
toString
()});
},
child:
LibraryCell
(
model:
model
,
onTap:
(){
widget
.
controller
.
love
(
bookId:
model
.
bookId
.
toString
(),
isCollection:
model
.
isCollection
!);
},),
);
}
);
}
@override
...
...
lib/pages/library/widgets/list_controller.dart
0 → 100644
浏览文件 @
ea5b1d3f
lib/pages/library_content/controller.dart
浏览文件 @
ea5b1d3f
part of
library_content
;
class
LibraryContentController
extends
GetxController
{
final
EasyRefreshController
refreshController
=
EasyRefreshController
(
controlFinishLoad:
true
,
controlFinishRefresh:
true
,
);
final
int
_limit
=
10
;
int
_page
=
1
;
bool
_noMore
=
false
;
// 图书列表数据
List
<
CourseModel
>
books
=
[];
@override
void
onReady
()
{
super
.
onReady
();
}
@override
void
onClose
()
{
refreshController
.
dispose
();
super
.
onClose
();
}
/// 收藏 与 取消收藏
void
love
({
required
String
bookId
,
required
num
isCollection
})
async
{
if
(
isCollection
==
0
){
isCollection
=
1
;
}
else
{
isCollection
=
0
;
}
bool
result
=
await
CommonAPI
.
love
(
bookId:
bookId
,
love:
isCollection
.
toString
());
if
(
result
)
{
onRefresh
();
}
}
/// 获取图书列表数据
Future
<
void
>
_getBooks
([
bool
isRefresh
=
false
])
async
{
if
(
isRefresh
)
_page
=
1
;
// 网路请求
final
result
=
await
LibraryAPI
.
books
(
page:
_page
,
limit:
_limit
);
// 如果是刷新 清理数据
if
(
isRefresh
)
books
.
clear
();
books
.
addAll
(
result
);
_page
++;
_noMore
=
result
.
length
<
_limit
;
update
();
}
void
onRefresh
()
async
{
try
{
await
_getBooks
(
true
);
refreshController
.
finishRefresh
(
IndicatorResult
.
success
);
refreshController
.
resetFooter
();
}
catch
(
error
)
{
refreshController
.
finishRefresh
(
IndicatorResult
.
fail
);
}
}
void
onLoading
()
async
{
if
(
_noMore
)
{
refreshController
.
finishLoad
(
IndicatorResult
.
noMore
);
return
;
}
try
{
await
_getBooks
();
refreshController
.
finishLoad
();
}
catch
(
error
)
{
refreshController
.
finishLoad
(
IndicatorResult
.
fail
);
}
}
}
\ No newline at end of file
// part of library_content;
//
// class LibraryContentController extends GetxController {
//
// final CategoryModel categoryModel;
// late LabelModel labelModel;
// LibraryContentController(this.categoryModel, this.labelModel);
//
// final EasyRefreshController refreshController = EasyRefreshController(
// controlFinishLoad: true,
// controlFinishRefresh: true,
// );
//
// // 广告数组
// List<AdModel> ads = [];
//
// final int _limit = 10;
// int _page = 1;
// bool _noMore = false;
//
//
// // 图书列表数据
// List<CourseModel> books = [];
//
//
// @override
// void onReady() {
//
// super.onReady();
// }
//
//
// @override
// void onClose() {
// refreshController.dispose();
// super.onClose();
// }
//
//
// /// 收藏 与 取消收藏
// void love({
// required String bookId,
// required num isCollection
// }) async {
// if (isCollection == 0){
// isCollection = 1;
// }
// else{
// isCollection = 0;
// }
// bool result = await CommonAPI.love(bookId: bookId, love: isCollection.toString());
// if (result) {
// onRefresh();
// }
// }
//
// /// 获取图书列表数据
// Future<void> _getBooks([bool isRefresh = false]) async {
// if (isRefresh) _page = 1;
// // 网路请求
// final result = await LibraryAPI.books(
// page: _page,
// limit: _limit,
// categoryId: categoryModel.categoryId.toString(),
// labelId: labelModel.labelId.toString()
// );
// // 如果是刷新 清理数据
// if (isRefresh) books.clear();
// books.addAll(result);
// _page ++;
// _noMore = result.length < _limit;
// update();
//
// }
//
// void onRefresh() async {
// try {
// await _getBooks(true);
// refreshController.finishRefresh(IndicatorResult.success);
// refreshController.resetFooter();
// } catch (error) {
// refreshController.finishRefresh(IndicatorResult.fail);
// }
// }
//
// void onLoading() async {
// if (_noMore) {
// refreshController.finishLoad(IndicatorResult.noMore);
// return;
// }
// try {
// await _getBooks();
// refreshController.finishLoad();
// } catch (error) {
// refreshController.finishLoad(IndicatorResult.fail);
// }
// }
//
// }
\ No newline at end of file
lib/pages/library_content/index.dart
浏览文件 @
ea5b1d3f
library
library_content
;
import
'package:easy_refresh/easy_refresh.dart'
;
import
'package:flutter/material.dart'
;
import
'package:get/get.dart'
;
import
'package:get/get_state_manager/src/simple/get_controllers.dart'
;
import
'package:go_router/go_router.dart'
;
import
'../../apis/index.dart'
;
import
'../../models/index.dart'
;
import
'../../routes/index.dart'
;
import
'../../widgets/index.dart'
;
import
'../course/index.dart'
;
import
'../library/index.dart'
;
part
'view.dart'
;
part
'controller.dart'
;
\ No newline at end of file
// library library_content;
//
// import 'package:easy_refresh/easy_refresh.dart';
// import 'package:flutter/material.dart';
// import 'package:get/get.dart';
// import 'package:get/get_state_manager/src/simple/get_controllers.dart';
// import 'package:go_router/go_router.dart';
//
// import '../../apis/index.dart';
// import '../../models/index.dart';
// import '../../routes/index.dart';
// import '../../widgets/index.dart';
// import '../course/index.dart';
// import '../library/index.dart';
//
// part 'view.dart';
// part 'controller.dart';
\ No newline at end of file
lib/pages/library_content/view.dart
浏览文件 @
ea5b1d3f
part of
library_content
;
class
LibraryContentPage
extends
StatefulWidget
{
final
CategoryModel
categoryModel
;
final
LabelModel
labelModel
;
const
LibraryContentPage
({
Key
?
key
,
required
this
.
categoryModel
,
required
this
.
labelModel
})
:
super
(
key:
key
);
@override
State
<
LibraryContentPage
>
createState
()
=>
_LibraryContentPageState
();
}
class
_LibraryContentPageState
extends
State
<
LibraryContentPage
>
with
AutomaticKeepAliveClientMixin
{
@override
Widget
build
(
BuildContext
context
)
{
return
GetBuilder
<
LibraryContentController
>(
init:
LibraryContentController
(),
builder:
(
controller
)
=>
CustomPullScrollView
(
controller:
controller
.
refreshController
,
onRefresh:
controller
.
onRefresh
,
onLoading:
controller
.
onLoading
,
child:
ListView
.
builder
(
itemCount:
controller
.
books
.
length
,
itemBuilder:
(
BuildContext
context
,
int
index
)
{
// if (index == 0){
// return Container(
// color: Colors.transparent,
// padding: const EdgeInsets.symmetric(horizontal: 10),
// child: BuildBanner(items: controller.ads,),
// );
// }
// else {
CourseModel
model
=
controller
.
books
[
index
];
return
GestureDetector
(
onTap:
(){
context
.
pushNamed
(
Routes
.
bookDetail
,
queryParameters:
{
'book_id'
:
model
.
bookId
.
toString
()});
},
child:
LibraryCell
(
model:
model
,
onTap:
(){
controller
.
love
(
bookId:
model
.
bookId
.
toString
(),
isCollection:
model
.
isCollection
!);
},),
);
}
// },
),
),
);
}
@override
bool
get
wantKeepAlive
=>
true
;
}
// part of library_content;
//
// class LibraryContentPage extends StatefulWidget {
// final CategoryModel categoryModel;
// final LabelModel labelModel;
// final String tag;
// const LibraryContentPage({
// Key? key,
// required this.categoryModel,
// required this.labelModel,
// required this.tag
// }) : super(key: key);
//
// @override
// State<LibraryContentPage> createState() => _LibraryContentPageState();
// }
//
// class _LibraryContentPageState extends State<LibraryContentPage> {
// @override
// Widget build(BuildContext context) {
// return GetBuilder<LibraryContentController>(
// // tag: widget.tag,
// init: LibraryContentController(widget.categoryModel,widget.labelModel),
// builder: (controller) => CustomPullScrollView(
// controller: controller.refreshController,
// onRefresh: controller.onRefresh,
// onLoading: controller.onLoading,
// child: ListView.builder(
// itemCount: controller.books.length+1,
// itemBuilder: (BuildContext context, int index) {
// if (index == 0){
// return Container(
// color: Colors.red,
// padding: const EdgeInsets.symmetric(horizontal: 10),
// child: BuildBanner(items: controller.ads,),
// );
// }
// else {
// CourseModel model = controller.books[index-1];
// return GestureDetector(
// onTap: (){
// context.pushNamed(Routes.bookDetail,queryParameters: {'book_id':model.bookId.toString()});
// },
// child: LibraryCell(model: model,onTap: (){
// controller.love(bookId: model.bookId.toString(), isCollection: model.isCollection!);
// },),
// );
// }
// },
// ),
// ),
// );
// }
// // @override
// // bool get wantKeepAlive => true;
// }
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论