import 'package:farmer_client/pages/infomation/widgets/Information/index.dart';
import 'package:farmer_client/widgets/layout/BasicPage.dart';
import 'package:flutter/material.dart';

import '../../models/entities/NewsInformationModel.dart';
import '../../services/news.dart';

class Infomation extends BasicPage {
  Infomation({Key? key}) : super(key: key) {
    tabIndex = 2;
    naviTitle = '资讯';
  }
  List<NewsInformationModel> newsListItem = [];


@override
  void beforeShow() {
    // TODO: implement beforeShow
    super.beforeShow();
  getNewsList().then((value) {
     value['records'].forEach((item) {
       newsListItem.add(NewsInformationModel.fromJson(item));
      });
  });

}

  @override
  Widget builder(BuildContext context) {


    return  Column(
      mainAxisSize: MainAxisSize.min,
      children: newsListItem.map((item) => Information(item: item)).toList(),
    );
  }
}