import 'package:eitc_erm_app/utils/Constants.dart';
import 'package:flutter/material.dart';
import 'package:flutter_html/flutter_html.dart';

import 'bean/notice_manage_list.dart';

void main() {
  WidgetsFlutterBinding.ensureInitialized();
  runApp(NoticeDetail("", 0));
}

NoticeManageList mNoticeManageList = new NoticeManageList();
int mWhich = 0;

class NoticeDetail extends StatefulWidget {
  NoticeDetail(noticeManageList, which) {
    mNoticeManageList = noticeManageList;
    mWhich = which;
  }

  @override
  State<StatefulWidget> createState() => NoticeDetailState();
}

class NoticeDetailState extends State<NoticeDetail> {
  @override
  void initState() {
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('公告详情',
            style: TextStyle(
              color: Colors.white,
            )),
        centerTitle: true,
        elevation: 0.5,
        backgroundColor: Global.StatusBarColor,
        leading: IconButton(
          tooltip: '返回上一页',
          icon: const Icon(
            Icons.arrow_back_ios,
            color: Colors.white,
          ),
          onPressed: () {
            Navigator.of(context).pop();
            //_nextPage(-1);
          },
        ),
      ),
      body: Padding(
        padding: const EdgeInsets.all(10),
        child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
          Text(
            mNoticeManageList.data![mWhich].noticeTitle ?? "",
            style: Theme.of(context).textTheme.titleLarge,
          ),
          Align(
            alignment: Alignment.centerRight,
            child: Text(
              mNoticeManageList.data![mWhich].noticeStartTime ?? "",
              style: Theme.of(context)
                  .textTheme
                  .bodySmall
                  ?.copyWith(color: Colors.grey),
            ),
          ),
          const SizedBox(
            height: 5,
          ),
          Html(
            data: mNoticeManageList.data![mWhich].noticeContent,
          ),
        ]),
      ),
    );
  }
}
