Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
B
book-app
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
EzijingWeb
book-app
Commits
e6854922
提交
e6854922
authored
1月 31, 2024
作者:
yueweilu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
阅读界面笔记讨论目录
上级
c9044f19
显示空白字符变更
内嵌
并排
正在显示
9 个修改的文件
包含
131 行增加
和
74 行删除
+131
-74
controller.dart
lib/pages/user_coin_recharge/controller.dart
+12
-15
view.dart
lib/pages/user_coin_recharge/view.dart
+1
-1
controller.dart
lib/pages/web/controller.dart
+33
-0
index.dart
lib/pages/web/index.dart
+1
-0
view.dart
lib/pages/web/view.dart
+55
-51
category.dart
lib/pages/web/widgets/category.dart
+7
-2
discuss.dart
lib/pages/web/widgets/discuss.dart
+12
-3
note.dart
lib/pages/web/widgets/note.dart
+9
-2
styles.dart
lib/utils/styles.dart
+1
-0
没有找到文件。
lib/pages/user_coin_recharge/controller.dart
浏览文件 @
e6854922
...
...
@@ -39,7 +39,6 @@ class CoinRechargeController extends GetxController {
@override
void
onInit
()
{
initPlatformState
();
_getProduct
();
_getPendingPurchase
();
super
.
onInit
();
}
...
...
@@ -78,6 +77,7 @@ class CoinRechargeController extends GetxController {
}
rechargeModel
=
coinModel
;
_buyIndex
=
data
.
indexOf
(
coinModel
);
update
();
}
...
...
@@ -100,20 +100,13 @@ class CoinRechargeController extends GetxController {
Future
<
void
>
initPlatformState
()
async
{
var
result
=
await
FlutterInappPurchase
.
instance
.
initialize
();
print
(
'--------------initPlatformState-------------------------
$result
'
);
try
{
String
msg
=
await
FlutterInappPurchase
.
instance
.
consumeAll
();
print
(
'consumeAllItems:
$msg
'
);
}
catch
(
err
)
{
print
(
'consumeAllItems error:
$err
'
);
}
_connectionSubscription
=
FlutterInappPurchase
.
connectionUpdated
.
listen
((
connected
)
{
_connectionSubscription
=
FlutterInappPurchase
.
connectionUpdated
.
listen
((
connected
)
{
print
(
'connected:
$connected
'
);
});
_purchaseUpdatedSubscription
=
FlutterInappPurchase
.
purchaseUpdated
.
listen
((
productItem
)
{
_purchaseUpdatedSubscription
=
FlutterInappPurchase
.
purchaseUpdated
.
listen
((
productItem
)
{
CustomToast
.
dismiss
();
if
(
productItem
!=
null
){
_resultItem
=
productItem
;
...
...
@@ -121,8 +114,7 @@ class CoinRechargeController extends GetxController {
}
});
_purchaseErrorSubscription
=
FlutterInappPurchase
.
purchaseError
.
listen
((
purchaseError
)
{
_purchaseErrorSubscription
=
FlutterInappPurchase
.
purchaseError
.
listen
((
purchaseError
)
{
CustomToast
.
dismiss
();
Toast
.
show
(
purchaseError
!.
message
.
toString
());
});
...
...
@@ -136,19 +128,24 @@ class CoinRechargeController extends GetxController {
.
map
((
coinModel
)
=>
coinModel
.
identifying
!)
.
toList
();
List
<
IAPItem
>
items
=
await
FlutterInappPurchase
.
instance
.
getProducts
(
productList
);
print
(
'-------------productList-------------------
$productList
'
);
List
<
IAPItem
>
items
=
await
FlutterInappPurchase
.
instance
.
getProducts
([
'com.zijing.book.flutterBook'
]);
for
(
var
item
in
items
)
{
_items
.
add
(
item
);
}
print
(
'-------------_items-------------------
$items
'
);
_items
=
items
;
_purchases
=
[];
update
();
}
/// 创建订单
void
_
createRechargeOrder
()
async
{
void
createRechargeOrder
()
async
{
final
result
=
await
MineAPI
.
createRechargeOrder
(
identifying:
rechargeModel
.
identifying
??
''
,
type:
payModel
.
type
.
toString
());
print
(
'-----------------------------------
${result.ordersnum}
--------------------------------
${result.msg}
'
);
payOrderModel
=
result
;
// 创建订单成功开启支付流程
if
(
payOrderModel
.
ordersnum
!=
null
){
...
...
lib/pages/user_coin_recharge/view.dart
浏览文件 @
e6854922
...
...
@@ -63,7 +63,7 @@ class _CoinRechargePageState extends State<CoinRechargePage> {
text:
'立即充值
${controller.rechargeModel.priceName??''}
'
,
isEnabled:
true
,
onPressed:
()
{
// context.goNamed(Routes.login
);
controller
.
createRechargeOrder
(
);
},
),
),
...
...
lib/pages/web/controller.dart
浏览文件 @
e6854922
...
...
@@ -4,6 +4,13 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
// 目录
List
<
ChapterModel
>
chapters
=
[];
List
<
ToolModel
>
tools
=
[
ToolModel
(
tag:
0
,
name:
'目录'
,
selected:
false
,
icon:
'assets/images/category_unselect.png'
,
activeIcon:
'assets/images/category_select.png'
),
ToolModel
(
tag:
1
,
name:
'笔记'
,
selected:
false
,
icon:
'assets/images/note_unselect.png'
,
activeIcon:
'assets/images/note_select.png'
),
ToolModel
(
tag:
2
,
name:
'讨论'
,
selected:
false
,
icon:
'assets/images/discuss_unselect.png'
,
activeIcon:
'assets/images/discuss_select.png'
),
];
late
ToolModel
toolModel
=
tools
.
first
;
// late final PageController pageController;
//
...
...
@@ -33,6 +40,22 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
}
void
chooseTool
(
ToolModel
selectedModel
){
for
(
var
model
in
tools
)
{
// 如果当前遍历到的工具是选中的,并且不是点击的工具,则取消选中
if
(
model
.
selected
&&
model
!=
selectedModel
)
{
model
.
selected
=
false
;
}
// 如果当前遍历到的工具是点击的工具,切换选中状态
else
if
(
model
==
selectedModel
)
{
model
.
selected
=
!
model
.
selected
;
}
}
toolModel
=
selectedModel
;
update
();
}
AnimationController
get
controller
=>
_controller
;
...
...
@@ -89,3 +112,12 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
update
();
}
}
class
ToolModel
{
ToolModel
({
required
this
.
tag
,
required
this
.
selected
,
required
this
.
name
,
required
this
.
icon
,
required
this
.
activeIcon
});
int
tag
;
String
name
;
bool
selected
;
String
icon
;
String
activeIcon
;
}
\ No newline at end of file
lib/pages/web/index.dart
浏览文件 @
e6854922
...
...
@@ -4,6 +4,7 @@ library web;
import
'package:easy_refresh/easy_refresh.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter/services.dart'
;
import
'package:flutter_book/theme.dart'
;
import
'package:flutter_inappwebview/flutter_inappwebview.dart'
;
import
'package:flutter_book/utils/index.dart'
;
import
'package:flutter_screenutil/flutter_screenutil.dart'
;
...
...
lib/pages/web/view.dart
浏览文件 @
e6854922
...
...
@@ -69,7 +69,7 @@ class _ReadPageState extends State<ReadPage> {
right:
0
,
top:
0
,
bottom:
49
+
MediaQuery
.
of
(
context
).
viewInsets
.
bottom
,
child:
_showContent
(
readController
,
currentIndex
)
child:
_showContent
(
readController
,
readController
.
toolModel
)
),
AnimatedPositioned
(
duration:
readController
.
controller
.
duration
!,
...
...
@@ -81,98 +81,102 @@ class _ReadPageState extends State<ReadPage> {
child:
Container
(
color:
Colors
.
limeAccent
,
alignment:
Alignment
.
center
,
child:
BottomNavigationBar
(
currentIndex:
currentIndex
,
onTap:
(
index
){
setState
(()
{
currentIndex
=
index
;
});
// _showBottomSheet(context, index);
},
items:
[
BottomNavigationBarItem
(
label:
'目录'
,
icon:
Image
.
asset
(
'assets/images/category_unselect.png'
,
),
activeIcon:
Image
.
asset
(
'assets/images/category_select.png'
,
),
),
BottomNavigationBarItem
(
label:
'笔记'
,
icon:
Image
.
asset
(
'assets/images/note_unselect.png'
,
),
activeIcon:
Image
.
asset
(
'assets/images/note_select.png'
,
)
),
BottomNavigationBarItem
(
label:
'讨论'
,
icon:
Image
.
asset
(
'assets/images/discuss_unselect.png'
,
child:
_createToolBar
(
readController
)
),
activeIcon:
Image
.
asset
(
'assets/images/discuss_select.png'
,
)
),
],
)
),
),
),
);
}
Widget
_createToolBar
(
ReadController
controller
){
return
Container
(
child:
Row
(
mainAxisAlignment:
MainAxisAlignment
.
spaceAround
,
children:
controller
.
tools
.
map
((
model
){
return
Expanded
(
child:
GestureDetector
(
onTap:
(){
controller
.
chooseTool
(
model
);
},
child:
Container
(
color:
Colors
.
white
,
child:
Column
(
mainAxisAlignment:
MainAxisAlignment
.
center
,
mainAxisSize:
MainAxisSize
.
max
,
children:
[
SizedBox
(
width:
17
,
height:
17
,
child:
Image
.
asset
(
model
.
selected
?
model
.
activeIcon
:
model
.
icon
)
),
// SizedBox(height: 2.5.w,),
model
.
selected
?
Text
(
model
.
name
,
style:
TextStyle
(
fontSize:
10
.
w
,
height:
1.4
,
fontWeight:
Fonts
.
medium
,
color:
AppTheme
.
primary
),)
:
Text
(
model
.
name
,
style:
TextStyle
(
fontSize:
10
.
w
,
height:
1.4
,
fontWeight:
Fonts
.
medium
,
color:
Colours
.
c6
))
],
),
),
),
);
}).
toList
()
),
);
}
Widget
_showContent
(
ReadController
controller
,
int
index
)
{
print
(
'++++++++++++++++++++++++
$index
'
);
Widget
_showContent
(
ReadController
controller
,
ToolModel
model
)
{
print
(
'++++++++++++++++++++++++
${model.tag}
'
);
if
(
controller
.
show
){
if
(
index
==
0
){
return
Container
(
if
(
model
.
tag
==
0
){
return
model
.
selected
?
Container
(
color:
Color
(
0xFF000000
).
withOpacity
(
0.5
),
padding:
EdgeInsets
.
only
(
top:
MediaQuery
.
of
(
context
).
size
.
height
*
0.2
),
child:
ClipRRect
(
borderRadius:
BorderRadius
.
only
(
topRight:
Radius
.
circular
(
8
.
w
),
topLeft:
Radius
.
circular
(
8
.
w
)),
child:
Container
(
color:
Colors
.
white
,
child:
ReadCategoryPage
(
controller:
controller
,),
child:
ReadCategoryPage
(
controller:
controller
,
onTap:
(){
controller
.
chooseTool
(
model
);
},),
),
),
// child: ReadCategoryPage(),
);
)
:
const
SizedBox
()
;
}
else
if
(
index
==
1
){
return
Container
(
else
if
(
model
.
tag
==
1
){
return
model
.
selected
?
Container
(
color:
Color
(
0xFF000000
).
withOpacity
(
0.5
),
padding:
EdgeInsets
.
only
(
top:
MediaQuery
.
of
(
context
).
size
.
height
*
0.2
),
child:
ClipRRect
(
borderRadius:
BorderRadius
.
only
(
topRight:
Radius
.
circular
(
8
.
w
),
topLeft:
Radius
.
circular
(
8
.
w
)),
child:
Container
(
color:
Colors
.
white
,
child:
ReadNotePage
(),
child:
ReadNotePage
(
onTap:
(){
controller
.
chooseTool
(
model
);
},),
),
),
// child: ReadCategoryPage(),
);
)
:
const
SizedBox
()
;
}
else
if
(
index
==
2
){
return
Container
(
else
if
(
model
.
tag
==
2
){
return
model
.
selected
?
Container
(
color:
Color
(
0xFF000000
).
withOpacity
(
0.5
),
padding:
EdgeInsets
.
only
(
top:
MediaQuery
.
of
(
context
).
size
.
height
*
0.2
),
child:
ClipRRect
(
borderRadius:
BorderRadius
.
only
(
topRight:
Radius
.
circular
(
8
.
w
),
topLeft:
Radius
.
circular
(
8
.
w
)),
child:
Container
(
color:
Colors
.
white
,
child:
ReadNotePage
(),
child:
ReadDiscussPage
(
onTap:
(){
controller
.
chooseTool
(
model
);
},),
),
),
// child: ReadCategoryPage(),
);
)
:
const
SizedBox
()
;
}
}
return
const
SizedBox
();
...
...
lib/pages/web/widgets/category.dart
浏览文件 @
e6854922
...
...
@@ -2,9 +2,11 @@ part of web;
class
ReadCategoryPage
extends
StatefulWidget
{
final
ReadController
controller
;
final
void
Function
()?
onTap
;
const
ReadCategoryPage
({
Key
?
key
,
required
this
.
controller
,
required
this
.
onTap
,
})
:
super
(
key:
key
);
@override
...
...
@@ -24,7 +26,10 @@ class _ReadCategoryPageState extends State<ReadCategoryPage> {
children:
[
Container
(
margin:
EdgeInsets
.
only
(
left:
15
.
w
,
right:
15
.
w
,
top:
15
.
w
,
bottom:
15
.
w
),
child:
Image
.
asset
(
'assets/images/close.png'
)
child:
GestureDetector
(
onTap:
widget
.
onTap
,
child:
Image
.
asset
(
'assets/images/close.png'
),
)
),
Container
(
margin:
EdgeInsets
.
only
(
left:
15
.
w
,
right:
15
.
w
,),
...
...
@@ -45,7 +50,7 @@ class _ReadCategoryPageState extends State<ReadCategoryPage> {
child:
CustomInputSearch
(
controller:
searchController
,
readOnly:
false
,
hintText:
'请输入书籍名称'
,
hintText:
'请输入书籍名称
分类
'
,
onTap:
()
{
// context.pushNamed(Routes.msgs);
},
...
...
lib/pages/web/widgets/discuss.dart
浏览文件 @
e6854922
part of
web
;
class
ReadDiscussPage
extends
StatefulWidget
{
const
ReadDiscussPage
({
Key
?
key
})
:
super
(
key:
key
);
final
void
Function
()?
onTap
;
const
ReadDiscussPage
({
Key
?
key
,
required
this
.
onTap
,
})
:
super
(
key:
key
);
@override
State
<
ReadDiscussPage
>
createState
()
=>
_ReadDiscussPageState
();
...
...
@@ -20,7 +24,10 @@ class _ReadDiscussPageState extends State<ReadDiscussPage> {
children:
[
Container
(
margin:
EdgeInsets
.
only
(
left:
15
.
w
,
right:
15
.
w
,
top:
15
.
w
,
bottom:
15
.
w
),
child:
GestureDetector
(
onTap:
widget
.
onTap
,
child:
Image
.
asset
(
'assets/images/close.png'
)
)
),
Container
(
margin:
EdgeInsets
.
only
(
left:
15
.
w
,
right:
15
.
w
,),
...
...
@@ -41,7 +48,7 @@ class _ReadDiscussPageState extends State<ReadDiscussPage> {
child:
CustomInputSearch
(
controller:
searchController
,
readOnly:
false
,
hintText:
'请输入书籍名称'
,
hintText:
'请输入书籍名称
讨论
'
,
onTap:
()
{
// context.pushNamed(Routes.msgs);
},
...
...
@@ -52,12 +59,14 @@ class _ReadDiscussPageState extends State<ReadDiscussPage> {
),
),
BuildBook
(),
ListView
.
builder
(
Expanded
(
child:
ListView
.
builder
(
itemBuilder:
(
BuildContext
context
,
int
index
){
DiscussModel
model
=
controller
.
discuss
[
index
];
return
BuildDiscuss
(
model:
model
,);
},
itemCount:
controller
.
discuss
.
length
,
),
)
],
...
...
lib/pages/web/widgets/note.dart
浏览文件 @
e6854922
part of
web
;
class
ReadNotePage
extends
StatefulWidget
{
const
ReadNotePage
({
Key
?
key
})
:
super
(
key:
key
);
final
void
Function
()?
onTap
;
const
ReadNotePage
({
Key
?
key
,
required
this
.
onTap
,
})
:
super
(
key:
key
);
@override
State
<
ReadNotePage
>
createState
()
=>
_ReadNotePageState
();
...
...
@@ -18,7 +22,10 @@ class _ReadNotePageState extends State<ReadNotePage> {
children:
[
Container
(
margin:
EdgeInsets
.
only
(
left:
15
.
w
,
right:
15
.
w
,
top:
15
.
w
,
bottom:
15
.
w
),
child:
GestureDetector
(
onTap:
widget
.
onTap
,
child:
Image
.
asset
(
'assets/images/close.png'
)
)
),
Container
(
margin:
EdgeInsets
.
only
(
left:
15
.
w
,
right:
15
.
w
,),
...
...
@@ -39,7 +46,7 @@ class _ReadNotePageState extends State<ReadNotePage> {
child:
CustomInputSearch
(
controller:
searchController
,
readOnly:
false
,
hintText:
'请输入书籍名称'
,
hintText:
'请输入书籍名称
笔记
'
,
onTap:
()
{
// context.pushNamed(Routes.msgs);
},
...
...
lib/utils/styles.dart
浏览文件 @
e6854922
...
...
@@ -65,6 +65,7 @@ class Gaps {
class
Fonts
{
static
const
medium
=
FontWeight
.
w500
;
static
const
regular
=
FontWeight
.
w400
;
static
const
bold
=
FontWeight
.
bold
;
static
const
boldSemi
=
FontWeight
.
w600
;
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论