Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
B
book-app
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
EzijingWeb
book-app
Commits
65efd517
提交
65efd517
authored
1月 31, 2024
作者:
yueweilu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
拍照获取图片
上级
f1469b77
显示空白字符变更
内嵌
并排
正在显示
12 个修改的文件
包含
61 行增加
和
16 行删除
+61
-16
book_placeholder.png
assets/images/2.0x/book_placeholder.png
+0
-0
book_placeholder.png
assets/images/3.0x/book_placeholder.png
+0
-0
book_placeholder.png
assets/images/book_placeholder.png
+0
-0
view.dart
lib/pages/course/view.dart
+12
-1
banner.dart
lib/pages/course/widgets/banner.dart
+10
-7
view.dart
lib/pages/library/view.dart
+4
-3
cell.dart
lib/pages/library/widgets/cell.dart
+1
-1
view.dart
lib/pages/user_info/view.dart
+0
-3
access.dart
lib/utils/access.dart
+6
-0
assets_picker.dart
lib/utils/assets_picker.dart
+24
-0
book.dart
lib/widgets/book.dart
+1
-1
dialog.dart
lib/widgets/dialog.dart
+3
-0
没有找到文件。
assets/images/2.0x/book_placeholder.png
0 → 100644
浏览文件 @
65efd517
2.5 KB
assets/images/3.0x/book_placeholder.png
0 → 100644
浏览文件 @
65efd517
5.0 KB
assets/images/book_placeholder.png
0 → 100644
浏览文件 @
65efd517
1.1 KB
lib/pages/course/view.dart
浏览文件 @
65efd517
...
@@ -32,7 +32,18 @@ class _CoursePageState extends State<CoursePage> {
...
@@ -32,7 +32,18 @@ class _CoursePageState extends State<CoursePage> {
icon:
Image
.
asset
(
icon:
Image
.
asset
(
'assets/images/read_history.png'
,
'assets/images/read_history.png'
,
),
),
onPressed:
()
=>
context
.
pushNamed
(
Routes
.
studyHistory
),
onPressed:
()
async
{
// context.pushNamed(Routes.studyHistory);
final
canPrint
=
await
CustomDialog
.
show
<
bool
>(
context:
context
,
builder:
(
context
)
=>
const
Text
(
'是否开始打印?'
),
cancel:
const
Text
(
'取消'
),
confirm:
const
Text
(
'打印'
),
onCancel:
Navigator
.
of
(
context
).
pop
,
onConfirm:
()
=>
Navigator
.
of
(
context
).
pop
(
true
),
);
print
(
'------------canPrint-----------------------
$canPrint
'
);
},
),
),
GestureDetector
(
GestureDetector
(
onTap:
()
async
{
onTap:
()
async
{
...
...
lib/pages/course/widgets/banner.dart
浏览文件 @
65efd517
...
@@ -30,16 +30,19 @@ class BuildBanner extends StatelessWidget {
...
@@ -30,16 +30,19 @@ class BuildBanner extends StatelessWidget {
width:
double
.
infinity
,
width:
double
.
infinity
,
decoration:
BoxDecoration
(
decoration:
BoxDecoration
(
borderRadius:
BorderRadius
.
circular
(
8
.
w
),
borderRadius:
BorderRadius
.
circular
(
8
.
w
),
color:
Color
.
fromRGBO
(
//
color: Color.fromRGBO(
random
.
nextInt
(
256
),
// Red
//
random.nextInt(256), // Red
random
.
nextInt
(
256
),
// Green
//
random.nextInt(256), // Green
random
.
nextInt
(
256
),
// Blue
//
random.nextInt(256), // Blue
1.0
,
// Alpha (opacity)
//
1.0, // Alpha (opacity)
),
//
),
),
),
child:
Image
.
network
(
item
.
pic
??
''
),
child:
ClipRRect
(
borderRadius:
BorderRadius
.
circular
(
8
.
w
),
child:
Image
.
network
(
item
.
pic
??
''
,)
),
// child: CustomImage.asset(
// child: CustomImage.asset(
// url: 'assets/images/banner.png',
// url: 'assets/images/banner.png',
// width: 130.w,
// width: 130.w,
...
...
lib/pages/library/view.dart
浏览文件 @
65efd517
...
@@ -76,14 +76,15 @@ class _LibraryPageState extends State<LibraryPage> {
...
@@ -76,14 +76,15 @@ class _LibraryPageState extends State<LibraryPage> {
child:
Expanded
(
child:
Expanded
(
child:
CustomPullScrollView
(
child:
CustomPullScrollView
(
controller:
controller
.
refreshController
,
controller:
controller
.
refreshController
,
//
onRefresh: controller.onRefresh,
onRefresh:
controller
.
onRefresh
,
onLoading:
controller
.
onLoading
,
onLoading:
controller
.
onLoading
,
child:
SingleChildScrollView
(
child:
SingleChildScrollView
(
child:
Column
(
child:
Column
(
mainAxisSize:
MainAxisSize
.
max
,
mainAxisSize:
MainAxisSize
.
max
,
children:
[
children:
[
controller
.
ads
.
isNotEmpty
?
Container
(
controller
.
ads
.
isNotEmpty
?
Container
(
color:
Colors
.
cyan
,
color:
Colors
.
transparent
,
padding:
EdgeInsets
.
symmetric
(
horizontal:
10
.
w
),
child:
BuildBanner
(
items:
controller
.
ads
)
child:
BuildBanner
(
items:
controller
.
ads
)
):
const
SizedBox
(),
):
const
SizedBox
(),
...
@@ -136,7 +137,7 @@ class _LibraryPageState extends State<LibraryPage> {
...
@@ -136,7 +137,7 @@ class _LibraryPageState extends State<LibraryPage> {
Widget
_buildCategory
(){
Widget
_buildCategory
(){
return
Container
(
return
Container
(
height:
38
,
height:
38
.
w
,
child:
GetBuilder
<
LibraryController
>(
child:
GetBuilder
<
LibraryController
>(
init:
LibraryController
(),
init:
LibraryController
(),
builder:
(
controller
)
=>
ListView
.
builder
(
builder:
(
controller
)
=>
ListView
.
builder
(
...
...
lib/pages/library/widgets/cell.dart
浏览文件 @
65efd517
...
@@ -39,7 +39,7 @@ class LibraryCell extends StatelessWidget {
...
@@ -39,7 +39,7 @@ class LibraryCell extends StatelessWidget {
Container
(
Container
(
width:
100
.
w
,
width:
100
.
w
,
height:
120
.
w
,
height:
120
.
w
,
color:
Colors
.
red
,
color:
Colors
.
white
,
),
),
/// 右侧
/// 右侧
Expanded
(
Expanded
(
...
...
lib/pages/user_info/view.dart
浏览文件 @
65efd517
...
@@ -49,9 +49,6 @@ class _UserInfoPageState extends State<UserInfoPage> {
...
@@ -49,9 +49,6 @@ class _UserInfoPageState extends State<UserInfoPage> {
onTap:
()
async
{
onTap:
()
async
{
final
assets
=
await
AssetsPicker
.
image
(
final
assets
=
await
AssetsPicker
.
image
(
context:
context
,
context:
context
,
source
:
ImageSource
.
gallery
,
maxWidth:
512
.
w
,
maxHeight:
512
.
w
,
);
);
controller
.
upload
(
path:
assets
!.
path
);
controller
.
upload
(
path:
assets
!.
path
);
},
},
...
...
lib/utils/access.dart
浏览文件 @
65efd517
...
@@ -16,6 +16,12 @@ abstract class Access {
...
@@ -16,6 +16,12 @@ abstract class Access {
return
false
;
return
false
;
}
}
/// 相机权限
static
Future
<
bool
>
camera
()
async
{
final
result
=
await
[
Permission
.
camera
].
request
();
return
result
[
Permission
.
camera
]
==
PermissionStatus
.
granted
;
}
/// 打开设置
/// 打开设置
static
Future
<
void
>
setting
()
async
=>
await
openAppSettings
();
static
Future
<
void
>
setting
()
async
=>
await
openAppSettings
();
...
...
lib/utils/assets_picker.dart
浏览文件 @
65efd517
...
@@ -3,6 +3,7 @@ part of utils;
...
@@ -3,6 +3,7 @@ part of utils;
abstract
class
AssetsPicker
{
abstract
class
AssetsPicker
{
static
final
ImagePicker
_imagePicker
=
ImagePicker
();
static
final
ImagePicker
_imagePicker
=
ImagePicker
();
/// 获取图库
static
Future
<
XFile
?>
image
({
static
Future
<
XFile
?>
image
({
required
BuildContext
context
,
required
BuildContext
context
,
ImageSource
source
=
ImageSource
.
gallery
,
ImageSource
source
=
ImageSource
.
gallery
,
...
@@ -24,4 +25,27 @@ abstract class AssetsPicker {
...
@@ -24,4 +25,27 @@ abstract class AssetsPicker {
maxHeight:
maxHeight
,
maxHeight:
maxHeight
,
);
);
}
}
/// 拍照
static
Future
<
XFile
?>
camera
({
required
BuildContext
context
,
ImageSource
source
=
ImageSource
.
camera
,
double
maxWidth
=
512
,
double
maxHeight
=
512
,
})
async
{
if
(!(
await
Access
.
photos
()))
{
if
(
context
.
mounted
)
{
CustomDialog
.
showAccess
(
context:
context
,
content:
const
Text
(
'Requires access to your photo gallery'
),
);
}
return
null
;
}
return
_imagePicker
.
pickImage
(
source
:
source
,
maxWidth:
maxWidth
,
maxHeight:
maxHeight
,
);
}
}
}
lib/widgets/book.dart
浏览文件 @
65efd517
...
@@ -34,7 +34,7 @@ class CustomCard extends StatelessWidget {
...
@@ -34,7 +34,7 @@ class CustomCard extends StatelessWidget {
width:
width
,
width:
width
,
child:
Container
(
child:
Container
(
padding:
const
EdgeInsets
.
all
(
1
),
padding:
const
EdgeInsets
.
all
(
1
),
child:
CustomImage
.
network
(
url:
url
),
child:
CustomImage
.
network
(
url:
url
,
placeholder:
Image
.
asset
(
'assets/images/book_placeholder.png'
),
),
),
),
);
);
}
}
...
...
lib/widgets/dialog.dart
浏览文件 @
65efd517
...
@@ -82,6 +82,9 @@ class CustomDialog extends StatelessWidget {
...
@@ -82,6 +82,9 @@ class CustomDialog extends StatelessWidget {
));
));
}
}
return
Dialog
(
return
Dialog
(
shape:
RoundedRectangleBorder
(
borderRadius:
BorderRadius
.
circular
(
5
.
w
),
// 调整这里的数值以设置圆角大小
),
child:
Column
(
child:
Column
(
mainAxisSize:
MainAxisSize
.
min
,
mainAxisSize:
MainAxisSize
.
min
,
crossAxisAlignment:
CrossAxisAlignment
.
stretch
,
crossAxisAlignment:
CrossAxisAlignment
.
stretch
,
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论