效果
实现代码
import 'dart:convert';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutterwncq/models/article_data_bean.dart';
import 'package:flutterwncq/utils/net_utils.dart';
class CQInformationPage extends StatefulWidget {
@override
_CQInformationPageState createState() => _CQInformationPageState();
}
class _CQInformationPageState extends State<CQInformationPage> {
var _hasMore = true;
int curPage = 1;
List<ListData> _newsList;
ScrollController _scrollController;
@override
void initState() {
super.initState();
_scrollController = ScrollController()
..addListener(() {
判断是否滑到底
if (_scrollController.position.pixels ==
_scrollController.position.maxScrollExtent &&
_hasMore) {
curPage++;
_articlePage();
}
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(
'传奇咨讯',
style: TextStyle(color: Color(0xffbbbbbb), fontSize: 16.0),
),
centerTitle: true,
backgroundColor: Color(0xff161616),
leading: new IconButton(
icon: new Container(
padding: EdgeInsets.all(3.0),
child: new CircleAvatar(
radius: 15.0,
backgroundColor: Color(0xff161616),
backgroundImage:
AssetImage("assets/images/nav_icon_return.png")),
),
onPressed: () {