import 'package:base_app/res/index.dart';
import 'package:flutter/material.dart';

/// 开始巡检的弹窗Widget
class inputDialogWidget extends StatefulWidget {
  inputDialogWidget({
    Key key,
  }) : super(key: key);

  @override
  _inputDialogWidgetState createState() => _inputDialogWidgetState();
}

class _inputDialogWidgetState extends State<inputDialogWidget> {
  TextEditingController _decController = TextEditingController();
  @override
  Widget build(BuildContext context) {
    return GestureDetector(
      onTap: () {
        // 点击其他区域关闭
        FocusScope.of(context).requestFocus(FocusNode());
      },
      child: Container(
        color: Colors.transparent,
        width: double.infinity,
        height: double.infinity,
        child: Container(
            padding: EdgeInsets.symmetric(
                horizontal: 20.0,
                vertical: (MediaQuery.of(context).size.height - 250) / 2),
            child: Stack(
              children: <Widget>[
                Positioned(
                  child: Container(
                    decoration: BoxDecoration(
                        color: Colors.white,
                        borderRadius: BorderRadius.all(Radius.circular(5))),
                    child: Column(
                      children: <Widget>[
                        Gaps.vGap15,
                        // 标题
                        Container(
                          alignment: Alignment.centerLeft,
                          padding: EdgeInsets.symmetric(horizontal: 20),
                          child: Text(
                            '巡检标签',
                            style: TextStyle(
                                fontSize: 14,
                                color: Color(0XFF333333),
                                fontWeight: FontWeight.bold,
                                decoration: TextDecoration.none),
                          ),
                        ),
                        Gaps.vGap10,
                        //输入框
                        Container(
                            padding: EdgeInsets.symmetric(horizontal: 20),
                            child: Container(
                                decoration: BoxDecoration(
                                    border: Border.all(
                                        color: Color(0xFFEEEEEE), width: 0.5),
                                    borderRadius:
                                        BorderRadius.all(Radius.circular(4.0))),
                                child: TextField(
                                    maxLines: 3,
                                    maxLength: 100,
                                    textInputAction: TextInputAction.done,
                                    controller: _decController,
                                    decoration: InputDecoration(
                                      contentPadding: const EdgeInsets.all(10),
                                      hintText: '如：XXXX区间巡检',
                                      border: OutlineInputBorder(
                                          borderSide: BorderSide.none),
                                      hintStyle:
                                          TextStyle(color: Colours.gray_cc),
                                    )))),
                        // 按钮
                        Container(
                          padding: EdgeInsets.all(20),
                          child: GestureDetector(
                            onTap: () {
                              Navigator.pop(context);
                            },
                            child: Container(
                              width: double.infinity,
                              height: 35.0,
                              alignment: Alignment.center,
                              decoration: BoxDecoration(
                                color: Color(0XFF2B95E9),
                                borderRadius:
                                    BorderRadius.all(Radius.circular(4.0)),
                              ),
                              child: Text(
                                '开始巡检',
                                style: TextStyle(
                                    color: Colors.white, fontSize: 14.0),
                              ),
                            ),
                          ),
                        ),
                      ],
                    ),
                  ),
                )
              ],
            )),
      ),
    );
  }
}
