correcao de erros no codigo do mapa
This commit is contained in:
@@ -4,6 +4,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_blue_plus/flutter_blue_plus.dart';
|
||||
import 'package:permission_handler/permission_handler.dart';
|
||||
import '../constants/app_colors.dart';
|
||||
import '../constants/app_strings.dart';
|
||||
|
||||
class BluetoothConnectionScreen extends StatefulWidget {
|
||||
const BluetoothConnectionScreen({super.key});
|
||||
@@ -63,7 +64,7 @@ class _BluetoothConnectionScreenState extends State<BluetoothConnectionScreen> {
|
||||
if (mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(
|
||||
content: Text('Permissões de Bluetooth negadas.'),
|
||||
content: Text(AppStrings.permissionDenied),
|
||||
behavior: SnackBarBehavior.floating,
|
||||
),
|
||||
);
|
||||
@@ -80,7 +81,7 @@ class _BluetoothConnectionScreenState extends State<BluetoothConnectionScreen> {
|
||||
if (mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(
|
||||
content: Text('Ligue o Bluetooth para buscar dispositivos.'),
|
||||
content: Text(AppStrings.turnOnBluetooth),
|
||||
behavior: SnackBarBehavior.floating,
|
||||
),
|
||||
);
|
||||
@@ -93,7 +94,7 @@ class _BluetoothConnectionScreenState extends State<BluetoothConnectionScreen> {
|
||||
if (mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text('Erro ao iniciar scan: $e'),
|
||||
content: Text('${AppStrings.scanError}$e'),
|
||||
behavior: SnackBarBehavior.floating,
|
||||
),
|
||||
);
|
||||
@@ -108,7 +109,7 @@ class _BluetoothConnectionScreenState extends State<BluetoothConnectionScreen> {
|
||||
if (mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text('Erro ao parar scan: $e'),
|
||||
content: Text('${AppStrings.stopScanError}$e'),
|
||||
behavior: SnackBarBehavior.floating,
|
||||
),
|
||||
);
|
||||
@@ -120,7 +121,7 @@ class _BluetoothConnectionScreenState extends State<BluetoothConnectionScreen> {
|
||||
try {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text('Conectando a ${device.platformName}...'),
|
||||
content: Text('${AppStrings.connectingTo}${device.platformName.isEmpty ? AppStrings.unknownDevice : device.platformName}...'),
|
||||
duration: const Duration(seconds: 2),
|
||||
behavior: SnackBarBehavior.floating,
|
||||
),
|
||||
@@ -135,7 +136,7 @@ class _BluetoothConnectionScreenState extends State<BluetoothConnectionScreen> {
|
||||
FlutterBluePlus.stopScan();
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(
|
||||
content: Text('Conectado com sucesso!'),
|
||||
content: Text(AppStrings.connectionSuccess),
|
||||
backgroundColor: Colors.green,
|
||||
behavior: SnackBarBehavior.floating,
|
||||
),
|
||||
@@ -145,7 +146,7 @@ class _BluetoothConnectionScreenState extends State<BluetoothConnectionScreen> {
|
||||
if (mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text('Erro ao conectar: $e'),
|
||||
content: Text('${AppStrings.connectionError}$e'),
|
||||
backgroundColor: Colors.red,
|
||||
behavior: SnackBarBehavior.floating,
|
||||
),
|
||||
@@ -169,7 +170,7 @@ class _BluetoothConnectionScreenState extends State<BluetoothConnectionScreen> {
|
||||
backgroundColor: AppColors.background,
|
||||
appBar: AppBar(
|
||||
title: const Text(
|
||||
'DISPOSITIVOS',
|
||||
AppStrings.bluetoothTitle,
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w900,
|
||||
letterSpacing: 2,
|
||||
@@ -214,8 +215,8 @@ class _BluetoothConnectionScreenState extends State<BluetoothConnectionScreen> {
|
||||
children: [
|
||||
Text(
|
||||
_connectedDevice != null
|
||||
? 'STATUS: CONECTADO'
|
||||
: (_isScanning ? 'STATUS: BUSCANDO...' : 'STATUS: PRONTO'),
|
||||
? AppStrings.statusConnected
|
||||
: (_isScanning ? AppStrings.statusSearching : AppStrings.statusReady),
|
||||
style: TextStyle(
|
||||
color: _connectedDevice != null ? Colors.greenAccent : (_isScanning ? AppColors.coral : Colors.white54),
|
||||
fontSize: 10,
|
||||
@@ -226,8 +227,8 @@ class _BluetoothConnectionScreenState extends State<BluetoothConnectionScreen> {
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
_connectedDevice != null
|
||||
? '1 Dispositivo'
|
||||
: '${_scanResults.length} Encontrados',
|
||||
? AppStrings.oneDevice
|
||||
: '${_scanResults.length} ${AppStrings.foundDevices}',
|
||||
style: const TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 22,
|
||||
@@ -289,7 +290,7 @@ class _BluetoothConnectionScreenState extends State<BluetoothConnectionScreen> {
|
||||
physics: const BouncingScrollPhysics(),
|
||||
itemBuilder: (context, index) {
|
||||
final BluetoothDevice device = _connectedDevice ?? _scanResults[index].device;
|
||||
final name = device.platformName;
|
||||
final name = device.platformName.isEmpty ? AppStrings.unknownDevice : device.platformName;
|
||||
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(bottom: 18),
|
||||
|
||||
Reference in New Issue
Block a user