2023-10-03 00:33:10 +00:00
|
|
|
import 'package:cached_network_image/cached_network_image.dart';
|
2022-12-05 08:06:45 +00:00
|
|
|
import 'package:flutter/material.dart';
|
2023-01-23 03:02:59 +00:00
|
|
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
|
|
|
import 'package:flutter_progress_hud/flutter_progress_hud.dart';
|
2023-10-03 00:33:10 +00:00
|
|
|
import 'package:flutter_svg/svg.dart';
|
2022-12-05 08:06:45 +00:00
|
|
|
import 'package:fluttericon/font_awesome5_icons.dart';
|
2023-01-23 03:02:59 +00:00
|
|
|
import 'package:intl/intl.dart';
|
2022-12-13 06:56:09 +00:00
|
|
|
import 'package:qr_flutter/qr_flutter.dart';
|
2023-01-23 03:02:59 +00:00
|
|
|
import 'package:unit2/model/login_data/user_info/user_data.dart';
|
2023-07-28 02:21:42 +00:00
|
|
|
import 'package:unit2/screens/unit2/basic-info/components/qr_image.dart';
|
2022-12-13 06:56:09 +00:00
|
|
|
import 'package:unit2/theme-data.dart/btn-style.dart';
|
|
|
|
import 'package:unit2/utils/global.dart';
|
2022-12-20 06:26:37 +00:00
|
|
|
import 'package:unit2/utils/text_container.dart';
|
2023-02-01 08:03:05 +00:00
|
|
|
import '../../../bloc/user/user_bloc.dart';
|
2022-12-13 06:56:09 +00:00
|
|
|
import '../../../theme-data.dart/colors.dart';
|
2023-09-05 08:44:48 +00:00
|
|
|
import '../../../utils/urls.dart';
|
2023-01-23 03:02:59 +00:00
|
|
|
import '../../../widgets/splash_screen.dart';
|
2023-04-13 08:45:19 +00:00
|
|
|
import '../signature/signature_pad.dart';
|
2022-12-05 08:06:45 +00:00
|
|
|
import './components/cover-image.dart';
|
|
|
|
|
2023-01-23 08:23:20 +00:00
|
|
|
class BasicInfo extends StatelessWidget {
|
|
|
|
const BasicInfo({super.key});
|
2022-12-05 08:06:45 +00:00
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return WillPopScope(
|
|
|
|
onWillPop: () async {
|
|
|
|
return Future.value(true);
|
|
|
|
},
|
2023-01-23 03:02:59 +00:00
|
|
|
child: ProgressHUD(
|
|
|
|
child: BlocBuilder<UserBloc, UserState>(
|
|
|
|
builder: (context, state) {
|
|
|
|
if (state is UserLoggedIn) {
|
2023-09-06 00:54:53 +00:00
|
|
|
String fileUrl =
|
|
|
|
'${Url.instance.prefixHost()}://${Url.instance.host()}/media/${state.userData?.employeeInfo?.profile?.photoPath}';
|
2023-01-23 03:02:59 +00:00
|
|
|
state.userData!.employeeInfo!.profile!.sex!.toUpperCase();
|
|
|
|
return SafeArea(
|
|
|
|
child: Scaffold(
|
|
|
|
body: SizedBox(
|
|
|
|
width: screenWidth,
|
|
|
|
child: Column(
|
|
|
|
children: [
|
|
|
|
Stack(
|
|
|
|
clipBehavior: Clip.none,
|
|
|
|
alignment: Alignment.center,
|
|
|
|
children: [
|
|
|
|
const CoverImage(),
|
2023-10-03 00:33:10 +00:00
|
|
|
Positioned(
|
|
|
|
top: blockSizeVertical * 15.5,
|
|
|
|
child: Stack(
|
|
|
|
alignment: Alignment.center,
|
|
|
|
children: [
|
|
|
|
CachedNetworkImage(
|
|
|
|
imageUrl: fileUrl,
|
|
|
|
imageBuilder: (context, imageProvider) =>
|
|
|
|
Container(
|
|
|
|
width: 160,
|
|
|
|
height: 160,
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
border: Border.all(
|
|
|
|
color: Colors.black26, width: 3),
|
|
|
|
shape: BoxShape.circle,
|
|
|
|
image: DecorationImage(
|
|
|
|
image: imageProvider,
|
|
|
|
fit: BoxFit.cover),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
placeholder: (context, url) =>
|
|
|
|
const CircularProgressIndicator(),
|
|
|
|
errorWidget: (context, url, error) =>
|
|
|
|
Container(
|
|
|
|
width: 160,
|
|
|
|
height: 160,
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
border: Border.all(
|
|
|
|
color: Colors.white, width: 3),
|
|
|
|
shape: BoxShape.circle,
|
|
|
|
),
|
|
|
|
child: SvgPicture.asset(
|
|
|
|
'assets/svgs/male.svg',
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
2023-01-23 03:02:59 +00:00
|
|
|
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!,
|
|
|
|
),
|
|
|
|
],
|
2022-12-20 06:26:37 +00:00
|
|
|
),
|
2023-01-23 03:02:59 +00:00
|
|
|
),
|
2022-12-20 06:26:37 +00:00
|
|
|
),
|
2023-01-23 03:02:59 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
return const UniTSplashScreen();
|
|
|
|
},
|
2022-12-05 08:06:45 +00:00
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class BuildInformation extends StatelessWidget {
|
2023-01-23 03:02:59 +00:00
|
|
|
final UserData userData;
|
|
|
|
const BuildInformation({super.key, required this.userData});
|
2022-12-05 08:06:45 +00:00
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
2023-01-23 03:02:59 +00:00
|
|
|
DateFormat dteFormat2 = DateFormat.yMMMMd('en_US');
|
2023-10-03 00:33:10 +00:00
|
|
|
globalFistname =
|
|
|
|
globalFistname ?? userData.employeeInfo!.profile!.firstName!.toUpperCase();
|
|
|
|
globalLastname =
|
|
|
|
globalLastname ?? userData.employeeInfo!.profile!.lastName!.toUpperCase();
|
|
|
|
globalMiddleName = globalMiddleName ??
|
|
|
|
(userData.employeeInfo == null
|
2023-09-22 08:07:13 +00:00
|
|
|
? ''
|
2023-10-03 00:33:10 +00:00
|
|
|
: userData.employeeInfo!.profile?.middleName?.toUpperCase());
|
2023-09-22 08:07:13 +00:00
|
|
|
globalSex = globalSex ?? userData.employeeInfo!.profile!.sex!.toUpperCase();
|
|
|
|
globalBday = globalBday ?? userData.employeeInfo!.profile!.birthdate;
|
2023-01-23 03:02:59 +00:00
|
|
|
final uuid = userData.employeeInfo!.uuid;
|
2022-12-13 06:56:09 +00:00
|
|
|
return Container(
|
|
|
|
padding: const EdgeInsets.symmetric(horizontal: 25),
|
|
|
|
width: screenWidth,
|
|
|
|
child: Column(
|
|
|
|
children: [
|
|
|
|
const SizedBox(
|
|
|
|
height: 25,
|
|
|
|
),
|
|
|
|
Text(
|
2023-09-22 08:07:13 +00:00
|
|
|
"$globalFistname ${globalMiddleName ?? ''} $globalLastname",
|
2023-01-23 03:02:59 +00:00
|
|
|
textAlign: TextAlign.center,
|
2022-12-13 06:56:09 +00:00
|
|
|
style: Theme.of(context)
|
|
|
|
.textTheme
|
2023-06-21 00:22:43 +00:00
|
|
|
.headlineSmall!
|
2022-12-13 06:56:09 +00:00
|
|
|
.copyWith(fontWeight: FontWeight.bold),
|
|
|
|
),
|
|
|
|
const SizedBox(
|
|
|
|
height: 10,
|
|
|
|
),
|
|
|
|
Text(
|
2023-09-22 08:07:13 +00:00
|
|
|
"${dteFormat2.format(globalBday!)} | $sex",
|
2023-07-28 02:21:42 +00:00
|
|
|
style:
|
|
|
|
Theme.of(context).textTheme.bodySmall!.copyWith(fontSize: 18),
|
2022-12-13 06:56:09 +00:00
|
|
|
),
|
|
|
|
const SizedBox(
|
|
|
|
height: 15,
|
|
|
|
),
|
2023-07-28 02:21:42 +00:00
|
|
|
GestureDetector(
|
|
|
|
onTap: () {
|
|
|
|
Navigator.push(context,
|
|
|
|
MaterialPageRoute(builder: (BuildContext context) {
|
|
|
|
return QRFullScreenImage(uuid: uuid);
|
|
|
|
}));
|
|
|
|
},
|
2023-10-09 02:58:07 +00:00
|
|
|
child: QrImageView(
|
2023-07-28 02:21:42 +00:00
|
|
|
data: uuid!,
|
|
|
|
size: blockSizeVertical * 24,
|
|
|
|
),
|
2022-12-13 06:56:09 +00:00
|
|
|
),
|
2022-12-20 06:26:37 +00:00
|
|
|
const SizedBox(
|
2022-12-13 06:56:09 +00:00
|
|
|
height: 25,
|
|
|
|
),
|
|
|
|
SizedBox(
|
|
|
|
width: screenWidth * .60,
|
2023-07-28 02:21:42 +00:00
|
|
|
height: blockSizeVertical * 7,
|
2022-12-20 06:26:37 +00:00
|
|
|
child: SizedBox(
|
|
|
|
child: ElevatedButton.icon(
|
|
|
|
style:
|
|
|
|
mainBtnStyle(third, Colors.transparent, Colors.white54),
|
|
|
|
onPressed: () {
|
2023-07-28 02:21:42 +00:00
|
|
|
Navigator.push(context,
|
|
|
|
MaterialPageRoute(builder: (BuildContext context) {
|
2023-06-21 00:22:43 +00:00
|
|
|
return const SignaturePad();
|
2023-04-13 08:45:19 +00:00
|
|
|
}));
|
2022-12-20 06:26:37 +00:00
|
|
|
},
|
|
|
|
icon: const Icon(
|
|
|
|
FontAwesome5.signature,
|
|
|
|
size: 15,
|
|
|
|
),
|
|
|
|
label: const Text(signature)),
|
2022-12-05 08:06:45 +00:00
|
|
|
),
|
2022-12-13 06:56:09 +00:00
|
|
|
),
|
|
|
|
const SizedBox(
|
|
|
|
height: 5,
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
2022-12-05 08:06:45 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|