Error: Expected ',' before this SizedBox(height: 50),, Error: Method not found: 'Sizedbox'

139

You use this

         Text(
                'Sign In',
                style: TextStyle(
                    cbuildEmail(),olor: Colors.white,
                    fontSize: 40,
                    fontWeight: FontWeight.bold),
              ),
              SizedBox(height: 50),
             buildEmail(),
Share:
139
Admin
Author by

Admin

Updated on December 01, 2022

Comments

  • Admin
    Admin over 1 year

    when I used Sizedbox in my code, it display redlines and errors. I'm using the android studio to develop the flutter app. this is the login UI I'm creating. https://www.youtube.com/watch?v=PqZgkU_SZAE&t=111s I refer to this youtube video. can someone please explain why this is happening

    enter image description here Error: Expected ',' before this SizedBox(height: 50), Error: Method not found: 'Sizedbox'.

    import 'package:flutter/cupertino.dart';
        
    import 'package:flutter/material.dart';
        
    import'package:flutter/services.dart';
        
        
        class LoginScreen extends StatefulWidget {
        
        
        @override
          _LoginScreenState createState() => _LoginScreenState();
          }
        
        Widget buildEmail(){
          return Column(
            crossAxisAlignment: CrossAxisAlignment.start,
            children: <Widget>[
              Text(
                'Email',
                style: TextStyle(
                  color: Colors.white,
                  fontSize: 16,
                  fontWeight: FontWeight.bold
        
                ),
              )
        
              **Sizedbox (height:10),** //error
              Container(
                alignment: Alignment.centerLeft,
                decoration: BoxDecoration(
                  borderRadius: BorderRadius.circular(10),
                  boxShadow: [
                    BoxShadow(
                      color:Colors.black26,
                      blurRadius: 6,
                      offset :Offset(0,2)
        
                    )
                  ]
                  
                ),
                height:60,
                child: TextField(
                  keyboardType: TextInputType.emailAddress,
        
                )
        
        
              )
            ]
        
          );
        }
        
        
                 class _LoginScreenState extends State <LoginScreen> {
        
          @override
          Widget build(BuildContext context) {
            return Scaffold(
              body: AnnotatedRegion<SystemUiOverlayStyle> (
                value: SystemUiOverlayStyle.light,
                child: GestureDetector(
                  child: Stack(
                    children: <Widget>[
                      Container(
                        height: double.infinity,
                        width: double.infinity,
                        decoration: BoxDecoration(
                          gradient: LinearGradient(
                            begin: Alignment.topCenter,
                            end: Alignment.bottomCenter,
                            colors:[
                              Color(0x665ac18e),
                              Color(0x995ac18e),
                              Color(0xcc5ac18e),
                              Color(0xff5ac18e),
                            ]
                          )
                        ),
        
                        child:Column(
                          mainAxisAlignment: MainAxisAlignment.center,
                          children: <Widget>[
                            Text(
                              'Sign In',
                              style: TextStyle(
                                    color: Colors.white,
                                fontSize: 40,
                                fontWeight: FontWeight.bold
        
                              ),
                            )
        
                            **SizedBox(height: 50),** //error
                            buildEmail(),
        
                          ],
                        )
                      )
                    ],
                  ),
                ),
              ),
            );
          }
        }
    
    • Fahmida
      Fahmida over 2 years
      This a simple error. Please read the error message. Add a comma(,) before SizedBox. Column or Row elements should be separated using commas.
  • Admin
    Admin over 2 years
    It's worked little. now its showing function 'Sizedbox' isn't defined. what should I DO
  • Nabin Dhakal
    Nabin Dhakal over 2 years
    It needs to be SizedBox instead of Sizedbox. You are making spelling mistake
  • Admin
    Admin over 2 years
    omg! thank you so much means a lot