Skip to content

Commit

Permalink
fix: Allow search box to shrink on low width
Browse files Browse the repository at this point in the history
  • Loading branch information
spydon committed Oct 3, 2024
1 parent 1edf713 commit 49ba5d7
Showing 1 changed file with 65 additions and 54 deletions.
119 changes: 65 additions & 54 deletions packages/app_center/lib/manage/manage_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -173,61 +173,72 @@ class ManagePage extends ConsumerWidget {
.titleMedium!
.copyWith(fontWeight: FontWeight.w500),
),
const Spacer(),
ConstrainedBox(
constraints: const BoxConstraints(maxWidth: 300),
// TODO: refactor - extract common text field decoration from
// here and the `SearchField` widget
child: TextFormField(
style: Theme.of(context).textTheme.bodyMedium,
strutStyle: kSearchFieldStrutStyle,
textAlignVertical: TextAlignVertical.center,
cursorWidth: 1,
decoration: InputDecoration(
prefixIcon: kSearchFieldPrefixIcon,
prefixIconConstraints: kSearchFieldIconConstraints,
hintText: l10n.managePageSearchFieldSearchHint,
),
initialValue: ref.watch(localSnapFilterProvider),
onChanged: (value) => ref
.read(localSnapFilterProvider.notifier)
.state = value,
),
),
const SizedBox(width: kSpacing),
Text(l10n.searchPageSortByLabel),
const SizedBox(width: kSpacingSmall),
// TODO: refactor - create proper widget
Consumer(
builder: (context, ref, child) {
final sortOrder = ref.watch(localSnapSortOrderProvider);
return MenuButtonBuilder<SnapSortOrder>(
values: const [
SnapSortOrder.alphabeticalAsc,
SnapSortOrder.alphabeticalDesc,
SnapSortOrder.installedDateAsc,
SnapSortOrder.installedDateDesc,
SnapSortOrder.installedSizeAsc,
SnapSortOrder.installedSizeDesc,
],
itemBuilder: (context, sortOrder, child) =>
Text(sortOrder.localize(l10n)),
onSelected: (value) => ref
.read(localSnapSortOrderProvider.notifier)
.state = value,
expanded: false,
child: Text(sortOrder.localize(l10n)),
);
},
),
const SizedBox(width: kSpacing),
Text(l10n.managePageShowSystemSnapsLabel),
const SizedBox(width: kSpacingSmall),
YaruCheckbox(
value: ref.watch(showLocalSystemAppsProvider),
onChanged: (value) => ref
.read(showLocalSystemAppsProvider.notifier)
.state = value ?? false,
Expanded(
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
Flexible(
child: ConstrainedBox(
constraints: const BoxConstraints(maxWidth: 300),
// TODO: refactor - extract common text field decoration from
// here and the `SearchField` widget
child: TextFormField(
style: Theme.of(context).textTheme.bodyMedium,
strutStyle: kSearchFieldStrutStyle,
textAlignVertical: TextAlignVertical.center,
cursorWidth: 1,
decoration: InputDecoration(
prefixIcon: kSearchFieldPrefixIcon,
prefixIconConstraints:
kSearchFieldIconConstraints,
hintText: l10n.managePageSearchFieldSearchHint,
),
initialValue: ref.watch(localSnapFilterProvider),
onChanged: (value) => ref
.read(localSnapFilterProvider.notifier)
.state = value,
),
),
),
const SizedBox(width: kSpacing),
Text(l10n.searchPageSortByLabel),
const SizedBox(width: kSpacingSmall),
// TODO: refactor - create proper widget
Consumer(
builder: (context, ref, child) {
final sortOrder =
ref.watch(localSnapSortOrderProvider);
return MenuButtonBuilder<SnapSortOrder>(
values: const [
SnapSortOrder.alphabeticalAsc,
SnapSortOrder.alphabeticalDesc,
SnapSortOrder.installedDateAsc,
SnapSortOrder.installedDateDesc,
SnapSortOrder.installedSizeAsc,
SnapSortOrder.installedSizeDesc,
],
itemBuilder: (context, sortOrder, child) =>
Text(sortOrder.localize(l10n)),
onSelected: (value) => ref
.read(localSnapSortOrderProvider.notifier)
.state = value,
expanded: false,
child: Text(sortOrder.localize(l10n)),
);
},
),
const SizedBox(width: kSpacing),
Text(l10n.managePageShowSystemSnapsLabel),
const SizedBox(width: kSpacingSmall),
YaruCheckbox(
value: ref.watch(showLocalSystemAppsProvider),
onChanged: (value) => ref
.read(showLocalSystemAppsProvider.notifier)
.state = value ?? false,
),
],
),
),
],
),
Expand Down

0 comments on commit 49ba5d7

Please sign in to comment.