Skip to content

I am new to flutter and i am developing flutter app I want to call a function inside the column but it said null values.i have tried to show the Title1() function inside the Photo() class but it shows error. #9

@Natnael3344

Description

@Natnael3344

[class Internal extends StatefulWidget{

      @override
      _InternalState createState()=>_InternalState();
    
    }
    class _InternalState extends State<Internal> {
    
      bool isSearching=false;
      Photo(int number,){
        return Scaffold(
          backgroundColor: Color(0XFFfffafa),
          body: SafeArea(
          child: SingleChildScrollView(
            child: Container(
              child: Stack(
                children: <Widget>[
                  Container(
                    height: 19,
                    child: Padding(
                      padding: const EdgeInsets.only(right:360.0),
                      child: IconButton(icon: Icon(Icons.arrow_back,color: Colors.black,size: 30,), onPressed: (){
                        Navigator.push(
                          context,
                          MaterialPageRoute(builder: (context) => Internal()),
                        );
    
                      }),
                    ),
                  ),
                Title1(number),
                ClipRRect(
                  borderRadius: BorderRadius.only(topRight: Radius.circular(40.0),topLeft: Radius.circular(40.0)),
                  child: Image(image:  AssetImage('images/song$number.jpg'),),
                ),
                ],
              ),
            ),
          ),
        ),
    Title1(int number){
      number=1;
      Container(
        margin: EdgeInsets.only(left:37.0,right: 37,bottom: 10),
        child: Center(child: Text('Tempo : 102\nStyle : Waltz\nChord : C\nTranspose : 4',
          style: TextStyle(color: Colors.white,fontFamily: 'SourceSansPro',fontWeight: FontWeight.w600,fontSize: 20),)),
        height: 120.0,
        width: 380,
        decoration: BoxDecoration(shape: BoxShape.rectangle,color: Color(0XFF40404F),borderRadius: BorderRadius.circular(20.0)),
      );
      number=2;
      Container(
        margin: EdgeInsets.only(left:37.0,right: 37,bottom: 10),
        child: Center(child: Text('Tempo : 102\nStyle : Waltz\nChord : C\nTranspose : 2',
          style: TextStyle(color: Colors.white,fontFamily: 'SourceSansPro',fontWeight: FontWeight.w600,fontSize: 20),)),
        height: 120.0,
        width: 380,
        decoration: BoxDecoration(shape: BoxShape.rectangle,color: Color(0XFF40404F),borderRadius: BorderRadius.circular(20.0)),
      );
    }
    );
  }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions