@@ -19,11 +19,6 @@ import "package:go_router/go_router.dart";
1919import "package:provider/provider.dart" ;
2020import "package:url_launcher/url_launcher.dart" ;
2121
22- const discordUri = "https://discord.gg/BazBZuvKZG" ;
23- const feedbackUri = "https://github.com/mumu-lhl/Ciyue/issues" ;
24- const githubUri = "https://github.com/mumu-lhl/Ciyue" ;
25- const sponsorUri = "https://afdian.com/a/mumulhl" ;
26-
2722void _copy (BuildContext context, String text) {
2823 Clipboard .setData (ClipboardData (text: text));
2924 ScaffoldMessenger .of (context).showSnackBar (SnackBar (
@@ -173,6 +168,8 @@ class ClearHistory extends StatelessWidget {
173168}
174169
175170class DiscordUrl extends StatelessWidget {
171+ static const discordUri = "https://discord.gg/BazBZuvKZG" ;
172+
176173 const DiscordUrl ({
177174 super .key,
178175 });
@@ -188,13 +185,6 @@ class DiscordUrl extends StatelessWidget {
188185 }
189186}
190187
191- class DrawerIconSwitch extends StatefulWidget {
192- const DrawerIconSwitch ({super .key});
193-
194- @override
195- State <DrawerIconSwitch > createState () => _DrawerIconSwitchState ();
196- }
197-
198188class Export extends StatelessWidget {
199189 const Export ({super .key});
200190
@@ -209,6 +199,8 @@ class Export extends StatelessWidget {
209199}
210200
211201class Feedback extends StatelessWidget {
202+ static const feedbackUri = "https://github.com/mumu-lhl/Ciyue/issues" ;
203+
212204 const Feedback ({
213205 super .key,
214206 });
@@ -232,6 +224,8 @@ class FloatingWindow extends StatefulWidget {
232224}
233225
234226class GithubUrl extends StatelessWidget {
227+ static const githubUri = "https://github.com/mumu-lhl/Ciyue" ;
228+
235229 const GithubUrl ({
236230 super .key,
237231 });
@@ -327,14 +321,6 @@ class ManageDictionariesWidget extends StatelessWidget {
327321 }
328322}
329323
330- class MoreOptionsButtonSwitch extends StatefulWidget {
331- const MoreOptionsButtonSwitch ({super .key});
332-
333- @override
334- State <MoreOptionsButtonSwitch > createState () =>
335- _MoreOptionsButtonSwitchState ();
336- }
337-
338324class NotificationSwitch extends StatefulWidget {
339325 const NotificationSwitch ({super .key});
340326
@@ -363,22 +349,6 @@ class PrivacyPolicy extends StatelessWidget {
363349 }
364350}
365351
366- class SearchbarInWordDisplaySwitch extends StatefulWidget {
367- const SearchbarInWordDisplaySwitch ({super .key});
368-
369- @override
370- State <SearchbarInWordDisplaySwitch > createState () =>
371- _SearchbarInWordDisplaySwitchState ();
372- }
373-
374- class SearchbarLocationSelector extends StatefulWidget {
375- const SearchbarLocationSelector ({super .key});
376-
377- @override
378- State <SearchbarLocationSelector > createState () =>
379- _SearchbarLocationSelectorState ();
380- }
381-
382352class SecureScreenSwitch extends StatefulWidget {
383353 const SecureScreenSwitch ({super .key});
384354
@@ -399,11 +369,7 @@ class SettingsScreen extends StatelessWidget {
399369 TitleDivider (title: AppLocalizations .of (context)! .appearance),
400370 const ThemeSelector (),
401371 const LanguageSelector (),
402- const SearchbarLocationSelector (),
403- const TabBarPositionSelector (),
404- const SearchbarInWordDisplaySwitch (),
405- const DrawerIconSwitch (),
406- const MoreOptionsButtonSwitch (),
372+ AppearanceSettings (),
407373 if (Platform .isAndroid) ...[
408374 TitleDivider (title: AppLocalizations .of (context)! .privacy),
409375 const SecureScreenSwitch (),
@@ -435,7 +401,25 @@ class SettingsScreen extends StatelessWidget {
435401 }
436402}
437403
404+ class AppearanceSettings extends StatelessWidget {
405+ const AppearanceSettings ({
406+ super .key,
407+ });
408+
409+ @override
410+ Widget build (BuildContext context) {
411+ return ListTile (
412+ leading: const Icon (Icons .palette),
413+ trailing: const Icon (Icons .arrow_forward),
414+ title: Text (AppLocalizations .of (context)! .appearance),
415+ onTap: () => context.push ("/settings/appearance" ),
416+ );
417+ }
418+ }
419+
438420class SponsorUrl extends StatelessWidget {
421+ static const sponsorUri = "https://afdian.com/a/mumulhl" ;
422+
439423 const SponsorUrl ({
440424 super .key,
441425 });
@@ -451,13 +435,6 @@ class SponsorUrl extends StatelessWidget {
451435 }
452436}
453437
454- class TabBarPositionSelector extends StatefulWidget {
455- const TabBarPositionSelector ({super .key});
456-
457- @override
458- State <TabBarPositionSelector > createState () => _TabBarPositionSelectorState ();
459- }
460-
461438class TermsOfService extends StatelessWidget {
462439 const TermsOfService ({super .key});
463440
@@ -541,25 +518,6 @@ class _AutoUpdateSwitchState extends State<AutoUpdateSwitch> {
541518 }
542519}
543520
544- class _DrawerIconSwitchState extends State <DrawerIconSwitch > {
545- @override
546- Widget build (BuildContext context) {
547- final locale = AppLocalizations .of (context);
548- return SwitchListTile (
549- title: Text (locale! .sidebarIcon),
550- value: settings.showSidebarIcon,
551- onChanged: (value) async {
552- await prefs.setBool ("showSidebarIcon" , value);
553- if (context.mounted) context.read <HomeModel >().update ();
554- setState (() {
555- settings.showSidebarIcon = value;
556- });
557- },
558- secondary: const Icon (Icons .menu),
559- );
560- }
561- }
562-
563521class _FloatingWindowState extends State <FloatingWindow > {
564522 @override
565523 Widget build (BuildContext context) {
@@ -634,25 +592,6 @@ class _LanguageSelectorState extends State<LanguageSelector> {
634592 }
635593}
636594
637- class _MoreOptionsButtonSwitchState extends State <MoreOptionsButtonSwitch > {
638- @override
639- Widget build (BuildContext context) {
640- final locale = AppLocalizations .of (context);
641- return SwitchListTile (
642- title: Text (locale! .moreOptionsButton),
643- value: settings.showMoreOptionsButton,
644- onChanged: (value) async {
645- await prefs.setBool ("showMoreOptionsButton" , value);
646- if (context.mounted) context.read <HomeModel >().update ();
647- setState (() {
648- settings.showMoreOptionsButton = value;
649- });
650- },
651- secondary: const Icon (Icons .more_vert),
652- );
653- }
654- }
655-
656595class _NotificationSwitchState extends State <NotificationSwitch > {
657596 @override
658597 Widget build (BuildContext context) {
@@ -694,64 +633,6 @@ class _PrereleaseUpdatesSwitchState extends State<PrereleaseUpdatesSwitch> {
694633 }
695634}
696635
697- class _SearchbarInWordDisplaySwitchState
698- extends State <SearchbarInWordDisplaySwitch > {
699- @override
700- Widget build (BuildContext context) {
701- final locale = AppLocalizations .of (context);
702- return SwitchListTile (
703- title: Text (locale! .showSearchBarInWordDisplayPage),
704- value: settings.showSearchBarInWordDisplay,
705- onChanged: (value) async {
706- await prefs.setBool ("showSearchBarInWordDisplay" , value);
707- setState (() {
708- settings.showSearchBarInWordDisplay = value;
709- });
710- },
711- secondary: const Icon (Icons .search),
712- );
713- }
714- }
715-
716- class _SearchbarLocationSelectorState extends State <SearchbarLocationSelector > {
717- @override
718- Widget build (BuildContext context) {
719- final locale = AppLocalizations .of (context);
720-
721- return InkWell (
722- onTapUp: (tapUpDetails) async {
723- final searchBarLocationSelected = await showMenu (
724- context: context,
725- position: RelativeRect .fromLTRB (
726- tapUpDetails.globalPosition.dx,
727- tapUpDetails.globalPosition.dy,
728- tapUpDetails.globalPosition.dx,
729- tapUpDetails.globalPosition.dy,
730- ),
731- initialValue: settings.searchBarInAppBar,
732- items: [
733- PopupMenuItem (value: true , child: Text (locale.top)),
734- PopupMenuItem (value: false , child: Text (locale.bottom)),
735- ],
736- );
737-
738- if (searchBarLocationSelected != null ) {
739- settings.searchBarInAppBar = searchBarLocationSelected;
740- await prefs.setBool ("searchBarInAppBar" , searchBarLocationSelected);
741-
742- if (context.mounted) context.read <HomeModel >().update ();
743- setState (() {});
744- }
745- },
746- child: ListTile (
747- leading: const Icon (Icons .search),
748- title: Text (locale! .searchBarLocation),
749- trailing: const Icon (Icons .keyboard_arrow_down),
750- ),
751- );
752- }
753- }
754-
755636class _SecureScreenSwitchState extends State <SecureScreenSwitch > {
756637 @override
757638 Widget build (BuildContext context) {
@@ -771,48 +652,6 @@ class _SecureScreenSwitchState extends State<SecureScreenSwitch> {
771652 }
772653}
773654
774- class _TabBarPositionSelectorState extends State <TabBarPositionSelector > {
775- @override
776- Widget build (BuildContext context) {
777- final locale = AppLocalizations .of (context)! ;
778-
779- return InkWell (
780- onTapUp: (tapUpDetails) async {
781- final selected = await showMenu <TabBarPosition >(
782- context: context,
783- position: RelativeRect .fromLTRB (
784- tapUpDetails.globalPosition.dx,
785- tapUpDetails.globalPosition.dy,
786- tapUpDetails.globalPosition.dx,
787- tapUpDetails.globalPosition.dy,
788- ),
789- initialValue: settings.tabBarPosition,
790- items: [
791- PopupMenuItem (
792- value: TabBarPosition .top,
793- child: Text (locale.top),
794- ),
795- PopupMenuItem (
796- value: TabBarPosition .bottom,
797- child: Text (locale.bottom),
798- ),
799- ],
800- );
801-
802- if (selected != null && selected != settings.tabBarPosition) {
803- await settings.setTabBarPosition (selected);
804- setState (() {});
805- }
806- },
807- child: ListTile (
808- leading: const Icon (Icons .tab),
809- title: Text (locale.tabBarPosition),
810- trailing: const Icon (Icons .keyboard_arrow_down),
811- ),
812- );
813- }
814- }
815-
816655class _ThemeSelectorState extends State <ThemeSelector > {
817656 @override
818657 Widget build (BuildContext context) {
0 commit comments