Advertisement
Guest User

Untitled

a guest
Jun 15th, 2019
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.72 KB | None | 0 0
  1. String txt = "";
  2. TextEditingController controllerTxt = new TextEditingController();
  3.  
  4. @override
  5. Widget build(BuildContext context) {
  6. return new Scaffold(
  7. appBar: new AppBar(
  8. title: Text('Create'),
  9. actions: <Widget>[
  10. FlatButton(
  11. child: Text('Submit'),
  12. textColor: Colors.white,
  13. onPressed: () {
  14. Navigator.pushNamed(context, '/ResultPage',
  15. arguments: (controllerTxt.text));
  16. },
  17. ),
  18. ],
  19. ),
  20. body: new ListView(
  21. children: <Widget>[
  22. new Container(
  23. child: new Column(
  24. children: <Widget>[
  25. new TextField(
  26. controller: controllerTxt,
  27. maxLines: 25,
  28. ),
  29. ],
  30. ),
  31. ),
  32. ],
  33. ),
  34. );
  35. }
  36.  
  37. class _ResultPageState extends State<ResultPage> {
  38. String result;
  39.  
  40. @override
  41. Widget build(BuildContext context) {
  42. RouteSettings settings = ModalRoute.of(context).settings;
  43. result = settings.arguments;
  44.  
  45. return new Scaffold(
  46. appBar: new AppBar(
  47. title: Text('Create'),
  48. actions: <Widget>[
  49. ],
  50. ),
  51. body: new Container(
  52. padding: EdgeInsets.all(10.0),
  53. child: new Row(
  54. children: <Widget>[
  55. new Text('Name : '),
  56. Expanded(
  57. child: new TextField(
  58. enabled: false,
  59. decoration: new InputDecoration(
  60. border: new OutlineInputBorder(
  61. borderSide: new BorderSide(color: Colors.black)),
  62. labelText: ('${result}'),
  63. ),
  64. )),
  65. ],
  66. ),
  67. ),
  68. );
  69. }
  70. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement