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

@ -1313,49 +1313,52 @@ class ChatController extends State<ChatPageWithRoom>
}
@override
Widget build(BuildContext context) => Row(
children: [
Expanded(
child: ChatView(this),
),
AnimatedSize(
duration: FluffyThemes.animationDuration,
curve: FluffyThemes.animationCurve,
child: ValueListenableBuilder(
valueListenable: _displayChatDetailsColumn,
builder: (context, displayChatDetailsColumn, _) {
if (!FluffyThemes.isThreeColumnMode(context) ||
room.membership != Membership.join ||
!displayChatDetailsColumn) {
return const SizedBox(
height: double.infinity,
width: 0,
);
}
return Container(
width: FluffyThemes.columnWidth,
clipBehavior: Clip.hardEdge,
decoration: BoxDecoration(
border: Border(
left: BorderSide(
width: 1,
color: Theme.of(context).dividerColor,
),
Widget build(BuildContext context) {
final theme = Theme.of(context);
return Row(
children: [
Expanded(
child: ChatView(this),
),
AnimatedSize(
duration: FluffyThemes.animationDuration,
curve: FluffyThemes.animationCurve,
child: ValueListenableBuilder(
valueListenable: _displayChatDetailsColumn,
builder: (context, displayChatDetailsColumn, _) {
if (!FluffyThemes.isThreeColumnMode(context) ||
room.membership != Membership.join ||
!displayChatDetailsColumn) {
return const SizedBox(
height: double.infinity,
width: 0,
);
}
return Container(
width: FluffyThemes.columnWidth,
clipBehavior: Clip.hardEdge,
decoration: BoxDecoration(
border: Border(
left: BorderSide(
width: 1,
color: theme.dividerColor,
),
),
child: ChatDetails(
roomId: roomId,
embeddedCloseButton: IconButton(
icon: const Icon(Icons.close),
onPressed: toggleDisplayChatDetailsColumn,
),
),
child: ChatDetails(
roomId: roomId,
embeddedCloseButton: IconButton(
icon: const Icon(Icons.close),
onPressed: toggleDisplayChatDetailsColumn,
),
);
},
),
),
);
},
),
],
);
),
],
);
}
}
enum EmojiPickerType { reaction, keyboard }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@ -131,6 +131,8 @@ class RecordingDialogState extends State<RecordingDialog> {
@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
const maxDecibalWidth = 64.0;
final time =
'${_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),
width: 4,
decoration: BoxDecoration(
color: Theme.of(context).colorScheme.primary,
color: theme.colorScheme.primary,
borderRadius:
BorderRadius.circular(AppConfig.borderRadius),
),
@ -185,11 +187,7 @@ class RecordingDialogState extends State<RecordingDialog> {
child: Text(
L10n.of(context)!.cancel.toUpperCase(),
style: TextStyle(
color: Theme.of(context)
.textTheme
.bodyMedium
?.color
?.withAlpha(150),
color: theme.textTheme.bodyMedium?.color?.withAlpha(150),
),
),
),
@ -209,8 +207,7 @@ class RecordingDialogState extends State<RecordingDialog> {
child: Text(
L10n.of(context)!.cancel.toUpperCase(),
style: TextStyle(
color:
Theme.of(context).textTheme.bodyMedium?.color?.withAlpha(150),
color: theme.textTheme.bodyMedium?.color?.withAlpha(150),
),
),
),

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@ -17,55 +17,59 @@ class SearchTitle extends StatelessWidget {
});
@override
Widget build(BuildContext context) => Material(
shape: Border(
top: BorderSide(
color: Theme.of(context).dividerColor,
width: 1,
),
bottom: BorderSide(
color: Theme.of(context).dividerColor,
width: 1,
),
Widget build(BuildContext context) {
final theme = Theme.of(context);
return Material(
shape: Border(
top: BorderSide(
color: theme.dividerColor,
width: 1,
),
color: color ?? Theme.of(context).colorScheme.surface,
child: InkWell(
onTap: onTap,
splashColor: Theme.of(context).colorScheme.surface,
child: Align(
alignment: Alignment.centerLeft,
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: 16,
vertical: 8,
),
child: IconTheme(
data: Theme.of(context).iconTheme.copyWith(size: 16),
child: Row(
children: [
icon,
const SizedBox(width: 16),
Text(
title,
textAlign: TextAlign.left,
style: TextStyle(
color: Theme.of(context).colorScheme.onSurface,
fontSize: 12,
fontWeight: FontWeight.bold,
),
bottom: BorderSide(
color: theme.dividerColor,
width: 1,
),
),
color: color ?? theme.colorScheme.surface,
child: InkWell(
onTap: onTap,
splashColor: theme.colorScheme.surface,
child: Align(
alignment: Alignment.centerLeft,
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: 16,
vertical: 8,
),
child: IconTheme(
data: theme.iconTheme.copyWith(size: 16),
child: Row(
children: [
icon,
const SizedBox(width: 16),
Text(
title,
textAlign: TextAlign.left,
style: TextStyle(
color: theme.colorScheme.onSurface,
fontSize: 12,
fontWeight: FontWeight.bold,
),
if (trailing != null)
Expanded(
child: Align(
alignment: Alignment.centerRight,
child: trailing!,
),
),
if (trailing != null)
Expanded(
child: Align(
alignment: Alignment.centerRight,
child: trailing!,
),
],
),
),
],
),
),
),
),
);
),
);
}
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@ -35,6 +35,8 @@ class ConnectionStatusHeaderState extends State<ConnectionStatusHeader> {
@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
final client = Matrix.of(context).client;
final status = client.onSyncStatus.value ??
const SyncStatusUpdate(SyncStatus.waitingForResponse);
@ -65,7 +67,7 @@ class ConnectionStatusHeaderState extends State<ConnectionStatusHeader> {
status.toLocalizedString(context),
maxLines: 1,
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
Widget build(BuildContext context) {
final theme = Theme.of(context);
final isMobileMode =
enforceMobileMode || !FluffyThemes.isColumnMode(context);
final scaffold = Scaffold(
@ -40,13 +42,12 @@ class LoginScaffold extends StatelessWidget {
backgroundColor: isMobileMode ? null : Colors.transparent,
),
body: body,
backgroundColor: isMobileMode
? null
: Theme.of(context).colorScheme.surface.withOpacity(0.8),
backgroundColor:
isMobileMode ? null : theme.colorScheme.surface.withOpacity(0.8),
bottomNavigationBar: isMobileMode
? Material(
elevation: 4,
shadowColor: Theme.of(context).colorScheme.onSurface,
shadowColor: theme.colorScheme.onSurface,
child: const _PrivacyButtons(
mainAxisAlignment: MainAxisAlignment.center,
),
@ -72,9 +73,8 @@ class LoginScaffold extends StatelessWidget {
color: Colors.transparent,
borderRadius: BorderRadius.circular(AppConfig.borderRadius),
clipBehavior: Clip.hardEdge,
elevation:
Theme.of(context).appBarTheme.scrolledUnderElevation ?? 4,
shadowColor: Theme.of(context).appBarTheme.shadowColor,
elevation: theme.appBarTheme.scrolledUnderElevation ?? 4,
shadowColor: theme.appBarTheme.shadowColor,
child: ConstrainedBox(
constraints: isMobileMode
? const BoxConstraints()

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

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

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

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

Loading…
Cancel
Save