input_text_page.dart 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. import 'package:flutter/material.dart';
  2. import 'package:liftmanager/res/colors.dart';
  3. import 'package:liftmanager/routers/fluro_navigator.dart';
  4. import 'package:liftmanager/utils/theme_utils.dart';
  5. import 'package:liftmanager/widgets/app_bar.dart';
  6. /// design/7店铺-店铺配置/index.html#artboard13
  7. class InputTextPage extends StatefulWidget {
  8. InputTextPage({
  9. Key key,
  10. @required this.title,
  11. this.content,
  12. this.hintText,
  13. this.keyboardType: TextInputType.text,
  14. }) : super(key : key);
  15. final String title;
  16. final String content;
  17. final String hintText;
  18. final TextInputType keyboardType;
  19. @override
  20. _InputTextPageState createState() => _InputTextPageState();
  21. }
  22. class _InputTextPageState extends State<InputTextPage> {
  23. TextEditingController _controller = TextEditingController();
  24. @override
  25. void initState() {
  26. super.initState();
  27. _controller.text = widget.content;
  28. }
  29. @override
  30. Widget build(BuildContext context) {
  31. return Scaffold(
  32. appBar: MyAppBar(
  33. centerTitle: widget.title,
  34. actions: <Widget>[
  35. FlatButton(
  36. child: Text("完成", key: const Key('actionName')),
  37. textColor: Colours.tip_text_black,
  38. highlightColor: Colors.transparent,
  39. onPressed: (){
  40. NavigatorUtils.goBackWithParams(context, _controller.text);
  41. },
  42. )
  43. ]
  44. ),
  45. body: Container(
  46. color: ThemeUtils.getTabsBg(context),
  47. child: Padding(
  48. padding: const EdgeInsets.only(top: 21.0, left: 16.0, right: 16.0, bottom: 16.0),
  49. child: TextField(
  50. maxLength: 30,
  51. maxLines: 5,
  52. autofocus: true,
  53. controller: _controller,
  54. keyboardType: widget.keyboardType,
  55. //style: TextStyles.textDark14,
  56. decoration: InputDecoration(
  57. hintText: widget.hintText,
  58. border: InputBorder.none,
  59. //hintStyle: TextStyles.textGrayC14
  60. )
  61. ),
  62. ),
  63. ),
  64. );
  65. }
  66. }