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

Move widgets to hmi_widgets #26

Merged
merged 26 commits into from
Feb 9, 2023
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
eaf355c
Added AC drive widget
Minyewoo Feb 1, 2023
694f2f6
Fixed CraneLoadChart in example
Minyewoo Feb 1, 2023
af3e8cf
Added DateEditField
Minyewoo Feb 1, 2023
05f9fe0
Adding edit fields (WIP)
Minyewoo Feb 1, 2023
6340777
Added exports
Minyewoo Feb 1, 2023
046aa4b
Passed objects for auth to network edit fields
Minyewoo Feb 2, 2023
35c35c3
Added edit fields to example
Minyewoo Feb 2, 2023
4a2072c
Exported AuthDialog
Minyewoo Feb 2, 2023
8e68c7e
Used refactored localization
Minyewoo Feb 3, 2023
bb34132
Localized
a-givertzman Feb 3, 2023
c701c52
Merge branch 'Move-widgets-to-hmi_widgets' of https://github.com/a-gi…
a-givertzman Feb 3, 2023
1c39f93
unused DataSource removed
a-givertzman Feb 3, 2023
92c0388
unused DataSource removed
a-givertzman Feb 3, 2023
ca34c04
static analisis issues fixed
a-givertzman Feb 3, 2023
d1eadae
Took flushBarDuration and passwordKey from settings, made use of 'v' …
Minyewoo Feb 8, 2023
d0e1f94
AcDriveWidget default motor icons
a-givertzman Feb 8, 2023
6fc6db6
SwlData input files
a-givertzman Feb 8, 2023
0ae3e8a
SwlData input files
a-givertzman Feb 8, 2023
95c5152
Added default icons for AcDriveWidget
Minyewoo Feb 8, 2023
e2c07b6
Replaced assetName constructor param with JsonMap in SwlData and OilData
Minyewoo Feb 8, 2023
b8cec39
Added SwlData test
Minyewoo Feb 8, 2023
2f79948
Fixed SwlData bug with empty strings
Minyewoo Feb 9, 2023
6fb1270
Added OilData test
Minyewoo Feb 9, 2023
4600704
Used Log inside OilData
Minyewoo Feb 9, 2023
2eabfd6
SwlData test | compared received lists' lengths
Minyewoo Feb 9, 2023
5107d18
Added spaces to SwlData empty strings test case
Minyewoo Feb 9, 2023
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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ migrate_working_dir/

# Flutter/Dart/Pub related
# Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock.
/.flutter-plugins
/.flutter-plugins-dependencies
/pubspec.lock
**/doc/api/
.dart_tool/
Expand Down
Binary file added example/assets/icons/ac_motor.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added example/assets/icons/ac_motor_failure.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 2 additions & 3 deletions example/lib/core/get_random_stream.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import 'dart:math';

import 'package:hmi_core/hmi_core.dart';

///
Stream<DsDataPoint<T>> getRandomDataPointStream<T>(
T Function(Random) randomDelegate, {
Duration duration = const Duration(seconds: 1),
Expand All @@ -18,7 +17,7 @@ Stream<DsDataPoint<T>> getRandomDataPointStream<T>(
duration: duration,
);
}

///
Stream<T> getRandomStream<T>(
T Function(Random) randomDelegate, {
Duration duration = const Duration(seconds: 1),
Expand Down
20 changes: 18 additions & 2 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,12 +1,28 @@
import 'package:example/pages/home/home_page.dart';
import 'package:flutter/material.dart';

import 'package:hmi_networking/hmi_networking.dart';
///
void main() {
DataSource.initialize({
'app-user': DataSet<Map<String, String>>(
params: ApiParams( <String, dynamic>{
'api-sql': 'select',
'tableName': 'app_user',
}),
apiRequest: const ApiRequest(
url: '127.0.0.1',
api: '/get-app-user',
port: 8080,
),
),
});
runApp(const MyApp());
}

///
class MyApp extends StatelessWidget {
///
const MyApp({super.key});
//
@override
Widget build(BuildContext context) {
return MaterialApp(
Expand Down
5 changes: 3 additions & 2 deletions example/lib/pages/buttons/buttons_page.dart
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import 'package:example/core/get_random_stream.dart';
import 'package:flutter/material.dart';
import 'package:hmi_widgets/hmi_widgets.dart';

///
class ButtonsPage extends StatelessWidget {
///
const ButtonsPage({super.key});

//
@override
Widget build(BuildContext context) {
return Scaffold(
Expand Down
2 changes: 1 addition & 1 deletion example/lib/pages/charts/charts_page.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_widgets/hmi_widgets.dart';
///
class ChartsPage extends StatelessWidget {
final _swlLimitSet = const [0.3, 0.5, 0.7];
final _swlLimitSet = const [0.3, 0.5, 0.7, 1.1];
final _swlColorSet = const [Colors.grey, Colors.green, Colors.blue, Colors.red];
final _swlNameSet = const ['Limit1', 'Limit2', 'Limit3', 'Limits4'];
final _width = 450.0;
Expand Down
11 changes: 5 additions & 6 deletions example/lib/pages/charts/fake_swl_data.dart
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import 'dart:math';

import 'package:hmi_widgets/hmi_widgets.dart';

///
class FakeSwlData implements SwlData {
final double _rawWidth;
final double _rawHeight;
final int _pointsCount;
final int _swlIndexesCount;

///
FakeSwlData({
required double rawWidth,
required double rawHeight,
Expand All @@ -17,23 +16,23 @@ class FakeSwlData implements SwlData {
_pointsCount = pointsCount,
_rawHeight = rawHeight,
_rawWidth = rawWidth;

//
@override
Future<List<double>> get x {
final random = Random();
return Future.value(
List.generate(_pointsCount, (index) => random.nextDouble() * _rawWidth),
);
}

//
@override
Future<List<double>> get y {
final random = Random();
return Future.value(
List.generate(_pointsCount, (index) => random.nextDouble() * _rawHeight),
);
}

//
@override
Future<List<List<double>>> get swl {
final random = Random();
Expand Down
58 changes: 58 additions & 0 deletions example/lib/pages/edit_fields/edit_fields_page.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import 'package:example/pages/edit_fields/fake_oil_data.dart';
import 'package:flutter/material.dart';
import 'package:hmi_widgets/hmi_widgets.dart';
///
class EditFieldsPage extends StatelessWidget {
///
const EditFieldsPage({super.key});
//
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Edit Fields'),
),
body: ListView(
children: [
Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
children: const [
Text('Date Edit Field'),
SizedBox(
width: 300,
child: DateEditField(),
),
],
),
),
Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
children: const [
Text('Network Edit Field'),
SizedBox(
width: 300,
child: NetworkEditField<double>(
labelText: 'TestField',
),
),
],
),
),
Column(
children: const [
Text('Network Dropdown Form Field'),
SizedBox(
width: 300,
child: NetworkDropdownFormField(
oilData: FakeOilData(),
),
),
],
),
],
),
);
}
}
11 changes: 11 additions & 0 deletions example/lib/pages/edit_fields/fake_oil_data.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import 'package:hmi_widgets/hmi_widgets.dart';
///
class FakeOilData implements OilData {
///
const FakeOilData();
//
@override
Future<List<String>> names() => Future.value(
['ISO VG68', 'ISO VG46', 'ISO VG32', 'ISO VG422'],
);
}
4 changes: 2 additions & 2 deletions example/lib/pages/home/home_menu_button.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import 'package:flutter/material.dart';

///
class HomeMenuButton extends StatelessWidget {
final String text;
final void Function()? onPressed;
Expand All @@ -8,7 +8,7 @@ class HomeMenuButton extends StatelessWidget {
required this.text,
this.onPressed,
}) : super(key: key);

//
@override
Widget build(BuildContext context) {
return TextButton(
Expand Down
23 changes: 20 additions & 3 deletions example/lib/pages/home/home_page.dart
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import 'package:example/pages/buttons/buttons_page.dart';
import 'package:example/pages/charts/charts_page.dart';
import 'package:example/pages/edit_fields/edit_fields_page.dart';
import 'package:example/pages/process/process_page.dart';
import 'package:flutter/material.dart';

import 'home_menu_button.dart';

///
class HomePage extends StatelessWidget {
const HomePage({super.key});

//
@override
Widget build(BuildContext context) {
return Scaffold(
Expand Down Expand Up @@ -38,6 +39,22 @@ class HomePage extends StatelessWidget {
const HomeMenuButton(
text: 'Value Indicators',
),
HomeMenuButton(
text: 'Process Widgets',
onPressed: () => Navigator.of(context).push(
MaterialPageRoute(
builder: (_) => const ProccessPage(),
),
),
),
HomeMenuButton(
text: 'Edit fields',
onPressed: () => Navigator.of(context).push(
MaterialPageRoute(
builder: (_) => const EditFieldsPage(),
),
),
),
],
),
);
Expand Down
31 changes: 31 additions & 0 deletions example/lib/pages/process/process_page.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import 'package:example/core/get_random_stream.dart';
import 'package:flutter/material.dart';
import 'package:hmi_widgets/hmi_widgets.dart';
///
class ProccessPage extends StatelessWidget {
const ProccessPage({super.key});
//
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: const Text('Process Widgets')),
body: ListView(
padding: const EdgeInsets.all(4.0),
children: [
Column(
children: [
const Text('AC Drive'),
AcDriveWidget(
stream: getRandomDataPointStream(
(random) => random.nextInt(4),
).asBroadcastStream(),
acMotorIcon: Image.asset('assets/icons/ac_motor.png'),
acMotorFailureIcon: Image.asset('assets/icons/ac_motor_failure.png'),
),
],
),
],
),
);
}
}
2 changes: 2 additions & 0 deletions example/macos/Flutter/GeneratedPluginRegistrant.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import FlutterMacOS
import Foundation

import shared_preferences_foundation

func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin"))
}
8 changes: 5 additions & 3 deletions example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,13 @@ dependencies:
hmi_core:
git:
url: https://github.com/a-givertzman/hmi_core.git
ref: master
ref: Localized-refactoring
hmi_networking:
git:
url: https://github.com/a-givertzman/hmi_networking.git
ref: master
ref: Add-to-hmi_networking
fl_chart: ^0.55.1
another_flushbar: ^1.12.29

dev_dependencies:
flutter_test:
Expand All @@ -32,7 +33,8 @@ dev_dependencies:

# The following section is specific to Flutter packages.
flutter:

assets:
- assets/icons/
# The following line ensures that the Material Icons font is
# included with your application, so that you can use the icons in
# the material Icons class.
Expand Down
26 changes: 19 additions & 7 deletions lib/hmi_widgets.dart
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
library hmi_widgets;

//
// Theme
export 'src/theme/app_theme.dart';

//
// Dialogs
export 'src/dialogs/complete_dialog.dart';
export 'src/dialogs/delete_dialog.dart';
export 'src/dialogs/failure_dialog.dart';

export 'src/dialogs/auth_dialog.dart';
//
// Buttons
export 'src/buttons/circular_fab_widget.dart';
export 'src/buttons/control_button/control_button.dart';
export 'src/buttons/drop_down_control_button/drop_down_control_button.dart';

//
// Popups
export 'src/popups/popup_menu_button/popup_menu_button_custom.dart';

//
// Indicators
// Status indicators
export 'src/indicators/status_indicators/alarmed_status_indicator_widget.dart';
Expand All @@ -24,12 +25,13 @@ export 'src/indicators/status_indicators/dps_icon_indicator.dart';
export 'src/indicators/status_indicators/invalid_status_indicator.dart';
export 'src/indicators/status_indicators/sps_icon_indicator.dart';
export 'src/indicators/status_indicators/status_indicator_widget.dart';
//
// Value indicators
export 'src/indicators/value_indicators/circular_value_indicator.dart';
export 'src/indicators/value_indicators/linear_value_indicator.dart';
export 'src/indicators/value_indicators/text_value_indicator.dart';
export 'src/indicators/value_indicators/text_value_indicator_widget.dart';

//
// Charts
export 'src/charts/crane_load_chart/crane_load_chart.dart';
export 'src/charts/crane_load_chart/swl_data_cache.dart';
Expand All @@ -38,4 +40,14 @@ export 'src/charts/crane_load_chart/swl_data.dart';
export 'src/charts/crane_load_chart/crane_load_chart_legend_data.dart';
export 'src/charts/crane_load_chart/crane_load_chart_data.dart';
export 'src/charts/crane_position_chart/crane_position_chart.dart';
export 'src/charts/live_chart/live_chart_widget.dart';
export 'src/charts/live_chart/live_chart_widget.dart';
//
// Process
export 'src/process/electrical/drive/ac_drive_widget.dart';
//
// Edit fields
export 'src/edit_field/date_edit_field/date_edit_field.dart';
export 'src/edit_field/netword_edit_field/network_edit_field.dart';
export 'src/edit_field/network_dropdown_field/network_dropdown_field.dart';
export 'src/edit_field/network_dropdown_field/oil_data.dart';
export 'src/edit_field/network_field_authenticate.dart';
Loading