@@ -29,7 +29,10 @@ class SettingsLayoutPage extends StatelessWidget {
2929 const SizedBox (height: 16 ),
3030 if (enabledSections.isNotEmpty) ...[
3131 Padding (
32- padding: const EdgeInsets .symmetric (horizontal: 16 , vertical: 8 ),
32+ padding: const EdgeInsets .symmetric (
33+ horizontal: 16 ,
34+ vertical: 8 ,
35+ ),
3336 child: Text (
3437 '顯示中' .i18n,
3538 style: context.texts.labelLarge? .copyWith (
@@ -67,95 +70,100 @@ class SettingsLayoutPage extends StatelessWidget {
6770 ],
6871 if (disabledSections.isNotEmpty) ...[
6972 Padding (
70- padding: const EdgeInsets .symmetric (horizontal: 16 , vertical: 8 ),
73+ padding: const EdgeInsets .symmetric (
74+ horizontal: 16 ,
75+ vertical: 8 ,
76+ ),
7177 child: Text (
7278 '已隱藏' .i18n,
7379 style: context.texts.labelLarge? .copyWith (
7480 color: context.colors.onSurfaceVariant,
7581 ),
7682 ),
7783 ),
78- ...disabledSections.map ((section) {
79- final details = _getSectionDetails (section);
80- return _buildSectionCard (
81- context,
82- key: ValueKey (section),
83- icon: details.icon,
84- iconColor: details.color,
85- title: details.title,
86- subtitle: details.subtitle,
87- value: false ,
88- onChanged: (v) => model.toggleSection (section, v),
89- isReorderable: false ,
90- );
91- },
92- ),
93- Selector <SettingsUserInterfaceModel , bool >(
94- selector: (context, model) => model.isEnabled (.forecast),
95- builder: (context, isEnabled, child) {
96- return SectionListTile (
97- leading: ContainedIcon (
98- Symbols .radar_rounded,
99- color: Colors .orangeAccent,
100- ),
101- title: Text ('天氣預報' .i18n),
102- subtitle: Text ('顯示未來 24 小時的天氣預報' .i18n),
103- trailing: Switch (
104- value: isEnabled,
105- onChanged: (value) {
106- context.userInterface.toggleSection (.forecast, value);
107- },
108- ),
109- );
110- },
111- ),
112- Selector <SettingsUserInterfaceModel , bool >(
113- selector: (context, model) => model.isEnabled (.wind),
114- builder: (context, isEnabled, child) {
115- return SectionListTile (
116- leading: ContainedIcon (
117- Symbols .wind_power_rounded,
118- color: Colors .orangeAccent,
119- ),
120- title: Text ('風向' .i18n),
121- subtitle: Text ('顯示風向與風力級數' .i18n),
122- trailing: Switch (
123- value: isEnabled,
124- onChanged: (value) {
125- context.userInterface.toggleSection (.wind, value);
126- },
127- ),
128- );
129- },
130- ),
131- Selector <SettingsUserInterfaceModel , bool >(
132- selector: (context, model) => model.isEnabled (.history),
133- builder: (context, isEnabled, child) {
134- return SectionListTile (
135- isLast: true ,
136- leading: ContainedIcon (
137- Symbols .history_rounded,
138- color: Colors .greenAccent,
139- ),
140- title: Text ('歷史事件' .i18n),
141- subtitle: Text ('顯示地震與災害歷史紀錄' .i18n),
142- trailing: Switch (
143- value: isEnabled,
144- onChanged: (value) {
145- context.userInterface.toggleSection (.history, value);
146- },
147- ),
148- );
149- },
150- ),
84+ ...disabledSections.map (
85+ (section) {
86+ final details = _getSectionDetails (section);
87+ return _buildSectionCard (
88+ context,
89+ key: ValueKey (section),
90+ icon: details.icon,
91+ iconColor: details.color,
92+ title: details.title,
93+ subtitle: details.subtitle,
94+ value: false ,
95+ onChanged: (v) => model.toggleSection (section, v),
96+ isReorderable: false ,
97+ );
98+ },
99+ ),
100+ Selector <SettingsUserInterfaceModel , bool >(
101+ selector: (context, model) => model.isEnabled (.forecast),
102+ builder: (context, isEnabled, child) {
103+ return SectionListTile (
104+ leading: ContainedIcon (
105+ Symbols .radar_rounded,
106+ color: Colors .orangeAccent,
107+ ),
108+ title: Text ('天氣預報' .i18n),
109+ subtitle: Text ('顯示未來 24 小時的天氣預報' .i18n),
110+ trailing: Switch (
111+ value: isEnabled,
112+ onChanged: (value) {
113+ context.userInterface.toggleSection (.forecast, value);
114+ },
115+ ),
116+ );
117+ },
118+ ),
119+ Selector <SettingsUserInterfaceModel , bool >(
120+ selector: (context, model) => model.isEnabled (.wind),
121+ builder: (context, isEnabled, child) {
122+ return SectionListTile (
123+ leading: ContainedIcon (
124+ Symbols .wind_power_rounded,
125+ color: Colors .orangeAccent,
126+ ),
127+ title: Text ('風向' .i18n),
128+ subtitle: Text ('顯示風向與風力級數' .i18n),
129+ trailing: Switch (
130+ value: isEnabled,
131+ onChanged: (value) {
132+ context.userInterface.toggleSection (.wind, value);
133+ },
134+ ),
135+ );
136+ },
137+ ),
138+ Selector <SettingsUserInterfaceModel , bool >(
139+ selector: (context, model) => model.isEnabled (.history),
140+ builder: (context, isEnabled, child) {
141+ return SectionListTile (
142+ isLast: true ,
143+ leading: ContainedIcon (
144+ Symbols .history_rounded,
145+ color: Colors .greenAccent,
146+ ),
147+ title: Text ('歷史事件' .i18n),
148+ subtitle: Text ('顯示地震與災害歷史紀錄' .i18n),
149+ trailing: Switch (
150+ value: isEnabled,
151+ onChanged: (value) {
152+ context.userInterface.toggleSection (.history, value);
153+ },
154+ ),
155+ );
156+ },
157+ ),
158+ ],
151159 ],
152160 );
153161 },
154162 );
155163 }
156164
157165 ({IconData icon, Color color, String title, String subtitle})
158- _getSectionDetails (HomeDisplaySection section) {
166+ _getSectionDetails (HomeDisplaySection section) {
159167 switch (section) {
160168 case HomeDisplaySection .radar:
161169 return (
@@ -178,6 +186,13 @@ class SettingsLayoutPage extends StatelessWidget {
178186 title: '歷史事件' .i18n,
179187 subtitle: '顯示地震與災害歷史紀錄' .i18n,
180188 );
189+ case HomeDisplaySection .wind:
190+ return (
191+ icon: Symbols .wind_power_rounded,
192+ color: Colors .purple,
193+ title: '風向' .i18n,
194+ subtitle: '顯示風向與風力級數' .i18n,
195+ );
181196 }
182197 }
183198
@@ -258,7 +273,9 @@ class SettingsLayoutPage extends StatelessWidget {
258273 if (isReorderable) ...[
259274 Icon (
260275 Symbols .drag_handle_rounded,
261- color: context.colors.onSurfaceVariant.withValues (alpha: 0.5 ),
276+ color: context.colors.onSurfaceVariant.withValues (
277+ alpha: 0.5 ,
278+ ),
262279 ),
263280 const SizedBox (width: 12 ),
264281 ],
0 commit comments