opt: unnecessary_non_null_assertion (#1762)

This commit is contained in:
My-Responsitories
2025-12-03 17:35:42 +08:00
committed by GitHub
parent b7a277a57c
commit 2b3ec77e92
89 changed files with 249 additions and 247 deletions

View File

@@ -179,43 +179,44 @@ class _LivePageState extends CommonPageState<LivePage, LiveController>
),
Success(:var response) => SliverMainAxisGroup(
slivers: [
if (controller.newTags?.isNotEmpty == true)
SliverToBoxAdapter(
child: SelfSizedHorizontalList(
gapSize: 12,
padding: const EdgeInsets.only(bottom: 8),
childBuilder: (index) {
late final item = controller.newTags![index];
return Obx(
() {
final isCurr = index == controller.tagIndex.value;
return SearchText(
fontSize: 13,
padding: const EdgeInsets.symmetric(
horizontal: 8,
vertical: 3,
),
text: '${item.name}',
bgColor: isCurr
? theme.colorScheme.secondaryContainer
: Colors.transparent,
textColor: isCurr
? theme.colorScheme.onSecondaryContainer
: null,
onTap: (value) {
controller.onSelectTag(
index,
item.sortType,
);
},
);
},
);
},
itemCount: controller.newTags!.length,
if (controller.newTags case final newTags?)
if (newTags.isNotEmpty)
SliverToBoxAdapter(
child: SelfSizedHorizontalList(
gapSize: 12,
padding: const EdgeInsets.only(bottom: 8),
childBuilder: (index) {
late final item = newTags[index];
return Obx(
() {
final isCurr = index == controller.tagIndex.value;
return SearchText(
fontSize: 13,
padding: const EdgeInsets.symmetric(
horizontal: 8,
vertical: 3,
),
text: '${item.name}',
bgColor: isCurr
? theme.colorScheme.secondaryContainer
: Colors.transparent,
textColor: isCurr
? theme.colorScheme.onSecondaryContainer
: null,
onTap: (value) {
controller.onSelectTag(
index,
item.sortType,
);
},
);
},
);
},
itemCount: newTags.length,
),
),
),
response?.isNotEmpty == true
response != null && response.isNotEmpty == true
? SliverGrid.builder(
gridDelegate: gridDelegate,
itemBuilder: (context, index) {
@@ -230,7 +231,7 @@ class _LivePageState extends CommonPageState<LivePage, LiveController>
}
return LiveCardVApp(item: item);
},
itemCount: response!.length,
itemCount: response.length,
)
: HttpError(onReload: controller.onReload),
],