final
This commit is contained in:
@@ -18,7 +18,7 @@ import '../../widgets/mobile/MobileBottomNav.dart';
|
||||
|
||||
class MobileBlog extends StatefulWidget {
|
||||
final int businessId;
|
||||
const MobileBlog({Key key, this.businessId}) : super(key: key);
|
||||
const MobileBlog({Key? key, required this.businessId}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<StatefulWidget> createState() {
|
||||
@@ -28,7 +28,7 @@ class MobileBlog extends StatefulWidget {
|
||||
}
|
||||
|
||||
class MobileBlogState extends State<MobileBlog> {
|
||||
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) {
|
||||
|
||||
Reference in New Issue
Block a user