diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml
index e28ce59..eb0025b 100644
--- a/android/app/src/main/AndroidManifest.xml
+++ b/android/app/src/main/AndroidManifest.xml
@@ -10,7 +10,7 @@
CFBundleDevelopmentRegion
$(DEVELOPMENT_LANGUAGE)
CFBundleDisplayName
- SIAB
+ SIAB Scale
CFBundleExecutable
$(EXECUTABLE_NAME)
CFBundleIdentifier
diff --git a/lib/main.dart b/lib/main.dart
index 2a838e0..f6632d2 100644
--- a/lib/main.dart
+++ b/lib/main.dart
@@ -20,7 +20,7 @@ class SIABApp extends StatelessWidget {
return ChangeNotifierProvider(
create: (_) => BLEService(),
child: MaterialApp(
- title: 'SIAB',
+ title: 'SIAB Scale',
theme: ThemeData(
colorScheme: colorScheme,
scaffoldBackgroundColor: const Color(0xFFF4F8FF),
diff --git a/lib/screens/devices_screen.dart b/lib/screens/devices_screen.dart
index 3760126..835cfc1 100644
--- a/lib/screens/devices_screen.dart
+++ b/lib/screens/devices_screen.dart
@@ -82,7 +82,7 @@ class _DevicesScreenState extends State {
builder: (ctx) => AlertDialog(
title: const Text('Unregister device'),
content: Text(
- 'Remove \"${device.label}\" (${device.uuid}) from registered devices?',
+ 'Remove "${device.label}" (${device.uuid}) from registered devices?',
),
actions: [
TextButton(
@@ -117,7 +117,7 @@ class _DevicesScreenState extends State {
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
- title: const Text('TIMBANGAN SIAB'),
+ title: const Text('SIAB SCALE'),
actions: [
IconButton(
onPressed: _loading ? null : _loadSaved,
@@ -148,7 +148,7 @@ class _DevicesScreenState extends State {
if (_scanResults.isEmpty && !ble.isScanning)
const Card(child: Padding(
padding: EdgeInsets.all(16),
- child: Text('Tap \"Scan Timbangan\" lihat melihat timbangan di sekitar.'),
+ child: Text('Tap "Scan Timbangan" lihat melihat timbangan di sekitar.'),
))
else
..._scanResults.map((r) {
@@ -300,7 +300,7 @@ class _ListRow extends StatelessWidget {
'$label:',
style: TextStyle(
fontWeight: FontWeight.w600,
- color: Theme.of(context).colorScheme.onSurface.withOpacity(0.8),
+ color: Theme.of(context).colorScheme.onSurface.withValues(alpha: 0.8),
fontSize: 13,
),
),
diff --git a/lib/screens/home_screen.dart b/lib/screens/home_screen.dart
index 22823de..7df23a9 100644
--- a/lib/screens/home_screen.dart
+++ b/lib/screens/home_screen.dart
@@ -25,7 +25,7 @@ class _HomeScreenState extends State {
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
- title: const Text('Timbangan Bluetooh'),
+ title: const Text('SIAB Scale'),
backgroundColor: Theme.of(context).colorScheme.inversePrimary,
actions: [
Consumer(
diff --git a/lib/screens/timbang_screen.dart b/lib/screens/timbang_screen.dart
index 8d5eea1..da00d61 100644
--- a/lib/screens/timbang_screen.dart
+++ b/lib/screens/timbang_screen.dart
@@ -58,8 +58,8 @@ class TimbangScreen extends StatelessWidget {
builder: (context, snapshot) {
final label = snapshot.data?.trim() ?? '';
final title = isConnected && label.isNotEmpty
- ? 'TIMBANGAN $label SIAB'
- : 'TIMBANGAN SIAB';
+ ? 'SIAB SCALE - $label'
+ : 'SIAB SCALE';
return _HeaderSection(
title: title,
diff --git a/lib/widgets/connection_card.dart b/lib/widgets/connection_card.dart
index 2034f41..e65927f 100644
--- a/lib/widgets/connection_card.dart
+++ b/lib/widgets/connection_card.dart
@@ -57,7 +57,7 @@ class ConnectionCard extends StatelessWidget {
final success = await ble.autoConnect();
if (!success && context.mounted) {
ScaffoldMessenger.of(context).showSnackBar(
- SnackBar(
+ const SnackBar(
content: Text(
'Failed to find ${SiabConfig.deviceName} device',
),
diff --git a/test/widget_test.dart b/test/widget_test.dart
index 0c9d7de..1cd8cf0 100644
--- a/test/widget_test.dart
+++ b/test/widget_test.dart
@@ -5,26 +5,54 @@
// 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:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
-
-import 'package:siab_bluetooth_app/main.dart';
+import 'package:siab_bluetooth_app/models/registered_device.dart';
+import 'package:siab_bluetooth_app/services/ble_service.dart';
void main() {
- testWidgets('Counter increments smoke test', (WidgetTester tester) async {
- // Build our app and trigger a frame.
- await tester.pumpWidget(const MyApp());
+ group('RegisteredDevice Model Tests', () {
+ test('toMap and fromMap serialization', () {
+ final device = RegisteredDevice(
+ id: 1,
+ uuid: '00:11:22:33:44:55',
+ label: 'Scale Alpha',
+ );
- // Verify that our counter starts at 0.
- expect(find.text('0'), findsOneWidget);
- expect(find.text('1'), findsNothing);
+ final map = device.toMap();
+ expect(map['id'], 1);
+ expect(map['uuid'], '00:11:22:33:44:55');
+ expect(map['label'], 'Scale Alpha');
- // Tap the '+' icon and trigger a frame.
- await tester.tap(find.byIcon(Icons.add));
- await tester.pump();
+ final from = RegisteredDevice.fromMap(map);
+ expect(from.id, 1);
+ expect(from.uuid, '00:11:22:33:44:55');
+ expect(from.label, 'Scale Alpha');
+ });
- // Verify that our counter has incremented.
- expect(find.text('0'), findsNothing);
- expect(find.text('1'), findsOneWidget);
+ test('copyWith works correctly', () {
+ final device = RegisteredDevice(
+ id: 1,
+ uuid: '00:11:22:33:44:55',
+ label: 'Scale Alpha',
+ );
+
+ final updated = device.copyWith(label: 'Scale Beta');
+ expect(updated.id, 1);
+ expect(updated.uuid, '00:11:22:33:44:55');
+ expect(updated.label, 'Scale Beta');
+ });
+ });
+
+ group('DataPacket Tests', () {
+ test('parses weight correctly from byte 3 (index 2)', () {
+ final packet = DataPacket(
+ data: [0xAA, 0xBB, 125, 0xDD],
+ timestamp: DateTime.now(),
+ packetNumber: 1,
+ );
+
+ expect(packet.weightKg, 12.5);
+ expect(packet.hexString, 'aabb7ddd');
+ });
});
}
diff --git a/web/index.html b/web/index.html
index 3cf4513..5f0145a 100644
--- a/web/index.html
+++ b/web/index.html
@@ -23,13 +23,13 @@
-
+
- siab_bluetooth_app
+ SIAB Scale
diff --git a/windows/runner/main.cpp b/windows/runner/main.cpp
index 7145801..ce99c12 100644
--- a/windows/runner/main.cpp
+++ b/windows/runner/main.cpp
@@ -27,7 +27,7 @@ int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev,
FlutterWindow window(project);
Win32Window::Point origin(10, 10);
Win32Window::Size size(1280, 720);
- if (!window.Create(L"siab_bluetooth_app", origin, size)) {
+ if (!window.Create(L"SIAB Scale", origin, size)) {
return EXIT_FAILURE;
}
window.SetQuitOnClose(true);