fix try again button
parent
ebb04ad358
commit
8dc0529646
|
@ -6,11 +6,11 @@ abstract class UserEvent extends Equatable {
|
||||||
}
|
}
|
||||||
|
|
||||||
class GetApkVersion extends UserEvent {
|
class GetApkVersion extends UserEvent {
|
||||||
final String username;
|
final String? username;
|
||||||
final String password;
|
final String? password;
|
||||||
GetApkVersion({required this.password, required this.username});
|
GetApkVersion({required this.password, required this.username});
|
||||||
@override
|
@override
|
||||||
List<Object> get props => [username, password];
|
List<Object> get props => [];
|
||||||
}
|
}
|
||||||
|
|
||||||
class UserLogin extends UserEvent {
|
class UserLogin extends UserEvent {
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_bloc/flutter_bloc.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:flutter_zoom_drawer/flutter_zoom_drawer.dart';
|
||||||
import 'package:fluttericon/font_awesome5_icons.dart';
|
import 'package:fluttericon/font_awesome5_icons.dart';
|
||||||
import 'package:unit2/bloc/offline/offline_bloc/offline_bloc.dart';
|
import 'package:unit2/bloc/offline/offline_bloc/offline_bloc.dart';
|
||||||
|
@ -28,37 +30,41 @@ class OfflineModuleScreen extends StatelessWidget {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
body: BlocConsumer<OfflineBloc, OfflineState>(
|
body: ProgressHUD(
|
||||||
listener: (context, state) {
|
backgroundColor: Colors.black87,
|
||||||
// TODO: implement listener
|
indicatorWidget: const SpinKitFadingCircle(color: Colors.white),
|
||||||
},
|
child: BlocConsumer<OfflineBloc, OfflineState>(
|
||||||
builder: (context, state) {
|
listener: (context, state) {
|
||||||
if (state is OfflineModeState) {
|
if (state is OfflineLoadingState) {}
|
||||||
return Padding(
|
},
|
||||||
padding: const EdgeInsets.all(24),
|
builder: (context, state) {
|
||||||
child: GridView.count(
|
if (state is OfflineModeState) {
|
||||||
shrinkWrap: true,
|
return Padding(
|
||||||
crossAxisCount: 4,
|
padding: const EdgeInsets.all(24),
|
||||||
crossAxisSpacing: 8,
|
child: GridView.count(
|
||||||
mainAxisSpacing: 10,
|
shrinkWrap: true,
|
||||||
physics: const BouncingScrollPhysics(),
|
crossAxisCount: 4,
|
||||||
padding:
|
crossAxisSpacing: 8,
|
||||||
const EdgeInsets.symmetric(vertical: 5, horizontal: 5),
|
mainAxisSpacing: 10,
|
||||||
children: state.offlineModules
|
physics: const BouncingScrollPhysics(),
|
||||||
.map((e) => CardLabel(
|
padding: const EdgeInsets.symmetric(
|
||||||
icon: FontAwesome5.eye,
|
vertical: 5, horizontal: 5),
|
||||||
title: "Field Surveyor",
|
children: state.offlineModules
|
||||||
ontap: () {
|
.map((e) => CardLabel(
|
||||||
Navigator.push(context,
|
icon: FontAwesome5.eye,
|
||||||
MaterialPageRoute(builder: ((context) {
|
title: "Field Surveyor",
|
||||||
return PassoDashBoard();
|
ontap: () {
|
||||||
})));
|
Navigator.push(context,
|
||||||
}))
|
MaterialPageRoute(builder: ((context) {
|
||||||
.toList()),
|
return PassoDashBoard();
|
||||||
);
|
})));
|
||||||
}
|
}))
|
||||||
return Container();
|
.toList()),
|
||||||
},
|
);
|
||||||
|
}
|
||||||
|
return Container();
|
||||||
|
},
|
||||||
|
),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,6 +63,7 @@ class _UniT2LoginState extends State<UniT2Login> {
|
||||||
backgroundColor: Colors.black87,
|
backgroundColor: Colors.black87,
|
||||||
indicatorWidget: const SpinKitFadingCircle(color: Colors.white),
|
indicatorWidget: const SpinKitFadingCircle(color: Colors.white),
|
||||||
child: BlocConsumer<UserBloc, UserState>(listener: (context, state) {
|
child: BlocConsumer<UserBloc, UserState>(listener: (context, state) {
|
||||||
|
print(state);
|
||||||
if (state is UserLoggedIn ||
|
if (state is UserLoggedIn ||
|
||||||
state is UuidLoaded ||
|
state is UuidLoaded ||
|
||||||
state is LoginErrorState) {
|
state is LoginErrorState) {
|
||||||
|
@ -372,7 +373,8 @@ class _UniT2LoginState extends State<UniT2Login> {
|
||||||
onpressed: () {
|
onpressed: () {
|
||||||
BlocProvider.of<UserBloc>(
|
BlocProvider.of<UserBloc>(
|
||||||
NavigationService.navigatorKey.currentContext!)
|
NavigationService.navigatorKey.currentContext!)
|
||||||
.add(LoadVersion(username: username, password: password));
|
.add(GetApkVersion(
|
||||||
|
username: username, password: password));
|
||||||
return MaterialPageRoute(builder: (_) {
|
return MaterialPageRoute(builder: (_) {
|
||||||
return const UniT2Login();
|
return const UniT2Login();
|
||||||
});
|
});
|
||||||
|
@ -388,7 +390,7 @@ class _UniT2LoginState extends State<UniT2Login> {
|
||||||
onpressed: () {
|
onpressed: () {
|
||||||
BlocProvider.of<UserBloc>(
|
BlocProvider.of<UserBloc>(
|
||||||
NavigationService.navigatorKey.currentContext!)
|
NavigationService.navigatorKey.currentContext!)
|
||||||
.add(LoadVersion(
|
.add(GetApkVersion(
|
||||||
username: username, password: password));
|
username: username, password: password));
|
||||||
return MaterialPageRoute(builder: (_) {
|
return MaterialPageRoute(builder: (_) {
|
||||||
return const UniT2Login();
|
return const UniT2Login();
|
||||||
|
@ -434,7 +436,8 @@ class _UniT2LoginState extends State<UniT2Login> {
|
||||||
onpressed: () {
|
onpressed: () {
|
||||||
BlocProvider.of<UserBloc>(
|
BlocProvider.of<UserBloc>(
|
||||||
NavigationService.navigatorKey.currentContext!)
|
NavigationService.navigatorKey.currentContext!)
|
||||||
.add(LoadVersion(username: username, password: password));
|
.add(GetApkVersion(
|
||||||
|
username: username, password: password));
|
||||||
return MaterialPageRoute(builder: (_) {
|
return MaterialPageRoute(builder: (_) {
|
||||||
return const UniT2Login();
|
return const UniT2Login();
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue