fluttercontainersbackground-colorflutter-container

i am change the background color of container using hexcode but showing error


Container( color: Color('#260033'), height: 150.0, width: double.infinity, child: Column(

i want to use hex code to change the container color.pls help me regarding this.

Container( color: Color('#260033'), // showing error on this line height: 150.0, width: double.infinity, child: Column(

i want to change the background of container using this hex color code but unable to this..


Solution

  • In flutter you have to use Color(0xff) with your hex code.

    if you want to use the color #260033- use Color(0XFF260033)
    FF represents full opacity. if you want to change the opacity replace FF with values in this table

            Container(
               color:Color(0xff260033),
               child: Text("some text"),
                     ),