feat(chart): interactive zoom/pan controls, pattern overlays, predictions, individual pattern filtering and landscape fullscreen mode
This commit is contained in:
@@ -15,5 +15,32 @@ class AssetTechnicalBloc extends Bloc<AssetTechnicalEvent, AssetTechnicalState>
|
||||
emit(AssetTechnicalError(e.toString()));
|
||||
}
|
||||
});
|
||||
|
||||
on<TogglePatternFilter>((event, emit) {
|
||||
if (state is AssetTechnicalLoaded) {
|
||||
final current = state as AssetTechnicalLoaded;
|
||||
final updated = Set<int>.from(current.disabledPatternIndices);
|
||||
if (event.enabled) {
|
||||
updated.remove(event.patternIndex);
|
||||
} else {
|
||||
updated.add(event.patternIndex);
|
||||
}
|
||||
emit(current.copyWith(disabledPatternIndices: updated));
|
||||
}
|
||||
});
|
||||
|
||||
on<ToggleIndicatorFilter>((event, emit) {
|
||||
if (state is AssetTechnicalLoaded) {
|
||||
final current = state as AssetTechnicalLoaded;
|
||||
emit(current.copyWith(
|
||||
showSma50: event.showSma50,
|
||||
showSma200: event.showSma200,
|
||||
showEma: event.showEma,
|
||||
showSupertrend: event.showSupertrend,
|
||||
showPatterns: event.showPatterns,
|
||||
showSignals: event.showSignals,
|
||||
));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,32 @@
|
||||
abstract class AssetTechnicalEvent {}
|
||||
|
||||
class LoadAssetTechnical extends AssetTechnicalEvent {
|
||||
final String isin;
|
||||
final bool forceRefresh;
|
||||
final String? ticker;
|
||||
LoadAssetTechnical(this.isin, {this.forceRefresh = false, this.ticker});
|
||||
}
|
||||
|
||||
class TogglePatternFilter extends AssetTechnicalEvent {
|
||||
final int patternIndex;
|
||||
final bool enabled;
|
||||
TogglePatternFilter({required this.patternIndex, required this.enabled});
|
||||
}
|
||||
|
||||
class ToggleIndicatorFilter extends AssetTechnicalEvent {
|
||||
final bool? showSma50;
|
||||
final bool? showSma200;
|
||||
final bool? showEma;
|
||||
final bool? showSupertrend;
|
||||
final bool? showPatterns;
|
||||
final bool? showSignals;
|
||||
|
||||
ToggleIndicatorFilter({
|
||||
this.showSma50,
|
||||
this.showSma200,
|
||||
this.showEma,
|
||||
this.showSupertrend,
|
||||
this.showPatterns,
|
||||
this.showSignals,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,12 +1,55 @@
|
||||
import '../../models/technical_analysis_model.dart';
|
||||
|
||||
abstract class AssetTechnicalState {}
|
||||
|
||||
class AssetTechnicalInitial extends AssetTechnicalState {}
|
||||
|
||||
class AssetTechnicalLoading extends AssetTechnicalState {}
|
||||
|
||||
class AssetTechnicalLoaded extends AssetTechnicalState {
|
||||
final TechnicalAnalysisModel? data;
|
||||
AssetTechnicalLoaded(this.data);
|
||||
final Set<int> disabledPatternIndices;
|
||||
final bool showSma50;
|
||||
final bool showSma200;
|
||||
final bool showEma;
|
||||
final bool showSupertrend;
|
||||
final bool showPatterns;
|
||||
final bool showSignals;
|
||||
|
||||
AssetTechnicalLoaded(
|
||||
this.data, {
|
||||
this.disabledPatternIndices = const {},
|
||||
this.showSma50 = true,
|
||||
this.showSma200 = true,
|
||||
this.showEma = true,
|
||||
this.showSupertrend = true,
|
||||
this.showPatterns = true,
|
||||
this.showSignals = true,
|
||||
});
|
||||
|
||||
AssetTechnicalLoaded copyWith({
|
||||
TechnicalAnalysisModel? data,
|
||||
Set<int>? disabledPatternIndices,
|
||||
bool? showSma50,
|
||||
bool? showSma200,
|
||||
bool? showEma,
|
||||
bool? showSupertrend,
|
||||
bool? showPatterns,
|
||||
bool? showSignals,
|
||||
}) {
|
||||
return AssetTechnicalLoaded(
|
||||
data ?? this.data,
|
||||
disabledPatternIndices: disabledPatternIndices ?? this.disabledPatternIndices,
|
||||
showSma50: showSma50 ?? this.showSma50,
|
||||
showSma200: showSma200 ?? this.showSma200,
|
||||
showEma: showEma ?? this.showEma,
|
||||
showSupertrend: showSupertrend ?? this.showSupertrend,
|
||||
showPatterns: showPatterns ?? this.showPatterns,
|
||||
showSignals: showSignals ?? this.showSignals,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class AssetTechnicalError extends AssetTechnicalState {
|
||||
final String message;
|
||||
AssetTechnicalError(this.message);
|
||||
|
||||
Reference in New Issue
Block a user