feat: perfil BD, historial sesiones, UX login y config Android
- Perfil conectado a BD: nombre real, edición con iniciales auto - Historial de sesiones: nueva página con duración y badge activa - Ayuda y soporte navega a MensajeriaPage - InicioPage: nombre real desde BD, click avatar → tab perfil - Login: foco automático, Enter = ingresar, click card = foco - ApplicationId: net.siaxsystem.sentinelone en todos los manifests - Linux: libsqlite3-dev requerido en CMakeLists, error amigable en app - BD ruta Linux corregida a ~/.local/share/sentinel_one/ Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
1184ab5fe2
commit
3e2294faf6
+35
-33
@@ -15,39 +15,39 @@ class MainPage extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _MainPageState extends State<MainPage> {
|
||||
late int _index;
|
||||
// Guardamos también qué ítem del nav está "seleccionado visualmente"
|
||||
// (INICIO y ALARMAS apuntan al mismo índice del stack)
|
||||
late int _navSelected;
|
||||
late final PageController _pageController;
|
||||
int _navSelected = 0;
|
||||
|
||||
static const _pages = [
|
||||
InicioPage(), // 0 – INICIO
|
||||
ControlAccesoPage(), // 1 – ACCESO
|
||||
MonitoreoAlarmaPage(), // 2 – ALARMAS
|
||||
PerfilUsuarioPage(), // 3 – PERFIL
|
||||
List<Widget> get _pages => [
|
||||
InicioPage(onGoToPerfil: () => _onNavTap(3)),
|
||||
const ControlAccesoPage(),
|
||||
const MonitoreoAlarmaPage(),
|
||||
const PerfilUsuarioPage(),
|
||||
];
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_index = 0;
|
||||
_navSelected = widget.initialIndex;
|
||||
_pageController = PageController(initialPage: widget.initialIndex);
|
||||
}
|
||||
|
||||
void _onNavTap(int navIdx) {
|
||||
// navIdx: 0=INICIO 1=ACCESO 2=ALARMAS 3=PERFIL
|
||||
int pageIdx;
|
||||
switch (navIdx) {
|
||||
case 0: pageIdx = 0; break; // INICIO → InicioPage
|
||||
case 1: pageIdx = 1; break; // ACCESO → ControlAccesoPage
|
||||
case 2: pageIdx = 2; break; // ALARMAS → MonitoreoAlarmaPage
|
||||
case 3: pageIdx = 3; break; // PERFIL → PerfilUsuarioPage
|
||||
default: pageIdx = 0;
|
||||
}
|
||||
setState(() {
|
||||
_index = pageIdx;
|
||||
_navSelected = navIdx;
|
||||
});
|
||||
@override
|
||||
void dispose() {
|
||||
_pageController.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
void _onNavTap(int idx) {
|
||||
_pageController.animateToPage(
|
||||
idx,
|
||||
duration: const Duration(milliseconds: 300),
|
||||
curve: Curves.easeInOut,
|
||||
);
|
||||
}
|
||||
|
||||
void _onPageChanged(int idx) {
|
||||
setState(() => _navSelected = idx);
|
||||
}
|
||||
|
||||
String get _tituloActual {
|
||||
@@ -70,7 +70,12 @@ class _MainPageState extends State<MainPage> {
|
||||
children: [
|
||||
_header(),
|
||||
Expanded(
|
||||
child: IndexedStack(index: _index, children: _pages),
|
||||
child: PageView(
|
||||
controller: _pageController,
|
||||
onPageChanged: _onPageChanged,
|
||||
children: _pages,
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -87,9 +92,8 @@ class _MainPageState extends State<MainPage> {
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
// Logo + nombre
|
||||
Row(children: [
|
||||
const Icon(Icons.security, color: AppColors.primary, size: 22),
|
||||
Image.asset('lib/recursos/logo_app.png', width: 30, height: 30),
|
||||
const SizedBox(width: 12),
|
||||
Text('SENTINEL ONE',
|
||||
style: appHeadline(
|
||||
@@ -98,7 +102,6 @@ class _MainPageState extends State<MainPage> {
|
||||
color: AppColors.primary,
|
||||
spacing: 2.5)),
|
||||
]),
|
||||
// Sección activa + botón de configuración
|
||||
Row(children: [
|
||||
Text(_tituloActual,
|
||||
style: appLabel(
|
||||
@@ -130,17 +133,16 @@ class _MainPageState extends State<MainPage> {
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
_navItem(Icons.home_outlined, 'INICIO', 0),
|
||||
_navItem(Icons.lock_open, 'ACCESO', 1),
|
||||
_navItem(Icons.notifications_active, 'ALARMAS', 2),
|
||||
_navItem(Icons.person_outline, 'PERFIL', 3),
|
||||
_navItem(Icons.home_outlined, 'INICIO', 0),
|
||||
_navItem(Icons.lock_open, 'ACCESO', 1),
|
||||
_navItem(Icons.notifications_active, 'ALARMAS', 2),
|
||||
_navItem(Icons.person_outline, 'PERFIL', 3),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
Widget _navItem(IconData icon, String label, int idx) {
|
||||
final isActive = _navSelected == idx;
|
||||
|
||||
return GestureDetector(
|
||||
onTap: () => _onNavTap(idx),
|
||||
child: AnimatedContainer(
|
||||
|
||||
Reference in New Issue
Block a user