PACKET v1.0.0 - Initial release
App móvil Flutter para capturar contenido multimedia, etiquetarlo con hashes y enviarlo a backends configurables. Features: - Captura de fotos, audio, video y archivos - Sistema de etiquetas con bibliotecas externas (HST) - Packs de etiquetas predefinidos - Cola de reintentos (hasta 20 contenedores) - Soporte GPS - Hash SHA-256 auto-generado por contenedor - Persistencia SQLite local - Múltiples destinos configurables Stack: Flutter 3.38.5, flutter_bloc, sqflite, dio 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
42
lib/presentation/bloc/packs/packs_cubit.dart
Normal file
42
lib/presentation/bloc/packs/packs_cubit.dart
Normal file
@@ -0,0 +1,42 @@
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:equatable/equatable.dart';
|
||||
import '../../../data/repositories/etiqueta_repository.dart';
|
||||
import '../../../domain/entities/pack.dart';
|
||||
|
||||
class PacksState extends Equatable {
|
||||
final List<Pack> packs;
|
||||
final bool isLoading;
|
||||
|
||||
const PacksState({this.packs = const [], this.isLoading = false});
|
||||
|
||||
PacksState copyWith({List<Pack>? packs, bool? isLoading}) => PacksState(
|
||||
packs: packs ?? this.packs,
|
||||
isLoading: isLoading ?? this.isLoading,
|
||||
);
|
||||
|
||||
@override
|
||||
List<Object?> get props => [packs, isLoading];
|
||||
}
|
||||
|
||||
class PacksCubit extends Cubit<PacksState> {
|
||||
final EtiquetaRepository _repo = EtiquetaRepository();
|
||||
|
||||
PacksCubit() : super(const PacksState());
|
||||
|
||||
Future<void> load() async {
|
||||
emit(state.copyWith(isLoading: true));
|
||||
final packs = await _repo.getPacks();
|
||||
emit(state.copyWith(packs: packs, isLoading: false));
|
||||
}
|
||||
|
||||
Future<void> addPack(String nombre, List<String> tags) async {
|
||||
final pack = Pack(nombre: nombre, tags: tags);
|
||||
await _repo.insertPack(pack);
|
||||
await load();
|
||||
}
|
||||
|
||||
Future<void> deletePack(int id) async {
|
||||
await _repo.deletePack(id);
|
||||
await load();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user