with go router navigation
parent
0c0c6c1c90
commit
c088dbc2a2
|
@ -1,3 +1,4 @@
|
||||||
|
import 'package:barcode_scan2/barcode_scan2.dart';
|
||||||
import 'package:bloc/bloc.dart';
|
import 'package:bloc/bloc.dart';
|
||||||
import 'package:equatable/equatable.dart';
|
import 'package:equatable/equatable.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
@ -6,15 +7,17 @@ import 'package:unit2/model/login_data/version_info.dart';
|
||||||
import 'package:unit2/sevices/login_service/auth_service.dart';
|
import 'package:unit2/sevices/login_service/auth_service.dart';
|
||||||
import 'package:unit2/widgets/error_state.dart';
|
import 'package:unit2/widgets/error_state.dart';
|
||||||
|
|
||||||
|
import '../../utils/scanner.dart';
|
||||||
|
|
||||||
part 'user_event.dart';
|
part 'user_event.dart';
|
||||||
part 'user_state.dart';
|
part 'user_state.dart';
|
||||||
|
|
||||||
class UserBloc extends Bloc<UserEvent, UserState> {
|
class UserBloc extends Bloc<UserEvent, UserState> {
|
||||||
|
UserData? _userData;
|
||||||
UserBloc() : super(UserInitial()) {
|
UserBloc() : super(UserInitial()) {
|
||||||
// this event is called when opening the app to check if
|
// this event is called when opening the app to check if
|
||||||
// there is new app version
|
// there is new app version
|
||||||
on<GetApkVersion>((event, emit) async {
|
on<GetApkVersion>((event, emit) async {
|
||||||
debugPrint("getApkEvent is called");
|
|
||||||
try {
|
try {
|
||||||
emit(SplashScreen());
|
emit(SplashScreen());
|
||||||
VersionInfo versionInfo = await AuthService.instance.getVersionInfo();
|
VersionInfo versionInfo = await AuthService.instance.getVersionInfo();
|
||||||
|
@ -24,14 +27,25 @@ class UserBloc extends Bloc<UserEvent, UserState> {
|
||||||
message: e.toString(),
|
message: e.toString(),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
on<UserLogin>((event, emit) async{
|
});
|
||||||
try{
|
on<UserLogin>((event, emit) async {
|
||||||
UserData? userData = await AuthService.instance.webLogin(username: event.username,password: event.password);
|
try {
|
||||||
emit(UserLoggedIn(userData: userData));
|
UserData? userData = await AuthService.instance
|
||||||
}catch(e){
|
.webLogin(username: event.username, password: event.password);
|
||||||
emit(UserError(message: e.toString()));
|
_userData = userData;
|
||||||
}
|
emit(UserLoggedIn(userData: userData));
|
||||||
});
|
} catch (e) {
|
||||||
|
emit(UserError(message: e.toString()));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
on<LoadLoggedInUser>((event, emit) {
|
||||||
|
emit(UserLoggedIn(userData: event.userData));
|
||||||
|
});
|
||||||
|
on<GetUuid>((event, emit) async {
|
||||||
|
ScanResult result = await QRCodeBarCodeScanner.instance.scanner();
|
||||||
|
if(result.rawContent.toString().isNotEmpty){
|
||||||
|
emit(UuidLoaded(uuid: result.rawContent.toString()));
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,13 +1,12 @@
|
||||||
part of 'user_bloc.dart';
|
part of 'user_bloc.dart';
|
||||||
|
|
||||||
abstract class UserEvent extends Equatable {
|
abstract class UserEvent extends Equatable {
|
||||||
const UserEvent();
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
List<Object> get props => [];
|
List<Object> get props => [];
|
||||||
}
|
}
|
||||||
|
|
||||||
class GetApkVersion extends UserEvent{
|
class GetApkVersion extends UserEvent{
|
||||||
|
GetApkVersion();
|
||||||
@override
|
@override
|
||||||
List<Object> get props => [];
|
List<Object> get props => [];
|
||||||
}
|
}
|
||||||
|
@ -15,5 +14,15 @@ class GetApkVersion extends UserEvent{
|
||||||
class UserLogin extends UserEvent{
|
class UserLogin extends UserEvent{
|
||||||
final String? username;
|
final String? username;
|
||||||
final String? password;
|
final String? password;
|
||||||
const UserLogin({this.username,this.password});
|
UserLogin({this.username,this.password});
|
||||||
|
}
|
||||||
|
|
||||||
|
class LoadLoggedInUser extends UserEvent{
|
||||||
|
final UserData? userData;
|
||||||
|
LoadLoggedInUser({this.userData});
|
||||||
|
}
|
||||||
|
|
||||||
|
class GetUuid extends UserEvent{
|
||||||
|
|
||||||
|
GetUuid();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,17 +1,20 @@
|
||||||
part of 'user_bloc.dart';
|
part of 'user_bloc.dart';
|
||||||
|
|
||||||
abstract class UserState extends Equatable {
|
abstract class UserState extends Equatable {
|
||||||
const UserState();
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
List<Object> get props => [];
|
List<Object> get props => [];
|
||||||
}
|
}
|
||||||
|
|
||||||
class UserInitial extends UserState {}
|
class UserInitial extends UserState {
|
||||||
|
UserInitial();
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
class UserLoading extends UserState {
|
class UserLoading extends UserState {
|
||||||
final String? message;
|
final String? message;
|
||||||
const UserLoading({this.message});
|
UserLoading({this.message});
|
||||||
@override
|
@override
|
||||||
List<Object> get props => [message!];
|
List<Object> get props => [message!];
|
||||||
}
|
}
|
||||||
|
@ -23,18 +26,24 @@ class SplashScreen extends UserState {
|
||||||
|
|
||||||
class UserError extends UserState {
|
class UserError extends UserState {
|
||||||
final String? message;
|
final String? message;
|
||||||
const UserError({this.message});
|
UserError({this.message});
|
||||||
@override
|
@override
|
||||||
List<Object> get props => [];
|
List<Object> get props => [];
|
||||||
}
|
}
|
||||||
class UserLoggedIn extends UserState{
|
class UserLoggedIn extends UserState{
|
||||||
final UserData? userData;
|
final UserData? userData;
|
||||||
const UserLoggedIn({this.userData});
|
UserLoggedIn({this.userData});
|
||||||
}
|
}
|
||||||
|
|
||||||
class VersionLoaded extends UserState {
|
class VersionLoaded extends UserState {
|
||||||
final VersionInfo? versionInfo;
|
final VersionInfo? versionInfo;
|
||||||
const VersionLoaded({this.versionInfo});
|
VersionLoaded({this.versionInfo});
|
||||||
@override
|
@override
|
||||||
List<Object> get props => [versionInfo!];
|
List<Object> get props => [versionInfo!];
|
||||||
}
|
}
|
||||||
|
class UuidLoaded extends UserState{
|
||||||
|
final String uuid;
|
||||||
|
UuidLoaded({required this.uuid});
|
||||||
|
@override
|
||||||
|
List<Object> get props => [uuid];
|
||||||
|
}
|
||||||
|
|
|
@ -4,6 +4,8 @@ import 'package:device_preview/device_preview.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
import 'package:unit2/bloc/bloc/user_bloc.dart';
|
import 'package:unit2/bloc/bloc/user_bloc.dart';
|
||||||
|
import 'package:unit2/utils/global_context.dart';
|
||||||
|
import 'package:unit2/utils/global_context.dart';
|
||||||
import './utils/router.dart';
|
import './utils/router.dart';
|
||||||
import './utils/global.dart';
|
import './utils/global.dart';
|
||||||
|
|
||||||
|
@ -24,6 +26,7 @@ class MyApp extends StatelessWidget {
|
||||||
// This widget is the root of your application.
|
// This widget is the root of your application.
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
BuildContext? parentContext = NavigationService.navigatorKey.currentContext;
|
||||||
final mediaQueryData =
|
final mediaQueryData =
|
||||||
MediaQueryData.fromWindow(WidgetsBinding.instance.window);
|
MediaQueryData.fromWindow(WidgetsBinding.instance.window);
|
||||||
screenWidth = mediaQueryData.size.width;
|
screenWidth = mediaQueryData.size.width;
|
||||||
|
@ -37,9 +40,14 @@ class MyApp extends StatelessWidget {
|
||||||
safeBlockHorizontal = (screenWidth - safeAreaHorizontal) / 100;
|
safeBlockHorizontal = (screenWidth - safeAreaHorizontal) / 100;
|
||||||
safeBlockVertical = (screenHeight - safeAreaVertical) / 100;
|
safeBlockVertical = (screenHeight - safeAreaVertical) / 100;
|
||||||
|
|
||||||
return BlocProvider(
|
return MultiBlocProvider(
|
||||||
create: (context) => UserBloc(),
|
providers: [
|
||||||
|
BlocProvider(
|
||||||
|
create: (parentContext) => UserBloc(),
|
||||||
|
),
|
||||||
|
],
|
||||||
child: MaterialApp.router(
|
child: MaterialApp.router(
|
||||||
|
key: NavigationService.navigatorKey,
|
||||||
// useInheritedMediaQuery: true,
|
// useInheritedMediaQuery: true,
|
||||||
// locale: DevicePreview.locale(context),
|
// locale: DevicePreview.locale(context),
|
||||||
// builder: DevicePreview.appBuilder,
|
// builder: DevicePreview.appBuilder,
|
||||||
|
|
|
@ -0,0 +1,81 @@
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:unit2/screens/unit2/homepage.dart/module-screen.dart';
|
||||||
|
|
||||||
|
import 'package:unit2/test_data.dart';
|
||||||
|
import 'package:unit2/theme-data.dart/colors.dart';
|
||||||
|
|
||||||
|
class DashBoard extends StatelessWidget {
|
||||||
|
final List<Module> roles;
|
||||||
|
const DashBoard({super.key, required this.roles});
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Container(
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 24),
|
||||||
|
height: MediaQuery.of(context).size.height,
|
||||||
|
//listview builder
|
||||||
|
child: ListView.builder(
|
||||||
|
scrollDirection: Axis.vertical,
|
||||||
|
shrinkWrap: true,
|
||||||
|
itemCount: roles.length,
|
||||||
|
itemBuilder: (BuildContext context, int index) {
|
||||||
|
// gridview.count
|
||||||
|
return SizedBox(
|
||||||
|
child: Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
roles[index].name,
|
||||||
|
style: Theme.of(context)
|
||||||
|
.textTheme
|
||||||
|
.labelLarge!
|
||||||
|
.copyWith(fontSize: 16, fontWeight: FontWeight.w700),
|
||||||
|
),
|
||||||
|
const Divider(),
|
||||||
|
const SizedBox(
|
||||||
|
height: 8,
|
||||||
|
),
|
||||||
|
GridView.count(
|
||||||
|
shrinkWrap: true,
|
||||||
|
crossAxisCount: 4,
|
||||||
|
crossAxisSpacing: 5,
|
||||||
|
mainAxisSpacing: 2,
|
||||||
|
physics: const BouncingScrollPhysics(),
|
||||||
|
padding: const EdgeInsets.symmetric(
|
||||||
|
vertical: 5, horizontal: 5),
|
||||||
|
children: roles[index].roles.map((role) {
|
||||||
|
return GestureDetector(
|
||||||
|
onTap: () {
|
||||||
|
print("Role is click");
|
||||||
|
},
|
||||||
|
child: Column(children: [
|
||||||
|
Icon(
|
||||||
|
role.icon,
|
||||||
|
size: 24,
|
||||||
|
color: second,
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 5,
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: Text(
|
||||||
|
role.role.name!,
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: Theme.of(context)
|
||||||
|
.textTheme
|
||||||
|
.button!
|
||||||
|
.copyWith(
|
||||||
|
fontSize: 11,
|
||||||
|
fontWeight: FontWeight.bold),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
]),
|
||||||
|
);
|
||||||
|
}).toList()),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,7 +1,10 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
import 'package:flutter_zoom_drawer/config.dart';
|
import 'package:flutter_zoom_drawer/config.dart';
|
||||||
import 'package:flutter_zoom_drawer/flutter_zoom_drawer.dart';
|
import 'package:flutter_zoom_drawer/flutter_zoom_drawer.dart';
|
||||||
|
import 'package:unit2/bloc/bloc/user_bloc.dart';
|
||||||
import 'package:unit2/theme-data.dart/colors.dart';
|
import 'package:unit2/theme-data.dart/colors.dart';
|
||||||
|
import '../../../../widgets/splash_screen.dart';
|
||||||
import 'menu-screen.dart';
|
import 'menu-screen.dart';
|
||||||
import '../module-screen.dart';
|
import '../module-screen.dart';
|
||||||
|
|
||||||
|
@ -15,18 +18,29 @@ class _DrawerScreenState extends State<DrawerScreen> {
|
||||||
final zoomDrawerController = ZoomDrawerController();
|
final zoomDrawerController = ZoomDrawerController();
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return ZoomDrawer(
|
return BlocBuilder<UserBloc, UserState>(
|
||||||
controller: zoomDrawerController,
|
builder: (context, state) {
|
||||||
menuScreen: const MenuScreen(),
|
print("drawer screen"+state.toString());
|
||||||
mainScreen: const MainScreen(),
|
if(state is UserLoggedIn){
|
||||||
style: DrawerStyle.defaultStyle,
|
return ZoomDrawer(
|
||||||
borderRadius: 24.0,
|
controller: zoomDrawerController,
|
||||||
showShadow: false,
|
menuScreen: MenuScreen(userData: state.userData,),
|
||||||
angle: -0.0,
|
mainScreen: SizedBox(
|
||||||
slideWidth: MediaQuery.of(context).size.width * .90,
|
height: MediaQuery.of(context).size.height,
|
||||||
openCurve: Curves.fastOutSlowIn,
|
child: const MainScreen()),
|
||||||
closeCurve: Curves.easeOut,
|
style: DrawerStyle.defaultStyle,
|
||||||
menuBackgroundColor: Colors.grey,
|
borderRadius: 24.0,
|
||||||
|
showShadow: false,
|
||||||
|
angle: -0.0,
|
||||||
|
slideWidth: MediaQuery.of(context).size.width * .90,
|
||||||
|
openCurve: Curves.fastOutSlowIn,
|
||||||
|
closeCurve: Curves.easeOut,
|
||||||
|
menuBackgroundColor: Colors.grey,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return const UniTSplashScreen();
|
||||||
|
|
||||||
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,11 +3,13 @@ import 'package:unit2/theme-data.dart/colors.dart';
|
||||||
import 'package:fluttericon/web_symbols_icons.dart';
|
import 'package:fluttericon/web_symbols_icons.dart';
|
||||||
import 'package:fluttericon/typicons_icons.dart';
|
import 'package:fluttericon/typicons_icons.dart';
|
||||||
import 'package:fluttericon/font_awesome5_icons.dart';
|
import 'package:fluttericon/font_awesome5_icons.dart';
|
||||||
|
import '../../../../model/login_data/user_info/user_data.dart';
|
||||||
import 'menu.dart';
|
import 'menu.dart';
|
||||||
import '../../../../utils/global.dart';
|
import '../../../../utils/global.dart';
|
||||||
|
|
||||||
class MenuScreen extends StatefulWidget {
|
class MenuScreen extends StatefulWidget {
|
||||||
const MenuScreen({Key? key}) : super(key: key);
|
final UserData? userData;
|
||||||
|
const MenuScreen({Key? key, required this.userData}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<MenuScreen> createState() => _MenuScreenState();
|
State<MenuScreen> createState() => _MenuScreenState();
|
||||||
|
@ -16,6 +18,10 @@ class MenuScreen extends StatefulWidget {
|
||||||
class _MenuScreenState extends State<MenuScreen> {
|
class _MenuScreenState extends State<MenuScreen> {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
final String firstName =
|
||||||
|
widget.userData!.user!.login!.user!.firstName!.toUpperCase();
|
||||||
|
final String lastname =
|
||||||
|
widget.userData!.user!.login!.user!.lastName!.toUpperCase();
|
||||||
return SafeArea(
|
return SafeArea(
|
||||||
child: Drawer(
|
child: Drawer(
|
||||||
child: SingleChildScrollView(
|
child: SingleChildScrollView(
|
||||||
|
@ -24,13 +30,13 @@ class _MenuScreenState extends State<MenuScreen> {
|
||||||
child: Column(
|
child: Column(
|
||||||
// ignore: prefer_const_literals_to_create_immutables
|
// ignore: prefer_const_literals_to_create_immutables
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
const UserAccountsDrawerHeader(
|
UserAccountsDrawerHeader(
|
||||||
decoration: BoxDecoration(
|
decoration: const BoxDecoration(
|
||||||
color: primary,
|
color: primary,
|
||||||
image: DecorationImage(
|
image: DecorationImage(
|
||||||
image: AssetImage('assets/pngs/bg.png'),
|
image: AssetImage('assets/pngs/bg.png'),
|
||||||
fit: BoxFit.cover)),
|
fit: BoxFit.cover)),
|
||||||
accountName: Text("ACUIN" ", " "RODOLFO" " " "BERNALIS"),
|
accountName: Text("$firstName $lastname"),
|
||||||
accountEmail: null,
|
accountEmail: null,
|
||||||
currentAccountPicture: CircleAvatar(
|
currentAccountPicture: CircleAvatar(
|
||||||
radius: 40,
|
radius: 40,
|
||||||
|
@ -40,30 +46,26 @@ class _MenuScreenState extends State<MenuScreen> {
|
||||||
backgroundColor: third,
|
backgroundColor: third,
|
||||||
child: //Icon(Icons.person, size: 40, color: fifth),
|
child: //Icon(Icons.person, size: 40, color: fifth),
|
||||||
Text(
|
Text(
|
||||||
"A",
|
firstName[0].toUpperCase(),
|
||||||
style: TextStyle(fontSize: 45.0, color: fifth),
|
style: const TextStyle(fontSize: 45.0, color: fifth),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
getTile(Typicons.user_outline, "Profile", 'profile', context),
|
getTile(FontAwesome5.user, "Basic Info", 'profile', context,
|
||||||
|
widget.userData!),
|
||||||
const Divider(),
|
const Divider(),
|
||||||
getTile(Typicons.home_outline, "Address", '/SelfAddressScreen',
|
getTile(FontAwesome5.user_circle, "Profile",
|
||||||
context),
|
'/SelfAddressScreen', context, widget.userData!),
|
||||||
const Divider(),
|
|
||||||
getTile(Typicons.contacts, "Contact Number",
|
|
||||||
'/SelfContactScreen', context),
|
|
||||||
const Divider(),
|
|
||||||
getTile(Typicons.mail, "Email Address", '/SelfEmailAddScreen',
|
|
||||||
context),
|
|
||||||
const Divider(),
|
const Divider(),
|
||||||
getTile(FontAwesome5.life_ring, "Request SOS", 'request-sos',
|
getTile(FontAwesome5.life_ring, "Request SOS", 'request-sos',
|
||||||
context),
|
context, widget.userData!),
|
||||||
const Divider(),
|
const Divider(),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Align(
|
child: Align(
|
||||||
alignment: FractionalOffset.bottomLeft,
|
alignment: FractionalOffset.bottomLeft,
|
||||||
child: getTile(WebSymbols.logout, "Logout", 'login', context),
|
child: getTile(WebSymbols.logout, "Logout", 'login', context,
|
||||||
|
widget.userData!),
|
||||||
)),
|
)),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_zoom_drawer/flutter_zoom_drawer.dart';
|
import 'package:flutter_zoom_drawer/flutter_zoom_drawer.dart';
|
||||||
import 'package:go_router/go_router.dart';
|
import 'package:go_router/go_router.dart';
|
||||||
|
import 'package:unit2/model/login_data/user_info/user_data.dart';
|
||||||
import 'package:unit2/utils/alerts.dart';
|
import 'package:unit2/utils/alerts.dart';
|
||||||
import '../../../../theme-data.dart/colors.dart';
|
import '../../../../theme-data.dart/colors.dart';
|
||||||
|
|
||||||
Widget getTile(
|
Widget getTile(
|
||||||
IconData icondata, String title, String route, BuildContext context) {
|
IconData icondata, String title, String route, BuildContext context,UserData userData) {
|
||||||
return ListTile(
|
return ListTile(
|
||||||
dense: true,
|
dense: true,
|
||||||
leading: Icon(
|
leading: Icon(
|
||||||
|
@ -22,7 +23,7 @@ Widget getTile(
|
||||||
context.goNamed("login");
|
context.goNamed("login");
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
context.goNamed(route);
|
context.goNamed(route,extra: userData);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
|
@ -1,8 +1,16 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_bloc/flutter_bloc.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_awesome_icons.dart';
|
||||||
|
import 'package:fluttericon/typicons_icons.dart';
|
||||||
|
import 'package:unit2/screens/unit2/homepage.dart/components/dashboard.dart';
|
||||||
|
import 'package:unit2/test_data.dart';
|
||||||
import 'package:unit2/theme-data.dart/colors.dart';
|
import 'package:unit2/theme-data.dart/colors.dart';
|
||||||
import 'package:unit2/utils/text_container.dart';
|
import 'package:unit2/utils/text_container.dart';
|
||||||
|
|
||||||
|
import '../../../bloc/bloc/user_bloc.dart';
|
||||||
|
import '../../../model/login_data/user_info/role.dart';
|
||||||
import 'components/empty_module.dart';
|
import 'components/empty_module.dart';
|
||||||
|
|
||||||
class MainScreen extends StatefulWidget {
|
class MainScreen extends StatefulWidget {
|
||||||
|
@ -13,41 +21,98 @@ class MainScreen extends StatefulWidget {
|
||||||
}
|
}
|
||||||
|
|
||||||
class _MainScreenState extends State<MainScreen> {
|
class _MainScreenState extends State<MainScreen> {
|
||||||
bool hasModule = false;
|
List<Module> roles = [
|
||||||
|
Module(name: 'UniT2 roles', roles: []),
|
||||||
|
Module(name: 'DocSms roles', roles: [])
|
||||||
|
];
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return WillPopScope(
|
return WillPopScope(
|
||||||
onWillPop: () async {
|
onWillPop: () async {
|
||||||
return Future.value(true);
|
return Future.value(true);
|
||||||
},
|
},
|
||||||
child: SafeArea(
|
child: BlocBuilder<UserBloc, UserState>(builder: (context, state) {
|
||||||
child: Scaffold(
|
if (state is UserLoggedIn) {
|
||||||
appBar: AppBar(
|
state.userData!.user!.login!.user!.roles!.forEach((role) {
|
||||||
backgroundColor: primary,
|
Role? getRole = role;
|
||||||
leading: IconButton(
|
role!.modules!.forEach((module) {
|
||||||
onPressed: () {
|
if (module!.name!.toLowerCase() == 'unit2') {
|
||||||
ZoomDrawer.of(context)!.toggle();
|
IconData iconData = iconGenerator(getRole!.name!);
|
||||||
},
|
Roles newRole = Roles(role: getRole, icon: iconData);
|
||||||
icon: const Icon(
|
roles[0].roles.add(newRole);
|
||||||
Icons.menu,
|
}
|
||||||
color: Colors.white,
|
if (module.name!.toLowerCase() == 'document management') {
|
||||||
|
IconData iconData = iconGenerator(getRole!.name!);
|
||||||
|
Roles newRole = Roles(role: getRole, icon: iconData);
|
||||||
|
roles[1].roles.add(newRole);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
return SafeArea(
|
||||||
|
child: Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
backgroundColor: primary,
|
||||||
|
leading: IconButton(
|
||||||
|
onPressed: () {
|
||||||
|
ZoomDrawer.of(context)!.toggle();
|
||||||
|
},
|
||||||
|
icon: const Icon(
|
||||||
|
Icons.menu,
|
||||||
|
color: Colors.white,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
centerTitle: true,
|
||||||
|
title: const Text(
|
||||||
|
unit2ModuleScreen,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 18.0,
|
||||||
|
color: Colors.white,
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
body: state.userData!.user!.login!.user!.roles!.isNotEmpty
|
||||||
centerTitle: true,
|
? DashBoard(
|
||||||
title: const Text(
|
roles: roles,
|
||||||
unit2ModuleScreen,
|
)
|
||||||
style: TextStyle(
|
: const NoModule(),
|
||||||
fontSize: 18.0,
|
));
|
||||||
color: Colors.white,
|
}
|
||||||
),
|
return Container();
|
||||||
),
|
}),
|
||||||
),
|
|
||||||
body: hasModule
|
|
||||||
? const Center(
|
|
||||||
child: Text('Main Screen'),
|
|
||||||
)
|
|
||||||
: const NoModule(),
|
|
||||||
)),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
IconData iconGenerator(String roleName) {
|
||||||
|
IconData? iconData;
|
||||||
|
switch (roleName.toLowerCase()) {
|
||||||
|
case 'qr code scanner':
|
||||||
|
iconData = FontAwesome.qrcode;
|
||||||
|
break;
|
||||||
|
case 'security guard':
|
||||||
|
iconData = FontAwesome5.user_shield;
|
||||||
|
break;
|
||||||
|
case 'establishment point-person':
|
||||||
|
iconData = FontAwesome.building_filled;
|
||||||
|
break;
|
||||||
|
case 'registration in-charge':
|
||||||
|
iconData = FontAwesome.user_plus;
|
||||||
|
break;
|
||||||
|
case 'process server':
|
||||||
|
iconData = Typicons.doc_text;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return iconData!;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class Module {
|
||||||
|
final String name;
|
||||||
|
final List<Roles> roles;
|
||||||
|
Module({required this.name, required this.roles});
|
||||||
|
}
|
||||||
|
|
||||||
|
class Roles {
|
||||||
|
final IconData icon;
|
||||||
|
final Role role;
|
||||||
|
Roles({required this.role, required this.icon});
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,14 +4,18 @@ import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
import 'package:flutter_svg/flutter_svg.dart';
|
import 'package:flutter_svg/flutter_svg.dart';
|
||||||
import 'package:flutter_form_builder/flutter_form_builder.dart';
|
import 'package:flutter_form_builder/flutter_form_builder.dart';
|
||||||
import 'package:fluttericon/font_awesome5_icons.dart';
|
import 'package:fluttericon/font_awesome5_icons.dart';
|
||||||
|
import 'package:fluttertoast/fluttertoast.dart';
|
||||||
import 'package:form_builder_validators/form_builder_validators.dart';
|
import 'package:form_builder_validators/form_builder_validators.dart';
|
||||||
import 'package:go_router/go_router.dart';
|
import 'package:go_router/go_router.dart';
|
||||||
|
|
||||||
import 'package:flutter_progress_hud/flutter_progress_hud.dart';
|
import 'package:flutter_progress_hud/flutter_progress_hud.dart';
|
||||||
import 'package:unit2/bloc/bloc/user_bloc.dart';
|
import 'package:unit2/bloc/bloc/user_bloc.dart';
|
||||||
|
import 'package:unit2/model/login_data/user_info/user_data.dart';
|
||||||
|
import 'package:unit2/screens/unit2/login/qr_login.dart';
|
||||||
import 'package:unit2/utils/text_container.dart';
|
import 'package:unit2/utils/text_container.dart';
|
||||||
import 'package:unit2/widgets/error_state.dart';
|
import 'package:unit2/widgets/error_state.dart';
|
||||||
|
|
||||||
|
import '../../../utils/scanner.dart';
|
||||||
import '../../../widgets/splash_screen.dart';
|
import '../../../widgets/splash_screen.dart';
|
||||||
import '../../../widgets/wave.dart';
|
import '../../../widgets/wave.dart';
|
||||||
import '../../../utils/global.dart';
|
import '../../../utils/global.dart';
|
||||||
|
@ -40,9 +44,15 @@ class _UniT2LoginState extends State<UniT2Login> {
|
||||||
body: ProgressHUD(
|
body: ProgressHUD(
|
||||||
child: BlocConsumer<UserBloc, UserState>(listener: (context, state) {
|
child: BlocConsumer<UserBloc, UserState>(listener: (context, state) {
|
||||||
if (state is UserLoggedIn) {
|
if (state is UserLoggedIn) {
|
||||||
|
print("login" + state.toString());
|
||||||
final progress = ProgressHUD.of(context);
|
final progress = ProgressHUD.of(context);
|
||||||
progress!.dismiss();
|
progress!.dismiss();
|
||||||
debugPrint(state.userData!.user!.login!.user!.firstName);
|
context.goNamed('home', extra: state.userData);
|
||||||
|
}
|
||||||
|
if (state is UuidLoaded) {
|
||||||
|
Navigator.push(context, MaterialPageRoute(builder: (context) {
|
||||||
|
return QRLogin();
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
}, builder: (context, state) {
|
}, builder: (context, state) {
|
||||||
if (state is VersionLoaded) {
|
if (state is VersionLoaded) {
|
||||||
|
@ -50,6 +60,7 @@ class _UniT2LoginState extends State<UniT2Login> {
|
||||||
return SizedBox(
|
return SizedBox(
|
||||||
child: SingleChildScrollView(
|
child: SingleChildScrollView(
|
||||||
child: Stack(
|
child: Stack(
|
||||||
|
alignment: Alignment.center,
|
||||||
children: [
|
children: [
|
||||||
Positioned(
|
Positioned(
|
||||||
bottom: 0,
|
bottom: 0,
|
||||||
|
@ -64,11 +75,11 @@ class _UniT2LoginState extends State<UniT2Login> {
|
||||||
const EdgeInsets.symmetric(horizontal: 25),
|
const EdgeInsets.symmetric(horizontal: 25),
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
SizedBox(height: blockSizeVertical * 7),
|
|
||||||
SvgPicture.asset(
|
SvgPicture.asset(
|
||||||
'assets/svgs/logo.svg',
|
'assets/svgs/logo.svg',
|
||||||
height: blockSizeVertical * 16,
|
height: blockSizeVertical * 12,
|
||||||
allowDrawingOutsideViewBox: true,
|
allowDrawingOutsideViewBox: true,
|
||||||
color: primary,
|
color: primary,
|
||||||
),
|
),
|
||||||
|
@ -76,25 +87,25 @@ class _UniT2LoginState extends State<UniT2Login> {
|
||||||
Text(
|
Text(
|
||||||
welcome,
|
welcome,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: blockSizeVertical * 5,
|
fontSize: blockSizeVertical * 4,
|
||||||
fontWeight: FontWeight.w600),
|
fontWeight: FontWeight.w600),
|
||||||
),
|
),
|
||||||
Text(unitApp,
|
Text(unitApp,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: blockSizeVertical * 8,
|
fontSize: blockSizeVertical * 6,
|
||||||
fontWeight: FontWeight.w800,
|
fontWeight: FontWeight.w800,
|
||||||
letterSpacing: .2,
|
letterSpacing: .2,
|
||||||
height: 1,
|
height: 1,
|
||||||
color: primary)),
|
color: primary)),
|
||||||
Text(
|
// Text(
|
||||||
loginToContinue,
|
// loginToContinue,
|
||||||
style: TextStyle(
|
// style: TextStyle(
|
||||||
fontSize: blockSizeVertical * 2,
|
// fontSize: blockSizeVertical * 1.7,
|
||||||
height: 1.5,
|
// height: 1.5,
|
||||||
fontWeight: FontWeight.w600),
|
// fontWeight: FontWeight.w600),
|
||||||
),
|
// ),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: blockSizeVertical * 1.5,
|
height: blockSizeVertical * 3,
|
||||||
),
|
),
|
||||||
// USERNAME
|
// USERNAME
|
||||||
FormBuilderTextField(
|
FormBuilderTextField(
|
||||||
|
@ -243,17 +254,10 @@ class _UniT2LoginState extends State<UniT2Login> {
|
||||||
loginViaQr,
|
loginViaQr,
|
||||||
style: TextStyle(color: second),
|
style: TextStyle(color: second),
|
||||||
),
|
),
|
||||||
onPressed: () async {
|
onPressed: () {
|
||||||
context.goNamed('register');
|
context
|
||||||
// ScanResult result =
|
.read<UserBloc>()
|
||||||
// await QRCodeBarCodeScanner.instance
|
.add(GetUuid());
|
||||||
// .scanner();
|
|
||||||
|
|
||||||
// debugPrint(result.type.toString());
|
|
||||||
// debugPrint(
|
|
||||||
// result.rawContent.toString());
|
|
||||||
// BlocProvider.of<UserBloc>(context)
|
|
||||||
// .add(QRCodelogin());
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
)),
|
)),
|
||||||
|
@ -302,9 +306,7 @@ class _UniT2LoginState extends State<UniT2Login> {
|
||||||
if (state is SplashScreen) {
|
if (state is SplashScreen) {
|
||||||
return const UniTSplashScreen();
|
return const UniTSplashScreen();
|
||||||
}
|
}
|
||||||
return const Center(
|
return Container();
|
||||||
child: Text("Default"),
|
|
||||||
);
|
|
||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
|
@ -0,0 +1,239 @@
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter/src/widgets/container.dart';
|
||||||
|
import 'package:flutter/src/widgets/framework.dart';
|
||||||
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
|
import 'package:flutter_form_builder/flutter_form_builder.dart';
|
||||||
|
import 'package:flutter_svg/svg.dart';
|
||||||
|
import 'package:fluttericon/font_awesome5_icons.dart';
|
||||||
|
import 'package:fluttericon/font_awesome_icons.dart';
|
||||||
|
import 'package:form_builder_validators/form_builder_validators.dart';
|
||||||
|
import 'package:go_router/go_router.dart';
|
||||||
|
import 'package:unit2/theme-data.dart/btn-style.dart';
|
||||||
|
import 'package:unit2/widgets/wave.dart';
|
||||||
|
|
||||||
|
import '../../../bloc/bloc/user_bloc.dart';
|
||||||
|
import '../../../theme-data.dart/colors.dart';
|
||||||
|
import '../../../theme-data.dart/form-style.dart';
|
||||||
|
import '../../../utils/global.dart';
|
||||||
|
import '../../../utils/text_container.dart';
|
||||||
|
import '../../../utils/validators.dart';
|
||||||
|
|
||||||
|
class QRLogin extends StatefulWidget {
|
||||||
|
const QRLogin({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<QRLogin> createState() => _QRLoginState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _QRLoginState extends State<QRLogin> {
|
||||||
|
bool showSuffixIcon = false;
|
||||||
|
bool _showPassword = true;
|
||||||
|
final _formKey = GlobalKey<FormBuilderState>();
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return SafeArea(
|
||||||
|
child: Scaffold(
|
||||||
|
resizeToAvoidBottomInset: true,
|
||||||
|
appBar: AppBar(
|
||||||
|
backgroundColor: primary,
|
||||||
|
elevation: 0,
|
||||||
|
automaticallyImplyLeading: true,
|
||||||
|
title: const Text("Login via QR"),
|
||||||
|
centerTitle: true,
|
||||||
|
),
|
||||||
|
body: BlocBuilder<UserBloc, UserState>(
|
||||||
|
builder: (context, state) {
|
||||||
|
print(state);
|
||||||
|
if (state is UuidLoaded) {
|
||||||
|
return Center(
|
||||||
|
child: Text(state.uuid),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return SingleChildScrollView(
|
||||||
|
child: Stack(
|
||||||
|
children: [
|
||||||
|
Positioned(
|
||||||
|
bottom: 0,
|
||||||
|
child: WaveReverse(height: blockSizeVertical * 8)),
|
||||||
|
Container(
|
||||||
|
height: screenHeight * .90,
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 15),
|
||||||
|
child: FormBuilder(
|
||||||
|
key: _formKey,
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
SvgPicture.asset(
|
||||||
|
'assets/svgs/logo.svg',
|
||||||
|
height: blockSizeVertical * 12,
|
||||||
|
allowDrawingOutsideViewBox: true,
|
||||||
|
color: primary,
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 12,
|
||||||
|
),
|
||||||
|
Text(unitApp,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: blockSizeVertical * 5,
|
||||||
|
fontWeight: FontWeight.w800,
|
||||||
|
letterSpacing: .2,
|
||||||
|
height: 1,
|
||||||
|
color: Colors.black87)),
|
||||||
|
const SizedBox(
|
||||||
|
height: 15,
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
"Enter your password",
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: blockSizeVertical * 1.5,
|
||||||
|
height: 1.5,
|
||||||
|
fontWeight: FontWeight.w600),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 15,
|
||||||
|
),
|
||||||
|
// Password
|
||||||
|
FormBuilderTextField(
|
||||||
|
name: 'password',
|
||||||
|
validator: registerPasswordValidator,
|
||||||
|
// initialValue: state.password,
|
||||||
|
onChanged: (value) {
|
||||||
|
value!.isEmpty
|
||||||
|
? setState(() {
|
||||||
|
showSuffixIcon = false;
|
||||||
|
})
|
||||||
|
: setState(() {
|
||||||
|
showSuffixIcon = true;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
autofocus: false,
|
||||||
|
style: const TextStyle(
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
color: Colors.black87),
|
||||||
|
decoration: loginTextFieldStyle().copyWith(
|
||||||
|
suffixIcon: Visibility(
|
||||||
|
visible: showSuffixIcon,
|
||||||
|
child: _showPassword
|
||||||
|
? IconButton(
|
||||||
|
icon: Icon(FontAwesome5.eye_slash,
|
||||||
|
size: 24,
|
||||||
|
color: Theme.of(context)
|
||||||
|
.textTheme
|
||||||
|
.displayLarge
|
||||||
|
?.color),
|
||||||
|
onPressed: () {
|
||||||
|
setState(() {
|
||||||
|
_showPassword = false;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
)
|
||||||
|
: IconButton(
|
||||||
|
onPressed: () {
|
||||||
|
setState(() {
|
||||||
|
_showPassword = true;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
icon: Icon(FontAwesome5.eye,
|
||||||
|
size: 24,
|
||||||
|
color: Theme.of(context)
|
||||||
|
.textTheme
|
||||||
|
.displayLarge
|
||||||
|
?.color)),
|
||||||
|
),
|
||||||
|
prefixIcon: const Icon(Icons.lock),
|
||||||
|
labelText: "Password",
|
||||||
|
hintText: enterPassword),
|
||||||
|
obscureText: _showPassword ? true : false,
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 15,
|
||||||
|
),
|
||||||
|
// FormBuilderTextField(
|
||||||
|
// name: 'confirmPassword',
|
||||||
|
// validator: registerPasswordValidator,
|
||||||
|
// // initialValue: state.password,
|
||||||
|
// onChanged: (value) {
|
||||||
|
// value!.isEmpty
|
||||||
|
// ? setState(() {
|
||||||
|
// showSuffixIcon = false;
|
||||||
|
// })
|
||||||
|
// : setState(() {
|
||||||
|
// showSuffixIcon = true;
|
||||||
|
// });
|
||||||
|
// },
|
||||||
|
// autofocus: false,
|
||||||
|
// style: const TextStyle(
|
||||||
|
// fontWeight: FontWeight.bold, color: Colors.black87),
|
||||||
|
// decoration: loginTextFieldStyle().copyWith(
|
||||||
|
// suffixIcon: Visibility(
|
||||||
|
// visible: showSuffixIcon,
|
||||||
|
// child: _showPassword
|
||||||
|
// ? IconButton(
|
||||||
|
// icon: Icon(FontAwesome5.eye_slash,
|
||||||
|
// size: 24,
|
||||||
|
// color: Theme.of(context)
|
||||||
|
// .textTheme
|
||||||
|
// .displayLarge
|
||||||
|
// ?.color),
|
||||||
|
// onPressed: () {
|
||||||
|
// setState(() {
|
||||||
|
// _showPassword = false;
|
||||||
|
// });
|
||||||
|
// },
|
||||||
|
// )
|
||||||
|
// : IconButton(
|
||||||
|
// onPressed: () {
|
||||||
|
// setState(() {
|
||||||
|
// _showPassword = true;
|
||||||
|
// });
|
||||||
|
// },
|
||||||
|
// icon: Icon(FontAwesome5.eye,
|
||||||
|
// size: 24,
|
||||||
|
// color: Theme.of(context)
|
||||||
|
// .textTheme
|
||||||
|
// .displayLarge
|
||||||
|
// ?.color)),
|
||||||
|
// ),
|
||||||
|
// prefixIcon: const Icon(Icons.lock),
|
||||||
|
// labelText: confirmPassword,
|
||||||
|
// hintText: enterConfirmPassword),
|
||||||
|
// obscureText: _showPassword ? true : false,
|
||||||
|
// ),
|
||||||
|
const SizedBox(
|
||||||
|
height: 15,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
width: double.infinity,
|
||||||
|
height: blockSizeVertical * 6,
|
||||||
|
child: ElevatedButton(
|
||||||
|
style: secondaryBtnStyle(
|
||||||
|
second, Colors.transparent, primary),
|
||||||
|
onPressed: () {
|
||||||
|
if (_formKey.currentState!
|
||||||
|
.saveAndValidate()) {
|
||||||
|
BlocProvider.of<UserBloc>(context)
|
||||||
|
.add(UserLogin(
|
||||||
|
username: _formKey
|
||||||
|
.currentState!.value['username'],
|
||||||
|
password: _formKey
|
||||||
|
.currentState!.value['password'],
|
||||||
|
));
|
||||||
|
}
|
||||||
|
},
|
||||||
|
child: const Text(submit)),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,213 +0,0 @@
|
||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:flutter/src/widgets/container.dart';
|
|
||||||
import 'package:flutter/src/widgets/framework.dart';
|
|
||||||
import 'package:flutter_form_builder/flutter_form_builder.dart';
|
|
||||||
import 'package:flutter_svg/svg.dart';
|
|
||||||
import 'package:fluttericon/font_awesome5_icons.dart';
|
|
||||||
import 'package:fluttericon/font_awesome_icons.dart';
|
|
||||||
import 'package:form_builder_validators/form_builder_validators.dart';
|
|
||||||
import 'package:go_router/go_router.dart';
|
|
||||||
import 'package:unit2/theme-data.dart/btn-style.dart';
|
|
||||||
import 'package:unit2/widgets/wave.dart';
|
|
||||||
|
|
||||||
import '../../../theme-data.dart/colors.dart';
|
|
||||||
import '../../../theme-data.dart/form-style.dart';
|
|
||||||
import '../../../utils/global.dart';
|
|
||||||
import '../../../utils/text_container.dart';
|
|
||||||
import '../../../utils/validators.dart';
|
|
||||||
|
|
||||||
class Register extends StatefulWidget {
|
|
||||||
const Register({super.key});
|
|
||||||
|
|
||||||
@override
|
|
||||||
State<Register> createState() => _RegisterState();
|
|
||||||
}
|
|
||||||
|
|
||||||
class _RegisterState extends State<Register> {
|
|
||||||
bool showSuffixIcon = false;
|
|
||||||
bool _showPassword = true;
|
|
||||||
final _formKey = GlobalKey<FormBuilderState>();
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return SafeArea(
|
|
||||||
child: Scaffold(
|
|
||||||
resizeToAvoidBottomInset: true,
|
|
||||||
appBar: AppBar(
|
|
||||||
backgroundColor: primary,
|
|
||||||
elevation: 0,
|
|
||||||
automaticallyImplyLeading: true,
|
|
||||||
title: const Text("Register password"),
|
|
||||||
centerTitle: true,
|
|
||||||
),
|
|
||||||
body: SingleChildScrollView(
|
|
||||||
child: Stack(
|
|
||||||
children: [
|
|
||||||
Wave(height: blockSizeVertical * 8),
|
|
||||||
Positioned(
|
|
||||||
bottom: 0, child: WaveReverse(height: blockSizeVertical * 8)),
|
|
||||||
Container(
|
|
||||||
height: screenHeight * .90,
|
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 15),
|
|
||||||
child: FormBuilder(
|
|
||||||
key: _formKey,
|
|
||||||
child: Column(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
children: [
|
|
||||||
SvgPicture.asset(
|
|
||||||
'assets/svgs/logo.svg',
|
|
||||||
height: blockSizeVertical * 16,
|
|
||||||
allowDrawingOutsideViewBox: true,
|
|
||||||
color: primary,
|
|
||||||
),
|
|
||||||
Text(unitApp,
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: blockSizeVertical * 8,
|
|
||||||
fontWeight: FontWeight.w800,
|
|
||||||
letterSpacing: .2,
|
|
||||||
height: 1,
|
|
||||||
color: Colors.black87)),
|
|
||||||
Text(
|
|
||||||
registerToContinue,
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: blockSizeVertical * 2,
|
|
||||||
height: 1.5,
|
|
||||||
fontWeight: FontWeight.w600),
|
|
||||||
),
|
|
||||||
const SizedBox(
|
|
||||||
height: 15,
|
|
||||||
),
|
|
||||||
// Password
|
|
||||||
FormBuilderTextField(
|
|
||||||
name: 'password',
|
|
||||||
validator: registerPasswordValidator,
|
|
||||||
// initialValue: state.password,
|
|
||||||
onChanged: (value) {
|
|
||||||
value!.isEmpty
|
|
||||||
? setState(() {
|
|
||||||
showSuffixIcon = false;
|
|
||||||
})
|
|
||||||
: setState(() {
|
|
||||||
showSuffixIcon = true;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
autofocus: false,
|
|
||||||
style: const TextStyle(
|
|
||||||
fontWeight: FontWeight.bold, color: Colors.black87),
|
|
||||||
decoration: loginTextFieldStyle().copyWith(
|
|
||||||
suffixIcon: Visibility(
|
|
||||||
visible: showSuffixIcon,
|
|
||||||
child: _showPassword
|
|
||||||
? IconButton(
|
|
||||||
icon: Icon(FontAwesome5.eye_slash,
|
|
||||||
size: 24,
|
|
||||||
color: Theme.of(context)
|
|
||||||
.textTheme
|
|
||||||
.displayLarge
|
|
||||||
?.color),
|
|
||||||
onPressed: () {
|
|
||||||
setState(() {
|
|
||||||
_showPassword = false;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
)
|
|
||||||
: IconButton(
|
|
||||||
onPressed: () {
|
|
||||||
setState(() {
|
|
||||||
_showPassword = true;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
icon: Icon(FontAwesome5.eye,
|
|
||||||
size: 24,
|
|
||||||
color: Theme.of(context)
|
|
||||||
.textTheme
|
|
||||||
.displayLarge
|
|
||||||
?.color)),
|
|
||||||
),
|
|
||||||
prefixIcon: const Icon(Icons.lock),
|
|
||||||
labelText: "Password",
|
|
||||||
hintText: enterPassword),
|
|
||||||
obscureText: _showPassword ? true : false,
|
|
||||||
),
|
|
||||||
const SizedBox(
|
|
||||||
height: 15,
|
|
||||||
),
|
|
||||||
FormBuilderTextField(
|
|
||||||
name: 'confirmPassword',
|
|
||||||
validator: registerPasswordValidator,
|
|
||||||
// initialValue: state.password,
|
|
||||||
onChanged: (value) {
|
|
||||||
value!.isEmpty
|
|
||||||
? setState(() {
|
|
||||||
showSuffixIcon = false;
|
|
||||||
})
|
|
||||||
: setState(() {
|
|
||||||
showSuffixIcon = true;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
autofocus: false,
|
|
||||||
style: const TextStyle(
|
|
||||||
fontWeight: FontWeight.bold, color: Colors.black87),
|
|
||||||
decoration: loginTextFieldStyle().copyWith(
|
|
||||||
suffixIcon: Visibility(
|
|
||||||
visible: showSuffixIcon,
|
|
||||||
child: _showPassword
|
|
||||||
? IconButton(
|
|
||||||
icon: Icon(FontAwesome5.eye_slash,
|
|
||||||
size: 24,
|
|
||||||
color: Theme.of(context)
|
|
||||||
.textTheme
|
|
||||||
.displayLarge
|
|
||||||
?.color),
|
|
||||||
onPressed: () {
|
|
||||||
setState(() {
|
|
||||||
_showPassword = false;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
)
|
|
||||||
: IconButton(
|
|
||||||
onPressed: () {
|
|
||||||
setState(() {
|
|
||||||
_showPassword = true;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
icon: Icon(FontAwesome5.eye,
|
|
||||||
size: 24,
|
|
||||||
color: Theme.of(context)
|
|
||||||
.textTheme
|
|
||||||
.displayLarge
|
|
||||||
?.color)),
|
|
||||||
),
|
|
||||||
prefixIcon: const Icon(Icons.lock),
|
|
||||||
labelText: confirmPassword,
|
|
||||||
hintText: enterConfirmPassword),
|
|
||||||
obscureText: _showPassword ? true : false,
|
|
||||||
),
|
|
||||||
const SizedBox(
|
|
||||||
height: 15,
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
width: double.infinity,
|
|
||||||
height: blockSizeVertical * 6,
|
|
||||||
child: ElevatedButton(
|
|
||||||
style: secondaryBtnStyle(
|
|
||||||
second, Colors.transparent, primary),
|
|
||||||
onPressed: () {
|
|
||||||
if (_formKey.currentState!.saveAndValidate()) {
|
|
||||||
context.goNamed('home');
|
|
||||||
}
|
|
||||||
},
|
|
||||||
child: const Text(register)),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,14 +1,19 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
|
import 'package:flutter_progress_hud/flutter_progress_hud.dart';
|
||||||
import 'package:flutter_svg/svg.dart';
|
import 'package:flutter_svg/svg.dart';
|
||||||
import 'package:fluttericon/font_awesome5_icons.dart';
|
import 'package:fluttericon/font_awesome5_icons.dart';
|
||||||
import 'package:fluttericon/web_symbols_icons.dart';
|
|
||||||
import 'package:go_router/go_router.dart';
|
import 'package:go_router/go_router.dart';
|
||||||
|
import 'package:intl/intl.dart';
|
||||||
import 'package:qr_flutter/qr_flutter.dart';
|
import 'package:qr_flutter/qr_flutter.dart';
|
||||||
|
import 'package:unit2/bloc/bloc/user_bloc.dart';
|
||||||
|
import 'package:unit2/model/login_data/user_info/user_data.dart';
|
||||||
import 'package:unit2/test_data.dart';
|
import 'package:unit2/test_data.dart';
|
||||||
import 'package:unit2/theme-data.dart/btn-style.dart';
|
import 'package:unit2/theme-data.dart/btn-style.dart';
|
||||||
import 'package:unit2/utils/global.dart';
|
import 'package:unit2/utils/global.dart';
|
||||||
import 'package:unit2/utils/text_container.dart';
|
import 'package:unit2/utils/text_container.dart';
|
||||||
import '../../../theme-data.dart/colors.dart';
|
import '../../../theme-data.dart/colors.dart';
|
||||||
|
import '../../../widgets/splash_screen.dart';
|
||||||
import './components/cover-image.dart';
|
import './components/cover-image.dart';
|
||||||
|
|
||||||
class Profile extends StatelessWidget {
|
class Profile extends StatelessWidget {
|
||||||
|
@ -20,69 +25,81 @@ class Profile extends StatelessWidget {
|
||||||
onWillPop: () async {
|
onWillPop: () async {
|
||||||
return Future.value(true);
|
return Future.value(true);
|
||||||
},
|
},
|
||||||
child: SafeArea(
|
child: ProgressHUD(
|
||||||
child: Scaffold(
|
child: BlocBuilder<UserBloc, UserState>(
|
||||||
body: SizedBox(
|
builder: (context, state) {
|
||||||
width: screenWidth,
|
if (state is UserLoggedIn) {
|
||||||
child: Column(
|
state.userData!.employeeInfo!.profile!.sex!.toUpperCase();
|
||||||
children: [
|
return SafeArea(
|
||||||
Stack(
|
child: Scaffold(
|
||||||
clipBehavior: Clip.none,
|
body: SizedBox(
|
||||||
alignment: Alignment.center,
|
width: screenWidth,
|
||||||
children: [
|
child: Column(
|
||||||
const CoverImage(),
|
children: [
|
||||||
Positioned(
|
Stack(
|
||||||
top: blockSizeVertical * 17.5,
|
clipBehavior: Clip.none,
|
||||||
child: Stack(
|
alignment: Alignment.center,
|
||||||
alignment: Alignment.center,
|
children: [
|
||||||
children: [
|
const CoverImage(),
|
||||||
const CircleAvatar(
|
Positioned(
|
||||||
radius: 72,
|
top: blockSizeVertical * 17.5,
|
||||||
backgroundColor: Colors.white,
|
child: Stack(
|
||||||
),
|
alignment: Alignment.center,
|
||||||
CircleAvatar(
|
children: [
|
||||||
radius: 69,
|
const CircleAvatar(
|
||||||
backgroundColor: Colors.grey.shade800,
|
radius: 72,
|
||||||
child: SvgPicture.asset(
|
backgroundColor: Colors.white,
|
||||||
'assets/svgs/male.svg',
|
),
|
||||||
|
CircleAvatar(
|
||||||
|
radius: 69,
|
||||||
|
backgroundColor: Colors.grey.shade800,
|
||||||
|
child: SvgPicture.asset(
|
||||||
|
'assets/svgs/male.svg',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
Positioned(
|
||||||
],
|
top: 10,
|
||||||
),
|
left: 20,
|
||||||
|
child: IconButton(
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.pop(context);
|
||||||
|
},
|
||||||
|
icon: const Icon(
|
||||||
|
FontAwesome5.arrow_left,
|
||||||
|
size: 24,
|
||||||
|
color: Colors.white,
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
Positioned(
|
||||||
|
top: 10,
|
||||||
|
right: 20,
|
||||||
|
child: IconButton(
|
||||||
|
onPressed: () {},
|
||||||
|
icon: const Icon(
|
||||||
|
Icons.edit,
|
||||||
|
size: 24,
|
||||||
|
color: Colors.white,
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: blockSizeVertical * 5,
|
||||||
|
),
|
||||||
|
BuildInformation(
|
||||||
|
userData: state.userData!,
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
Positioned(
|
),
|
||||||
top: 10,
|
|
||||||
left: 20,
|
|
||||||
child: IconButton(
|
|
||||||
onPressed: () {
|
|
||||||
context.go(context.namedLocation('home'));
|
|
||||||
},
|
|
||||||
icon: const Icon(
|
|
||||||
FontAwesome5.arrow_left,
|
|
||||||
size: 24,
|
|
||||||
color: Colors.white,
|
|
||||||
),
|
|
||||||
)),
|
|
||||||
Positioned(
|
|
||||||
top: 10,
|
|
||||||
right: 20,
|
|
||||||
child: IconButton(
|
|
||||||
onPressed: () {},
|
|
||||||
icon: const Icon(
|
|
||||||
Icons.edit,
|
|
||||||
size: 24,
|
|
||||||
color: Colors.white,
|
|
||||||
),
|
|
||||||
)),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
SizedBox(
|
);
|
||||||
height: blockSizeVertical * 5,
|
}
|
||||||
),
|
return const UniTSplashScreen();
|
||||||
const BuildInformation(),
|
},
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
@ -90,9 +107,19 @@ class Profile extends StatelessWidget {
|
||||||
}
|
}
|
||||||
|
|
||||||
class BuildInformation extends StatelessWidget {
|
class BuildInformation extends StatelessWidget {
|
||||||
const BuildInformation({super.key});
|
final UserData userData;
|
||||||
|
const BuildInformation({super.key, required this.userData});
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
DateFormat dteFormat2 = DateFormat.yMMMMd('en_US');
|
||||||
|
final String firstName =
|
||||||
|
userData.user!.login!.user!.firstName!.toUpperCase();
|
||||||
|
final String lastname = userData.user!.login!.user!.lastName!.toUpperCase();
|
||||||
|
final String middlename =
|
||||||
|
userData.employeeInfo!.profile!.middleName!.toUpperCase();
|
||||||
|
final String sex = userData.employeeInfo!.profile!.sex!.toUpperCase();
|
||||||
|
final DateTime? bday = userData.employeeInfo!.profile!.birthdate;
|
||||||
|
final uuid = userData.employeeInfo!.uuid;
|
||||||
return Container(
|
return Container(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 25),
|
padding: const EdgeInsets.symmetric(horizontal: 25),
|
||||||
width: screenWidth,
|
width: screenWidth,
|
||||||
|
@ -102,7 +129,8 @@ class BuildInformation extends StatelessWidget {
|
||||||
height: 25,
|
height: 25,
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
"Rodolfo Bernales Acuin",
|
"$firstName $middlename $lastname",
|
||||||
|
textAlign: TextAlign.center,
|
||||||
style: Theme.of(context)
|
style: Theme.of(context)
|
||||||
.textTheme
|
.textTheme
|
||||||
.headline5!
|
.headline5!
|
||||||
|
@ -112,14 +140,14 @@ class BuildInformation extends StatelessWidget {
|
||||||
height: 10,
|
height: 10,
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
"july 14, 1994 | Male",
|
"${dteFormat2.format(bday!)} | $sex",
|
||||||
style: Theme.of(context).textTheme.caption!.copyWith(fontSize: 18),
|
style: Theme.of(context).textTheme.caption!.copyWith(fontSize: 18),
|
||||||
),
|
),
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 15,
|
height: 15,
|
||||||
),
|
),
|
||||||
QrImage(
|
QrImage(
|
||||||
data: uuid,
|
data: uuid!,
|
||||||
size: blockSizeVertical * 30,
|
size: blockSizeVertical * 30,
|
||||||
),
|
),
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
|
|
|
@ -1,5 +1,10 @@
|
||||||
import 'package:azlistview/azlistview.dart';
|
import 'package:azlistview/azlistview.dart';
|
||||||
String uuid = 'f68c3142-b939-11ec-9acb-3939f0cc109a';
|
import 'package:flutter/cupertino.dart';
|
||||||
|
import 'package:fluttericon/font_awesome5_icons.dart';
|
||||||
|
import 'package:fluttericon/font_awesome_icons.dart';
|
||||||
|
import 'package:fluttericon/rpg_awesome_icons.dart';
|
||||||
|
import 'package:unit2/model/login_data/user_info/role.dart';
|
||||||
|
|
||||||
List<String> levels = ['Establishments', 'Office'];
|
List<String> levels = ['Establishments', 'Office'];
|
||||||
List<String> establishments = ['Provincial Government of Agusan del Norte'];
|
List<String> establishments = ['Provincial Government of Agusan del Norte'];
|
||||||
List<String> checkPointAreas = [
|
List<String> checkPointAreas = [
|
||||||
|
@ -85,3 +90,17 @@ class Person extends ISuspensionBean {
|
||||||
return lastname[0];
|
return lastname[0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// List<Roles> roles = [
|
||||||
|
// Roles(name: 'QR scanner', icon: FontAwesome.qrcode),
|
||||||
|
// Roles(name: "Security", icon: FontAwesome5.user_shield),
|
||||||
|
// Roles(name: "Establishment point person", icon: FontAwesome.building_filled),
|
||||||
|
// Roles(name: "Registration in charge", icon: FontAwesome.user_plus),
|
||||||
|
// Roles(name: 'Super admin', icon: FontAwesome5.user_lock),
|
||||||
|
// Roles(name: "Purok president", icon: FontAwesome5.user_tie),
|
||||||
|
// Roles(name: "Check point inchage", icon: FontAwesome5.hand_paper),
|
||||||
|
// Roles(name: "Health officer", icon: RpgAwesome.health_decrease),
|
||||||
|
|
||||||
|
// ];
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
// import 'package:flutter/cupertino.dart';
|
||||||
|
// import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
|
|
||||||
|
// class AppRouter{
|
||||||
|
// Route onGenerateRoute(RouteSettings routeSettings){
|
||||||
|
// switch(routeSettings.name){
|
||||||
|
// case '/':
|
||||||
|
// return BlocProvider(
|
||||||
|
// create: (context) => UserBloc()..add(GetApkVersion()),
|
||||||
|
// child: const UniT2Login(),
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
|
@ -0,0 +1,6 @@
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class NavigationService {
|
||||||
|
static GlobalKey<NavigatorState> navigatorKey =
|
||||||
|
GlobalKey<NavigatorState>();
|
||||||
|
}
|
|
@ -2,10 +2,12 @@ import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
import 'package:go_router/go_router.dart';
|
import 'package:go_router/go_router.dart';
|
||||||
import 'package:unit2/bloc/bloc/user_bloc.dart';
|
import 'package:unit2/bloc/bloc/user_bloc.dart';
|
||||||
import 'package:unit2/screens/unit2/login/register.dart';
|
import 'package:unit2/model/login_data/user_info/user_data.dart';
|
||||||
|
import 'package:unit2/screens/unit2/login/qr_login.dart';
|
||||||
import 'package:unit2/screens/unit2/roles/qr_code_scanner.dart/scan.dart';
|
import 'package:unit2/screens/unit2/roles/qr_code_scanner.dart/scan.dart';
|
||||||
import 'package:unit2/screens/unit2/roles/qr_code_scanner.dart/settings_screen.dart';
|
import 'package:unit2/screens/unit2/roles/qr_code_scanner.dart/settings_screen.dart';
|
||||||
import 'package:unit2/screens/unit2/signature/signature_pad.dart';
|
import 'package:unit2/screens/unit2/signature/signature_pad.dart';
|
||||||
|
import 'package:unit2/utils/global_context.dart';
|
||||||
import 'package:unit2/utils/scanner.dart';
|
import 'package:unit2/utils/scanner.dart';
|
||||||
import '../screens/docsms/components/doc_info_tile.dart';
|
import '../screens/docsms/components/doc_info_tile.dart';
|
||||||
import '../screens/docsms/request_receipt.dart';
|
import '../screens/docsms/request_receipt.dart';
|
||||||
|
@ -21,24 +23,38 @@ final GoRouter goRouter = GoRouter(routes: <GoRoute>[
|
||||||
path: '/',
|
path: '/',
|
||||||
name: 'login',
|
name: 'login',
|
||||||
builder: (context, state) {
|
builder: (context, state) {
|
||||||
debugPrint("login bloc called");
|
return BlocProvider(
|
||||||
BlocProvider.of<UserBloc>(context).add(GetApkVersion());
|
create: (context) => UserBloc()..add(GetApkVersion()),
|
||||||
return const UniT2Login();
|
child: const UniT2Login(),
|
||||||
|
);
|
||||||
},
|
},
|
||||||
routes: [
|
routes: [
|
||||||
GoRoute(
|
// GoRoute(
|
||||||
name: 'register',
|
// name: 'qr-login',
|
||||||
path: 'register',
|
// path: 'qr-login',
|
||||||
builder: ((context, state) => const Register())),
|
// builder: ((context, state) => const QRLogin())),
|
||||||
GoRoute(
|
GoRoute(
|
||||||
name: 'home',
|
name: 'home',
|
||||||
path: 'home',
|
path: 'home',
|
||||||
builder: (context, state) => const DrawerScreen(),
|
builder: (context, state) {
|
||||||
|
UserData userData = state.extra as UserData;
|
||||||
|
return BlocProvider<UserBloc>.value(
|
||||||
|
value: UserBloc()..add((LoadLoggedInUser(userData: userData))),
|
||||||
|
child: const DrawerScreen(),
|
||||||
|
);
|
||||||
|
},
|
||||||
routes: [
|
routes: [
|
||||||
GoRoute(
|
GoRoute(
|
||||||
name: 'profile',
|
name: 'profile',
|
||||||
path: 'profile',
|
path: 'profile',
|
||||||
builder: (context, state) => const Profile(),
|
builder: (context, state) {
|
||||||
|
UserData userData = state.extra as UserData;
|
||||||
|
return BlocProvider<UserBloc>.value(
|
||||||
|
value: UserBloc()
|
||||||
|
..add((LoadLoggedInUser(userData: userData))),
|
||||||
|
child: const Profile(),
|
||||||
|
);
|
||||||
|
},
|
||||||
routes: [
|
routes: [
|
||||||
GoRoute(
|
GoRoute(
|
||||||
name: 'signature',
|
name: 'signature',
|
||||||
|
|
|
@ -14,7 +14,7 @@ const String login = "LOGIN";
|
||||||
const String sOSTitle = "Request SOS";
|
const String sOSTitle = "Request SOS";
|
||||||
const String sOSReceivedMessage =
|
const String sOSReceivedMessage =
|
||||||
"your SOS request has been received. Please wait for respondent's acknowledgement.";
|
"your SOS request has been received. Please wait for respondent's acknowledgement.";
|
||||||
const String unit2ModuleScreen = "uniT2 Modules";
|
const String unit2ModuleScreen = "uniT Dashboard";
|
||||||
const String welcome = "Welcome to!";
|
const String welcome = "Welcome to!";
|
||||||
const String unitApp = 'uniT-App';
|
const String unitApp = 'uniT-App';
|
||||||
const String loginToContinue = "Please login to continue.";
|
const String loginToContinue = "Please login to continue.";
|
||||||
|
|
|
@ -12,36 +12,40 @@ class UniTSplashScreen extends StatelessWidget {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Center(
|
return Container(
|
||||||
child: Column(
|
height: MediaQuery.of(context).size.height,
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
color: Colors.white,
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
child: Center(
|
||||||
children: [
|
child: Column(
|
||||||
SlideInUp(
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
from: 50,
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
duration: const Duration(milliseconds: 300),
|
children: [
|
||||||
child: SvgPicture.asset(
|
SlideInUp(
|
||||||
'assets/svgs/logo.svg',
|
from: 50,
|
||||||
height: blockSizeVertical * 15.0,
|
duration: const Duration(milliseconds: 300),
|
||||||
allowDrawingOutsideViewBox: true,
|
child: SvgPicture.asset(
|
||||||
color: primary,
|
'assets/svgs/logo.svg',
|
||||||
|
height: blockSizeVertical * 12.0,
|
||||||
|
allowDrawingOutsideViewBox: true,
|
||||||
|
color: primary,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
const SizedBox(
|
||||||
const SizedBox(
|
height: 12,
|
||||||
height: 24,
|
),
|
||||||
),
|
SlideInDown(
|
||||||
SlideInDown(
|
from: 100,
|
||||||
from: 100,
|
duration: const Duration(milliseconds: 200),
|
||||||
duration: const Duration(milliseconds: 200),
|
child: Text("uniT-App",
|
||||||
child: Text("uniT-App",
|
style: TextStyle(
|
||||||
style: TextStyle(
|
fontSize: blockSizeVertical * 4,
|
||||||
fontSize: blockSizeVertical * 5,
|
fontWeight: FontWeight.w600,
|
||||||
fontWeight: FontWeight.w800,
|
letterSpacing: .2,
|
||||||
letterSpacing: .2,
|
height: 1,
|
||||||
height: 1,
|
color: Colors.black)),
|
||||||
color: Colors.black)),
|
),
|
||||||
),
|
],
|
||||||
],
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,7 +60,7 @@ dependencies:
|
||||||
signature: ^5.3.0
|
signature: ^5.3.0
|
||||||
awesome_dialog: ^3.0.2
|
awesome_dialog: ^3.0.2
|
||||||
system_info2: ^2.0.4
|
system_info2: ^2.0.4
|
||||||
flutter_bloc: ^8.1.1
|
flutter_bloc: ^8.0.0
|
||||||
equatable: ^2.0.5
|
equatable: ^2.0.5
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
|
|
Loading…
Reference in New Issue