feat: implement splash and onboarding flows, update app assets, and add project design documentation
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import 'dart:async';
|
||||
import 'package:equatable/equatable.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import '../data/maps_repository.dart';
|
||||
import '../data/models/place_model.dart';
|
||||
|
||||
@@ -62,10 +63,11 @@ class DestinationCubit extends Cubit<DestinationState> {
|
||||
|
||||
Future<void> _search(String query) async {
|
||||
try {
|
||||
final results = await _mapsRepo.autocomplete(query);
|
||||
final results = await _mapsRepo.search(query);
|
||||
emit(state.copyWith(results: results, searching: false));
|
||||
} catch (e) {
|
||||
emit(state.copyWith(searching: false, error: e.toString()));
|
||||
emit(state.copyWith(
|
||||
searching: false, error: e.toString(), clearError: false));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,10 +76,27 @@ class DestinationCubit extends Cubit<DestinationState> {
|
||||
if (query.trim().length < 2) return;
|
||||
emit(state.copyWith(searching: true, clearError: true));
|
||||
try {
|
||||
final results = await _mapsRepo.autocomplete(query);
|
||||
final results = await _mapsRepo.search(query);
|
||||
emit(state.copyWith(results: results, searching: false));
|
||||
} catch (e) {
|
||||
emit(state.copyWith(searching: false, error: e.toString()));
|
||||
} catch (e, st) {
|
||||
debugPrint('Map Search Error: $e\n$st');
|
||||
emit(state.copyWith(
|
||||
searching: false, error: e.toString(), clearError: false));
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> searchVoiceDirectly(String query,
|
||||
{double? lat, double? lng}) async {
|
||||
_debounce?.cancel();
|
||||
if (query.trim().isEmpty) return;
|
||||
emit(state.copyWith(searching: true, clearError: true));
|
||||
try {
|
||||
final results = await _mapsRepo.voiceSearch(query, lat: lat, lng: lng);
|
||||
emit(state.copyWith(results: results, searching: false));
|
||||
} catch (e, st) {
|
||||
debugPrint('Map Voice Search Error: $e\n$st');
|
||||
emit(state.copyWith(
|
||||
searching: false, error: e.toString(), clearError: false));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user