phase3: nullable fields/methods, casts, ?.call, pinput/YoutubePlayer v5, buttonColor, dead-code removal. 72->16

This commit is contained in:
2026-08-01 01:21:37 +08:00
parent 137eca4c69
commit 7c69197396
39 changed files with 107 additions and 113 deletions

View File

@@ -28,7 +28,7 @@ class MobileBlog extends StatefulWidget {
}
class MobileBlogState extends State<MobileBlog> {
late List<Blog> blogs;
List<Blog>? blogs;
int _page = 1;
int _pageCount = 1;
@@ -41,7 +41,7 @@ class MobileBlogState extends State<MobileBlog> {
void _onRefresh() {
_page = 1;
if (blogs != null) {
blogs.clear();
blogs!.clear();
} else {
blogs = [];
}
@@ -82,7 +82,7 @@ class MobileBlogState extends State<MobileBlog> {
enablePullUp: true,
header: WaterDropHeader(),
footer: CustomFooter(
builder: (BuildContext context, LoadStatus mode){
builder: (BuildContext context, LoadStatus? mode){
Widget footer;
if(mode == LoadStatus.idle) {
footer = Text(S.of(context).pull_up_to_load_more);
@@ -123,9 +123,9 @@ class MobileBlogState extends State<MobileBlog> {
return SizedBox.shrink();
}
return ListView.builder(
itemCount: blogs.length <= 1 ? 1 : blogs.length,
itemCount: blogs!.length <= 1 ? 1 : blogs!.length,
itemBuilder: (BuildContext context, int i) {
if (blogs.length <= 0) {
if (blogs!.length <= 0) {
return Container(
padding: EdgeInsets.all(16.0),
child: Center(
@@ -133,7 +133,7 @@ class MobileBlogState extends State<MobileBlog> {
),
);
} else {
Blog blog = blogs[i];
Blog blog = blogs![i];
Widget w = Container(
padding: EdgeInsets.symmetric(vertical: 20.0, horizontal: 16.0),
@@ -243,7 +243,7 @@ class MobileBlogState extends State<MobileBlog> {
if (blogs == null) {
blogs = [];
}
blogs.addAll((value['blogs'] as List).map((e) => Blog.fromJson(e)).toList());
blogs!.addAll((value['blogs'] as List).map((e) => Blog.fromJson(e)).toList());
});
}
}).catchError((error) {