Group Group Group Group Group Group Group Group Group

Code given in flutter aprrentice book not working

primary colour is amber but its showing blue only
import ‘package:flutter/material.dart’;

void main() {

runApp(const RecipeApp());

}

class RecipeApp extends StatelessWidget {

const RecipeApp({Key? key}) : super(key: key);

// This widget is the root of your application.

// 1

@override

Widget build(BuildContext context) {

// 2

final ThemeData theme = ThemeData();

// 3

return MaterialApp(

  // 4

  title: 'Recipe Calculator',

  // 5

  theme: theme.copyWith(

    colorScheme: theme.colorScheme.copyWith(

      primary: Colors.amber,

      secondary: Colors.amber,

    ),

  ),

  // 6

  home: const MyHomePage(title: 'Recipe Calculator'),

);

}

}

class MyHomePage extends StatefulWidget {

const MyHomePage({Key? key, required this.title}) : super(key: key);

// This widget is the home page of your application. It is stateful, meaning

// that it has a State object (defined below) that contains fields that affect

// how it looks.

// This class is the configuration for the state. It holds the values (in this

// case the title) provided by the parent (in this case the App widget) and

// used by the build method of the State. Fields in a Widget subclass are

// always marked “final”.

final String title;

@override

State createState() => _MyHomePageState();

}

class _MyHomePageState extends State {

@override

Widget build(BuildContext context) {

// 1

return Scaffold(

  // 2

  appBar: AppBar(

    title: Text(widget.title),

  ),

  // 3

  body: SafeArea(

    // TODO: Replace child: Container()

    // 4

    child: Container(),

  ),

);

}

// TODO: Add buildRecipeCard() here

}

Hey,

Which chapter is this?

Hi Thanks for giving Reply
This code exist withing 1’st chapter
Primary colour of the application shows Blue in scaffold app bar

Finished 1st chapter, everything ok, i think you make some mistake

I took your pasted code and got the amber bar. Are you sure you cleared everything out and running the right app?