import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

import '../../../components/commonFun.dart';
import '../../../widget/JdButton.dart';

class MyAbout extends StatefulWidget {
  MyAbout({Key key, this.ver, this.date}) : super(key: key);
  String ver = '1.0.0';
  String date = '';

  _LoginPageState createState() => _LoginPageState();
}

class _LoginPageState extends State<MyAbout> {
  var _username = new TextEditingController();

  void initState() {
    // TODO: implement initState
    super.initState();
  }

  //监听登录页面销毁的事件
  dispose() {
    super.dispose();
  }

  doLogin() async {
    //临时跳转
    //Navigator.pushNamed(context, '/tabs', arguments: g_iIndex);
    Navigator.pop(context); //返回
    return;
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: PreferredSize(
        preferredSize: Size.fromHeight(ScreenUtil().setHeight(173)), // 设置appBar高度
        // 设置appBar高度
        child: AppBar(
          automaticallyImplyLeading: false,
          centerTitle: true,
          titleSpacing: 0.0,
          //设置title的左边距
          flexibleSpace: Container(
            //SizedBox(height: ScreenUtil().statusBarHeight), //显示顶部状态栏
            // SizedBox(height: ScreenUtil().setHeight(10)), //显示顶部状态栏
            padding: EdgeInsets.only(top: ScreenUtil().statusBarHeight), //留出顶部状态栏高度
            child: Container(
              //height: ScreenUtil().setHeight(173),
              decoration: BoxDecoration(
                gradient: LinearGradient(
                  begin: Alignment.centerLeft,
                  end: Alignment.centerRight,
                  colors: [
                    Color.fromRGBO(12, 186, 156, 1),
                    Color.fromRGBO(39, 127, 235, 1),
                  ],
                ),
              ),
              // decoration: BoxDecoration(
              //   gradient: LinearGradient(colors: [
              //     Color(0xFF0018EB),
              //     Color(0xFF01C1D9),
              //   ], begin: Alignment.bottomCenter, end: Alignment.topCenter),
              // ),
            ),
          ),
          title: Padding(
            padding: EdgeInsets.only(left: 0, right: 0),
            child: Row(
              mainAxisAlignment: MainAxisAlignment.start,
              children: [
                getIconAndTextButton(
                  iconColor: Colors.white,
                  iconData: Icons.chevron_left_outlined,
                  onPress: () {
                    Navigator.pop(context);
                  },
                ),
                Expanded(
                  child: Text("关于",
                      style: TextStyle(color: Colors.white, fontSize: 20),
                      textAlign: TextAlign.center,
                      overflow: TextOverflow.ellipsis),
                ),
                SizedBox(width: 50),
              ],
            ),
          ),
        ),
      ),
      body: Container(
        padding: EdgeInsets.only(top: 20, bottom: 20, left: 5, right: 5),
        child: ListView(
          children: <Widget>[
            Center(
              child: Container(
                margin: EdgeInsets.only(top: 30),
                height: ScreenUtil().setWidth(160),
                width: ScreenUtil().setWidth(160),
                //child: Image.asset('assets/images/user.png', fit: BoxFit.cover),
                child: Image.asset('assets/images/ybsthbj.png', fit: BoxFit.fitHeight),
                // child: Image.network(
                //     'https://www.itying.com/images/flutter/list5.jpg',
                //     fit: BoxFit.cover),
              ),
            ),
            Center(
              child: Column(
                mainAxisAlignment: MainAxisAlignment.center,
                children: <Widget>[
                  SizedBox(height: 60),
                  // Text('宜宾市翠屏黑烟车电子抓拍系统', style: TextStyle(fontSize: 20)),
                  Text(qx_name_long + '黑烟车电子抓拍系统', style: TextStyle(fontSize: 20)),
                  Text('v${widget.ver}（${widget.date}）', style: TextStyle(fontSize: 20)),
                  SizedBox(height: 60),
                  // Text('© 宜宾市翠屏生态环境局  版权所有',
                  Text(copyright_info,
                      maxLines: 2, style: TextStyle(fontSize: 16), textAlign: TextAlign.center),
                ],
                // Text('© 宜宾市翠屏生态环境局  四川省踏石科技  版权所有\n服务热线：187-8467-8300',
              ),
            ),
            SizedBox(height: 100),
            Container(
              padding: EdgeInsets.only(top: 20, bottom: 20, left: 20, right: 20),
              child: JdButton(
                height: 126,
                text: "确认",
                color: Colors.blueAccent,
                onTop: doLogin,
              ),
            ),
          ],
        ),
      ),
    );
  }
}
