Skip to content

Commit

Permalink
Merge branch 'Changing_grpc_temp' into Changing_grpc
Browse files Browse the repository at this point in the history
  • Loading branch information
guyluz11 committed Dec 13, 2023
2 parents 255603d + a5eb01c commit 627a940
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 35 deletions.
1 change: 0 additions & 1 deletion analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ analyzer:
- "**/*.config.dart"
- "lib/infrastructure/core/gen/**"


linter:
rules:
# Use parameter order as in json response
Expand Down
82 changes: 52 additions & 30 deletions lib/presentation/pages/devices_in_network_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'package:auto_route/auto_route.dart';
import 'package:cbj_integrations_controller/infrastructure/generic_devices/abstract_device/device_entity_abstract.dart';
import 'package:cybear_jinni/domain/i_phone_as_hub.dart';
import 'package:cybear_jinni/presentation/atoms/atoms.dart';
import 'package:cybear_jinni/presentation/core/theme_data.dart';
import 'package:cybear_jinni/presentation/molecules/molecules.dart';
import 'package:flutter/material.dart';

Expand All @@ -28,6 +29,18 @@ class _DevicesInNetworkPageState extends State<DevicesInNetworkPage> {
});
}

Widget getTextIfNotNull(String name, String? var1) {
if (var1 == null || var1.isEmpty || var1 == '0' || var1 == '[]') {
return const SizedBox();
}
return Row(
children: [
TextAtom('$name: $var1'),
const SeparatorAtom(),
],
);
}

@override
Widget build(BuildContext context) {
if (allDevices == null) {
Expand All @@ -40,44 +53,53 @@ class _DevicesInNetworkPageState extends State<DevicesInNetworkPage> {
backgroundColor: Colors.purple.withOpacity(0.7),
),
backgroundColor: Colors.black.withOpacity(0.7),
body: MarginedExpandedAtom(
body: Container(
margin: AppThemeData.generalHorizontalEdgeInsets,
child: ListViewSeparatedMolecule(
itemCount: allDevices!.length,
itemBuilder: (context, index) {
final DeviceEntityAbstract device = allDevices!.elementAt(index);

final String? deviceLastKnownIp =
device.deviceLastKnownIp.getOrCrash();
final String? deviceOriginalName =
device.deviceOriginalName.getOrCrash();
final String entityOriginalName =
device.entityOriginalName.getOrCrash();
final String deviceHostName = device.deviceHostName.getOrCrash();
final String? deviceMdns = device.deviceMdns.getOrCrash();
final String devicePort = device.devicePort.getOrCrash();
final String cbjDeviceVendor = device.cbjDeviceVendor.getOrCrash();
final String? devicesMacAddress =
device.devicesMacAddress.getOrCrash();
final String? srvResourceRecord =
device.srvResourceRecord.getOrCrash();
final String? ptrResourceRecord =
device.ptrResourceRecord.getOrCrash();

final String? deviceVendor = device.deviceVendor.getOrCrash();

final String? deviceNetworkLastUpdate =
device.deviceNetworkLastUpdate.getOrCrash();

return SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: Row(
children: [
TextAtom(
'Ip: ${device.deviceLastKnownIp.getOrCrash()}',
),
TextAtom(
', Device: ${device.deviceOriginalName.getOrCrash()}',
),
TextAtom(
', Entity: ${device.entityOriginalName.getOrCrash()}',
),
TextAtom(
', Host: ${device.deviceHostName.getOrCrash()}',
),
TextAtom(
', mDNS: ${device.deviceMdns.getOrCrash()}',
),
TextAtom(
', Port: ${device.devicePort.getOrCrash()}',
),
TextAtom(
', Vendor: ${device.deviceVendor.getOrCrash()}',
),
TextAtom(
', Mac: ${device.devicesMacAddress.getOrCrash()}',
),
TextAtom(
', Srv: ${device.srvResourceRecord.getOrCrash()}',
),
TextAtom(
', Ptr: ${device.ptrResourceRecord.getOrCrash()}',
getTextIfNotNull('Ip', deviceLastKnownIp),
getTextIfNotNull('Device', deviceOriginalName),
getTextIfNotNull('Entity', entityOriginalName),
getTextIfNotNull('Host', deviceHostName),
getTextIfNotNull('mDNS', deviceMdns),
getTextIfNotNull('Port', devicePort),
getTextIfNotNull('Vendor', cbjDeviceVendor),
getTextIfNotNull('Mac', devicesMacAddress),
getTextIfNotNull('Srv', srvResourceRecord),
getTextIfNotNull('Ptr', ptrResourceRecord),
getTextIfNotNull('Network Vendor', deviceVendor),
getTextIfNotNull(
'Last Updated',
deviceNetworkLastUpdate,
),
],
),
Expand Down
4 changes: 0 additions & 4 deletions test/widget_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@ import 'package:test/test.dart';

void main() {
test('DST example Test 2', () {
// final DateTime today = DateTime(2020, 3, 8);
// final DateTime tomorrow = DateTime(2020, 3, 9);
// final diff = tomorrow.difference(today);
// final int days = diff.inDays;
expect(1, 1);
});
}

0 comments on commit 627a940

Please sign in to comment.