Skip to content

Commit

Permalink
Added import sorting
Browse files Browse the repository at this point in the history
  • Loading branch information
Gold872 committed Dec 9, 2023
1 parent a7c1454 commit 398309f
Show file tree
Hide file tree
Showing 70 changed files with 304 additions and 172 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/elastic-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ jobs:
- name: Verify formatting
run: dart format --output=none --set-exit-if-changed lib/* test/*

- name: Verify import order
run: dart run import_sorter:main lib\/* test\/* --no-comments --exit-if-changed

- name: Analyze project source
run: flutter analyze --no-fatal-infos --no-fatal-warnings
test:
Expand Down
16 changes: 9 additions & 7 deletions lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
import 'dart:io';

import 'package:elastic_dashboard/pages/dashboard_page.dart';
import 'package:elastic_dashboard/services/field_images.dart';
import 'package:elastic_dashboard/services/settings.dart';
import 'package:elastic_dashboard/services/ip_address_util.dart';
import 'package:elastic_dashboard/services/log.dart';
import 'package:elastic_dashboard/services/nt4_connection.dart';
import 'package:elastic_dashboard/services/nt4_widget_builder.dart';
import 'package:flutter/material.dart';

import 'package:package_info_plus/package_info_plus.dart';
import 'package:path_provider/path_provider.dart';
import 'package:screen_retriever/screen_retriever.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:window_manager/window_manager.dart';

import 'package:elastic_dashboard/pages/dashboard_page.dart';
import 'package:elastic_dashboard/services/field_images.dart';
import 'package:elastic_dashboard/services/ip_address_util.dart';
import 'package:elastic_dashboard/services/log.dart';
import 'package:elastic_dashboard/services/nt4_connection.dart';
import 'package:elastic_dashboard/services/nt4_widget_builder.dart';
import 'package:elastic_dashboard/services/settings.dart';

void main() async {
WidgetsFlutterBinding.ensureInitialized();

Expand Down
24 changes: 13 additions & 11 deletions lib/pages/dashboard_page.dart
Original file line number Diff line number Diff line change
@@ -1,13 +1,25 @@
import 'dart:convert';
import 'dart:io';

import 'package:flutter/material.dart';
import 'package:flutter/scheduler.dart';
import 'package:flutter/services.dart';

import 'package:collection/collection.dart';
import 'package:dot_cast/dot_cast.dart';
import 'package:elastic_dashboard/services/settings.dart';
import 'package:elegant_notification/elegant_notification.dart';
import 'package:elegant_notification/resources/arrays.dart';
import 'package:file_selector/file_selector.dart';
import 'package:screen_retriever/screen_retriever.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:url_launcher/url_launcher.dart';
import 'package:window_manager/window_manager.dart';

import 'package:elastic_dashboard/services/hotkey_manager.dart';
import 'package:elastic_dashboard/services/ip_address_util.dart';
import 'package:elastic_dashboard/services/log.dart';
import 'package:elastic_dashboard/services/nt4_connection.dart';
import 'package:elastic_dashboard/services/settings.dart';
import 'package:elastic_dashboard/services/shuffleboard_nt_listener.dart';
import 'package:elastic_dashboard/services/update_checker.dart';
import 'package:elastic_dashboard/widgets/custom_appbar.dart';
Expand All @@ -19,16 +31,6 @@ import 'package:elastic_dashboard/widgets/draggable_dialog.dart';
import 'package:elastic_dashboard/widgets/editable_tab_bar.dart';
import 'package:elastic_dashboard/widgets/network_tree/network_table_tree.dart';
import 'package:elastic_dashboard/widgets/settings_dialog.dart';
import 'package:elegant_notification/elegant_notification.dart';
import 'package:elegant_notification/resources/arrays.dart';
import 'package:file_selector/file_selector.dart';
import 'package:flutter/material.dart';
import 'package:flutter/scheduler.dart';
import 'package:flutter/services.dart';
import 'package:screen_retriever/screen_retriever.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:url_launcher/url_launcher.dart';
import 'package:window_manager/window_manager.dart';

class DashboardPage extends StatefulWidget {
final SharedPreferences preferences;
Expand Down
3 changes: 2 additions & 1 deletion lib/services/ds_interop.dart
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import 'dart:convert';
import 'dart:io';

import 'package:flutter/foundation.dart';

import 'package:elastic_dashboard/services/ip_address_util.dart';
import 'package:elastic_dashboard/services/log.dart';
import 'package:flutter/foundation.dart';

class DSInteropClient {
final String serverBaseAddress = '127.0.0.1';
Expand Down
3 changes: 2 additions & 1 deletion lib/services/hotkey_manager.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'package:collection/collection.dart';
import 'package:flutter/services.dart';

import 'package:collection/collection.dart';
import 'package:uuid/uuid.dart';

class HotKey {
Expand Down
1 change: 1 addition & 0 deletions lib/services/log.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import 'dart:io';

import 'package:flutter/foundation.dart';

import 'package:logger/logger.dart';
import 'package:path/path.dart';
import 'package:path_provider/path_provider.dart';
Expand Down
4 changes: 3 additions & 1 deletion lib/services/nt4.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@ import 'dart:async';
import 'dart:convert';
import 'dart:math';

import 'package:elastic_dashboard/services/log.dart';
import 'package:flutter/foundation.dart';

import 'package:messagepack/messagepack.dart';
import 'package:msgpack_dart/msgpack_dart.dart';
import 'package:web_socket_channel/web_socket_channel.dart';

import 'package:elastic_dashboard/services/log.dart';

class NT4Client {
// TODO: Change to 1000 for 2024 NT4.1 updates
static int pingTimeoutMs = 5000;
Expand Down
5 changes: 3 additions & 2 deletions lib/services/nt4_connection.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import 'package:flutter/foundation.dart';

import 'package:elastic_dashboard/services/ds_interop.dart';
import 'package:elastic_dashboard/services/settings.dart';
import 'package:elastic_dashboard/services/log.dart';
import 'package:elastic_dashboard/services/nt4.dart';
import 'package:flutter/foundation.dart';
import 'package:elastic_dashboard/services/settings.dart';

NT4Connection get nt4Connection => NT4Connection.instance;

Expand Down
5 changes: 3 additions & 2 deletions lib/services/nt4_widget_builder.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import 'package:elastic_dashboard/services/settings.dart';
import 'package:flutter/foundation.dart';

import 'package:elastic_dashboard/services/log.dart';
import 'package:elastic_dashboard/services/settings.dart';
import 'package:elastic_dashboard/widgets/draggable_containers/draggable_widget_container.dart';
import 'package:elastic_dashboard/widgets/nt4_widgets/multi-topic/accelerometer.dart';
import 'package:elastic_dashboard/widgets/nt4_widgets/multi-topic/camera_stream.dart';
Expand Down Expand Up @@ -34,7 +36,6 @@ import 'package:elastic_dashboard/widgets/nt4_widgets/single_topic/text_display.
import 'package:elastic_dashboard/widgets/nt4_widgets/single_topic/toggle_button.dart';
import 'package:elastic_dashboard/widgets/nt4_widgets/single_topic/toggle_switch.dart';
import 'package:elastic_dashboard/widgets/nt4_widgets/single_topic/voltage_view.dart';
import 'package:flutter/foundation.dart';

class NT4WidgetBuilder {
static final Map<
Expand Down
3 changes: 2 additions & 1 deletion lib/services/shuffleboard_nt_listener.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import 'package:dot_cast/dot_cast.dart';
import 'package:elastic_dashboard/services/settings.dart';

import 'package:elastic_dashboard/services/nt4.dart';
import 'package:elastic_dashboard/services/nt4_connection.dart';
import 'package:elastic_dashboard/services/settings.dart';
import 'package:elastic_dashboard/widgets/draggable_containers/draggable_widget_container.dart';
import 'package:elastic_dashboard/widgets/network_tree/tree_row.dart';
import 'package:elastic_dashboard/widgets/nt4_widgets/nt4_widget.dart';
Expand Down
3 changes: 2 additions & 1 deletion lib/services/update_checker.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import 'package:elastic_dashboard/services/log.dart';
import 'package:github/github.dart';
import 'package:version/version.dart';

import 'package:elastic_dashboard/services/log.dart';

class UpdateChecker {
final GitHub _github;
final String currentVersion;
Expand Down
4 changes: 3 additions & 1 deletion lib/widgets/custom_appbar.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import 'package:elastic_dashboard/services/settings.dart';
import 'package:flutter/material.dart';

import 'package:titlebar_buttons/titlebar_buttons.dart';
import 'package:window_manager/window_manager.dart';

import 'package:elastic_dashboard/services/settings.dart';

class CustomAppBar extends AppBar {
final String titleText;
final Color? appBarColor;
Expand Down
8 changes: 5 additions & 3 deletions lib/widgets/dashboard_grid.dart
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
import 'package:flutter/material.dart';

import 'package:contextmenu/contextmenu.dart';
import 'package:dot_cast/dot_cast.dart';
import 'package:elastic_dashboard/services/settings.dart';
import 'package:provider/provider.dart';

import 'package:elastic_dashboard/services/nt4_connection.dart';
import 'package:elastic_dashboard/services/settings.dart';
import 'package:elastic_dashboard/widgets/draggable_containers/draggable_layout_container.dart';
import 'package:elastic_dashboard/widgets/draggable_containers/draggable_list_layout.dart';
import 'package:elastic_dashboard/widgets/draggable_containers/draggable_nt4_widget_container.dart';
import 'package:elastic_dashboard/widgets/draggable_containers/draggable_widget_container.dart';
import 'package:elastic_dashboard/widgets/nt4_widgets/nt4_widget.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';

// Used to refresh the dashboard grid when a widget is added or removed
// This doesn't use a stateless widget since everything has to be rendered at program startup or data will be lost
Expand Down
1 change: 1 addition & 0 deletions lib/widgets/dialog_widgets/dialog_color_picker.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';

import 'package:flutter_colorpicker/flutter_colorpicker.dart';

class DialogColorPicker extends StatefulWidget {
Expand Down
3 changes: 2 additions & 1 deletion lib/widgets/dialog_widgets/layout_drag_tile.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import 'package:elastic_dashboard/widgets/draggable_containers/draggable_layout_container.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';

import 'package:elastic_dashboard/widgets/draggable_containers/draggable_layout_container.dart';

class LayoutDragTile extends StatelessWidget {
final String title;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import 'dart:ui';

import 'package:flutter/foundation.dart';

import 'package:elastic_dashboard/widgets/draggable_containers/draggable_nt4_widget_container.dart';
import 'package:elastic_dashboard/widgets/draggable_containers/draggable_widget_container.dart';
import 'package:flutter/foundation.dart';

abstract class DraggableLayoutContainer extends DraggableWidgetContainer {
String get type;
Expand Down
4 changes: 3 additions & 1 deletion lib/widgets/draggable_containers/draggable_list_layout.dart
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import 'dart:ui';

import 'package:flutter/material.dart';

import 'package:collection/collection.dart';
import 'package:dot_cast/dot_cast.dart';

import 'package:elastic_dashboard/widgets/dialog_widgets/dialog_dropdown_chooser.dart';
import 'package:elastic_dashboard/widgets/dialog_widgets/dialog_text_input.dart';
import 'package:elastic_dashboard/widgets/draggable_containers/draggable_layout_container.dart';
import 'package:elastic_dashboard/widgets/draggable_containers/draggable_nt4_widget_container.dart';
import 'package:elastic_dashboard/widgets/draggable_containers/draggable_widget_container.dart';
import 'package:flutter/material.dart';

class DraggableListLayout extends DraggableLayoutContainer {
@override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import 'package:dot_cast/dot_cast.dart';
import 'package:elastic_dashboard/services/nt4_widget_builder.dart';
import 'package:elastic_dashboard/widgets/dialog_widgets/dialog_dropdown_chooser.dart';
import 'package:elastic_dashboard/widgets/draggable_containers/draggable_widget_container.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';

import 'package:dot_cast/dot_cast.dart';
import 'package:provider/provider.dart';

import 'package:elastic_dashboard/services/nt4_widget_builder.dart';
import 'package:elastic_dashboard/widgets/dialog_widgets/dialog_dropdown_chooser.dart';
import 'package:elastic_dashboard/widgets/draggable_containers/draggable_widget_container.dart';
import '../dialog_widgets/dialog_text_input.dart';
import '../nt4_widgets/nt4_widget.dart';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import 'package:flutter/material.dart';

import 'package:dot_cast/dot_cast.dart';
import 'package:flutter_box_transform/flutter_box_transform.dart';
import 'package:provider/provider.dart';

import 'package:elastic_dashboard/services/settings.dart';
import 'package:elastic_dashboard/widgets/dashboard_grid.dart';
import 'package:elastic_dashboard/widgets/dialog_widgets/dialog_text_input.dart';
import 'package:flutter/material.dart';
import 'package:flutter_box_transform/flutter_box_transform.dart';
import 'package:provider/provider.dart';

class WidgetContainerModel extends ChangeNotifier {
bool draggable = true;
Expand Down
4 changes: 3 additions & 1 deletion lib/widgets/draggable_dialog.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import 'package:elastic_dashboard/services/settings.dart';
import 'package:flutter/material.dart';

import 'package:flutter_box_transform/flutter_box_transform.dart';

import 'package:elastic_dashboard/services/settings.dart';

class DraggableDialog extends StatefulWidget {
final Widget dialog;
final Rect initialPosition;
Expand Down
10 changes: 6 additions & 4 deletions lib/widgets/editable_tab_bar.dart
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import 'package:contextmenu/contextmenu.dart';
import 'package:elastic_dashboard/services/settings.dart';
import 'package:elastic_dashboard/widgets/dashboard_grid.dart';
import 'package:elastic_dashboard/widgets/dialog_widgets/dialog_text_input.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';

import 'package:contextmenu/contextmenu.dart';
import 'package:provider/provider.dart';
import 'package:transitioned_indexed_stack/transitioned_indexed_stack.dart';

import 'package:elastic_dashboard/services/settings.dart';
import 'package:elastic_dashboard/widgets/dashboard_grid.dart';
import 'package:elastic_dashboard/widgets/dialog_widgets/dialog_text_input.dart';

class TabData {
String name;

Expand Down
1 change: 1 addition & 0 deletions lib/widgets/mjpeg.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import 'dart:io';

import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';

import 'package:flutter_hooks/flutter_hooks.dart';
import 'package:http/http.dart';
import 'package:visibility_detector/visibility_detector.dart';
Expand Down
6 changes: 4 additions & 2 deletions lib/widgets/network_tree/network_table_tree.dart
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import 'dart:ui';

import 'package:flutter/material.dart';

import 'package:collection/collection.dart';
import 'package:flutter_fancy_tree_view/flutter_fancy_tree_view.dart';

import 'package:elastic_dashboard/services/nt4.dart';
import 'package:elastic_dashboard/services/nt4_connection.dart';
import 'package:elastic_dashboard/widgets/draggable_containers/draggable_nt4_widget_container.dart';
import 'package:elastic_dashboard/widgets/draggable_containers/draggable_widget_container.dart';
import 'package:elastic_dashboard/widgets/network_tree/tree_row.dart';
import 'package:flutter/material.dart';
import 'package:flutter_fancy_tree_view/flutter_fancy_tree_view.dart';

class NetworkTableTree extends StatefulWidget {
final Function(Offset globalPosition, DraggableNT4WidgetContainer widget)?
Expand Down
5 changes: 3 additions & 2 deletions lib/widgets/network_tree/tree_row.dart
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import 'package:flutter/material.dart';

import 'package:elastic_dashboard/services/nt4.dart';
import 'package:elastic_dashboard/services/nt4_connection.dart';
import 'package:elastic_dashboard/services/nt4_widget_builder.dart';
import 'package:elastic_dashboard/widgets/draggable_containers/draggable_widget_container.dart';
import 'package:elastic_dashboard/widgets/nt4_widgets/multi-topic/camera_stream.dart';
import 'package:elastic_dashboard/widgets/nt4_widgets/single_topic/boolean_box.dart';
import 'package:elastic_dashboard/widgets/nt4_widgets/nt4_widget.dart';
import 'package:elastic_dashboard/widgets/nt4_widgets/single_topic/boolean_box.dart';
import 'package:elastic_dashboard/widgets/nt4_widgets/single_topic/text_display.dart';
import 'package:flutter/material.dart';

class TreeRow {
final String topic;
Expand Down
6 changes: 4 additions & 2 deletions lib/widgets/nt4_widgets/multi-topic/accelerometer.dart
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import 'package:flutter/material.dart';

import 'package:dot_cast/dot_cast.dart';
import 'package:provider/provider.dart';

import 'package:elastic_dashboard/services/nt4.dart';
import 'package:elastic_dashboard/services/nt4_connection.dart';
import 'package:elastic_dashboard/widgets/nt4_widgets/nt4_widget.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';

class AccelerometerWidget extends NT4Widget {
static const String widgetType = 'Accelerometer';
Expand Down
8 changes: 5 additions & 3 deletions lib/widgets/nt4_widgets/multi-topic/camera_stream.dart
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import 'package:flutter/material.dart';

import 'package:dot_cast/dot_cast.dart';
import 'package:http/http.dart';
import 'package:provider/provider.dart';

import 'package:elastic_dashboard/services/nt4_connection.dart';
import 'package:elastic_dashboard/widgets/custom_loading_indicator.dart';
import 'package:elastic_dashboard/widgets/mjpeg.dart';
import 'package:elastic_dashboard/widgets/nt4_widgets/nt4_widget.dart';
import 'package:flutter/material.dart';
import 'package:http/http.dart';
import 'package:provider/provider.dart';

class CameraStreamWidget extends NT4Widget {
static const String widgetType = 'Camera Stream';
Expand Down
Loading

0 comments on commit 398309f

Please sign in to comment.