-
Notifications
You must be signed in to change notification settings - Fork 839
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
primaryColor: Doesnt Work #37
Comments
Use primarySwatch instead like - |
theme: ThemeData( |
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
// Define the theme
theme: ThemeData(
// Define the primary color
primaryColor: Colors.blue,
// Optionally, you can also define other theme properties
// such as accentColor, scaffoldBackgroundColor, etc.
),
home: MyHomePage(),
);
}
}
class MyHomePage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
// Use the primary color for the app bar
backgroundColor: Theme.of(context).primaryColor,
title: Text('Flutter App with Primary Color'),
),
body: Center(
child: Text(
'Hello, Flutter!',
style: TextStyle(
// Use the primary color for text
color: Theme.of(context).primaryColor,
fontSize: 24.0,
fontWeight: FontWeight.bold,
),
),
),
);
}
}
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
No description provided.
The text was updated successfully, but these errors were encountered: