diff options
| author | uvok | 2025-07-30 20:34:54 +0200 | 
|---|---|---|
| committer | uvok | 2025-07-30 20:34:54 +0200 | 
| commit | e0fb75037ae575bb0c63703299c2039bf970ad65 (patch) | |
| tree | 0d259415e2bf115106ff25ebc77ff1f54d7c2284 | |
| parent | 87e1dfffd2c17ef0e3d0711394122456e9d0c7c8 (diff) | |
Shuffle code around / reorder
| -rw-r--r-- | lib/main.dart | 2 | ||||
| -rw-r--r-- | lib/model/flutter_blue_plus_device.dart | 5 | ||||
| -rw-r--r-- | lib/utility.dart | 18 | ||||
| -rw-r--r-- | lib/widgets/badge_app.dart (renamed from lib/badge_app.dart) | 2 | ||||
| -rw-r--r-- | lib/widgets/device_details.dart (renamed from lib/device_details.dart) | 0 | ||||
| -rw-r--r-- | lib/widgets/device_scan_select.dart (renamed from lib/device_scan_select.dart) | 16 | ||||
| -rw-r--r-- | lib/widgets/notifying_list_widget.dart | 27 | ||||
| -rw-r--r-- | lib/widgets/scan_page.dart (renamed from lib/scan_page.dart) | 4 | ||||
| -rw-r--r-- | test/widget_test.dart | 2 | 
9 files changed, 52 insertions, 24 deletions
| diff --git a/lib/main.dart b/lib/main.dart index 39f5e27..3e6c8cd 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -13,7 +13,7 @@  // You should have received a copy of the GNU General Public License  // along with this program.  If not, see <https://www.gnu.org/licenses/>. -import 'package:uvok_epaper_badge/badge_app.dart'; +import 'package:uvok_epaper_badge/widgets/badge_app.dart';  import 'package:flutter/material.dart';  import 'package:logger/logger.dart'; diff --git a/lib/model/flutter_blue_plus_device.dart b/lib/model/flutter_blue_plus_device.dart index 079d9fa..101c489 100644 --- a/lib/model/flutter_blue_plus_device.dart +++ b/lib/model/flutter_blue_plus_device.dart @@ -1,5 +1,6 @@  import 'package:uvok_epaper_badge/model/device.dart';  import 'package:flutter_blue_plus/flutter_blue_plus.dart'; +import 'package:uvok_epaper_badge/utility.dart';  class FlutterBluePlusDevice implements Device {    final ScanResult scanResult; @@ -24,7 +25,3 @@ class FlutterBluePlusDevice implements Device {      return bleDevice;    }  } - -String firstGiven(List<String> list) { -  return list.firstWhere((s) => s.isNotEmpty, orElse: () => ""); -} diff --git a/lib/utility.dart b/lib/utility.dart new file mode 100644 index 0000000..3be1f9b --- /dev/null +++ b/lib/utility.dart @@ -0,0 +1,18 @@ +// Copyright (C) 2025, uvok cheetah +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program.  If not, see <https://www.gnu.org/licenses/>. + +String firstGiven(List<String> list) { +  return list.firstWhere((s) => s.isNotEmpty, orElse: () => ""); +} diff --git a/lib/badge_app.dart b/lib/widgets/badge_app.dart index 37fbf4c..68cfce9 100644 --- a/lib/badge_app.dart +++ b/lib/widgets/badge_app.dart @@ -14,7 +14,7 @@  // along with this program.  If not, see <https://www.gnu.org/licenses/>.  import 'package:uvok_epaper_badge/control/mock_scanner_controller.dart'; -import 'package:uvok_epaper_badge/scan_page.dart'; +import 'package:uvok_epaper_badge/widgets/scan_page.dart';  import 'package:flutter/material.dart';  class BadgeApp extends StatelessWidget { diff --git a/lib/device_details.dart b/lib/widgets/device_details.dart index f3754d3..f3754d3 100644 --- a/lib/device_details.dart +++ b/lib/widgets/device_details.dart diff --git a/lib/device_scan_select.dart b/lib/widgets/device_scan_select.dart index a11a79a..c89d3cf 100644 --- a/lib/device_scan_select.dart +++ b/lib/widgets/device_scan_select.dart @@ -15,17 +15,7 @@  import 'package:uvok_epaper_badge/model/device.dart';  import 'package:flutter/material.dart'; - -abstract class NotifyingListWidget<T> extends StatefulWidget { -  final List<T> items; -  final ValueChanged<T?> onItemSelected; - -  const NotifyingListWidget({ -    super.key, -    required this.items, -    required this.onItemSelected, -  }); -} +import 'package:uvok_epaper_badge/widgets/notifying_list_widget.dart';  class DeviceScanSelection extends NotifyingListWidget<Device> {    const DeviceScanSelection({ @@ -94,7 +84,3 @@ class _DeviceScanSelectionState extends State<DeviceScanSelection> {      return true;    }  } - -String firstGiven(List<String> list) { -  return list.firstWhere((s) => s.isNotEmpty, orElse: () => ""); -} diff --git a/lib/widgets/notifying_list_widget.dart b/lib/widgets/notifying_list_widget.dart new file mode 100644 index 0000000..7fdc2b1 --- /dev/null +++ b/lib/widgets/notifying_list_widget.dart @@ -0,0 +1,27 @@ +// Copyright (C) 2025, uvok cheetah +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program.  If not, see <https://www.gnu.org/licenses/>. + +import 'package:flutter/material.dart'; + +abstract class NotifyingListWidget<T> extends StatefulWidget { +  final List<T> items; +  final ValueChanged<T?> onItemSelected; + +  const NotifyingListWidget({ +    super.key, +    required this.items, +    required this.onItemSelected, +  }); +} diff --git a/lib/scan_page.dart b/lib/widgets/scan_page.dart index 6256728..c557657 100644 --- a/lib/scan_page.dart +++ b/lib/widgets/scan_page.dart @@ -14,8 +14,8 @@  // along with this program.  If not, see <https://www.gnu.org/licenses/>.  import 'package:uvok_epaper_badge/control/scanner_controller.dart'; -import 'package:uvok_epaper_badge/device_details.dart'; -import 'package:uvok_epaper_badge/device_scan_select.dart'; +import 'package:uvok_epaper_badge/widgets/device_details.dart'; +import 'package:uvok_epaper_badge/widgets/device_scan_select.dart';  import 'package:uvok_epaper_badge/model/device.dart';  import 'package:flutter/material.dart';  import 'package:logger/logger.dart'; diff --git a/test/widget_test.dart b/test/widget_test.dart index 3a794df..5779cd8 100644 --- a/test/widget_test.dart +++ b/test/widget_test.dart @@ -5,7 +5,7 @@  // gestures. You can also use WidgetTester to find child widgets in the widget  // tree, read text, and verify that the values of widget properties are correct. -import 'package:uvok_epaper_badge/badge_app.dart'; +import 'package:uvok_epaper_badge/widgets/badge_app.dart';  import 'package:flutter/material.dart';  import 'package:flutter_test/flutter_test.dart'; | 
