fix try again button

feature/passo/PASSO-#1-Sync-data-from-device-to-postgre-and-vice-versa
unknown 2023-10-07 21:30:44 +08:00
parent ebb04ad358
commit 8dc0529646
3 changed files with 46 additions and 37 deletions

View File

@ -6,11 +6,11 @@ abstract class UserEvent extends Equatable {
}
class GetApkVersion extends UserEvent {
final String username;
final String password;
final String? username;
final String? password;
GetApkVersion({required this.password, required this.username});
@override
List<Object> get props => [username, password];
List<Object> get props => [];
}
class UserLogin extends UserEvent {

View File

@ -1,5 +1,7 @@
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_progress_hud/flutter_progress_hud.dart';
import 'package:flutter_spinkit/flutter_spinkit.dart';
import 'package:flutter_zoom_drawer/flutter_zoom_drawer.dart';
import 'package:fluttericon/font_awesome5_icons.dart';
import 'package:unit2/bloc/offline/offline_bloc/offline_bloc.dart';
@ -28,9 +30,12 @@ class OfflineModuleScreen extends StatelessWidget {
),
),
),
body: BlocConsumer<OfflineBloc, OfflineState>(
body: ProgressHUD(
backgroundColor: Colors.black87,
indicatorWidget: const SpinKitFadingCircle(color: Colors.white),
child: BlocConsumer<OfflineBloc, OfflineState>(
listener: (context, state) {
// TODO: implement listener
if (state is OfflineLoadingState) {}
},
builder: (context, state) {
if (state is OfflineModeState) {
@ -42,8 +47,8 @@ class OfflineModuleScreen extends StatelessWidget {
crossAxisSpacing: 8,
mainAxisSpacing: 10,
physics: const BouncingScrollPhysics(),
padding:
const EdgeInsets.symmetric(vertical: 5, horizontal: 5),
padding: const EdgeInsets.symmetric(
vertical: 5, horizontal: 5),
children: state.offlineModules
.map((e) => CardLabel(
icon: FontAwesome5.eye,
@ -59,6 +64,7 @@ class OfflineModuleScreen extends StatelessWidget {
}
return Container();
},
),
));
}
}

View File

@ -63,6 +63,7 @@ class _UniT2LoginState extends State<UniT2Login> {
backgroundColor: Colors.black87,
indicatorWidget: const SpinKitFadingCircle(color: Colors.white),
child: BlocConsumer<UserBloc, UserState>(listener: (context, state) {
print(state);
if (state is UserLoggedIn ||
state is UuidLoaded ||
state is LoginErrorState) {
@ -372,7 +373,8 @@ class _UniT2LoginState extends State<UniT2Login> {
onpressed: () {
BlocProvider.of<UserBloc>(
NavigationService.navigatorKey.currentContext!)
.add(LoadVersion(username: username, password: password));
.add(GetApkVersion(
username: username, password: password));
return MaterialPageRoute(builder: (_) {
return const UniT2Login();
});
@ -388,7 +390,7 @@ class _UniT2LoginState extends State<UniT2Login> {
onpressed: () {
BlocProvider.of<UserBloc>(
NavigationService.navigatorKey.currentContext!)
.add(LoadVersion(
.add(GetApkVersion(
username: username, password: password));
return MaterialPageRoute(builder: (_) {
return const UniT2Login();
@ -434,7 +436,8 @@ class _UniT2LoginState extends State<UniT2Login> {
onpressed: () {
BlocProvider.of<UserBloc>(
NavigationService.navigatorKey.currentContext!)
.add(LoadVersion(username: username, password: password));
.add(GetApkVersion(
username: username, password: password));
return MaterialPageRoute(builder: (_) {
return const UniT2Login();
});