part of study_history;

class StudyHistoryPage extends StatefulWidget {
  const StudyHistoryPage({Key? key}) : super(key: key);

  @override
  State<StudyHistoryPage> createState() => _StudyHistoryPageState();
}

class _StudyHistoryPageState extends State<StudyHistoryPage> {
  @override
  Widget build(BuildContext context) {
    return GetBuilder<HistoryController>(
      init: HistoryController(),
      builder:(controller) => Scaffold(
        appBar: AppBar(
          centerTitle: true,
          title: const Text('最近学习'),
        ),
        body: CustomPullScrollView(
          controller: controller.refreshController,
          onRefresh: controller.onRefresh,
          onLoading: controller.onLoading,
          child: ListView.builder(
            itemBuilder: (BuildContext context, int index) {
              return BuildDayItem(
                historyModel: controller.histories[index],
                onTap: (CourseModel courseModel){
                  context.pushNamed(Routes.bookDetail,queryParameters: {'book_id':courseModel.bookId.toString()});
                },
              );
            },
            itemCount: controller.histories.length,
          ),
        ),
      ),
    );
  }
}
