Solution: AppBar Widget

In this lesson, you'll explore the solution to the "AppBar Widget" challenge.

Solution: Making AppBar Purple

You learned that AppBar widget’s background color can be updated using the backgroundColor property in the previous lesson.

You need to pick the purple color from Colors class like this: Colors.purple.

import 'package:flutter/material.dart';

//App's entry point
void main() => runApp(ContactProfilePage());

//App's main widget
class ContactProfilePage extends StatelessWidget {

 //Building screen widget
 @override
 Widget build(BuildContext context) {
   return MaterialApp(
     //Removing debug banner
     debugShowCheckedModeBanner: false,
     //Scaffold widget as home 
     home: Scaffold(

       //Assigning requested color to app bar 
       appBar: AppBar(
            backgroundColor: Colors.purple,	
       ),
     ),
   );
 }
}

Get hands-on with 1400+ tech skills courses.