Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Styling issue with YaruPopupMenuButton #873

Merged
merged 1 commit into from
Mar 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading