-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ajustando home page e tela de bluetooth
- Loading branch information
Showing
4 changed files
with
119 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,13 @@ | ||
import 'package:flutter/material.dart'; | ||
// import 'package:flutter_blue_plus/flutter_blue_plus.dart'; | ||
// import 'package:zenith_monitor/modules/bluetooth/device_caracteristics_screen.dart'; | ||
import './MainPage.dart'; | ||
import 'BluetoothMainPage.dart'; | ||
|
||
class BluetoothScreen extends StatelessWidget { | ||
@override | ||
Widget build(BuildContext context) { | ||
return MaterialApp( | ||
home: ExampleApplication(), | ||
return Scaffold( | ||
body: BluetoothMainPage(), | ||
); | ||
} | ||
} | ||
|
||
class ExampleApplication extends StatelessWidget { | ||
@override | ||
Widget build(BuildContext context) { | ||
return MaterialApp(home: MainPage()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,116 @@ | ||
import 'package:firebase_auth/firebase_auth.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:zenith_monitor/modules/bluetooth/bluetooth_screen.dart'; | ||
|
||
class HomeScreen extends StatelessWidget { | ||
final User? currentUser; | ||
|
||
const HomeScreen({this.currentUser}); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return MaterialApp( | ||
title: 'Flutter Bluetooth App', | ||
theme: ThemeData( | ||
primarySwatch: Colors.blue, | ||
return Scaffold( | ||
appBar: AppBar( | ||
title: const Text('Zenith Monitor'), | ||
), | ||
drawer: Drawer( | ||
child: ListView( | ||
padding: EdgeInsets.zero, | ||
children: <Widget>[ | ||
DrawerHeader( | ||
decoration: const BoxDecoration( | ||
color: Colors.blue, | ||
), | ||
child: Column( | ||
crossAxisAlignment: CrossAxisAlignment.start, | ||
children: [ | ||
if (currentUser != null) | ||
CircleAvatar( | ||
backgroundImage: | ||
NetworkImage(currentUser!.photoURL ?? ''), | ||
radius: 30, | ||
), | ||
const SizedBox(height: 10), | ||
Text( | ||
currentUser != null | ||
? currentUser!.displayName ?? 'Usuário' | ||
: 'Resgate com Bluetooth', | ||
style: const TextStyle( | ||
color: Colors.white, | ||
fontSize: 24, | ||
), | ||
), | ||
const SizedBox(height: 5), | ||
Text( | ||
currentUser != null ? currentUser!.email ?? '' : '', | ||
style: const TextStyle( | ||
color: Colors.white70, | ||
fontSize: 16, | ||
), | ||
), | ||
], | ||
), | ||
), | ||
ListTile( | ||
leading: const Icon(Icons.home), | ||
title: const Text('Home'), | ||
onTap: () { | ||
Navigator.pop(context); | ||
}, | ||
), | ||
ListTile( | ||
leading: const Icon(Icons.settings), | ||
title: const Text('Configurações'), | ||
onTap: () { | ||
Navigator.pop(context); | ||
}, | ||
), | ||
ListTile( | ||
leading: const Icon(Icons.exit_to_app), | ||
title: const Text('Logout'), | ||
onTap: () { | ||
FirebaseAuth.instance.signOut(); | ||
Navigator.pop(context); | ||
Navigator.pushReplacementNamed(context, '/login'); | ||
}, | ||
), | ||
], | ||
), | ||
), | ||
body: Padding( | ||
padding: const EdgeInsets.all(16), | ||
child: ListView( | ||
children: <Widget>[ | ||
_buildCard(context, Icons.bluetooth, | ||
'Acompanhar resgate com bluetooth', '/bluetooth'), | ||
_buildCard(context, Icons.map, 'Mapa', '/map'), | ||
_buildCard( | ||
context, Icons.settings, 'Configurações', '/configuration'), | ||
_buildCard(context, Icons.terminal, 'Terminal', '/terminal'), | ||
], | ||
), | ||
), | ||
home: BluetoothScreen(), // Defina a tela inicial como BluetoothScreen | ||
); | ||
} | ||
} | ||
} | ||
|
||
Widget _buildCard( | ||
BuildContext context, IconData icon, String label, String route) { | ||
return Card( | ||
shape: RoundedRectangleBorder( | ||
borderRadius: BorderRadius.circular(15), | ||
), | ||
elevation: 4, | ||
margin: const EdgeInsets.symmetric(vertical: 10), | ||
child: ListTile( | ||
contentPadding: const EdgeInsets.all(16), | ||
leading: Icon(icon, size: 50, color: Colors.blue), | ||
title: Text( | ||
label, | ||
style: const TextStyle(fontSize: 20, fontWeight: FontWeight.bold), | ||
), | ||
onTap: () { | ||
Navigator.pushNamed(context, route); | ||
}, | ||
), | ||
); | ||
} |