someone_that_needHelp
someone_that_needHelp

Reputation: 165

SingleChildScrollView push everything up (Problem)

singlechildscrollview push everything up when i implement it, is there anything i can do to disable the bu or is there any other easier technique?

return Background(
          child:  SingleChildScrollView(
            child: Column(
              mainAxisAlignment:MainAxisAlignment.center,
              crossAxisAlignment: CrossAxisAlignment.center,
              children:  <Widget>[
                Text(
                  "Welcome to my App",
                  style: TextStyle(fontWeight: FontWeight.bold, color: kPrimaryColor,),
                ),
                Center(
                  child: SvgPicture.asset(
                    "assets/icons/chat.svg",
                    height: size.height * 0.45,
                  ),
                ),
                SizedBox(height: size.height * 0.03),
                RoundedButton(
                  text: "LOGIN",
                  press:
                  (){Navigator.push(context, MaterialPageRoute(builder: (context){
                    return LoginScreen();},),);},
                ),
                RoundedButton(
                  text: "SIGN UP",
                  color: kPrimaryightColor,
                  textColor: Colors.black,
                  press: (){},
                ),
              ],
            ),
          ),
        );

Upvotes: 0

Views: 142

Answers (2)

Mohamad Eizeddin
Mohamad Eizeddin

Reputation: 896

You can add SizedBox(height: 100) widget on the top of Column widget or just edit the crossAxisAlignment & mainAxisAlignment

like this:

return Background(
      child:  SingleChildScrollView(
        child: Column(
          mainAxisAlignment:MainAxisAlignment.spaceEvenly,
      crossAxisAlignment: CrossAxisAlignment.stretch,
          children:  <Widget>[
            Text(
              "Welcome to my App",
              style: TextStyle(fontWeight: FontWeight.bold, color: kPrimaryColor,),
            ),
            Center(
              child: SvgPicture.asset(
                "assets/icons/chat.svg",
                height: size.height * 0.45,
              ),
            ),
            SizedBox(height: size.height * 0.03),
            RoundedButton(
              text: "LOGIN",
              press:
              (){Navigator.push(context, MaterialPageRoute(builder: (context){
                return LoginScreen();},),);},
            ),
            RoundedButton(
              text: "SIGN UP",
              color: kPrimaryightColor,
              textColor: Colors.black,
              press: (){},
            ),
          ],
        ),
      ),
    );

Upvotes: 1

Jam
Jam

Reputation: 642

Try this:

          mainAxisAlignment:MainAxisAlignment.spaceEvenly,
          crossAxisAlignment: CrossAxisAlignment.stetch,

Upvotes: 1

Related Questions