|
- import 'package:flutter/cupertino.dart';
- import 'package:flutter/material.dart';
- import 'package:provider/provider.dart';
- import 'package:zhiying_base_widget/pages/main_page/main_page_notifier.dart';
-
- class HomeGoods extends StatefulWidget {
- HomeGoods({Key key}) : super(key: key);
-
- @override
- _HomeGoodsState createState() => _HomeGoodsState();
- }
-
- class _HomeGoodsState extends State<HomeGoods> {
- @override
- void initState() {
- super.initState();
- }
-
- @override
- void didChangeDependencies() {
- super.didChangeDependencies();
- print('didChangeDependencies');
- bool isNeedLoadMore = Provider.of<MainPageNotifier>(context).scrollEnd;
- if (isNeedLoadMore) {
- print('HomeGoods loadmore...');
- }
- }
-
- @override
- Widget build(BuildContext context) {
- return Container(
- width: double.infinity,
- child: ListView.builder(
- shrinkWrap: true,
- physics: NeverScrollableScrollPhysics(),
- itemCount: 20,
- itemBuilder: (context, index) {
- return Container(
- width: double.infinity,
- height: 70,
- color: Colors.primaries[index % Colors.primaries.length],
- child: Text(
- Provider.of<MainPageNotifier>(context).scrollEnd.toString()),
- );
- }),
- );
- }
- }
|