From b6484e3e14e3cc100750d42fee17080bb52916bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cyanghuaxuan=E2=80=9D?= <“646903573@qq.com”> Date: Sat, 27 Mar 2021 14:31:31 +0800 Subject: [PATCH] =?UTF-8?q?1=E6=9B=B4=E6=96=B0bloc?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/pages/empty_page/bloc/empty_page_bloc.dart | 5 ++--- lib/pages/login_page/account/bloc/login_account_bloc.dart | 5 ++--- lib/pages/login_page/bind/bloc/login_bind_phone_bloc.dart | 5 +---- lib/pages/login_page/bloc/login_bloc.dart | 5 ++--- lib/pages/login_page/invite/bloc/login_invite_bloc.dart | 5 ++--- lib/pages/login_page/login_page.dart | 3 ++- lib/util/net_util.dart | 1 + pubspec.yaml | 3 ++- 8 files changed, 14 insertions(+), 18 deletions(-) diff --git a/lib/pages/empty_page/bloc/empty_page_bloc.dart b/lib/pages/empty_page/bloc/empty_page_bloc.dart index b1872e6..9cb8976 100644 --- a/lib/pages/empty_page/bloc/empty_page_bloc.dart +++ b/lib/pages/empty_page/bloc/empty_page_bloc.dart @@ -7,12 +7,11 @@ import 'empty_page_state.dart'; import 'empty_page_event.dart'; class EmptyPageBloc extends Bloc { - @override - EmptyPageState get initialState => EmptyPageInitial(); + EmptyPageRepository repository; - EmptyPageBloc(this.repository); + EmptyPageBloc(this.repository) : super(EmptyPageInitial()); @override Stream mapEventToState( diff --git a/lib/pages/login_page/account/bloc/login_account_bloc.dart b/lib/pages/login_page/account/bloc/login_account_bloc.dart index 3ad8231..e88f3bc 100644 --- a/lib/pages/login_page/account/bloc/login_account_bloc.dart +++ b/lib/pages/login_page/account/bloc/login_account_bloc.dart @@ -9,10 +9,9 @@ import 'package:fluttertoast/fluttertoast.dart'; class LoginAccountBloc extends Bloc { LoginAccountRepository repository; - LoginAccountBloc({@required this.repository}); + LoginAccountBloc({@required this.repository}) : super(LoginAccountInitial()); + - @override - LoginAccountState get initialState => LoginAccountInitial(); @override Stream mapEventToState(LoginAccountEvent event) async* { diff --git a/lib/pages/login_page/bind/bloc/login_bind_phone_bloc.dart b/lib/pages/login_page/bind/bloc/login_bind_phone_bloc.dart index 0341e6f..0b9a142 100644 --- a/lib/pages/login_page/bind/bloc/login_bind_phone_bloc.dart +++ b/lib/pages/login_page/bind/bloc/login_bind_phone_bloc.dart @@ -8,10 +8,7 @@ import 'package:fluttertoast/fluttertoast.dart'; class LoginBindPhoneBloc extends Bloc { LoginBindPhoneRepository repository; - LoginBindPhoneBloc({@required this.repository}); - - @override - LoginBindPhoneState get initialState => LoginBindPhoneInitial(); + LoginBindPhoneBloc({@required this.repository}) : super(LoginBindPhoneInitial()); @override Stream mapEventToState(LoginBindPhoneEvent event) async* { diff --git a/lib/pages/login_page/bloc/login_bloc.dart b/lib/pages/login_page/bloc/login_bloc.dart index 2d2b607..0289f66 100644 --- a/lib/pages/login_page/bloc/login_bloc.dart +++ b/lib/pages/login_page/bloc/login_bloc.dart @@ -8,10 +8,9 @@ import 'package:zhiying_comm/util/empty_util.dart'; class LoginBloc extends Bloc { LoginRepository repository; - LoginBloc({this.repository}); + LoginBloc({this.repository}) : super(InitialLoginState()); + - @override - LoginState get initialState => InitialLoginState(); @override Stream mapEventToState( diff --git a/lib/pages/login_page/invite/bloc/login_invite_bloc.dart b/lib/pages/login_page/invite/bloc/login_invite_bloc.dart index d3c1dce..9190fe3 100644 --- a/lib/pages/login_page/invite/bloc/login_invite_bloc.dart +++ b/lib/pages/login_page/invite/bloc/login_invite_bloc.dart @@ -8,10 +8,9 @@ import 'login_invite_repository.dart'; class LoginInviteBloc extends Bloc { LoginInviteRepository repostitory; - LoginInviteBloc({@required this.repostitory}); + LoginInviteBloc({@required this.repostitory}) : super(LoginInviteInitial()); + - @override - LoginInviteState get initialState => LoginInviteInitial(); @override Stream mapEventToState( diff --git a/lib/pages/login_page/login_page.dart b/lib/pages/login_page/login_page.dart index 382c4a8..a5a7cc6 100644 --- a/lib/pages/login_page/login_page.dart +++ b/lib/pages/login_page/login_page.dart @@ -110,7 +110,7 @@ class _LoginPageContainerState extends State { /// 微信登录 Loading.show(context); SharesdkPlugin.getUserInfo(ShareSDKPlatforms.wechatSession, (SSDKResponseState state, Map userdata, SSDKError error) { - Logger.log('state = ${state?.toString()}, userInfo = ${userdata?.toString()}'); + Logger.log('state = ${state?.toString()}, userInfo = ${userdata?.toString()} , error = ${error?.code}'); if (state == SSDKResponseState.Success) { try { if (Platform.isIOS) { @@ -140,6 +140,7 @@ class _LoginPageContainerState extends State { Loading.dismiss(); } catch (e) { + Logger.error(e?.toString()); Fluttertoast.showToast(msg: '登录失败'); Loading.dismiss(); } diff --git a/lib/util/net_util.dart b/lib/util/net_util.dart index 8243d4f..ad140bc 100644 --- a/lib/util/net_util.dart +++ b/lib/util/net_util.dart @@ -371,6 +371,7 @@ class NetUtil { } // 应用版本号 params["app_version_name"] = packageInfo.version?.toString(); + params["AppVersionName"] = packageInfo.version?.toString(); params["app_version"] = packageInfo.buildNumber?.toString(); // 分辨率 params["solution"] = "${window.physicalSize.width.floor()}*${window.physicalSize.height.floor()}"; diff --git a/pubspec.yaml b/pubspec.yaml index e0559c0..60ac671 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -26,7 +26,8 @@ dependencies: # 缓存 shared_preferences: ^0.5.10 # bloc - flutter_bloc: ^4.0.1 + flutter_bloc: ^5.0.0 + # 骨架屏 shimmer: ^1.1.1 webview_flutter: ^1.0.7