fix try again button
parent
ebb04ad358
commit
8dc0529646
|
@ -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 {
|
||||
|
|
|
@ -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,37 +30,41 @@ class OfflineModuleScreen extends StatelessWidget {
|
|||
),
|
||||
),
|
||||
),
|
||||
body: BlocConsumer<OfflineBloc, OfflineState>(
|
||||
listener: (context, state) {
|
||||
// TODO: implement listener
|
||||
},
|
||||
builder: (context, state) {
|
||||
if (state is OfflineModeState) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(24),
|
||||
child: GridView.count(
|
||||
shrinkWrap: true,
|
||||
crossAxisCount: 4,
|
||||
crossAxisSpacing: 8,
|
||||
mainAxisSpacing: 10,
|
||||
physics: const BouncingScrollPhysics(),
|
||||
padding:
|
||||
const EdgeInsets.symmetric(vertical: 5, horizontal: 5),
|
||||
children: state.offlineModules
|
||||
.map((e) => CardLabel(
|
||||
icon: FontAwesome5.eye,
|
||||
title: "Field Surveyor",
|
||||
ontap: () {
|
||||
Navigator.push(context,
|
||||
MaterialPageRoute(builder: ((context) {
|
||||
return PassoDashBoard();
|
||||
})));
|
||||
}))
|
||||
.toList()),
|
||||
);
|
||||
}
|
||||
return Container();
|
||||
},
|
||||
body: ProgressHUD(
|
||||
backgroundColor: Colors.black87,
|
||||
indicatorWidget: const SpinKitFadingCircle(color: Colors.white),
|
||||
child: BlocConsumer<OfflineBloc, OfflineState>(
|
||||
listener: (context, state) {
|
||||
if (state is OfflineLoadingState) {}
|
||||
},
|
||||
builder: (context, state) {
|
||||
if (state is OfflineModeState) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(24),
|
||||
child: GridView.count(
|
||||
shrinkWrap: true,
|
||||
crossAxisCount: 4,
|
||||
crossAxisSpacing: 8,
|
||||
mainAxisSpacing: 10,
|
||||
physics: const BouncingScrollPhysics(),
|
||||
padding: const EdgeInsets.symmetric(
|
||||
vertical: 5, horizontal: 5),
|
||||
children: state.offlineModules
|
||||
.map((e) => CardLabel(
|
||||
icon: FontAwesome5.eye,
|
||||
title: "Field Surveyor",
|
||||
ontap: () {
|
||||
Navigator.push(context,
|
||||
MaterialPageRoute(builder: ((context) {
|
||||
return PassoDashBoard();
|
||||
})));
|
||||
}))
|
||||
.toList()),
|
||||
);
|
||||
}
|
||||
return Container();
|
||||
},
|
||||
),
|
||||
));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue