From 296a9a59ba314a6b8c3d1b55758a2521f96fe8bf Mon Sep 17 00:00:00 2001 From: appdevelpo <56633229+appdevelpo@users.noreply.github.com> Date: Sun, 17 Dec 2023 21:50:48 +0800 Subject: [PATCH] refactor(mobile-detial-page) : change sort button in detail page (#152) * Update detail_episodes.dart * upload --------- Co-authored-by: MiaoMint <44718819+MiaoMint@users.noreply.github.com> --- lib/views/widgets/detail/detail_episodes.dart | 100 +++++++++--------- 1 file changed, 50 insertions(+), 50 deletions(-) diff --git a/lib/views/widgets/detail/detail_episodes.dart b/lib/views/widgets/detail/detail_episodes.dart index 586ee69e..3fbf051b 100644 --- a/lib/views/widgets/detail/detail_episodes.dart +++ b/lib/views/widgets/detail/detail_episodes.dart @@ -33,61 +33,61 @@ class _DetailEpisodesState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ // select 选择框 - if (episodes.isNotEmpty) - SizedBox( - child: Row(children: [ - IconButton( - onPressed: () { + if (episodes.isNotEmpty) ...[ + Container( + margin: const EdgeInsets.only(left: 8, top: 5, right: 8), + padding: + const EdgeInsets.only(left: 20, right: 20, top: 5, bottom: 5), + decoration: BoxDecoration( + // 背景颜色为 primaryContainer + color: Theme.of(context).colorScheme.primaryContainer, + borderRadius: const BorderRadius.all( + Radius.circular(10), + ), + ), + child: DropdownButton( + // 内容为 primary 颜色 + style: TextStyle(color: Theme.of(context).colorScheme.primary), + isExpanded: true, + underline: const SizedBox(), + value: c.selectEpGroup.value, + items: dropdownItems, + onChanged: (value) { setState(() { - isRevered = !isRevered; + c.selectEpGroup.value = value!; }); }, - icon: isRevered - ? const Icon(Icons.keyboard_double_arrow_up_rounded) - : const Icon(Icons.keyboard_double_arrow_down_rounded)), - Expanded( - flex: 1, - child: Container( - margin: const EdgeInsets.only(left: 8, top: 5, right: 8), - padding: const EdgeInsets.only( - left: 20, right: 20, top: 5, bottom: 5), - decoration: BoxDecoration( - // 背景颜色为 primaryContainer - color: Theme.of(context).colorScheme.primaryContainer, - borderRadius: - const BorderRadius.all(Radius.circular(10))), - child: DropdownButton( - // 内容为 primary 颜色 - style: TextStyle( - color: Theme.of(context).colorScheme.primary), - isExpanded: true, - underline: const SizedBox(), - value: c.selectEpGroup.value, - items: dropdownItems, - onChanged: (value) { - setState(() { - c.selectEpGroup.value = value!; - }); - }, - ))) - ])), - if (episodes.isNotEmpty) + )), Container( - margin: const EdgeInsets.only(left: 16, top: 10, bottom: 10), - child: Text( - FlutterI18n.translate( - context, - 'detail.total-episodes', - translationParams: { - 'total': - episodes[c.selectEpGroup.value].urls.length.toString(), - }, - ), - style: const TextStyle( - fontSize: 18, + margin: const EdgeInsets.only(left: 16, top: 10), + child: Row(children: [ + Text( + FlutterI18n.translate( + context, + 'detail.total-episodes', + translationParams: { + 'total': + episodes[c.selectEpGroup.value].urls.length.toString(), + }, + ), + style: const TextStyle( + fontSize: 18, + ), ), - ), - ), + Transform.flip( + flipY: isRevered, + child: IconButton( + onPressed: () { + setState(() { + isRevered = !isRevered; + }); + }, + icon: const Icon(Icons.sort_rounded), + ), + ) + ]), + ) + ], Expanded( child: ListView.builder( padding: const EdgeInsets.all(0),