Home > OS >  Want to set the primarySwatch as white in flutter
Want to set the primarySwatch as white in flutter

Time:12-19

how to change the 'primarySwatch' to white in the app bar - Flutter?

This is what I have:

,

I want to change the blueGrey (portion marked in red) to white. While trying to change this from

        primarySwatch: Colors.blueGrey,

to

        primarySwatch: Colors.white,

en error is showing as "The argument type 'Color' can't be assigned to the parameter type 'MaterialColor?'. "

I want to get it like this:

Tried to change the primarySwatch to 'Colors.White', created a class 'basicColors'and added colors(colorHexcode) to variables in the class. Tried to call them in the position of 'Colors.white' as 'basicColors.varibleName'. Didn't work though.

CodePudding user response:

Add below code in your main() function and import below library

import 'package:flutter/services.dart';

inside main function

  SystemChrome.setSystemUIOverlayStyle(
    const SystemUiOverlayStyle(
      statusBarColor: Colors.transparent,
    ),
  );
  • Related