-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
7 changed files
with
195 additions
and
170 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import 'package:flutter/material.dart'; | ||
|
||
import 'color_swatch.dart'; | ||
|
||
/// A custom theme that can be used to define custom colors for the app. | ||
class ZetaCustomTheme { | ||
/// Constructs a [ZetaCustomTheme]. | ||
/// To define every shade of a color, provide a [ZetaColorSwatch] or a [MaterialColor]. | ||
/// If only a [Color] is provided, a [ZetaColorSwatch] will be automatically generated. | ||
ZetaCustomTheme({ | ||
required this.id, | ||
Color? primary, | ||
Color? primaryDark, | ||
Color? secondary, | ||
Color? secondaryDark, | ||
}) : assert( | ||
primaryDark != null && primary != null, | ||
'Primary dark cannot be set without a primary color', | ||
), | ||
assert( | ||
secondary != null && secondaryDark != null, | ||
'Secondary dark cannot be set without a secondary color', | ||
), | ||
primary = primary != null ? ZetaColorSwatch.fromColor(primary) : null, | ||
primaryDark = primaryDark != null | ||
? ZetaColorSwatch.fromColor(primaryDark) | ||
: primary != null | ||
? ZetaColorSwatch.inverse(ZetaColorSwatch.fromColor(primary)) | ||
: null, | ||
secondary = secondary != null ? ZetaColorSwatch.fromColor(secondary) : null, | ||
secondaryDark = secondaryDark != null | ||
? ZetaColorSwatch.fromColor(secondaryDark) | ||
: secondary != null | ||
? ZetaColorSwatch.inverse(ZetaColorSwatch.fromColor(secondary)) | ||
: null; | ||
|
||
/// The ID of the custom theme. | ||
final String id; | ||
|
||
/// The primary color of the custom theme. | ||
final ZetaColorSwatch? primary; | ||
|
||
/// The dark primary color of the custom theme. | ||
final ZetaColorSwatch? primaryDark; | ||
|
||
/// The secondary color of the custom theme. | ||
final ZetaColorSwatch? secondary; | ||
|
||
/// The dark secondary color of the custom theme. | ||
final ZetaColorSwatch? secondaryDark; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.