Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/flutter/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Flutter _在布局过程中,RenderInkFeatures对象的大小为无限大_Flutter_Dart - Fatal编程技术网

Flutter _在布局过程中,RenderInkFeatures对象的大小为无限大

Flutter _在布局过程中,RenderInkFeatures对象的大小为无限大,flutter,dart,Flutter,Dart,我是个新手,不知道是哪个问题。正如我所回顾的,错误在于小部件构建中的像循环一样工作,同时调用方法并创建无限方法 LoginPage.dart import 'dart:convert'; import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; import 'package:http/http.dart' as http; import 'package:shared_preference

我是个新手,不知道是哪个问题。正如我所回顾的,错误在于
小部件构建
中的
像循环一样工作,同时调用方法并创建无限方法

LoginPage.dart

import 'dart:convert';

import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:http/http.dart' as http;
import 'package:shared_preferences/shared_preferences.dart';

import 'main_page.dart';

class LoginPage extends StatefulWidget {
  @override
  _LoginPageState createState() => _LoginPageState();
}

class _LoginPageState extends State<LoginPage> {
  bool _isLoading = false;

  @override
  Widget build(BuildContext context) {
    return Container(
      decoration: BoxDecoration (
        gradient: LinearGradient (
          colors: [
            Colors.blue,
            Colors.teal
          ],
          begin: Alignment.topCenter,
          end: Alignment.bottomCenter
        )
      ),
      child: _isLoading ? Center(child: CircularProgressIndicator()) : ListView (
        children: <Widget>[
          headerSection(),
          textSection(),
          buttonSection(),
        ],
      ),
    );
  }

  signIn(String email, String password) async {
    Map data = {
      'email': email,
      'password': password
    };

    var jsonData = null;
    SharedPreferences sharedPreferences = await SharedPreferences.getInstance();
    var response = await http.post("", body: data);

    if(response.statusCode == 200) {
      _isLoading = false;
      jsonData = jsonDecode(response.body);

      setState(() {
        sharedPreferences.setString("token", jsonData['token']);
        Navigator.of(context).pushAndRemoveUntil(MaterialPageRoute(builder: (BuildContext context) => MainPage()), (Route<dynamic> route)  => false);
      });
    } else {
      print(response.body);
    }
  }

  Container buttonSection() {
    return Container(
      width: MediaQuery.of(context).size.width,
      height: 40.0 ,
      margin: EdgeInsets.only(top: 30.0),
      padding: EdgeInsets.symmetric(horizontal: 20.0),
      child: RaisedButton(
        onPressed: () {
            setState(() {
              _isLoading = true;
            });
            signIn(emailController.text, passwordController.text);
          },
          color: Colors.purple,
          shape: RoundedRectangleBorder(
            borderRadius: BorderRadius.circular(5.0),
          ),
          child: Text("Sign In", style: TextStyle(color: Colors.white70))
      ),
    );
  }

  final TextEditingController emailController = new TextEditingController();
  final TextEditingController passwordController = new TextEditingController();

  Container textSection() {
    return Container(
      padding: EdgeInsets.symmetric(horizontal: 15.0, vertical: 20.0),
      child: new Scaffold(
        body: new Column(
          children: <Widget>[
            TextFormField(
              controller: emailController,
              cursorColor: Colors.white,

              style: TextStyle(color: Colors.white70),
              decoration: InputDecoration(
                icon: Icon(Icons.email, color: Colors.white70),
                hintText: "Email",
                border: UnderlineInputBorder(borderSide: BorderSide(color: Colors.white70)),
                hintStyle: TextStyle(color: Colors.white70),
              ),
            ),
            SizedBox(height: 30.0),
            TextFormField(
              controller: passwordController,
              cursorColor: Colors.white,

              obscureText: true,
              style: TextStyle(color: Colors.white70),
              decoration: InputDecoration(
                icon: Icon(Icons.lock, color: Colors.white70),
                hintText: "Password",
                border: UnderlineInputBorder(borderSide: BorderSide(color: Colors.white70)),
                hintStyle: TextStyle(color: Colors.white70),
              ),
            ),
          ]
        ),
      ),
    );
  }


  Container headerSection() {
    return Container(
      padding: EdgeInsets.symmetric(horizontal: 20.0, vertical: 30.0),
      child: Text("Bob lox", style: TextStyle(color: Colors.white)),

    );
  }
}
导入'dart:convert';
进口“包装:颤振/材料.省道”;
导入“package:flatter/rendering.dart”;
将“package:http/http.dart”导入为http;
导入“package:shared_preferences/shared_preferences.dart”;
导入“main_page.dart”;
类LoginPage扩展StatefulWidget{
@凌驾
_LoginPagentate createState()=>_LoginPagentate();
}
类_loginpagentate扩展状态{
bool_isLoading=false;
@凌驾
小部件构建(构建上下文){
返回容器(
装饰:盒子装饰(
梯度:线性梯度(
颜色:[
颜色,蓝色,
蓝绿色
],
开始:Alignment.topCenter,
结束:对齐。底部中心
)
),
子项:_isLoading?中心(子项:CircularProgressIndicator()):ListView(
儿童:[
headerSection(),
textSection(),
buttonSection(),
],
),
);
}
登录(字符串电子邮件、字符串密码)异步{
地图数据={
“电子邮件”:电子邮件,
“密码”:密码
};
var jsonData=null;
SharedReferences SharedReferences=等待SharedReferences.getInstance();
var response=wait http.post(“,body:data);
如果(response.statusCode==200){
_isLoading=false;
jsonData=jsonDecode(response.body);
设置状态(){
setString(“token”,jsonData['token']);
Navigator.of(context).pushandremoveintil(MaterialPageRoute(builder:(BuildContext context)=>MainPage(),(Route-Route)=>false);
});
}否则{
打印(响应.正文);
}
}
容器按钮部分(){
返回容器(
宽度:MediaQuery.of(context).size.width,
身高:40.0,
边距:仅限边缘集(顶部:30.0),
填充:边缘组。对称(水平:20.0),
孩子:升起按钮(
已按下:(){
设置状态(){
_isLoading=true;
});
登录(emailController.text、passwordController.text);
},
颜色:颜色,紫色,
形状:圆形矩形边框(
边界半径:边界半径。圆形(5.0),
),
子项:文本(“登录”,样式:TextStyle(颜色:Colors.white70))
),
);
}
final TextEditingController emailController=新TextEditingController();
final TextEditingController密码控制器=新TextEditingController();
容器文本节(){
返回容器(
填充:边缘组。对称(水平:15.0,垂直:20.0),
儿童:新脚手架(
正文:新栏目(
儿童:[
TextFormField(
控制器:emailController,
光标颜色:颜色。白色,
样式:TextStyle(颜色:Colors.white70),
装饰:输入装饰(
图标:图标(Icons.email,颜色:Colors.white70),
hintText:“电子邮件”,
边框:下划线输入边框(borderSide:borderSide(颜色:Colors.white70)),
hintStyle:TextStyle(颜色:Colors.white70),
),
),
尺寸箱(高度:30.0),
TextFormField(
控制器:密码控制器,
光标颜色:颜色。白色,
蒙昧文字:对,
样式:TextStyle(颜色:Colors.white70),
装饰:输入装饰(
图标:图标(Icons.lock,color:Colors.white70),
hintText:“密码”,
边框:下划线输入边框(borderSide:borderSide(颜色:Colors.white70)),
hintStyle:TextStyle(颜色:Colors.white70),
),
),
]
),
),
);
}
货柜头组(){
返回容器(
填充:边缘组。对称(水平:20.0,垂直:30.0),
子:文本(“Bob lox”,style:TextStyle(颜色:Colors.white)),
);
}
}
错误

════════ Exception caught by rendering library ═════════════════════════════════════════════════════
The following assertion was thrown during performLayout():
RenderCustomMultiChildLayoutBox object was given an infinite size during layout.

This probably means that it is a render object that tries to be as big as possible, but it was put inside another render object that allows its children to pick their own size.
The nearest ancestor providing an unbounded height constraint is: RenderIndexedSemantics#7c292 relayoutBoundary=up3 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
...  parentData: index=1; layoutOffset=None (can use size)
...  constraints: BoxConstraints(w=320.0, 0.0<=h<=Infinity)
...  semantic boundary
...  size: MISSING
...  index: 1
The constraints that applied to the RenderCustomMultiChildLayoutBox were: BoxConstraints(w=290.0, 0.0<=h<=Infinity)
The exact size it was given was: Size(290.0, Infinity)

See https://flutter.dev/docs/development/ui/layout/box-constraints for more information.

The relevant error-causing widget was: 
  Scaffold file:///home/damir/AndroidStudioProjects/flutter_app/lib/login_page.dart:92:18
When the exception was thrown, this was the stack: 
#0      RenderBox.debugAssertDoesMeetConstraints.<anonymous closure> (package:flutter/src/rendering/box.dart:2060:9)
#1      RenderBox.debugAssertDoesMeetConstraints (package:flutter/src/rendering/box.dart:2128:6)
#2      RenderBox.size=.<anonymous closure> (package:flutter/src/rendering/box.dart:1846:7)
#3      RenderBox.size= (package:flutter/src/rendering/box.dart:1848:6)
#4      RenderCustomMultiChildLayoutBox.performLayout (package:flutter/src/rendering/custom_layout.dart:401:5)
...
The following RenderObject was being processed when the exception was fired: RenderCustomMultiChildLayoutBox#b7fbf relayoutBoundary=up8 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
...  parentData: <none> (can use size)
...  constraints: BoxConstraints(w=290.0, 0.0<=h<=Infinity)
...  size: Size(290.0, Infinity)
RenderObject: RenderCustomMultiChildLayoutBox#b7fbf relayoutBoundary=up8 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
  parentData: <none> (can use size)
  constraints: BoxConstraints(w=290.0, 0.0<=h<=Infinity)
  size: Size(290.0, Infinity)
...  child 1: RenderFlex#a75fd NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
...    parentData: offset=Offset(0.0, 0.0); id=_ScaffoldSlot.body
...    constraints: MISSING
...    size: MISSING
...    direction: vertical
...    mainAxisAlignment: start
...    mainAxisSize: max
...    crossAxisAlignment: center
...    verticalDirection: down
...    child 1: RenderMouseRegion#dcc07 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
...      parentData: offset=Offset(0.0, 0.0); flex=null; fit=null
...      constraints: MISSING
...      size: MISSING
...      listeners: enter, exit
...      cursor: SystemMouseCursor(text)
...      child: RenderIgnorePointer#7c564 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
...        parentData: <none>
...        constraints: MISSING
...        size: MISSING
...        ignoring: false
...        ignoringSemantics: implicitly false
...        child: RenderSemanticsAnnotations#b3580 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
...          parentData: <none>
...          constraints: MISSING
...          size: MISSING
...    child 2: RenderConstrainedBox#5d9df NEEDS-LAYOUT NEEDS-PAINT
...      parentData: offset=Offset(0.0, 0.0); flex=null; fit=null
...      constraints: MISSING
...      size: MISSING
...      additionalConstraints: BoxConstraints(0.0<=w<=Infinity, h=30.0)
...    child 3: RenderMouseRegion#e2532 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
...      parentData: offset=Offset(0.0, 0.0); flex=null; fit=null
...      constraints: MISSING
...      size: MISSING
...      listeners: enter, exit
...      cursor: SystemMouseCursor(text)
...      child: RenderIgnorePointer#a517c NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
...        parentData: <none>
...        constraints: MISSING
...        size: MISSING
...        ignoring: false
...        ignoringSemantics: implicitly false
...        child: RenderSemanticsAnnotations#bb152 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
...          parentData: <none>
...          constraints: MISSING
...          size: MISSING
...  child 2: RenderStack#dc014 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
...    parentData: offset=Offset(0.0, 0.0); id=_ScaffoldSlot.floatingActionButton
...    constraints: MISSING
...    size: MISSING
...    alignment: centerRight
...    textDirection: ltr
...    fit: loose
...    child 1: RenderTransform#36528 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
...      parentData: not positioned; offset=Offset(0.0, 0.0)
...      constraints: MISSING
...      size: MISSING
...      transform matrix: [0] 0.0,0.0,0.0,0.0
[1] 0.0,0.0,0.0,0.0
[2] 0.0,0.0,1.0,0.0
[3] 0.0,0.0,0.0,1.0
...      origin: null
...      alignment: center
...      textDirection: ltr
...      transformHitTests: true
...      child: RenderTransform#2661a NEEDS-LAYOUT NEEDS-PAINT
...        parentData: <none>
...        constraints: MISSING
...        size: MISSING
...        transform matrix: [0] 0.7,0.7,0.0,0.0
[1] -0.7,0.7,0.0,0.0
[2] 0.0,0.0,1.0,0.0
[3] 0.0,0.0,0.0,1.0
...        origin: null
...        alignment: center
...        textDirection: ltr
...        transformHitTests: true
════════════════════════════════════════════════════════════════════════════════════════════════════

════════ Exception caught by rendering library ═════════════════════════════════════════════════════
_RenderInkFeatures object was given an infinite size during layout.
The relevant error-causing widget was: 
  Scaffold file:///home/damir/AndroidStudioProjects/flutter_app/lib/login_page.dart:92:18
════════════════════════════════════════════════════════════════════════════════════════════════════

════════ Exception caught by rendering library ═════════════════════════════════════════════════════
RenderPhysicalModel object was given an infinite size during layout.
The relevant error-causing widget was: 
  Scaffold file:///home/damir/AndroidStudioProjects/flutter_app/lib/login_page.dart:92:18
════════════════════════════════════════════════════════════════════════════════════════════════════

════════ Exception caught by rendering library ═════════════════════════════════════════════════════
RenderPadding object was given an infinite size during layout.
The relevant error-causing widget was: 
  Container file:///home/damir/AndroidStudioProjects/flutter_app/lib/login_page.dart:90:12
════════════════════════════════════════════════════════════════════════════════════════════════════

════════ Exception caught by rendering library ═════════════════════════════════════════════════════
RenderRepaintBoundary object was given an infinite size during layout.
The relevant error-causing widget was: 
  ListView file:///home/damir/AndroidStudioProjects/flutter_app/lib/login_page.dart:31:72
════════════════════════════════════════════════════════════════════════════════════════════════════

════════ Exception caught by rendering library ═════════════════════════════════════════════════════
RenderIndexedSemantics object was given an infinite size during layout.
The relevant error-causing widget was: 
  ListView file:///home/damir/AndroidStudioProjects/flutter_app/lib/login_page.dart:31:72
════════════════════════════════════════════════════════════════════════════════════════════════════

════════ Exception caught by rendering library ═════════════════════════════════════════════════════
The following assertion was thrown during performLayout():
RenderCustomMultiChildLayoutBox object was given an infinite size during layout.

This probably means that it is a render object that tries to be as big as possible, but it was put inside another render object that allows its children to pick their own size.
The nearest ancestor providing an unbounded height constraint is: RenderIndexedSemantics#7c292 relayoutBoundary=up3 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
...  needs compositing
...  parentData: index=1; layoutOffset=116.0 (can use size)
...  constraints: BoxConstraints(w=320.0, 0.0<=h<=Infinity)
...  semantic boundary
...  size: Size(320.0, Infinity)
...  index: 1
The constraints that applied to the RenderCustomMultiChildLayoutBox were: BoxConstraints(w=290.0, 0.0<=h<=Infinity)
The exact size it was given was: Size(290.0, Infinity)

See https://flutter.dev/docs/development/ui/layout/box-constraints for more information.

The relevant error-causing widget was: 
  Scaffold file:///home/damir/AndroidStudioProjects/flutter_app/lib/login_page.dart:92:18
When the exception was thrown, this was the stack: 
#0      RenderBox.debugAssertDoesMeetConstraints.<anonymous closure> (package:flutter/src/rendering/box.dart:2060:9)
#1      RenderBox.debugAssertDoesMeetConstraints (package:flutter/src/rendering/box.dart:2128:6)
#2      RenderBox.size=.<anonymous closure> (package:flutter/src/rendering/box.dart:1846:7)
#3      RenderBox.size= (package:flutter/src/rendering/box.dart:1848:6)
#4      RenderCustomMultiChildLayoutBox.performLayout (package:flutter/src/rendering/custom_layout.dart:401:5)
...
The following RenderObject was being processed when the exception was fired: RenderCustomMultiChildLayoutBox#b7fbf relayoutBoundary=up8 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
...  needs compositing
...  parentData: <none> (can use size)
...  constraints: BoxConstraints(w=290.0, 0.0<=h<=Infinity)
...  size: Size(290.0, Infinity)
RenderObject: RenderCustomMultiChildLayoutBox#b7fbf relayoutBoundary=up8 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
  needs compositing
  parentData: <none> (can use size)
  constraints: BoxConstraints(w=290.0, 0.0<=h<=Infinity)
  size: Size(290.0, Infinity)
...  child 1: RenderFlex#a75fd NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
...    needs compositing
...    parentData: offset=Offset(0.0, 0.0); id=_ScaffoldSlot.body
...    constraints: MISSING
...    size: MISSING
...    direction: vertical
...    mainAxisAlignment: start
...    mainAxisSize: max
...    crossAxisAlignment: center
...    verticalDirection: down
...    child 1: RenderMouseRegion#dcc07 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
...      needs compositing
...      parentData: offset=Offset(0.0, 0.0); flex=null; fit=null
...      constraints: MISSING
...      size: MISSING
...      listeners: enter, exit
...      cursor: SystemMouseCursor(text)
...      child: RenderIgnorePointer#7c564 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
...        needs compositing
...        parentData: <none>
...        constraints: MISSING
...        size: MISSING
...        ignoring: false
...        ignoringSemantics: implicitly false
...        child: RenderSemanticsAnnotations#b3580 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
...          needs compositing
...          parentData: <none>
...          constraints: MISSING
...          size: MISSING
...    child 2: RenderConstrainedBox#5d9df NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
...      parentData: offset=Offset(0.0, 0.0); flex=null; fit=null
...      constraints: MISSING
...      size: MISSING
...      additionalConstraints: BoxConstraints(0.0<=w<=Infinity, h=30.0)
...    child 3: RenderMouseRegion#e2532 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
...      needs compositing
...      parentData: offset=Offset(0.0, 0.0); flex=null; fit=null
...      constraints: MISSING
...      size: MISSING
...      listeners: enter, exit
...      cursor: SystemMouseCursor(text)
...      child: RenderIgnorePointer#a517c NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
...        needs compositing
...        parentData: <none>
...        constraints: MISSING
...        size: MISSING
...        ignoring: false
...        ignoringSemantics: implicitly false
...        child: RenderSemanticsAnnotations#bb152 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
...          needs compositing
...          parentData: <none>
...          constraints: MISSING
...          size: MISSING
...  child 2: RenderStack#dc014 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
...    parentData: offset=Offset(0.0, 0.0); id=_ScaffoldSlot.floatingActionButton
...    constraints: MISSING
...    size: MISSING
...    alignment: centerRight
...    textDirection: ltr
...    fit: loose
...    child 1: RenderTransform#36528 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
...      parentData: not positioned; offset=Offset(0.0, 0.0)
...      constraints: MISSING
...      size: MISSING
...      transform matrix: [0] 0.0,0.0,0.0,0.0
[1] 0.0,0.0,0.0,0.0
[2] 0.0,0.0,1.0,0.0
[3] 0.0,0.0,0.0,1.0
...      origin: null
...      alignment: center
...      textDirection: ltr
...      transformHitTests: true
...      child: RenderTransform#2661a NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
...        parentData: <none>
...        constraints: MISSING
...        size: MISSING
...        transform matrix: [0] 0.7,0.7,0.0,0.0
[1] -0.7,0.7,0.0,0.0
[2] 0.0,0.0,1.0,0.0
[3] 0.0,0.0,0.0,1.0
...        origin: null
...        alignment: center
...        textDirection: ltr
...        transformHitTests: true
════════════════════════════════════════════════════════════════════════════════════════════════════

════════ Exception caught by rendering library ═════════════════════════════════════════════════════
_RenderInkFeatures object was given an infinite size during layout.
The relevant error-causing widget was: 
  Scaffold file:///home/damir/AndroidStudioProjects/flutter_app/lib/login_page.dart:92:18
════════════════════════════════════════════════════════════════════════════════════════════════════

════════ Exception caught by rendering library ═════════════════════════════════════════════════════
RenderPhysicalModel object was given an infinite size during layout.
The relevant error-causing widget was: 
  Scaffold file:///home/damir/AndroidStudioProjects/flutter_app/lib/login_page.dart:92:18
════════════════════════════════════════════════════════════════════════════════════════════════════

════════ Exception caught by rendering library ═════════════════════════════════════════════════════
RenderPadding object was given an infinite size during layout.
The relevant error-causing widget was: 
  Container file:///home/damir/AndroidStudioProjects/flutter_app/lib/login_page.dart:90:12
════════════════════════════════════════════════════════════════════════════════════════════════════

════════ Exception caught by rendering library ═════════════════════════════════════════════════════
RenderRepaintBoundary object was given an infinite size during layout.
The relevant error-causing widget was: 
  ListView file:///home/damir/AndroidStudioProjects/flutter_app/lib/login_page.dart:31:72
════════════════════════════════════════════════════════════════════════════════════════════════════

════════ Exception caught by rendering library ═════════════════════════════════════════════════════
RenderIndexedSemantics object was given an infinite size during layout.
The relevant error-causing widget was: 
  ListView file:///home/damir/AndroidStudioProjects/flutter_app/lib/login_page.dart:31:72
════════════════════════════════════════════════════════════════════════════════════════════════════

════════ Exception caught by rendering library ═════════════════════════════════════════════════════
The following assertion was thrown during performLayout():
RenderCustomMultiChildLayoutBox object was given an infinite size during layout.

This probably means that it is a render object that tries to be as big as possible, but it was put inside another render object that allows its children to pick their own size.
The nearest ancestor providing an unbounded height constraint is: RenderIndexedSemantics#7c292 relayoutBoundary=up3 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
...  needs compositing
...  parentData: index=1; layoutOffset=116.0 (can use size)
...  constraints: BoxConstraints(w=320.0, 0.0<=h<=Infinity)
...  semantic boundary
...  size: Size(320.0, Infinity)
...  index: 1
The constraints that applied to the RenderCustomMultiChildLayoutBox were: BoxConstraints(w=290.0, 0.0<=h<=Infinity)
The exact size it was given was: Size(290.0, Infinity)

See https://flutter.dev/docs/development/ui/layout/box-constraints for more information.

The relevant error-causing widget was: 
  Scaffold file:///home/damir/AndroidStudioProjects/flutter_app/lib/login_page.dart:92:18
When the exception was thrown, this was the stack: 
#0      RenderBox.debugAssertDoesMeetConstraints.<anonymous closure> (package:flutter/src/rendering/box.dart:2060:9)
#1      RenderBox.debugAssertDoesMeetConstraints (package:flutter/src/rendering/box.dart:2128:6)
#2      RenderBox.size=.<anonymous closure> (package:flutter/src/rendering/box.dart:1846:7)
#3      RenderBox.size= (package:flutter/src/rendering/box.dart:1848:6)
#4      RenderCustomMultiChildLayoutBox.performLayout (package:flutter/src/rendering/custom_layout.dart:401:5)
...
The following RenderObject was being processed when the exception was fired: RenderCustomMultiChildLayoutBox#b7fbf relayoutBoundary=up8 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
...  needs compositing
...  parentData: <none> (can use size)
...  constraints: BoxConstraints(w=290.0, 0.0<=h<=Infinity)
...  size: Size(290.0, Infinity)
RenderObject: RenderCustomMultiChildLayoutBox#b7fbf relayoutBoundary=up8 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
  needs compositing
  parentData: <none> (can use size)
  constraints: BoxConstraints(w=290.0, 0.0<=h<=Infinity)
  size: Size(290.0, Infinity)
...  child 1: RenderFlex#a75fd NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
...    needs compositing
...    parentData: offset=Offset(0.0, 0.0); id=_ScaffoldSlot.body
...    constraints: MISSING
...    size: MISSING
...    direction: vertical
...    mainAxisAlignment: start
...    mainAxisSize: max
...    crossAxisAlignment: center
...    verticalDirection: down
...    child 1: RenderMouseRegion#dcc07 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
...      needs compositing
...      parentData: offset=Offset(0.0, 0.0); flex=null; fit=null
...      constraints: MISSING
...      size: MISSING
...      listeners: enter, exit
...      cursor: SystemMouseCursor(text)
...      child: RenderIgnorePointer#7c564 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
...        needs compositing
...        parentData: <none>
...        constraints: MISSING
...        size: MISSING
...        ignoring: false
...        ignoringSemantics: implicitly false
...        child: RenderSemanticsAnnotations#b3580 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
...          needs compositing
...          parentData: <none>
...          constraints: MISSING
...          size: MISSING
...    child 2: RenderConstrainedBox#5d9df NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
...      parentData: offset=Offset(0.0, 0.0); flex=null; fit=null
...      constraints: MISSING
...      size: MISSING
...      additionalConstraints: BoxConstraints(0.0<=w<=Infinity, h=30.0)
...    child 3: RenderMouseRegion#e2532 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
...      needs compositing
...      parentData: offset=Offset(0.0, 0.0); flex=null; fit=null
...      constraints: MISSING
...      size: MISSING
...      listeners: enter, exit
...      cursor: SystemMouseCursor(text)
...      child: RenderIgnorePointer#a517c NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
...        needs compositing
...        parentData: <none>
...        constraints: MISSING
...        size: MISSING
...        ignoring: false
...        ignoringSemantics: implicitly false
...        child: RenderSemanticsAnnotations#bb152 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
...          needs compositing
...          parentData: <none>
...          constraints: MISSING
...          size: MISSING
...  child 2: RenderStack#dc014 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
...    parentData: offset=Offset(0.0, 0.0); id=_ScaffoldSlot.floatingActionButton
...    constraints: MISSING
...    size: MISSING
...    alignment: centerRight
...    textDirection: ltr
...    fit: loose
...    child 1: RenderTransform#36528 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
...      parentData: not positioned; offset=Offset(0.0, 0.0)
...      constraints: MISSING
...      size: MISSING
...      transform matrix: [0] 0.0,0.0,0.0,0.0
[1] 0.0,0.0,0.0,0.0
[2] 0.0,0.0,1.0,0.0
[3] 0.0,0.0,0.0,1.0
...      origin: null
...      alignment: center
...      textDirection: ltr
...      transformHitTests: true
...      child: RenderTransform#2661a NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
...        parentData: <none>
...        constraints: MISSING
...        size: MISSING
...        transform matrix: [0] 0.7,0.7,0.0,0.0
[1] -0.7,0.7,0.0,0.0
[2] 0.0,0.0,1.0,0.0
[3] 0.0,0.0,0.0,1.0
...        origin: null
...        alignment: center
...        textDirection: ltr
...        transformHitTests: true
════════════════════════════════════════════════════════════════════════════════════════════════════

════════ Exception caught by rendering library ═════════════════════════════════════════════════════
_RenderInkFeatures object was given an infinite size during layout.
The relevant error-causing widget was: 
  Scaffold file:///home/damir/AndroidStudioProjects/flutter_app/lib/login_page.dart:92:18
════════════════════════════════════════════════════════════════════════════════════════════════════

════════ Exception caught by rendering library ═════════════════════════════════════════════════════
RenderPhysicalModel object was given an infinite size during layout.
The relevant error-causing widget was: 
  Scaffold file:///home/damir/AndroidStudioProjects/flutter_app/lib/login_page.dart:92:18
════════════════════════════════════════════════════════════════════════════════════════════════════

════════ Exception caught by rendering library ═════════════════════════════════════════════════════
RenderPadding object was given an infinite size during layout.
The relevant error-causing widget was: 
  Container file:///home/damir/AndroidStudioProjects/flutter_app/lib/login_page.dart:90:12
════════════════════════════════════════════════════════════════════════════════════════════════════

════════ Exception caught by rendering library ═════════════════════════════════════════════════════
RenderRepaintBoundary object was given an infinite size during layout.
The relevant error-causing widget was: 
  ListView file:///home/damir/AndroidStudioProjects/flutter_app/lib/login_page.dart:31:72
════════════════════════════════════════════════════════════════════════════════════════════════════

════════ Exception caught by rendering library ═════════════════════════════════════════════════════
RenderIndexedSemantics object was given an infinite size during layout.
The relevant error-causing widget was: 
  ListView file:///home/damir/AndroidStudioProjects/flutter_app/lib/login_page.dart:31:72
════════════════════════════════════════════════════════════════════════════════════════════════════
════════ 呈现库捕获到异常═════════════════════════════════════════════════════
在performLayout()期间引发了以下断言:
在布局过程中,RenderCustomMultiChildLayoutBox对象的大小为无限大。
这可能意味着它是一个试图尽可能大的渲染对象,但它被放在另一个渲染对象中,允许其子对象选择自己的大小。
提供无限高度约束的最近祖先是:RenderIndexedSemantics#7c292 relaytBoundary=up3 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
...  parentData:index=1;layoutOffset=无(可以使用大小)

... 约束:BoxConstraints(w=320.0,0.0Add shrinkWrap:在ListView中为true。错误解释了何时绘制脚手架,高度是无限的。因为脚手架需要一些最大高度才能正常工作。您在具有无限高度的ListView中使用了脚手架小部件。请移除脚手架小部件或将高度添加到其父容器中。同时收缩kWrap你的名单

试试这个:

import 'dart:convert';

import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:http/http.dart' as http;
import 'package:shared_preferences/shared_preferences.dart';

import 'main_page.dart';

class LoginPage extends StatefulWidget {
  @override
  _LoginPageState createState() => _LoginPageState();
}

class _LoginPageState extends State<LoginPage> {
  bool _isLoading = false;

  @override
  Widget build(BuildContext context) {
    return Container(
      decoration: BoxDecoration(
          gradient: LinearGradient(
              colors: [Colors.blue, Colors.teal],
              begin: Alignment.topCenter,
              end: Alignment.bottomCenter)),
      child: _isLoading
          ? Center(child: CircularProgressIndicator())
          : ListView(
              shrinkWrap: true,
              children: <Widget>[
                headerSection(),
                textSection(),
                buttonSection(),
              ],
            ),
    );
  }

  signIn(String email, String password) async {
    Map data = {'email': email, 'password': password};

    var jsonData = null;
    SharedPreferences sharedPreferences = await SharedPreferences.getInstance();
    var response = await http.post("", body: data);

    if (response.statusCode == 200) {
      _isLoading = false;
      jsonData = jsonDecode(response.body);

      setState(() {
        sharedPreferences.setString("token", jsonData['token']);
        Navigator.of(context).pushAndRemoveUntil(
            MaterialPageRoute(builder: (BuildContext context) => MainPage()),
            (Route<dynamic> route) => false);
      });
    } else {
      print(response.body);
    }
  }

  Container buttonSection() {
    return Container(
      width: MediaQuery.of(context).size.width,
      height: 40.0,
      margin: EdgeInsets.only(top: 30.0),
      padding: EdgeInsets.symmetric(horizontal: 20.0),
      child: RaisedButton(
          onPressed: () {
            setState(() {
              _isLoading = true;
            });
            signIn(emailController.text, passwordController.text);
          },
          color: Colors.purple,
          shape: RoundedRectangleBorder(
            borderRadius: BorderRadius.circular(5.0),
          ),
          child: Text("Sign In", style: TextStyle(color: Colors.white70))),
    );
  }

  final TextEditingController emailController = new TextEditingController();
  final TextEditingController passwordController = new TextEditingController();

  Container textSection() {
    return Container(
      padding: EdgeInsets.symmetric(horizontal: 15.0, vertical: 20.0),
      child: new Column(children: <Widget>[
        TextFormField(
          controller: emailController,
          cursorColor: Colors.white,
          style: TextStyle(color: Colors.white70),
          decoration: InputDecoration(
            icon: Icon(Icons.email, color: Colors.white70),
            hintText: "Email",
            border: UnderlineInputBorder(
                borderSide: BorderSide(color: Colors.white70)),
            hintStyle: TextStyle(color: Colors.white70),
          ),
        ),
        SizedBox(height: 30.0),
        TextFormField(
          controller: passwordController,
          cursorColor: Colors.white,
          obscureText: true,
          style: TextStyle(color: Colors.white70),
          decoration: InputDecoration(
            icon: Icon(Icons.lock, color: Colors.white70),
            hintText: "Password",
            border: UnderlineInputBorder(
                borderSide: BorderSide(color: Colors.white70)),
            hintStyle: TextStyle(color: Colors.white70),
          ),
        ),
      ]),
    );
  }

  Container headerSection() {
    return Container(
      padding: EdgeInsets.symmetric(horizontal: 20.0, vertical: 30.0),
      child: Text("Bob lox", style: TextStyle(color: Colors.white)),
    );
  }
}
导入'dart:convert';
进口“包装:颤振/材料.省道”;
导入“package:flatter/rendering.dart”;
将“package:http/http.dart”导入为http;
导入“package:shared_preferences/shared_preferences.dart”;
导入“main_page.dart”;
类LoginPage扩展StatefulWidget{
@凌驾
_LoginPagentate createState()=>_LoginPagentate();
}
类_loginpagentate扩展状态{
bool_isLoading=false;
@凌驾
小部件构建(构建上下文){
返回容器(
装饰:盒子装饰