From 6bb5d68b9f492bfc4b8edf12a9614e826391c07f Mon Sep 17 00:00:00 2001 From: Bibash Shrestha Date: Mon, 24 Jun 2024 14:57:24 +0545 Subject: [PATCH] fix: Add portal even if primary color is not provided #2733 --- lib/dashboard/profile/models/profile_setting.dart | 4 ++-- lib/theme/app_theme/app_theme.dart | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/dashboard/profile/models/profile_setting.dart b/lib/dashboard/profile/models/profile_setting.dart index 308dec7d8..0f31c1ec4 100644 --- a/lib/dashboard/profile/models/profile_setting.dart +++ b/lib/dashboard/profile/models/profile_setting.dart @@ -349,7 +349,7 @@ class GeneralOptions extends Equatable { required this.published, required this.profileId, required this.customerPlan, - required this.primaryColor, + this.primaryColor, }); factory GeneralOptions.fromJson(Map json) => @@ -381,7 +381,7 @@ class GeneralOptions extends Equatable { final DateTime published; final String profileId; final String customerPlan; - final String primaryColor; + final String? primaryColor; Map toJson() => _$GeneralOptionsToJson(this); diff --git a/lib/theme/app_theme/app_theme.dart b/lib/theme/app_theme/app_theme.dart index 4fcd52c1d..3729a9ecb 100644 --- a/lib/theme/app_theme/app_theme.dart +++ b/lib/theme/app_theme/app_theme.dart @@ -48,8 +48,10 @@ class AppTheme { ); } - static ThemeData seedThemeData(Brightness brightness, String primaryColor) { - if (primaryColor.startsWith('#')) { + static ThemeData seedThemeData(Brightness brightness, String? primaryColor) { + if (primaryColor == null) { + return defaultThemeData(brightness); + } else if (primaryColor.startsWith('#')) { final seedColor = Color( int.parse(primaryColor.substring(1, 7), radix: 16) + 0xFF000000, );