flutter bottom overflowed by 50 PIXELS

    image.png

    1. Widget build(BuildContext context) {
    2. super.build(context);
    3. return Scaffold(
    4. backgroundColor: Colors.white,
    5. appBar: createAppbarWithBack(context, '私钥导入'),
    6. body: Column(
    7. crossAxisAlignment: CrossAxisAlignment.start,
    8. children: [
    9. Container(
    10. margin: EdgeInsets.only(left: 16, right: 16, top: 16),
    11. padding: const EdgeInsets.all(5.0),
    12. height: 100,
    13. decoration: BoxDecoration(

    解决办法:

    1. Widget build(BuildContext context) {
    2. super.build(context);
    3. return Scaffold(
    4. backgroundColor: Colors.white,
    5. appBar: createAppbarWithBack(context, '私钥导入'),
    6. //使用ScrollView包装一下,否则键盘弹出时会报错空间溢出
    7. body: new SingleChildScrollView(
    8. child: new ConstrainedBox(
    9. constraints: new BoxConstraints(
    10. minHeight: 120.0,
    11. ),
    12. child: new Column(
    13. mainAxisSize: MainAxisSize.min,
    14. crossAxisAlignment: CrossAxisAlignment.start,
    15. mainAxisAlignment: MainAxisAlignment.spaceAround,
    16. children: <Widget>[
    17. Container(
    18. margin: EdgeInsets.only(left: 16, right: 16, top: 16),
    19. padding: const EdgeInsets.all(5.0),
    20. height: 80,
    21. decoration: BoxDecoration(
    22. color: Color(0xfff5f5f5),
    23. borderRadius: BorderRadius.circular(6),
    24. border: Border.all(width: 1, color: Colors.grey)),
    25. child: TextField(
    26. textAlign: TextAlign.start,
    27. maxLines: 10,
    28. style: TextStyle(fontSize: 14, color: Colors.black),
    29. decoration: InputDecoration(
    30. contentPadding:
    31. EdgeInsets.symmetric(horizontal: 10, vertical: 8),
    32. hintText: '输入明文私钥或扫描二维码,请注意大小写',
    33. hintStyle: TextStyle(fontSize: 14, color: Colors.grey),
    34. border: InputBorder.none),
    35. controller: privateKeyController,
    36. ),
    37. ),
    38. createLabel('钱包名称'),
    39. createTextFieldWithPadding('请输入钱包名称', walletNameController),
    40. createLabel('钱包密码'),
    41. createTextFieldWithPadding('请输入密码,至少8位', passwordController),
    42. createTextFieldWithPadding('重复密码', ensurePasswordController),
    43. createLabel('提示信息'),
    44. createTextFieldWithPadding('密码提示信息(可不填)', remainInfoController),
    45. Padding(
    46. padding: EdgeInsets.symmetric(horizontal: 16),
    47. child: Column(
    48. crossAxisAlignment: CrossAxisAlignment.start,
    49. children: [
    50. Row(
    51. children: [
    52. GestureDetector(
    53. onTap: () {
    54. setState(() {
    55. selectedCheckbox = !selectedCheckbox;
    56. });
    57. },
    58. child: Padding(
    59. padding: const EdgeInsets.only(
    60. left: 0, right: 8, top: 8, bottom: 8),
    61. child: Image.asset(
    62. selectedCheckbox
    63. ? R.assetsImagesIcSelectNoPng
    64. : R.assetsImagesIcSelectYesPng,
    65. height: 16,
    66. width: 16,
    67. ),
    68. )),
    69. Text(
    70. '我熟知以下事项:',
    71. style: TextStyle(fontSize: 14, color: Colors.black),
    72. ),
    73. ],
    74. ),
    75. Row(
    76. children: [
    77. Text(' -我已仔细阅读并同意',
    78. style:
    79. TextStyle(fontSize: 12, color: Colors.black)),
    80. Text('服务及隐私条款',
    81. style: TextStyle(
    82. fontSize: 12, color: Colors.lightBlue)),
    83. ],
    84. ),
    85. Text(' -密码用于保护私钥和交易授权,强度非常重要',
    86. style: TextStyle(fontSize: 12, color: Colors.black)),
    87. Text(' -我们不会存储密码,也无法帮你找回,请务必牢记',
    88. style: TextStyle(fontSize: 12, color: Colors.black))
    89. ],
    90. ),
    91. ),
    92. SizedBox(height: 20),
    93. Container(
    94. margin: EdgeInsets.symmetric(horizontal: 16),
    95. child: createButton('导入钱包', () {
    96. importWallet();
    97. }),
    98. ),
    99. ],
    100. )),
    101. ),
    102. // body: Column(
    103. // crossAxisAlignment: CrossAxisAlignment.start,
    104. // ),
    105. );
    106. }

    参考地址
    https://my.oschina.net/u/2364451/blog/4820525

    https://www.jianshu.com/p/dbb1d66961ae