Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
B
book-app
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
EzijingWeb
book-app
Commits
714ac852
提交
714ac852
authored
1月 18, 2024
作者:
yueweilu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
1、权限请求类
2、图片权限 3、弹窗组件
上级
ab492862
显示空白字符变更
内嵌
并排
正在显示
12 个修改的文件
包含
198 行增加
和
9 行删除
+198
-9
key.properties
android/key.properties
+3
-3
controller.dart
lib/pages/ad/controller.dart
+1
-1
view.dart
lib/pages/splash/view.dart
+1
-1
index.dart
lib/pages/user_set/index.dart
+1
-0
view.dart
lib/pages/user_set/view.dart
+4
-2
view.dart
lib/pages/version/view.dart
+3
-0
routes.dart
lib/routes/routes.dart
+2
-2
access.dart
lib/utils/access.dart
+18
-0
assets_picker.dart
lib/utils/assets_picker.dart
+27
-0
index.dart
lib/utils/index.dart
+7
-0
dialog.dart
lib/widgets/dialog.dart
+129
-0
index.dart
lib/widgets/index.dart
+2
-0
没有找到文件。
android/key.properties
浏览文件 @
714ac852
...
...
@@ -4,5 +4,5 @@ keyPassword=123456
keyAlias
=
zijing
#storeFile=/Users/apple/zijiing_key.jks
storeFile
=
zijiing_key.jks
\ No newline at end of file
storeFile
=
/Users/apple/zijiing_key.jks
#
storeFile
=
zijiing_key.jks
\ No newline at end of file
lib/pages/ad/controller.dart
浏览文件 @
714ac852
...
...
@@ -21,7 +21,7 @@ class AdController extends GetxController {
}
else
{
_timer
.
cancel
();
// context.pushReplacementNamed(Routes.splash);
context
.
goNamed
(
Routes
.
log
in
);
context
.
goNamed
(
Routes
.
ma
in
);
}
});
}
...
...
lib/pages/splash/view.dart
浏览文件 @
714ac852
...
...
@@ -29,7 +29,7 @@ class _SplashPageState extends State<SplashPage> {
@override
Widget
build
(
BuildContext
context
)
{
return
Scaffold
(
extendBodyBehindAppBar:
true
,
//
extendBodyBehindAppBar: true,
appBar:
AppBar
(),
body:
const
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
stretch
,
...
...
lib/pages/user_set/index.dart
浏览文件 @
714ac852
...
...
@@ -3,6 +3,7 @@ library user_set;
import
'package:flutter/material.dart'
;
import
'package:flutter_book/theme.dart'
;
import
'package:flutter_book/utils/index.dart'
;
import
'package:flutter_book/widgets/index.dart'
;
import
'package:flutter_screenutil/flutter_screenutil.dart'
;
import
'package:go_router/go_router.dart'
;
...
...
lib/pages/user_set/view.dart
浏览文件 @
714ac852
...
...
@@ -92,10 +92,12 @@ class _UserSetPageState extends State<UserSetPage> {
onTap:
()
async
{
final
result
=
await
AccountAPI
.
logout
();
if
(
result
){
Toast
.
show
(
'退出成功'
);
// Toast.show('退出成功');
CustomToast
.
loading
();
await
UserStore
.
to
.
logout
();
CustomToast
.
dismiss
();
if
(
context
.
mounted
){
context
.
goNamed
(
Routes
.
main
);
context
.
goNamed
(
Routes
.
splash
);
}
}
},
...
...
lib/pages/version/view.dart
浏览文件 @
714ac852
...
...
@@ -37,6 +37,8 @@ class _VersionPageState extends State<VersionPage> {
),
],
),
child:
ClipRRect
(
borderRadius:
BorderRadius
.
circular
(
8
),
child:
ListView
.
builder
(
shrinkWrap:
true
,
physics:
const
NeverScrollableScrollPhysics
(),
...
...
@@ -54,6 +56,7 @@ class _VersionPageState extends State<VersionPage> {
),
),
),
),
));
}
}
lib/routes/routes.dart
浏览文件 @
714ac852
...
...
@@ -91,8 +91,8 @@ abstract class Routes {
static
final
GoRouter
config
=
GoRouter
(
// initialLocation: '/$login
',
initialLocation:
'/'
,
initialLocation:
'/
$splash
'
,
//
initialLocation: '/',
observers:
[
observer
],
// redirect: _RouteRedirect.auth,
routes:
[
...
...
lib/utils/access.dart
0 → 100644
浏览文件 @
714ac852
part of
utils
;
abstract
class
Access
{
static
Future
<
bool
>
photos
()
async
{
if
(
Platform
.
isIOS
)
{
final
result
=
await
[
Permission
.
photos
].
request
();
return
result
[
Permission
.
photos
]
==
PermissionStatus
.
granted
||
result
[
Permission
.
photos
]
==
PermissionStatus
.
limited
;
}
if
(
Platform
.
isAndroid
)
{
final
result
=
await
[
Permission
.
storage
].
request
();
return
result
[
Permission
.
storage
]
==
PermissionStatus
.
granted
;
}
return
false
;
}
static
Future
<
void
>
setting
()
async
=>
await
openAppSettings
();
}
lib/utils/assets_picker.dart
0 → 100644
浏览文件 @
714ac852
part of
utils
;
abstract
class
AssetsPicker
{
static
final
ImagePicker
_imagePicker
=
ImagePicker
();
static
Future
<
XFile
?>
image
({
required
BuildContext
context
,
ImageSource
source
=
ImageSource
.
gallery
,
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/utils/index.dart
浏览文件 @
714ac852
...
...
@@ -7,12 +7,16 @@ import 'dart:ui';
import
'package:flutter/cupertino.dart'
;
import
'package:flutter/foundation.dart'
;
import
'package:flutter/material.dart'
;
import
'package:image_picker/image_picker.dart'
;
import
'package:intl/intl.dart'
;
import
'package:logger/logger.dart'
;
import
'package:crypto/crypto.dart'
;
import
'package:convert/convert.dart'
;
import
'package:oktoast/oktoast.dart'
;
import
'package:path_provider/path_provider.dart'
;
import
'package:permission_handler/permission_handler.dart'
;
import
'../widgets/index.dart'
;
part
'constants.dart'
;
...
...
@@ -26,3 +30,5 @@ part 'styles.dart';
part
'validator.dart'
;
part
'toast_utils.dart'
;
part
'clear_cache_util.dart'
;
part
'access.dart'
;
part
'assets_picker.dart'
;
\ No newline at end of file
lib/widgets/dialog.dart
0 → 100644
浏览文件 @
714ac852
part of
widgets
;
class
CustomDialog
extends
StatelessWidget
{
final
Widget
child
;
final
Widget
?
title
;
final
Widget
?
cancel
;
final
Widget
?
confirm
;
final
void
Function
()?
onCancel
;
final
void
Function
()?
onConfirm
;
const
CustomDialog
({
Key
?
key
,
required
this
.
child
,
this
.
title
,
this
.
cancel
,
this
.
confirm
,
this
.
onCancel
,
this
.
onConfirm
,
})
:
super
(
key:
key
);
static
Future
<
T
?>
show
<
T
>({
required
BuildContext
context
,
required
WidgetBuilder
builder
,
Widget
?
title
,
Widget
?
confirm
,
Widget
?
cancel
,
void
Function
()?
onConfirm
,
void
Function
()?
onCancel
,
})
{
return
showDialog
<
T
>(
context:
context
,
barrierColor:
const
Color
(
0xFF09101D
).
withOpacity
(
0.7
),
builder:
(
context
)
=>
CustomDialog
(
title:
title
,
confirm:
confirm
,
cancel:
cancel
,
onConfirm:
onConfirm
,
onCancel:
onCancel
,
child:
builder
(
context
),
),
);
}
static
Future
<
void
>
showAccess
({
required
BuildContext
context
,
required
Widget
content
,
})
async
{
await
show
(
context:
context
,
builder:
(
context
)
=>
content
,
title:
const
Text
(
'Permission'
),
cancel:
const
Text
(
'Cancel'
),
confirm:
const
Text
(
'Setting'
),
onCancel:
()
=>
Navigator
.
of
(
context
).
pop
(),
onConfirm:
()
=>
Access
.
setting
(),
);
}
@override
Widget
build
(
BuildContext
context
)
{
final
buttonGroup
=
<
Widget
>[];
if
(
cancel
!=
null
)
{
buttonGroup
.
add
(
Expanded
(
child:
CustomButton
(
type:
CustomButtonType
.
ghost
,
shape:
CustomButtonShape
.
stadium
,
onPressed:
onCancel
,
child:
cancel
!,
),
));
}
if
(
confirm
!=
null
&&
cancel
!=
null
)
{
buttonGroup
.
add
(
SizedBox
(
width:
12
.
w
));
}
if
(
confirm
!=
null
)
{
buttonGroup
.
add
(
Expanded
(
child:
CustomButton
(
shape:
CustomButtonShape
.
stadium
,
onPressed:
onConfirm
,
child:
confirm
!,
),
));
}
return
Dialog
(
child:
Column
(
mainAxisSize:
MainAxisSize
.
min
,
crossAxisAlignment:
CrossAxisAlignment
.
stretch
,
children:
[
if
(
title
!=
null
)
Padding
(
padding:
const
EdgeInsets
.
all
(
AppTheme
.
margin
),
child:
DefaultTextStyle
.
merge
(
textAlign:
TextAlign
.
center
,
style:
DialogTheme
.
of
(
context
).
titleTextStyle
,
child:
title
!,
),
),
Flexible
(
flex:
1
,
fit:
FlexFit
.
loose
,
child:
SingleChildScrollView
(
physics:
const
ClampingScrollPhysics
(),
padding:
const
EdgeInsets
.
all
(
AppTheme
.
margin
).
copyWith
(
top:
title
!=
null
?
0
:
null
,
bottom:
buttonGroup
.
isNotEmpty
?
0
:
null
,
),
child:
DefaultTextStyle
.
merge
(
textAlign:
TextAlign
.
center
,
style:
DialogTheme
.
of
(
context
).
contentTextStyle
?.
copyWith
(
fontSize:
title
!=
null
?
18
.
w
:
null
,
),
child:
Container
(
alignment:
Alignment
.
center
,
constraints:
BoxConstraints
(
minHeight:
80
.
h
),
child:
child
,
),
),
),
),
if
(
buttonGroup
.
isNotEmpty
)
Padding
(
padding:
const
EdgeInsets
.
all
(
AppTheme
.
margin
),
child:
Row
(
children:
buttonGroup
),
),
],
),
);
}
}
lib/widgets/index.dart
浏览文件 @
714ac852
...
...
@@ -24,3 +24,4 @@ part 'input.dart';
part
'button.dart'
;
part
'pull_scroll_view.dart'
;
part
'tab_bar.dart'
;
part
'dialog.dart'
;
\ No newline at end of file
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论