@@ -8,6 +8,7 @@ import 'package:miru_app/pages/search/widgets/search_all_extension.dart';
88import 'package:miru_app/router/router.dart' ;
99import 'package:miru_app/utils/i18n.dart' ;
1010import 'package:miru_app/widgets/platform_widget.dart' ;
11+ import 'package:miru_app/widgets/search_appbar.dart' ;
1112
1213class SearchPage extends StatefulWidget {
1314 const SearchPage ({Key ? key}) : super (key: key);
@@ -26,14 +27,11 @@ class _SearchPageState extends State<SearchPage> {
2627 }
2728
2829 Widget _buildAndroidSearch (BuildContext context) {
29- return Scaffold (
30- appBar: AppBar (
31- title: TextField (
32- decoration: InputDecoration (
33- hintText: 'search.hint-text' .i18n,
34- border: InputBorder .none,
35- ),
36- controller: TextEditingController (
30+ return DefaultTabController (
31+ length: 4 ,
32+ child: Scaffold (
33+ appBar: SearchAppBar (
34+ textEditingController: TextEditingController (
3735 text: c.search.value,
3836 ),
3937 onChanged: (value) {
@@ -44,86 +42,47 @@ class _SearchPageState extends State<SearchPage> {
4442 onSubmitted: (value) {
4543 c.search.value = value;
4644 },
47- ),
48- flexibleSpace: Obx (
49- () => Column (
50- children: [
51- if (c.finishCount != c.searchResultList.length)
52- Padding (
53- padding: const EdgeInsets .symmetric (horizontal: 16 ),
54- child: LinearProgressIndicator (
55- value: (c.finishCount / c.searchResultList.length),
56- minHeight: 2 ,
45+ hintText: "search.hint-text" .i18n,
46+ title: "common.search" .i18n,
47+ flexibleSpace: Obx (
48+ () => Column (
49+ children: [
50+ if (c.finishCount != c.searchResultList.length)
51+ Padding (
52+ padding: const EdgeInsets .symmetric (horizontal: 16 ),
53+ child: LinearProgressIndicator (
54+ value: (c.finishCount / c.searchResultList.length),
55+ minHeight: 2 ,
56+ ),
5757 ),
58- ),
58+ ],
59+ ),
60+ ),
61+ bottom: TabBar (
62+ tabs: [
63+ Tab (text: 'search.all' .i18n),
64+ Tab (text: 'extension-type.video' .i18n),
65+ Tab (text: 'extension-type.comic' .i18n),
66+ Tab (text: 'extension-type.novel' .i18n),
5967 ],
68+ onTap: (value) {
69+ switch (value) {
70+ case 0 :
71+ c.getRuntime ();
72+ break ;
73+ case 1 :
74+ c.getRuntime (type: ExtensionType .bangumi);
75+ break ;
76+ case 2 :
77+ c.getRuntime (type: ExtensionType .manga);
78+ break ;
79+ case 3 :
80+ c.getRuntime (type: ExtensionType .fikushon);
81+ break ;
82+ }
83+ },
6084 ),
6185 ),
62- ),
63- body: NestedScrollView (
64- headerSliverBuilder: (context, innerBoxIsScrolled) {
65- return [
66- SliverAppBar (
67- flexibleSpace: Obx (
68- () => SizedBox (
69- height: 60 ,
70- child: ListView (
71- padding: const EdgeInsets .symmetric (horizontal: 16 ),
72- scrollDirection: Axis .horizontal,
73- children: [
74- ChoiceChip (
75- label: Text ('search.all' .i18n),
76- selected: c.cuurentExtensionType.value == null ,
77- onSelected: (value) {
78- if (value) {
79- c.getRuntime ();
80- }
81- },
82- ),
83- const SizedBox (width: 8 ),
84- ChoiceChip (
85- label: Text ('extension-type.video' .i18n),
86- selected: c.cuurentExtensionType.value ==
87- ExtensionType .bangumi,
88- onSelected: (value) {
89- if (value) {
90- c.getRuntime (type: ExtensionType .bangumi);
91- }
92- },
93- ),
94- const SizedBox (width: 8 ),
95- ChoiceChip (
96- label: Text ('extension-type.comic' .i18n),
97- selected:
98- c.cuurentExtensionType.value == ExtensionType .manga,
99- onSelected: (value) {
100- if (value) {
101- c.getRuntime (type: ExtensionType .manga);
102- }
103- },
104- ),
105- const SizedBox (width: 8 ),
106- ChoiceChip (
107- label: Text ('extension-type.novel' .i18n),
108- selected: c.cuurentExtensionType.value ==
109- ExtensionType .fikushon,
110- onSelected: (value) {
111- if (value) {
112- c.getRuntime (
113- type: ExtensionType .fikushon,
114- );
115- }
116- },
117- ),
118- ],
119- ),
120- ),
121- ),
122- floating: true ,
123- snap: true ,
124- )
125- ];
126- },
12786 body: Obx (
12887 () {
12988 // ignore: invalid_use_of_protected_member
0 commit comments