Skip to content

Commit

Permalink
fix: Styling issue with YaruPopupMenuButton (#873)
Browse files Browse the repository at this point in the history
Fixes #774
  • Loading branch information
Feichtmeier authored Mar 5, 2024
1 parent c124d7a commit 91bf92b
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 5 deletions.
2 changes: 2 additions & 0 deletions example/lib/pages/theme_page/src/controls/chips.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
import 'package:yaru/yaru.dart';

import '../constants.dart';

Expand All @@ -13,6 +14,7 @@ class Chips extends StatelessWidget {
children: [
const Chip(label: Text('Ch-ch-ch-Chip n Dale')),
Chip(
deleteIcon: const Icon(YaruIcons.window_close),
label: const Text('Rescue Rangers'),
onDeleted: () {},
),
Expand Down
7 changes: 5 additions & 2 deletions example/lib/pages/theme_page/src/controls/toggleables.dart
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,18 @@ class _ToggleablesState extends State<Toggleables> {
),
],
),
Row(
Wrap(
spacing: 10,
children: [
Switch(onChanged: (value) {}, value: true),
Switch(onChanged: (value) {}, value: false),
const Switch(value: true, onChanged: null),
const Switch(value: false, onChanged: null),
],
),
Row(
Wrap(
spacing: 10,
runSpacing: 10,
children: [
ToggleButtons(
isSelected: const [true, false, false],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
import 'package:yaru/yaru.dart';

import '../constants.dart';

Expand Down Expand Up @@ -90,6 +91,8 @@ class _TextFieldsViewState extends State<TextFieldsView> {
maxLines: 5,
),
const DropdownMenu(
trailingIcon: Icon(YaruIcons.pan_down),
selectedTrailingIcon: Icon(YaruIcons.pan_down),
dropdownMenuEntries: [
DropdownMenuEntry(value: 1, label: '1'),
DropdownMenuEntry(value: 2, label: '2'),
Expand Down
10 changes: 7 additions & 3 deletions lib/src/widgets/yaru_popup_menu_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,12 @@ class YaruPopupMenuButton<T> extends StatelessWidget {
return DecoratedBox(
decoration: ShapeDecoration(shape: shape.copyWith(side: side)),
child: Material(
color: Colors.transparent,
color: style?.backgroundColor?.resolve({}) ?? Colors.transparent,
clipBehavior: Clip.antiAlias,
shape: shape,
child: PopupMenuButton(
color: style?.foregroundColor?.resolve({}),
iconColor: style?.foregroundColor?.resolve({}),
enabled: enabled,
elevation: elevation,
position: position,
Expand All @@ -88,7 +90,8 @@ class YaruPopupMenuButton<T> extends StatelessWidget {
padding: padding,
child: DefaultTextStyle(
style: TextStyle(
color: Theme.of(context).colorScheme.onSurface,
color: style?.foregroundColor?.resolve({}) ??
Theme.of(context).colorScheme.onSurface,
fontWeight: FontWeight.w500,
),
child: Row(
Expand All @@ -102,8 +105,9 @@ class YaruPopupMenuButton<T> extends StatelessWidget {
SizedBox(
height: kYaruTitleBarItemHeight,
child: icon ??
const Icon(
Icon(
YaruIcons.pan_down,
color: style?.foregroundColor?.resolve({}),
),
),
],
Expand Down

0 comments on commit 91bf92b

Please sign in to comment.