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
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
Widget item = Container(
|
Widget item = Container(
|
||||||
padding: EdgeInsets.only(left: 15),
|
padding: EdgeInsets.symmetric(horizontal: 15),
|
||||||
constraints: BoxConstraints(minHeight: Utils.minInteractiveSize, minWidth: double.infinity),
|
constraints: BoxConstraints(minHeight: Utils.minInteractiveSize, minWidth: double.infinity),
|
||||||
child: Row(
|
child: Row(
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
@ -24,7 +24,7 @@ class ConfigCheckboxItem extends StatelessWidget {
|
||||||
label != null ? Container(width: labelWidth, child: label) : Container(),
|
label != null ? Container(width: labelWidth, child: label) : Container(),
|
||||||
Expanded(child: Container(child: content, padding: EdgeInsets.only(right: 10))),
|
Expanded(child: Container(child: content, padding: EdgeInsets.only(right: 10))),
|
||||||
checked
|
checked
|
||||||
? Icon(CupertinoIcons.check_mark, color: CupertinoColors.systemBlue.resolveFrom(context), size: 34)
|
? Icon(CupertinoIcons.check_mark, color: CupertinoColors.systemBlue.resolveFrom(context))
|
||||||
: Container()
|
: Container()
|
||||||
],
|
],
|
||||||
));
|
));
|
||||||
|
|
|
@ -53,18 +53,14 @@ class _SiteTunnelsScreenState extends State<SiteTunnelsScreen> {
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final double ipWidth = Utils.textSize("000.000.000.000", CupertinoTheme.of(context).textTheme.textStyle).width + 32;
|
final double ipWidth = Utils.textSize("000.000.000.000", CupertinoTheme.of(context).textTheme.textStyle).width + 32;
|
||||||
|
|
||||||
List<Widget> children = [];
|
final List<ConfigPageItem> children = tunnels.map((hostInfo) {
|
||||||
tunnels.forEach((hostInfo) {
|
|
||||||
Widget icon;
|
|
||||||
|
|
||||||
final isLh = site.staticHostmap[hostInfo.vpnIp]?.lighthouse ?? false;
|
final isLh = site.staticHostmap[hostInfo.vpnIp]?.lighthouse ?? false;
|
||||||
if (isLh) {
|
final icon = switch (isLh) {
|
||||||
icon = Icon(Icons.lightbulb_outline, color: CupertinoColors.placeholderText.resolveFrom(context));
|
true => Icon(Icons.lightbulb_outline, color: CupertinoColors.placeholderText.resolveFrom(context)),
|
||||||
} else {
|
false => Icon(Icons.computer, color: CupertinoColors.placeholderText.resolveFrom(context))
|
||||||
icon = Icon(Icons.computer, color: CupertinoColors.placeholderText.resolveFrom(context));
|
};
|
||||||
}
|
|
||||||
|
|
||||||
children.add(ConfigPageItem(
|
return (ConfigPageItem(
|
||||||
onPressed: () => Utils.openPage(
|
onPressed: () => Utils.openPage(
|
||||||
context,
|
context,
|
||||||
(context) => HostInfoScreen(
|
(context) => HostInfoScreen(
|
||||||
|
@ -82,14 +78,12 @@ class _SiteTunnelsScreenState extends State<SiteTunnelsScreen> {
|
||||||
labelWidth: ipWidth,
|
labelWidth: ipWidth,
|
||||||
content: Container(alignment: Alignment.centerRight, child: Text(hostInfo.cert?.details.name ?? "")),
|
content: Container(alignment: Alignment.centerRight, child: Text(hostInfo.cert?.details.name ?? "")),
|
||||||
));
|
));
|
||||||
});
|
}).toList();
|
||||||
|
|
||||||
Widget child;
|
final Widget child = switch (children.length) {
|
||||||
if (children.length == 0) {
|
0 => Center(child: Padding(child: Text('No tunnels to show'), padding: EdgeInsets.only(top: 30))),
|
||||||
child = Center(child: Padding(child: Text('No tunnels to show'), padding: EdgeInsets.only(top: 30)));
|
_ => ConfigSection(children: children),
|
||||||
} else {
|
};
|
||||||
child = ConfigSection(children: children);
|
|
||||||
}
|
|
||||||
|
|
||||||
final title = widget.pending ? 'Pending' : 'Active';
|
final title = widget.pending ? 'Pending' : 'Active';
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue