@@ -125,24 +125,26 @@ class _BsdBmfWidgetState extends State<BsdBmfWidget>
125
125
/// 标题检测
126
126
Future <void > titleCheck () async {
127
127
if (bmf.title != null && bmf.title! .isNotEmpty) return ;
128
- var confirm = await showConfirm (
129
- context,
130
- title: '尝试获取标题?' ,
131
- content: '检测到标题为空' ,
132
- );
133
- if (! confirm) return ;
128
+ if (bmf.id != - 1 ) {
129
+ var confirm = await showConfirm (
130
+ context,
131
+ title: '尝试获取标题?' ,
132
+ content: '检测到标题为空' ,
133
+ );
134
+ if (! confirm) return ;
135
+ }
134
136
var title = await getTitle ();
135
137
if (title != null ) bmf.title = title;
136
138
setState (() {});
137
139
await sqliteBmf.write (bmf);
138
- if (mounted) {
140
+ if (mounted && bmf.id != - 1 ) {
139
141
await BtInfobar .success (context, '[${bmf .subject }]已设置标题:${bmf .title }' );
140
142
}
141
143
}
142
144
143
145
/// 更新标题
144
146
Future <void > updateTitle () async {
145
- var hasTitle = bmf.title != null && bmf.rss ! .isNotEmpty;
147
+ var hasTitle = bmf.title != null && bmf.title ! .isNotEmpty;
146
148
var title = bmf.title;
147
149
if (! hasTitle) title = await getTitle ();
148
150
title ?? = "" ;
@@ -157,6 +159,12 @@ class _BsdBmfWidgetState extends State<BsdBmfWidget>
157
159
setState (() {
158
160
bmf.title = title;
159
161
});
162
+ await sqliteBmf.write (bmf);
163
+ var read = await sqliteBmf.read (bmf.subject);
164
+ if (read != null ) {
165
+ bmf = read;
166
+ setState (() {});
167
+ }
160
168
if (mounted) {
161
169
await BtInfobar .success (
162
170
context,
@@ -221,7 +229,7 @@ class _BsdBmfWidgetState extends State<BsdBmfWidget>
221
229
222
230
/// buildHeaderActTitle
223
231
Widget buildHeaderActTitle (BuildContext context) {
224
- var hasTitle = bmf.title != null && bmf.rss ! .isNotEmpty;
232
+ var hasTitle = bmf.title != null && bmf.title ! .isNotEmpty;
225
233
return Tooltip (
226
234
message: hasTitle ? '修改标题' : '设置标题' ,
227
235
child: IconButton (
@@ -281,8 +289,10 @@ class _BsdBmfWidgetState extends State<BsdBmfWidget>
281
289
Widget buildHeaderAction (BuildContext context) {
282
290
return Row (
283
291
children: [
284
- buildHeaderActTitle (context),
285
- SizedBox (width: 12. w),
292
+ if (bmf.id != - 1 ) ...[
293
+ buildHeaderActTitle (context),
294
+ SizedBox (width: 12. w)
295
+ ],
286
296
buildHeaderActRss (context),
287
297
SizedBox (width: 12. w),
288
298
buildHeaderActFile (context),
@@ -314,16 +324,13 @@ class _BsdBmfWidgetState extends State<BsdBmfWidget>
314
324
trailing: buildHeaderAction (context),
315
325
);
316
326
}
327
+ var title = '${bmf .title ?? '' }(${bmf .subject })' ;
328
+ if (! widget.isConfig) title = 'BMF Config - $title ' ;
317
329
return Padding (
318
330
padding: EdgeInsets .only (right: 12. w),
319
331
child: Expander (
320
332
leading: BsdBmfLeading (widget.isConfig, bmf),
321
- header: widget.isConfig
322
- ? Text (
323
- '${bmf .title ?? '' }(${bmf .subject })' ,
324
- style: TextStyle (fontSize: 24. sp),
325
- )
326
- : Text ('BMF Config' , style: TextStyle (fontSize: 24. sp)),
333
+ header: Text (title, style: TextStyle (fontSize: 24. sp)),
327
334
content: Column (
328
335
crossAxisAlignment: CrossAxisAlignment .start,
329
336
mainAxisAlignment: MainAxisAlignment .start,
0 commit comments