Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
ethan
/
appframe
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit 8c723823
authored
2026-03-11 10:54:36 +0800
by
tanghuan
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
link_cubit 增加状态判断
1 parent
b9526f1e
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
0 deletions
lib/bloc/link_cubit.dart
lib/bloc/link_cubit.dart
View file @
8c72382
...
@@ -70,8 +70,11 @@ class LinkCubit extends Cubit<LinkState> {
...
@@ -70,8 +70,11 @@ class LinkCubit extends Cubit<LinkState> {
final
pageTitle
=
await
_controller
.
runJavaScriptReturningResult
(
'document.title'
)
as
String
?;
final
pageTitle
=
await
_controller
.
runJavaScriptReturningResult
(
'document.title'
)
as
String
?;
// 移除可能存在的引号
// 移除可能存在的引号
final
cleanTitle
=
pageTitle
?.
replaceAll
(
'"'
,
''
);
final
cleanTitle
=
pageTitle
?.
replaceAll
(
'"'
,
''
);
// 检查 Cubit 是否已关闭,避免调用 emit 时抛出异常
if
(!
isClosed
)
{
emit
(
state
.
copyWith
(
title:
cleanTitle
??
''
));
emit
(
state
.
copyWith
(
title:
cleanTitle
??
''
));
}
}
}
_finishLoading
();
_finishLoading
();
},
},
...
@@ -100,8 +103,11 @@ class LinkCubit extends Cubit<LinkState> {
...
@@ -100,8 +103,11 @@ class LinkCubit extends Cubit<LinkState> {
}
}
void
_finishLoading
()
{
void
_finishLoading
()
{
// 检查 Cubit 是否已关闭,避免调用 emit 时抛出异常
if
(!
isClosed
)
{
emit
(
state
.
copyWith
(
loaded:
true
));
emit
(
state
.
copyWith
(
loaded:
true
));
}
}
}
// 设置屏幕方向
// 设置屏幕方向
void
_setOrientation
(
int
screenType
)
{
void
_setOrientation
(
int
screenType
)
{
...
...
Write
Preview
Styling with
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment