mirror of
https://github.com/DefinedNet/mobile_nebula.git
synced 2025-01-31 09:27:02 +00:00
Clean up SiteTunnelsScreen & Fix padding for the Checkbox config item (#239)
* Clean up SiteTunnelsScreen * Adding padding to the checkmark in ConfigCheckboxItem
This commit is contained in:
parent
af1c582984
commit
f69f7cc9a3
2 changed files with 13 additions and 19 deletions
|
@ -16,7 +16,7 @@ class ConfigCheckboxItem extends StatelessWidget {
|
|||
@override
|
||||
Widget build(BuildContext context) {
|
||||
Widget item = Container(
|
||||
padding: EdgeInsets.only(left: 15),
|
||||
padding: EdgeInsets.symmetric(horizontal: 15),
|
||||
constraints: BoxConstraints(minHeight: Utils.minInteractiveSize, minWidth: double.infinity),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
|
@ -24,7 +24,7 @@ class ConfigCheckboxItem extends StatelessWidget {
|
|||
label != null ? Container(width: labelWidth, child: label) : Container(),
|
||||
Expanded(child: Container(child: content, padding: EdgeInsets.only(right: 10))),
|
||||
checked
|
||||
? Icon(CupertinoIcons.check_mark, color: CupertinoColors.systemBlue.resolveFrom(context), size: 34)
|
||||
? Icon(CupertinoIcons.check_mark, color: CupertinoColors.systemBlue.resolveFrom(context))
|
||||
: Container()
|
||||
],
|
||||
));
|
||||
|
|
|
@ -53,18 +53,14 @@ class _SiteTunnelsScreenState extends State<SiteTunnelsScreen> {
|
|||
Widget build(BuildContext context) {
|
||||
final double ipWidth = Utils.textSize("000.000.000.000", CupertinoTheme.of(context).textTheme.textStyle).width + 32;
|
||||
|
||||
List<Widget> children = [];
|
||||
tunnels.forEach((hostInfo) {
|
||||
Widget icon;
|
||||
|
||||
final List<ConfigPageItem> children = tunnels.map((hostInfo) {
|
||||
final isLh = site.staticHostmap[hostInfo.vpnIp]?.lighthouse ?? false;
|
||||
if (isLh) {
|
||||
icon = Icon(Icons.lightbulb_outline, color: CupertinoColors.placeholderText.resolveFrom(context));
|
||||
} else {
|
||||
icon = Icon(Icons.computer, color: CupertinoColors.placeholderText.resolveFrom(context));
|
||||
}
|
||||
final icon = switch (isLh) {
|
||||
true => Icon(Icons.lightbulb_outline, color: CupertinoColors.placeholderText.resolveFrom(context)),
|
||||
false => Icon(Icons.computer, color: CupertinoColors.placeholderText.resolveFrom(context))
|
||||
};
|
||||
|
||||
children.add(ConfigPageItem(
|
||||
return (ConfigPageItem(
|
||||
onPressed: () => Utils.openPage(
|
||||
context,
|
||||
(context) => HostInfoScreen(
|
||||
|
@ -82,14 +78,12 @@ class _SiteTunnelsScreenState extends State<SiteTunnelsScreen> {
|
|||
labelWidth: ipWidth,
|
||||
content: Container(alignment: Alignment.centerRight, child: Text(hostInfo.cert?.details.name ?? "")),
|
||||
));
|
||||
});
|
||||
}).toList();
|
||||
|
||||
Widget child;
|
||||
if (children.length == 0) {
|
||||
child = Center(child: Padding(child: Text('No tunnels to show'), padding: EdgeInsets.only(top: 30)));
|
||||
} else {
|
||||
child = ConfigSection(children: children);
|
||||
}
|
||||
final Widget child = switch (children.length) {
|
||||
0 => Center(child: Padding(child: Text('No tunnels to show'), padding: EdgeInsets.only(top: 30))),
|
||||
_ => ConfigSection(children: children),
|
||||
};
|
||||
|
||||
final title = widget.pending ? 'Pending' : 'Active';
|
||||
|
||||
|
|
Loading…
Reference in a new issue