Adjust audio player bar positioning and width for improved layout; add authentication token retrieval in file download URL generation
This commit is contained in:
@@ -445,7 +445,7 @@ class _HomePageState extends State<HomePage> with TickerProviderStateMixin {
|
|||||||
_audioFileName != null &&
|
_audioFileName != null &&
|
||||||
_audioFileUrl != null)
|
_audioFileUrl != null)
|
||||||
Positioned(
|
Positioned(
|
||||||
right: -200, // adjust to position next to title
|
right: 120, // Add padding from right edge to avoid overlapping nav buttons
|
||||||
child: SlideTransition(
|
child: SlideTransition(
|
||||||
position: _audioBarOffset,
|
position: _audioBarOffset,
|
||||||
child: AudioPlayerBar(
|
child: AudioPlayerBar(
|
||||||
|
|||||||
@@ -47,6 +47,8 @@ class ApiClient {
|
|||||||
|
|
||||||
String get baseUrl => _dio.options.baseUrl;
|
String get baseUrl => _dio.options.baseUrl;
|
||||||
|
|
||||||
|
String? get currentToken => _getCurrentToken();
|
||||||
|
|
||||||
String? _getCurrentToken() {
|
String? _getCurrentToken() {
|
||||||
// Get from SessionBloc state
|
// Get from SessionBloc state
|
||||||
final state = _sessionBloc.state;
|
final state = _sessionBloc.state;
|
||||||
|
|||||||
@@ -121,10 +121,16 @@ class FileService {
|
|||||||
required String filePath,
|
required String filePath,
|
||||||
String? fileName,
|
String? fileName,
|
||||||
}) async {
|
}) async {
|
||||||
// Return the full download URL
|
// Get authentication token
|
||||||
|
final token = _apiClient.currentToken;
|
||||||
|
if (token == null) {
|
||||||
|
throw Exception('No authentication token available');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return the full download URL with token
|
||||||
final path = orgId.isEmpty
|
final path = orgId.isEmpty
|
||||||
? '/user/files/download?path=${Uri.encodeComponent(filePath)}'
|
? '/user/files/download?path=${Uri.encodeComponent(filePath)}&token=${Uri.encodeComponent(token)}'
|
||||||
: '/orgs/$orgId/files/download?path=${Uri.encodeComponent(filePath)}';
|
: '/orgs/$orgId/files/download?path=${Uri.encodeComponent(filePath)}&token=${Uri.encodeComponent(token)}';
|
||||||
return '$baseUrl$path';
|
return '$baseUrl$path';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -193,7 +193,7 @@ class _AudioPlayerBarState extends State<AudioPlayerBar>
|
|||||||
height: 48,
|
height: 48,
|
||||||
width:
|
width:
|
||||||
MediaQuery.of(context).size.width *
|
MediaQuery.of(context).size.width *
|
||||||
0.25, // Reduce width to 25% for better fit
|
0.30, // Reduce width to 30% for better fit
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 6),
|
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 6),
|
||||||
decoration: AppTheme.glassDecoration.copyWith(
|
decoration: AppTheme.glassDecoration.copyWith(
|
||||||
borderRadius: BorderRadius.circular(16),
|
borderRadius: BorderRadius.circular(16),
|
||||||
|
|||||||
Reference in New Issue
Block a user