Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
B
book-app
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
EzijingWeb
book-app
Commits
1eeefed9
提交
1eeefed9
authored
2月 01, 2024
作者:
yueweilu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
讨论窗口 键盘 基本布局
上级
6bc3e093
隐藏空白字符变更
内嵌
并排
正在显示
11 个修改的文件
包含
386 行增加
和
10 行删除
+386
-10
read_add_audio.png
assets/images/2.0x/read_add_audio.png
+0
-0
read_add_img.png
assets/images/2.0x/read_add_img.png
+0
-0
read_add_audio.png
assets/images/3.0x/read_add_audio.png
+0
-0
read_add_img.png
assets/images/3.0x/read_add_img.png
+0
-0
read_add_audio.png
assets/images/read_add_audio.png
+0
-0
read_add_img.png
assets/images/read_add_img.png
+0
-0
controller.dart
lib/pages/web/controller.dart
+6
-6
index.dart
lib/pages/web/index.dart
+2
-0
view.dart
lib/pages/web/view.dart
+209
-3
input_discuss.dart
lib/pages/web/widgets/input_discuss.dart
+167
-0
http.dart
lib/services/http.dart
+2
-1
没有找到文件。
assets/images/2.0x/read_add_audio.png
0 → 100644
浏览文件 @
1eeefed9
1.4 KB
assets/images/2.0x/read_add_img.png
0 → 100644
浏览文件 @
1eeefed9
1.2 KB
assets/images/3.0x/read_add_audio.png
0 → 100644
浏览文件 @
1eeefed9
2.7 KB
assets/images/3.0x/read_add_img.png
0 → 100644
浏览文件 @
1eeefed9
2.1 KB
assets/images/read_add_audio.png
0 → 100644
浏览文件 @
1eeefed9
701 Bytes
assets/images/read_add_img.png
0 → 100644
浏览文件 @
1eeefed9
767 Bytes
lib/pages/web/controller.dart
浏览文件 @
1eeefed9
...
...
@@ -19,8 +19,8 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
bool
showChat
=
false
;
final
FocusNode
comment
FocusNode
=
FocusNode
();
final
FocusNode
discussTitle
FocusNode
=
FocusNode
();
final
FocusNode
discussContentFocusNode
=
FocusNode
();
late
AnimationController
_controller
;
bool
_show
=
true
;
...
...
@@ -63,7 +63,7 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
AnimationController
get
controller
=>
_controller
;
void
_onCommentFocusChanged
()
{
if
(
comm
entFocusNode
.
hasFocus
)
{
if
(
discussTitleFocusNode
.
hasFocus
||
discussCont
entFocusNode
.
hasFocus
)
{
setShowChat
(
true
);
}
else
{
setShowChat
(
false
);
...
...
@@ -78,7 +78,7 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
@override
void
onInit
()
{
// pageController = PageController(initialPage: currentPage);
comment
FocusNode
.
addListener
(
_onCommentFocusChanged
);
discussTitle
FocusNode
.
addListener
(
_onCommentFocusChanged
);
/// 默认不显示状态栏
// SystemChrome.setEnabledSystemUIMode(SystemUiMode.immersiveSticky);
/// 初始化
...
...
@@ -98,8 +98,8 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
@override
void
onClose
()
{
_controller
.
dispose
();
comment
FocusNode
.
removeListener
(
_onCommentFocusChanged
);
comment
FocusNode
.
dispose
();
discussTitle
FocusNode
.
removeListener
(
_onCommentFocusChanged
);
discussTitle
FocusNode
.
dispose
();
super
.
onClose
();
}
...
...
lib/pages/web/index.dart
浏览文件 @
1eeefed9
...
...
@@ -25,3 +25,4 @@ part 'widgets/note.dart';
part
'widgets/book.dart'
;
part
'note_controller.dart'
;
part
'discuss_controller.dart'
;
part
'widgets/input_discuss.dart'
;
\ No newline at end of file
lib/pages/web/view.dart
浏览文件 @
1eeefed9
part of
web
;
final
GlobalKey
_chatContainerKey
=
GlobalKey
();
class
ReadPage
extends
StatefulWidget
{
const
ReadPage
({
Key
?
key
})
:
super
(
key:
key
);
...
...
@@ -22,7 +24,16 @@ class _ReadPageState extends State<ReadPage> {
return
GetBuilder
<
ReadController
>(
init:
ReadController
(),
builder:
(
readController
)
=>
Scaffold
(
resizeToAvoidBottomInset:
false
,
floatingActionButton:
readController
.
show
?
GestureDetector
(
onTap:
(){
readController
.
setShowChat
(
true
);
// FocusScope.of(context).requestFocus(readController.commentFocusNode);
},
child:
Image
.
asset
(
'assets/images/chat.png'
),
):
null
,
// floatingActionButtonAnimator: const NoAnimationFabAnimator(),
floatingActionButtonLocation:
MyFloatingActionButtonLocation
(),
body:
Container
(
color:
Colors
.
white
,
child:
Stack
(
...
...
@@ -84,7 +95,15 @@ class _ReadPageState extends State<ReadPage> {
child:
_createToolBar
(
readController
)
),
),
Visibility
(
visible:
readController
.
showChat
,
child:
Positioned
(
left:
0
,
right:
0
,
bottom:
MediaQuery
.
of
(
context
).
viewInsets
.
bottom
,
child:
ReadInputDiscuss
(
controller:
readController
,)
),
),
],
),
),
...
...
@@ -93,6 +112,7 @@ class _ReadPageState extends State<ReadPage> {
}
/// 目录 笔记 讨论 工具栏
Widget
_createToolBar
(
ReadController
controller
){
return
Container
(
child:
Row
(
...
...
@@ -127,12 +147,13 @@ class _ReadPageState extends State<ReadPage> {
);
}
/// 目录、评论、笔记
Widget
_showContent
(
ReadController
controller
,
ToolModel
model
)
{
print
(
'++++++++++++++++++++++++
${model.tag}
'
);
if
(
controller
.
show
){
if
(
model
.
tag
==
0
){
return
model
.
selected
?
Container
(
color:
Color
(
0xFF000000
).
withOpacity
(
0.5
),
color:
const
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
)),
...
...
@@ -181,4 +202,189 @@ class _ReadPageState extends State<ReadPage> {
}
return
const
SizedBox
();
}
Widget
_discussInput
(
ReadController
controller
){
return
Container
(
margin:
EdgeInsets
.
symmetric
(
horizontal:
15
.
w
),
child:
Column
(
children:
[
Container
(
margin:
EdgeInsets
.
symmetric
(
vertical:
10
.
w
),
child:
Row
(
children:
[
Text
(
'话题'
,
style:
TextStyle
(
fontSize:
14
.
w
,
color:
Colours
.
c3
,
height:
1.5
,
fontWeight:
Fonts
.
medium
),),
Gaps
.
hGaps5
,
Expanded
(
child:
ClipRRect
(
borderRadius:
BorderRadius
.
circular
(
4
),
child:
TextField
(
focusNode:
controller
.
discussTitleFocusNode
,
autofocus:
true
,
decoration:
InputDecoration
(
hintText:
'请输入话题名称'
,
hintStyle:
TextStyle
(
fontSize:
12
.
w
,
height:
1.5
,
color:
Colours
.
c9
,),
filled:
true
,
fillColor:
Colours
.
cF8
,
),
),
),
),
],
),
),
ClipRRect
(
borderRadius:
BorderRadius
.
circular
(
4
.
w
),
child:
Container
(
color:
Colours
.
cF8
,
constraints:
BoxConstraints
(
minHeight:
100
.
w
),
child:
Column
(
children:
[
TextField
(
focusNode:
controller
.
discussContentFocusNode
,
maxLines:
null
,
decoration:
InputDecoration
(
border:
InputBorder
.
none
,
enabledBorder:
InputBorder
.
none
,
focusedBorder:
InputBorder
.
none
,
hintText:
'请输入内容'
,
hintStyle:
TextStyle
(
fontSize:
12
.
w
,
height:
1.5
,
color:
Colours
.
c9
,),
filled:
true
,
fillColor:
Colours
.
cF8
,
),
),
Column
(
children:
[
MediaQuery
.
removePadding
(
context:
context
,
removeTop:
true
,
child:
GridView
.
builder
(
// padding: const EdgeInsets.only(left: 13,top: 10),
physics:
const
NeverScrollableScrollPhysics
(),
shrinkWrap:
true
,
gridDelegate:
SliverGridDelegateWithFixedCrossAxisCount
(
crossAxisCount:
6
,
crossAxisSpacing:
2
.
w
,
mainAxisSpacing:
2
.
w
,
childAspectRatio:
1
),
itemBuilder:
(
BuildContext
context
,
int
index
)
{
return
Container
(
color:
Colors
.
red
,
child:
Center
(
child:
Text
(
'图片'
)),
);
},
itemCount:
0
,
),
),
Container
(
color:
Colors
.
red
,
child:
MediaQuery
.
removePadding
(
context:
context
,
removeTop:
true
,
child:
ListView
.
builder
(
physics:
const
NeverScrollableScrollPhysics
(),
shrinkWrap:
true
,
itemBuilder:
(
BuildContext
context
,
int
index
){
return
Container
(
height:
20
.
w
,
margin:
EdgeInsets
.
only
(
right:
130
.
w
),
child:
Container
(
margin:
EdgeInsets
.
only
(
top:
5
.
w
),
padding:
EdgeInsets
.
only
(
right:
20
.
w
,
left:
10
.
w
),
decoration:
BoxDecoration
(
borderRadius:
BorderRadius
.
circular
(
10
.
w
),
color:
Colours
.
cF9
,
),
child:
Row
(
// mainAxisSize: MainAxisSize.min,
mainAxisAlignment:
MainAxisAlignment
.
spaceBetween
,
children:
[
Image
.
asset
(
'assets/images/audio.png'
),
Text
(
'0:00/1:52'
,
style:
TextStyle
(
fontSize:
10
.
w
,
height:
1.4
,
color:
Colours
.
c9
),)
],
),
),
);
},
itemCount:
0
,
),
),
)
],
)
],
),
),
),
Row
(
mainAxisAlignment:
MainAxisAlignment
.
spaceBetween
,
crossAxisAlignment:
CrossAxisAlignment
.
center
,
children:
[
Row
(
children:
[
Image
.
asset
(
'assets/images/read_add_img.png'
),
Gaps
.
hGaps10
,
Image
.
asset
(
'assets/images/read_add_audio.png'
),
],
),
GestureDetector
(
onTap:
(){},
child:
Container
(
decoration:
BoxDecoration
(
borderRadius:
BorderRadius
.
circular
(
15
.
w
),
color:
AppTheme
.
primary
,
gradient:
LinearGradient
(
colors:
[
const
Color
(
0xFFD53676
).
withOpacity
(
0.9
),
AppTheme
.
primary
]
,
// 不可点击时的颜色,透明度为0.7
begin:
Alignment
.
topCenter
,
end:
Alignment
.
bottomCenter
,
),
),
padding:
EdgeInsets
.
symmetric
(
horizontal:
13.5
.
w
,
vertical:
4
.
w
),
child:
Text
(
'发表'
,
style:
TextStyle
(
fontSize:
14
.
w
,
fontWeight:
Fonts
.
medium
,
color:
Colors
.
white
),),
),
)
],
)
],
)
);
}
}
class
MyFloatingActionButtonLocation
extends
FloatingActionButtonLocation
{
@override
Offset
getOffset
(
ScaffoldPrelayoutGeometry
scaffoldGeometry
)
{
// You can customize the position of the FloatingActionButton here
return
Offset
(
scaffoldGeometry
.
scaffoldSize
.
width
-
15.0
.
w
-
45
.
w
,
scaffoldGeometry
.
scaffoldSize
.
height
-
118
.
w
-
49
.
w
);
}
@override
String
toString
()
=>
'MyFloatingActionButtonLocation'
;
}
// class NoAnimationFabAnimator extends FloatingActionButtonAnimator {
// // 通过构造函数参数提供动画
// const NoAnimationFabAnimator();
//
// @override
// Animation<double> getRotationAnimation({required Animation<double> parent}) {
// return AlwaysStoppedAnimation<double>(0);
// }
//
// @override
// Animation<double> getScaleAnimation({required Animation<double> parent}) {
// return AlwaysStoppedAnimation<double>(1);
// }
//
// @override
// Offset getOffset({required Offset begin, required Offset end, required double progress}) {
// return begin;
// }
// }
lib/pages/web/widgets/input_discuss.dart
0 → 100644
浏览文件 @
1eeefed9
part of
web
;
class
ReadInputDiscuss
extends
StatefulWidget
{
final
ReadController
controller
;
const
ReadInputDiscuss
({
Key
?
key
,
required
this
.
controller
,
})
:
super
(
key:
key
);
@override
State
<
ReadInputDiscuss
>
createState
()
=>
_ReadInputDiscussState
();
}
class
_ReadInputDiscussState
extends
State
<
ReadInputDiscuss
>
{
@override
Widget
build
(
BuildContext
context
)
{
return
Container
(
margin:
EdgeInsets
.
symmetric
(
horizontal:
15
.
w
),
child:
Column
(
children:
[
Container
(
margin:
EdgeInsets
.
symmetric
(
vertical:
10
.
w
),
child:
Row
(
children:
[
Text
(
'话题'
,
style:
TextStyle
(
fontSize:
14
.
w
,
color:
Colours
.
c3
,
height:
1.5
,
fontWeight:
Fonts
.
medium
),),
Gaps
.
hGaps5
,
Expanded
(
child:
ClipRRect
(
borderRadius:
BorderRadius
.
circular
(
4
),
child:
TextField
(
focusNode:
widget
.
controller
.
discussTitleFocusNode
,
autofocus:
true
,
decoration:
InputDecoration
(
border:
InputBorder
.
none
,
enabledBorder:
InputBorder
.
none
,
focusedBorder:
InputBorder
.
none
,
hintText:
'请输入话题名称'
,
hintStyle:
TextStyle
(
fontSize:
12
.
w
,
height:
1.5
,
color:
Colours
.
c9
,),
filled:
true
,
fillColor:
Colours
.
cF8
,
),
),
),
),
],
),
),
ClipRRect
(
borderRadius:
BorderRadius
.
circular
(
4
.
w
),
child:
Container
(
color:
Colours
.
cF8
,
constraints:
BoxConstraints
(
minHeight:
100
.
w
),
child:
Column
(
children:
[
TextField
(
focusNode:
widget
.
controller
.
discussContentFocusNode
,
maxLines:
null
,
decoration:
InputDecoration
(
border:
InputBorder
.
none
,
enabledBorder:
InputBorder
.
none
,
focusedBorder:
InputBorder
.
none
,
hintText:
'请输入内容'
,
hintStyle:
TextStyle
(
fontSize:
12
.
w
,
height:
1.5
,
color:
Colours
.
c9
,),
filled:
true
,
fillColor:
Colours
.
cF8
,
),
),
Column
(
children:
[
MediaQuery
.
removePadding
(
context:
context
,
removeTop:
true
,
child:
GridView
.
builder
(
// padding: const EdgeInsets.only(left: 13,top: 10),
physics:
const
NeverScrollableScrollPhysics
(),
shrinkWrap:
true
,
gridDelegate:
SliverGridDelegateWithFixedCrossAxisCount
(
crossAxisCount:
6
,
crossAxisSpacing:
2
.
w
,
mainAxisSpacing:
2
.
w
,
childAspectRatio:
1
),
itemBuilder:
(
BuildContext
context
,
int
index
)
{
return
Container
(
color:
Colors
.
red
,
child:
Center
(
child:
Text
(
'图片'
)),
);
},
itemCount:
0
,
),
),
Container
(
color:
Colors
.
red
,
child:
MediaQuery
.
removePadding
(
context:
context
,
removeTop:
true
,
child:
ListView
.
builder
(
physics:
const
NeverScrollableScrollPhysics
(),
shrinkWrap:
true
,
itemBuilder:
(
BuildContext
context
,
int
index
){
return
Container
(
height:
20
.
w
,
margin:
EdgeInsets
.
only
(
right:
130
.
w
),
child:
Container
(
margin:
EdgeInsets
.
only
(
top:
5
.
w
),
padding:
EdgeInsets
.
only
(
right:
20
.
w
,
left:
10
.
w
),
decoration:
BoxDecoration
(
borderRadius:
BorderRadius
.
circular
(
10
.
w
),
color:
Colours
.
cF9
,
),
child:
Row
(
// mainAxisSize: MainAxisSize.min,
mainAxisAlignment:
MainAxisAlignment
.
spaceBetween
,
children:
[
Image
.
asset
(
'assets/images/audio.png'
),
Text
(
'0:00/1:52'
,
style:
TextStyle
(
fontSize:
10
.
w
,
height:
1.4
,
color:
Colours
.
c9
),)
],
),
),
);
},
itemCount:
0
,
),
),
)
],
)
],
),
),
),
Row
(
mainAxisAlignment:
MainAxisAlignment
.
spaceBetween
,
crossAxisAlignment:
CrossAxisAlignment
.
center
,
children:
[
Row
(
children:
[
Image
.
asset
(
'assets/images/read_add_img.png'
),
Gaps
.
hGaps10
,
Image
.
asset
(
'assets/images/read_add_audio.png'
),
],
),
GestureDetector
(
onTap:
(){},
child:
Container
(
decoration:
BoxDecoration
(
borderRadius:
BorderRadius
.
circular
(
15
.
w
),
color:
AppTheme
.
primary
,
gradient:
LinearGradient
(
colors:
[
const
Color
(
0xFFD53676
).
withOpacity
(
0.9
),
AppTheme
.
primary
]
,
// 不可点击时的颜色,透明度为0.7
begin:
Alignment
.
topCenter
,
end:
Alignment
.
bottomCenter
,
),
),
padding:
EdgeInsets
.
symmetric
(
horizontal:
13.5
.
w
,
vertical:
4
.
w
),
child:
Text
(
'发表'
,
style:
TextStyle
(
fontSize:
14
.
w
,
fontWeight:
Fonts
.
medium
,
color:
Colors
.
white
),),
),
)
],
)
],
)
);
}
}
lib/services/http.dart
浏览文件 @
1eeefed9
...
...
@@ -201,10 +201,11 @@ class _RequestInterceptor extends Interceptor {
final
response
=
err
.
response
;
final
statusCode
=
response
?.
statusCode
;
print
(
'*************
${response?.data}
'
);
print
(
'******statusCode*******
$statusCode
'
);
// Console.log(response?.data);
var
msg
=
'服务器错误'
;
switch
(
statusCode
)
{
case
40
1
:
case
40
3
:
msg
=
'
$statusCode
- Unauthorized'
;
final
newToken
=
await
refreshToken
();
if
(
newToken
!=
null
)
{
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论