-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
163 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
90 changes: 90 additions & 0 deletions
90
clients/sail_ui/lib/widgets/modals/daemon_settings_modal.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:sail_ui/sail_ui.dart'; | ||
|
||
class DaemonConnectionDetailsModal extends StatefulWidget { | ||
final RPCConnection connection; | ||
|
||
const DaemonConnectionDetailsModal({ | ||
super.key, | ||
required this.connection, | ||
}); | ||
|
||
@override | ||
State<DaemonConnectionDetailsModal> createState() => _DaemonConnectionDetailsModalState(); | ||
} | ||
|
||
class _DaemonConnectionDetailsModalState extends State<DaemonConnectionDetailsModal> { | ||
List<String> args = []; | ||
|
||
@override | ||
void initState() { | ||
super.initState(); | ||
_loadArgs(); | ||
} | ||
|
||
Future<void> _loadArgs() async { | ||
final loadedArgs = await widget.connection.binaryArgs(widget.connection.conf); | ||
loadedArgs.removeWhere((arg) => arg.contains('pass')); | ||
if (mounted) { | ||
setState(() { | ||
args = loadedArgs; | ||
}); | ||
} | ||
} | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Dialog( | ||
backgroundColor: context.sailTheme.colors.backgroundSecondary, | ||
child: ConstrainedBox( | ||
constraints: const BoxConstraints(maxWidth: 500), | ||
child: SailRawCard( | ||
padding: true, | ||
title: '${widget.connection.binary.name} Connection Details', | ||
subtitle: 'Connection information for this daemon', | ||
widgetHeaderEnd: SailTextButton( | ||
label: '×', | ||
onPressed: () => Navigator.of(context).pop(), | ||
), | ||
child: Padding( | ||
padding: const EdgeInsets.all(SailStyleValues.padding16), | ||
child: SailColumn( | ||
spacing: SailStyleValues.padding16, | ||
crossAxisAlignment: CrossAxisAlignment.stretch, | ||
children: [ | ||
StaticField( | ||
label: 'Host', | ||
value: widget.connection.conf.host, | ||
copyable: true, | ||
), | ||
StaticField( | ||
label: 'Port', | ||
value: widget.connection.binary.port.toString(), | ||
copyable: true, | ||
), | ||
if (args.isNotEmpty) | ||
StaticField( | ||
label: 'Binary Arguments', | ||
value: args.join(' \\\n'), | ||
copyable: true, | ||
), | ||
const SizedBox(height: SailStyleValues.padding08), | ||
SailRow( | ||
spacing: SailStyleValues.padding08, | ||
mainAxisAlignment: MainAxisAlignment.end, | ||
children: [ | ||
QtButton( | ||
label: 'Close', | ||
onPressed: () => Navigator.pop(context), | ||
size: ButtonSize.small, | ||
), | ||
], | ||
), | ||
], | ||
), | ||
), | ||
), | ||
), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters