feat(App): update Finlytic Flutter app UI and blocs
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'asset_technical_event.dart';
|
||||
import 'asset_technical_state.dart';
|
||||
import '../../repositories/asset_repository.dart';
|
||||
|
||||
class AssetTechnicalBloc extends Bloc<AssetTechnicalEvent, AssetTechnicalState> {
|
||||
final AssetRepository repository;
|
||||
AssetTechnicalBloc({required this.repository}) : super(AssetTechnicalInitial()) {
|
||||
on<LoadAssetTechnical>((event, emit) async {
|
||||
emit(AssetTechnicalLoading());
|
||||
try {
|
||||
final data = await repository.getAssetTechnical(event.isin, event.forceRefresh, ticker: event.ticker);
|
||||
emit(AssetTechnicalLoaded(data));
|
||||
} catch (e) {
|
||||
emit(AssetTechnicalError(e.toString()));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
abstract class AssetTechnicalEvent {}
|
||||
class LoadAssetTechnical extends AssetTechnicalEvent {
|
||||
final String isin;
|
||||
final bool forceRefresh;
|
||||
final String? ticker;
|
||||
LoadAssetTechnical(this.isin, {this.forceRefresh = false, this.ticker});
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
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);
|
||||
}
|
||||
class AssetTechnicalError extends AssetTechnicalState {
|
||||
final String message;
|
||||
AssetTechnicalError(this.message);
|
||||
}
|
||||
Reference in New Issue
Block a user