
import 'package:flutter/material.dart';
import 'package:liftmanager/res/colors.dart';
import 'package:liftmanager/routers/fluro_navigator.dart';
import 'package:liftmanager/utils/theme_utils.dart';
import 'package:liftmanager/widgets/app_bar.dart';


/// design/7店铺-店铺配置/index.html#artboard13
class InputTextPage extends StatefulWidget {

  InputTextPage({
    Key key,
    @required this.title,
    this.content,
    this.hintText,
    this.keyboardType: TextInputType.text,
  }) : super(key : key);

  final String title;
  final String content;
  final String hintText;
  final TextInputType keyboardType;

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

class _InputTextPageState extends State<InputTextPage> {

  TextEditingController _controller = TextEditingController();

  @override
  void initState() {
    super.initState();
    _controller.text = widget.content;
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: MyAppBar(
        centerTitle: widget.title,
        actions: <Widget>[
          FlatButton(
            child: Text("完成", key: const Key('actionName')),
            textColor: Colours.tip_text_black,
            highlightColor: Colors.transparent,
            onPressed: (){
              NavigatorUtils.goBackWithParams(context, _controller.text);
            },
          )
        ]
      ),
      body: Container(
        color: ThemeUtils.getTabsBg(context),
        child: Padding(
          padding: const EdgeInsets.only(top: 21.0, left: 16.0, right: 16.0, bottom: 16.0),
          child: TextField(
              maxLength: 30,
              maxLines: 5,
              autofocus: true,
              controller: _controller,
              keyboardType: widget.keyboardType,
              //style: TextStyles.textDark14,
              decoration: InputDecoration(
                hintText: widget.hintText,
                border: InputBorder.none,
                //hintStyle: TextStyles.textGrayC14
              )
          ),
        ),
      ),
    );
  }
}
