Signed-off-by: dom <githubaccount56556@proton.me>
This commit is contained in:
dom
2026-08-01 11:25:14 +08:00
parent 5c0c6b3cfd
commit 90d8e8b2f2
8 changed files with 199 additions and 111 deletions

View File

@@ -1,4 +1,5 @@
import 'package:PiliPlus/common/style.dart';
import 'package:PiliPlus/common/widgets/animated_height.dart';
import 'package:PiliPlus/common/widgets/loading_widget/http_error.dart';
import 'package:PiliPlus/common/widgets/loading_widget/loading_widget.dart';
import 'package:PiliPlus/common/widgets/scaffold/simple_scaffold.dart';
@@ -73,14 +74,16 @@ class _PgcIndexPageState extends State<PgcIndexPage>
if (widget.indexType != null)
const SliverToBoxAdapter(child: SizedBox(height: 12)),
SliverToBoxAdapter(
child: AnimatedSize(
curve: Curves.easeInOut,
alignment: Alignment.topCenter,
duration: const Duration(milliseconds: 200),
child: count > 5
? Obx(() => _buildSortsWidget(theme, count, response))
: _buildSortsWidget(theme, count, response),
),
child: count > 5
? Obx(
() => AnimatedHeightWidget(
curve: Curves.easeInOut,
expand: _ctr.isExpand.value,
duration: const Duration(milliseconds: 200),
child: _buildSortsWidget(theme, count, response),
),
)
: _buildSortsWidget(theme, count, response),
),
SliverPadding(
padding: EdgeInsets.only(
@@ -112,42 +115,39 @@ class _PgcIndexPageState extends State<PgcIndexPage>
Object item,
Map<String, dynamic> indexParams,
) {
final String text;
final String key;
final String? value;
final bool isCurr;
if (item is PgcConditionOrder) {
final isCurr = indexParams['order'] == item.field;
return SearchText(
bgColor: isCurr
? theme.colorScheme.secondaryContainer
: Colors.transparent,
textColor: isCurr
? theme.colorScheme.onSecondaryContainer
: theme.colorScheme.onSurfaceVariant,
text: item.name!,
padding: const .symmetric(horizontal: 6, vertical: 3),
onTap: (_) => _ctr
..indexParams['order'] = item.field
..onReload(),
);
text = item.name!;
key = 'order';
value = item.field;
isCurr = indexParams[key] == item.field;
} else if (item is PgcConditionValue) {
text = item.name!;
if (data.order?.isNotEmpty == true) index -= 1;
key = data.filter![index].field!;
value = item.keyword;
isCurr = indexParams[key] == item.keyword;
} else {
throw UnsupportedError(item.toString());
}
if (item is PgcConditionValue) {
final hasOrder = data.order?.isNotEmpty == true;
if (hasOrder) index -= 1;
final key = data.filter![index].field!;
final isCurr = indexParams[key] == item.keyword;
return SearchText(
bgColor: isCurr
? theme.colorScheme.secondaryContainer
: Colors.transparent,
textColor: isCurr
? theme.colorScheme.onSecondaryContainer
: theme.colorScheme.onSurfaceVariant,
text: item.name!,
padding: const .symmetric(horizontal: 6, vertical: 3),
onTap: (_) => _ctr
..indexParams[key] = item.keyword
..onReload(),
);
}
throw UnsupportedError(item.toString());
return SearchText(
bgColor: isCurr
? theme.colorScheme.secondaryContainer
: Colors.transparent,
textColor: isCurr
? theme.colorScheme.onSecondaryContainer
: theme.colorScheme.onSurfaceVariant,
text: text,
padding: const .symmetric(horizontal: 6, vertical: 3),
onTap: (_) => _ctr
..indexParams[key] = value
..onReload(),
);
}
Widget _buildSortsWidget(
@@ -205,9 +205,7 @@ class _PgcIndexPageState extends State<PgcIndexPage>
children: [
Text(
_ctr.isExpand.value ? '收起' : '展开',
style: TextStyle(
color: theme.colorScheme.outline,
),
style: TextStyle(color: theme.colorScheme.outline),
),
Icon(
_ctr.isExpand.value