import 'package:flutter/material.dart';
import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/message/mine_message.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:huixiang/utils/font_weight.dart';
import 'package:huixiang/view_widget/my_appbar.dart';

class MainMessagePage extends StatefulWidget {
  @override
  State<StatefulWidget> createState() {
    return _MainMessagePage();
  }
}

class _MainMessagePage extends State<MainMessagePage>
    with SingleTickerProviderStateMixin {
  var tabcontroller;

  @override
  void initState() {
    super.initState();
    if (tabcontroller == null)
      tabcontroller = TabController(length: 2, vsync: this);
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Color(0xFFFFFFFF),
      appBar: MyAppBar(
        title: S.of(context).xiaoxi,
        titleColor: Colors.black,
        titleSize: 18.sp,
        background: Color(0xFFF7F7F7),
        leadingColor: Colors.black,
        action: rightAction(),
      ),
      body: MineMessagePage(_status),
      // TabBarView(
      //   children: [
      //     RealTimeInfoPage(),
      //     MineMessagePage(_status, (status) {
      //       setState(() {
      //         _bgStatus = status;
      //       });
      //     })
      //   ],
      //   controller: tabcontroller,
      // ),
    );
  }

  var _status = 0;

  Widget rightAction() {
    return Text(
      S.of(context).biaojiweiyidu,
      style: TextStyle(
        fontSize: 16.sp,
        fontWeight: MyFontWeight.semi_bold,
        color: Color(0xFF353535),
      ),
    );

    // if (_status == 0) {
    //   return Container(
    //     margin: EdgeInsets.only(right: 17),
    //     child: GestureDetector(
    //       onTap: () {
    //         setState(() {
    //           _status = (_status + 1) % 2;
    //         });
    //       },
    //       child: Image.asset(
    //         "assets/image/icon_delete.png",
    //         width: 24,
    //         height: 24,
    //       ),
    //     ),
    //   );
    // } else {
    //   return GestureDetector(
    //     onTap: () {
    //       setState(() {
    //         _status = (_status + 1) % 2;
    //       });
    //     },
    //     child: Container(
    //       margin: EdgeInsets.only(right: 17),
    //       padding: EdgeInsets.only(top: 15, bottom: 15),
    //       alignment: Alignment.center,
    //       child: RoundButton(
    //         text: S.of(context).wancheng,
    //         textColor: _bgStatus ? Colors.white : Color(0xFFA0A0A0),
    //         backgroup: _bgStatus ? Color(0xFF32A060) : Color(0xFFD8D8D8),
    //         fontSize: 14,
    //         fontWeight: FontWeight.bold,
    //         padding: EdgeInsets.only(left: 12, right: 12, top: 2, bottom: 2),
    //         radius: 12,
    //       ),
    //     ),
    //   );
    // }
  }
}