Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pubspec | hmi_networking version bump #76

Merged
merged 18 commits into from
Apr 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions example/ios/Flutter/Debug.xcconfig
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
#include "Generated.xcconfig"
1 change: 1 addition & 0 deletions example/ios/Flutter/Release.xcconfig
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
#include "Generated.xcconfig"
44 changes: 44 additions & 0 deletions example/ios/Podfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Uncomment this line to define a global platform for your project
# platform :ios, '12.0'

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'

project 'Runner', {
'Debug' => :debug,
'Profile' => :release,
'Release' => :release,
}

def flutter_root
generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
unless File.exist?(generated_xcode_build_settings_path)
raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
end

File.foreach(generated_xcode_build_settings_path) do |line|
matches = line.match(/FLUTTER_ROOT\=(.*)/)
return matches[1].strip if matches
end
raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
end

require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)

flutter_ios_podfile_setup

target 'Runner' do
use_frameworks!
use_modular_headers!

flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
target 'RunnerTests' do
inherit! :search_paths
end
end

post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
end
end
1 change: 1 addition & 0 deletions example/lib/core/get_random_stream.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Stream<DsDataPoint<T>> getRandomDataPointStream<T>(
name: DsPointName('/test'),
value: randomDelegate(random),
status: DsStatus.ok,
cot: DsCot.inf,
timestamp: DsTimeStamp.now().toString(),
),
duration: duration,
Expand Down
1 change: 1 addition & 0 deletions example/macos/Flutter/Flutter-Debug.xcconfig
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
#include "ephemeral/Flutter-Generated.xcconfig"
1 change: 1 addition & 0 deletions example/macos/Flutter/Flutter-Release.xcconfig
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
#include "ephemeral/Flutter-Generated.xcconfig"
43 changes: 43 additions & 0 deletions example/macos/Podfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
platform :osx, '10.14'

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'

project 'Runner', {
'Debug' => :debug,
'Profile' => :release,
'Release' => :release,
}

def flutter_root
generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'ephemeral', 'Flutter-Generated.xcconfig'), __FILE__)
unless File.exist?(generated_xcode_build_settings_path)
raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure \"flutter pub get\" is executed first"
end

File.foreach(generated_xcode_build_settings_path) do |line|
matches = line.match(/FLUTTER_ROOT\=(.*)/)
return matches[1].strip if matches
end
raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Flutter-Generated.xcconfig, then run \"flutter pub get\""
end

require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)

flutter_macos_podfile_setup

target 'Runner' do
use_frameworks!
use_modular_headers!

flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__))
target 'RunnerTests' do
inherit! :search_paths
end
end

post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_macos_build_settings(target)
end
end
7 changes: 3 additions & 4 deletions example/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: example
description: Usage example for hmi_widgets package.
version: 1.0.0+1
version: 1.0.1
publish_to: 'none'

environment:
Expand All @@ -15,12 +15,11 @@ dependencies:
hmi_core:
git:
url: https://github.com/a-givertzman/hmi_core.git
ref: 1.0.0
ref: 2.0.0
hmi_networking:
git:
url: https://github.com/a-givertzman/hmi_networking.git
ref: 1.0.0
another_flushbar: ^1.12.29
ref: 1.1.0

dev_dependencies:
flutter_test:
Expand Down
1 change: 1 addition & 0 deletions lib/hmi_widgets.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export 'src/buttons/drop_down_control_button/drop_down_control_button.dart';
//
// Popups
export 'src/popups/popup_menu_button/popup_menu_button_custom.dart';
export 'src/popups/bottom_message/bottom_message.dart';
//
// Indicators
// Status indicators
Expand Down
10 changes: 5 additions & 5 deletions lib/src/buttons/control_button/control_button_indicator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class ControlButtonIndicator extends StatefulWidget {

///
class _ControlButtonIndicatorState extends State<ControlButtonIndicator> with TickerProviderStateMixin {
static const _debug = false;
static const _log = Log('_ControlButtonIndicatorState');
final Stream<DsDataPoint<num>>? _stream;
final List<String> _stateValues;
final String? _caption;
Expand All @@ -66,7 +66,7 @@ class _ControlButtonIndicatorState extends State<ControlButtonIndicator> with Ti
_stateColor = stateColor,
_captionColor = captionColor,
super() {
log(_debug, '[$_ControlButtonIndicatorState]');
_log.debug('[$_ControlButtonIndicatorState]');
}
//
@override
Expand Down Expand Up @@ -114,15 +114,15 @@ class _ControlButtonIndicatorState extends State<ControlButtonIndicator> with Ti
}
}
} else {
log(_debug, '[$_ControlButtonIndicatorState._build] snapshot.connectionState: ', snapshot.connectionState);
_log.debug('[._build] snapshot.connectionState: ${snapshot.connectionState}');
}
} else {
log(_debug, '[$_ControlButtonIndicatorState._build] snapshot.connectionState: ', snapshot.connectionState);
_log.debug('[._build] snapshot.connectionState: ${snapshot.connectionState}');
}
final fontSize = stateTextStyle.fontSize;
final stateTextHeight = stateTextStyle.height;
final boxHeight = stateTextHeight ?? (fontSize != null ? fontSize * 1.5 : 18);
// log(_debug, '[$_ControlButtonIndicatorState._build] boxHeight: ', boxHeight);
// _log.debug('[._build] boxHeight: $boxHeight');
return SizedBox(
height: boxHeight * 1.0 + padding * 2,
child: Stack(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ import 'package:hmi_networking/hmi_networking.dart';
import 'package:hmi_core/hmi_core.dart';
import 'package:hmi_widgets/hmi_widgets.dart';
///
enum LoadingUntil {
writeTagResponded,
responseTagResponded,
}
///
/// Кнопка посылает значение bool / int / real в DsClient
class DropDownControlButton extends StatefulWidget {
final BufferedStream<bool>? _disabledStream;
Expand All @@ -14,6 +19,7 @@ class DropDownControlButton extends StatefulWidget {
final DsClient? _dsClient;
final DsPointName? _writeTagName;
final String? _responseTagName;
final LoadingUntil _loadingUntil;
final Map<int, String> _items;
final String? _tooltip;
final String? _label;
Expand All @@ -30,6 +36,7 @@ class DropDownControlButton extends StatefulWidget {
required Map<int, String> items,
String? tooltip,
String? label,
LoadingUntil loadingUntil = LoadingUntil.responseTagResponded,
}) :
_disabledStream = disabledStream,
_itemsDisabledStreams = itemsDisabledStreams,
Expand All @@ -41,6 +48,7 @@ class DropDownControlButton extends StatefulWidget {
_items = items,
_tooltip = tooltip,
_label = label,
_loadingUntil = loadingUntil,
super(key: key);
//
@override
Expand All @@ -57,14 +65,15 @@ class DropDownControlButton extends StatefulWidget {
items: _items,
tooltip: _tooltip,
label: _label,
loadingUntil: _loadingUntil,
);
///
BufferedStream<DsDataPoint<int>>? _buildResponseSTream(DsClient? dsClient, String? tagName) {
if (dsClient != null){
if (tagName != null) {
return BufferedStream<DsDataPoint<int>>(
dsClient.streamInt(tagName),
initValue: DsDataPoint(type: DsDataType.integer, name: DsPointName('/test/test/test/test'), value: -1, status: DsStatus.ok, timestamp: DsTimeStamp.now().toString()),
initValue: DsDataPoint(type: DsDataType.integer, name: DsPointName('/test/test/test/test'), value: -1, status: DsStatus.ok, cot: DsCot.inf, timestamp: DsTimeStamp.now().toString()),
);
}
}
Expand All @@ -91,6 +100,7 @@ class _DropDownControlButtonState extends State<DropDownControlButton> with Tick
final Map<int, bool> _itemsDisabled = {};
late AnimationController _animationController;
final StreamController<Null> _streamController = StreamController<Null>();
final LoadingUntil _loadingUntil;
///
_DropDownControlButtonState({
required BufferedStream<bool>? isDisabledStream,
Expand All @@ -104,6 +114,7 @@ class _DropDownControlButtonState extends State<DropDownControlButton> with Tick
required Map<int, String> items,
required String? tooltip,
required String? label,
required LoadingUntil loadingUntil,
}) :
_isDisabledStream = isDisabledStream,
_itemsDisabledStreams = itemsDisabledStreams,
Expand All @@ -116,6 +127,7 @@ class _DropDownControlButtonState extends State<DropDownControlButton> with Tick
_items = items,
_tooltip = tooltip,
_label = label,
_loadingUntil = loadingUntil,
super();
//
@override
Expand All @@ -137,7 +149,7 @@ class _DropDownControlButtonState extends State<DropDownControlButton> with Tick
_itemDisabledSuscriptions.add(itemDisabledSuscription);
});
final responseStream = _responseStream;
responseStream?.stream.listen((event) {
responseStream?.stream.listen((event) {
if (_state.isLoading) {
_state.setLoaded();
}
Expand Down Expand Up @@ -275,13 +287,21 @@ class _DropDownControlButtonState extends State<DropDownControlButton> with Tick
if (mounted) setState(() => _state.setSaving());
DsSend<int>(
dsClient: dsClient,
pointName: writeTagName,
response: responseTagName,
pointName: writeTagName,
response: switch(_loadingUntil) {
LoadingUntil.writeTagResponded => null,
LoadingUntil.responseTagResponded => _responseTagName,
},
cot: DsCot.act,
responseCots: switch(_loadingUntil) {
LoadingUntil.writeTagResponded => [DsCot.actCon, DsCot.actErr],
LoadingUntil.responseTagResponded => [DsCot.inf],
},
)
.exec(value)
.then((responseValue) {
if (mounted) setState(() => _state.setSaved());
});
.exec(value)
.then((responseValue) {
if (mounted) setState(() => _state.setSaved());
});
}
}
//
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class DropDownControlButtonDepricated extends StatefulWidget {

///
class _DropDownControlButtonState extends State<DropDownControlButtonDepricated> with TickerProviderStateMixin {
static const _debug = true;
static const _log = Log('_DropDownControlButtonState');
final _state = NetworkOperationState(isLoading: true);
final double? _width;
final double? _height;
Expand Down Expand Up @@ -117,7 +117,7 @@ class _DropDownControlButtonState extends State<DropDownControlButtonDepricated>
if (itemsDisabledStreams != null) {
itemsDisabledStreams.forEach((index, itemDisabledStream) {
final itemDisabledSuscription = itemDisabledStream.listen((event) {
log(_debug, '[$_DropDownControlButtonState.initState] index: $index\tevent: $event');
_log.debug('[.initState] index: $index\tevent: $event');
_itemsDisabled[index] = event;
});
_itemDisabledSuscriptions.add(itemDisabledSuscription);
Expand Down Expand Up @@ -157,7 +157,7 @@ class _DropDownControlButtonState extends State<DropDownControlButtonDepricated>
_lastSelectedValue = point?.value ?? _lastSelectedValue;
_isDisabled = snapshots.data?.value2 ?? _isDisabled;
}
log(_debug, '$_DropDownControlButtonState.build isDisabled: ', _isDisabled);
_log.debug('.build isDisabled: $_isDisabled');
return PopupMenuButtonCustom<int>(
// color: backgroundColor,
offset: Offset(width != null ? width * 0.7 : 100, height ?? 0),
Expand Down Expand Up @@ -218,10 +218,10 @@ class _DropDownControlButtonState extends State<DropDownControlButtonDepricated>
}).values.toList();
},
onCanceled: () {
log(_debug, '[$_DropDownControlButtonState] onCanceled');
_log.debug('[$_DropDownControlButtonState] onCanceled');
},
onSelected: (value) {
log(_debug, '[$_DropDownControlButtonState] onSelected: ', value);
_log.debug('[$_DropDownControlButtonState] onSelected: $value');
if (_items.containsKey(value)) {
final sendValue = value;
if (sendValue != _lastSelectedValue) {
Expand Down Expand Up @@ -304,7 +304,8 @@ class _DropDownControlButtonState extends State<DropDownControlButtonDepricated>
DsSend<int>(
dsClient: dsClient,
pointName: writeTagName,
response: responseTagName,
cot: DsCot.act,
responseCots: [DsCot.actCon, DsCot.actErr, DsCot.inf],
)
.exec(value)
.then((responseValue) {
Expand Down
6 changes: 2 additions & 4 deletions lib/src/charts/crane_load_chart/crane_load_point_painter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import 'package:flutter/material.dart';
import 'package:hmi_core/hmi_core_log.dart';
///
class CraneLoadPointPainter extends CustomPainter {
static const _debug = false;
static const _log = Log('CraneLoadPointPainter');
final Map<int, String> _xAxis;
final Map<int, String> _yAxis;
final bool _showGrrid;
Expand Down Expand Up @@ -39,9 +39,7 @@ class CraneLoadPointPainter extends CustomPainter {
//
@override
void paint(Canvas canvas, Size size) {
log(_debug, '[$CraneLoadPointPainter.paint]');
log(_debug, '[$CraneLoadPointPainter.paint] xAxis: ', _xAxis);
log(_debug, '[$CraneLoadPointPainter.paint] yAxis: ', _yAxis);
_log.debug('[.paint] xAxis: $_xAxis | yAxis: $_yAxis');
_drawBackgroundRect(canvas, size);
_drawXaxis(canvas, size);
_drawYaxis(canvas, size);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import 'package:hmi_core/hmi_core_log.dart';
import 'crane_position_chart.dart';
///
class CranePositionPainter extends CustomPainter {
static const _debug = false;
static const _log = Log('CranePositionPainter');
final DrawingController _drawingController;
final int code;
final Size size;
Expand All @@ -29,7 +29,7 @@ class CranePositionPainter extends CustomPainter {
//
@override
void paint(Canvas canvas, Size size) {
log(_debug, '[$CranePositionPainter.paint]');
_log.debug('[.paint]');
final Color verticalLineColor;
if (_drawingController.isXValid) {
verticalLineColor = _drawingController.swlProtection
Expand Down
Loading
Loading