mirror of
https://github.com/GopeedLab/gopeed.git
synced 2026-11-15 21:03:41 +00:00
fix(ui): refine narrow layouts and enable tab swipes
This commit is contained in:
1 parent
e47a20a1bd
commit
c703c52cbc
17 files changed
+624
-182
No files matched your search
@@ -21,6 +21,7 @@ class AppChoiceSegmentedControl<T extends Object> extends StatelessWidget {
|
||||
required this.onChanged,
|
||||
this.buttonKeyPrefix = 'choice',
|
||||
this.alignment,
|
||||
this.showIcons = true,
|
||||
});
|
||||
|
||||
final T value;
|
||||
@@ -28,6 +29,7 @@ class AppChoiceSegmentedControl<T extends Object> extends StatelessWidget {
|
||||
final ValueChanged<T> onChanged;
|
||||
final String buttonKeyPrefix;
|
||||
final WrapAlignment? alignment;
|
||||
final bool showIcons;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -44,6 +46,7 @@ class AppChoiceSegmentedControl<T extends Object> extends StatelessWidget {
|
||||
option: option,
|
||||
selected: option.value == value,
|
||||
palette: palette,
|
||||
showIcon: showIcons,
|
||||
onPressed: () => onChanged(option.value),
|
||||
),
|
||||
],
|
||||
@@ -58,12 +61,14 @@ class _ChoiceButton<T extends Object> extends StatelessWidget {
|
||||
required this.selected,
|
||||
required this.palette,
|
||||
required this.onPressed,
|
||||
required this.showIcon,
|
||||
});
|
||||
|
||||
final AppChoiceOption<T> option;
|
||||
final bool selected;
|
||||
final AppPalette palette;
|
||||
final VoidCallback onPressed;
|
||||
final bool showIcon;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -82,8 +87,10 @@ class _ChoiceButton<T extends Object> extends StatelessWidget {
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Icon(option.icon, size: 15, color: selected ? palette.textPrimary : palette.textSecondary),
|
||||
const SizedBox(width: 7),
|
||||
if (showIcon) ...[
|
||||
Icon(option.icon, size: 15, color: selected ? palette.textPrimary : palette.textSecondary),
|
||||
const SizedBox(width: 7),
|
||||
],
|
||||
Text(
|
||||
option.label,
|
||||
style: TextStyle(
|
||||
|
||||
Reference in new issue
Block a user