Skip to content

Commit 58debf5

Browse files
committed
compose [nfc]: Refactor away shared iconTheme override
Because these buttons share the same superclass, we can de-duplicate styling code without the theme override. This helps de-nest the layout code. While more types of buttons that are not subclasses of `_AttachUploadsButton` might be added, a theme is probably still unnecessary given that we can lift a common button class that handles the styling. Signed-off-by: Zixuan James Li <[email protected]>
1 parent 56b7a19 commit 58debf5

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

lib/widgets/compose_box.dart

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -659,9 +659,10 @@ abstract class _AttachUploadsButton extends StatelessWidget {
659659

660660
@override
661661
Widget build(BuildContext context) {
662+
ColorScheme colorScheme = Theme.of(context).colorScheme;
662663
final zulipLocalizations = ZulipLocalizations.of(context);
663664
return IconButton(
664-
icon: Icon(icon),
665+
icon: Icon(icon, color: colorScheme.onSurfaceVariant),
665666
tooltip: tooltip(zulipLocalizations),
666667
onPressed: () => _handlePress(context));
667668
}
@@ -1033,14 +1034,11 @@ class _ComposeBoxLayout extends StatelessWidget {
10331034
const SizedBox(width: 8),
10341035
sendButton,
10351036
]),
1036-
Theme(
1037-
data: themeData.copyWith(
1038-
iconTheme: themeData.iconTheme.copyWith(color: colorScheme.onSurfaceVariant)),
1039-
child: Row(children: [
1040-
_AttachFileButton(contentController: contentController, contentFocusNode: contentFocusNode),
1041-
_AttachMediaButton(contentController: contentController, contentFocusNode: contentFocusNode),
1042-
_AttachFromCameraButton(contentController: contentController, contentFocusNode: contentFocusNode),
1043-
])),
1037+
Row(children: [
1038+
_AttachFileButton(contentController: contentController, contentFocusNode: contentFocusNode),
1039+
_AttachMediaButton(contentController: contentController, contentFocusNode: contentFocusNode),
1040+
_AttachFromCameraButton(contentController: contentController, contentFocusNode: contentFocusNode),
1041+
]),
10441042
]));
10451043
}
10461044
}

0 commit comments

Comments
 (0)