首页 > 解决方案 > 如何使堆栈内的列可滚动?

问题描述

Scaffold(
      resizeToAvoidBottomInset: true,
      backgroundColor: Color(0xff1D1B20),
      body: SafeArea(
        child: Row(
          mainAxisAlignment: MainAxisAlignment.start,
          children: [
            Image.asset(
              "assets/sign_car.png",
              height: MediaQuery.of(context).size.height * 0.88,
            ),
            Column(
              mainAxisAlignment: MainAxisAlignment.start,
              crossAxisAlignment: CrossAxisAlignment.center,
              children: [
                Spacer(),
                SizedBox(
                  height: 40.0,
                ),
                Text("Welcome",
                    style: TextStyle(color: Color(0xffD8D8D8), fontSize: 25.0)),
                SizedBox(
                  height: 10.0,
                ),
                Text("Sign In",
                    style: TextStyle(
                      fontSize: 15.0,
                      color: Color(0xffD8D8D8),
                    )),
                SizedBox(
                  height: 10.0,
                ),
                ConstrainedBox(
                  constraints: BoxConstraints(
                      maxWidth: MediaQuery.of(context).size.width * 0.56),
                  child: Input(
                    text: "Name",
                    height: 45.0,
                    fonttext: 14.0,
                  ),
                ),
                ConstrainedBox(
                  constraints: BoxConstraints(
                      maxWidth: MediaQuery.of(context).size.width * 0.56),
                  child: Input(
                    text: "Email",
                    height: 45.0,
                    fonttext: 14.0,
                  ),
                ),
                ConstrainedBox(
                  constraints: BoxConstraints(
                      maxWidth: MediaQuery.of(context).size.width * 0.56),
                  child: Input(
                    text: "Password",
                    height: 45.0,
                    fonttext: 14.0,
                    toppadding: 10.0,
                    suffixIcon: Icon(
                      Icons.panorama_fish_eye_sharp,
                      color: Colors.white,
                      size: 10.0,
                    ),
                  ),
                ),
                SizedBox(
                  height: 10.0,
                ),
                Container(
                  width: MediaQuery.of(context).size.width * 0.56,
                  child: Text("Forget Password ?",
                      textAlign: TextAlign.left,
                      style: TextStyle(
                        fontSize: 13.0,
                        color: Color(0xffFFD700),
                      )),
                ),
                SizedBox(
                  height: 30.0,
                ),
                InkWell(
                  onTap: () {},
                  child: Container(
                      decoration: BoxDecoration(
                        borderRadius: BorderRadius.circular(10),
                        color: Color(0xffFFD700),
                      ),
                      width: MediaQuery.of(context).size.width * 0.56,
                      height: 45,
                      child: Center(
                        child: Text(
                          "Create Account",
                          style: TextStyle(
                            color: Colors.black,
                            fontSize: 18,
                          ),
                          textAlign: TextAlign.center,
                        ),
                      )),
                ),
                SizedBox(
                  height: 60.0,
                ),
                Container(
                  child: Text("If already have an account",
                      style: TextStyle(
                        fontSize: 14.0,
                        color: Colors.white,
                      )),
                ),
                SizedBox(
                  height: 10.0,
                ),
                InkWell(
                  onTap: () {},
                  child: Container(
                      decoration: BoxDecoration(
                        borderRadius: BorderRadius.circular(10),
                        border:
                            Border.all(width: 1.0, color: Color(0xffFFD700)),
                        color: Colors.transparent,
                      ),
                      width: MediaQuery.of(context).size.width * 0.56,
                      height: 45,
                      child: Center(
                        child: Text(
                          "Login",
                          style: TextStyle(
                            color: Color(0xffFFD700),
                            fontSize: 18,
                          ),
                          textAlign: TextAlign.center,
                        ),
                      )),
                ),
                SizedBox(
                  height: 30.0,
                ),
              ],
            ),
          ],
        ),
      ),
    );

标签: flutter

解决方案


您必须阅读SingleChildScrollView。在这里您可以找到所有需要的示例。


推荐阅读