Flutter-Interview-Questions icon indicating copy to clipboard operation
Flutter-Interview-Questions copied to clipboard

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.

Open Natnael3344 opened this issue 4 years ago • 0 comments

[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)),
      );
    }
    );
  }

Natnael3344 avatar Aug 26 '20 01:08 Natnael3344