Dev C Tutorial For Beginners This walkthrough shows how to create a traditional Windows desktop application in Visual Studio. The example application you'll create uses the Windows API to display 'Hello, Windows desktop!'
Background image is used in many mobile applications to make the View beautiful. As we have already seen social apps is giving us the option to configure us background using your own images. In flutter the Scaffold widget directly dose not support background image customization but using Container widget as Root Parent widget we can easily put background image in activity screen. We have to use Box Decoration property with Decoration Image to put background image on whole layout screen. So in this tutorial we would Flutter Add Set Full Screen Background Image to Scaffold Container Widget Android iOS Example tutorial.
Graphic programming can be done in c using your terminal or command prompt or you can download DevC compiler to create graphic programs. For terminal you need to add the graphics.h libraray to you GCC compiler. For this you will have type in the following commands. You'll probably just google which color is which, but you migt find this interesting. Attribute is kept in a byte. 4 bits for background and 4 for text color. To represent this color hexadecimal numbers are used, since one hex digit represents 4 bits. For example 0x07. 0 is background color (black) and 7 is text color (gray).
Contents in this project Flutter Add Set Full Screen Background Image to Scaffold Container Widget Android iOS Example:
1. Import material.dart package in your app’s main.dart file.
2. Create void main runApp() inbuilt method and here we would call our main MyApp class.
3. Create our main MyApp class extends with State less widget.
2 4 | } |
4. Creating Widget Build area in MyApp class. Now we would make Scaffold widget and put a Center Widget in it.
2 4 6 8 10 | returnMaterialApp( appBar:AppBar( body:Center( ) ); |
5. Creating a Container Widget in Center widget as Child. We would use this Container widget as Root Parent Widget and put all the widgets in its child.
- constraints: BoxConstraints.expand() : is used to create container full screen with filled content.
- BoxDecoration : Used to decorate the Container widget. We would use the image property of box decoration to set background image from URL resource.
2 4 6 8 10 | constraints:BoxConstraints.expand(), image:DecorationImage( image:NetworkImage('https://flutter-examples.com/wp-content/uploads/2020/02/dice.jpg'), ), child:Center(child:Text('Set Full Screen Background Image in Flutter', TextStyle(color:Colors.brown,fontSize:25,fontWeight:FontWeight.bold),),) |
6. Complete source code for main.dart file:
2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 | Widget build(BuildContext context){ home:Scaffold( title:Text('Set Full Screen Background Image')), constraints:BoxConstraints.expand(), image:DecorationImage( image:NetworkImage('https://flutter-examples.com/wp-content/uploads/2020/02/dice.jpg'), ), child:Center(child:Text('Set Full Screen Background Image in Flutter', TextStyle(color:Colors.brown,fontSize:25,fontWeight:FontWeight.bold),),) ) ); } |
Screenshot: