基础组件库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

49 regels
1.3 KiB

  1. import 'package:flutter/cupertino.dart';
  2. import 'package:flutter/material.dart';
  3. import 'package:provider/provider.dart';
  4. import 'package:zhiying_base_widget/pages/main_page/main_page_notifier.dart';
  5. class HomeGoods extends StatefulWidget {
  6. HomeGoods({Key key}) : super(key: key);
  7. @override
  8. _HomeGoodsState createState() => _HomeGoodsState();
  9. }
  10. class _HomeGoodsState extends State<HomeGoods> {
  11. @override
  12. void initState() {
  13. super.initState();
  14. }
  15. @override
  16. void didChangeDependencies() {
  17. super.didChangeDependencies();
  18. print('didChangeDependencies');
  19. bool isNeedLoadMore = Provider.of<MainPageNotifier>(context).scrollEnd;
  20. if (isNeedLoadMore) {
  21. print('HomeGoods loadmore...');
  22. }
  23. }
  24. @override
  25. Widget build(BuildContext context) {
  26. return Container(
  27. width: double.infinity,
  28. child: ListView.builder(
  29. shrinkWrap: true,
  30. physics: NeverScrollableScrollPhysics(),
  31. itemCount: 20,
  32. itemBuilder: (context, index) {
  33. return Container(
  34. width: double.infinity,
  35. height: 70,
  36. color: Colors.primaries[index % Colors.primaries.length],
  37. child: Text(
  38. Provider.of<MainPageNotifier>(context).scrollEnd.toString()),
  39. );
  40. }),
  41. );
  42. }
  43. }