mirror of
				https://github.com/johrpan/musicus_mobile.git
				synced 2025-10-26 18:57:25 +01:00 
			
		
		
		
	Remove tracks from recording editor
The tracks will not be part of the recording entity. Instead, they will be managed outside the database alongside the corresponding audio files.
This commit is contained in:
		
							parent
							
								
									8f0463a1a1
								
							
						
					
					
						commit
						9bece557c7
					
				
					 1 changed files with 0 additions and 52 deletions
				
			
		|  | @ -1,20 +1,10 @@ | |||
| import 'package:flutter/material.dart'; | ||||
| import 'package:path/path.dart' as pth; | ||||
| 
 | ||||
| import '../backend.dart'; | ||||
| import '../database.dart'; | ||||
| import '../selectors/files.dart'; | ||||
| import '../selectors/performer.dart'; | ||||
| import '../selectors/work.dart'; | ||||
| 
 | ||||
| class TrackModel { | ||||
|   final String path; | ||||
| 
 | ||||
|   TrackModel({ | ||||
|     this.path, | ||||
|   }); | ||||
| } | ||||
| 
 | ||||
| class RecordingEditor extends StatefulWidget { | ||||
|   final Recording recording; | ||||
| 
 | ||||
|  | @ -29,7 +19,6 @@ class RecordingEditor extends StatefulWidget { | |||
| class _RecordingEditorState extends State<RecordingEditor> { | ||||
|   Work work; | ||||
|   List<PerformanceModel> performances = []; | ||||
|   List<TrackModel> tracks = []; | ||||
| 
 | ||||
|   @override | ||||
|   void initState() { | ||||
|  | @ -141,47 +130,6 @@ class _RecordingEditorState extends State<RecordingEditor> { | |||
|                 }, | ||||
|               ), | ||||
|             ), | ||||
|           ListTile( | ||||
|             title: Text('Tracks'), | ||||
|             trailing: IconButton( | ||||
|               icon: const Icon(Icons.add), | ||||
|               onPressed: () async { | ||||
|                 final paths = await Navigator.push<Set<String>>( | ||||
|                   context, | ||||
|                   MaterialPageRoute( | ||||
|                     builder: (context) => FilesSelector( | ||||
|                       baseDirectory: backend.musicLibraryPath, | ||||
|                     ), | ||||
|                     fullscreenDialog: true, | ||||
|                   ), | ||||
|                 ); | ||||
| 
 | ||||
|                 if (paths != null) { | ||||
|                   setState(() { | ||||
|                     for (final path in paths) { | ||||
|                       final relPath = | ||||
|                           pth.relative(path, from: backend.musicLibraryPath); | ||||
|                       tracks.add(TrackModel( | ||||
|                         path: relPath, | ||||
|                       )); | ||||
|                     } | ||||
|                   }); | ||||
|                 } | ||||
|               }, | ||||
|             ), | ||||
|           ), | ||||
|           for (final track in tracks) | ||||
|             ListTile( | ||||
|               title: Text(track.path), | ||||
|               trailing: IconButton( | ||||
|                 icon: const Icon(Icons.delete), | ||||
|                 onPressed: () { | ||||
|                   setState(() { | ||||
|                     tracks.remove(track); | ||||
|                   }); | ||||
|                 }, | ||||
|               ), | ||||
|             ), | ||||
|         ], | ||||
|       ), | ||||
|     ); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Elias Projahn
						Elias Projahn