initial pages for admin users
parent
ee6e881fbf
commit
a2eb8d6877
|
|
@ -0,0 +1,46 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:pcastlivetv/stores/login_store.dart';
|
||||
import 'package:velocity_x/velocity_x.dart';
|
||||
|
||||
class NcUserInfo extends StatelessWidget {
|
||||
const NcUserInfo({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
LoginStore store = VxState.store as LoginStore;
|
||||
|
||||
return Card(
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(10),
|
||||
child: Row(
|
||||
children: [
|
||||
const SizedBox(width: 10),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
store.userName!,
|
||||
style: const TextStyle(
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
store.userType! == 'A'
|
||||
? 'Administrador'
|
||||
: store.userType! == 'R'
|
||||
? 'Revendedor'
|
||||
: 'User',
|
||||
style: const TextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w300,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,20 +1,107 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:pcastlivetv/components/nc_base_page.dart';
|
||||
import 'package:pcastlivetv/components/nc_user_info.dart';
|
||||
import 'package:pcastlivetv/views/admin/servers_view.dart';
|
||||
import 'package:pcastlivetv/views/admin/users_view.dart';
|
||||
import 'package:velocity_x/velocity_x.dart';
|
||||
|
||||
class AdminPage extends StatelessWidget {
|
||||
import '../stores/login_store.dart';
|
||||
|
||||
class AdminPage extends StatefulWidget {
|
||||
const AdminPage({super.key});
|
||||
@override
|
||||
State<StatefulWidget> createState() => AdminPageState();
|
||||
}
|
||||
|
||||
class AdminPageState extends State<AdminPage> {
|
||||
LoginStore store = VxState.store as LoginStore;
|
||||
|
||||
int _selectedIndex = 0;
|
||||
List<NavigationRailDestination> items = [];
|
||||
List<Widget> views = [];
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return const NcBasePage(
|
||||
body: Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text("Admin Page"),
|
||||
],
|
||||
),
|
||||
VxState.watch(context, on: [AuthLogged]);
|
||||
|
||||
getViews();
|
||||
|
||||
getItems();
|
||||
|
||||
return Scaffold(
|
||||
body: Row(
|
||||
children: [
|
||||
NavigationRail(
|
||||
selectedIndex: _selectedIndex,
|
||||
elevation: 20,
|
||||
extended: true,
|
||||
selectedIconTheme: const IconThemeData(color: Colors.white, size: 32),
|
||||
unselectedIconTheme: const IconThemeData(color: Colors.white, size: 32),
|
||||
backgroundColor: Colors.grey[600],
|
||||
labelType: NavigationRailLabelType.none,
|
||||
useIndicator: false,
|
||||
selectedLabelTextStyle: const TextStyle(color: Colors.white),
|
||||
unselectedLabelTextStyle: const TextStyle(color: Colors.white),
|
||||
leading: const NcUserInfo(),
|
||||
destinations: items,
|
||||
onDestinationSelected: (int index) {
|
||||
setState(() {
|
||||
_selectedIndex = index;
|
||||
});
|
||||
},
|
||||
),
|
||||
Expanded(
|
||||
child: views[_selectedIndex],
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
getItems() {
|
||||
// if (store.isLogged) {
|
||||
setState(() {
|
||||
items = [
|
||||
const NavigationRailDestination(icon: Icon(Icons.computer, color: Colors.white), label: Text('Servers')),
|
||||
const NavigationRailDestination(icon: Icon(Icons.verified_user, color: Colors.white), label: Text('Users')),
|
||||
const NavigationRailDestination(icon: Icon(Icons.settings, color: Colors.white), label: Text('Settings')),
|
||||
const NavigationRailDestination(icon: Icon(Icons.logout, color: Colors.white), label: Text('Logout')),
|
||||
];
|
||||
});
|
||||
// }
|
||||
}
|
||||
|
||||
getViews() {
|
||||
// if (store.isLogged) {
|
||||
setState(() {
|
||||
views = [
|
||||
const ServersView(),
|
||||
const UsersView(),
|
||||
Container(
|
||||
color: const Color.fromRGBO(166, 0, 249, 1),
|
||||
child: const Center(
|
||||
child: Text(
|
||||
'Settings',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 24,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
color: const Color.fromRGBO(166, 0, 249, 1),
|
||||
child: const Center(
|
||||
child: Text(
|
||||
'Logout',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 24,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
];
|
||||
});
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,26 @@
|
|||
import 'package:flutter/material.dart';
|
||||
|
||||
class ServersView extends StatefulWidget {
|
||||
const ServersView({super.key});
|
||||
|
||||
@override
|
||||
State<ServersView> createState() => _ServersViewState();
|
||||
}
|
||||
|
||||
class _ServersViewState extends State<ServersView> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
color: const Color.fromRGBO(166, 0, 249, 1),
|
||||
child: const Center(
|
||||
child: Text(
|
||||
'Servers',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 24,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
import 'package:flutter/material.dart';
|
||||
|
||||
class UsersView extends StatefulWidget {
|
||||
const UsersView({super.key});
|
||||
|
||||
@override
|
||||
State<UsersView> createState() => _UsersViewState();
|
||||
}
|
||||
|
||||
class _UsersViewState extends State<UsersView> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
color: const Color.fromRGBO(166, 0, 249, 1),
|
||||
child: const Center(
|
||||
child: Text(
|
||||
'Users',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 24,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue