Stream Chatty added as example (#21)

* app updated

* readme updated

* rename base folder

* update chatty's readme

Co-authored-by: Neevash Ramdial <[email protected]>
This commit is contained in:
Diego Velásquez López
2021-03-10 14:53:20 -04:00
committed by GitHub
co-authored by Neevash Ramdial
parent c86652dcfc
commit bd6bb66279
111 changed files with 3806 additions and 0 deletions
@@ -0,0 +1,44 @@
import 'dart:io';
import 'package:stream_chatter/data/image_picker_repository.dart';
import 'package:stream_chatter/domain/usecases/profile_sign_in_usecase.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
class ProfileState {
const ProfileState(
this.file, {
this.success = false,
this.loading = false,
});
final File file;
final bool success;
final bool loading;
}
class ProfileVerifyCubit extends Cubit<ProfileState> {
ProfileVerifyCubit(
this._imagePickerRepository,
this._profileSignInUseCase,
) : super(ProfileState(null));
final nameController = TextEditingController();
final ImagePickerRepository _imagePickerRepository;
final ProfileSignInUseCase _profileSignInUseCase;
void startChatting() async {
emit(ProfileState(null, loading: true));
final file = state.file;
final name = nameController.text;
await _profileSignInUseCase.verify(ProfileInput(
imageFile: file,
name: name,
));
emit(ProfileState(file, success: true, loading: false));
}
void pickImage() async {
final file = await _imagePickerRepository.pickImage();
emit(ProfileState(file));
}
}