I am looking for a custom color theme pattern in Flutter. Something like following written in Swift
.
struct Colors {
struct Text {
static var success: UIColor {
return UIColor.green
}
static var error: UIColor {
return UIColor.red
}
}
struct Button {
static var normal: UIColor {
return UIColor.black
}
static var onPressed: UIColor {
return UIColor.blue
}
}
}
So that I can use something like,
let successTextColor = Colors.Text.success
let normalButtonColor = Colors.Button.normal
> Main Objective:
I am looking for something that is appropriate or best for flutter project, the above is for reference only.
I have tried overriding the ThemeData
but as per my understanding I can only override the TextTheme
and can't use any custom value such as errorText
or successText
, etc.
I want something that will provide me the color palates (fonts, size, etc) for buttons or other widgets.
Also keeping in mind that I need to support the light and dark theme.
Any suggestions will be appreciatable.