diff --git a/lib/main.dart b/lib/main.dart index 8cdef9c..1e40267 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,6 +1,5 @@ import 'package:flutter/material.dart'; -import 'package:lsa_gloves/pages/ble_connection_error_page.dart'; import 'package:lsa_gloves/pages/ble_devices_connection_page.dart'; import 'package:lsa_gloves/pages/file_content_chart_page.dart'; import 'package:lsa_gloves/pages/home_page.dart'; @@ -25,7 +24,6 @@ class MyApp extends StatelessWidget { routes: { FileContentChartPage.routeName: (context) => FileContentChartPage(), BleGloveConnectionPage.routeName: (context) => BleGloveConnectionPage(), - BleConnectionErrorPage.routeName: (context) => BleConnectionErrorPage(), }, title: 'Lengua de señas Argentina', theme: ThemeData( diff --git a/lib/pages/ble_connection_error_page.dart b/lib/pages/ble_connection_error_page.dart deleted file mode 100644 index 24e93ac..0000000 --- a/lib/pages/ble_connection_error_page.dart +++ /dev/null @@ -1,73 +0,0 @@ -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; - -import 'ble_devices_connection_page.dart'; - -class BleConnectionErrorPage extends StatelessWidget { - static const routeName = '/bleConnectionError'; - @override - Widget build(BuildContext context) { - Size size = MediaQuery.of(context).size; - return Scaffold( - appBar: AppBar( - title: Text('Error!'), - ), - body: Container( - height: double.maxFinite, - child: new Stack( - //alignment:new Alignment(x, y) - children: [ - new Positioned( - child: Center( - child: Wrap( - direction: Axis.vertical, - alignment: WrapAlignment.center, - crossAxisAlignment: WrapCrossAlignment.center, - spacing: size.height * 0.03, - children: [ - Icon(Icons.error, - size: 100, color: Theme.of(context).errorColor), - Text("Se perdió la conexión bluetooth!", - style: TextStyle( - fontSize: Theme.of(context) - .textTheme - .subtitle1! - .fontSize, - color: Theme.of(context).errorColor)), - ]), - ), - ), - new Positioned( - child: new Align( - alignment: FractionalOffset.bottomCenter, - child: Container( - height: 50.0, - margin: EdgeInsets.all(10), - child: ElevatedButton( - onPressed: () => Navigator.pushNamedAndRemoveUntil( - context, BleGloveConnectionPage.routeName, (_) => false), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text( - 'Volver a conectar', - style: TextStyle( - color: Theme.of(context).secondaryHeaderColor, - ), - ), - Icon( - Icons.arrow_right, - size: Theme.of(context).buttonTheme.height , - color: Theme.of(context).secondaryHeaderColor, - ) - ]), - style: ElevatedButton.styleFrom( - shape: StadiumBorder(), - minimumSize: Size(double.infinity, 30)), - ))), - ) - ], - ), - )); - } -} diff --git a/lib/pages/ble_data_collection_page.dart b/lib/pages/ble_data_collection_page.dart index 3855e94..29c6d2c 100644 --- a/lib/pages/ble_data_collection_page.dart +++ b/lib/pages/ble_data_collection_page.dart @@ -1,14 +1,11 @@ import 'dart:async'; import 'package:animated_text_kit/animated_text_kit.dart'; -import 'package:flutter/cupertino.dart'; -import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:lsa_gloves/connection/ble/bluetooth_backend.dart'; import 'package:lsa_gloves/datacollection/measurements_collector.dart'; import 'package:lsa_gloves/datacollection/measurements_listener.dart'; import 'package:lsa_gloves/model/glove_measurement.dart'; -import 'package:lsa_gloves/pages/ble_connection_error_page.dart'; import 'package:provider/provider.dart'; import 'package:simple_timer/simple_timer.dart'; import 'dart:developer' as developer; @@ -160,17 +157,10 @@ class _BleDataCollectionState extends State void _startRecording(BluetoothBackend bluetoothBackend) { developer.log('startRecording'); - if (bluetoothBackend.connectedDevices.isEmpty) { - developer.log('Cant start recording! No devices connected.'); - Navigator.of(context).push(MaterialPageRoute( - builder: (context) => BleConnectionErrorPage(), - maintainState: false)); - } else { bluetoothBackend.sendStartDataCollectionCommand(); _measurementsCollector.startCollecting( this.selectedGesture, bluetoothBackend.dataCollectionCharacteristics); _isRecording = true; - } } void _stopRecording(BluetoothBackend bluetoothBackend) async {