input_text_page.dart 2.0 KB

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