Merge pull request #1261 from CodeThomnics/refactor/reduce_context_calls_theme

Refactor: Reduce .of(context) calls theme
pull/1270/head
Krille-chan 11 months ago committed by GitHub
commit 9731fb461a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -88,6 +88,7 @@ class BootstrapDialogState extends State<BootstrapDialog> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final theme = Theme.of(context);
_wipe ??= widget.wipe; _wipe ??= widget.wipe;
final buttons = <Widget>[]; final buttons = <Widget>[];
Widget body = const CircularProgressIndicator.adaptive(); Widget body = const CircularProgressIndicator.adaptive();
@ -119,7 +120,7 @@ class BootstrapDialogState extends State<BootstrapDialog> {
backgroundColor: Colors.transparent, backgroundColor: Colors.transparent,
child: Icon( child: Icon(
Icons.info_outlined, Icons.info_outlined,
color: Theme.of(context).colorScheme.primary, color: theme.colorScheme.primary,
), ),
), ),
subtitle: Text(L10n.of(context)!.chatBackupDescription), subtitle: Text(L10n.of(context)!.chatBackupDescription),
@ -144,7 +145,7 @@ class BootstrapDialogState extends State<BootstrapDialog> {
CheckboxListTile.adaptive( CheckboxListTile.adaptive(
contentPadding: const EdgeInsets.symmetric(horizontal: 8.0), contentPadding: const EdgeInsets.symmetric(horizontal: 8.0),
value: _storeInSecureStorage, value: _storeInSecureStorage,
activeColor: Theme.of(context).colorScheme.primary, activeColor: theme.colorScheme.primary,
onChanged: (b) { onChanged: (b) {
setState(() { setState(() {
_storeInSecureStorage = b; _storeInSecureStorage = b;
@ -158,7 +159,7 @@ class BootstrapDialogState extends State<BootstrapDialog> {
CheckboxListTile.adaptive( CheckboxListTile.adaptive(
contentPadding: const EdgeInsets.symmetric(horizontal: 8.0), contentPadding: const EdgeInsets.symmetric(horizontal: 8.0),
value: _recoveryKeyCopied, value: _recoveryKeyCopied,
activeColor: Theme.of(context).colorScheme.primary, activeColor: theme.colorScheme.primary,
onChanged: (b) { onChanged: (b) {
FluffyShare.share(key!, context); FluffyShare.share(key!, context);
setState(() => _recoveryKeyCopied = true); setState(() => _recoveryKeyCopied = true);
@ -241,7 +242,7 @@ class BootstrapDialogState extends State<BootstrapDialog> {
const EdgeInsets.symmetric(horizontal: 8.0), const EdgeInsets.symmetric(horizontal: 8.0),
trailing: Icon( trailing: Icon(
Icons.info_outlined, Icons.info_outlined,
color: Theme.of(context).colorScheme.primary, color: theme.colorScheme.primary,
), ),
subtitle: Text( subtitle: Text(
L10n.of(context)!.pleaseEnterRecoveryKeyDescription, L10n.of(context)!.pleaseEnterRecoveryKeyDescription,
@ -261,8 +262,7 @@ class BootstrapDialogState extends State<BootstrapDialog> {
decoration: InputDecoration( decoration: InputDecoration(
contentPadding: const EdgeInsets.all(16), contentPadding: const EdgeInsets.all(16),
hintStyle: TextStyle( hintStyle: TextStyle(
fontFamily: fontFamily: theme.textTheme.bodyLarge?.fontFamily,
Theme.of(context).textTheme.bodyLarge?.fontFamily,
), ),
hintText: L10n.of(context)!.recoveryKey, hintText: L10n.of(context)!.recoveryKey,
errorText: _recoveryKeyInputError, errorText: _recoveryKeyInputError,
@ -272,9 +272,8 @@ class BootstrapDialogState extends State<BootstrapDialog> {
const SizedBox(height: 16), const SizedBox(height: 16),
ElevatedButton.icon( ElevatedButton.icon(
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
foregroundColor: foregroundColor: theme.colorScheme.onPrimary,
Theme.of(context).colorScheme.onPrimary, backgroundColor: theme.colorScheme.primary,
backgroundColor: Theme.of(context).colorScheme.primary,
), ),
icon: _recoveryKeyInputLoading icon: _recoveryKeyInputLoading
? const CircularProgressIndicator.adaptive() ? const CircularProgressIndicator.adaptive()
@ -386,10 +385,8 @@ class BootstrapDialogState extends State<BootstrapDialog> {
const SizedBox(height: 16), const SizedBox(height: 16),
ElevatedButton.icon( ElevatedButton.icon(
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
backgroundColor: backgroundColor: theme.colorScheme.errorContainer,
Theme.of(context).colorScheme.errorContainer, foregroundColor: theme.colorScheme.onErrorContainer,
foregroundColor:
Theme.of(context).colorScheme.onErrorContainer,
), ),
icon: const Icon(Icons.delete_outlined), icon: const Icon(Icons.delete_outlined),
label: Text(L10n.of(context)!.recoveryKeyLost), label: Text(L10n.of(context)!.recoveryKeyLost),

@ -1313,7 +1313,9 @@ class ChatController extends State<ChatPageWithRoom>
} }
@override @override
Widget build(BuildContext context) => Row( Widget build(BuildContext context) {
final theme = Theme.of(context);
return Row(
children: [ children: [
Expanded( Expanded(
child: ChatView(this), child: ChatView(this),
@ -1339,7 +1341,7 @@ class ChatController extends State<ChatPageWithRoom>
border: Border( border: Border(
left: BorderSide( left: BorderSide(
width: 1, width: 1,
color: Theme.of(context).dividerColor, color: theme.dividerColor,
), ),
), ),
), ),
@ -1356,6 +1358,7 @@ class ChatController extends State<ChatPageWithRoom>
), ),
], ],
); );
}
} }
enum EmojiPickerType { reaction, keyboard } enum EmojiPickerType { reaction, keyboard }

@ -22,6 +22,7 @@ class ChatAppBarListTile extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final theme = Theme.of(context);
final leading = this.leading; final leading = this.leading;
final trailing = this.trailing; final trailing = this.trailing;
return SizedBox( return SizedBox(
@ -40,16 +41,15 @@ class ChatAppBarListTile extends StatelessWidget {
maxLines: 1, maxLines: 1,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
style: TextStyle( style: TextStyle(
color: Theme.of(context).colorScheme.onSurfaceVariant, color: theme.colorScheme.onSurfaceVariant,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
fontSize: 14, fontSize: 14,
), ),
linkStyle: TextStyle( linkStyle: TextStyle(
color: Theme.of(context).colorScheme.onSurfaceVariant, color: theme.colorScheme.onSurfaceVariant,
fontSize: 14, fontSize: 14,
decoration: TextDecoration.underline, decoration: TextDecoration.underline,
decorationColor: decorationColor: theme.colorScheme.onSurfaceVariant,
Theme.of(context).colorScheme.onSurfaceVariant,
), ),
onOpen: (url) => UrlLauncher(context, url.url).launchUrl(), onOpen: (url) => UrlLauncher(context, url.url).launchUrl(),
), ),

@ -43,9 +43,8 @@ class ChatEmojiPicker extends StatelessWidget {
config: Config( config: Config(
emojiViewConfig: EmojiViewConfig( emojiViewConfig: EmojiViewConfig(
noRecents: const NoRecent(), noRecents: const NoRecent(),
backgroundColor: Theme.of(context) backgroundColor:
.colorScheme theme.colorScheme.onInverseSurface,
.onInverseSurface,
), ),
bottomActionBarConfig: const BottomActionBarConfig( bottomActionBarConfig: const BottomActionBarConfig(
enabled: false, enabled: false,

@ -21,6 +21,7 @@ class ChatInputRow extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final theme = Theme.of(context);
if (controller.showEmojiPicker && if (controller.showEmojiPicker &&
controller.emojiPickerType == EmojiPickerType.reaction) { controller.emojiPickerType == EmojiPickerType.reaction) {
return const SizedBox.shrink(); return const SizedBox.shrink();
@ -37,7 +38,7 @@ class ChatInputRow extends StatelessWidget {
height: height, height: height,
child: TextButton( child: TextButton(
style: TextButton.styleFrom( style: TextButton.styleFrom(
foregroundColor: Theme.of(context).colorScheme.error, foregroundColor: theme.colorScheme.error,
), ),
onPressed: controller.deleteErrorEventsAction, onPressed: controller.deleteErrorEventsAction,
child: Row( child: Row(
@ -278,9 +279,8 @@ class ChatInputRow extends StatelessWidget {
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(height), borderRadius: BorderRadius.circular(height),
), ),
backgroundColor: Theme.of(context).colorScheme.primary, backgroundColor: theme.colorScheme.primary,
foregroundColor: foregroundColor: theme.colorScheme.onPrimary,
Theme.of(context).colorScheme.onPrimary,
child: const Icon(Icons.mic_none_outlined), child: const Icon(Icons.mic_none_outlined),
) )
: FloatingActionButton.small( : FloatingActionButton.small(
@ -291,10 +291,8 @@ class ChatInputRow extends StatelessWidget {
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(height), borderRadius: BorderRadius.circular(height),
), ),
backgroundColor: backgroundColor: theme.colorScheme.onPrimaryContainer,
Theme.of(context).colorScheme.onPrimaryContainer, foregroundColor: theme.colorScheme.onPrimary,
foregroundColor:
Theme.of(context).colorScheme.onPrimary,
child: const Icon(Icons.send_outlined), child: const Icon(Icons.send_outlined),
), ),
), ),

@ -128,6 +128,7 @@ class ChatView extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final theme = Theme.of(context);
if (controller.room.membership == Membership.invite) { if (controller.room.membership == Membership.invite) {
showFutureLoadingDialog( showFutureLoadingDialog(
context: context, context: context,
@ -173,14 +174,14 @@ class ChatView extends StatelessWidget {
actionsIconTheme: IconThemeData( actionsIconTheme: IconThemeData(
color: controller.selectedEvents.isEmpty color: controller.selectedEvents.isEmpty
? null ? null
: Theme.of(context).colorScheme.primary, : theme.colorScheme.primary,
), ),
leading: controller.selectMode leading: controller.selectMode
? IconButton( ? IconButton(
icon: const Icon(Icons.close), icon: const Icon(Icons.close),
onPressed: controller.clearSelectedEvents, onPressed: controller.clearSelectedEvents,
tooltip: L10n.of(context)!.close, tooltip: L10n.of(context)!.close,
color: Theme.of(context).colorScheme.primary, color: theme.colorScheme.primary,
) )
: StreamBuilder<Object>( : StreamBuilder<Object>(
stream: Matrix.of(context) stream: Matrix.of(context)
@ -218,8 +219,7 @@ class ChatView extends StatelessWidget {
if (scrollUpBannerEventId != null) if (scrollUpBannerEventId != null)
ChatAppBarListTile( ChatAppBarListTile(
leading: IconButton( leading: IconButton(
color: color: theme.colorScheme.onSurfaceVariant,
Theme.of(context).colorScheme.onSurfaceVariant,
icon: const Icon(Icons.close), icon: const Icon(Icons.close),
tooltip: L10n.of(context)!.close, tooltip: L10n.of(context)!.close,
onPressed: () { onPressed: () {
@ -308,7 +308,7 @@ class ChatView extends StatelessWidget {
alignment: Alignment.center, alignment: Alignment.center,
child: Material( child: Material(
clipBehavior: Clip.hardEdge, clipBehavior: Clip.hardEdge,
color: Theme.of(context) color: theme
.colorScheme .colorScheme
// ignore: deprecated_member_use // ignore: deprecated_member_use
.surfaceVariant, .surfaceVariant,
@ -325,9 +325,8 @@ class ChatView extends StatelessWidget {
padding: const EdgeInsets.all( padding: const EdgeInsets.all(
16, 16,
), ),
foregroundColor: Theme.of(context) foregroundColor:
.colorScheme theme.colorScheme.error,
.error,
), ),
icon: const Icon( icon: const Icon(
Icons.archive_outlined, Icons.archive_outlined,
@ -370,9 +369,7 @@ class ChatView extends StatelessWidget {
), ),
if (controller.dragging) if (controller.dragging)
Container( Container(
color: Theme.of(context) color: theme.scaffoldBackgroundColor.withOpacity(0.9),
.scaffoldBackgroundColor
.withOpacity(0.9),
alignment: Alignment.center, alignment: Alignment.center,
child: const Icon( child: const Icon(
Icons.upload_outlined, Icons.upload_outlined,

@ -36,6 +36,7 @@ class EventInfoDialog extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final theme = Theme.of(context);
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
title: Text(L10n.of(context)!.messageInfo), title: Text(L10n.of(context)!.messageInfo),
@ -72,14 +73,14 @@ class EventInfoDialog extends StatelessWidget {
padding: const EdgeInsets.all(12.0), padding: const EdgeInsets.all(12.0),
child: Material( child: Material(
borderRadius: BorderRadius.circular(AppConfig.borderRadius), borderRadius: BorderRadius.circular(AppConfig.borderRadius),
color: Theme.of(context).colorScheme.inverseSurface, color: theme.colorScheme.inverseSurface,
child: SingleChildScrollView( child: SingleChildScrollView(
padding: const EdgeInsets.all(8), padding: const EdgeInsets.all(8),
scrollDirection: Axis.horizontal, scrollDirection: Axis.horizontal,
child: SelectableText( child: SelectableText(
prettyJson, prettyJson,
style: TextStyle( style: TextStyle(
color: Theme.of(context).colorScheme.onInverseSurface, color: theme.colorScheme.onInverseSurface,
), ),
), ),
), ),

@ -218,6 +218,8 @@ class AudioPlayerState extends State<AudioPlayerWidget> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final theme = Theme.of(context);
final statusText = this.statusText ??= _durationString ?? '00:00'; final statusText = this.statusText ??= _durationString ?? '00:00';
final audioPlayer = this.audioPlayer; final audioPlayer = this.audioPlayer;
return Padding( return Padding(
@ -304,8 +306,8 @@ class AudioPlayerState extends State<AudioPlayerWidget> {
: Text( : Text(
'${audioPlayer.speed.toString()}x', '${audioPlayer.speed.toString()}x',
), ),
backgroundColor: Theme.of(context).colorScheme.secondary, backgroundColor: theme.colorScheme.secondary,
textColor: Theme.of(context).colorScheme.onSecondary, textColor: theme.colorScheme.onSecondary,
child: InkWell( child: InkWell(
splashColor: widget.color.withAlpha(128), splashColor: widget.color.withAlpha(128),
borderRadius: BorderRadius.circular(64), borderRadius: BorderRadius.circular(64),

@ -67,6 +67,8 @@ class ImageBubble extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final theme = Theme.of(context);
final borderRadius = final borderRadius =
this.borderRadius ?? BorderRadius.circular(AppConfig.borderRadius); this.borderRadius ?? BorderRadius.circular(AppConfig.borderRadius);
return Material( return Material(
@ -77,7 +79,7 @@ class ImageBubble extends StatelessWidget {
side: BorderSide( side: BorderSide(
color: event.messageType == MessageTypes.Sticker color: event.messageType == MessageTypes.Sticker
? Colors.transparent ? Colors.transparent
: Theme.of(context).dividerColor, : theme.dividerColor,
), ),
), ),
child: InkWell( child: InkWell(

@ -22,6 +22,8 @@ class MapBubble extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final theme = Theme.of(context);
return ClipRRect( return ClipRRect(
borderRadius: BorderRadius.circular(radius), borderRadius: BorderRadius.circular(radius),
child: Container( child: Container(
@ -72,11 +74,10 @@ class MapBubble extends StatelessWidget {
child: Text( child: Text(
' © OpenStreetMap contributors ', ' © OpenStreetMap contributors ',
style: TextStyle( style: TextStyle(
color: Theme.of(context).brightness == Brightness.dark color: theme.brightness == Brightness.dark
? Colors.white ? Colors.white
: Colors.black, : Colors.black,
backgroundColor: backgroundColor: theme.appBarTheme.backgroundColor,
Theme.of(context).appBarTheme.backgroundColor,
), ),
), ),
), ),

@ -57,6 +57,8 @@ class Message extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final theme = Theme.of(context);
if (!{ if (!{
EventTypes.Message, EventTypes.Message,
EventTypes.Sticker, EventTypes.Sticker,
@ -78,7 +80,7 @@ class Message extends StatelessWidget {
final ownMessage = event.senderId == client.userID; final ownMessage = event.senderId == client.userID;
final alignment = ownMessage ? Alignment.topRight : Alignment.topLeft; final alignment = ownMessage ? Alignment.topRight : Alignment.topLeft;
// ignore: deprecated_member_use // ignore: deprecated_member_use
var color = Theme.of(context).colorScheme.surfaceVariant; var color = theme.colorScheme.surfaceVariant;
final displayTime = event.type == EventTypes.RoomCreate || final displayTime = event.type == EventTypes.RoomCreate ||
nextEvent == null || nextEvent == null ||
!event.originServerTs.sameEnvironment(nextEvent!.originServerTs); !event.originServerTs.sameEnvironment(nextEvent!.originServerTs);
@ -100,9 +102,8 @@ class Message extends StatelessWidget {
previousEvent!.senderId == event.senderId && previousEvent!.senderId == event.senderId &&
previousEvent!.originServerTs.sameEnvironment(event.originServerTs); previousEvent!.originServerTs.sameEnvironment(event.originServerTs);
final textColor = ownMessage final textColor =
? Theme.of(context).colorScheme.onPrimary ownMessage ? theme.colorScheme.onPrimary : theme.colorScheme.onSurface;
: Theme.of(context).colorScheme.onSurface;
final rowMainAxisAlignment = final rowMainAxisAlignment =
ownMessage ? MainAxisAlignment.end : MainAxisAlignment.start; ownMessage ? MainAxisAlignment.end : MainAxisAlignment.start;
@ -131,7 +132,7 @@ class Message extends StatelessWidget {
if (ownMessage) { if (ownMessage) {
color = displayEvent.status.isError color = displayEvent.status.isError
? Colors.redAccent ? Colors.redAccent
: Theme.of(context).colorScheme.primary; : theme.colorScheme.primary;
} }
final resetAnimateIn = this.resetAnimateIn; final resetAnimateIn = this.resetAnimateIn;
@ -168,14 +169,10 @@ class Message extends StatelessWidget {
borderRadius: borderRadius:
BorderRadius.circular(AppConfig.borderRadius / 2), BorderRadius.circular(AppConfig.borderRadius / 2),
color: selected color: selected
? Theme.of(context) ? theme.colorScheme.secondaryContainer
.colorScheme
.secondaryContainer
.withAlpha(100) .withAlpha(100)
: highlightMarker : highlightMarker
? Theme.of(context) ? theme.colorScheme.tertiaryContainer
.colorScheme
.tertiaryContainer
.withAlpha(100) .withAlpha(100)
: Colors.transparent, : Colors.transparent,
), ),
@ -253,8 +250,7 @@ class Message extends StatelessWidget {
displayname, displayname,
style: TextStyle( style: TextStyle(
fontSize: 12, fontSize: 12,
color: (Theme.of(context) color: (theme.brightness ==
.brightness ==
Brightness.light Brightness.light
? displayname.color ? displayname.color
: displayname : displayname
@ -442,10 +438,10 @@ class Message extends StatelessWidget {
style: TextStyle( style: TextStyle(
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
fontSize: 12 * AppConfig.fontSizeFactor, fontSize: 12 * AppConfig.fontSizeFactor,
color: Theme.of(context).colorScheme.secondary, color: theme.colorScheme.secondary,
shadows: [ shadows: [
Shadow( Shadow(
color: Theme.of(context).colorScheme.surface, color: theme.colorScheme.surface,
blurRadius: 3, blurRadius: 3,
), ),
], ],
@ -473,14 +469,14 @@ class Message extends StatelessWidget {
Row( Row(
children: [ children: [
Expanded( Expanded(
child: Divider(color: Theme.of(context).colorScheme.primary), child: Divider(color: theme.colorScheme.primary),
), ),
Container( Container(
decoration: BoxDecoration( decoration: BoxDecoration(
border: Border.all( border: Border.all(
color: Theme.of(context).colorScheme.primary, color: theme.colorScheme.primary,
), ),
color: Theme.of(context).colorScheme.primaryContainer, color: theme.colorScheme.primaryContainer,
borderRadius: BorderRadius.circular(4), borderRadius: BorderRadius.circular(4),
), ),
margin: const EdgeInsets.all(8.0), margin: const EdgeInsets.all(8.0),
@ -489,12 +485,11 @@ class Message extends StatelessWidget {
), ),
child: Text( child: Text(
L10n.of(context)!.readUpToHere, L10n.of(context)!.readUpToHere,
style: style: TextStyle(color: theme.colorScheme.primary),
TextStyle(color: Theme.of(context).colorScheme.primary),
), ),
), ),
Expanded( Expanded(
child: Divider(color: Theme.of(context).colorScheme.primary), child: Divider(color: theme.colorScheme.primary),
), ),
], ],
), ),

@ -108,10 +108,10 @@ class _Reaction extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final textColor = Theme.of(context).brightness == Brightness.dark final theme = Theme.of(context);
? Colors.white final textColor =
: Colors.black; theme.brightness == Brightness.dark ? Colors.white : Colors.black;
final color = Theme.of(context).colorScheme.surface; final color = theme.colorScheme.surface;
Widget content; Widget content;
if (reactionKey.startsWith('mxc://')) { if (reactionKey.startsWith('mxc://')) {
content = Row( content = Row(
@ -158,8 +158,8 @@ class _Reaction extends StatelessWidget {
border: Border.all( border: Border.all(
width: 1, width: 1,
color: reacted! color: reacted!
? Theme.of(context).colorScheme.primary ? theme.colorScheme.primary
: Theme.of(context).colorScheme.primaryContainer, : theme.colorScheme.primaryContainer,
), ),
borderRadius: BorderRadius.circular(AppConfig.borderRadius / 2), borderRadius: BorderRadius.circular(AppConfig.borderRadius / 2),
), ),

@ -27,20 +27,19 @@ class ReplyContent extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final theme = Theme.of(context);
final timeline = this.timeline; final timeline = this.timeline;
final displayEvent = final displayEvent =
timeline != null ? replyEvent.getDisplayEvent(timeline) : replyEvent; timeline != null ? replyEvent.getDisplayEvent(timeline) : replyEvent;
final fontSize = AppConfig.messageFontSize * AppConfig.fontSizeFactor; final fontSize = AppConfig.messageFontSize * AppConfig.fontSizeFactor;
final color = ownMessage final color = ownMessage
? Theme.of(context).colorScheme.primaryContainer ? theme.colorScheme.primaryContainer
: Theme.of(context).colorScheme.primary; : theme.colorScheme.primary;
return Material( return Material(
color: backgroundColor ?? color: backgroundColor ??
Theme.of(context) theme.colorScheme.surface.withOpacity(ownMessage ? 0.2 : 0.33),
.colorScheme
.surface
.withOpacity(ownMessage ? 0.2 : 0.33),
borderRadius: borderRadius, borderRadius: borderRadius,
child: Row( child: Row(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
@ -81,8 +80,8 @@ class ReplyContent extends StatelessWidget {
maxLines: 1, maxLines: 1,
style: TextStyle( style: TextStyle(
color: ownMessage color: ownMessage
? Theme.of(context).colorScheme.onPrimary ? theme.colorScheme.onPrimary
: Theme.of(context).colorScheme.onSurface, : theme.colorScheme.onSurface,
fontSize: fontSize, fontSize: fontSize,
), ),
), ),

@ -12,6 +12,8 @@ class StateMessage extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final theme = Theme.of(context);
return Padding( return Padding(
padding: const EdgeInsets.symmetric(horizontal: 8.0), padding: const EdgeInsets.symmetric(horizontal: 8.0),
child: Center( child: Center(
@ -27,7 +29,7 @@ class StateMessage extends StatelessWidget {
decoration: event.redacted ? TextDecoration.lineThrough : null, decoration: event.redacted ? TextDecoration.lineThrough : null,
shadows: [ shadows: [
Shadow( Shadow(
color: Theme.of(context).colorScheme.surface, color: theme.colorScheme.surface,
blurRadius: 3, blurRadius: 3,
), ),
], ],

@ -17,6 +17,8 @@ class VerificationRequestContent extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final theme = Theme.of(context);
final events = event.aggregatedEvents(timeline, 'm.reference'); final events = event.aggregatedEvents(timeline, 'm.reference');
final done = events.where((e) => e.type == EventTypes.KeyVerificationDone); final done = events.where((e) => e.type == EventTypes.KeyVerificationDone);
final start = final start =
@ -36,10 +38,10 @@ class VerificationRequestContent extends StatelessWidget {
padding: const EdgeInsets.all(8), padding: const EdgeInsets.all(8),
decoration: BoxDecoration( decoration: BoxDecoration(
border: Border.all( border: Border.all(
color: Theme.of(context).dividerColor, color: theme.dividerColor,
), ),
borderRadius: BorderRadius.circular(AppConfig.borderRadius), borderRadius: BorderRadius.circular(AppConfig.borderRadius),
color: Theme.of(context).colorScheme.surface, color: theme.colorScheme.surface,
), ),
child: Row( child: Row(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,

@ -96,6 +96,8 @@ class EventVideoPlayerState extends State<EventVideoPlayer> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final theme = Theme.of(context);
final hasThumbnail = widget.event.hasThumbnail; final hasThumbnail = widget.event.hasThumbnail;
final blurHash = (widget.event.infoMap as Map<String, dynamic>) final blurHash = (widget.event.infoMap as Map<String, dynamic>)
.tryGet<String>('xyz.amorgan.blurhash') ?? .tryGet<String>('xyz.amorgan.blurhash') ??
@ -123,7 +125,7 @@ class EventVideoPlayerState extends State<EventVideoPlayer> {
Center( Center(
child: IconButton( child: IconButton(
style: IconButton.styleFrom( style: IconButton.styleFrom(
backgroundColor: Theme.of(context).colorScheme.surface, backgroundColor: theme.colorScheme.surface,
), ),
icon: _isDownloading icon: _isDownloading
? const SizedBox( ? const SizedBox(

@ -221,6 +221,7 @@ class InputBar extends StatelessWidget {
Map<String, String?> suggestion, Map<String, String?> suggestion,
Client? client, Client? client,
) { ) {
final theme = Theme.of(context);
const size = 30.0; const size = 30.0;
const padding = EdgeInsets.all(4.0); const padding = EdgeInsets.all(4.0);
if (suggestion['type'] == 'command') { if (suggestion['type'] == 'command') {
@ -242,7 +243,7 @@ class InputBar extends StatelessWidget {
hint, hint,
maxLines: 1, maxLines: 1,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
style: Theme.of(context).textTheme.bodySmall, style: theme.textTheme.bodySmall,
), ),
], ],
), ),

@ -53,6 +53,8 @@ class PinnedEvents extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final theme = Theme.of(context);
final pinnedEventIds = controller.room.pinnedEventIds; final pinnedEventIds = controller.room.pinnedEventIds;
if (pinnedEventIds.isEmpty) { if (pinnedEventIds.isEmpty) {
@ -73,7 +75,7 @@ class PinnedEvents extends StatelessWidget {
leading: IconButton( leading: IconButton(
splashRadius: 18, splashRadius: 18,
iconSize: 18, iconSize: 18,
color: Theme.of(context).colorScheme.onSurfaceVariant, color: theme.colorScheme.onSurfaceVariant,
icon: const Icon(Icons.push_pin), icon: const Icon(Icons.push_pin),
tooltip: L10n.of(context)!.unpin, tooltip: L10n.of(context)!.unpin,
onPressed: controller.room.canSendEvent(EventTypes.RoomPinnedEvents) onPressed: controller.room.canSendEvent(EventTypes.RoomPinnedEvents)

@ -15,6 +15,8 @@ class ReactionsPicker extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final theme = Theme.of(context);
if (controller.showEmojiPicker) return const SizedBox.shrink(); if (controller.showEmojiPicker) return const SizedBox.shrink();
final display = controller.editEvent == null && final display = controller.editEvent == null &&
controller.replyEvent == null && controller.replyEvent == null &&
@ -60,7 +62,7 @@ class ReactionsPicker extends StatelessWidget {
Expanded( Expanded(
child: Container( child: Container(
decoration: BoxDecoration( decoration: BoxDecoration(
color: Theme.of(context).colorScheme.onInverseSurface, color: theme.colorScheme.onInverseSurface,
borderRadius: const BorderRadius.only( borderRadius: const BorderRadius.only(
bottomRight: Radius.circular(AppConfig.borderRadius), bottomRight: Radius.circular(AppConfig.borderRadius),
), ),
@ -92,7 +94,7 @@ class ReactionsPicker extends StatelessWidget {
width: 36, width: 36,
height: 56, height: 56,
decoration: BoxDecoration( decoration: BoxDecoration(
color: Theme.of(context).colorScheme.onInverseSurface, color: theme.colorScheme.onInverseSurface,
shape: BoxShape.circle, shape: BoxShape.circle,
), ),
child: const Icon(Icons.add_outlined), child: const Icon(Icons.add_outlined),

@ -131,6 +131,8 @@ class RecordingDialogState extends State<RecordingDialog> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final theme = Theme.of(context);
const maxDecibalWidth = 64.0; const maxDecibalWidth = 64.0;
final time = final time =
'${_duration.inMinutes.toString().padLeft(2, '0')}:${(_duration.inSeconds % 60).toString().padLeft(2, '0')}'; '${_duration.inMinutes.toString().padLeft(2, '0')}:${(_duration.inSeconds % 60).toString().padLeft(2, '0')}';
@ -159,7 +161,7 @@ class RecordingDialogState extends State<RecordingDialog> {
margin: const EdgeInsets.only(left: 2), margin: const EdgeInsets.only(left: 2),
width: 4, width: 4,
decoration: BoxDecoration( decoration: BoxDecoration(
color: Theme.of(context).colorScheme.primary, color: theme.colorScheme.primary,
borderRadius: borderRadius:
BorderRadius.circular(AppConfig.borderRadius), BorderRadius.circular(AppConfig.borderRadius),
), ),
@ -185,11 +187,7 @@ class RecordingDialogState extends State<RecordingDialog> {
child: Text( child: Text(
L10n.of(context)!.cancel.toUpperCase(), L10n.of(context)!.cancel.toUpperCase(),
style: TextStyle( style: TextStyle(
color: Theme.of(context) color: theme.textTheme.bodyMedium?.color?.withAlpha(150),
.textTheme
.bodyMedium
?.color
?.withAlpha(150),
), ),
), ),
), ),
@ -209,8 +207,7 @@ class RecordingDialogState extends State<RecordingDialog> {
child: Text( child: Text(
L10n.of(context)!.cancel.toUpperCase(), L10n.of(context)!.cancel.toUpperCase(),
style: TextStyle( style: TextStyle(
color: color: theme.textTheme.bodyMedium?.color?.withAlpha(150),
Theme.of(context).textTheme.bodyMedium?.color?.withAlpha(150),
), ),
), ),
), ),

@ -14,6 +14,8 @@ class ReplyDisplay extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final theme = Theme.of(context);
return AnimatedContainer( return AnimatedContainer(
duration: FluffyThemes.animationDuration, duration: FluffyThemes.animationDuration,
curve: FluffyThemes.animationCurve, curve: FluffyThemes.animationCurve,
@ -22,7 +24,7 @@ class ReplyDisplay extends StatelessWidget {
: 0, : 0,
clipBehavior: Clip.hardEdge, clipBehavior: Clip.hardEdge,
decoration: BoxDecoration( decoration: BoxDecoration(
color: Theme.of(context).colorScheme.onInverseSurface, color: theme.colorScheme.onInverseSurface,
), ),
child: Row( child: Row(
children: <Widget>[ children: <Widget>[
@ -55,6 +57,7 @@ class _EditContent extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final theme = Theme.of(context);
final event = this.event; final event = this.event;
if (event == null) { if (event == null) {
return const SizedBox.shrink(); return const SizedBox.shrink();
@ -63,7 +66,7 @@ class _EditContent extends StatelessWidget {
children: <Widget>[ children: <Widget>[
Icon( Icon(
Icons.edit, Icons.edit,
color: Theme.of(context).colorScheme.primary, color: theme.colorScheme.primary,
), ),
Container(width: 15.0), Container(width: 15.0),
Text( Text(
@ -75,7 +78,7 @@ class _EditContent extends StatelessWidget {
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
maxLines: 1, maxLines: 1,
style: TextStyle( style: TextStyle(
color: Theme.of(context).textTheme.bodyMedium!.color, color: theme.textTheme.bodyMedium!.color,
), ),
), ),
], ],

@ -12,6 +12,8 @@ class SeenByRow extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final theme = Theme.of(context);
final seenByUsers = controller.room.getSeenByUsers(controller.timeline!); final seenByUsers = controller.room.getSeenByUsers(controller.timeline!);
const maxAvatars = 7; const maxAvatars = 7;
return Container( return Container(
@ -49,7 +51,7 @@ class SeenByRow extends StatelessWidget {
width: 16, width: 16,
height: 16, height: 16,
child: Material( child: Material(
color: Theme.of(context).colorScheme.surface, color: theme.colorScheme.surface,
borderRadius: BorderRadius.circular(32), borderRadius: BorderRadius.circular(32),
child: Center( child: Center(
child: Text( child: Text(

@ -66,6 +66,8 @@ class SendFileDialogState extends State<SendFileDialog> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final theme = Theme.of(context);
var sendStr = L10n.of(context)!.sendFile; var sendStr = L10n.of(context)!.sendFile;
final allFilesAreImages = final allFilesAreImages =
widget.files.every((file) => file is MatrixImageFile); widget.files.every((file) => file is MatrixImageFile);
@ -91,9 +93,8 @@ class SendFileDialogState extends State<SendFileDialog> {
Flexible( Flexible(
child: Material( child: Material(
borderRadius: BorderRadius.circular(AppConfig.borderRadius), borderRadius: BorderRadius.circular(AppConfig.borderRadius),
elevation: elevation: theme.appBarTheme.scrolledUnderElevation ?? 4,
Theme.of(context).appBarTheme.scrolledUnderElevation ?? 4, shadowColor: theme.appBarTheme.shadowColor,
shadowColor: Theme.of(context).appBarTheme.shadowColor,
clipBehavior: Clip.hardEdge, clipBehavior: Clip.hardEdge,
child: Image.memory( child: Image.memory(
widget.files.first.bytes, widget.files.first.bytes,

@ -27,6 +27,8 @@ class StickerPickerDialogState extends State<StickerPickerDialog> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final theme = Theme.of(context);
final stickerPacks = widget.room.getImagePacks(ImagePackUsage.sticker); final stickerPacks = widget.room.getImagePacks(ImagePackUsage.sticker);
final packSlugs = stickerPacks.keys.toList(); final packSlugs = stickerPacks.keys.toList();
@ -100,7 +102,7 @@ class StickerPickerDialogState extends State<StickerPickerDialog> {
}; };
return Scaffold( return Scaffold(
backgroundColor: Theme.of(context).colorScheme.onInverseSurface, backgroundColor: theme.colorScheme.onInverseSurface,
body: SizedBox( body: SizedBox(
width: double.maxFinite, width: double.maxFinite,
child: CustomScrollView( child: CustomScrollView(

@ -14,6 +14,8 @@ class TypingIndicators extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final theme = Theme.of(context);
const avatarSize = Avatar.defaultSize / 2; const avatarSize = Avatar.defaultSize / 2;
return StreamBuilder<Object>( return StreamBuilder<Object>(
@ -81,7 +83,7 @@ class TypingIndicators extends StatelessWidget {
Material( Material(
color: color:
// ignore: deprecated_member_use // ignore: deprecated_member_use
Theme.of(context).colorScheme.surfaceVariant, theme.colorScheme.surfaceVariant,
borderRadius: const BorderRadius.all( borderRadius: const BorderRadius.all(
Radius.circular(AppConfig.borderRadius), Radius.circular(AppConfig.borderRadius),
), ),
@ -137,6 +139,7 @@ class __TypingDotsState extends State<_TypingDots> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final theme = Theme.of(context);
const size = 8.0; const size = 8.0;
return Row( return Row(
@ -154,7 +157,7 @@ class __TypingDotsState extends State<_TypingDots> {
), ),
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(size * 2), borderRadius: BorderRadius.circular(size * 2),
color: Theme.of(context).colorScheme.secondary, color: theme.colorScheme.secondary,
), ),
), ),
], ],

@ -14,6 +14,8 @@ class ChatAccessSettingsPageView extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final theme = Theme.of(context);
final room = controller.room; final room = controller.room;
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
@ -38,7 +40,7 @@ class ChatAccessSettingsPageView extends StatelessWidget {
title: Text( title: Text(
L10n.of(context)!.visibilityOfTheChatHistory, L10n.of(context)!.visibilityOfTheChatHistory,
style: TextStyle( style: TextStyle(
color: Theme.of(context).colorScheme.secondary, color: theme.colorScheme.secondary,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
), ),
@ -56,12 +58,12 @@ class ChatAccessSettingsPageView extends StatelessWidget {
? null ? null
: controller.setHistoryVisibility, : controller.setHistoryVisibility,
), ),
Divider(color: Theme.of(context).dividerColor), Divider(color: theme.dividerColor),
ListTile( ListTile(
title: Text( title: Text(
L10n.of(context)!.whoIsAllowedToJoinThisGroup, L10n.of(context)!.whoIsAllowedToJoinThisGroup,
style: TextStyle( style: TextStyle(
color: Theme.of(context).colorScheme.secondary, color: theme.colorScheme.secondary,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
), ),
@ -79,14 +81,14 @@ class ChatAccessSettingsPageView extends StatelessWidget {
? null ? null
: controller.setJoinRule, : controller.setJoinRule,
), ),
Divider(color: Theme.of(context).dividerColor), Divider(color: theme.dividerColor),
if ({JoinRules.public, JoinRules.knock} if ({JoinRules.public, JoinRules.knock}
.contains(room.joinRules)) ...[ .contains(room.joinRules)) ...[
ListTile( ListTile(
title: Text( title: Text(
L10n.of(context)!.areGuestsAllowedToJoin, L10n.of(context)!.areGuestsAllowedToJoin,
style: TextStyle( style: TextStyle(
color: Theme.of(context).colorScheme.secondary, color: theme.colorScheme.secondary,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
), ),
@ -105,12 +107,12 @@ class ChatAccessSettingsPageView extends StatelessWidget {
? null ? null
: controller.setGuestAccess, : controller.setGuestAccess,
), ),
Divider(color: Theme.of(context).dividerColor), Divider(color: theme.dividerColor),
ListTile( ListTile(
title: Text( title: Text(
L10n.of(context)!.publicChatAddresses, L10n.of(context)!.publicChatAddresses,
style: TextStyle( style: TextStyle(
color: Theme.of(context).colorScheme.secondary, color: theme.colorScheme.secondary,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
), ),
@ -163,7 +165,7 @@ class ChatAccessSettingsPageView extends StatelessWidget {
); );
}, },
), ),
Divider(color: Theme.of(context).dividerColor), Divider(color: theme.dividerColor),
FutureBuilder( FutureBuilder(
future: room.client.getRoomVisibilityOnDirectory(room.id), future: room.client.getRoomVisibilityOnDirectory(room.id),
builder: (context, snapshot) => SwitchListTile.adaptive( builder: (context, snapshot) => SwitchListTile.adaptive(
@ -225,6 +227,8 @@ class _AliasListTile extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final theme = Theme.of(context);
return ListTile( return ListTile(
leading: isCanonicalAlias leading: isCanonicalAlias
? const Icon(Icons.star) ? const Icon(Icons.star)
@ -238,15 +242,15 @@ class _AliasListTile extends StatelessWidget {
'https://matrix.to/#/$alias', 'https://matrix.to/#/$alias',
style: TextStyle( style: TextStyle(
decoration: TextDecoration.underline, decoration: TextDecoration.underline,
decorationColor: Theme.of(context).colorScheme.primary, decorationColor: theme.colorScheme.primary,
color: Theme.of(context).colorScheme.primary, color: theme.colorScheme.primary,
fontSize: 14, fontSize: 14,
), ),
), ),
), ),
trailing: onDelete != null trailing: onDelete != null
? IconButton( ? IconButton(
color: Theme.of(context).colorScheme.error, color: theme.colorScheme.error,
icon: const Icon(Icons.delete_outlined), icon: const Icon(Icons.delete_outlined),
onPressed: onDelete, onPressed: onDelete,
) )

@ -23,6 +23,8 @@ class ChatDetailsView extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final theme = Theme.of(context);
final room = Matrix.of(context).client.getRoomById(controller.roomId!); final room = Matrix.of(context).client.getRoomById(controller.roomId!);
if (room == null) { if (room == null) {
return Scaffold( return Scaffold(
@ -45,7 +47,7 @@ class ChatDetailsView extends StatelessWidget {
final actualMembersCount = (room.summary.mInvitedMemberCount ?? 0) + final actualMembersCount = (room.summary.mInvitedMemberCount ?? 0) +
(room.summary.mJoinedMemberCount ?? 0); (room.summary.mJoinedMemberCount ?? 0);
final canRequestMoreMembers = members.length < actualMembersCount; final canRequestMoreMembers = members.length < actualMembersCount;
final iconColor = Theme.of(context).textTheme.bodyLarge!.color; final iconColor = theme.textTheme.bodyLarge!.color;
final displayname = room.getLocalizedDisplayname( final displayname = room.getLocalizedDisplayname(
MatrixLocals(L10n.of(context)!), MatrixLocals(L10n.of(context)!),
); );
@ -53,7 +55,7 @@ class ChatDetailsView extends StatelessWidget {
appBar: AppBar( appBar: AppBar(
leading: controller.widget.embeddedCloseButton ?? leading: controller.widget.embeddedCloseButton ??
const Center(child: BackButton()), const Center(child: BackButton()),
elevation: Theme.of(context).appBarTheme.elevation, elevation: theme.appBarTheme.elevation,
actions: <Widget>[ actions: <Widget>[
if (room.canonicalAlias.isNotEmpty) if (room.canonicalAlias.isNotEmpty)
IconButton( IconButton(
@ -68,7 +70,7 @@ class ChatDetailsView extends StatelessWidget {
ChatSettingsPopupMenu(room, false), ChatSettingsPopupMenu(room, false),
], ],
title: Text(L10n.of(context)!.chatDetails), title: Text(L10n.of(context)!.chatDetails),
backgroundColor: Theme.of(context).appBarTheme.backgroundColor, backgroundColor: theme.appBarTheme.backgroundColor,
), ),
body: MaxWidthBody( body: MaxWidthBody(
child: ListView.builder( child: ListView.builder(
@ -143,9 +145,8 @@ class ChatDetailsView extends StatelessWidget {
size: 16, size: 16,
), ),
style: TextButton.styleFrom( style: TextButton.styleFrom(
foregroundColor: Theme.of(context) foregroundColor:
.colorScheme theme.colorScheme.onSurface,
.onSurface,
), ),
label: Text( label: Text(
room.isDirectChat room.isDirectChat
@ -167,9 +168,8 @@ class ChatDetailsView extends StatelessWidget {
size: 14, size: 14,
), ),
style: TextButton.styleFrom( style: TextButton.styleFrom(
foregroundColor: Theme.of(context) foregroundColor:
.colorScheme theme.colorScheme.secondary,
.secondary,
), ),
label: Text( label: Text(
L10n.of(context)!.countParticipants( L10n.of(context)!.countParticipants(
@ -185,13 +185,13 @@ class ChatDetailsView extends StatelessWidget {
), ),
], ],
), ),
Divider(color: Theme.of(context).dividerColor), Divider(color: theme.dividerColor),
if (!room.canChangeStateEvent(EventTypes.RoomTopic)) if (!room.canChangeStateEvent(EventTypes.RoomTopic))
ListTile( ListTile(
title: Text( title: Text(
L10n.of(context)!.chatDescription, L10n.of(context)!.chatDescription,
style: TextStyle( style: TextStyle(
color: Theme.of(context).colorScheme.secondary, color: theme.colorScheme.secondary,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
), ),
@ -204,12 +204,10 @@ class ChatDetailsView extends StatelessWidget {
label: Text(L10n.of(context)!.setChatDescription), label: Text(L10n.of(context)!.setChatDescription),
icon: const Icon(Icons.edit_outlined), icon: const Icon(Icons.edit_outlined),
style: TextButton.styleFrom( style: TextButton.styleFrom(
backgroundColor: Theme.of(context) backgroundColor:
.colorScheme theme.colorScheme.secondaryContainer,
.secondaryContainer, foregroundColor:
foregroundColor: Theme.of(context) theme.colorScheme.onSecondaryContainer,
.colorScheme
.onSecondaryContainer,
), ),
), ),
), ),
@ -231,21 +229,19 @@ class ChatDetailsView extends StatelessWidget {
fontStyle: room.topic.isEmpty fontStyle: room.topic.isEmpty
? FontStyle.italic ? FontStyle.italic
: FontStyle.normal, : FontStyle.normal,
color: color: theme.textTheme.bodyMedium!.color,
Theme.of(context).textTheme.bodyMedium!.color,
decorationColor: decorationColor:
Theme.of(context).textTheme.bodyMedium!.color, theme.textTheme.bodyMedium!.color,
), ),
onOpen: (url) => onOpen: (url) =>
UrlLauncher(context, url.url).launchUrl(), UrlLauncher(context, url.url).launchUrl(),
), ),
), ),
const SizedBox(height: 16), const SizedBox(height: 16),
Divider(color: Theme.of(context).dividerColor), Divider(color: theme.dividerColor),
ListTile( ListTile(
leading: CircleAvatar( leading: CircleAvatar(
backgroundColor: backgroundColor: theme.scaffoldBackgroundColor,
Theme.of(context).scaffoldBackgroundColor,
foregroundColor: iconColor, foregroundColor: iconColor,
child: const Icon( child: const Icon(
Icons.insert_emoticon_outlined, Icons.insert_emoticon_outlined,
@ -260,8 +256,7 @@ class ChatDetailsView extends StatelessWidget {
if (!room.isDirectChat) if (!room.isDirectChat)
ListTile( ListTile(
leading: CircleAvatar( leading: CircleAvatar(
backgroundColor: backgroundColor: theme.scaffoldBackgroundColor,
Theme.of(context).scaffoldBackgroundColor,
foregroundColor: iconColor, foregroundColor: iconColor,
child: const Icon(Icons.shield_outlined), child: const Icon(Icons.shield_outlined),
), ),
@ -282,8 +277,7 @@ class ChatDetailsView extends StatelessWidget {
L10n.of(context)!.whoCanPerformWhichAction, L10n.of(context)!.whoCanPerformWhichAction,
), ),
leading: CircleAvatar( leading: CircleAvatar(
backgroundColor: backgroundColor: theme.scaffoldBackgroundColor,
Theme.of(context).scaffoldBackgroundColor,
foregroundColor: iconColor, foregroundColor: iconColor,
child: const Icon( child: const Icon(
Icons.edit_attributes_outlined, Icons.edit_attributes_outlined,
@ -293,14 +287,14 @@ class ChatDetailsView extends StatelessWidget {
onTap: () => context onTap: () => context
.push('/rooms/${room.id}/details/permissions'), .push('/rooms/${room.id}/details/permissions'),
), ),
Divider(color: Theme.of(context).dividerColor), Divider(color: theme.dividerColor),
ListTile( ListTile(
title: Text( title: Text(
L10n.of(context)!.countParticipants( L10n.of(context)!.countParticipants(
actualMembersCount.toString(), actualMembersCount.toString(),
), ),
style: TextStyle( style: TextStyle(
color: Theme.of(context).colorScheme.secondary, color: theme.colorScheme.secondary,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
), ),
@ -309,12 +303,10 @@ class ChatDetailsView extends StatelessWidget {
ListTile( ListTile(
title: Text(L10n.of(context)!.inviteContact), title: Text(L10n.of(context)!.inviteContact),
leading: CircleAvatar( leading: CircleAvatar(
backgroundColor: Theme.of(context) backgroundColor:
.colorScheme theme.colorScheme.primaryContainer,
.primaryContainer, foregroundColor:
foregroundColor: Theme.of(context) theme.colorScheme.onPrimaryContainer,
.colorScheme
.onPrimaryContainer,
radius: Avatar.defaultSize / 2, radius: Avatar.defaultSize / 2,
child: const Icon(Icons.add_outlined), child: const Icon(Icons.add_outlined),
), ),
@ -332,8 +324,7 @@ class ChatDetailsView extends StatelessWidget {
), ),
), ),
leading: CircleAvatar( leading: CircleAvatar(
backgroundColor: backgroundColor: theme.scaffoldBackgroundColor,
Theme.of(context).scaffoldBackgroundColor,
child: const Icon( child: const Icon(
Icons.group_outlined, Icons.group_outlined,
color: Colors.grey, color: Colors.grey,

@ -14,6 +14,8 @@ class ParticipantListItem extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final theme = Theme.of(context);
final membershipBatch = switch (user.membership) { final membershipBatch = switch (user.membership) {
Membership.ban => L10n.of(context)!.banned, Membership.ban => L10n.of(context)!.banned,
Membership.invite => L10n.of(context)!.invited, Membership.invite => L10n.of(context)!.invited,
@ -54,17 +56,17 @@ class ParticipantListItem extends StatelessWidget {
), ),
margin: const EdgeInsets.symmetric(horizontal: 8), margin: const EdgeInsets.symmetric(horizontal: 8),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Theme.of(context).colorScheme.primaryContainer, color: theme.colorScheme.primaryContainer,
borderRadius: BorderRadius.circular(8), borderRadius: BorderRadius.circular(8),
border: Border.all( border: Border.all(
color: Theme.of(context).colorScheme.primary, color: theme.colorScheme.primary,
), ),
), ),
child: Text( child: Text(
permissionBatch, permissionBatch,
style: TextStyle( style: TextStyle(
fontSize: 14, fontSize: 14,
color: Theme.of(context).colorScheme.primary, color: theme.colorScheme.primary,
), ),
), ),
), ),
@ -74,7 +76,7 @@ class ParticipantListItem extends StatelessWidget {
padding: const EdgeInsets.all(4), padding: const EdgeInsets.all(4),
margin: const EdgeInsets.symmetric(horizontal: 8), margin: const EdgeInsets.symmetric(horizontal: 8),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Theme.of(context).secondaryHeaderColor, color: theme.secondaryHeaderColor,
borderRadius: BorderRadius.circular(8), borderRadius: BorderRadius.circular(8),
), ),
child: Center(child: Text(membershipBatch)), child: Center(child: Text(membershipBatch)),

@ -18,6 +18,8 @@ class ChatEncryptionSettingsView extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final theme = Theme.of(context);
final room = controller.room; final room = controller.room;
return StreamBuilder<Object>( return StreamBuilder<Object>(
stream: room.client.onSync.stream.where( stream: room.client.onSync.stream.where(
@ -43,10 +45,8 @@ class ChatEncryptionSettingsView extends StatelessWidget {
children: [ children: [
SwitchListTile( SwitchListTile(
secondary: CircleAvatar( secondary: CircleAvatar(
foregroundColor: foregroundColor: theme.colorScheme.onPrimaryContainer,
Theme.of(context).colorScheme.onPrimaryContainer, backgroundColor: theme.colorScheme.primaryContainer,
backgroundColor:
Theme.of(context).colorScheme.primaryContainer,
child: const Icon(Icons.lock_outlined), child: const Icon(Icons.lock_outlined),
), ),
title: Text(L10n.of(context)!.encryptThisChat), title: Text(L10n.of(context)!.encryptThisChat),
@ -56,7 +56,7 @@ class ChatEncryptionSettingsView extends StatelessWidget {
Icon( Icon(
CupertinoIcons.lock_shield, CupertinoIcons.lock_shield,
size: 128, size: 128,
color: Theme.of(context).colorScheme.onInverseSurface, color: theme.colorScheme.onInverseSurface,
), ),
const Divider(), const Divider(),
if (room.isDirectChat) if (room.isDirectChat)
@ -144,13 +144,10 @@ class ChatEncryptionSettingsView extends StatelessWidget {
AppConfig.borderRadius, AppConfig.borderRadius,
), ),
side: BorderSide( side: BorderSide(
color: color: theme.colorScheme.primary,
Theme.of(context).colorScheme.primary,
), ),
), ),
color: Theme.of(context) color: theme.colorScheme.primaryContainer,
.colorScheme
.primaryContainer,
child: Padding( child: Padding(
padding: const EdgeInsets.all(4.0), padding: const EdgeInsets.all(4.0),
child: Text( child: Text(
@ -158,9 +155,7 @@ class ChatEncryptionSettingsView extends StatelessWidget {
maxLines: 1, maxLines: 1,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
style: TextStyle( style: TextStyle(
color: Theme.of(context) color: theme.colorScheme.primary,
.colorScheme
.primary,
fontSize: 12, fontSize: 12,
fontStyle: FontStyle.italic, fontStyle: FontStyle.italic,
), ),
@ -175,7 +170,7 @@ class ChatEncryptionSettingsView extends StatelessWidget {
L10n.of(context)!.unknownEncryptionAlgorithm, L10n.of(context)!.unknownEncryptionAlgorithm,
style: TextStyle( style: TextStyle(
fontFamily: 'RobotoMono', fontFamily: 'RobotoMono',
color: Theme.of(context).colorScheme.secondary, color: theme.colorScheme.secondary,
), ),
), ),
), ),

@ -28,6 +28,8 @@ class ChatListViewBody extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final theme = Theme.of(context);
final client = Matrix.of(context).client; final client = Matrix.of(context).client;
final activeSpace = controller.activeSpaceId; final activeSpace = controller.activeSpaceId;
if (activeSpace != null) { if (activeSpace != null) {
@ -59,10 +61,8 @@ class ChatListViewBody extends StatelessWidget {
.toList(); .toList();
final userSearchResult = controller.userSearchResult; final userSearchResult = controller.userSearchResult;
const dummyChatCount = 4; const dummyChatCount = 4;
final titleColor = final titleColor = theme.textTheme.bodyLarge!.color!.withAlpha(100);
Theme.of(context).textTheme.bodyLarge!.color!.withAlpha(100); final subtitleColor = theme.textTheme.bodyLarge!.color!.withAlpha(50);
final subtitleColor =
Theme.of(context).textTheme.bodyLarge!.color!.withAlpha(50);
final filter = controller.searchController.text.toLowerCase(); final filter = controller.searchController.text.toLowerCase();
return StreamBuilder( return StreamBuilder(
key: ValueKey( key: ValueKey(
@ -144,7 +144,7 @@ class ChatListViewBody extends StatelessWidget {
clipBehavior: Clip.hardEdge, clipBehavior: Clip.hardEdge,
decoration: const BoxDecoration(), decoration: const BoxDecoration(),
child: Material( child: Material(
color: Theme.of(context).colorScheme.surface, color: theme.colorScheme.surface,
child: ListTile( child: ListTile(
leading: const Icon(Icons.vpn_key), leading: const Icon(Icons.vpn_key),
title: Text(L10n.of(context)!.dehydrateTor), title: Text(L10n.of(context)!.dehydrateTor),
@ -199,11 +199,8 @@ class ChatListViewBody extends StatelessWidget {
decoration: BoxDecoration( decoration: BoxDecoration(
color: filter == color: filter ==
controller.activeFilter controller.activeFilter
? Theme.of(context) ? theme.colorScheme.primary
.colorScheme : theme.colorScheme
.primary
: Theme.of(context)
.colorScheme
.secondaryContainer, .secondaryContainer,
borderRadius: BorderRadius.circular( borderRadius: BorderRadius.circular(
AppConfig.borderRadius, AppConfig.borderRadius,
@ -219,11 +216,8 @@ class ChatListViewBody extends StatelessWidget {
: FontWeight.normal, : FontWeight.normal,
color: filter == color: filter ==
controller.activeFilter controller.activeFilter
? Theme.of(context) ? theme.colorScheme.onPrimary
.colorScheme : theme.colorScheme
.onPrimary
: Theme.of(context)
.colorScheme
.onSecondaryContainer, .onSecondaryContainer,
), ),
), ),
@ -249,7 +243,7 @@ class ChatListViewBody extends StatelessWidget {
child: Icon( child: Icon(
CupertinoIcons.chat_bubble_2, CupertinoIcons.chat_bubble_2,
size: 128, size: 128,
color: Theme.of(context).colorScheme.secondary, color: theme.colorScheme.secondary,
), ),
), ),
], ],
@ -266,7 +260,7 @@ class ChatListViewBody extends StatelessWidget {
backgroundColor: titleColor, backgroundColor: titleColor,
child: CircularProgressIndicator( child: CircularProgressIndicator(
strokeWidth: 1, strokeWidth: 1,
color: Theme.of(context).textTheme.bodyLarge!.color, color: theme.textTheme.bodyLarge!.color,
), ),
), ),
title: Row( title: Row(

@ -19,6 +19,8 @@ class ChatListHeader extends StatelessWidget implements PreferredSizeWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final theme = Theme.of(context);
final selectMode = controller.selectMode; final selectMode = controller.selectMode;
return SliverAppBar( return SliverAppBar(
@ -36,7 +38,7 @@ class ChatListHeader extends StatelessWidget implements PreferredSizeWidget {
tooltip: L10n.of(context)!.cancel, tooltip: L10n.of(context)!.cancel,
icon: const Icon(Icons.close_outlined), icon: const Icon(Icons.close_outlined),
onPressed: controller.cancelAction, onPressed: controller.cancelAction,
color: Theme.of(context).colorScheme.primary, color: theme.colorScheme.primary,
), ),
title: selectMode == SelectMode.share title: selectMode == SelectMode.share
? Text( ? Text(
@ -52,7 +54,7 @@ class ChatListHeader extends StatelessWidget implements PreferredSizeWidget {
globalSearch: globalSearch, globalSearch: globalSearch,
), ),
decoration: InputDecoration( decoration: InputDecoration(
fillColor: Theme.of(context).colorScheme.secondaryContainer, fillColor: theme.colorScheme.secondaryContainer,
border: OutlineInputBorder( border: OutlineInputBorder(
borderSide: BorderSide.none, borderSide: BorderSide.none,
borderRadius: BorderRadius.circular(99), borderRadius: BorderRadius.circular(99),
@ -60,7 +62,7 @@ class ChatListHeader extends StatelessWidget implements PreferredSizeWidget {
contentPadding: EdgeInsets.zero, contentPadding: EdgeInsets.zero,
hintText: L10n.of(context)!.searchChatsRooms, hintText: L10n.of(context)!.searchChatsRooms,
hintStyle: TextStyle( hintStyle: TextStyle(
color: Theme.of(context).colorScheme.onPrimaryContainer, color: theme.colorScheme.onPrimaryContainer,
fontWeight: FontWeight.normal, fontWeight: FontWeight.normal,
), ),
floatingLabelBehavior: FloatingLabelBehavior.never, floatingLabelBehavior: FloatingLabelBehavior.never,
@ -69,14 +71,13 @@ class ChatListHeader extends StatelessWidget implements PreferredSizeWidget {
tooltip: L10n.of(context)!.cancel, tooltip: L10n.of(context)!.cancel,
icon: const Icon(Icons.close_outlined), icon: const Icon(Icons.close_outlined),
onPressed: controller.cancelSearch, onPressed: controller.cancelSearch,
color: Theme.of(context).colorScheme.onPrimaryContainer, color: theme.colorScheme.onPrimaryContainer,
) )
: IconButton( : IconButton(
onPressed: controller.startSearch, onPressed: controller.startSearch,
icon: Icon( icon: Icon(
Icons.search_outlined, Icons.search_outlined,
color: color: theme.colorScheme.onPrimaryContainer,
Theme.of(context).colorScheme.onPrimaryContainer,
), ),
), ),
suffixIcon: controller.isSearchMode && globalSearch suffixIcon: controller.isSearchMode && globalSearch

@ -63,12 +63,13 @@ class ChatListItem extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final theme = Theme.of(context);
final isMuted = room.pushRuleState != PushRuleState.notify; final isMuted = room.pushRuleState != PushRuleState.notify;
final typingText = room.getLocalizedTypingText(context); final typingText = room.getLocalizedTypingText(context);
final lastEvent = room.lastEvent; final lastEvent = room.lastEvent;
final ownMessage = lastEvent?.senderId == room.client.userID; final ownMessage = lastEvent?.senderId == room.client.userID;
final unread = room.isUnread || room.membership == Membership.invite; final unread = room.isUnread || room.membership == Membership.invite;
final theme = Theme.of(context);
final directChatMatrixId = room.directChatMatrixID; final directChatMatrixId = room.directChatMatrixID;
final isDirectChat = directChatMatrixId != null; final isDirectChat = directChatMatrixId != null;
final unreadBubbleSize = unread || room.hasNewMessages final unreadBubbleSize = unread || room.hasNewMessages
@ -126,7 +127,7 @@ class ChatListItem extends StatelessWidget {
border: BorderSide( border: BorderSide(
width: 2, width: 2,
color: backgroundColor ?? color: backgroundColor ??
Theme.of(context).colorScheme.surface, theme.colorScheme.surface,
), ),
borderRadius: BorderRadius.circular( borderRadius: BorderRadius.circular(
AppConfig.borderRadius / 4, AppConfig.borderRadius / 4,
@ -146,7 +147,7 @@ class ChatListItem extends StatelessWidget {
: BorderSide( : BorderSide(
width: 2, width: 2,
color: backgroundColor ?? color: backgroundColor ??
Theme.of(context).colorScheme.surface, theme.colorScheme.surface,
), ),
borderRadius: room.isSpace borderRadius: room.isSpace
? BorderRadius.circular( ? BorderRadius.circular(

@ -35,6 +35,8 @@ class _NaviRailItemState extends State<NaviRailItem> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final theme = Theme.of(context);
final borderRadius = BorderRadius.circular(AppConfig.borderRadius); final borderRadius = BorderRadius.circular(AppConfig.borderRadius);
return SizedBox( return SizedBox(
height: 64, height: 64,
@ -50,7 +52,7 @@ class _NaviRailItemState extends State<NaviRailItem> {
duration: FluffyThemes.animationDuration, duration: FluffyThemes.animationDuration,
curve: FluffyThemes.animationCurve, curve: FluffyThemes.animationCurve,
decoration: BoxDecoration( decoration: BoxDecoration(
color: Theme.of(context).colorScheme.primary, color: theme.colorScheme.primary,
borderRadius: const BorderRadius.only( borderRadius: const BorderRadius.only(
topRight: Radius.circular(90), topRight: Radius.circular(90),
bottomRight: Radius.circular(90), bottomRight: Radius.circular(90),
@ -66,8 +68,8 @@ class _NaviRailItemState extends State<NaviRailItem> {
child: Material( child: Material(
borderRadius: borderRadius, borderRadius: borderRadius,
color: widget.isSelected color: widget.isSelected
? Theme.of(context).colorScheme.primaryContainer ? theme.colorScheme.primaryContainer
: Theme.of(context).colorScheme.surface, : theme.colorScheme.surface,
child: Tooltip( child: Tooltip(
message: widget.toolTip, message: widget.toolTip,
child: InkWell( child: InkWell(

@ -27,6 +27,8 @@ class NaviRailItem extends StatelessWidget {
}); });
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final theme = Theme.of(context);
final borderRadius = BorderRadius.circular(AppConfig.borderRadius); final borderRadius = BorderRadius.circular(AppConfig.borderRadius);
final icon = isSelected ? selectedIcon ?? this.icon : this.icon; final icon = isSelected ? selectedIcon ?? this.icon : this.icon;
final unreadBadgeFilter = this.unreadBadgeFilter; final unreadBadgeFilter = this.unreadBadgeFilter;
@ -46,7 +48,7 @@ class NaviRailItem extends StatelessWidget {
duration: FluffyThemes.animationDuration, duration: FluffyThemes.animationDuration,
curve: FluffyThemes.animationCurve, curve: FluffyThemes.animationCurve,
decoration: BoxDecoration( decoration: BoxDecoration(
color: Theme.of(context).colorScheme.primary, color: theme.colorScheme.primary,
borderRadius: const BorderRadius.only( borderRadius: const BorderRadius.only(
topRight: Radius.circular(90), topRight: Radius.circular(90),
bottomRight: Radius.circular(90), bottomRight: Radius.circular(90),
@ -62,8 +64,8 @@ class NaviRailItem extends StatelessWidget {
child: Material( child: Material(
borderRadius: borderRadius, borderRadius: borderRadius,
color: isSelected color: isSelected
? Theme.of(context).colorScheme.primaryContainer ? theme.colorScheme.primaryContainer
: Theme.of(context).colorScheme.surface, : theme.colorScheme.surface,
child: Tooltip( child: Tooltip(
message: toolTip, message: toolTip,
child: InkWell( child: InkWell(

@ -17,21 +17,24 @@ class SearchTitle extends StatelessWidget {
}); });
@override @override
Widget build(BuildContext context) => Material( Widget build(BuildContext context) {
final theme = Theme.of(context);
return Material(
shape: Border( shape: Border(
top: BorderSide( top: BorderSide(
color: Theme.of(context).dividerColor, color: theme.dividerColor,
width: 1, width: 1,
), ),
bottom: BorderSide( bottom: BorderSide(
color: Theme.of(context).dividerColor, color: theme.dividerColor,
width: 1, width: 1,
), ),
), ),
color: color ?? Theme.of(context).colorScheme.surface, color: color ?? theme.colorScheme.surface,
child: InkWell( child: InkWell(
onTap: onTap, onTap: onTap,
splashColor: Theme.of(context).colorScheme.surface, splashColor: theme.colorScheme.surface,
child: Align( child: Align(
alignment: Alignment.centerLeft, alignment: Alignment.centerLeft,
child: Padding( child: Padding(
@ -40,7 +43,7 @@ class SearchTitle extends StatelessWidget {
vertical: 8, vertical: 8,
), ),
child: IconTheme( child: IconTheme(
data: Theme.of(context).iconTheme.copyWith(size: 16), data: theme.iconTheme.copyWith(size: 16),
child: Row( child: Row(
children: [ children: [
icon, icon,
@ -49,7 +52,7 @@ class SearchTitle extends StatelessWidget {
title, title,
textAlign: TextAlign.left, textAlign: TextAlign.left,
style: TextStyle( style: TextStyle(
color: Theme.of(context).colorScheme.onSurface, color: theme.colorScheme.onSurface,
fontSize: 12, fontSize: 12,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
@ -68,4 +71,5 @@ class SearchTitle extends StatelessWidget {
), ),
), ),
); );
}
} }

@ -241,6 +241,8 @@ class _SpaceViewState extends State<SpaceView> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final theme = Theme.of(context);
final room = Matrix.of(context).client.getRoomById(widget.spaceId); final room = Matrix.of(context).client.getRoomById(widget.spaceId);
final displayname = final displayname =
room?.getLocalizedDisplayname() ?? L10n.of(context)!.nothingFound; room?.getLocalizedDisplayname() ?? L10n.of(context)!.nothingFound;
@ -359,8 +361,7 @@ class _SpaceViewState extends State<SpaceView> {
onChanged: (_) => setState(() {}), onChanged: (_) => setState(() {}),
textInputAction: TextInputAction.search, textInputAction: TextInputAction.search,
decoration: InputDecoration( decoration: InputDecoration(
fillColor: fillColor: theme.colorScheme.secondaryContainer,
Theme.of(context).colorScheme.secondaryContainer,
border: OutlineInputBorder( border: OutlineInputBorder(
borderSide: BorderSide.none, borderSide: BorderSide.none,
borderRadius: BorderRadius.circular(99), borderRadius: BorderRadius.circular(99),
@ -368,9 +369,7 @@ class _SpaceViewState extends State<SpaceView> {
contentPadding: EdgeInsets.zero, contentPadding: EdgeInsets.zero,
hintText: L10n.of(context)!.search, hintText: L10n.of(context)!.search,
hintStyle: TextStyle( hintStyle: TextStyle(
color: Theme.of(context) color: theme.colorScheme.onPrimaryContainer,
.colorScheme
.onPrimaryContainer,
fontWeight: FontWeight.normal, fontWeight: FontWeight.normal,
), ),
floatingLabelBehavior: FloatingLabelBehavior.never, floatingLabelBehavior: FloatingLabelBehavior.never,
@ -378,9 +377,7 @@ class _SpaceViewState extends State<SpaceView> {
onPressed: () {}, onPressed: () {},
icon: Icon( icon: Icon(
Icons.search_outlined, Icons.search_outlined,
color: Theme.of(context) color: theme.colorScheme.onPrimaryContainer,
.colorScheme
.onPrimaryContainer,
), ),
), ),
), ),

@ -116,6 +116,8 @@ class PresenceAvatar extends StatelessWidget {
return FutureBuilder<Profile>( return FutureBuilder<Profile>(
future: client.getProfileFromUserId(presence.userid), future: client.getProfileFromUserId(presence.userid),
builder: (context, snapshot) { builder: (context, snapshot) {
final theme = Theme.of(context);
final profile = snapshot.data; final profile = snapshot.data;
final displayName = profile?.displayName ?? final displayName = profile?.displayName ??
presence.userid.localpart ?? presence.userid.localpart ??
@ -123,9 +125,8 @@ class PresenceAvatar extends StatelessWidget {
final statusMsg = presence.statusMsg; final statusMsg = presence.statusMsg;
final statusMsgBubbleElevation = final statusMsgBubbleElevation =
Theme.of(context).appBarTheme.scrolledUnderElevation ?? 4; theme.appBarTheme.scrolledUnderElevation ?? 4;
final statusMsgBubbleShadowColor = final statusMsgBubbleShadowColor = theme.colorScheme.onSurface;
Theme.of(context).colorScheme.onSurface;
final statusMsgBubbleColor = Colors.white.withAlpha(245); final statusMsgBubbleColor = Colors.white.withAlpha(245);
return Padding( return Padding(
padding: const EdgeInsets.symmetric(horizontal: 8.0), padding: const EdgeInsets.symmetric(horizontal: 8.0),

@ -15,6 +15,8 @@ class ChatPermissionsSettingsView extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final theme = Theme.of(context);
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
leading: const Center(child: BackButton()), leading: const Center(child: BackButton()),
@ -47,12 +49,12 @@ class ChatPermissionsSettingsView extends StatelessWidget {
L10n.of(context)!.chatPermissionsDescription, L10n.of(context)!.chatPermissionsDescription,
), ),
), ),
Divider(color: Theme.of(context).dividerColor), Divider(color: theme.dividerColor),
ListTile( ListTile(
title: Text( title: Text(
L10n.of(context)!.chatPermissions, L10n.of(context)!.chatPermissions,
style: TextStyle( style: TextStyle(
color: Theme.of(context).colorScheme.primary, color: theme.colorScheme.primary,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
), ),
@ -72,12 +74,12 @@ class ChatPermissionsSettingsView extends StatelessWidget {
), ),
canEdit: room.canChangePowerLevel, canEdit: room.canChangePowerLevel,
), ),
Divider(color: Theme.of(context).dividerColor), Divider(color: theme.dividerColor),
ListTile( ListTile(
title: Text( title: Text(
L10n.of(context)!.notifications, L10n.of(context)!.notifications,
style: TextStyle( style: TextStyle(
color: Theme.of(context).colorScheme.primary, color: theme.colorScheme.primary,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
), ),
@ -107,12 +109,12 @@ class ChatPermissionsSettingsView extends StatelessWidget {
); );
}, },
), ),
Divider(color: Theme.of(context).dividerColor), Divider(color: theme.dividerColor),
ListTile( ListTile(
title: Text( title: Text(
L10n.of(context)!.configureChat, L10n.of(context)!.configureChat,
style: TextStyle( style: TextStyle(
color: Theme.of(context).colorScheme.primary, color: theme.colorScheme.primary,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
), ),

@ -71,6 +71,8 @@ class PermissionsListTile extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final theme = Theme.of(context);
final color = permission >= 100 final color = permission >= 100
? Colors.orangeAccent ? Colors.orangeAccent
: permission >= 50 : permission >= 50
@ -79,7 +81,7 @@ class PermissionsListTile extends StatelessWidget {
return ListTile( return ListTile(
title: Text( title: Text(
getLocalizedPowerLevelString(context), getLocalizedPowerLevelString(context),
style: Theme.of(context).textTheme.titleSmall, style: theme.textTheme.titleSmall,
), ),
trailing: Material( trailing: Material(
color: color.withAlpha(32), color: color.withAlpha(32),

@ -28,6 +28,7 @@ class ChatSearchFilesTab extends StatelessWidget {
return StreamBuilder( return StreamBuilder(
stream: searchStream, stream: searchStream,
builder: (context, snapshot) { builder: (context, snapshot) {
final theme = Theme.of(context);
final events = snapshot.data?.$1; final events = snapshot.data?.$1;
if (searchStream == null || events == null) { if (searchStream == null || events == null) {
return Column( return Column(
@ -82,10 +83,8 @@ class ChatSearchFilesTab extends StatelessWidget {
padding: const EdgeInsets.all(16.0), padding: const EdgeInsets.all(16.0),
child: TextButton.icon( child: TextButton.icon(
style: TextButton.styleFrom( style: TextButton.styleFrom(
backgroundColor: backgroundColor: theme.colorScheme.secondaryContainer,
Theme.of(context).colorScheme.secondaryContainer, foregroundColor: theme.colorScheme.onSecondaryContainer,
foregroundColor:
Theme.of(context).colorScheme.onSecondaryContainer,
), ),
onPressed: () => startSearch( onPressed: () => startSearch(
prevBatch: nextBatch, prevBatch: nextBatch,
@ -127,21 +126,21 @@ class ChatSearchFilesTab extends StatelessWidget {
Expanded( Expanded(
child: Container( child: Container(
height: 1, height: 1,
color: Theme.of(context).dividerColor, color: theme.dividerColor,
), ),
), ),
Padding( Padding(
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: Text( child: Text(
event.originServerTs.localizedTime(context), event.originServerTs.localizedTime(context),
style: Theme.of(context).textTheme.labelSmall, style: theme.textTheme.labelSmall,
textAlign: TextAlign.center, textAlign: TextAlign.center,
), ),
), ),
Expanded( Expanded(
child: Container( child: Container(
height: 1, height: 1,
color: Theme.of(context).dividerColor, color: theme.dividerColor,
), ),
), ),
], ],
@ -151,7 +150,7 @@ class ChatSearchFilesTab extends StatelessWidget {
Material( Material(
borderRadius: borderRadius:
BorderRadius.circular(AppConfig.borderRadius), BorderRadius.circular(AppConfig.borderRadius),
color: Theme.of(context).colorScheme.onInverseSurface, color: theme.colorScheme.onInverseSurface,
clipBehavior: Clip.hardEdge, clipBehavior: Clip.hardEdge,
child: ListTile( child: ListTile(
leading: const Icon(Icons.file_present_outlined), leading: const Icon(Icons.file_present_outlined),

@ -28,6 +28,7 @@ class ChatSearchImagesTab extends StatelessWidget {
return StreamBuilder( return StreamBuilder(
stream: searchStream, stream: searchStream,
builder: (context, snapshot) { builder: (context, snapshot) {
final theme = Theme.of(context);
final events = snapshot.data?.$1; final events = snapshot.data?.$1;
if (searchStream == null || events == null) { if (searchStream == null || events == null) {
return Column( return Column(
@ -91,10 +92,8 @@ class ChatSearchImagesTab extends StatelessWidget {
padding: const EdgeInsets.all(16.0), padding: const EdgeInsets.all(16.0),
child: TextButton.icon( child: TextButton.icon(
style: TextButton.styleFrom( style: TextButton.styleFrom(
backgroundColor: backgroundColor: theme.colorScheme.secondaryContainer,
Theme.of(context).colorScheme.secondaryContainer, foregroundColor: theme.colorScheme.onSecondaryContainer,
foregroundColor:
Theme.of(context).colorScheme.onSecondaryContainer,
), ),
onPressed: () => startSearch( onPressed: () => startSearch(
prevBatch: nextBatch, prevBatch: nextBatch,
@ -119,7 +118,7 @@ class ChatSearchImagesTab extends StatelessWidget {
Expanded( Expanded(
child: Container( child: Container(
height: 1, height: 1,
color: Theme.of(context).dividerColor, color: theme.dividerColor,
), ),
), ),
Padding( Padding(
@ -128,14 +127,14 @@ class ChatSearchImagesTab extends StatelessWidget {
DateFormat.yMMMM( DateFormat.yMMMM(
Localizations.localeOf(context).languageCode, Localizations.localeOf(context).languageCode,
).format(eventsByMonthList[i].key), ).format(eventsByMonthList[i].key),
style: Theme.of(context).textTheme.labelSmall, style: theme.textTheme.labelSmall,
textAlign: TextAlign.center, textAlign: TextAlign.center,
), ),
), ),
Expanded( Expanded(
child: Container( child: Container(
height: 1, height: 1,
color: Theme.of(context).dividerColor, color: theme.dividerColor,
), ),
), ),
], ],

@ -33,6 +33,7 @@ class ChatSearchMessageTab extends StatelessWidget {
key: ValueKey(searchQuery), key: ValueKey(searchQuery),
stream: searchStream, stream: searchStream,
builder: (context, snapshot) { builder: (context, snapshot) {
final theme = Theme.of(context);
if (searchStream == null) { if (searchStream == null) {
return Column( return Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
@ -55,7 +56,7 @@ class ChatSearchMessageTab extends StatelessWidget {
child: ListView.separated( child: ListView.separated(
itemCount: events.length + 1, itemCount: events.length + 1,
separatorBuilder: (context, _) => Divider( separatorBuilder: (context, _) => Divider(
color: Theme.of(context).dividerColor, color: theme.dividerColor,
height: 1, height: 1,
), ),
itemBuilder: (context, i) { itemBuilder: (context, i) {
@ -79,10 +80,8 @@ class ChatSearchMessageTab extends StatelessWidget {
padding: const EdgeInsets.all(16.0), padding: const EdgeInsets.all(16.0),
child: TextButton.icon( child: TextButton.icon(
style: TextButton.styleFrom( style: TextButton.styleFrom(
backgroundColor: backgroundColor: theme.colorScheme.secondaryContainer,
Theme.of(context).colorScheme.secondaryContainer, foregroundColor: theme.colorScheme.onSecondaryContainer,
foregroundColor:
Theme.of(context).colorScheme.onSecondaryContainer,
), ),
onPressed: () => startSearch( onPressed: () => startSearch(
prevBatch: nextBatch, prevBatch: nextBatch,
@ -130,6 +129,8 @@ class _MessageSearchResultListTile extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final theme = Theme.of(context);
return ListTile( return ListTile(
title: Row( title: Row(
children: [ children: [
@ -153,9 +154,9 @@ class _MessageSearchResultListTile extends StatelessWidget {
subtitle: Linkify( subtitle: Linkify(
options: const LinkifyOptions(humanize: false), options: const LinkifyOptions(humanize: false),
linkStyle: TextStyle( linkStyle: TextStyle(
color: Theme.of(context).colorScheme.primary, color: theme.colorScheme.primary,
decoration: TextDecoration.underline, decoration: TextDecoration.underline,
decorationColor: Theme.of(context).colorScheme.primary, decorationColor: theme.colorScheme.primary,
), ),
onOpen: (url) => UrlLauncher(context, url.url).launchUrl(), onOpen: (url) => UrlLauncher(context, url.url).launchUrl(),
text: event text: event

@ -22,6 +22,7 @@ class DevicesSettingsView extends StatelessWidget {
child: FutureBuilder<bool>( child: FutureBuilder<bool>(
future: controller.loadUserDevices(context), future: controller.loadUserDevices(context),
builder: (BuildContext context, snapshot) { builder: (BuildContext context, snapshot) {
final theme = Theme.of(context);
if (snapshot.hasError) { if (snapshot.hasError) {
return Center( return Center(
child: Column( child: Column(
@ -58,7 +59,7 @@ class DevicesSettingsView extends StatelessWidget {
L10n.of(context)!.thisDevice, L10n.of(context)!.thisDevice,
style: TextStyle( style: TextStyle(
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
color: Theme.of(context).colorScheme.primary, color: theme.colorScheme.primary,
), ),
textAlign: TextAlign.left, textAlign: TextAlign.left,
), ),
@ -86,12 +87,10 @@ class DevicesSettingsView extends StatelessWidget {
L10n.of(context)!.removeAllOtherDevices, L10n.of(context)!.removeAllOtherDevices,
), ),
style: TextButton.styleFrom( style: TextButton.styleFrom(
foregroundColor: Theme.of(context) foregroundColor:
.colorScheme theme.colorScheme.onErrorContainer,
.onErrorContainer, backgroundColor:
backgroundColor: Theme.of(context) theme.colorScheme.errorContainer,
.colorScheme
.errorContainer,
), ),
icon: controller.loadingDeletingDevices icon: controller.loadingDeletingDevices
? const CircularProgressIndicator.adaptive( ? const CircularProgressIndicator.adaptive(

@ -17,14 +17,15 @@ class HomeserverAppBar extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final theme = Theme.of(context);
return TypeAheadField<PublicHomeserver>( return TypeAheadField<PublicHomeserver>(
decorationBuilder: (context, child) => ConstrainedBox( decorationBuilder: (context, child) => ConstrainedBox(
constraints: const BoxConstraints(maxHeight: 256), constraints: const BoxConstraints(maxHeight: 256),
child: Material( child: Material(
borderRadius: BorderRadius.circular(AppConfig.borderRadius), borderRadius: BorderRadius.circular(AppConfig.borderRadius),
elevation: Theme.of(context).appBarTheme.scrolledUnderElevation ?? 4, elevation: theme.appBarTheme.scrolledUnderElevation ?? 4,
shadowColor: shadowColor: theme.appBarTheme.shadowColor ?? Colors.black,
Theme.of(context).appBarTheme.shadowColor ?? Colors.black,
child: child, child: child,
), ),
), ),
@ -92,9 +93,9 @@ class HomeserverAppBar extends StatelessWidget {
) )
: null, : null,
fillColor: FluffyThemes.isColumnMode(context) fillColor: FluffyThemes.isColumnMode(context)
? Theme.of(context).colorScheme.surface ? theme.colorScheme.surface
// ignore: deprecated_member_use // ignore: deprecated_member_use
: Theme.of(context).colorScheme.surfaceVariant, : theme.colorScheme.surfaceVariant,
prefixText: '${L10n.of(context)!.homeserver}: ', prefixText: '${L10n.of(context)!.homeserver}: ',
hintText: L10n.of(context)!.enterYourHomeserver, hintText: L10n.of(context)!.enterYourHomeserver,
suffixIcon: const Icon(Icons.search), suffixIcon: const Icon(Icons.search),

@ -19,6 +19,8 @@ class HomeserverPickerView extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final theme = Theme.of(context);
final identityProviders = controller.identityProviders; final identityProviders = controller.identityProviders;
final errorText = controller.error; final errorText = controller.error;
final publicHomeserver = controller.cachedHomeservers?.singleWhereOrNull( final publicHomeserver = controller.cachedHomeservers?.singleWhereOrNull(
@ -32,7 +34,7 @@ class HomeserverPickerView extends StatelessWidget {
appBar: AppBar( appBar: AppBar(
titleSpacing: 12, titleSpacing: 12,
automaticallyImplyLeading: false, automaticallyImplyLeading: false,
surfaceTintColor: Theme.of(context).colorScheme.surface, surfaceTintColor: theme.colorScheme.surface,
title: HomeserverAppBar(controller: controller), title: HomeserverAppBar(controller: controller),
), ),
body: Column( body: Column(
@ -50,7 +52,7 @@ class HomeserverPickerView extends StatelessWidget {
clipBehavior: Clip.hardEdge, clipBehavior: Clip.hardEdge,
borderRadius: borderRadius:
const BorderRadius.vertical(bottom: Radius.circular(8)), const BorderRadius.vertical(bottom: Radius.circular(8)),
color: Theme.of(context).colorScheme.surface, color: theme.colorScheme.surface,
child: ListTile( child: ListTile(
leading: const Icon(Icons.vpn_key), leading: const Icon(Icons.vpn_key),
title: Text(L10n.of(context)!.hydrateTor), title: Text(L10n.of(context)!.hydrateTor),
@ -80,7 +82,7 @@ class HomeserverPickerView extends StatelessWidget {
errorText, errorText,
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: TextStyle( style: TextStyle(
color: Theme.of(context).colorScheme.error, color: theme.colorScheme.error,
fontSize: 18, fontSize: 18,
), ),
), ),
@ -91,7 +93,7 @@ class HomeserverPickerView extends StatelessWidget {
.pleaseTryAgainLaterOrChooseDifferentServer, .pleaseTryAgainLaterOrChooseDifferentServer,
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: TextStyle( style: TextStyle(
color: Theme.of(context).colorScheme.error, color: theme.colorScheme.error,
fontSize: 12, fontSize: 12,
), ),
), ),
@ -189,6 +191,8 @@ class _LoginButton extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final theme = Theme.of(context);
final icon = this.icon; final icon = this.icon;
return Container( return Container(
margin: const EdgeInsets.only(bottom: 12), margin: const EdgeInsets.only(bottom: 12),
@ -201,16 +205,15 @@ class _LoginButton extends StatelessWidget {
side: FluffyThemes.isColumnMode(context) side: FluffyThemes.isColumnMode(context)
? BorderSide.none ? BorderSide.none
: BorderSide( : BorderSide(
color: Theme.of(context).colorScheme.outlineVariant, color: theme.colorScheme.outlineVariant,
width: 1, width: 1,
), ),
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(99), borderRadius: BorderRadius.circular(99),
), ),
foregroundColor: Theme.of(context).colorScheme.onSurface, foregroundColor: theme.colorScheme.onSurface,
backgroundColor: withBorder backgroundColor:
? Theme.of(context).colorScheme.surface withBorder ? theme.colorScheme.surface : Colors.transparent,
: Colors.transparent,
), ),
onPressed: onPressed, onPressed: onPressed,
label: Text(label), label: Text(label),

@ -153,6 +153,8 @@ class _InviteContactListTile extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final theme = Theme.of(context);
return Opacity( return Opacity(
opacity: isMember ? 0.5 : 1, opacity: isMember ? 0.5 : 1,
child: ListTile( child: ListTile(
@ -171,7 +173,7 @@ class _InviteContactListTile extends StatelessWidget {
maxLines: 1, maxLines: 1,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
style: TextStyle( style: TextStyle(
color: Theme.of(context).colorScheme.secondary, color: theme.colorScheme.secondary,
), ),
), ),
onTap: isMember ? null : onTap, onTap: isMember ? null : onTap,

@ -94,6 +94,8 @@ class KeyVerificationPageState extends State<KeyVerificationDialog> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final theme = Theme.of(context);
User? user; User? user;
final directChatId = final directChatId =
widget.request.client.getDirectChatFromUserId(widget.request.userId); widget.request.client.getDirectChatFromUserId(widget.request.userId);
@ -139,10 +141,8 @@ class KeyVerificationPageState extends State<KeyVerificationDialog> {
obscureText: true, obscureText: true,
decoration: InputDecoration( decoration: InputDecoration(
hintText: L10n.of(context)!.passphraseOrKey, hintText: L10n.of(context)!.passphraseOrKey,
prefixStyle: prefixStyle: TextStyle(color: theme.colorScheme.primary),
TextStyle(color: Theme.of(context).colorScheme.primary), suffixStyle: TextStyle(color: theme.colorScheme.primary),
suffixStyle:
TextStyle(color: Theme.of(context).colorScheme.primary),
border: const OutlineInputBorder(), border: const OutlineInputBorder(),
), ),
), ),

@ -14,6 +14,8 @@ class LoginView extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final theme = Theme.of(context);
final homeserver = Matrix.of(context) final homeserver = Matrix.of(context)
.getLoginClient() .getLoginClient()
.homeserver .homeserver
@ -23,9 +25,9 @@ class LoginView extends StatelessWidget {
final titleParts = title.split(homeserver); final titleParts = title.split(homeserver);
final textFieldFillColor = FluffyThemes.isColumnMode(context) final textFieldFillColor = FluffyThemes.isColumnMode(context)
? Theme.of(context).colorScheme.surface ? theme.colorScheme.surface
// ignore: deprecated_member_use // ignore: deprecated_member_use
: Theme.of(context).colorScheme.surfaceVariant; : theme.colorScheme.surfaceVariant;
return LoginScaffold( return LoginScaffold(
enforceMobileMode: Matrix.of(context).client.isLogged(), enforceMobileMode: Matrix.of(context).client.isLogged(),
@ -111,8 +113,8 @@ class LoginView extends StatelessWidget {
padding: const EdgeInsets.symmetric(horizontal: 8.0), padding: const EdgeInsets.symmetric(horizontal: 8.0),
child: ElevatedButton.icon( child: ElevatedButton.icon(
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
backgroundColor: Theme.of(context).colorScheme.primary, backgroundColor: theme.colorScheme.primary,
foregroundColor: Theme.of(context).colorScheme.onPrimary, foregroundColor: theme.colorScheme.onPrimary,
), ),
onPressed: controller.loading ? null : controller.login, onPressed: controller.loading ? null : controller.login,
icon: const Icon(Icons.login_outlined), icon: const Icon(Icons.login_outlined),
@ -129,7 +131,7 @@ class LoginView extends StatelessWidget {
? () {} ? () {}
: controller.passwordForgotten, : controller.passwordForgotten,
style: TextButton.styleFrom( style: TextButton.styleFrom(
foregroundColor: Theme.of(context).colorScheme.error, foregroundColor: theme.colorScheme.error,
), ),
icon: const Icon(Icons.safety_check_outlined), icon: const Icon(Icons.safety_check_outlined),
label: Text(L10n.of(context)!.passwordForgotten), label: Text(L10n.of(context)!.passwordForgotten),

@ -15,6 +15,8 @@ class NewGroupView extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final theme = Theme.of(context);
final avatar = controller.avatar; final avatar = controller.avatar;
final error = controller.error; final error = controller.error;
return Scaffold( return Scaffold(
@ -86,12 +88,12 @@ class NewGroupView extends StatelessWidget {
SwitchListTile.adaptive( SwitchListTile.adaptive(
secondary: Icon( secondary: Icon(
Icons.lock_outlined, Icons.lock_outlined,
color: Theme.of(context).colorScheme.onSurface, color: theme.colorScheme.onSurface,
), ),
title: Text( title: Text(
L10n.of(context)!.enableEncryption, L10n.of(context)!.enableEncryption,
style: TextStyle( style: TextStyle(
color: Theme.of(context).colorScheme.onSurface, color: theme.colorScheme.onSurface,
), ),
), ),
value: !controller.publicGroup, value: !controller.publicGroup,
@ -126,12 +128,12 @@ class NewGroupView extends StatelessWidget {
: ListTile( : ListTile(
leading: Icon( leading: Icon(
Icons.warning_outlined, Icons.warning_outlined,
color: Theme.of(context).colorScheme.error, color: theme.colorScheme.error,
), ),
title: Text( title: Text(
error.toLocalizedString(context), error.toLocalizedString(context),
style: TextStyle( style: TextStyle(
color: Theme.of(context).colorScheme.error, color: theme.colorScheme.error,
), ),
), ),
), ),

@ -22,13 +22,15 @@ class NewPrivateChatView extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final theme = Theme.of(context);
final searchResponse = controller.searchResponse; final searchResponse = controller.searchResponse;
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
scrolledUnderElevation: 0, scrolledUnderElevation: 0,
leading: const Center(child: BackButton()), leading: const Center(child: BackButton()),
title: Text(L10n.of(context)!.newChat), title: Text(L10n.of(context)!.newChat),
backgroundColor: Theme.of(context).scaffoldBackgroundColor, backgroundColor: theme.scaffoldBackgroundColor,
actions: [ actions: [
TextButton( TextButton(
onPressed: onPressed:
@ -109,7 +111,7 @@ class NewPrivateChatView extends StatelessWidget {
], ],
), ),
style: TextStyle( style: TextStyle(
color: Theme.of(context).colorScheme.onSurface, color: theme.colorScheme.onSurface,
fontSize: 13, fontSize: 13,
), ),
), ),
@ -117,10 +119,8 @@ class NewPrivateChatView extends StatelessWidget {
const SizedBox(height: 8), const SizedBox(height: 8),
ListTile( ListTile(
leading: CircleAvatar( leading: CircleAvatar(
backgroundColor: backgroundColor: theme.colorScheme.secondaryContainer,
Theme.of(context).colorScheme.secondaryContainer, foregroundColor: theme.colorScheme.onSecondaryContainer,
foregroundColor:
Theme.of(context).colorScheme.onSecondaryContainer,
child: Icon(Icons.adaptive.share_outlined), child: Icon(Icons.adaptive.share_outlined),
), ),
title: Text(L10n.of(context)!.shareInviteLink), title: Text(L10n.of(context)!.shareInviteLink),
@ -128,10 +128,8 @@ class NewPrivateChatView extends StatelessWidget {
), ),
ListTile( ListTile(
leading: CircleAvatar( leading: CircleAvatar(
backgroundColor: backgroundColor: theme.colorScheme.tertiaryContainer,
Theme.of(context).colorScheme.tertiaryContainer, foregroundColor: theme.colorScheme.onTertiaryContainer,
foregroundColor:
Theme.of(context).colorScheme.onTertiaryContainer,
child: const Icon(Icons.group_add_outlined), child: const Icon(Icons.group_add_outlined),
), ),
title: Text(L10n.of(context)!.createGroup), title: Text(L10n.of(context)!.createGroup),
@ -140,10 +138,8 @@ class NewPrivateChatView extends StatelessWidget {
if (PlatformInfos.isMobile) if (PlatformInfos.isMobile)
ListTile( ListTile(
leading: CircleAvatar( leading: CircleAvatar(
backgroundColor: backgroundColor: theme.colorScheme.primaryContainer,
Theme.of(context).colorScheme.primaryContainer, foregroundColor: theme.colorScheme.onPrimaryContainer,
foregroundColor:
Theme.of(context).colorScheme.onPrimaryContainer,
child: const Icon(Icons.qr_code_scanner_outlined), child: const Icon(Icons.qr_code_scanner_outlined),
), ),
title: Text(L10n.of(context)!.scanQrCode), title: Text(L10n.of(context)!.scanQrCode),
@ -158,8 +154,7 @@ class NewPrivateChatView extends StatelessWidget {
borderRadius: BorderRadius.circular(12), borderRadius: BorderRadius.circular(12),
elevation: 10, elevation: 10,
color: Colors.white, color: Colors.white,
shadowColor: shadowColor: theme.appBarTheme.shadowColor,
Theme.of(context).appBarTheme.shadowColor,
clipBehavior: Clip.hardEdge, clipBehavior: Clip.hardEdge,
child: Padding( child: Padding(
padding: const EdgeInsets.all(8), padding: const EdgeInsets.all(8),
@ -169,12 +164,9 @@ class NewPrivateChatView extends StatelessWidget {
decoration: PrettyQrDecoration( decoration: PrettyQrDecoration(
shape: PrettyQrSmoothSymbol( shape: PrettyQrSmoothSymbol(
roundFactor: 1, roundFactor: 1,
color: Theme.of(context).brightness == color: theme.brightness == Brightness.light
Brightness.light ? theme.colorScheme.primary
? Theme.of(context).colorScheme.primary : theme.colorScheme.onPrimary,
: Theme.of(context)
.colorScheme
.onPrimary,
), ),
), ),
), ),
@ -198,7 +190,7 @@ class NewPrivateChatView extends StatelessWidget {
error.toLocalizedString(context), error.toLocalizedString(context),
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: TextStyle( style: TextStyle(
color: Theme.of(context).colorScheme.error, color: theme.colorScheme.error,
), ),
), ),
const SizedBox(height: 12), const SizedBox(height: 12),
@ -227,7 +219,7 @@ class NewPrivateChatView extends StatelessWidget {
controller.controller.text, controller.controller.text,
), ),
style: TextStyle( style: TextStyle(
color: Theme.of(context).colorScheme.primary, color: theme.colorScheme.primary,
), ),
textAlign: TextAlign.center, textAlign: TextAlign.center,
), ),

@ -19,6 +19,7 @@ class SettingsView extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final theme = Theme.of(context);
final showChatBackupBanner = controller.showChatBackupBanner; final showChatBackupBanner = controller.showChatBackupBanner;
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
@ -30,7 +31,7 @@ class SettingsView extends StatelessWidget {
title: Text(L10n.of(context)!.settings), title: Text(L10n.of(context)!.settings),
), ),
body: ListTileTheme( body: ListTileTheme(
iconColor: Theme.of(context).colorScheme.onSurface, iconColor: theme.colorScheme.onSurface,
child: ListView( child: ListView(
key: const Key('SettingsListViewContent'), key: const Key('SettingsListViewContent'),
children: <Widget>[ children: <Widget>[
@ -79,8 +80,7 @@ class SettingsView extends StatelessWidget {
size: 16, size: 16,
), ),
style: TextButton.styleFrom( style: TextButton.styleFrom(
foregroundColor: foregroundColor: theme.colorScheme.onSurface,
Theme.of(context).colorScheme.onSurface,
), ),
label: Text( label: Text(
displayname, displayname,
@ -98,8 +98,7 @@ class SettingsView extends StatelessWidget {
size: 14, size: 14,
), ),
style: TextButton.styleFrom( style: TextButton.styleFrom(
foregroundColor: foregroundColor: theme.colorScheme.secondary,
Theme.of(context).colorScheme.secondary,
), ),
label: Text( label: Text(
mxid, mxid,
@ -115,7 +114,7 @@ class SettingsView extends StatelessWidget {
); );
}, },
), ),
Divider(color: Theme.of(context).dividerColor), Divider(color: theme.dividerColor),
if (showChatBackupBanner == null) if (showChatBackupBanner == null)
ListTile( ListTile(
leading: const Icon(Icons.backup_outlined), leading: const Icon(Icons.backup_outlined),
@ -131,7 +130,7 @@ class SettingsView extends StatelessWidget {
onChanged: controller.firstRunBootstrapAction, onChanged: controller.firstRunBootstrapAction,
), ),
Divider( Divider(
color: Theme.of(context).dividerColor, color: theme.dividerColor,
), ),
ListTile( ListTile(
leading: const Icon(Icons.format_paint_outlined), leading: const Icon(Icons.format_paint_outlined),
@ -158,7 +157,7 @@ class SettingsView extends StatelessWidget {
title: Text(L10n.of(context)!.security), title: Text(L10n.of(context)!.security),
onTap: () => context.go('/rooms/settings/security'), onTap: () => context.go('/rooms/settings/security'),
), ),
Divider(color: Theme.of(context).dividerColor), Divider(color: theme.dividerColor),
ListTile( ListTile(
leading: const Icon(Icons.help_outline_outlined), leading: const Icon(Icons.help_outline_outlined),
title: Text(L10n.of(context)!.help), title: Text(L10n.of(context)!.help),
@ -174,7 +173,7 @@ class SettingsView extends StatelessWidget {
title: Text(L10n.of(context)!.about), title: Text(L10n.of(context)!.about),
onTap: () => PlatformInfos.showDialog(context), onTap: () => PlatformInfos.showDialog(context),
), ),
Divider(color: Theme.of(context).dividerColor), Divider(color: theme.dividerColor),
ListTile( ListTile(
leading: const Icon(Icons.logout_outlined), leading: const Icon(Icons.logout_outlined),
title: Text(L10n.of(context)!.logout), title: Text(L10n.of(context)!.logout),

@ -14,6 +14,8 @@ class Settings3PidView extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final theme = Theme.of(context);
controller.request ??= Matrix.of(context).client.getAccount3PIDs(); controller.request ??= Matrix.of(context).client.getAccount3PIDs();
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
@ -53,7 +55,7 @@ class Settings3PidView extends StatelessWidget {
children: [ children: [
ListTile( ListTile(
leading: CircleAvatar( leading: CircleAvatar(
backgroundColor: Theme.of(context).scaffoldBackgroundColor, backgroundColor: theme.scaffoldBackgroundColor,
foregroundColor: foregroundColor:
identifier.isEmpty ? Colors.orange : Colors.grey, identifier.isEmpty ? Colors.orange : Colors.grey,
child: Icon( child: Icon(
@ -75,8 +77,7 @@ class Settings3PidView extends StatelessWidget {
itemCount: identifier.length, itemCount: identifier.length,
itemBuilder: (BuildContext context, int i) => ListTile( itemBuilder: (BuildContext context, int i) => ListTile(
leading: CircleAvatar( leading: CircleAvatar(
backgroundColor: backgroundColor: theme.scaffoldBackgroundColor,
Theme.of(context).scaffoldBackgroundColor,
foregroundColor: Colors.grey, foregroundColor: Colors.grey,
child: Icon(identifier[i].iconData), child: Icon(identifier[i].iconData),
), ),

@ -18,10 +18,12 @@ class SettingsChatView extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final theme = Theme.of(context);
return Scaffold( return Scaffold(
appBar: AppBar(title: Text(L10n.of(context)!.chat)), appBar: AppBar(title: Text(L10n.of(context)!.chat)),
body: ListTileTheme( body: ListTileTheme(
iconColor: Theme.of(context).textTheme.bodyLarge!.color, iconColor: theme.textTheme.bodyLarge!.color,
child: MaxWidthBody( child: MaxWidthBody(
child: Column( child: Column(
children: [ children: [
@ -71,12 +73,12 @@ class SettingsChatView extends StatelessWidget {
storeKey: SettingKeys.swipeRightToLeftToReply, storeKey: SettingKeys.swipeRightToLeftToReply,
defaultValue: AppConfig.swipeRightToLeftToReply, defaultValue: AppConfig.swipeRightToLeftToReply,
), ),
Divider(color: Theme.of(context).dividerColor), Divider(color: theme.dividerColor),
ListTile( ListTile(
title: Text( title: Text(
L10n.of(context)!.customEmojisAndStickers, L10n.of(context)!.customEmojisAndStickers,
style: TextStyle( style: TextStyle(
color: Theme.of(context).colorScheme.secondary, color: theme.colorScheme.secondary,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
), ),
@ -90,12 +92,12 @@ class SettingsChatView extends StatelessWidget {
child: Icon(Icons.chevron_right_outlined), child: Icon(Icons.chevron_right_outlined),
), ),
), ),
Divider(color: Theme.of(context).dividerColor), Divider(color: theme.dividerColor),
ListTile( ListTile(
title: Text( title: Text(
L10n.of(context)!.calls, L10n.of(context)!.calls,
style: TextStyle( style: TextStyle(
color: Theme.of(context).colorScheme.secondary, color: theme.colorScheme.secondary,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
), ),

@ -231,6 +231,8 @@ class _EmojiImportPreviewState extends State<_EmojiImportPreview> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final theme = Theme.of(context);
// TODO: support Lottie here as well ... // TODO: support Lottie here as well ...
final controller = TextEditingController(text: widget.entry.value); final controller = TextEditingController(text: widget.entry.value);
@ -281,11 +283,11 @@ class _EmojiImportPreviewState extends State<_EmojiImportPreview> {
suffixText: ':', suffixText: ':',
border: const OutlineInputBorder(), border: const OutlineInputBorder(),
prefixStyle: TextStyle( prefixStyle: TextStyle(
color: Theme.of(context).colorScheme.secondary, color: theme.colorScheme.secondary,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
suffixStyle: TextStyle( suffixStyle: TextStyle(
color: Theme.of(context).colorScheme.secondary, color: theme.colorScheme.secondary,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
), ),
@ -314,6 +316,8 @@ class _ImageFileError extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final theme = Theme.of(context);
return SizedBox.square( return SizedBox.square(
dimension: 64, dimension: 64,
child: Tooltip( child: Tooltip(
@ -327,7 +331,7 @@ class _ImageFileError extends StatelessWidget {
Text( Text(
L10n.of(context)!.notAnImage, L10n.of(context)!.notAnImage,
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: Theme.of(context).textTheme.labelSmall, style: theme.textTheme.labelSmall,
), ),
], ],
), ),

@ -19,6 +19,8 @@ class EmotesSettingsView extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final theme = Theme.of(context);
final client = Matrix.of(context).client; final client = Matrix.of(context).client;
final imageKeys = controller.pack!.images.keys.toList(); final imageKeys = controller.pack!.images.keys.toList();
return Scaffold( return Scaffold(
@ -73,7 +75,7 @@ class EmotesSettingsView extends StatelessWidget {
padding: const EdgeInsets.symmetric(horizontal: 8), padding: const EdgeInsets.symmetric(horizontal: 8),
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: const BorderRadius.all(Radius.circular(10)), borderRadius: const BorderRadius.all(Radius.circular(10)),
color: Theme.of(context).secondaryHeaderColor, color: theme.secondaryHeaderColor,
), ),
child: TextField( child: TextField(
controller: controller.newImageCodeController, controller: controller.newImageCodeController,
@ -85,11 +87,11 @@ class EmotesSettingsView extends StatelessWidget {
prefixText: ': ', prefixText: ': ',
suffixText: ':', suffixText: ':',
prefixStyle: TextStyle( prefixStyle: TextStyle(
color: Theme.of(context).colorScheme.secondary, color: theme.colorScheme.secondary,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
suffixStyle: TextStyle( suffixStyle: TextStyle(
color: Theme.of(context).colorScheme.secondary, color: theme.colorScheme.secondary,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
border: InputBorder.none, border: InputBorder.none,
@ -152,7 +154,7 @@ class EmotesSettingsView extends StatelessWidget {
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: borderRadius:
const BorderRadius.all(Radius.circular(10)), const BorderRadius.all(Radius.circular(10)),
color: Theme.of(context).secondaryHeaderColor, color: theme.secondaryHeaderColor,
), ),
child: Shortcuts( child: Shortcuts(
shortcuts: !useShortCuts shortcuts: !useShortCuts
@ -188,13 +190,11 @@ class EmotesSettingsView extends StatelessWidget {
prefixText: ': ', prefixText: ': ',
suffixText: ':', suffixText: ':',
prefixStyle: TextStyle( prefixStyle: TextStyle(
color: color: theme.colorScheme.secondary,
Theme.of(context).colorScheme.secondary,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
suffixStyle: TextStyle( suffixStyle: TextStyle(
color: color: theme.colorScheme.secondary,
Theme.of(context).colorScheme.secondary,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
border: InputBorder.none, border: InputBorder.none,

@ -16,6 +16,8 @@ class SettingsIgnoreListView extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final theme = Theme.of(context);
final client = Matrix.of(context).client; final client = Matrix.of(context).client;
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
@ -58,7 +60,7 @@ class SettingsIgnoreListView extends StatelessWidget {
), ),
), ),
Divider( Divider(
color: Theme.of(context).dividerColor, color: theme.dividerColor,
), ),
Expanded( Expanded(
child: StreamBuilder<Object>( child: StreamBuilder<Object>(

@ -30,6 +30,7 @@ class SettingsNotificationsView extends StatelessWidget {
false, false,
), ),
builder: (BuildContext context, _) { builder: (BuildContext context, _) {
final theme = Theme.of(context);
return Column( return Column(
children: [ children: [
SwitchListTile.adaptive( SwitchListTile.adaptive(
@ -41,12 +42,12 @@ class SettingsNotificationsView extends StatelessWidget {
? null ? null
: (_) => controller.onToggleMuteAllNotifications(), : (_) => controller.onToggleMuteAllNotifications(),
), ),
Divider(color: Theme.of(context).dividerColor), Divider(color: theme.dividerColor),
ListTile( ListTile(
title: Text( title: Text(
L10n.of(context)!.notifyMeFor, L10n.of(context)!.notifyMeFor,
style: TextStyle( style: TextStyle(
color: Theme.of(context).colorScheme.secondary, color: theme.colorScheme.secondary,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
), ),
@ -64,12 +65,12 @@ class SettingsNotificationsView extends StatelessWidget {
: (bool enabled) => controller : (bool enabled) => controller
.setNotificationSetting(item, enabled), .setNotificationSetting(item, enabled),
), ),
Divider(color: Theme.of(context).dividerColor), Divider(color: theme.dividerColor),
ListTile( ListTile(
title: Text( title: Text(
L10n.of(context)!.devices, L10n.of(context)!.devices,
style: TextStyle( style: TextStyle(
color: Theme.of(context).colorScheme.secondary, color: theme.colorScheme.secondary,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
), ),

@ -12,6 +12,8 @@ class SettingsPasswordView extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final theme = Theme.of(context);
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
title: Text(L10n.of(context)!.changePassword), title: Text(L10n.of(context)!.changePassword),
@ -23,7 +25,7 @@ class SettingsPasswordView extends StatelessWidget {
], ],
), ),
body: ListTileTheme( body: ListTileTheme(
iconColor: Theme.of(context).colorScheme.onSurface, iconColor: theme.colorScheme.onSurface,
child: MaxWidthBody( child: MaxWidthBody(
child: Padding( child: Padding(
padding: const EdgeInsets.all(16.0), padding: const EdgeInsets.all(16.0),
@ -32,7 +34,7 @@ class SettingsPasswordView extends StatelessWidget {
Center( Center(
child: Icon( child: Icon(
Icons.key_outlined, Icons.key_outlined,
color: Theme.of(context).dividerColor, color: theme.dividerColor,
size: 80, size: 80,
), ),
), ),

@ -18,10 +18,12 @@ class SettingsSecurityView extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final theme = Theme.of(context);
return Scaffold( return Scaffold(
appBar: AppBar(title: Text(L10n.of(context)!.security)), appBar: AppBar(title: Text(L10n.of(context)!.security)),
body: ListTileTheme( body: ListTileTheme(
iconColor: Theme.of(context).colorScheme.onSurface, iconColor: theme.colorScheme.onSurface,
child: MaxWidthBody( child: MaxWidthBody(
child: FutureBuilder( child: FutureBuilder(
future: Matrix.of(context) future: Matrix.of(context)
@ -45,7 +47,7 @@ class SettingsSecurityView extends StatelessWidget {
title: Text( title: Text(
L10n.of(context)!.privacy, L10n.of(context)!.privacy,
style: TextStyle( style: TextStyle(
color: Theme.of(context).colorScheme.secondary, color: theme.colorScheme.secondary,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
), ),
@ -86,13 +88,13 @@ class SettingsSecurityView extends StatelessWidget {
), ),
}, },
Divider( Divider(
color: Theme.of(context).dividerColor, color: theme.dividerColor,
), ),
ListTile( ListTile(
title: Text( title: Text(
L10n.of(context)!.account, L10n.of(context)!.account,
style: TextStyle( style: TextStyle(
color: Theme.of(context).colorScheme.secondary, color: theme.colorScheme.secondary,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
), ),

@ -20,6 +20,8 @@ class SettingsStyleView extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final theme = Theme.of(context);
const colorPickerSize = 32.0; const colorPickerSize = 32.0;
final client = Matrix.of(context).client; final client = Matrix.of(context).client;
return Scaffold( return Scaffold(
@ -27,7 +29,7 @@ class SettingsStyleView extends StatelessWidget {
leading: const Center(child: BackButton()), leading: const Center(child: BackButton()),
title: Text(L10n.of(context)!.changeTheme), title: Text(L10n.of(context)!.changeTheme),
), ),
backgroundColor: Theme.of(context).colorScheme.surface, backgroundColor: theme.colorScheme.surface,
body: MaxWidthBody( body: MaxWidthBody(
child: Column( child: Column(
children: [ children: [
@ -35,7 +37,7 @@ class SettingsStyleView extends StatelessWidget {
title: Text( title: Text(
L10n.of(context)!.setColorTheme, L10n.of(context)!.setColorTheme,
style: TextStyle( style: TextStyle(
color: Theme.of(context).colorScheme.secondary, color: theme.colorScheme.secondary,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
), ),
@ -88,18 +90,16 @@ class SettingsStyleView extends StatelessWidget {
child: Icon( child: Icon(
Icons.check, Icons.check,
size: 16, size: 16,
color: Theme.of(context) color: theme
.colorScheme .colorScheme.onSurface,
.onSurface,
), ),
), ),
Text( Text(
L10n.of(context)!.systemTheme, L10n.of(context)!.systemTheme,
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: TextStyle( style: TextStyle(
color: Theme.of(context) color: theme
.colorScheme .colorScheme.onSurface,
.onSurface,
), ),
), ),
], ],
@ -136,13 +136,13 @@ class SettingsStyleView extends StatelessWidget {
), ),
const SizedBox(height: 8), const SizedBox(height: 8),
Divider( Divider(
color: Theme.of(context).dividerColor, color: theme.dividerColor,
), ),
ListTile( ListTile(
title: Text( title: Text(
L10n.of(context)!.setTheme, L10n.of(context)!.setTheme,
style: TextStyle( style: TextStyle(
color: Theme.of(context).colorScheme.secondary, color: theme.colorScheme.secondary,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
), ),
@ -166,13 +166,13 @@ class SettingsStyleView extends StatelessWidget {
onChanged: controller.switchTheme, onChanged: controller.switchTheme,
), ),
Divider( Divider(
color: Theme.of(context).dividerColor, color: theme.dividerColor,
), ),
ListTile( ListTile(
title: Text( title: Text(
L10n.of(context)!.overview, L10n.of(context)!.overview,
style: TextStyle( style: TextStyle(
color: Theme.of(context).colorScheme.secondary, color: theme.colorScheme.secondary,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
), ),
@ -190,13 +190,13 @@ class SettingsStyleView extends StatelessWidget {
defaultValue: AppConfig.separateChatTypes, defaultValue: AppConfig.separateChatTypes,
), ),
Divider( Divider(
color: Theme.of(context).dividerColor, color: theme.dividerColor,
), ),
ListTile( ListTile(
title: Text( title: Text(
L10n.of(context)!.messagesStyle, L10n.of(context)!.messagesStyle,
style: TextStyle( style: TextStyle(
color: Theme.of(context).colorScheme.secondary, color: theme.colorScheme.secondary,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
), ),
@ -246,7 +246,7 @@ class SettingsStyleView extends StatelessWidget {
bottom: 12, bottom: 12,
), ),
child: Material( child: Material(
color: Theme.of(context).colorScheme.primary, color: theme.colorScheme.primary,
borderRadius: BorderRadius.circular( borderRadius: BorderRadius.circular(
AppConfig.borderRadius, AppConfig.borderRadius,
), ),
@ -258,8 +258,7 @@ class SettingsStyleView extends StatelessWidget {
child: Text( child: Text(
'Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor', 'Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor',
style: TextStyle( style: TextStyle(
color: color: theme.colorScheme.onPrimary,
Theme.of(context).colorScheme.onPrimary,
fontSize: AppConfig.messageFontSize * fontSize: AppConfig.messageFontSize *
AppConfig.fontSizeFactor, AppConfig.fontSizeFactor,
), ),
@ -277,7 +276,7 @@ class SettingsStyleView extends StatelessWidget {
? null ? null
: IconButton( : IconButton(
icon: const Icon(Icons.delete_outlined), icon: const Icon(Icons.delete_outlined),
color: Theme.of(context).colorScheme.error, color: theme.colorScheme.error,
onPressed: controller.deleteChatWallpaper, onPressed: controller.deleteChatWallpaper,
), ),
onTap: controller.setWallpaper, onTap: controller.setWallpaper,

@ -62,6 +62,7 @@ class UserBottomSheetView extends StatelessWidget {
false, false,
), ),
builder: (context, snapshot) { builder: (context, snapshot) {
final theme = Theme.of(context);
return ListView( return ListView(
children: [ children: [
if (user?.membership == Membership.knock) if (user?.membership == Membership.knock)
@ -70,7 +71,7 @@ class UserBottomSheetView extends StatelessWidget {
child: Material( child: Material(
color: color:
// ignore: deprecated_member_use // ignore: deprecated_member_use
Theme.of(context).colorScheme.surfaceVariant, theme.colorScheme.surfaceVariant,
borderRadius: borderRadius:
BorderRadius.circular(AppConfig.borderRadius), BorderRadius.circular(AppConfig.borderRadius),
child: ListTile( child: ListTile(
@ -86,10 +87,8 @@ class UserBottomSheetView extends StatelessWidget {
children: [ children: [
TextButton.icon( TextButton.icon(
style: TextButton.styleFrom( style: TextButton.styleFrom(
backgroundColor: backgroundColor: theme.colorScheme.surface,
Theme.of(context).colorScheme.surface, foregroundColor: theme.colorScheme.primary,
foregroundColor:
Theme.of(context).colorScheme.primary,
), ),
onPressed: controller.knockAccept, onPressed: controller.knockAccept,
icon: const Icon(Icons.check_outlined), icon: const Icon(Icons.check_outlined),
@ -98,12 +97,10 @@ class UserBottomSheetView extends StatelessWidget {
const SizedBox(width: 12), const SizedBox(width: 12),
TextButton.icon( TextButton.icon(
style: TextButton.styleFrom( style: TextButton.styleFrom(
backgroundColor: Theme.of(context) backgroundColor:
.colorScheme theme.colorScheme.errorContainer,
.errorContainer, foregroundColor:
foregroundColor: Theme.of(context) theme.colorScheme.onErrorContainer,
.colorScheme
.onErrorContainer,
), ),
onPressed: controller.knockDecline, onPressed: controller.knockDecline,
icon: const Icon(Icons.cancel_outlined), icon: const Icon(Icons.cancel_outlined),
@ -142,8 +139,7 @@ class UserBottomSheetView extends StatelessWidget {
size: 14, size: 14,
), ),
style: TextButton.styleFrom( style: TextButton.styleFrom(
foregroundColor: foregroundColor: theme.colorScheme.onSurface,
Theme.of(context).colorScheme.onSurface,
), ),
label: Text( label: Text(
userId, userId,
@ -187,8 +183,7 @@ class UserBottomSheetView extends StatelessWidget {
Text( Text(
L10n.of(context)!.currentlyActive, L10n.of(context)!.currentlyActive,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
style: style: theme.textTheme.bodySmall,
Theme.of(context).textTheme.bodySmall,
) )
else if (lastActiveTimestamp != null) else if (lastActiveTimestamp != null)
Text( Text(
@ -197,8 +192,7 @@ class UserBottomSheetView extends StatelessWidget {
.localizedTimeShort(context), .localizedTimeShort(context),
), ),
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
style: style: theme.textTheme.bodySmall,
Theme.of(context).textTheme.bodySmall,
), ),
], ],
); );
@ -283,7 +277,7 @@ class UserBottomSheetView extends StatelessWidget {
.participantAction(UserBottomSheetAction.mention), .participantAction(UserBottomSheetAction.mention),
), ),
if (user != null) ...[ if (user != null) ...[
Divider(color: Theme.of(context).dividerColor), Divider(color: theme.dividerColor),
ListTile( ListTile(
title: Text( title: Text(
'${L10n.of(context)!.userRole} (${user.powerLevel})', '${L10n.of(context)!.userRole} (${user.powerLevel})',
@ -292,7 +286,7 @@ class UserBottomSheetView extends StatelessWidget {
trailing: Material( trailing: Material(
borderRadius: borderRadius:
BorderRadius.circular(AppConfig.borderRadius / 2), BorderRadius.circular(AppConfig.borderRadius / 2),
color: Theme.of(context).colorScheme.onInverseSurface, color: theme.colorScheme.onInverseSurface,
child: DropdownButton<int>( child: DropdownButton<int>(
onChanged: user.canChangeUserPowerLevel || onChanged: user.canChangeUserPowerLevel ||
// Workaround until https://github.com/famedly/matrix-dart-sdk/pull/1765 // Workaround until https://github.com/famedly/matrix-dart-sdk/pull/1765
@ -329,11 +323,11 @@ class UserBottomSheetView extends StatelessWidget {
), ),
), ),
], ],
Divider(color: Theme.of(context).dividerColor), Divider(color: theme.dividerColor),
if (user != null && user.canKick) if (user != null && user.canKick)
ListTile( ListTile(
textColor: Theme.of(context).colorScheme.error, textColor: theme.colorScheme.error,
iconColor: Theme.of(context).colorScheme.error, iconColor: theme.colorScheme.error,
title: Text(L10n.of(context)!.kickFromChat), title: Text(L10n.of(context)!.kickFromChat),
leading: const Icon(Icons.exit_to_app_outlined), leading: const Icon(Icons.exit_to_app_outlined),
onTap: () => controller onTap: () => controller
@ -343,8 +337,8 @@ class UserBottomSheetView extends StatelessWidget {
user.canBan && user.canBan &&
user.membership != Membership.ban) user.membership != Membership.ban)
ListTile( ListTile(
textColor: Theme.of(context).colorScheme.onErrorContainer, textColor: theme.colorScheme.onErrorContainer,
iconColor: Theme.of(context).colorScheme.onErrorContainer, iconColor: theme.colorScheme.onErrorContainer,
title: Text(L10n.of(context)!.banFromChat), title: Text(L10n.of(context)!.banFromChat),
leading: const Icon(Icons.warning_sharp), leading: const Icon(Icons.warning_sharp),
onTap: () => onTap: () =>
@ -361,8 +355,8 @@ class UserBottomSheetView extends StatelessWidget {
), ),
if (user != null && user.id != client.userID) if (user != null && user.id != client.userID)
ListTile( ListTile(
textColor: Theme.of(context).colorScheme.onErrorContainer, textColor: theme.colorScheme.onErrorContainer,
iconColor: Theme.of(context).colorScheme.onErrorContainer, iconColor: theme.colorScheme.onErrorContainer,
title: Text(L10n.of(context)!.reportUser), title: Text(L10n.of(context)!.reportUser),
leading: const Icon(Icons.gavel_outlined), leading: const Icon(Icons.gavel_outlined),
onTap: () => controller onTap: () => controller
@ -382,8 +376,8 @@ class UserBottomSheetView extends StatelessWidget {
if (userId != client.userID && if (userId != client.userID &&
!client.ignoredUsers.contains(userId)) !client.ignoredUsers.contains(userId))
ListTile( ListTile(
textColor: Theme.of(context).colorScheme.onErrorContainer, textColor: theme.colorScheme.onErrorContainer,
iconColor: Theme.of(context).colorScheme.onErrorContainer, iconColor: theme.colorScheme.onErrorContainer,
leading: const Icon(Icons.block_outlined), leading: const Icon(Icons.block_outlined),
title: Text(L10n.of(context)!.block), title: Text(L10n.of(context)!.block),
onTap: () => controller onTap: () => controller

@ -11,6 +11,7 @@ abstract class UpdateNotifier {
static const String versionStoreKey = 'last_known_version'; static const String versionStoreKey = 'last_known_version';
static void showUpdateSnackBar(BuildContext context) async { static void showUpdateSnackBar(BuildContext context) async {
final theme = Theme.of(context);
final scaffoldMessenger = ScaffoldMessenger.of(context); final scaffoldMessenger = ScaffoldMessenger.of(context);
final currentVersion = await PlatformInfos.getVersion(); final currentVersion = await PlatformInfos.getVersion();
final store = await SharedPreferences.getInstance(); final store = await SharedPreferences.getInstance();
@ -28,7 +29,7 @@ abstract class UpdateNotifier {
icon: Icon( icon: Icon(
Icons.close_outlined, Icons.close_outlined,
size: 20, size: 20,
color: Theme.of(context).colorScheme.onPrimary, color: theme.colorScheme.onPrimary,
), ),
onPressed: () => controller?.close(), onPressed: () => controller?.close(),
), ),

@ -35,6 +35,8 @@ class Avatar extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final theme = Theme.of(context);
var fallbackLetters = '@'; var fallbackLetters = '@';
final name = this.name; final name = this.name;
if (name != null) { if (name != null) {
@ -68,7 +70,7 @@ class Avatar extends StatelessWidget {
width: size, width: size,
height: size, height: size,
child: Material( child: Material(
color: Theme.of(context).brightness == Brightness.light color: theme.brightness == Brightness.light
? Colors.white ? Colors.white
: Colors.black, : Colors.black,
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
@ -89,7 +91,7 @@ class Avatar extends StatelessWidget {
placeholder: (_) => Center( placeholder: (_) => Center(
child: Icon( child: Icon(
Icons.person_2, Icons.person_2,
color: Theme.of(context).colorScheme.tertiary, color: theme.colorScheme.tertiary,
size: size / 1.5, size: size / 1.5,
), ),
), ),
@ -118,8 +120,7 @@ class Avatar extends StatelessWidget {
width: 16, width: 16,
height: 16, height: 16,
decoration: BoxDecoration( decoration: BoxDecoration(
color: presenceBackgroundColor ?? color: presenceBackgroundColor ?? theme.colorScheme.surface,
Theme.of(context).colorScheme.surface,
borderRadius: BorderRadius.circular(32), borderRadius: BorderRadius.circular(32),
), ),
alignment: Alignment.center, alignment: Alignment.center,
@ -131,7 +132,7 @@ class Avatar extends StatelessWidget {
borderRadius: BorderRadius.circular(16), borderRadius: BorderRadius.circular(16),
border: Border.all( border: Border.all(
width: 1, width: 1,
color: Theme.of(context).colorScheme.surface, color: theme.colorScheme.surface,
), ),
), ),
), ),

@ -35,6 +35,8 @@ class ConnectionStatusHeaderState extends State<ConnectionStatusHeader> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final theme = Theme.of(context);
final client = Matrix.of(context).client; final client = Matrix.of(context).client;
final status = client.onSyncStatus.value ?? final status = client.onSyncStatus.value ??
const SyncStatusUpdate(SyncStatus.waitingForResponse); const SyncStatusUpdate(SyncStatus.waitingForResponse);
@ -65,7 +67,7 @@ class ConnectionStatusHeaderState extends State<ConnectionStatusHeader> {
status.toLocalizedString(context), status.toLocalizedString(context),
maxLines: 1, maxLines: 1,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
style: TextStyle(color: Theme.of(context).colorScheme.onSurface), style: TextStyle(color: theme.colorScheme.onSurface),
), ),
], ],
), ),

@ -23,6 +23,8 @@ class LoginScaffold extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final theme = Theme.of(context);
final isMobileMode = final isMobileMode =
enforceMobileMode || !FluffyThemes.isColumnMode(context); enforceMobileMode || !FluffyThemes.isColumnMode(context);
final scaffold = Scaffold( final scaffold = Scaffold(
@ -40,13 +42,12 @@ class LoginScaffold extends StatelessWidget {
backgroundColor: isMobileMode ? null : Colors.transparent, backgroundColor: isMobileMode ? null : Colors.transparent,
), ),
body: body, body: body,
backgroundColor: isMobileMode backgroundColor:
? null isMobileMode ? null : theme.colorScheme.surface.withOpacity(0.8),
: Theme.of(context).colorScheme.surface.withOpacity(0.8),
bottomNavigationBar: isMobileMode bottomNavigationBar: isMobileMode
? Material( ? Material(
elevation: 4, elevation: 4,
shadowColor: Theme.of(context).colorScheme.onSurface, shadowColor: theme.colorScheme.onSurface,
child: const _PrivacyButtons( child: const _PrivacyButtons(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
), ),
@ -72,9 +73,8 @@ class LoginScaffold extends StatelessWidget {
color: Colors.transparent, color: Colors.transparent,
borderRadius: BorderRadius.circular(AppConfig.borderRadius), borderRadius: BorderRadius.circular(AppConfig.borderRadius),
clipBehavior: Clip.hardEdge, clipBehavior: Clip.hardEdge,
elevation: elevation: theme.appBarTheme.scrolledUnderElevation ?? 4,
Theme.of(context).appBarTheme.scrolledUnderElevation ?? 4, shadowColor: theme.appBarTheme.shadowColor,
shadowColor: Theme.of(context).appBarTheme.shadowColor,
child: ConstrainedBox( child: ConstrainedBox(
constraints: isMobileMode constraints: isMobileMode
? const BoxConstraints() ? const BoxConstraints()

@ -21,6 +21,8 @@ class MaxWidthBody extends StatelessWidget {
return SafeArea( return SafeArea(
child: LayoutBuilder( child: LayoutBuilder(
builder: (context, constraints) { builder: (context, constraints) {
final theme = Theme.of(context);
const desiredWidth = FluffyThemes.columnWidth * 1.5; const desiredWidth = FluffyThemes.columnWidth * 1.5;
final body = constraints.maxWidth <= desiredWidth final body = constraints.maxWidth <= desiredWidth
? child ? child
@ -32,14 +34,11 @@ class MaxWidthBody extends StatelessWidget {
maxWidth: FluffyThemes.columnWidth * 1.5, maxWidth: FluffyThemes.columnWidth * 1.5,
), ),
child: Material( child: Material(
elevation: Theme.of(context) elevation: theme.appBarTheme.scrolledUnderElevation ?? 4,
.appBarTheme
.scrolledUnderElevation ??
4,
clipBehavior: Clip.hardEdge, clipBehavior: Clip.hardEdge,
borderRadius: borderRadius:
BorderRadius.circular(AppConfig.borderRadius), BorderRadius.circular(AppConfig.borderRadius),
shadowColor: Theme.of(context).appBarTheme.shadowColor, shadowColor: theme.appBarTheme.shadowColor,
child: child, child: child,
), ),
), ),

@ -15,6 +15,8 @@ class TwoColumnLayout extends StatelessWidget {
}); });
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final theme = Theme.of(context);
return ScaffoldMessenger( return ScaffoldMessenger(
child: Scaffold( child: Scaffold(
body: Row( body: Row(
@ -28,7 +30,7 @@ class TwoColumnLayout extends StatelessWidget {
), ),
Container( Container(
width: 1.0, width: 1.0,
color: Theme.of(context).dividerColor, color: theme.dividerColor,
), ),
Expanded( Expanded(
child: ClipRRect( child: ClipRRect(

@ -113,6 +113,8 @@ class PublicRoomBottomSheet extends StatelessWidget {
body: FutureBuilder<PublicRoomsChunk>( body: FutureBuilder<PublicRoomsChunk>(
future: _search(), future: _search(),
builder: (context, snapshot) { builder: (context, snapshot) {
final theme = Theme.of(context);
final profile = snapshot.data; final profile = snapshot.data;
return ListView( return ListView(
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
@ -150,8 +152,7 @@ class PublicRoomBottomSheet extends StatelessWidget {
size: 14, size: 14,
), ),
style: TextButton.styleFrom( style: TextButton.styleFrom(
foregroundColor: foregroundColor: theme.colorScheme.onSurface,
Theme.of(context).colorScheme.onSurface,
), ),
label: Text( label: Text(
roomLink ?? '...', roomLink ?? '...',
@ -166,8 +167,7 @@ class PublicRoomBottomSheet extends StatelessWidget {
size: 14, size: 14,
), ),
style: TextButton.styleFrom( style: TextButton.styleFrom(
foregroundColor: foregroundColor: theme.colorScheme.onSurface,
Theme.of(context).colorScheme.onSurface,
), ),
label: Text( label: Text(
L10n.of(context)!.countParticipants( L10n.of(context)!.countParticipants(
@ -211,7 +211,7 @@ class PublicRoomBottomSheet extends StatelessWidget {
), ),
style: TextStyle( style: TextStyle(
fontSize: 14, fontSize: 14,
color: Theme.of(context).textTheme.bodyMedium!.color, color: theme.textTheme.bodyMedium!.color,
), ),
options: const LinkifyOptions(humanize: false), options: const LinkifyOptions(humanize: false),
onOpen: (url) => onOpen: (url) =>

@ -19,6 +19,8 @@ class UnreadRoomsBadge extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final theme = Theme.of(context);
final unreadCount = Matrix.of(context) final unreadCount = Matrix.of(context)
.client .client
.rooms .rooms
@ -27,17 +29,17 @@ class UnreadRoomsBadge extends StatelessWidget {
.length; .length;
return b.Badge( return b.Badge(
badgeStyle: b.BadgeStyle( badgeStyle: b.BadgeStyle(
badgeColor: Theme.of(context).colorScheme.primary, badgeColor: theme.colorScheme.primary,
elevation: 4, elevation: 4,
borderSide: BorderSide( borderSide: BorderSide(
color: Theme.of(context).colorScheme.surface, color: theme.colorScheme.surface,
width: 2, width: 2,
), ),
), ),
badgeContent: Text( badgeContent: Text(
unreadCount.toString(), unreadCount.toString(),
style: TextStyle( style: TextStyle(
color: Theme.of(context).colorScheme.onPrimary, color: theme.colorScheme.onPrimary,
fontSize: 12, fontSize: 12,
), ),
), ),

Loading…
Cancel
Save