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';
|
2022-12-05 08:06:45 +00:00
|
|
|
import 'package:flutter_svg/svg.dart';
|
|
|
|
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-04-13 08:45:19 +00:00
|
|
|
import 'package:signature/signature.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-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) {
|
|
|
|
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(),
|
|
|
|
Positioned(
|
2023-06-21 00:22:43 +00:00
|
|
|
top: blockSizeVertical * 15.5,
|
2023-01-23 03:02:59 +00:00
|
|
|
child: Stack(
|
|
|
|
alignment: Alignment.center,
|
|
|
|
children: [
|
|
|
|
const CircleAvatar(
|
|
|
|
radius: 72,
|
|
|
|
backgroundColor: Colors.white,
|
|
|
|
),
|
|
|
|
CircleAvatar(
|
|
|
|
radius: 69,
|
|
|
|
backgroundColor: Colors.grey.shade800,
|
|
|
|
child: SvgPicture.asset(
|
|
|
|
'assets/svgs/male.svg',
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
2022-12-20 06:26:37 +00:00
|
|
|
),
|
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');
|
|
|
|
final String firstName =
|
|
|
|
userData.user!.login!.user!.firstName!.toUpperCase();
|
|
|
|
final String lastname = userData.user!.login!.user!.lastName!.toUpperCase();
|
2023-07-28 02:21:42 +00:00
|
|
|
final String? middlename = userData.employeeInfo == null
|
|
|
|
? ''
|
|
|
|
: userData.employeeInfo!.profile?.middleName?.toUpperCase();
|
2023-01-23 03:02:59 +00:00
|
|
|
final String sex = userData.employeeInfo!.profile!.sex!.toUpperCase();
|
|
|
|
final DateTime? bday = userData.employeeInfo!.profile!.birthdate;
|
|
|
|
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-07-28 02:21:42 +00:00
|
|
|
"$firstName ${middlename ?? ''} $lastname",
|
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-01-23 03:02:59 +00:00
|
|
|
"${dteFormat2.format(bday!)} | $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);
|
|
|
|
}));
|
|
|
|
},
|
|
|
|
child: QrImage(
|
|
|
|
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
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|