primera pagina empresa y negocios alfa
This commit is contained in:
@@ -3,7 +3,10 @@ import 'package:provider/provider.dart';
|
|||||||
import 'package:nethive_neo/providers/nethive/empresas_negocios_provider.dart';
|
import 'package:nethive_neo/providers/nethive/empresas_negocios_provider.dart';
|
||||||
import 'package:nethive_neo/pages/empresa_negocios/widgets/empresa_selector_sidebar.dart';
|
import 'package:nethive_neo/pages/empresa_negocios/widgets/empresa_selector_sidebar.dart';
|
||||||
import 'package:nethive_neo/pages/empresa_negocios/widgets/negocios_table.dart';
|
import 'package:nethive_neo/pages/empresa_negocios/widgets/negocios_table.dart';
|
||||||
|
import 'package:nethive_neo/pages/empresa_negocios/widgets/negocios_cards_view.dart';
|
||||||
|
import 'package:nethive_neo/pages/empresa_negocios/widgets/mobile_empresa_selector.dart';
|
||||||
import 'package:nethive_neo/theme/theme.dart';
|
import 'package:nethive_neo/theme/theme.dart';
|
||||||
|
import 'package:nethive_neo/helpers/globals.dart';
|
||||||
|
|
||||||
class EmpresaNegociosPage extends StatefulWidget {
|
class EmpresaNegociosPage extends StatefulWidget {
|
||||||
const EmpresaNegociosPage({Key? key}) : super(key: key);
|
const EmpresaNegociosPage({Key? key}) : super(key: key);
|
||||||
@@ -12,135 +15,380 @@ class EmpresaNegociosPage extends StatefulWidget {
|
|||||||
State<EmpresaNegociosPage> createState() => _EmpresaNegociosPageState();
|
State<EmpresaNegociosPage> createState() => _EmpresaNegociosPageState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _EmpresaNegociosPageState extends State<EmpresaNegociosPage> {
|
class _EmpresaNegociosPageState extends State<EmpresaNegociosPage>
|
||||||
|
with TickerProviderStateMixin {
|
||||||
bool showMapView = false;
|
bool showMapView = false;
|
||||||
|
late AnimationController _animationController;
|
||||||
|
late Animation<double> _fadeAnimation;
|
||||||
|
late Animation<Offset> _slideAnimation;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
_animationController = AnimationController(
|
||||||
|
duration: const Duration(milliseconds: 800),
|
||||||
|
vsync: this,
|
||||||
|
);
|
||||||
|
_fadeAnimation = Tween<double>(
|
||||||
|
begin: 0.0,
|
||||||
|
end: 1.0,
|
||||||
|
).animate(CurvedAnimation(
|
||||||
|
parent: _animationController,
|
||||||
|
curve: Curves.easeInOut,
|
||||||
|
));
|
||||||
|
_slideAnimation = Tween<Offset>(
|
||||||
|
begin: const Offset(0, 0.3),
|
||||||
|
end: Offset.zero,
|
||||||
|
).animate(CurvedAnimation(
|
||||||
|
parent: _animationController,
|
||||||
|
curve: Curves.easeOutCubic,
|
||||||
|
));
|
||||||
|
_animationController.forward();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
_animationController.dispose();
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
final isLargeScreen = MediaQuery.of(context).size.width > 1200;
|
||||||
|
final isMediumScreen = MediaQuery.of(context).size.width > 800;
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
backgroundColor: AppTheme.of(context).primaryBackground,
|
backgroundColor: AppTheme.of(context).primaryBackground,
|
||||||
body: Consumer<EmpresasNegociosProvider>(
|
body: Container(
|
||||||
builder: (context, provider, child) {
|
decoration: BoxDecoration(
|
||||||
return Row(
|
gradient: AppTheme.of(context).darkBackgroundGradient,
|
||||||
children: [
|
),
|
||||||
// Sidebar izquierdo con empresas
|
child: Consumer<EmpresasNegociosProvider>(
|
||||||
SizedBox(
|
builder: (context, provider, child) {
|
||||||
width: 300,
|
if (isLargeScreen) {
|
||||||
child: EmpresaSelectorSidebar(
|
// Vista de escritorio
|
||||||
provider: provider,
|
return Row(
|
||||||
onEmpresaSelected: (empresaId) {
|
children: [
|
||||||
provider.setEmpresaSeleccionada(empresaId);
|
// Sidebar izquierdo con empresas
|
||||||
},
|
SlideTransition(
|
||||||
),
|
position: Tween<Offset>(
|
||||||
),
|
begin: const Offset(-1, 0),
|
||||||
|
end: Offset.zero,
|
||||||
// Área principal
|
).animate(CurvedAnimation(
|
||||||
Expanded(
|
parent: _animationController,
|
||||||
child: Container(
|
curve: Curves.easeOutCubic,
|
||||||
padding: const EdgeInsets.all(16),
|
)),
|
||||||
child: Column(
|
child: SizedBox(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
width: 320,
|
||||||
children: [
|
child: EmpresaSelectorSidebar(
|
||||||
// Header con título y switch
|
provider: provider,
|
||||||
_buildHeader(provider),
|
onEmpresaSelected: (empresaId) {
|
||||||
|
provider.setEmpresaSeleccionada(empresaId);
|
||||||
const SizedBox(height: 16),
|
},
|
||||||
|
|
||||||
// Contenido principal (tabla o mapa)
|
|
||||||
Expanded(
|
|
||||||
child: showMapView
|
|
||||||
? _buildMapView()
|
|
||||||
: _buildTableView(provider),
|
|
||||||
),
|
),
|
||||||
],
|
),
|
||||||
),
|
),
|
||||||
),
|
|
||||||
),
|
// Área principal
|
||||||
],
|
Expanded(
|
||||||
);
|
child: SlideTransition(
|
||||||
},
|
position: _slideAnimation,
|
||||||
|
child: FadeTransition(
|
||||||
|
opacity: _fadeAnimation,
|
||||||
|
child: Container(
|
||||||
|
padding: const EdgeInsets.all(24),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
// Header con título y switch
|
||||||
|
_buildEnhancedHeader(provider),
|
||||||
|
|
||||||
|
const SizedBox(height: 24),
|
||||||
|
|
||||||
|
// Contenido principal (tabla o mapa)
|
||||||
|
Expanded(
|
||||||
|
child: showMapView
|
||||||
|
? _buildMapView()
|
||||||
|
: _buildTableView(provider),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
// Vista móvil/tablet
|
||||||
|
return Column(
|
||||||
|
children: [
|
||||||
|
// Header móvil
|
||||||
|
_buildMobileHeader(provider),
|
||||||
|
|
||||||
|
// Contenido principal
|
||||||
|
Expanded(
|
||||||
|
child: showMapView
|
||||||
|
? _buildMapView()
|
||||||
|
: NegociosCardsView(provider: provider),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
),
|
||||||
),
|
),
|
||||||
|
// FAB para vista móvil
|
||||||
|
floatingActionButton: MediaQuery.of(context).size.width <= 800
|
||||||
|
? _buildMobileFAB(context)
|
||||||
|
: null,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildHeader(EmpresasNegociosProvider provider) {
|
Widget _buildEnhancedHeader(EmpresasNegociosProvider provider) {
|
||||||
return Container(
|
return Container(
|
||||||
padding: const EdgeInsets.all(16),
|
padding: const EdgeInsets.all(24),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: AppTheme.of(context).secondaryBackground,
|
gradient: AppTheme.of(context).primaryGradient,
|
||||||
borderRadius: BorderRadius.circular(12),
|
borderRadius: BorderRadius.circular(20),
|
||||||
boxShadow: [
|
boxShadow: [
|
||||||
|
BoxShadow(
|
||||||
|
color: AppTheme.of(context).primaryColor.withOpacity(0.3),
|
||||||
|
blurRadius: 20,
|
||||||
|
offset: const Offset(0, 8),
|
||||||
|
),
|
||||||
BoxShadow(
|
BoxShadow(
|
||||||
color: Colors.black.withOpacity(0.1),
|
color: Colors.black.withOpacity(0.1),
|
||||||
blurRadius: 4,
|
blurRadius: 10,
|
||||||
offset: const Offset(0, 2),
|
offset: const Offset(0, 4),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
|
// Icono animado
|
||||||
|
TweenAnimationBuilder<double>(
|
||||||
|
duration: const Duration(milliseconds: 1000),
|
||||||
|
tween: Tween(begin: 0.0, end: 1.0),
|
||||||
|
builder: (context, value, child) {
|
||||||
|
return Transform.rotate(
|
||||||
|
angle: value * 0.1,
|
||||||
|
child: Container(
|
||||||
|
padding: const EdgeInsets.all(16),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Colors.white.withOpacity(0.2),
|
||||||
|
borderRadius: BorderRadius.circular(16),
|
||||||
|
border: Border.all(
|
||||||
|
color: Colors.white.withOpacity(0.3),
|
||||||
|
width: 2,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
child: Icon(
|
||||||
|
Icons.business_center,
|
||||||
|
color: Colors.white,
|
||||||
|
size: 32,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
|
||||||
|
const SizedBox(width: 20),
|
||||||
|
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
// Título principal con gradiente
|
||||||
provider.empresaSeleccionada != null
|
ShaderMask(
|
||||||
? 'Sucursales de ${provider.empresaSeleccionada!.nombre}'
|
shaderCallback: (bounds) => LinearGradient(
|
||||||
: 'Selecciona una empresa para ver sus sucursales',
|
colors: [Colors.white, Colors.white.withOpacity(0.8)],
|
||||||
style: TextStyle(
|
).createShader(bounds),
|
||||||
color: AppTheme.of(context).primaryText,
|
child: Text(
|
||||||
fontSize: 24,
|
provider.empresaSeleccionada != null
|
||||||
fontWeight: FontWeight.bold,
|
? 'Sucursales de ${provider.empresaSeleccionada!.nombre}'
|
||||||
|
: 'Gestión de Empresas y Sucursales',
|
||||||
|
style: const TextStyle(
|
||||||
|
color: Colors.white,
|
||||||
|
fontSize: 28,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
letterSpacing: 0.5,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 8),
|
const SizedBox(height: 12),
|
||||||
if (provider.empresaSeleccionada != null)
|
if (provider.empresaSeleccionada != null) ...[
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
Container(
|
// Badge animado
|
||||||
padding: const EdgeInsets.symmetric(
|
TweenAnimationBuilder<double>(
|
||||||
horizontal: 12,
|
duration: const Duration(milliseconds: 600),
|
||||||
vertical: 6,
|
tween: Tween(begin: 0.0, end: 1.0),
|
||||||
),
|
builder: (context, value, child) {
|
||||||
decoration: BoxDecoration(
|
return Transform.scale(
|
||||||
color: AppTheme.of(context).primaryColor,
|
scale: value,
|
||||||
borderRadius: BorderRadius.circular(20),
|
child: Container(
|
||||||
),
|
padding: const EdgeInsets.symmetric(
|
||||||
child: Text(
|
horizontal: 16,
|
||||||
'${provider.negocios.length} sucursales',
|
vertical: 8,
|
||||||
style: const TextStyle(
|
),
|
||||||
color: Colors.white,
|
decoration: BoxDecoration(
|
||||||
fontSize: 14,
|
color: Colors.white.withOpacity(0.9),
|
||||||
fontWeight: FontWeight.w600,
|
borderRadius: BorderRadius.circular(25),
|
||||||
),
|
boxShadow: [
|
||||||
),
|
BoxShadow(
|
||||||
|
color: Colors.black.withOpacity(0.1),
|
||||||
|
blurRadius: 8,
|
||||||
|
offset: const Offset(0, 2),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
child: Row(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
Icon(
|
||||||
|
Icons.store,
|
||||||
|
color: AppTheme.of(context).primaryColor,
|
||||||
|
size: 18,
|
||||||
|
),
|
||||||
|
const SizedBox(width: 8),
|
||||||
|
Text(
|
||||||
|
'${provider.negocios.length} sucursales',
|
||||||
|
style: TextStyle(
|
||||||
|
color: AppTheme.of(context).primaryColor,
|
||||||
|
fontSize: 14,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
),
|
),
|
||||||
const SizedBox(width: 12),
|
const SizedBox(width: 16),
|
||||||
Text(
|
Expanded(
|
||||||
provider.empresaSeleccionada!.nombre,
|
child: Text(
|
||||||
style: TextStyle(
|
provider.empresaSeleccionada!.rfc,
|
||||||
color: AppTheme.of(context).secondaryText,
|
style: TextStyle(
|
||||||
fontSize: 16,
|
color: Colors.white.withOpacity(0.9),
|
||||||
|
fontSize: 16,
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
],
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
||||||
// Switch para cambiar vista
|
// Switch mejorado para cambiar vista
|
||||||
Column(
|
Container(
|
||||||
|
padding: const EdgeInsets.all(16),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Colors.white.withOpacity(0.1),
|
||||||
|
borderRadius: BorderRadius.circular(16),
|
||||||
|
border: Border.all(
|
||||||
|
color: Colors.white.withOpacity(0.2),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
Row(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
Icon(
|
||||||
|
Icons.table_chart,
|
||||||
|
color: Colors.white,
|
||||||
|
size: 20,
|
||||||
|
),
|
||||||
|
const SizedBox(width: 8),
|
||||||
|
Text(
|
||||||
|
'Vista',
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.white,
|
||||||
|
fontSize: 14,
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 8),
|
||||||
|
Icon(
|
||||||
|
Icons.map,
|
||||||
|
color: Colors.white,
|
||||||
|
size: 20,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
const SizedBox(height: 12),
|
||||||
|
Switch(
|
||||||
|
value: showMapView,
|
||||||
|
onChanged: (value) {
|
||||||
|
setState(() {
|
||||||
|
showMapView = value;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
activeColor: Colors.white,
|
||||||
|
activeTrackColor: Colors.white.withOpacity(0.3),
|
||||||
|
inactiveThumbColor: Colors.white.withOpacity(0.7),
|
||||||
|
inactiveTrackColor: Colors.white.withOpacity(0.1),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildMobileHeader(EmpresasNegociosProvider provider) {
|
||||||
|
return Container(
|
||||||
|
padding: const EdgeInsets.fromLTRB(20, 40, 20, 20),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
gradient: AppTheme.of(context).primaryGradient,
|
||||||
|
borderRadius: const BorderRadius.only(
|
||||||
|
bottomLeft: Radius.circular(30),
|
||||||
|
bottomRight: Radius.circular(30),
|
||||||
|
),
|
||||||
|
boxShadow: [
|
||||||
|
BoxShadow(
|
||||||
|
color: AppTheme.of(context).primaryColor.withOpacity(0.3),
|
||||||
|
blurRadius: 15,
|
||||||
|
offset: const Offset(0, 5),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Row(
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Container(
|
||||||
'Vista de Mapa',
|
padding: const EdgeInsets.all(12),
|
||||||
style: TextStyle(
|
decoration: BoxDecoration(
|
||||||
color: AppTheme.of(context).primaryText,
|
color: Colors.white.withOpacity(0.2),
|
||||||
fontSize: 14,
|
borderRadius: BorderRadius.circular(12),
|
||||||
fontWeight: FontWeight.w500,
|
),
|
||||||
|
child: Icon(
|
||||||
|
Icons.business,
|
||||||
|
color: Colors.white,
|
||||||
|
size: 24,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 8),
|
const SizedBox(width: 16),
|
||||||
|
Expanded(
|
||||||
|
child: Text(
|
||||||
|
'NETHIVE',
|
||||||
|
style: const TextStyle(
|
||||||
|
color: Colors.white,
|
||||||
|
fontSize: 24,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
letterSpacing: 1.2,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
// Switch para modo vista
|
||||||
Switch(
|
Switch(
|
||||||
value: showMapView,
|
value: showMapView,
|
||||||
onChanged: (value) {
|
onChanged: (value) {
|
||||||
@@ -148,10 +396,37 @@ class _EmpresaNegociosPageState extends State<EmpresaNegociosPage> {
|
|||||||
showMapView = value;
|
showMapView = value;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
activeColor: AppTheme.of(context).primaryColor,
|
activeColor: Colors.white,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
if (provider.empresaSeleccionada != null) ...[
|
||||||
|
const SizedBox(height: 16),
|
||||||
|
Text(
|
||||||
|
provider.empresaSeleccionada!.nombre,
|
||||||
|
style: const TextStyle(
|
||||||
|
color: Colors.white,
|
||||||
|
fontSize: 20,
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 8),
|
||||||
|
Container(
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 6),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Colors.white.withOpacity(0.2),
|
||||||
|
borderRadius: BorderRadius.circular(20),
|
||||||
|
),
|
||||||
|
child: Text(
|
||||||
|
'${provider.negocios.length} sucursales',
|
||||||
|
style: const TextStyle(
|
||||||
|
color: Colors.white,
|
||||||
|
fontSize: 14,
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@@ -159,74 +434,89 @@ class _EmpresaNegociosPageState extends State<EmpresaNegociosPage> {
|
|||||||
|
|
||||||
Widget _buildTableView(EmpresasNegociosProvider provider) {
|
Widget _buildTableView(EmpresasNegociosProvider provider) {
|
||||||
if (provider.empresaSeleccionada == null) {
|
if (provider.empresaSeleccionada == null) {
|
||||||
return Center(
|
return _buildEmptyState();
|
||||||
child: Column(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
children: [
|
|
||||||
Icon(
|
|
||||||
Icons.business,
|
|
||||||
size: 80,
|
|
||||||
color: AppTheme.of(context).secondaryText,
|
|
||||||
),
|
|
||||||
const SizedBox(height: 16),
|
|
||||||
Text(
|
|
||||||
'Selecciona una empresa para ver sus sucursales',
|
|
||||||
style: TextStyle(
|
|
||||||
color: AppTheme.of(context).secondaryText,
|
|
||||||
fontSize: 18,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return Container(
|
return Container(
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: AppTheme.of(context).secondaryBackground,
|
color: AppTheme.of(context).secondaryBackground,
|
||||||
borderRadius: BorderRadius.circular(12),
|
borderRadius: BorderRadius.circular(20),
|
||||||
|
border: Border.all(
|
||||||
|
color: AppTheme.of(context).primaryColor.withOpacity(0.2),
|
||||||
|
width: 1,
|
||||||
|
),
|
||||||
boxShadow: [
|
boxShadow: [
|
||||||
BoxShadow(
|
BoxShadow(
|
||||||
color: Colors.black.withOpacity(0.1),
|
color: Colors.black.withOpacity(0.1),
|
||||||
blurRadius: 4,
|
blurRadius: 15,
|
||||||
offset: const Offset(0, 2),
|
offset: const Offset(0, 5),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
// Header de la tabla
|
// Header de la tabla mejorado
|
||||||
Container(
|
Container(
|
||||||
padding: const EdgeInsets.all(16),
|
padding: const EdgeInsets.all(20),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: AppTheme.of(context).primaryColor,
|
gradient: AppTheme.of(context).modernGradient,
|
||||||
borderRadius: const BorderRadius.only(
|
borderRadius: const BorderRadius.only(
|
||||||
topLeft: Radius.circular(12),
|
topLeft: Radius.circular(20),
|
||||||
topRight: Radius.circular(12),
|
topRight: Radius.circular(20),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
Icon(
|
Container(
|
||||||
Icons.store,
|
padding: const EdgeInsets.all(8),
|
||||||
color: Colors.white,
|
decoration: BoxDecoration(
|
||||||
size: 24,
|
color: Colors.white.withOpacity(0.2),
|
||||||
),
|
borderRadius: BorderRadius.circular(8),
|
||||||
const SizedBox(width: 12),
|
),
|
||||||
Text(
|
child: Icon(
|
||||||
'Sucursales',
|
Icons.store,
|
||||||
style: const TextStyle(
|
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
fontSize: 18,
|
size: 20,
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const Spacer(),
|
const SizedBox(width: 16),
|
||||||
Text(
|
Expanded(
|
||||||
'Mostrando 1 a ${provider.negocios.length} de ${provider.negocios.length} sucursales',
|
child: Column(
|
||||||
style: const TextStyle(
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
color: Colors.white70,
|
children: [
|
||||||
fontSize: 14,
|
Text(
|
||||||
|
'Sucursales',
|
||||||
|
style: const TextStyle(
|
||||||
|
color: Colors.white,
|
||||||
|
fontSize: 20,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
letterSpacing: 0.5,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
'Gestión y control de ubicaciones',
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.white.withOpacity(0.8),
|
||||||
|
fontSize: 14,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
padding:
|
||||||
|
const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Colors.white.withOpacity(0.2),
|
||||||
|
borderRadius: BorderRadius.circular(20),
|
||||||
|
),
|
||||||
|
child: Text(
|
||||||
|
'${provider.negocios.length} registros',
|
||||||
|
style: const TextStyle(
|
||||||
|
color: Colors.white,
|
||||||
|
fontSize: 14,
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@@ -242,44 +532,185 @@ class _EmpresaNegociosPageState extends State<EmpresaNegociosPage> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Widget _buildEmptyState() {
|
||||||
|
return Center(
|
||||||
|
child: TweenAnimationBuilder<double>(
|
||||||
|
duration: const Duration(milliseconds: 1000),
|
||||||
|
tween: Tween(begin: 0.0, end: 1.0),
|
||||||
|
builder: (context, value, child) {
|
||||||
|
return Transform.scale(
|
||||||
|
scale: value,
|
||||||
|
child: Container(
|
||||||
|
padding: const EdgeInsets.all(40),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
gradient: AppTheme.of(context).primaryGradient,
|
||||||
|
borderRadius: BorderRadius.circular(20),
|
||||||
|
boxShadow: [
|
||||||
|
BoxShadow(
|
||||||
|
color: AppTheme.of(context).primaryColor.withOpacity(0.3),
|
||||||
|
blurRadius: 20,
|
||||||
|
offset: const Offset(0, 10),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
child: Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
Icon(
|
||||||
|
Icons.business_center,
|
||||||
|
size: 80,
|
||||||
|
color: Colors.white,
|
||||||
|
),
|
||||||
|
const SizedBox(height: 20),
|
||||||
|
Text(
|
||||||
|
'Selecciona una empresa',
|
||||||
|
style: const TextStyle(
|
||||||
|
color: Colors.white,
|
||||||
|
fontSize: 24,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 12),
|
||||||
|
Text(
|
||||||
|
'Elige una empresa del panel lateral\npara ver y gestionar sus sucursales',
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.white.withOpacity(0.9),
|
||||||
|
fontSize: 16,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
Widget _buildMapView() {
|
Widget _buildMapView() {
|
||||||
return Container(
|
return Container(
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: Colors.blue.withOpacity(0.3),
|
gradient: LinearGradient(
|
||||||
borderRadius: BorderRadius.circular(12),
|
begin: Alignment.topLeft,
|
||||||
|
end: Alignment.bottomRight,
|
||||||
|
colors: [
|
||||||
|
Colors.blue.withOpacity(0.1),
|
||||||
|
Colors.blue.withOpacity(0.3),
|
||||||
|
AppTheme.of(context).primaryColor.withOpacity(0.2),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
borderRadius: BorderRadius.circular(20),
|
||||||
border: Border.all(
|
border: Border.all(
|
||||||
color: Colors.blue,
|
color: AppTheme.of(context).primaryColor,
|
||||||
width: 2,
|
width: 2,
|
||||||
),
|
),
|
||||||
|
boxShadow: [
|
||||||
|
BoxShadow(
|
||||||
|
color: AppTheme.of(context).primaryColor.withOpacity(0.2),
|
||||||
|
blurRadius: 20,
|
||||||
|
offset: const Offset(0, 10),
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
child: Center(
|
child: Center(
|
||||||
child: Column(
|
child: TweenAnimationBuilder<double>(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
duration: const Duration(milliseconds: 1500),
|
||||||
children: [
|
tween: Tween(begin: 0.0, end: 1.0),
|
||||||
Icon(
|
builder: (context, value, child) {
|
||||||
Icons.map,
|
return Transform.scale(
|
||||||
size: 80,
|
scale: 0.8 + (0.2 * value),
|
||||||
color: Colors.blue[700],
|
child: Column(
|
||||||
),
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
const SizedBox(height: 16),
|
children: [
|
||||||
Text(
|
Container(
|
||||||
'Vista de Mapa',
|
padding: const EdgeInsets.all(20),
|
||||||
style: TextStyle(
|
decoration: BoxDecoration(
|
||||||
color: Colors.blue[700],
|
gradient: AppTheme.of(context).modernGradient,
|
||||||
fontSize: 24,
|
borderRadius: BorderRadius.circular(20),
|
||||||
fontWeight: FontWeight.bold,
|
),
|
||||||
|
child: Icon(
|
||||||
|
Icons.map,
|
||||||
|
size: 80,
|
||||||
|
color: Colors.white,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 24),
|
||||||
|
Text(
|
||||||
|
'Vista de Mapa',
|
||||||
|
style: TextStyle(
|
||||||
|
color: AppTheme.of(context).primaryColor,
|
||||||
|
fontSize: 28,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
letterSpacing: 1,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 12),
|
||||||
|
Container(
|
||||||
|
padding: const EdgeInsets.all(16),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Colors.white.withOpacity(0.9),
|
||||||
|
borderRadius: BorderRadius.circular(15),
|
||||||
|
),
|
||||||
|
child: Text(
|
||||||
|
'Próximamente se implementará el mapa interactivo\ncon las ubicaciones de todas las sucursales',
|
||||||
|
style: TextStyle(
|
||||||
|
color: AppTheme.of(context).primaryColor,
|
||||||
|
fontSize: 16,
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
),
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildMobileFAB(BuildContext context) {
|
||||||
|
return Consumer<EmpresasNegociosProvider>(
|
||||||
|
builder: (context, provider, child) {
|
||||||
|
return FloatingActionButton.extended(
|
||||||
|
onPressed: () {
|
||||||
|
_showMobileEmpresaSelector(context, provider);
|
||||||
|
},
|
||||||
|
backgroundColor: AppTheme.of(context).primaryColor,
|
||||||
|
icon: const Icon(Icons.business, color: Colors.white),
|
||||||
|
label: Text(
|
||||||
|
provider.empresaSeleccionada != null
|
||||||
|
? provider.empresaSeleccionada!.nombre.length > 15
|
||||||
|
? '${provider.empresaSeleccionada!.nombre.substring(0, 15)}...'
|
||||||
|
: provider.empresaSeleccionada!.nombre
|
||||||
|
: 'Empresas',
|
||||||
|
style: const TextStyle(
|
||||||
|
color: Colors.white,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
),
|
),
|
||||||
const SizedBox(height: 8),
|
),
|
||||||
Text(
|
);
|
||||||
'Próximamente se implementará el mapa con las ubicaciones de las sucursales',
|
},
|
||||||
style: TextStyle(
|
);
|
||||||
color: Colors.blue[600],
|
}
|
||||||
fontSize: 16,
|
|
||||||
),
|
void _showMobileEmpresaSelector(
|
||||||
textAlign: TextAlign.center,
|
BuildContext context, EmpresasNegociosProvider provider) {
|
||||||
),
|
showModalBottomSheet(
|
||||||
],
|
context: context,
|
||||||
|
isScrollControlled: true,
|
||||||
|
backgroundColor: Colors.transparent,
|
||||||
|
builder: (context) => DraggableScrollableSheet(
|
||||||
|
initialChildSize: 0.7,
|
||||||
|
maxChildSize: 0.95,
|
||||||
|
minChildSize: 0.3,
|
||||||
|
builder: (context, scrollController) => MobileEmpresaSelector(
|
||||||
|
provider: provider,
|
||||||
|
onEmpresaSelected: (empresaId) {
|
||||||
|
provider.setEmpresaSeleccionada(empresaId);
|
||||||
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,11 +1,11 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:nethive_neo/helpers/globals.dart';
|
|
||||||
import 'package:nethive_neo/providers/nethive/empresas_negocios_provider.dart';
|
import 'package:nethive_neo/providers/nethive/empresas_negocios_provider.dart';
|
||||||
import 'package:nethive_neo/pages/empresa_negocios/widgets/add_empresa_dialog.dart';
|
import 'package:nethive_neo/pages/empresa_negocios/widgets/add_empresa_dialog.dart';
|
||||||
import 'package:nethive_neo/pages/empresa_negocios/widgets/add_negocio_dialog.dart';
|
import 'package:nethive_neo/pages/empresa_negocios/widgets/add_negocio_dialog.dart';
|
||||||
import 'package:nethive_neo/theme/theme.dart';
|
import 'package:nethive_neo/theme/theme.dart';
|
||||||
|
import 'package:nethive_neo/helpers/globals.dart';
|
||||||
|
|
||||||
class EmpresaSelectorSidebar extends StatelessWidget {
|
class EmpresaSelectorSidebar extends StatefulWidget {
|
||||||
final EmpresasNegociosProvider provider;
|
final EmpresasNegociosProvider provider;
|
||||||
final Function(String) onEmpresaSelected;
|
final Function(String) onEmpresaSelected;
|
||||||
|
|
||||||
@@ -15,219 +15,363 @@ class EmpresaSelectorSidebar extends StatelessWidget {
|
|||||||
required this.onEmpresaSelected,
|
required this.onEmpresaSelected,
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<EmpresaSelectorSidebar> createState() => _EmpresaSelectorSidebarState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _EmpresaSelectorSidebarState extends State<EmpresaSelectorSidebar>
|
||||||
|
with TickerProviderStateMixin {
|
||||||
|
late AnimationController _pulseController;
|
||||||
|
late Animation<double> _pulseAnimation;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
_pulseController = AnimationController(
|
||||||
|
duration: const Duration(seconds: 2),
|
||||||
|
vsync: this,
|
||||||
|
)..repeat(reverse: true);
|
||||||
|
_pulseAnimation = Tween<double>(
|
||||||
|
begin: 0.8,
|
||||||
|
end: 1.0,
|
||||||
|
).animate(CurvedAnimation(
|
||||||
|
parent: _pulseController,
|
||||||
|
curve: Curves.easeInOut,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
_pulseController.dispose();
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Container(
|
return Container(
|
||||||
color: AppTheme.of(context).secondaryBackground,
|
decoration: BoxDecoration(
|
||||||
|
gradient: LinearGradient(
|
||||||
|
begin: Alignment.topCenter,
|
||||||
|
end: Alignment.bottomCenter,
|
||||||
|
colors: [
|
||||||
|
AppTheme.of(context).secondaryBackground,
|
||||||
|
AppTheme.of(context).primaryBackground,
|
||||||
|
],
|
||||||
|
),
|
||||||
|
border: Border(
|
||||||
|
right: BorderSide(
|
||||||
|
color: AppTheme.of(context).primaryColor.withOpacity(0.2),
|
||||||
|
width: 1,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
boxShadow: [
|
||||||
|
BoxShadow(
|
||||||
|
color: Colors.black.withOpacity(0.1),
|
||||||
|
blurRadius: 10,
|
||||||
|
offset: const Offset(2, 0),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
// Header
|
// Header mejorado con gradiente
|
||||||
Container(
|
Container(
|
||||||
padding: const EdgeInsets.all(16),
|
padding: const EdgeInsets.all(20),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: AppTheme.of(context).primaryColor,
|
gradient: AppTheme.of(context).primaryGradient,
|
||||||
boxShadow: [
|
boxShadow: [
|
||||||
BoxShadow(
|
BoxShadow(
|
||||||
color: Colors.black.withOpacity(0.1),
|
color: AppTheme.of(context).primaryColor.withOpacity(0.3),
|
||||||
blurRadius: 4,
|
blurRadius: 15,
|
||||||
offset: const Offset(0, 2),
|
offset: const Offset(0, 5),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Row(
|
||||||
'Seleccionar Empresa',
|
children: [
|
||||||
style: TextStyle(
|
// Logo animado
|
||||||
color: Colors.white,
|
AnimatedBuilder(
|
||||||
fontSize: 18,
|
animation: _pulseAnimation,
|
||||||
fontWeight: FontWeight.bold,
|
builder: (context, child) {
|
||||||
),
|
return Transform.scale(
|
||||||
|
scale: _pulseAnimation.value,
|
||||||
|
child: Container(
|
||||||
|
padding: const EdgeInsets.all(12),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Colors.white.withOpacity(0.2),
|
||||||
|
borderRadius: BorderRadius.circular(12),
|
||||||
|
border: Border.all(
|
||||||
|
color: Colors.white.withOpacity(0.4),
|
||||||
|
width: 2,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
child: Icon(
|
||||||
|
Icons.business_center,
|
||||||
|
color: Colors.white,
|
||||||
|
size: 24,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
const SizedBox(width: 16),
|
||||||
|
Expanded(
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
ShaderMask(
|
||||||
|
shaderCallback: (bounds) => LinearGradient(
|
||||||
|
colors: [
|
||||||
|
Colors.white,
|
||||||
|
Colors.white.withOpacity(0.8)
|
||||||
|
],
|
||||||
|
).createShader(bounds),
|
||||||
|
child: Text(
|
||||||
|
'NETHIVE',
|
||||||
|
style: const TextStyle(
|
||||||
|
color: Colors.white,
|
||||||
|
fontSize: 20,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
letterSpacing: 1.5,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
'Empresas',
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.white.withOpacity(0.8),
|
||||||
|
fontSize: 14,
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
const SizedBox(height: 8),
|
const SizedBox(height: 16),
|
||||||
Text(
|
|
||||||
'Haz una empresas para ver sus sucursales',
|
// Contador de empresas con efecto
|
||||||
style: TextStyle(
|
Container(
|
||||||
color: Colors.white70,
|
padding:
|
||||||
fontSize: 14,
|
const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Colors.white.withOpacity(0.15),
|
||||||
|
borderRadius: BorderRadius.circular(20),
|
||||||
|
border: Border.all(
|
||||||
|
color: Colors.white.withOpacity(0.3),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
child: Row(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
Icon(
|
||||||
|
Icons.domain,
|
||||||
|
color: Colors.white,
|
||||||
|
size: 16,
|
||||||
|
),
|
||||||
|
const SizedBox(width: 8),
|
||||||
|
TweenAnimationBuilder<int>(
|
||||||
|
duration: const Duration(milliseconds: 800),
|
||||||
|
tween: IntTween(
|
||||||
|
begin: 0, end: widget.provider.empresas.length),
|
||||||
|
builder: (context, value, child) {
|
||||||
|
return Text(
|
||||||
|
'$value empresas',
|
||||||
|
style: const TextStyle(
|
||||||
|
color: Colors.white,
|
||||||
|
fontSize: 14,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
||||||
// Lista de empresas
|
// Lista de empresas con animaciones escalonadas
|
||||||
Expanded(
|
Expanded(
|
||||||
child: ListView.builder(
|
child: widget.provider.empresas.isEmpty
|
||||||
padding: const EdgeInsets.all(8),
|
? _buildEmptyState()
|
||||||
itemCount: provider.empresas.length,
|
: ListView.builder(
|
||||||
itemBuilder: (context, index) {
|
padding: const EdgeInsets.all(16),
|
||||||
final empresa = provider.empresas[index];
|
itemCount: widget.provider.empresas.length,
|
||||||
final isSelected = provider.empresaSeleccionadaId == empresa.id;
|
itemBuilder: (context, index) {
|
||||||
|
return TweenAnimationBuilder<double>(
|
||||||
|
duration: Duration(milliseconds: 200 + (index * 100)),
|
||||||
|
tween: Tween(begin: 0.0, end: 1.0),
|
||||||
|
builder: (context, value, child) {
|
||||||
|
return Transform.translate(
|
||||||
|
offset: Offset(-50 * (1 - value), 0),
|
||||||
|
child: Opacity(
|
||||||
|
opacity: value,
|
||||||
|
child: _buildEmpresaCard(
|
||||||
|
widget.provider.empresas[index], index),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
|
||||||
return Container(
|
// Botón añadir empresa mejorado
|
||||||
margin: const EdgeInsets.only(bottom: 8),
|
Container(
|
||||||
|
padding: const EdgeInsets.all(20),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
gradient: LinearGradient(
|
||||||
|
begin: Alignment.topCenter,
|
||||||
|
end: Alignment.bottomCenter,
|
||||||
|
colors: [
|
||||||
|
AppTheme.of(context).primaryBackground.withOpacity(0.0),
|
||||||
|
AppTheme.of(context).primaryBackground,
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
// Línea divisoria con gradiente
|
||||||
|
Container(
|
||||||
|
height: 1,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: isSelected
|
gradient: LinearGradient(
|
||||||
? AppTheme.of(context).primaryColor.withOpacity(0.1)
|
colors: [
|
||||||
: AppTheme.of(context).primaryBackground,
|
Colors.transparent,
|
||||||
borderRadius: BorderRadius.circular(12),
|
AppTheme.of(context).primaryColor.withOpacity(0.5),
|
||||||
border: Border.all(
|
Colors.transparent,
|
||||||
color: isSelected
|
],
|
||||||
? AppTheme.of(context).primaryColor
|
|
||||||
: Colors.grey.withOpacity(0.3),
|
|
||||||
width: isSelected ? 2 : 1,
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
child: InkWell(
|
),
|
||||||
onTap: () => onEmpresaSelected(empresa.id),
|
const SizedBox(height: 20),
|
||||||
borderRadius: BorderRadius.circular(12),
|
|
||||||
child: Padding(
|
// Botón principal
|
||||||
padding: const EdgeInsets.all(12),
|
SizedBox(
|
||||||
child: Column(
|
width: double.infinity,
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
child: Container(
|
||||||
children: [
|
decoration: BoxDecoration(
|
||||||
Row(
|
gradient: AppTheme.of(context).modernGradient,
|
||||||
children: [
|
borderRadius: BorderRadius.circular(15),
|
||||||
// Logo de la empresa
|
boxShadow: [
|
||||||
Container(
|
BoxShadow(
|
||||||
width: 40,
|
color: AppTheme.of(context)
|
||||||
height: 40,
|
.primaryColor
|
||||||
decoration: BoxDecoration(
|
.withOpacity(0.3),
|
||||||
color: AppTheme.of(context).primaryColor,
|
blurRadius: 15,
|
||||||
borderRadius: BorderRadius.circular(8),
|
offset: const Offset(0, 5),
|
||||||
),
|
),
|
||||||
child: empresa.logoUrl != null
|
],
|
||||||
? ClipRRect(
|
),
|
||||||
borderRadius: BorderRadius.circular(8),
|
child: ElevatedButton.icon(
|
||||||
child: Image.network(
|
onPressed: () {
|
||||||
"${supabaseLU.supabaseUrl}/storage/v1/object/public/nethive/logos/${empresa.logoUrl}",
|
showDialog(
|
||||||
fit: BoxFit.cover,
|
context: context,
|
||||||
errorBuilder:
|
builder: (context) =>
|
||||||
(context, error, stackTrace) {
|
AddEmpresaDialog(provider: widget.provider),
|
||||||
return Image.asset(
|
);
|
||||||
'assets/images/placeholder_no_image.jpg',
|
},
|
||||||
fit: BoxFit.cover,
|
icon: const Icon(Icons.add, color: Colors.white),
|
||||||
);
|
label: const Text(
|
||||||
},
|
'Nueva Empresa',
|
||||||
),
|
style: TextStyle(
|
||||||
)
|
color: Colors.white,
|
||||||
: Image.asset(
|
fontWeight: FontWeight.bold,
|
||||||
'assets/images/placeholder_no_image.jpg',
|
fontSize: 16,
|
||||||
fit: BoxFit.cover,
|
),
|
||||||
),
|
),
|
||||||
),
|
style: ElevatedButton.styleFrom(
|
||||||
const SizedBox(width: 12),
|
backgroundColor: Colors.transparent,
|
||||||
Expanded(
|
shadowColor: Colors.transparent,
|
||||||
child: Column(
|
padding: const EdgeInsets.symmetric(vertical: 16),
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
shape: RoundedRectangleBorder(
|
||||||
children: [
|
borderRadius: BorderRadius.circular(15),
|
||||||
Text(
|
),
|
||||||
empresa.nombre,
|
|
||||||
style: TextStyle(
|
|
||||||
color: AppTheme.of(context).primaryText,
|
|
||||||
fontSize: 16,
|
|
||||||
fontWeight: FontWeight.w600,
|
|
||||||
),
|
|
||||||
maxLines: 1,
|
|
||||||
overflow: TextOverflow.ellipsis,
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
'Tecnología',
|
|
||||||
style: TextStyle(
|
|
||||||
color:
|
|
||||||
AppTheme.of(context).secondaryText,
|
|
||||||
fontSize: 12,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
const SizedBox(height: 8),
|
|
||||||
Text(
|
|
||||||
'Sucursales: ${isSelected ? provider.negocios.length : '...'}',
|
|
||||||
style: TextStyle(
|
|
||||||
color: AppTheme.of(context).secondaryText,
|
|
||||||
fontSize: 12,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
),
|
||||||
},
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
||||||
// Botón añadir empresa
|
// Información de empresa seleccionada mejorada
|
||||||
Padding(
|
if (widget.provider.empresaSeleccionada != null) ...[
|
||||||
padding: const EdgeInsets.all(16),
|
|
||||||
child: SizedBox(
|
|
||||||
width: double.infinity,
|
|
||||||
child: ElevatedButton.icon(
|
|
||||||
onPressed: () {
|
|
||||||
showDialog(
|
|
||||||
context: context,
|
|
||||||
builder: (context) => AddEmpresaDialog(provider: provider),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
icon: const Icon(Icons.add, color: Colors.white),
|
|
||||||
label: const Text(
|
|
||||||
'Añadir Empresa',
|
|
||||||
style: TextStyle(
|
|
||||||
color: Colors.white,
|
|
||||||
fontWeight: FontWeight.w600,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
style: ElevatedButton.styleFrom(
|
|
||||||
backgroundColor: AppTheme.of(context).primaryColor,
|
|
||||||
padding: const EdgeInsets.symmetric(vertical: 12),
|
|
||||||
shape: RoundedRectangleBorder(
|
|
||||||
borderRadius: BorderRadius.circular(8),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
|
|
||||||
// Información de empresa seleccionada
|
|
||||||
if (provider.empresaSeleccionada != null) ...[
|
|
||||||
Container(
|
Container(
|
||||||
margin: const EdgeInsets.fromLTRB(16, 0, 16, 16),
|
margin: const EdgeInsets.fromLTRB(16, 0, 16, 16),
|
||||||
padding: const EdgeInsets.all(16),
|
padding: const EdgeInsets.all(20),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: AppTheme.of(context).primaryColor.withOpacity(0.1),
|
gradient: LinearGradient(
|
||||||
borderRadius: BorderRadius.circular(12),
|
begin: Alignment.topLeft,
|
||||||
|
end: Alignment.bottomRight,
|
||||||
|
colors: [
|
||||||
|
AppTheme.of(context).primaryColor.withOpacity(0.1),
|
||||||
|
AppTheme.of(context).tertiaryColor.withOpacity(0.1),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
borderRadius: BorderRadius.circular(16),
|
||||||
border: Border.all(
|
border: Border.all(
|
||||||
color: AppTheme.of(context).primaryColor.withOpacity(0.3),
|
color: AppTheme.of(context).primaryColor.withOpacity(0.3),
|
||||||
|
width: 2,
|
||||||
),
|
),
|
||||||
|
boxShadow: [
|
||||||
|
BoxShadow(
|
||||||
|
color: AppTheme.of(context).primaryColor.withOpacity(0.1),
|
||||||
|
blurRadius: 10,
|
||||||
|
offset: const Offset(0, 4),
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Row(
|
||||||
'Empresa seleccionada:',
|
children: [
|
||||||
style: TextStyle(
|
Container(
|
||||||
color: AppTheme.of(context).secondaryText,
|
padding: const EdgeInsets.all(8),
|
||||||
fontSize: 12,
|
decoration: BoxDecoration(
|
||||||
fontWeight: FontWeight.w500,
|
gradient: AppTheme.of(context).primaryGradient,
|
||||||
),
|
borderRadius: BorderRadius.circular(10),
|
||||||
|
),
|
||||||
|
child: Icon(
|
||||||
|
Icons.check_circle,
|
||||||
|
color: Colors.white,
|
||||||
|
size: 20,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 12),
|
||||||
|
Expanded(
|
||||||
|
child: Text(
|
||||||
|
'Empresa activa',
|
||||||
|
style: TextStyle(
|
||||||
|
color: AppTheme.of(context).primaryColor,
|
||||||
|
fontSize: 14,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
const SizedBox(height: 4),
|
const SizedBox(height: 12),
|
||||||
|
|
||||||
Text(
|
Text(
|
||||||
provider.empresaSeleccionada!.nombre,
|
widget.provider.empresaSeleccionada!.nombre,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: AppTheme.of(context).primaryText,
|
color: AppTheme.of(context).primaryText,
|
||||||
fontSize: 16,
|
fontSize: 18,
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 8),
|
const SizedBox(height: 8),
|
||||||
|
|
||||||
|
// Estadísticas
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
Icon(
|
Icon(
|
||||||
@@ -235,41 +379,71 @@ class EmpresaSelectorSidebar extends StatelessWidget {
|
|||||||
size: 16,
|
size: 16,
|
||||||
color: AppTheme.of(context).primaryColor,
|
color: AppTheme.of(context).primaryColor,
|
||||||
),
|
),
|
||||||
const SizedBox(width: 4),
|
const SizedBox(width: 6),
|
||||||
Text(
|
TweenAnimationBuilder<int>(
|
||||||
'${provider.negocios.length} Sucursales',
|
duration: const Duration(milliseconds: 600),
|
||||||
style: TextStyle(
|
tween: IntTween(
|
||||||
color: AppTheme.of(context).primaryText,
|
begin: 0, end: widget.provider.negocios.length),
|
||||||
fontSize: 14,
|
builder: (context, value, child) {
|
||||||
fontWeight: FontWeight.w500,
|
return Text(
|
||||||
),
|
'$value sucursales',
|
||||||
|
style: TextStyle(
|
||||||
|
color: AppTheme.of(context).primaryText,
|
||||||
|
fontSize: 14,
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
const SizedBox(height: 12),
|
const SizedBox(height: 16),
|
||||||
|
|
||||||
|
// Botón para añadir sucursal
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
child: ElevatedButton.icon(
|
child: Container(
|
||||||
onPressed: () {
|
decoration: BoxDecoration(
|
||||||
showDialog(
|
gradient: AppTheme.of(context).primaryGradient,
|
||||||
context: context,
|
borderRadius: BorderRadius.circular(10),
|
||||||
builder: (context) => AddNegocioDialog(
|
boxShadow: [
|
||||||
provider: provider,
|
BoxShadow(
|
||||||
empresaId: provider.empresaSeleccionada!.id,
|
color: AppTheme.of(context)
|
||||||
|
.primaryColor
|
||||||
|
.withOpacity(0.3),
|
||||||
|
blurRadius: 8,
|
||||||
|
offset: const Offset(0, 3),
|
||||||
),
|
),
|
||||||
);
|
],
|
||||||
},
|
|
||||||
icon: const Icon(Icons.add, size: 16),
|
|
||||||
label: const Text(
|
|
||||||
'Añadir Sucursal',
|
|
||||||
style: TextStyle(fontSize: 12),
|
|
||||||
),
|
),
|
||||||
style: ElevatedButton.styleFrom(
|
child: ElevatedButton.icon(
|
||||||
backgroundColor: AppTheme.of(context).primaryColor,
|
onPressed: () {
|
||||||
foregroundColor: Colors.white,
|
showDialog(
|
||||||
padding: const EdgeInsets.symmetric(vertical: 8),
|
context: context,
|
||||||
shape: RoundedRectangleBorder(
|
builder: (context) => AddNegocioDialog(
|
||||||
borderRadius: BorderRadius.circular(6),
|
provider: widget.provider,
|
||||||
|
empresaId:
|
||||||
|
widget.provider.empresaSeleccionada!.id,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
icon: const Icon(Icons.add_location,
|
||||||
|
size: 18, color: Colors.white),
|
||||||
|
label: const Text(
|
||||||
|
'Añadir Sucursal',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 14,
|
||||||
|
color: Colors.white,
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
style: ElevatedButton.styleFrom(
|
||||||
|
backgroundColor: Colors.transparent,
|
||||||
|
shadowColor: Colors.transparent,
|
||||||
|
padding: const EdgeInsets.symmetric(vertical: 12),
|
||||||
|
shape: RoundedRectangleBorder(
|
||||||
|
borderRadius: BorderRadius.circular(10),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -282,4 +456,231 @@ class EmpresaSelectorSidebar extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Widget _buildEmpresaCard(dynamic empresa, int index) {
|
||||||
|
final isSelected = widget.provider.empresaSeleccionadaId == empresa.id;
|
||||||
|
|
||||||
|
return Container(
|
||||||
|
margin: const EdgeInsets.only(bottom: 12),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
gradient: isSelected
|
||||||
|
? AppTheme.of(context).primaryGradient
|
||||||
|
: LinearGradient(
|
||||||
|
colors: [
|
||||||
|
AppTheme.of(context).secondaryBackground,
|
||||||
|
AppTheme.of(context).tertiaryBackground,
|
||||||
|
],
|
||||||
|
),
|
||||||
|
borderRadius: BorderRadius.circular(16),
|
||||||
|
border: Border.all(
|
||||||
|
color: isSelected
|
||||||
|
? Colors.white.withOpacity(0.3)
|
||||||
|
: AppTheme.of(context).primaryColor.withOpacity(0.2),
|
||||||
|
width: isSelected ? 2 : 1,
|
||||||
|
),
|
||||||
|
boxShadow: [
|
||||||
|
BoxShadow(
|
||||||
|
color: isSelected
|
||||||
|
? AppTheme.of(context).primaryColor.withOpacity(0.3)
|
||||||
|
: Colors.black.withOpacity(0.1),
|
||||||
|
blurRadius: isSelected ? 15 : 8,
|
||||||
|
offset: Offset(0, isSelected ? 8 : 3),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
child: Material(
|
||||||
|
color: Colors.transparent,
|
||||||
|
child: InkWell(
|
||||||
|
onTap: () => widget.onEmpresaSelected(empresa.id),
|
||||||
|
borderRadius: BorderRadius.circular(16),
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(16),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
// Logo de la empresa con efectos
|
||||||
|
Container(
|
||||||
|
width: 50,
|
||||||
|
height: 50,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
gradient: isSelected
|
||||||
|
? LinearGradient(
|
||||||
|
colors: [
|
||||||
|
Colors.white.withOpacity(0.3),
|
||||||
|
Colors.white.withOpacity(0.1)
|
||||||
|
],
|
||||||
|
)
|
||||||
|
: AppTheme.of(context).primaryGradient,
|
||||||
|
borderRadius: BorderRadius.circular(12),
|
||||||
|
boxShadow: [
|
||||||
|
BoxShadow(
|
||||||
|
color: (isSelected
|
||||||
|
? Colors.white
|
||||||
|
: AppTheme.of(context).primaryColor)
|
||||||
|
.withOpacity(0.3),
|
||||||
|
blurRadius: 8,
|
||||||
|
offset: const Offset(0, 3),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
child: empresa.logoUrl != null &&
|
||||||
|
empresa.logoUrl!.isNotEmpty
|
||||||
|
? ClipRRect(
|
||||||
|
borderRadius: BorderRadius.circular(12),
|
||||||
|
child: Image.network(
|
||||||
|
"${supabaseLU.supabaseUrl}/storage/v1/object/public/nethive/logos/${empresa.logoUrl}",
|
||||||
|
fit: BoxFit.cover,
|
||||||
|
errorBuilder: (context, error, stackTrace) {
|
||||||
|
return Image.asset(
|
||||||
|
'assets/images/placeholder_no_image.jpg',
|
||||||
|
fit: BoxFit.cover,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: Icon(
|
||||||
|
Icons.business,
|
||||||
|
color: isSelected ? Colors.white : Colors.white,
|
||||||
|
size: 24,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 16),
|
||||||
|
|
||||||
|
Expanded(
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
empresa.nombre,
|
||||||
|
style: TextStyle(
|
||||||
|
color: isSelected
|
||||||
|
? Colors.white
|
||||||
|
: AppTheme.of(context).primaryText,
|
||||||
|
fontSize: 16,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
maxLines: 1,
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
|
),
|
||||||
|
const SizedBox(height: 4),
|
||||||
|
Container(
|
||||||
|
padding: const EdgeInsets.symmetric(
|
||||||
|
horizontal: 8, vertical: 2),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: (isSelected
|
||||||
|
? Colors.white
|
||||||
|
: AppTheme.of(context).primaryColor)
|
||||||
|
.withOpacity(0.2),
|
||||||
|
borderRadius: BorderRadius.circular(10),
|
||||||
|
),
|
||||||
|
child: Text(
|
||||||
|
'Tecnología',
|
||||||
|
style: TextStyle(
|
||||||
|
color: isSelected
|
||||||
|
? Colors.white
|
||||||
|
: AppTheme.of(context).primaryColor,
|
||||||
|
fontSize: 10,
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
const SizedBox(height: 12),
|
||||||
|
|
||||||
|
// Información adicional
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Icon(
|
||||||
|
Icons.store,
|
||||||
|
size: 16,
|
||||||
|
color: isSelected
|
||||||
|
? Colors.white.withOpacity(0.8)
|
||||||
|
: AppTheme.of(context).secondaryText,
|
||||||
|
),
|
||||||
|
const SizedBox(width: 6),
|
||||||
|
Text(
|
||||||
|
'Sucursales: ${isSelected ? widget.provider.negocios.length : '...'}',
|
||||||
|
style: TextStyle(
|
||||||
|
color: isSelected
|
||||||
|
? Colors.white.withOpacity(0.9)
|
||||||
|
: AppTheme.of(context).secondaryText,
|
||||||
|
fontSize: 12,
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildEmptyState() {
|
||||||
|
return Center(
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(40),
|
||||||
|
child: Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
AnimatedBuilder(
|
||||||
|
animation: _pulseAnimation,
|
||||||
|
builder: (context, child) {
|
||||||
|
return Transform.scale(
|
||||||
|
scale: _pulseAnimation.value,
|
||||||
|
child: Container(
|
||||||
|
padding: const EdgeInsets.all(20),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
gradient: AppTheme.of(context).primaryGradient,
|
||||||
|
shape: BoxShape.circle,
|
||||||
|
boxShadow: [
|
||||||
|
BoxShadow(
|
||||||
|
color: AppTheme.of(context)
|
||||||
|
.primaryColor
|
||||||
|
.withOpacity(0.3),
|
||||||
|
blurRadius: 20,
|
||||||
|
offset: const Offset(0, 8),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
child: Icon(
|
||||||
|
Icons.business,
|
||||||
|
color: Colors.white,
|
||||||
|
size: 40,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
const SizedBox(height: 20),
|
||||||
|
Text(
|
||||||
|
'Sin empresas',
|
||||||
|
style: TextStyle(
|
||||||
|
color: AppTheme.of(context).primaryText,
|
||||||
|
fontSize: 18,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 8),
|
||||||
|
Text(
|
||||||
|
'Añade tu primera empresa\npara comenzar',
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: TextStyle(
|
||||||
|
color: AppTheme.of(context).secondaryText,
|
||||||
|
fontSize: 14,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
472
lib/pages/empresa_negocios/widgets/mobile_empresa_selector.dart
Normal file
472
lib/pages/empresa_negocios/widgets/mobile_empresa_selector.dart
Normal file
@@ -0,0 +1,472 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:nethive_neo/providers/nethive/empresas_negocios_provider.dart';
|
||||||
|
import 'package:nethive_neo/theme/theme.dart';
|
||||||
|
import 'package:nethive_neo/helpers/globals.dart';
|
||||||
|
|
||||||
|
class MobileEmpresaSelector extends StatefulWidget {
|
||||||
|
final EmpresasNegociosProvider provider;
|
||||||
|
final Function(String) onEmpresaSelected;
|
||||||
|
|
||||||
|
const MobileEmpresaSelector({
|
||||||
|
Key? key,
|
||||||
|
required this.provider,
|
||||||
|
required this.onEmpresaSelected,
|
||||||
|
}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<MobileEmpresaSelector> createState() => _MobileEmpresaSelectorState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _MobileEmpresaSelectorState extends State<MobileEmpresaSelector>
|
||||||
|
with TickerProviderStateMixin {
|
||||||
|
late AnimationController _animationController;
|
||||||
|
late Animation<double> _fadeAnimation;
|
||||||
|
final TextEditingController _searchController = TextEditingController();
|
||||||
|
List<dynamic> _filteredEmpresas = [];
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
_animationController = AnimationController(
|
||||||
|
duration: const Duration(milliseconds: 300),
|
||||||
|
vsync: this,
|
||||||
|
);
|
||||||
|
_fadeAnimation = CurvedAnimation(
|
||||||
|
parent: _animationController,
|
||||||
|
curve: Curves.easeInOut,
|
||||||
|
);
|
||||||
|
|
||||||
|
_filteredEmpresas = widget.provider.empresas;
|
||||||
|
_animationController.forward();
|
||||||
|
|
||||||
|
_searchController.addListener(_onSearchChanged);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
_animationController.dispose();
|
||||||
|
_searchController.dispose();
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
void _onSearchChanged() {
|
||||||
|
final query = _searchController.text.toLowerCase();
|
||||||
|
setState(() {
|
||||||
|
_filteredEmpresas = widget.provider.empresas.where((empresa) {
|
||||||
|
return empresa.nombre.toLowerCase().contains(query) ||
|
||||||
|
empresa.rfc.toLowerCase().contains(query);
|
||||||
|
}).toList();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return FadeTransition(
|
||||||
|
opacity: _fadeAnimation,
|
||||||
|
child: Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: AppTheme.of(context).primaryBackground,
|
||||||
|
borderRadius: const BorderRadius.only(
|
||||||
|
topLeft: Radius.circular(25),
|
||||||
|
topRight: Radius.circular(25),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
child: Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
// Handle
|
||||||
|
Container(
|
||||||
|
margin: const EdgeInsets.symmetric(vertical: 10),
|
||||||
|
width: 40,
|
||||||
|
height: 4,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: AppTheme.of(context).secondaryText.withOpacity(0.3),
|
||||||
|
borderRadius: BorderRadius.circular(2),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
|
||||||
|
// Header
|
||||||
|
Container(
|
||||||
|
padding: const EdgeInsets.all(20),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
gradient: AppTheme.of(context).primaryGradient,
|
||||||
|
borderRadius: const BorderRadius.only(
|
||||||
|
topLeft: Radius.circular(25),
|
||||||
|
topRight: Radius.circular(25),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
padding: const EdgeInsets.all(12),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Colors.white.withOpacity(0.2),
|
||||||
|
borderRadius: BorderRadius.circular(12),
|
||||||
|
),
|
||||||
|
child: const Icon(
|
||||||
|
Icons.business_center,
|
||||||
|
color: Colors.white,
|
||||||
|
size: 24,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 16),
|
||||||
|
Expanded(
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
const Text(
|
||||||
|
'Seleccionar Empresa',
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.white,
|
||||||
|
fontSize: 20,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
'Elige una empresa para ver sus sucursales',
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.white.withOpacity(0.8),
|
||||||
|
fontSize: 14,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
IconButton(
|
||||||
|
onPressed: () => Navigator.of(context).pop(),
|
||||||
|
icon: const Icon(
|
||||||
|
Icons.close,
|
||||||
|
color: Colors.white,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
const SizedBox(height: 16),
|
||||||
|
|
||||||
|
// Buscador
|
||||||
|
Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Colors.white.withOpacity(0.2),
|
||||||
|
borderRadius: BorderRadius.circular(15),
|
||||||
|
),
|
||||||
|
child: TextField(
|
||||||
|
controller: _searchController,
|
||||||
|
style: const TextStyle(color: Colors.white),
|
||||||
|
decoration: InputDecoration(
|
||||||
|
hintText: 'Buscar empresa...',
|
||||||
|
hintStyle: TextStyle(
|
||||||
|
color: Colors.white.withOpacity(0.7),
|
||||||
|
),
|
||||||
|
prefixIcon: Icon(
|
||||||
|
Icons.search,
|
||||||
|
color: Colors.white.withOpacity(0.7),
|
||||||
|
),
|
||||||
|
border: InputBorder.none,
|
||||||
|
contentPadding: const EdgeInsets.symmetric(
|
||||||
|
horizontal: 20,
|
||||||
|
vertical: 15,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
|
||||||
|
// Lista de empresas
|
||||||
|
Flexible(
|
||||||
|
child: _filteredEmpresas.isEmpty
|
||||||
|
? _buildEmptyState()
|
||||||
|
: ListView.builder(
|
||||||
|
padding: const EdgeInsets.all(16),
|
||||||
|
shrinkWrap: true,
|
||||||
|
itemCount: _filteredEmpresas.length,
|
||||||
|
itemBuilder: (context, index) {
|
||||||
|
return TweenAnimationBuilder<double>(
|
||||||
|
duration: Duration(milliseconds: 200 + (index * 50)),
|
||||||
|
tween: Tween(begin: 0.0, end: 1.0),
|
||||||
|
builder: (context, value, child) {
|
||||||
|
return Transform.translate(
|
||||||
|
offset: Offset(30 * (1 - value), 0),
|
||||||
|
child: Opacity(
|
||||||
|
opacity: value,
|
||||||
|
child: _buildEmpresaCard(
|
||||||
|
_filteredEmpresas[index],
|
||||||
|
index,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
|
||||||
|
// Footer con información adicional
|
||||||
|
if (widget.provider.empresaSeleccionada != null) ...[
|
||||||
|
Container(
|
||||||
|
padding: const EdgeInsets.all(20),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: AppTheme.of(context).secondaryBackground,
|
||||||
|
border: Border(
|
||||||
|
top: BorderSide(
|
||||||
|
color: AppTheme.of(context).primaryColor.withOpacity(0.2),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
'Empresa Actual',
|
||||||
|
style: TextStyle(
|
||||||
|
color: AppTheme.of(context).primaryColor,
|
||||||
|
fontSize: 14,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 8),
|
||||||
|
Text(
|
||||||
|
widget.provider.empresaSeleccionada!.nombre,
|
||||||
|
style: TextStyle(
|
||||||
|
color: AppTheme.of(context).primaryText,
|
||||||
|
fontSize: 16,
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 4),
|
||||||
|
Text(
|
||||||
|
'${widget.provider.negocios.length} sucursales',
|
||||||
|
style: TextStyle(
|
||||||
|
color: AppTheme.of(context).secondaryText,
|
||||||
|
fontSize: 14,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildEmpresaCard(dynamic empresa, int index) {
|
||||||
|
final isSelected = widget.provider.empresaSeleccionadaId == empresa.id;
|
||||||
|
|
||||||
|
return Container(
|
||||||
|
margin: const EdgeInsets.only(bottom: 12),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
gradient: isSelected
|
||||||
|
? AppTheme.of(context).primaryGradient
|
||||||
|
: LinearGradient(
|
||||||
|
colors: [
|
||||||
|
AppTheme.of(context).secondaryBackground,
|
||||||
|
AppTheme.of(context).tertiaryBackground,
|
||||||
|
],
|
||||||
|
),
|
||||||
|
borderRadius: BorderRadius.circular(16),
|
||||||
|
border: Border.all(
|
||||||
|
color: isSelected
|
||||||
|
? Colors.white.withOpacity(0.3)
|
||||||
|
: AppTheme.of(context).primaryColor.withOpacity(0.2),
|
||||||
|
width: isSelected ? 2 : 1,
|
||||||
|
),
|
||||||
|
boxShadow: [
|
||||||
|
BoxShadow(
|
||||||
|
color: isSelected
|
||||||
|
? AppTheme.of(context).primaryColor.withOpacity(0.3)
|
||||||
|
: Colors.black.withOpacity(0.1),
|
||||||
|
blurRadius: isSelected ? 15 : 8,
|
||||||
|
offset: Offset(0, isSelected ? 8 : 3),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
child: Material(
|
||||||
|
color: Colors.transparent,
|
||||||
|
child: InkWell(
|
||||||
|
onTap: () {
|
||||||
|
widget.onEmpresaSelected(empresa.id);
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
},
|
||||||
|
borderRadius: BorderRadius.circular(16),
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(16),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
// Logo de la empresa
|
||||||
|
Container(
|
||||||
|
width: 60,
|
||||||
|
height: 60,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
gradient: isSelected
|
||||||
|
? LinearGradient(
|
||||||
|
colors: [
|
||||||
|
Colors.white.withOpacity(0.3),
|
||||||
|
Colors.white.withOpacity(0.1)
|
||||||
|
],
|
||||||
|
)
|
||||||
|
: AppTheme.of(context).primaryGradient,
|
||||||
|
borderRadius: BorderRadius.circular(12),
|
||||||
|
boxShadow: [
|
||||||
|
BoxShadow(
|
||||||
|
color: (isSelected
|
||||||
|
? Colors.white
|
||||||
|
: AppTheme.of(context).primaryColor)
|
||||||
|
.withOpacity(0.3),
|
||||||
|
blurRadius: 8,
|
||||||
|
offset: const Offset(0, 3),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
child: empresa.logoUrl != null && empresa.logoUrl!.isNotEmpty
|
||||||
|
? ClipRRect(
|
||||||
|
borderRadius: BorderRadius.circular(12),
|
||||||
|
child: Image.network(
|
||||||
|
"${supabaseLU.supabaseUrl}/storage/v1/object/public/nethive/logos/${empresa.logoUrl}",
|
||||||
|
fit: BoxFit.cover,
|
||||||
|
errorBuilder: (context, error, stackTrace) {
|
||||||
|
return Image.asset(
|
||||||
|
'assets/images/placeholder_no_image.jpg',
|
||||||
|
fit: BoxFit.cover,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: Icon(
|
||||||
|
Icons.business,
|
||||||
|
color: isSelected ? Colors.white : Colors.white,
|
||||||
|
size: 30,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 16),
|
||||||
|
|
||||||
|
// Información de la empresa
|
||||||
|
Expanded(
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
empresa.nombre,
|
||||||
|
style: TextStyle(
|
||||||
|
color: isSelected
|
||||||
|
? Colors.white
|
||||||
|
: AppTheme.of(context).primaryText,
|
||||||
|
fontSize: 16,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
maxLines: 2,
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
|
),
|
||||||
|
const SizedBox(height: 4),
|
||||||
|
Text(
|
||||||
|
empresa.rfc,
|
||||||
|
style: TextStyle(
|
||||||
|
color: isSelected
|
||||||
|
? Colors.white.withOpacity(0.8)
|
||||||
|
: AppTheme.of(context).secondaryText,
|
||||||
|
fontSize: 14,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 8),
|
||||||
|
Container(
|
||||||
|
padding: const EdgeInsets.symmetric(
|
||||||
|
horizontal: 8,
|
||||||
|
vertical: 4,
|
||||||
|
),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: (isSelected
|
||||||
|
? Colors.white
|
||||||
|
: AppTheme.of(context).primaryColor)
|
||||||
|
.withOpacity(0.2),
|
||||||
|
borderRadius: BorderRadius.circular(10),
|
||||||
|
),
|
||||||
|
child: Text(
|
||||||
|
'Tecnología',
|
||||||
|
style: TextStyle(
|
||||||
|
color: isSelected
|
||||||
|
? Colors.white
|
||||||
|
: AppTheme.of(context).primaryColor,
|
||||||
|
fontSize: 10,
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
|
||||||
|
// Indicador de selección
|
||||||
|
if (isSelected)
|
||||||
|
Container(
|
||||||
|
padding: const EdgeInsets.all(8),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Colors.white.withOpacity(0.2),
|
||||||
|
shape: BoxShape.circle,
|
||||||
|
),
|
||||||
|
child: const Icon(
|
||||||
|
Icons.check,
|
||||||
|
color: Colors.white,
|
||||||
|
size: 20,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
else
|
||||||
|
Icon(
|
||||||
|
Icons.arrow_forward_ios,
|
||||||
|
color: AppTheme.of(context).secondaryText,
|
||||||
|
size: 16,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildEmptyState() {
|
||||||
|
return Center(
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(40),
|
||||||
|
child: Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
padding: const EdgeInsets.all(20),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: AppTheme.of(context).primaryColor.withOpacity(0.1),
|
||||||
|
shape: BoxShape.circle,
|
||||||
|
),
|
||||||
|
child: Icon(
|
||||||
|
Icons.search_off,
|
||||||
|
color: AppTheme.of(context).primaryColor,
|
||||||
|
size: 40,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 16),
|
||||||
|
Text(
|
||||||
|
'No se encontraron empresas',
|
||||||
|
style: TextStyle(
|
||||||
|
color: AppTheme.of(context).primaryText,
|
||||||
|
fontSize: 18,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 8),
|
||||||
|
Text(
|
||||||
|
'Intenta con otro término de búsqueda',
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: TextStyle(
|
||||||
|
color: AppTheme.of(context).secondaryText,
|
||||||
|
fontSize: 14,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
646
lib/pages/empresa_negocios/widgets/negocios_cards_view.dart
Normal file
646
lib/pages/empresa_negocios/widgets/negocios_cards_view.dart
Normal file
@@ -0,0 +1,646 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:nethive_neo/providers/nethive/empresas_negocios_provider.dart';
|
||||||
|
import 'package:nethive_neo/theme/theme.dart';
|
||||||
|
import 'package:nethive_neo/helpers/globals.dart';
|
||||||
|
|
||||||
|
class NegociosCardsView extends StatelessWidget {
|
||||||
|
final EmpresasNegociosProvider provider;
|
||||||
|
|
||||||
|
const NegociosCardsView({
|
||||||
|
Key? key,
|
||||||
|
required this.provider,
|
||||||
|
}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
if (provider.empresaSeleccionada == null) {
|
||||||
|
return _buildEmptyState(context);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (provider.negocios.isEmpty) {
|
||||||
|
return _buildNoDataState(context);
|
||||||
|
}
|
||||||
|
|
||||||
|
return Container(
|
||||||
|
padding: const EdgeInsets.all(16),
|
||||||
|
child: ListView.builder(
|
||||||
|
itemCount: provider.negocios.length,
|
||||||
|
itemBuilder: (context, index) {
|
||||||
|
final negocio = provider.negocios[index];
|
||||||
|
return TweenAnimationBuilder<double>(
|
||||||
|
duration: Duration(milliseconds: 300 + (index * 100)),
|
||||||
|
tween: Tween(begin: 0.0, end: 1.0),
|
||||||
|
builder: (context, value, child) {
|
||||||
|
return Transform.translate(
|
||||||
|
offset: Offset(0, 50 * (1 - value)),
|
||||||
|
child: Opacity(
|
||||||
|
opacity: value,
|
||||||
|
child: Container(
|
||||||
|
margin: const EdgeInsets.only(bottom: 16),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
gradient: LinearGradient(
|
||||||
|
begin: Alignment.topLeft,
|
||||||
|
end: Alignment.bottomRight,
|
||||||
|
colors: [
|
||||||
|
AppTheme.of(context).secondaryBackground,
|
||||||
|
AppTheme.of(context).tertiaryBackground,
|
||||||
|
],
|
||||||
|
),
|
||||||
|
borderRadius: BorderRadius.circular(20),
|
||||||
|
border: Border.all(
|
||||||
|
color:
|
||||||
|
AppTheme.of(context).primaryColor.withOpacity(0.3),
|
||||||
|
width: 1,
|
||||||
|
),
|
||||||
|
boxShadow: [
|
||||||
|
BoxShadow(
|
||||||
|
color: AppTheme.of(context)
|
||||||
|
.primaryColor
|
||||||
|
.withOpacity(0.1),
|
||||||
|
blurRadius: 15,
|
||||||
|
offset: const Offset(0, 5),
|
||||||
|
),
|
||||||
|
BoxShadow(
|
||||||
|
color: Colors.black.withOpacity(0.1),
|
||||||
|
blurRadius: 10,
|
||||||
|
offset: const Offset(0, 2),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
child: ClipRRect(
|
||||||
|
borderRadius: BorderRadius.circular(20),
|
||||||
|
child: Material(
|
||||||
|
color: Colors.transparent,
|
||||||
|
child: InkWell(
|
||||||
|
onTap: () {
|
||||||
|
_showNegocioDetails(context, negocio);
|
||||||
|
},
|
||||||
|
borderRadius: BorderRadius.circular(20),
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(20),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
// Header con logo y nombre
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
// Logo del negocio
|
||||||
|
Container(
|
||||||
|
width: 60,
|
||||||
|
height: 60,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
gradient: AppTheme.of(context)
|
||||||
|
.primaryGradient,
|
||||||
|
borderRadius: BorderRadius.circular(15),
|
||||||
|
boxShadow: [
|
||||||
|
BoxShadow(
|
||||||
|
color: AppTheme.of(context)
|
||||||
|
.primaryColor
|
||||||
|
.withOpacity(0.3),
|
||||||
|
blurRadius: 10,
|
||||||
|
offset: const Offset(0, 4),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
child: negocio.logoUrl != null &&
|
||||||
|
negocio.logoUrl!.isNotEmpty
|
||||||
|
? ClipRRect(
|
||||||
|
borderRadius:
|
||||||
|
BorderRadius.circular(15),
|
||||||
|
child: Image.network(
|
||||||
|
"${supabaseLU.supabaseUrl}/storage/v1/object/public/nethive/logos/${negocio.logoUrl}",
|
||||||
|
fit: BoxFit.cover,
|
||||||
|
errorBuilder: (context, error,
|
||||||
|
stackTrace) {
|
||||||
|
return Image.asset(
|
||||||
|
'assets/images/placeholder_no_image.jpg',
|
||||||
|
fit: BoxFit.cover,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: Icon(
|
||||||
|
Icons.store,
|
||||||
|
color: Colors.white,
|
||||||
|
size: 30,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 16),
|
||||||
|
|
||||||
|
// Información principal
|
||||||
|
Expanded(
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment:
|
||||||
|
CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
negocio.nombre,
|
||||||
|
style: TextStyle(
|
||||||
|
color: AppTheme.of(context)
|
||||||
|
.primaryText,
|
||||||
|
fontSize: 20,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
letterSpacing: 0.5,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 4),
|
||||||
|
Container(
|
||||||
|
padding: const EdgeInsets.symmetric(
|
||||||
|
horizontal: 12,
|
||||||
|
vertical: 4,
|
||||||
|
),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: AppTheme.of(context)
|
||||||
|
.primaryColor
|
||||||
|
.withOpacity(0.2),
|
||||||
|
borderRadius:
|
||||||
|
BorderRadius.circular(15),
|
||||||
|
border: Border.all(
|
||||||
|
color: AppTheme.of(context)
|
||||||
|
.primaryColor
|
||||||
|
.withOpacity(0.4),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
child: Text(
|
||||||
|
negocio.tipoLocal.isNotEmpty
|
||||||
|
? negocio.tipoLocal
|
||||||
|
: 'Sucursal',
|
||||||
|
style: TextStyle(
|
||||||
|
color: AppTheme.of(context)
|
||||||
|
.primaryColor,
|
||||||
|
fontSize: 12,
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
|
||||||
|
// Botón de acciones
|
||||||
|
PopupMenuButton<String>(
|
||||||
|
icon: Icon(
|
||||||
|
Icons.more_vert,
|
||||||
|
color:
|
||||||
|
AppTheme.of(context).secondaryText,
|
||||||
|
),
|
||||||
|
color: AppTheme.of(context)
|
||||||
|
.secondaryBackground,
|
||||||
|
onSelected: (value) {
|
||||||
|
_handleMenuAction(
|
||||||
|
context, value, negocio);
|
||||||
|
},
|
||||||
|
itemBuilder: (context) => [
|
||||||
|
PopupMenuItem(
|
||||||
|
value: 'edit',
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Icon(Icons.edit,
|
||||||
|
color: AppTheme.of(context)
|
||||||
|
.primaryColor),
|
||||||
|
const SizedBox(width: 8),
|
||||||
|
Text(
|
||||||
|
'Editar',
|
||||||
|
style: TextStyle(
|
||||||
|
color: AppTheme.of(context)
|
||||||
|
.primaryText),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
PopupMenuItem(
|
||||||
|
value: 'components',
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Icon(Icons.inventory_2,
|
||||||
|
color: Colors.orange),
|
||||||
|
const SizedBox(width: 8),
|
||||||
|
Text(
|
||||||
|
'Ver Componentes',
|
||||||
|
style: TextStyle(
|
||||||
|
color: AppTheme.of(context)
|
||||||
|
.primaryText),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
PopupMenuItem(
|
||||||
|
value: 'delete',
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Icon(Icons.delete,
|
||||||
|
color: Colors.red),
|
||||||
|
const SizedBox(width: 8),
|
||||||
|
Text(
|
||||||
|
'Eliminar',
|
||||||
|
style: TextStyle(
|
||||||
|
color: AppTheme.of(context)
|
||||||
|
.primaryText),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
|
||||||
|
const SizedBox(height: 16),
|
||||||
|
|
||||||
|
// Información de ubicación
|
||||||
|
Container(
|
||||||
|
padding: const EdgeInsets.all(16),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: AppTheme.of(context)
|
||||||
|
.primaryBackground
|
||||||
|
.withOpacity(0.5),
|
||||||
|
borderRadius: BorderRadius.circular(12),
|
||||||
|
border: Border.all(
|
||||||
|
color: AppTheme.of(context)
|
||||||
|
.primaryColor
|
||||||
|
.withOpacity(0.2),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment:
|
||||||
|
CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Icon(
|
||||||
|
Icons.location_on,
|
||||||
|
color: AppTheme.of(context)
|
||||||
|
.primaryColor,
|
||||||
|
size: 18,
|
||||||
|
),
|
||||||
|
const SizedBox(width: 8),
|
||||||
|
Text(
|
||||||
|
'Ubicación',
|
||||||
|
style: TextStyle(
|
||||||
|
color: AppTheme.of(context)
|
||||||
|
.primaryColor,
|
||||||
|
fontSize: 14,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
const SizedBox(height: 8),
|
||||||
|
Text(
|
||||||
|
negocio.direccion.isNotEmpty
|
||||||
|
? negocio.direccion
|
||||||
|
: 'Sin dirección',
|
||||||
|
style: TextStyle(
|
||||||
|
color:
|
||||||
|
AppTheme.of(context).primaryText,
|
||||||
|
fontSize: 14,
|
||||||
|
height: 1.4,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
|
||||||
|
const SizedBox(height: 12),
|
||||||
|
|
||||||
|
// Coordenadas y estadísticas
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: _buildInfoChip(
|
||||||
|
context,
|
||||||
|
icon: Icons.gps_fixed,
|
||||||
|
label: 'Coordenadas',
|
||||||
|
value:
|
||||||
|
'${negocio.latitud.toStringAsFixed(4)}, ${negocio.longitud.toStringAsFixed(4)}',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 12),
|
||||||
|
Expanded(
|
||||||
|
child: _buildInfoChip(
|
||||||
|
context,
|
||||||
|
icon: Icons.people,
|
||||||
|
label: 'Empleados',
|
||||||
|
value: negocio.tipoLocal == 'Sucursal'
|
||||||
|
? '95'
|
||||||
|
: '120',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
|
||||||
|
const SizedBox(height: 12),
|
||||||
|
|
||||||
|
// Fecha de creación
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Icon(
|
||||||
|
Icons.calendar_today,
|
||||||
|
color: AppTheme.of(context).secondaryText,
|
||||||
|
size: 16,
|
||||||
|
),
|
||||||
|
const SizedBox(width: 8),
|
||||||
|
Text(
|
||||||
|
'Creado: ${negocio.fechaCreacion.toString().split(' ')[0]}',
|
||||||
|
style: TextStyle(
|
||||||
|
color:
|
||||||
|
AppTheme.of(context).secondaryText,
|
||||||
|
fontSize: 12,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildInfoChip(
|
||||||
|
BuildContext context, {
|
||||||
|
required IconData icon,
|
||||||
|
required String label,
|
||||||
|
required String value,
|
||||||
|
}) {
|
||||||
|
return Container(
|
||||||
|
padding: const EdgeInsets.all(12),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
gradient: LinearGradient(
|
||||||
|
colors: [
|
||||||
|
AppTheme.of(context).primaryColor.withOpacity(0.1),
|
||||||
|
AppTheme.of(context).tertiaryColor.withOpacity(0.1),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
borderRadius: BorderRadius.circular(12),
|
||||||
|
border: Border.all(
|
||||||
|
color: AppTheme.of(context).primaryColor.withOpacity(0.3),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Icon(
|
||||||
|
icon,
|
||||||
|
color: AppTheme.of(context).primaryColor,
|
||||||
|
size: 16,
|
||||||
|
),
|
||||||
|
const SizedBox(width: 6),
|
||||||
|
Text(
|
||||||
|
label,
|
||||||
|
style: TextStyle(
|
||||||
|
color: AppTheme.of(context).primaryColor,
|
||||||
|
fontSize: 12,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
const SizedBox(height: 4),
|
||||||
|
Text(
|
||||||
|
value,
|
||||||
|
style: TextStyle(
|
||||||
|
color: AppTheme.of(context).primaryText,
|
||||||
|
fontSize: 12,
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildEmptyState(BuildContext context) {
|
||||||
|
return Center(
|
||||||
|
child: Container(
|
||||||
|
padding: const EdgeInsets.all(40),
|
||||||
|
margin: const EdgeInsets.all(20),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
gradient: AppTheme.of(context).primaryGradient,
|
||||||
|
borderRadius: BorderRadius.circular(20),
|
||||||
|
boxShadow: [
|
||||||
|
BoxShadow(
|
||||||
|
color: AppTheme.of(context).primaryColor.withOpacity(0.3),
|
||||||
|
blurRadius: 20,
|
||||||
|
offset: const Offset(0, 10),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
child: Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
Icon(
|
||||||
|
Icons.business_center,
|
||||||
|
size: 60,
|
||||||
|
color: Colors.white,
|
||||||
|
),
|
||||||
|
const SizedBox(height: 16),
|
||||||
|
Text(
|
||||||
|
'Selecciona una empresa',
|
||||||
|
style: const TextStyle(
|
||||||
|
color: Colors.white,
|
||||||
|
fontSize: 20,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 8),
|
||||||
|
Text(
|
||||||
|
'Toca el botón de empresas para seleccionar una y ver sus sucursales',
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.white.withOpacity(0.9),
|
||||||
|
fontSize: 14,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildNoDataState(BuildContext context) {
|
||||||
|
return Center(
|
||||||
|
child: Container(
|
||||||
|
padding: const EdgeInsets.all(40),
|
||||||
|
margin: const EdgeInsets.all(20),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: AppTheme.of(context).secondaryBackground,
|
||||||
|
borderRadius: BorderRadius.circular(20),
|
||||||
|
border: Border.all(
|
||||||
|
color: AppTheme.of(context).primaryColor.withOpacity(0.3),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
child: Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
Icon(
|
||||||
|
Icons.store_mall_directory,
|
||||||
|
size: 60,
|
||||||
|
color: AppTheme.of(context).secondaryText,
|
||||||
|
),
|
||||||
|
const SizedBox(height: 16),
|
||||||
|
Text(
|
||||||
|
'Sin sucursales',
|
||||||
|
style: TextStyle(
|
||||||
|
color: AppTheme.of(context).primaryText,
|
||||||
|
fontSize: 20,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 8),
|
||||||
|
Text(
|
||||||
|
'Esta empresa aún no tiene sucursales registradas',
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: TextStyle(
|
||||||
|
color: AppTheme.of(context).secondaryText,
|
||||||
|
fontSize: 14,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void _showNegocioDetails(BuildContext context, dynamic negocio) {
|
||||||
|
showModalBottomSheet(
|
||||||
|
context: context,
|
||||||
|
isScrollControlled: true,
|
||||||
|
backgroundColor: Colors.transparent,
|
||||||
|
builder: (context) => DraggableScrollableSheet(
|
||||||
|
initialChildSize: 0.6,
|
||||||
|
maxChildSize: 0.9,
|
||||||
|
minChildSize: 0.3,
|
||||||
|
builder: (context, scrollController) => Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: AppTheme.of(context).primaryBackground,
|
||||||
|
borderRadius: const BorderRadius.only(
|
||||||
|
topLeft: Radius.circular(25),
|
||||||
|
topRight: Radius.circular(25),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
// Handle
|
||||||
|
Container(
|
||||||
|
margin: const EdgeInsets.symmetric(vertical: 10),
|
||||||
|
width: 40,
|
||||||
|
height: 4,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: AppTheme.of(context).secondaryText,
|
||||||
|
borderRadius: BorderRadius.circular(2),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
// Contenido del modal
|
||||||
|
Expanded(
|
||||||
|
child: SingleChildScrollView(
|
||||||
|
controller: scrollController,
|
||||||
|
padding: const EdgeInsets.all(20),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
'Detalles de la Sucursal',
|
||||||
|
style: TextStyle(
|
||||||
|
color: AppTheme.of(context).primaryText,
|
||||||
|
fontSize: 24,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 20),
|
||||||
|
// Aquí puedes agregar más detalles específicos
|
||||||
|
Text(
|
||||||
|
'Información adicional de ${negocio.nombre}',
|
||||||
|
style: TextStyle(
|
||||||
|
color: AppTheme.of(context).secondaryText,
|
||||||
|
fontSize: 16,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void _handleMenuAction(BuildContext context, String action, dynamic negocio) {
|
||||||
|
switch (action) {
|
||||||
|
case 'edit':
|
||||||
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
|
const SnackBar(content: Text('Función de edición próximamente')),
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
case 'components':
|
||||||
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
|
SnackBar(content: Text('Ver componentes de ${negocio.nombre}')),
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
case 'delete':
|
||||||
|
_showDeleteDialog(context, negocio);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void _showDeleteDialog(BuildContext context, dynamic negocio) {
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (context) => AlertDialog(
|
||||||
|
backgroundColor: AppTheme.of(context).primaryBackground,
|
||||||
|
title: Text(
|
||||||
|
'Confirmar eliminación',
|
||||||
|
style: TextStyle(color: AppTheme.of(context).primaryText),
|
||||||
|
),
|
||||||
|
content: Text(
|
||||||
|
'¿Estás seguro de que deseas eliminar la sucursal "${negocio.nombre}"?',
|
||||||
|
style: TextStyle(color: AppTheme.of(context).secondaryText),
|
||||||
|
),
|
||||||
|
actions: [
|
||||||
|
TextButton(
|
||||||
|
onPressed: () => Navigator.pop(context),
|
||||||
|
child: Text(
|
||||||
|
'Cancelar',
|
||||||
|
style: TextStyle(color: AppTheme.of(context).secondaryText),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
TextButton(
|
||||||
|
onPressed: () async {
|
||||||
|
Navigator.pop(context);
|
||||||
|
final success = await provider.eliminarNegocio(negocio.id);
|
||||||
|
if (context.mounted) {
|
||||||
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
|
SnackBar(
|
||||||
|
content: Text(
|
||||||
|
success
|
||||||
|
? 'Sucursal eliminada correctamente'
|
||||||
|
: 'Error al eliminar la sucursal',
|
||||||
|
),
|
||||||
|
backgroundColor: success ? Colors.green : Colors.red,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
child: const Text(
|
||||||
|
'Eliminar',
|
||||||
|
style: TextStyle(color: Colors.red),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -161,9 +161,10 @@ class EmpresasNegociosProvider extends ChangeNotifier {
|
|||||||
|
|
||||||
logoFileName = 'logo-$timestamp-${picker.files.single.name}';
|
logoFileName = 'logo-$timestamp-${picker.files.single.name}';
|
||||||
logoToUpload = picker.files.single.bytes;
|
logoToUpload = picker.files.single.bytes;
|
||||||
}
|
|
||||||
|
|
||||||
notifyListeners();
|
// Notificar inmediatamente después de seleccionar
|
||||||
|
notifyListeners();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> selectImagen() async {
|
Future<void> selectImagen() async {
|
||||||
@@ -182,9 +183,10 @@ class EmpresasNegociosProvider extends ChangeNotifier {
|
|||||||
|
|
||||||
imagenFileName = 'imagen-$timestamp-${picker.files.single.name}';
|
imagenFileName = 'imagen-$timestamp-${picker.files.single.name}';
|
||||||
imagenToUpload = picker.files.single.bytes;
|
imagenToUpload = picker.files.single.bytes;
|
||||||
}
|
|
||||||
|
|
||||||
notifyListeners();
|
// Notificar inmediatamente después de seleccionar
|
||||||
|
notifyListeners();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<String?> uploadLogo() async {
|
Future<String?> uploadLogo() async {
|
||||||
|
|||||||
@@ -135,39 +135,40 @@ abstract class AppTheme {
|
|||||||
|
|
||||||
class LightModeTheme extends AppTheme {
|
class LightModeTheme extends AppTheme {
|
||||||
@override
|
@override
|
||||||
Color primaryColor = const Color(0xFF3B82F6); // Azul brillante del login
|
Color primaryColor = const Color(0xFF10B981); // Verde esmeralda principal
|
||||||
@override
|
@override
|
||||||
Color secondaryColor = const Color(0xFF10B981); // Verde esmeralda del login
|
Color secondaryColor = const Color(0xFF059669); // Verde más oscuro
|
||||||
@override
|
@override
|
||||||
Color tertiaryColor = const Color(0xFF0369A1); // Azul medio del login
|
Color tertiaryColor = const Color(0xFF0D9488); // Verde azulado
|
||||||
@override
|
@override
|
||||||
Color alternate = const Color(0xFF7C3AED); // Púrpura del login
|
Color alternate = const Color(0xFF3B82F6); // Azul de acento
|
||||||
@override
|
@override
|
||||||
Color primaryBackground = const Color(0xFFFFFFFF);
|
Color primaryBackground = const Color(0xFF0F172A); // Fondo muy oscuro
|
||||||
@override
|
@override
|
||||||
Color secondaryBackground = const Color(0xFFF8FAFC); // Gris muy claro
|
Color secondaryBackground =
|
||||||
|
const Color(0xFF1E293B); // Fondo secundario oscuro
|
||||||
@override
|
@override
|
||||||
Color tertiaryBackground = const Color(0xFFF1F5F9); // Gris claro azulado
|
Color tertiaryBackground = const Color(0xFF334155); // Fondo terciario
|
||||||
@override
|
@override
|
||||||
Color transparentBackground =
|
Color transparentBackground =
|
||||||
const Color(0xFF1E293B).withOpacity(.1); // Azul oscuro transparente
|
const Color(0xFF1E293B).withOpacity(.1); // Fondo transparente
|
||||||
@override
|
@override
|
||||||
Color primaryText = const Color(0xFF0F172A); // Azul muy oscuro del login
|
Color primaryText = const Color(0xFFFFFFFF); // Texto blanco
|
||||||
@override
|
@override
|
||||||
Color secondaryText = const Color(0xFF1E293B); // Azul oscuro
|
Color secondaryText = const Color(0xFF94A3B8); // Texto gris claro
|
||||||
@override
|
@override
|
||||||
Color tertiaryText = const Color(0xFF64748B); // Gris azulado
|
Color tertiaryText = const Color(0xFF64748B); // Texto gris medio
|
||||||
@override
|
@override
|
||||||
Color hintText = const Color(0xFF94A3B8); // Gris claro
|
Color hintText = const Color(0xFF475569); // Texto de sugerencia
|
||||||
@override
|
@override
|
||||||
Color error = const Color(0xFFEF4444); // Rojo moderno
|
Color error = const Color(0xFFEF4444); // Rojo para errores
|
||||||
@override
|
@override
|
||||||
Color warning = const Color(0xFFF59E0B); // Amarillo moderno
|
Color warning = const Color(0xFFF59E0B); // Amarillo para advertencias
|
||||||
@override
|
@override
|
||||||
Color success = const Color(0xFF10B981); // Verde esmeralda del login
|
Color success = const Color(0xFF10B981); // Verde para éxito
|
||||||
@override
|
@override
|
||||||
Color formBackground =
|
Color formBackground =
|
||||||
const Color(0xFF3B82F6).withOpacity(.05); // Azul muy claro
|
const Color(0xFF10B981).withOpacity(.05); // Fondo de formularios
|
||||||
|
|
||||||
LightModeTheme({Mode? mode}) {
|
LightModeTheme({Mode? mode}) {
|
||||||
if (mode != null) {
|
if (mode != null) {
|
||||||
@@ -182,40 +183,68 @@ class LightModeTheme extends AppTheme {
|
|||||||
|
|
||||||
class DarkModeTheme extends AppTheme {
|
class DarkModeTheme extends AppTheme {
|
||||||
@override
|
@override
|
||||||
Color primaryColor = const Color(0xFF3B82F6); // Azul brillante del login
|
Color primaryColor = const Color(0xFF10B981); // Verde esmeralda principal
|
||||||
@override
|
@override
|
||||||
Color secondaryColor = const Color(0xFF10B981); // Verde esmeralda del login
|
Color secondaryColor = const Color(0xFF059669); // Verde más oscuro
|
||||||
@override
|
@override
|
||||||
Color tertiaryColor = const Color(0xFF0369A1); // Azul medio del login
|
Color tertiaryColor = const Color(0xFF0D9488); // Verde azulado
|
||||||
@override
|
@override
|
||||||
Color alternate = const Color(0xFF7C3AED); // Púrpura del login
|
Color alternate = const Color(0xFF3B82F6); // Azul de acento
|
||||||
@override
|
@override
|
||||||
Color primaryBackground =
|
Color primaryBackground = const Color(0xFF0F172A); // Fondo muy oscuro
|
||||||
const Color(0xFF0F172A); // Azul muy oscuro del login
|
|
||||||
@override
|
@override
|
||||||
Color secondaryBackground = const Color(0xFF1E293B); // Azul oscuro del login
|
Color secondaryBackground =
|
||||||
|
const Color(0xFF1E293B); // Fondo secundario oscuro
|
||||||
@override
|
@override
|
||||||
Color tertiaryBackground = const Color(0xFF334155); // Azul gris
|
Color tertiaryBackground = const Color(0xFF334155); // Fondo terciario
|
||||||
@override
|
@override
|
||||||
Color transparentBackground =
|
Color transparentBackground =
|
||||||
const Color(0xFF1E293B).withOpacity(.3); // Azul oscuro transparente
|
const Color(0xFF1E293B).withOpacity(.3); // Fondo transparente
|
||||||
@override
|
@override
|
||||||
Color primaryText = const Color(0xFFFFFFFF); // Blanco para contraste
|
Color primaryText = const Color(0xFFFFFFFF); // Texto blanco
|
||||||
@override
|
@override
|
||||||
Color secondaryText = const Color(0xFFF1F5F9); // Gris muy claro
|
Color secondaryText = const Color(0xFF94A3B8); // Texto gris claro
|
||||||
@override
|
@override
|
||||||
Color tertiaryText = const Color(0xFF94A3B8); // Gris azulado claro
|
Color tertiaryText = const Color(0xFF64748B); // Texto gris medio
|
||||||
@override
|
@override
|
||||||
Color hintText = const Color(0xFF64748B); // Gris medio
|
Color hintText = const Color(0xFF475569); // Texto de sugerencia
|
||||||
@override
|
@override
|
||||||
Color error = const Color(0xFFEF4444); // Rojo moderno
|
Color error = const Color(0xFFEF4444); // Rojo para errores
|
||||||
@override
|
@override
|
||||||
Color warning = const Color(0xFFF59E0B); // Amarillo moderno
|
Color warning = const Color(0xFFF59E0B); // Amarillo para advertencias
|
||||||
@override
|
@override
|
||||||
Color success = const Color(0xFF10B981); // Verde esmeralda del login
|
Color success = const Color(0xFF10B981); // Verde para éxito
|
||||||
@override
|
@override
|
||||||
Color formBackground =
|
Color formBackground =
|
||||||
const Color(0xFF3B82F6).withOpacity(.1); // Azul transparente
|
const Color(0xFF10B981).withOpacity(.1); // Fondo de formularios
|
||||||
|
|
||||||
|
// Nuevos gradientes modernos
|
||||||
|
LinearGradient get primaryGradient => LinearGradient(
|
||||||
|
begin: Alignment.topLeft,
|
||||||
|
end: Alignment.bottomRight,
|
||||||
|
colors: [
|
||||||
|
primaryColor,
|
||||||
|
secondaryColor,
|
||||||
|
],
|
||||||
|
);
|
||||||
|
|
||||||
|
LinearGradient get modernGradient => LinearGradient(
|
||||||
|
begin: Alignment.topLeft,
|
||||||
|
end: Alignment.bottomRight,
|
||||||
|
colors: [
|
||||||
|
tertiaryColor,
|
||||||
|
primaryColor,
|
||||||
|
],
|
||||||
|
);
|
||||||
|
|
||||||
|
LinearGradient get darkBackgroundGradient => LinearGradient(
|
||||||
|
begin: Alignment.topCenter,
|
||||||
|
end: Alignment.bottomCenter,
|
||||||
|
colors: [
|
||||||
|
primaryBackground,
|
||||||
|
secondaryBackground,
|
||||||
|
],
|
||||||
|
);
|
||||||
|
|
||||||
DarkModeTheme({Mode? mode}) {
|
DarkModeTheme({Mode? mode}) {
|
||||||
if (mode != null) {
|
if (mode != null) {
|
||||||
|
|||||||
Reference in New Issue
Block a user