changes
This commit is contained in:
@@ -8,10 +8,15 @@ import '../blocs/organization/organization_bloc.dart';
|
|||||||
import '../blocs/organization/organization_event.dart';
|
import '../blocs/organization/organization_event.dart';
|
||||||
import '../blocs/file_browser/file_browser_bloc.dart';
|
import '../blocs/file_browser/file_browser_bloc.dart';
|
||||||
import '../blocs/file_browser/file_browser_event.dart';
|
import '../blocs/file_browser/file_browser_event.dart';
|
||||||
|
import '../blocs/permission/permission_bloc.dart';
|
||||||
|
import '../blocs/upload/upload_bloc.dart';
|
||||||
|
import '../repositories/file_repository.dart';
|
||||||
|
import '../services/file_service.dart';
|
||||||
import '../theme/app_theme.dart';
|
import '../theme/app_theme.dart';
|
||||||
import '../theme/modern_glass_button.dart';
|
import '../theme/modern_glass_button.dart';
|
||||||
import 'login_form.dart' show LoginForm;
|
import 'login_form.dart' show LoginForm;
|
||||||
import 'file_explorer.dart';
|
import 'file_explorer.dart';
|
||||||
|
import '../injection.dart';
|
||||||
|
|
||||||
class HomePage extends StatefulWidget {
|
class HomePage extends StatefulWidget {
|
||||||
const HomePage({super.key});
|
const HomePage({super.key});
|
||||||
@@ -191,15 +196,30 @@ class _HomePageState extends State<HomePage> with TickerProviderStateMixin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildDrive(OrganizationState state, AuthState authState) {
|
Widget _buildDrive(OrganizationState state, AuthState authState) {
|
||||||
|
String orgId;
|
||||||
if (state is OrganizationLoaded && state.selectedOrg != null) {
|
if (state is OrganizationLoaded && state.selectedOrg != null) {
|
||||||
// Show selected organization's files
|
// Show selected organization's files
|
||||||
return FileExplorer(orgId: state.selectedOrg!.id);
|
orgId = state.selectedOrg!.id;
|
||||||
} else if (authState is AuthAuthenticated) {
|
} else if (authState is AuthAuthenticated) {
|
||||||
// Show personal workspace using user's email as workspace ID
|
// Show personal workspace using user's email as workspace ID
|
||||||
return FileExplorer(orgId: authState.email);
|
orgId = authState.email;
|
||||||
} else {
|
} else {
|
||||||
return const FileExplorer(orgId: 'personal');
|
orgId = 'personal';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Wrap FileExplorer with required BlocProviders
|
||||||
|
return MultiBlocProvider(
|
||||||
|
providers: [
|
||||||
|
BlocProvider<FileBrowserBloc>(
|
||||||
|
create: (context) => FileBrowserBloc(getIt<FileService>()),
|
||||||
|
),
|
||||||
|
BlocProvider<PermissionBloc>(create: (context) => PermissionBloc()),
|
||||||
|
BlocProvider<UploadBloc>(
|
||||||
|
create: (context) => UploadBloc(getIt<FileRepository>()),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
child: FileExplorer(orgId: orgId),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildNavButton(String label, IconData icon, {bool isAvatar = false}) {
|
Widget _buildNavButton(String label, IconData icon, {bool isAvatar = false}) {
|
||||||
|
|||||||
Reference in New Issue
Block a user