Refactor: Reduce .of(context) calls theme

Signed commit
This commit is contained in:
Thomas Klein Langenhorst 2024-08-04 14:09:36 +02:00
commit 5d2aaef3ca
No known key found for this signature in database
GPG key ID: CA868C3CB279DA5B
69 changed files with 525 additions and 501 deletions

View file

@ -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,
),
],
),

View file

@ -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,