I am new to Flutter and decided to follow a tutorial on making a spotify clone using Flutter. He specifies a custom dark theme, and when he runst the code it is indeed a dark theme, but when I run it it is still white. I initially thought I made a type somewhere so I copied his code, but it did not change anything.
This is the result I want to get
My main.dart file
import 'package:flutter/material.dart';
void main() {
runApp(Spotify());
}
class Spotify extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Spotify UI',
debugShowCheckedModeBanner: false,
darkTheme: ThemeData(
brightness: Brightness.dark,
appBarTheme: const AppBarTheme(backgroundColor: Colors.black),
scaffoldBackgroundColor: const Color(0xFF121212),
backgroundColor: const Color(0xFF121212),
primaryColor: Colors.black,
accentColor: const Color(0xFF1DB954),
iconTheme: const IconThemeData().copyWith(color: Colors.black),
fontFamily: 'Montserrat',
textTheme: TextTheme(
headline2: const TextStyle(
color: Colors.white,
fontSize: 32.0,
fontWeight: FontWeight.bold,
),
headline4: TextStyle(
fontSize: 12.0,
color: Colors.grey[300],
fontWeight: FontWeight.w500,
letterSpacing: 2.0,
),
bodyText1: TextStyle(
color: Colors.grey[300],
fontSize: 14.0,
fontWeight: FontWeight.w600,
letterSpacing: 1.0,
),
bodyText2: TextStyle(
color: Colors.grey[300],
letterSpacing: 1.0,
),
),
),
home: Shell(),
);
}
}
class Shell extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
body: Column(
children: [
Expanded(
child: Row(
children: [
Container(
height: double.infinity,
width: 280.0,
color: Colors.green,
),
// PlaylistScreen
],
),
),
Container(
height: 84.0,
width: double.infinity,
color: Colors.blue,
),
],
),
);
}
}
CodePudding user response:
set backgroundColor: Colors.black,
in Scaffold()