-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Create
catalyst_voices_brands
package to manage brands and th…
…emes.
- Loading branch information
Showing
19 changed files
with
168 additions
and
62 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
6 changes: 3 additions & 3 deletions
6
catalyst_voices/packages/catalyst_voices_blocs/lib/src/brand/brand_event.dart
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
8 changes: 4 additions & 4 deletions
8
catalyst_voices/packages/catalyst_voices_blocs/lib/src/brand/brand_state.dart
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 |
---|---|---|
@@ -1,11 +1,11 @@ | ||
part of 'brand_bloc.dart'; | ||
|
||
final class BrandState extends Equatable { | ||
final ThemeData? themeData; | ||
final BrandKey? brandKey; | ||
|
||
BrandState({ThemeData? themeData}) | ||
: themeData = themeData ?? brands[BrandKey.catalyst]; | ||
const BrandState({BrandKey? brandKey}) | ||
: brandKey = brandKey ?? BrandKey.catalyst; | ||
|
||
@override | ||
List<Object> get props => [themeData ?? '']; | ||
List<Object> get props => [brandKey ?? '']; | ||
} |
1 change: 1 addition & 0 deletions
1
catalyst_voices/packages/catalyst_voices_blocs/lib/src/catalyst_voices_blocs.dart
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
export 'authentication/authentication.dart'; | ||
export 'brand/brand.dart'; | ||
export 'dependency/dependency.dart'; | ||
export 'login/login.dart'; |
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
44 changes: 44 additions & 0 deletions
44
catalyst_voices/packages/catalyst_voices_brands/.gitignore
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,44 @@ | ||
# Miscellaneous | ||
*.class | ||
*.log | ||
*.pyc | ||
*.swp | ||
.DS_Store | ||
.atom/ | ||
.buildlog/ | ||
.history | ||
.svn/ | ||
migrate_working_dir/ | ||
|
||
# IntelliJ related | ||
*.iml | ||
*.ipr | ||
*.iws | ||
.idea/ | ||
|
||
# VSCode related | ||
.vscode/* | ||
|
||
# Flutter/Dart/Pub related | ||
**/doc/api/ | ||
**/ios/Flutter/.last_build_id | ||
.dart_tool/ | ||
.flutter-plugins | ||
.flutter-plugins-dependencies | ||
.packages | ||
.pub-cache/ | ||
.pub/ | ||
/build/ | ||
pubspec.lock | ||
|
||
# Web related | ||
lib/generated_plugin_registrant.dart | ||
|
||
# Symbolication related | ||
app.*.symbols | ||
|
||
# Obfuscation related | ||
app.*.map.json | ||
|
||
# Test related | ||
coverage |
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 @@ | ||
# Catalyst Voices Brands |
12 changes: 12 additions & 0 deletions
12
catalyst_voices/packages/catalyst_voices_brands/analysis_options.yaml
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,12 @@ | ||
include: package:catalyst_analysis/analysis_options.1.0.0.yaml | ||
|
||
analyzer: | ||
exclude: [ | ||
build/**, | ||
lib/*.g.dart, | ||
lib/generated/** | ||
] | ||
|
||
linter: | ||
rules: | ||
public_member_api_docs: false |
3 changes: 3 additions & 0 deletions
3
catalyst_voices/packages/catalyst_voices_brands/lib/catalyst_voices_brands.dart
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,3 @@ | ||
library catalyst_voices_brands; | ||
|
||
export 'src/catalyst_voices_brands.dart'; |
5 changes: 5 additions & 0 deletions
5
catalyst_voices/packages/catalyst_voices_brands/lib/src/brands/brands.dart
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,5 @@ | ||
/// Simple Enum to store all possible Brands. | ||
enum BrandKey { | ||
catalyst, | ||
dummy, | ||
} |
2 changes: 2 additions & 0 deletions
2
catalyst_voices/packages/catalyst_voices_brands/lib/src/catalyst_voices_brands.dart
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,2 @@ | ||
export 'brands/brands.dart'; | ||
export 'theme_builder/theme_builder.dart'; |
26 changes: 26 additions & 0 deletions
26
catalyst_voices/packages/catalyst_voices_brands/lib/src/theme_builder/theme_builder.dart
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,26 @@ | ||
import 'package:catalyst_voices_brands/src/brands/brands.dart'; | ||
import 'package:catalyst_voices_brands/src/themes/catalyst.dart'; | ||
import 'package:catalyst_voices_brands/src/themes/dummy.dart'; | ||
import 'package:flutter/material.dart'; | ||
|
||
/// A utility class to build themes dynamically based on brand keys. | ||
/// | ||
/// [buildTheme] can be used to obtain the corresponding theme data for the | ||
/// [BrandKey] passed to the method. | ||
/// | ||
/// For each brand there is a specific key defined in the [BrandKey] enum | ||
/// and a corresponding [ThemeData] in the `themes` folder. | ||
/// | ||
/// [buildTheme] defaults to the [catalyst] theme. | ||
class ThemeBuilder { | ||
static ThemeData buildTheme(BrandKey? brandKey) { | ||
switch (brandKey) { | ||
case BrandKey.catalyst: | ||
return catalyst; | ||
case BrandKey.dummy: | ||
return dummy; | ||
case null: | ||
return catalyst; | ||
} | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
catalyst_voices/packages/catalyst_voices_brands/lib/src/themes/catalyst.dart
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,10 @@ | ||
import 'package:catalyst_voices_assets/catalyst_voices_assets.dart'; | ||
import 'package:flutter/material.dart'; | ||
|
||
/// [ThemeData] for the `catalyst` brand. | ||
final ThemeData catalyst = ThemeData( | ||
colorScheme: ColorScheme.fromSeed( | ||
seedColor: VoicesColors.blue, | ||
primary: VoicesColors.blue, | ||
), | ||
); |
9 changes: 9 additions & 0 deletions
9
catalyst_voices/packages/catalyst_voices_brands/lib/src/themes/dummy.dart
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,9 @@ | ||
import 'package:flutter/material.dart'; | ||
|
||
/// [ThemeData] for the `dummy` brand. | ||
final ThemeData dummy = ThemeData.from( | ||
colorScheme: ColorScheme.fromSeed( | ||
seedColor: const Color(0xFFFF5722), | ||
primary: const Color(0xFFFF5722), | ||
), | ||
); |
24 changes: 24 additions & 0 deletions
24
catalyst_voices/packages/catalyst_voices_brands/pubspec.yaml
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,24 @@ | ||
name: catalyst_voices_brands | ||
description: Catalyst Voices Brands. | ||
version: 0.1.0+1 | ||
publish_to: none | ||
|
||
environment: | ||
sdk: ">=3.2.6 <4.0.0" | ||
flutter: 3.19.5 | ||
|
||
dependencies: | ||
catalyst_voices_assets: | ||
path: ../catalyst_voices_assets | ||
flutter: | ||
sdk: flutter | ||
|
||
dev_dependencies: | ||
catalyst_analysis: | ||
path: ../../../catalyst_voices_packages/catalyst_analysis | ||
catalyst_voices_blocs: | ||
path: ../catalyst_voices_blocs | ||
flutter_bloc: ^8.1.5 | ||
flutter_test: | ||
sdk: flutter | ||
test: ^1.24.9 |
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
1 change: 0 additions & 1 deletion
1
catalyst_voices/packages/catalyst_voices_models/lib/catalyst_voices_models.dart
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 |
---|---|---|
@@ -1,6 +1,5 @@ | ||
library catalyst_voices_models; | ||
|
||
export 'src/authentication_status.dart'; | ||
export 'src/brands.dart'; | ||
export 'src/catalyst_voices_models.dart'; | ||
export 'src/session_data.dart'; |
29 changes: 0 additions & 29 deletions
29
catalyst_voices/packages/catalyst_voices_models/lib/src/brands.dart
This file was deleted.
Oops, something went wrong.
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