Skip to content

Commit

Permalink
update deps
Browse files Browse the repository at this point in the history
  • Loading branch information
hoc081098 committed Aug 8, 2021
1 parent 1d8a77a commit 4eee496
Show file tree
Hide file tree
Showing 13 changed files with 56 additions and 60 deletions.
2 changes: 1 addition & 1 deletion lib/data/local/entities/user_and_token_entity.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions lib/data/local/entities/user_entity.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions lib/data/remote/response/token_response.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions lib/data/remote/response/user_response.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/data/serializers.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/domain/models/auth_state.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/domain/models/user.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/domain/models/user_and_token.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 14 additions & 3 deletions lib/pages/home/home_bloc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import 'dart:io';
import 'package:disposebag/disposebag.dart';
import 'package:distinct_value_connectable_stream/distinct_value_connectable_stream.dart';
import 'package:flutter_bloc_pattern/flutter_bloc_pattern.dart';
import 'package:image_picker/image_picker.dart';
import 'package:node_auth/domain/models/auth_state.dart';
import 'package:node_auth/domain/usecases/get_auth_state_stream_use_case.dart';
import 'package:node_auth/domain/usecases/logout_use_case.dart';
Expand All @@ -19,7 +20,7 @@ import 'package:rxdart_ext/rxdart_ext.dart';
/// BLoC that handles user profile and logout
class HomeBloc extends DisposeCallbackBaseBloc {
/// Input functions
final Function1<File?, void> changeAvatar;
final Function0<void> changeAvatar;
final Function0<void> logout;

/// Output stream
Expand All @@ -39,7 +40,7 @@ class HomeBloc extends DisposeCallbackBaseBloc {
final GetAuthStateStreamUseCase getAuthState,
final UploadImageUseCase uploadImage,
) {
final changeAvatarS = PublishSubject<File?>();
final changeAvatarS = PublishSubject<void>();
final logoutS = PublishSubject<void>();

final Stream<AuthenticationState?> authenticationState$ = getAuthState();
Expand All @@ -52,6 +53,16 @@ class HomeBloc extends DisposeCallbackBaseBloc {
]);

final updateAvatarMessage$ = changeAvatarS
.exhaustMap(
(value) => Rx.fromCallable(
() => ImagePicker().pickImage(
source: ImageSource.gallery,
maxWidth: 720.0,
maxHeight: 720.0,
),
),
)
.map((file) => file == null ? null : File(file.path))
.whereNotNull()
.distinct()
.switchMap(uploadImage.call)
Expand All @@ -62,7 +73,7 @@ class HomeBloc extends DisposeCallbackBaseBloc {
final message$ = Rx.merge([logoutMessage$, updateAvatarMessage$]).publish();

return HomeBloc._(
changeAvatar: changeAvatarS.add,
changeAvatar: () => changeAvatarS.add(null),
logout: () => logoutS.add(true),
authState$: authState$,
dispose: DisposeBag([
Expand Down
17 changes: 1 addition & 16 deletions lib/pages/home/home_profile_widget.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import 'dart:io';

import 'package:flutter/material.dart';
import 'package:flutter_bloc_pattern/flutter_bloc_pattern.dart';
import 'package:image_picker/image_picker.dart';
import 'package:node_auth/data/constants.dart';
import 'package:node_auth/domain/models/auth_state.dart';
import 'package:node_auth/domain/models/user.dart';
Expand Down Expand Up @@ -85,7 +82,7 @@ class HomeUserProfile extends StatelessWidget {
children: <Widget>[
ClipOval(
child: GestureDetector(
onTap: () => _pickAndUploadImage(homeBloc),
onTap: homeBloc.changeAvatar,
child: image,
),
),
Expand Down Expand Up @@ -135,16 +132,4 @@ class HomeUserProfile extends StatelessWidget {
),
);
}

void _pickAndUploadImage(HomeBloc homeBloc) async {
final imageFile = await ImagePicker().getImage(
source: ImageSource.gallery,
maxWidth: 720.0,
maxHeight: 720.0,
);
if (imageFile == null) {
return;
}
homeBloc.changeAvatar(File(imageFile.path));
}
}
41 changes: 23 additions & 18 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ packages:
name: _fe_analyzer_shared
url: "https://pub.dartlang.org"
source: hosted
version: "21.0.0"
version: "22.0.0"
analyzer:
dependency: transitive
dependency: "direct dev"
description:
name: analyzer
url: "https://pub.dartlang.org"
source: hosted
version: "1.5.0"
version: "1.7.2"
args:
dependency: transitive
description:
Expand Down Expand Up @@ -42,7 +42,7 @@ packages:
name: build
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
version: "2.1.0"
build_config:
dependency: transitive
description:
Expand Down Expand Up @@ -70,14 +70,14 @@ packages:
name: build_runner
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.6"
version: "2.1.0"
build_runner_core:
dependency: transitive
description:
name: build_runner_core
url: "https://pub.dartlang.org"
source: hosted
version: "7.0.1"
version: "7.1.0"
built_collection:
dependency: transitive
description:
Expand All @@ -91,14 +91,14 @@ packages:
name: built_value
url: "https://pub.dartlang.org"
source: hosted
version: "8.0.6"
version: "8.1.1"
built_value_generator:
dependency: "direct dev"
description:
name: built_value_generator
url: "https://pub.dartlang.org"
source: hosted
version: "8.0.6"
version: "8.1.1"
characters:
dependency: transitive
description:
Expand Down Expand Up @@ -155,6 +155,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.0"
cross_file:
dependency: transitive
description:
name: cross_file
url: "https://pub.dartlang.org"
source: hosted
version: "0.3.1+4"
crypto:
dependency: transitive
description:
Expand Down Expand Up @@ -323,21 +330,21 @@ packages:
name: image_picker
url: "https://pub.dartlang.org"
source: hosted
version: "0.8.0+3"
version: "0.8.3+1"
image_picker_for_web:
dependency: transitive
description:
name: image_picker_for_web
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
version: "2.1.2"
image_picker_platform_interface:
dependency: transitive
description:
name: image_picker_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
version: "2.2.0"
io:
dependency: transitive
description:
Expand Down Expand Up @@ -449,7 +456,7 @@ packages:
name: plugin_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
version: "2.0.1"
pool:
dependency: transitive
description:
Expand Down Expand Up @@ -509,12 +516,10 @@ packages:
rxdart_ext:
dependency: "direct main"
description:
path: "."
ref: "61ab80610903916556d8f2cf9d0055c23f05bb91"
resolved-ref: "61ab80610903916556d8f2cf9d0055c23f05bb91"
url: "https://github.com/hoc081098/rxdart_ext.git"
source: git
version: "0.1.1-dev.0"
name: rxdart_ext
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.1"
shared_preferences:
dependency: "direct main"
description:
Expand Down
17 changes: 6 additions & 11 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ dependencies:

path: ^1.8.0
http: ^0.13.3
built_value: ^8.0.6
built_value: ^8.1.1
tuple: ^2.0.0
rxdart: ^0.27.1
image_picker: ^0.8.0+3
image_picker: ^0.8.3+1
shared_preferences: ^2.0.6
octo_image: ^1.0.0+1

Expand All @@ -29,22 +29,17 @@ dependencies:
disposebag: ^1.5.0
flutter_disposebag: ^1.1.0
flutter_bloc_pattern: ^2.1.1
rxdart_ext: ^0.1.1-dev.0
rxdart_ext: ^0.1.1
did_change_dependencies: ^1.0.0
pedantic: ^1.11.0

dev_dependencies:
plugin_platform_interface: ^2.0.0
plugin_platform_interface: ^2.0.1
flutter_test:
sdk: flutter
build_runner: ^2.0.0
built_value_generator: ^8.0.6

dependency_overrides:
rxdart_ext:
git:
url: https://github.com/hoc081098/rxdart_ext.git
ref: 61ab80610903916556d8f2cf9d0055c23f05bb91
built_value_generator: ^8.1.1
analyzer: ^1.7.2

flutter:
uses-material-design: true
Expand Down

0 comments on commit 4eee496

Please sign in to comment.