Guest User

onwillpop

a guest
Jan 24th, 2019
424
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.82 KB | None | 0 0
  1. @override
  2. Widget build(BuildContext context) {
  3. return WillPopScope(
  4. child: Container(
  5. child: Row(
  6. mainAxisAlignment: MainAxisAlignment.end,
  7. children: <Widget>[
  8. isWIllPop
  9. ? Material(
  10. child: new Container(
  11. margin: new EdgeInsets.symmetric(horizontal: 1.0),
  12. child: FadeInImage.assetNetwork(
  13. placeholder: 'animation/loading.gif',
  14. image: 'BASE_URL/pictureUrl',
  15. width: 50,
  16. height: 200,
  17. ),
  18. ),
  19. color: Colors.white,
  20. )
  21. : Material(
  22. child: new Container(
  23. margin: new EdgeInsets.symmetric(horizontal: 1.0),
  24. child: FadeInImage.assetNetwork(
  25. placeholder: 'animation/loading.gif',
  26. image: 'BASE_URL/pictureUrl',
  27. width: 50,
  28. height: 50,
  29. ),
  30. ),
  31. color: Colors.white,
  32. ),
  33. Material(
  34. child: new Container(
  35. margin: new EdgeInsets.symmetric(horizontal: 1.0),
  36. child: new IconButton(
  37. icon: new Icon(Icons.add_circle),
  38. onPressed: () {},
  39. ),
  40. ),
  41. color: Colors.white,
  42. ),
  43. // Edit text
  44. Flexible(
  45. child: Container(
  46. child: TextField(
  47. style: TextStyle(color: Colors.blue, fontSize: 15.0),
  48. decoration: InputDecoration.collapsed(
  49. hintText: 'Type your message...',
  50. hintStyle: TextStyle(color: Colors.green),
  51. ),
  52. ),
  53. ),
  54. ),
  55.  
  56. // Button send message
  57. Material(
  58. child: new Container(
  59. margin: new EdgeInsets.symmetric(horizontal: 8.0),
  60. child: new IconButton(
  61. icon: new Icon(Icons.send),
  62. onPressed: () {},
  63. color: Colors.blue,
  64. ),
  65. ),
  66. color: Colors.white,
  67. ),
  68. ],
  69. ),
  70. width: double.infinity,
  71. height: 50.0,
  72. decoration: new BoxDecoration(
  73. border: new Border(
  74. top: new BorderSide(color: Colors.green, width: 0.5)),
  75. color: Colors.white),
  76. ),
  77. onWillPop: onBackPress,
  78. );
  79. }
  80.  
  81. Future<bool> onBackPress() {
  82. setState(() {
  83. isWIllPop = true;
  84. });
  85. return Future.value(true);
  86. }
Advertisement
Add Comment
Please, Sign In to add comment