by @kodeazy

flutter how to change the background color of my screen?

Home » flutter » flutter how to change the background color of my screen?
  • To change tthe background color of screen in flutter we have many ways
  • Below is the syntax using scafold to update the background using backgroundColor attribute.

    Scaffold(
          backgroundColor: Colors.white,
          body: Center(child: new Text("Hello, World!")))
  • Below is the example program on using scafold to update the background colo of the screen.

    import 'package:flutter/material.dart';
    void main() {
    runApp(MyApp());
    }
    class MyApp extends StatelessWidget {
    Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
          backgroundColor: Colors.yellow,
          body: Center(child: new Text("Hello, World!"))),
    );
    }
    }

    Output: Background Image Output