Skip to content

Commit

Permalink
Merge pull request #1545 from ubuntu/feat/sort-by-button-reduced-width
Browse files Browse the repository at this point in the history
fix: Removing the Expanded widget that make the button full width
  • Loading branch information
spydon authored Dec 20, 2023
2 parents 86e0e9e + f48b853 commit b8df931
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 26 deletions.
48 changes: 23 additions & 25 deletions packages/app_center/lib/src/search/search_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -48,31 +48,29 @@ class SearchPage extends StatelessWidget {
Row(children: [
Text(l10n.searchPageSortByLabel),
const SizedBox(width: 8),
Expanded(
child: Consumer(builder: (context, ref, child) {
final sortOrder = ref.watch(snapSortOrderProvider);
return MenuButtonBuilder<SnapSortOrder?>(
values: const [
null,
SnapSortOrder.alphabeticalAsc,
SnapSortOrder.alphabeticalDesc,
SnapSortOrder.downloadSizeAsc,
SnapSortOrder.downloadSizeDesc,
],
itemBuilder: (context, sortOrder, child) => Text(
sortOrder?.localize(l10n) ??
l10n.snapSortOrderRelevance,
),
onSelected: (value) => ref
.read(snapSortOrderProvider.notifier)
.state = value,
child: Text(
sortOrder?.localize(l10n) ??
l10n.snapSortOrderRelevance,
),
);
}),
),
Consumer(builder: (context, ref, child) {
final sortOrder = ref.watch(snapSortOrderProvider);
return MenuButtonBuilder<SnapSortOrder?>(
values: const [
null,
SnapSortOrder.alphabeticalAsc,
SnapSortOrder.alphabeticalDesc,
SnapSortOrder.downloadSizeAsc,
SnapSortOrder.downloadSizeDesc,
],
itemBuilder: (context, sortOrder, child) => Text(
sortOrder?.localize(l10n) ??
l10n.snapSortOrderRelevance,
),
onSelected: (value) => ref
.read(snapSortOrderProvider.notifier)
.state = value,
child: Text(
sortOrder?.localize(l10n) ??
l10n.snapSortOrderRelevance,
),
);
}),
if (query != null) ...[
const SizedBox(width: 24),
Text(l10n.searchPageFilterByLabel),
Expand Down
2 changes: 1 addition & 1 deletion packages/app_center/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ dependencies:
ubuntu_logger: ^0.1.0
ubuntu_service: ^0.3.0
ubuntu_test: ^0.1.0-0
ubuntu_widgets: ^0.3.0
ubuntu_widgets: ^0.3.1
url_launcher: ^6.2.1
xdg_directories: ^1.0.3
yaru: ^1.2.0
Expand Down

0 comments on commit b8df931

Please sign in to comment.