import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_hooks/flutter_hooks.dart';
import 'package:marking_app/utils/my_text.dart';

/// 作业考试横屏批阅
class DoPapersJobExam extends StatefulHookWidget {
  final int taskId; // 任务ID
  final int jobId;
  final String taskName;
  final String className; // 班级ID
  const DoPapersJobExam(
      {required this.taskId, required this.jobId, required this.taskName, required this.className, super.key});

  @override
  State<DoPapersJobExam> createState() => _DoPapersJobExamState();
}

class _DoPapersJobExamState extends State<DoPapersJobExam> {
  bool refresh = false; // 刷新外部列表（批阅试题后就需要刷新）

  @override
  void initState() {
    super.initState();

    Future.delayed(Duration.zero, () {
      SystemChrome.setPreferredOrientations([DeviceOrientation.landscapeLeft]);
      SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual, overlays: []);
    });
  }

  @override
  void dispose() {
    SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]); // 强制竖屏
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        // titleSpacing: 0,
        leading: IconButton(icon: Icon(Icons.arrow_back_ios), onPressed: () => Navigator.of(context).pop(refresh)),
        iconTheme: IconThemeData(color: Colors.black),
        title: quickText(widget.taskName + '(${widget.className})'),
        backgroundColor: Colors.white,
        elevation: 0,
        // actions: [
        //   FavoriteWidget(),

        // ],
      ),
      body: Container(),
    );
  }
}
