refactor: Deprecate accentColor

This commit is contained in:
Christian Pauly 2021-05-24 10:59:00 +02:00
parent 445a2498f1
commit ddd5711f79
17 changed files with 60 additions and 39 deletions

View File

@ -34,7 +34,10 @@ abstract class FluffyThemes {
primaryColorLight: Color(0xff121212), primaryColorLight: Color(0xff121212),
brightness: Brightness.light, brightness: Brightness.light,
primaryColor: AppConfig.primaryColor, primaryColor: AppConfig.primaryColor,
accentColor: AppConfig.primaryColor, colorScheme: ThemeData.light().colorScheme.copyWith(
primary: AppConfig.primaryColor,
secondary: AppConfig.primaryColor,
),
backgroundColor: Colors.white, backgroundColor: Colors.white,
secondaryHeaderColor: lighten(AppConfig.primaryColor, .51), secondaryHeaderColor: lighten(AppConfig.primaryColor, .51),
scaffoldBackgroundColor: Colors.white, scaffoldBackgroundColor: Colors.white,
@ -115,7 +118,10 @@ abstract class FluffyThemes {
errorColor: Color(0xFFCF6679), errorColor: Color(0xFFCF6679),
backgroundColor: Colors.black, backgroundColor: Colors.black,
scaffoldBackgroundColor: Colors.black, scaffoldBackgroundColor: Colors.black,
accentColor: AppConfig.primaryColorLight, colorScheme: ThemeData.dark().colorScheme.copyWith(
primary: AppConfig.primaryColorLight,
secondary: AppConfig.primaryColorLight,
),
secondaryHeaderColor: FluffyThemes.darken(AppConfig.primaryColorLight, .65), secondaryHeaderColor: FluffyThemes.darken(AppConfig.primaryColorLight, .65),
textTheme: Typography.material2018().white.merge(fallback_text_theme), textTheme: Typography.material2018().white.merge(fallback_text_theme),
dialogTheme: DialogTheme( dialogTheme: DialogTheme(

View File

@ -9,6 +9,7 @@ import 'package:fluffychat/utils/sentry_controller.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'utils/localized_exception_extension.dart'; import 'utils/localized_exception_extension.dart';
import 'package:flutter_app_lock/flutter_app_lock.dart'; import 'package:flutter_app_lock/flutter_app_lock.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart'; import 'package:flutter_gen/gen_l10n/l10n.dart';

View File

@ -110,7 +110,9 @@ class ChatDetailsView extends StatelessWidget {
title: Text( title: Text(
'${L10n.of(context).groupDescription}:', '${L10n.of(context).groupDescription}:',
style: TextStyle( style: TextStyle(
color: Theme.of(context).accentColor, color: Theme.of(context)
.colorScheme
.secondary,
fontWeight: FontWeight.bold)), fontWeight: FontWeight.bold)),
subtitle: LinkText( subtitle: LinkText(
text: room.topic?.isEmpty ?? true text: room.topic?.isEmpty ?? true
@ -136,7 +138,8 @@ class ChatDetailsView extends StatelessWidget {
title: Text( title: Text(
L10n.of(context).settings, L10n.of(context).settings,
style: TextStyle( style: TextStyle(
color: Theme.of(context).accentColor, color:
Theme.of(context).colorScheme.secondary,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
), ),
@ -321,7 +324,8 @@ class ChatDetailsView extends StatelessWidget {
actualMembersCount.toString()) actualMembersCount.toString())
: L10n.of(context).emptyChat, : L10n.of(context).emptyChat,
style: TextStyle( style: TextStyle(
color: Theme.of(context).accentColor, color:
Theme.of(context).colorScheme.secondary,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
), ),

View File

@ -32,7 +32,7 @@ class ChatEncryptionSettingsView extends StatelessWidget {
title: Text(L10n.of(context).deviceVerifyDescription), title: Text(L10n.of(context).deviceVerifyDescription),
leading: CircleAvatar( leading: CircleAvatar(
backgroundColor: Theme.of(context).secondaryHeaderColor, backgroundColor: Theme.of(context).secondaryHeaderColor,
foregroundColor: Theme.of(context).accentColor, foregroundColor: Theme.of(context).colorScheme.secondary,
child: Icon(Icons.lock), child: Icon(Icons.lock),
), ),
), ),

View File

@ -110,7 +110,8 @@ class ChatView extends StatelessWidget {
: Row( : Row(
children: <Widget>[ children: <Widget>[
Icon(Icons.edit_outlined, Icon(Icons.edit_outlined,
color: Theme.of(context).accentColor, color:
Theme.of(context).colorScheme.secondary,
size: 13), size: 13),
SizedBox(width: 4), SizedBox(width: 4),
Expanded( Expanded(
@ -119,7 +120,9 @@ class ChatView extends StatelessWidget {
.getLocalizedTypingText(context), .getLocalizedTypingText(context),
maxLines: 1, maxLines: 1,
style: TextStyle( style: TextStyle(
color: Theme.of(context).accentColor, color: Theme.of(context)
.colorScheme
.secondary,
fontStyle: FontStyle.italic, fontStyle: FontStyle.italic,
), ),
), ),
@ -209,7 +212,8 @@ class ChatView extends StatelessWidget {
color: Theme.of(context).secondaryHeaderColor, color: Theme.of(context).secondaryHeaderColor,
child: ListTile( child: ListTile(
leading: CircleAvatar( leading: CircleAvatar(
foregroundColor: Theme.of(context).accentColor, foregroundColor:
Theme.of(context).colorScheme.secondary,
backgroundColor: Theme.of(context).backgroundColor, backgroundColor: Theme.of(context).backgroundColor,
child: Icon(Icons.upgrade_outlined), child: Icon(Icons.upgrade_outlined),
), ),
@ -330,7 +334,8 @@ class ChatView extends StatelessWidget {
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
style: TextStyle( style: TextStyle(
color: Theme.of(context) color: Theme.of(context)
.accentColor, .colorScheme
.secondary,
), ),
), ),
), ),

View File

@ -25,7 +25,7 @@ class NewPrivateChatView extends StatelessWidget {
onPressed: () => VRouter.of(context).push('/newgroup'), onPressed: () => VRouter.of(context).push('/newgroup'),
child: Text( child: Text(
L10n.of(context).createNewGroup, L10n.of(context).createNewGroup,
style: TextStyle(color: Theme.of(context).accentColor), style: TextStyle(color: Theme.of(context).colorScheme.secondary),
), ),
) )
], ],
@ -78,7 +78,7 @@ class NewPrivateChatView extends StatelessWidget {
ListTile( ListTile(
leading: CircleAvatar( leading: CircleAvatar(
radius: Avatar.defaultSize / 2, radius: Avatar.defaultSize / 2,
foregroundColor: Theme.of(context).accentColor, foregroundColor: Theme.of(context).colorScheme.secondary,
backgroundColor: Theme.of(context).secondaryHeaderColor, backgroundColor: Theme.of(context).secondaryHeaderColor,
child: Icon(Icons.share_outlined), child: Icon(Icons.share_outlined),
), ),
@ -86,7 +86,8 @@ class NewPrivateChatView extends StatelessWidget {
title: Text('${L10n.of(context).yourOwnUsername}:'), title: Text('${L10n.of(context).yourOwnUsername}:'),
subtitle: Text( subtitle: Text(
Matrix.of(context).client.userID, Matrix.of(context).client.userID,
style: TextStyle(color: Theme.of(context).accentColor), style:
TextStyle(color: Theme.of(context).colorScheme.secondary),
), ),
), ),
Divider(height: 1), Divider(height: 1),

View File

@ -75,8 +75,8 @@ class SearchView extends StatelessWidget {
onChanged: controller.search, onChanged: controller.search,
), ),
bottom: TabBar( bottom: TabBar(
indicatorColor: Theme.of(context).accentColor, indicatorColor: Theme.of(context).colorScheme.secondary,
labelColor: Theme.of(context).accentColor, labelColor: Theme.of(context).colorScheme.secondary,
unselectedLabelColor: Theme.of(context).textTheme.bodyText1.color, unselectedLabelColor: Theme.of(context).textTheme.bodyText1.color,
labelStyle: TextStyle(fontSize: 16), labelStyle: TextStyle(fontSize: 16),
labelPadding: EdgeInsets.symmetric( labelPadding: EdgeInsets.symmetric(
@ -97,7 +97,7 @@ class SearchView extends StatelessWidget {
SizedBox(height: 12), SizedBox(height: 12),
ListTile( ListTile(
leading: CircleAvatar( leading: CircleAvatar(
foregroundColor: Theme.of(context).accentColor, foregroundColor: Theme.of(context).colorScheme.secondary,
backgroundColor: Theme.of(context).secondaryHeaderColor, backgroundColor: Theme.of(context).secondaryHeaderColor,
child: Icon(Icons.edit_outlined), child: Icon(Icons.edit_outlined),
), ),

View File

@ -56,11 +56,11 @@ class EmotesSettingsView extends StatelessWidget {
prefixText: ': ', prefixText: ': ',
suffixText: ':', suffixText: ':',
prefixStyle: TextStyle( prefixStyle: TextStyle(
color: Theme.of(context).accentColor, color: Theme.of(context).colorScheme.secondary,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
suffixStyle: TextStyle( suffixStyle: TextStyle(
color: Theme.of(context).accentColor, color: Theme.of(context).colorScheme.secondary,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
border: InputBorder.none, border: InputBorder.none,
@ -140,11 +140,15 @@ class EmotesSettingsView extends StatelessWidget {
prefixText: ': ', prefixText: ': ',
suffixText: ':', suffixText: ':',
prefixStyle: TextStyle( prefixStyle: TextStyle(
color: Theme.of(context).accentColor, color: Theme.of(context)
.colorScheme
.secondary,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
suffixStyle: TextStyle( suffixStyle: TextStyle(
color: Theme.of(context).accentColor, color: Theme.of(context)
.colorScheme
.secondary,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
border: InputBorder.none, border: InputBorder.none,

View File

@ -65,7 +65,7 @@ class SettingsNotificationsView extends StatelessWidget {
title: Text( title: Text(
L10n.of(context).pushRules, L10n.of(context).pushRules,
style: TextStyle( style: TextStyle(
color: Theme.of(context).accentColor, color: Theme.of(context).colorScheme.secondary,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
), ),
@ -83,7 +83,7 @@ class SettingsNotificationsView extends StatelessWidget {
title: Text( title: Text(
L10n.of(context).devices, L10n.of(context).devices,
style: TextStyle( style: TextStyle(
color: Theme.of(context).accentColor, color: Theme.of(context).colorScheme.secondary,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
), ),

View File

@ -47,7 +47,7 @@ class SettingsStyleView extends StatelessWidget {
title: Text( title: Text(
L10n.of(context).wallpaper, L10n.of(context).wallpaper,
style: TextStyle( style: TextStyle(
color: Theme.of(context).accentColor, color: Theme.of(context).colorScheme.secondary,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
), ),
@ -77,7 +77,7 @@ class SettingsStyleView extends StatelessWidget {
title: Text( title: Text(
L10n.of(context).fontSize, L10n.of(context).fontSize,
style: TextStyle( style: TextStyle(
color: Theme.of(context).accentColor, color: Theme.of(context).colorScheme.secondary,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
), ),

View File

@ -74,7 +74,7 @@ class SettingsView extends StatelessWidget {
title: Text( title: Text(
L10n.of(context).notifications, L10n.of(context).notifications,
style: TextStyle( style: TextStyle(
color: Theme.of(context).accentColor, color: Theme.of(context).colorScheme.secondary,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
), ),
@ -89,7 +89,7 @@ class SettingsView extends StatelessWidget {
title: Text( title: Text(
L10n.of(context).chat, L10n.of(context).chat,
style: TextStyle( style: TextStyle(
color: Theme.of(context).accentColor, color: Theme.of(context).colorScheme.secondary,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
), ),
@ -127,7 +127,7 @@ class SettingsView extends StatelessWidget {
title: Text( title: Text(
L10n.of(context).account, L10n.of(context).account,
style: TextStyle( style: TextStyle(
color: Theme.of(context).accentColor, color: Theme.of(context).colorScheme.secondary,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
), ),
@ -188,7 +188,7 @@ class SettingsView extends StatelessWidget {
title: Text( title: Text(
L10n.of(context).security, L10n.of(context).security,
style: TextStyle( style: TextStyle(
color: Theme.of(context).accentColor, color: Theme.of(context).colorScheme.secondary,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
), ),
@ -223,7 +223,7 @@ class SettingsView extends StatelessWidget {
title: Text( title: Text(
L10n.of(context).about, L10n.of(context).about,
style: TextStyle( style: TextStyle(
color: Theme.of(context).accentColor, color: Theme.of(context).colorScheme.secondary,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
), ),

View File

@ -98,7 +98,7 @@ class _ContactListTile extends StatelessWidget {
subtitle: Text(contact.getLocalizedStatusMessage(context), subtitle: Text(contact.getLocalizedStatusMessage(context),
style: contact.presence.statusMsg?.isNotEmpty ?? false style: contact.presence.statusMsg?.isNotEmpty ?? false
? TextStyle( ? TextStyle(
color: Theme.of(context).accentColor, color: Theme.of(context).colorScheme.secondary,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
) )
: null), : null),

View File

@ -46,7 +46,7 @@ class HtmlMessage extends StatelessWidget {
emoteSize: emoteSize, emoteSize: emoteSize,
linkStyle: linkStyle ?? linkStyle: linkStyle ??
themeData.textTheme.bodyText2.copyWith( themeData.textTheme.bodyText2.copyWith(
color: themeData.accentColor, color: themeData.colorScheme.secondary,
decoration: TextDecoration.underline, decoration: TextDecoration.underline,
), ),
shrinkToFit: true, shrinkToFit: true,

View File

@ -30,7 +30,7 @@ class OnePageCard extends StatelessWidget {
colors: [ colors: [
Theme.of(context).secondaryHeaderColor.withAlpha(alpha), Theme.of(context).secondaryHeaderColor.withAlpha(alpha),
Theme.of(context).primaryColor.withAlpha(alpha), Theme.of(context).primaryColor.withAlpha(alpha),
Theme.of(context).accentColor.withAlpha(alpha), Theme.of(context).colorScheme.secondary.withAlpha(alpha),
Theme.of(context).backgroundColor.withAlpha(alpha), Theme.of(context).backgroundColor.withAlpha(alpha),
], ],
), ),

View File

@ -185,7 +185,7 @@ class ChatListItem extends StatelessWidget {
style: TextStyle( style: TextStyle(
fontSize: 13, fontSize: 13,
color: room.notificationCount > 0 color: room.notificationCount > 0
? Theme.of(context).accentColor ? Theme.of(context).colorScheme.secondary
: null, : null,
), ),
), ),
@ -205,7 +205,7 @@ class ChatListItem extends StatelessWidget {
if (typingText.isNotEmpty) ...{ if (typingText.isNotEmpty) ...{
Icon( Icon(
Icons.edit_outlined, Icons.edit_outlined,
color: Theme.of(context).accentColor, color: Theme.of(context).colorScheme.secondary,
size: 14, size: 14,
), ),
SizedBox(width: 4), SizedBox(width: 4),
@ -215,7 +215,7 @@ class ChatListItem extends StatelessWidget {
? Text( ? Text(
typingText, typingText,
style: TextStyle( style: TextStyle(
color: Theme.of(context).accentColor, color: Theme.of(context).colorScheme.secondary,
), ),
softWrap: false, softWrap: false,
) )
@ -223,7 +223,7 @@ class ChatListItem extends StatelessWidget {
? Text( ? Text(
L10n.of(context).youAreInvitedToThisChat, L10n.of(context).youAreInvitedToThisChat,
style: TextStyle( style: TextStyle(
color: Theme.of(context).accentColor, color: Theme.of(context).colorScheme.secondary,
), ),
softWrap: false, softWrap: false,
) )
@ -253,7 +253,7 @@ class ChatListItem extends StatelessWidget {
child: Icon( child: Icon(
Icons.push_pin_outlined, Icons.push_pin_outlined,
size: 20, size: 20,
color: Theme.of(context).accentColor, color: Theme.of(context).colorScheme.secondary,
), ),
), ),
if (room.isUnread) if (room.isUnread)

View File

@ -51,7 +51,7 @@ class _LockScreenState extends State<LockScreen> {
colors: [ colors: [
Theme.of(context).secondaryHeaderColor.withAlpha(16), Theme.of(context).secondaryHeaderColor.withAlpha(16),
Theme.of(context).primaryColor.withAlpha(16), Theme.of(context).primaryColor.withAlpha(16),
Theme.of(context).accentColor.withAlpha(16), Theme.of(context).colorScheme.secondary.withAlpha(16),
Theme.of(context).backgroundColor.withAlpha(16), Theme.of(context).backgroundColor.withAlpha(16),
], ],
), ),

View File

@ -82,7 +82,7 @@ add_custom_command(
COMMAND ${CMAKE_COMMAND} -E env COMMAND ${CMAKE_COMMAND} -E env
${FLUTTER_TOOL_ENVIRONMENT} ${FLUTTER_TOOL_ENVIRONMENT}
"${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.sh" "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.sh"
linux-x64 ${CMAKE_BUILD_TYPE} ${FLUTTER_TARGET_PLATFORM} ${CMAKE_BUILD_TYPE}
VERBATIM VERBATIM
) )
add_custom_target(flutter_assemble DEPENDS add_custom_target(flutter_assemble DEPENDS