@@ -22,19 +22,18 @@ import 'package:flutter/material.dart';
2222import 'package:flutter/services.dart' ;
2323
2424import 'package:logging/logging.dart' ;
25+ import 'package:orion/util/widgets/system_status_widget.dart' ;
2526import 'package:path/path.dart' as path;
27+ import 'package:provider/provider.dart' ;
2628
2729import 'package:orion/glasser/glasser.dart' ;
28- import 'package:orion/pubspec.dart' ;
29- import 'package:orion/settings/about_dialog.dart' ;
3030import 'package:orion/settings/about_screen.dart' ;
3131import 'package:orion/settings/debug_screen.dart' ;
32- import 'package:orion/settings/fancy_license_screen.dart' ;
3332import 'package:orion/settings/general_screen.dart' ;
3433import 'package:orion/settings/update_screen.dart' ;
3534import 'package:orion/settings/wifi_screen.dart' ;
36- import 'package:orion/util/markdown_screen.dart' ;
3735import 'package:orion/util/orion_config.dart' ;
36+ import 'package:orion/util/providers/wifi_provider.dart' ;
3837
3938import 'package:phosphor_flutter/phosphor_flutter.dart' ;
4039
@@ -187,8 +186,8 @@ class SettingsScreenState extends State<SettingsScreen> {
187186 },
188187 );
189188
190- if (shouldDisconnect) {
191- await _wifiScreenKey.currentState ? .disconnect ();
189+ if (shouldDisconnect && mounted ) {
190+ await context. read < WiFiProvider >() .disconnect ();
192191 }
193192 }
194193
@@ -257,81 +256,7 @@ class SettingsScreenState extends State<SettingsScreen> {
257256 appBar: AppBar (
258257 title: const Text ('Settings' ),
259258 actions: < Widget > [
260- Padding (
261- padding: const EdgeInsets .only (right: 16.0 ),
262- child: _selectedIndex == 2
263- ? IconButton (
264- icon: PhosphorIcon (PhosphorIcons .info (), size: 40 ),
265- iconSize: 40 ,
266- onPressed: () {
267- showOrionAboutDialog (
268- context: context,
269- applicationName: 'Orion' ,
270- applicationVersion:
271- 'Version ${Pubspec .version } - ${Pubspec .versionFull .toString ().split ('+' )[1 ] == 'SELFCOMPILED' ? 'Local Build' : 'Commit ${Pubspec .versionFull .toString ().split ('+' )[1 ]}' }' ,
272- applicationLegalese:
273- 'Apache License 2.0 - Copyright © ${DateTime .now ().year } Open Resin Alliance' ,
274- applicationIcon: const FlutterLogo (size: 100 ),
275- children: < Widget > [
276- Padding (
277- padding:
278- const EdgeInsets .only (left: 10 , right: 10 ),
279- child: GlassCard (
280- child: ListTile (
281- leading: const Icon (Icons .list, size: 30 ),
282- title: const Text ('Changelog' ),
283- onTap: () {
284- Navigator .push (
285- context,
286- MaterialPageRoute (
287- builder: (context) =>
288- const MarkdownScreen (
289- filename: 'CHANGELOG.md' ),
290- ),
291- );
292- },
293- ),
294- ),
295- ),
296- Padding (
297- padding: const EdgeInsets .all (10 ),
298- child: GlassCard (
299- child: ListTile (
300- title: const Text ('Open-Source Licenses' ),
301- leading:
302- const Icon (Icons .favorite, size: 30 ),
303- onTap: () {
304- showFancyLicensePage (
305- context: context,
306- applicationName: 'Orion' ,
307- applicationVersion: Pubspec .version,
308- );
309- },
310- ),
311- ),
312- ),
313- ],
314- );
315- },
316- )
317- : _selectedIndex == 1
318- ? ValueListenableBuilder <bool >(
319- valueListenable: isConnected,
320- builder: (context, value, child) {
321- return value
322- ? IconButton (
323- onPressed: () {
324- launchDisconnectDialog ();
325- },
326- icon: PhosphorIcon (
327- PhosphorIcons .xCircle (),
328- size: 40 ),
329- )
330- : const SizedBox .shrink ();
331- },
332- )
333- : const SizedBox .shrink (),
334- ),
259+ SystemStatusWidget (),
335260 ],
336261 ),
337262 body: _selectedIndex == 0
@@ -360,23 +285,44 @@ class SettingsScreenState extends State<SettingsScreen> {
360285 bottomNavigationBar: GlassBottomNavigationBar (
361286 type: BottomNavigationBarType .fixed,
362287 items: < BottomNavigationBarItem > [
363- const BottomNavigationBarItem (
364- icon: Icon (Icons .settings),
288+ BottomNavigationBarItem (
289+ icon: PhosphorIcon (PhosphorIcons .gear ()),
290+ activeIcon: PhosphorIcon (
291+ PhosphorIconsFill .gear,
292+ color: Theme .of (context).colorScheme.primary,
293+ ),
365294 label: 'General' ,
366295 ),
367- const BottomNavigationBarItem (
368- icon: Icon (Icons .network_wifi),
369- label: 'WiFi' ,
296+ BottomNavigationBarItem (
297+ icon: PhosphorIcon (PhosphorIcons .network ()),
298+ activeIcon: PhosphorIcon (
299+ PhosphorIconsFill .network,
300+ color: Theme .of (context).colorScheme.primary,
301+ ),
302+ label: 'Network' ,
370303 ),
371- const BottomNavigationBarItem (
372- icon: Icon (Icons .info),
304+ BottomNavigationBarItem (
305+ icon: PhosphorIcon (PhosphorIcons .info ()),
306+ activeIcon: PhosphorIcon (
307+ PhosphorIconsFill .info,
308+ color: Theme .of (context).colorScheme.primary,
309+ ),
373310 label: 'About' ,
374311 ),
375- const BottomNavigationBarItem (
376- icon: Icon (Icons .update), label: 'Updates' ),
312+ BottomNavigationBarItem (
313+ icon: PhosphorIcon (PhosphorIcons .download ()),
314+ activeIcon: PhosphorIcon (
315+ PhosphorIconsFill .download,
316+ color: Theme .of (context).colorScheme.primary,
317+ ),
318+ label: 'Updates' ),
377319 if (config.getFlag ('developerMode' , category: 'advanced' ))
378- const BottomNavigationBarItem (
379- icon: Icon (Icons .bug_report),
320+ BottomNavigationBarItem (
321+ icon: PhosphorIcon (PhosphorIcons .bug ()),
322+ activeIcon: PhosphorIcon (
323+ PhosphorIconsFill .bug,
324+ color: Theme .of (context).colorScheme.primary,
325+ ),
380326 label: 'Debug' ,
381327 ),
382328 ],
0 commit comments