diff --git a/lib/constants/color_constants.dart b/lib/constants/color_constants.dart index 0537d1aa50442f4e1aa4b830303995b66915a94a..8415a1e95b7458625207e0d557a8757d8e7604d1 100644 --- a/lib/constants/color_constants.dart +++ b/lib/constants/color_constants.dart @@ -6,6 +6,7 @@ class AppColors { static const primaryBlue = Color.fromRGBO(4, 93, 173, 1); static const radioSelected = Color.fromRGBO(0, 116, 182, 0.2); static const primaryGreen = Color.fromRGBO(48, 105, 51, 1); + static const positiveLight = Color.fromRGBO(29, 137, 35, 1); static const black08 = Color.fromRGBO(0, 0, 0, 0.08); static const black16 = Color.fromRGBO(0, 0, 0, 0.16); static const black40 = Color.fromRGBO(0, 0, 0, 0.40); diff --git a/lib/models/application_model.dart b/lib/models/application_model.dart index a515a050a51d54e764dbf0166cc3ac831cd69989..54c47432f50770184d39704f2bacba52c6b17bbd 100644 --- a/lib/models/application_model.dart +++ b/lib/models/application_model.dart @@ -9,6 +9,8 @@ class Application { final Map dataObject; final List inspectors; final List leadInspector; + final Map inspectorDataObject; + final Map inspectorSummaryDataObject; final String scheduledDate; final String createdDate; final String createdBy; @@ -22,6 +24,8 @@ class Application { required this.dataObject, required this.inspectors, required this.leadInspector, + required this.inspectorDataObject, + required this.inspectorSummaryDataObject, required this.scheduledDate, required this.createdDate, required this.createdBy, @@ -37,10 +41,12 @@ class Application { dataObject: json['dataObject'], inspectors: json['inspection']['assignedTo'] ?? [], leadInspector: json['inspection']['leadInspector'] ?? [], + inspectorDataObject: json['inspectorDataObject'] != null + ? json['inspectorDataObject']['dataObject'] + : {}, + inspectorSummaryDataObject: json['inspectorSummaryDataObject'] ?? {}, scheduledDate: json['inspection']['scheduledDate'] ?? '', - createdDate: json['createdDate'] != null - ? DateFormat.yMMMEd().format(DateTime.parse(json['createdDate'])) - : '', + createdDate: json['createdDate'], createdBy: json['createdBy'], ); } @@ -54,6 +60,8 @@ class Application { dataObject, inspectors, leadInspector, + inspectorDataObject, + inspectorSummaryDataObject, scheduledDate, createdDate, createdBy diff --git a/lib/pages/application_details_page.dart b/lib/pages/application_details_page.dart index 8c66091618d51fca75cbd0ff8f24f303a82517ca..63f8c16618661d1a6973531ed4d4292c57cf7a93 100644 --- a/lib/pages/application_details_page.dart +++ b/lib/pages/application_details_page.dart @@ -9,7 +9,10 @@ import 'package:smf_mobile/pages/inspection_summary.dart'; import 'package:smf_mobile/pages/login_email_page.dart'; import 'package:smf_mobile/repositories/form_repository.dart'; import 'package:smf_mobile/util/helper.dart'; -import 'package:smf_mobile/widgets/application_field.dart'; +import 'package:smf_mobile/widgets/assistant_inspector_application_field.dart'; +import 'package:smf_mobile/widgets/assistant_inspector_dialog.dart'; +import 'package:smf_mobile/widgets/lead_inspector_application_field.dart'; +import 'package:smf_mobile/widgets/people_card.dart'; import 'package:smf_mobile/widgets/silverappbar_delegate.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; @@ -31,21 +34,59 @@ class _ApplicationDetailsPageState extends State<ApplicationDetailsPage> late FormData _formData; int _activeTabIndex = 0; final Map _data = {}; + final Map _leadInspectorData = {}; + final Map _leadInspectorFields = {}; final Map _fieldTypes = {}; final Map _fieldOptions = {}; final List<String> _tabs = []; final List<Map> _fields = []; + bool _isleadInspector = false; + bool _iDisagree = false; + bool _iConcent = false; + String _note = ''; + int _leadInspectorId = 0; + final List<Map> _inspectors = []; + String _inspectionSummary = ''; @override void initState() { super.initState(); - widget.application.dataObject.forEach((key, value) => _tabs.add(key)); _tabController = TabController(vsync: this, length: _tabs.length); _tabController!.addListener(_setActiveTabIndex); + _checkInspectorRole(); _populateFields(); } + Future<void> _checkInspectorRole() async { + String id = await Helper.getUser('smf_user_id'); + int userId = int.parse(id); + if (widget.application.leadInspector.isNotEmpty) { + _leadInspectorId = widget.application.leadInspector[0]; + if (widget.application.leadInspector[0] == userId) { + setState(() { + _isleadInspector = true; + }); + } else { + _inspectionSummary = + widget.application.inspectorSummaryDataObject['Inspection Summary'][ + widget.application + .inspectorSummaryDataObject['Inspection Summary'].keys + .elementAt(0)]; + } + } + + _inspectors.clear(); + for (var i = 0; i < widget.application.inspectors.length; i++) { + _inspectors.add({ + 'id': widget.application.inspectors[i]['id'], + 'name': + '${widget.application.inspectors[i]['firstName']} ${widget.application.inspectors[i]['lastName']}', + }); + setState(() {}); + } + } + Future<dynamic> _getFormDetails() async { _validateUser(); _formData = await Provider.of<FormRespository>(context, listen: false) @@ -87,6 +128,20 @@ class _ApplicationDetailsPageState extends State<ApplicationDetailsPage> _data[key] = updatedFields }); _data.forEach((key, value) => _fields.add(value)); + if (!_isleadInspector) { + updatedFields = {}; + widget.application.inspectorDataObject.forEach((key, value) => { + updatedFields = {}, + value.forEach( + (childKey, childValue) => { + updatedFields[childKey] = {'value': '', 'comments': ''}, + _leadInspectorFields[childKey] = childValue, + }, + ), + _leadInspectorData[key] = updatedFields, + }); + // print(_leadInspectorFields); + } } void updateField(Map fieldData) { @@ -131,6 +186,25 @@ class _ApplicationDetailsPageState extends State<ApplicationDetailsPage> ))); } + triggerUpdate(Map data) { + setState(() { + _iDisagree = !data['status'] ? false : _iDisagree; + _iConcent = !data['status'] ? false : _iConcent; + _note = data['note']; + }); + } + + Future _displayCommentDialog() { + return showDialog( + context: context, + builder: (context) => StatefulBuilder(builder: (context, setState) { + return AssistantInspectorDialog( + noteText: _note, + parentAction: triggerUpdate, + ); + })); + } + @override void dispose() { _tabController?.dispose(); @@ -226,33 +300,316 @@ class _ApplicationDetailsPageState extends State<ApplicationDetailsPage> builder: (context, AsyncSnapshot<dynamic> snapshot) { if (snapshot.hasData && snapshot.data != null) { return Container( - padding: const EdgeInsets.only(top: 20), - color: AppColors.scaffoldBackground, - child: TabBarView( - controller: _tabController, - children: [ - for (Map field in _fields) + padding: const EdgeInsets.only(top: 20), + color: AppColors.scaffoldBackground, + child: TabBarView( + controller: _tabController, + children: [ + for (Map field in _fields) + ListView(children: [ + !_isleadInspector + ? Wrap( + children: [ + Container( + width: double.infinity, + padding: + const EdgeInsets.all(20), + margin: const EdgeInsets.only( + left: 20, right: 20), + decoration: + const BoxDecoration( + borderRadius: + BorderRadius.only( + topLeft: Radius + .circular(4), + topRight: + Radius.circular( + 4)), + color: AppColors + .fieldBackground, + boxShadow: [ + BoxShadow( + color: + AppColors.black16, + offset: Offset(0, 2), + blurRadius: 2) + ], + ), + child: Column( + mainAxisAlignment: + MainAxisAlignment + .start, + crossAxisAlignment: + CrossAxisAlignment + .start, + children: [ + Container( + margin: + const EdgeInsets + .only( + top: 10), + padding: + const EdgeInsets + .fromLTRB( + 15, + 10, + 15, + 10), + width: + double.infinity, + decoration: + BoxDecoration( + color: AppColors + .black08, + border: Border.all( + color: AppColors + .black08), + borderRadius: + BorderRadius + .circular( + 4), + ), + child: Text( + 'Status: ${Helper.getInspectionStatus(widget.application.status)}', + textAlign: TextAlign + .center, + style: GoogleFonts + .lato( + color: AppColors + .positiveLight, + fontSize: 12.0, + letterSpacing: + 0.25, + fontWeight: + FontWeight + .w400, + ), + ), + ), + Container( + margin: + const EdgeInsets + .only( + top: 10), + width: + double.infinity, + child: Text( + 'Inspection completed on ${Helper.formatDate(widget.application.scheduledDate)}', + textAlign: TextAlign + .center, + style: GoogleFonts + .lato( + color: AppColors + .black60, + fontSize: 14.0, + letterSpacing: + 0.25, + fontWeight: + FontWeight + .w400, + ), + ), + ), + ]), + ), + Container( + width: double.infinity, + margin: const EdgeInsets.only( + top: 20, + left: 20, + right: 20), + padding: + const EdgeInsets.all(20), + decoration: + const BoxDecoration( + borderRadius: + BorderRadius.only( + topLeft: Radius + .circular(4), + topRight: + Radius.circular( + 4)), + color: Colors.white, + boxShadow: [ + BoxShadow( + color: + AppColors.black16, + offset: Offset(0, 2), + blurRadius: 2) + ], + ), + child: Column( + mainAxisAlignment: + MainAxisAlignment.start, + crossAxisAlignment: + CrossAxisAlignment + .start, + children: [ + Padding( + padding: + const EdgeInsets + .only(top: 5), + child: Text( + 'Inspection Summary', + style: + GoogleFonts.lato( + color: AppColors + .black87, + fontSize: 14.0, + letterSpacing: 0.25, + fontWeight: + FontWeight.w700, + ), + ), + ), + Container( + margin: const EdgeInsets + .only(top: 10), + padding: + const EdgeInsets + .fromLTRB( + 15, 10, 15, 10), + width: double.infinity, + decoration: + BoxDecoration( + border: Border.all( + color: AppColors + .black16), + ), + child: Text( + _inspectionSummary, + style: + GoogleFonts.lato( + color: AppColors + .black87, + fontSize: 14.0, + letterSpacing: 0.25, + fontWeight: + FontWeight.w400, + ), + ), + ), + _leadInspectorId != 0 + ? Container( + margin: const EdgeInsets + .fromLTRB( + 0, + 20, + 20, + 15), + child: Text( + 'Lead inspector', + style: + GoogleFonts + .lato( + color: AppColors + .black87, + fontWeight: + FontWeight + .w700, + fontSize: 14, + letterSpacing: + 0.25, + ), + )) + : const Center(), + for (int i = 0; + i < + _inspectors + .length; + i++) + if (_leadInspectorId == + _inspectors[i] + ['id']) + PeopleCard( + inspector: + _inspectors[i], + ), + Container( + margin: + const EdgeInsets + .fromLTRB( + 0, + 10, + 20, + 15), + child: Text( + 'Assisting inspectors', + style: GoogleFonts + .lato( + color: AppColors + .black87, + fontWeight: + FontWeight + .w700, + fontSize: 14, + letterSpacing: + 0.25, + ), + )), + for (int i = 0; + i < + _inspectors + .length; + i++) + if (_leadInspectorId != + _inspectors[i] + ['id']) + PeopleCard( + inspector: + _inspectors[i], + ), + ], + ), + ) + ], + ) + : const Center(), ListView.builder( shrinkWrap: true, physics: const NeverScrollableScrollPhysics(), itemCount: field.length, itemBuilder: (context, i) { - return ApplicationField( - fieldName: - field.keys.elementAt(i), - fieldData: field[ - field.keys.elementAt(i)], - fieldType: _fieldTypes[ - field.keys.elementAt(i)], - fieldOptions: _fieldOptions[ - field.keys.elementAt(i)], - applicationStatus: - widget.application.status, - parentAction: updateField, - ); + return _isleadInspector + ? LeadInspectorApplicationField( + fieldName: + field.keys.elementAt(i), + fieldData: field[field.keys + .elementAt(i)], + fieldType: _fieldTypes[field + .keys + .elementAt(i)], + fieldOptions: _fieldOptions[ + field.keys + .elementAt(i)], + applicationStatus: widget + .application.status, + parentAction: updateField, + ) + : widget.application.status == + InspectionStatus + .inspectionCompleted + ? AssistantInspectorApplicationField( + fieldName: field.keys + .elementAt(i), + fieldData: field[field + .keys + .elementAt(i)], + leadInspectorData: + _leadInspectorFields[ + _leadInspectorFields + .keys + .elementAt( + i)], + parentAction: + updateField, + ) + : const Center(); }) - ])); + ]) + ]), + ); } else { return const Center( child: CircularProgressIndicator(), @@ -264,94 +621,213 @@ class _ApplicationDetailsPageState extends State<ApplicationDetailsPage> bottomNavigationBar: BottomAppBar( elevation: 20, child: Container( - height: 60, - padding: const EdgeInsets.only(left: 20, right: 20), - decoration: BoxDecoration( - color: Theme.of(context).primaryColor, - borderRadius: const BorderRadius.only( - topLeft: Radius.circular(20), - topRight: Radius.circular(20), + height: _isleadInspector ? 60 : 120, + margin: const EdgeInsets.only( + top: 10, ), - ), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - _activeTabIndex > 0 - ? InkWell( - onTap: () => _tabController!.index--, - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceAround, - children: [ - const Icon( - Icons.arrow_back, - color: AppColors.primaryBlue, - ), - Padding( - padding: const EdgeInsets.only(left: 10), - child: Text( - AppLocalizations.of(context)!.previous, - style: GoogleFonts.lato( + padding: const EdgeInsets.only(left: 20, right: 20), + decoration: BoxDecoration( + color: Theme.of(context).primaryColor, + borderRadius: const BorderRadius.only( + topLeft: Radius.circular(20), + topRight: Radius.circular(20), + ), + ), + child: Column(children: [ + !_isleadInspector + ? Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + !_iConcent + ? ButtonTheme( + child: OutlinedButton( + onPressed: () { + if (!_iDisagree) { + _displayCommentDialog(); + } + setState(() { + _iDisagree = !_iDisagree; + }); + }, + style: OutlinedButton.styleFrom( + backgroundColor: _iDisagree + ? AppColors.primaryBlue + : Colors.white, + side: const BorderSide( + width: 1, color: AppColors.black40), + shape: RoundedRectangleBorder( + borderRadius: + BorderRadius.circular(4), + ), + // onSurface: Colors.grey, + ), + child: Row( + children: [ + Text( + 'I disagree', + style: GoogleFonts.lato( + color: _iDisagree + ? Colors.white + : AppColors.black60, + fontSize: 14, + letterSpacing: 0.5, + fontWeight: FontWeight.w700), + ), + Padding( + padding: + const EdgeInsets.fromLTRB( + 5, 0, 0, 0), + child: Icon( + Icons.clear, + color: _iDisagree + ? Colors.white + : AppColors.black60, + size: 20, + )) + ], + )), + ) + : const Center(), + !_iDisagree + ? Padding( + padding: const EdgeInsets.only(left: 10), + child: TextButton( + onPressed: () { + if (!_iConcent) { + _displayCommentDialog(); + } + setState(() { + _iConcent = !_iConcent; + }); + }, + style: TextButton.styleFrom( + // primary: Colors.white, + padding: const EdgeInsets.only( + left: 15, right: 15), + backgroundColor: _iConcent + ? AppColors.primaryBlue + : Colors.white, + shape: RoundedRectangleBorder( + borderRadius: + BorderRadius.circular(4), + side: const BorderSide( + color: AppColors.black40)), + ), + child: Row( + children: [ + Text( + 'I concent', + style: GoogleFonts.lato( + color: _iConcent + ? Colors.white + : AppColors.black60, + fontSize: 14, + letterSpacing: 0.5, + fontWeight: FontWeight.w700), + ), + Padding( + padding: + const EdgeInsets.fromLTRB( + 5, 0, 0, 0), + child: Icon( + Icons.check, + color: _iConcent + ? Colors.white + : AppColors.black60, + size: 20, + )) + ], + )), + ) + : const Center(), + ], + ) + : const Center(), + Container( + margin: const EdgeInsets.only(top: 10), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + _activeTabIndex > 0 + ? InkWell( + onTap: () => _tabController!.index--, + child: Row( + mainAxisAlignment: + MainAxisAlignment.spaceAround, + children: [ + const Icon( + Icons.arrow_back, color: AppColors.primaryBlue, - fontSize: 14.0, - letterSpacing: 0.12, - fontWeight: FontWeight.w700, ), - )), - ], - )) - : const Center(), - _activeTabIndex < _tabs.length - 1 - ? InkWell( - onTap: () => _tabController!.index++, - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Padding( - padding: const EdgeInsets.only(right: 10), - child: Text( - AppLocalizations.of(context)!.next, - style: GoogleFonts.lato( + Padding( + padding: const EdgeInsets.only(left: 10), + child: Text( + AppLocalizations.of(context)!.previous, + style: GoogleFonts.lato( + color: AppColors.primaryBlue, + fontSize: 14.0, + letterSpacing: 0.12, + fontWeight: FontWeight.w700, + ), + )), + ], + )) + : const Center(), + _activeTabIndex < _tabs.length - 1 + ? InkWell( + onTap: () => _tabController!.index++, + child: Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Padding( + padding: const EdgeInsets.only(right: 10), + child: Text( + AppLocalizations.of(context)!.next, + style: GoogleFonts.lato( + color: AppColors.primaryBlue, + fontSize: 14.0, + letterSpacing: 0.12, + fontWeight: FontWeight.w700, + ), + )), + const Icon( + Icons.arrow_forward, color: AppColors.primaryBlue, - fontSize: 14.0, - letterSpacing: 0.12, - fontWeight: FontWeight.w700, + ) + ], + )) + : widget.application.status == + InspectionStatus.sentForInspection + ? TextButton( + onPressed: () { + _submitInspection(); + }, + style: TextButton.styleFrom( + // primary: Colors.white, + padding: const EdgeInsets.only( + left: 15, right: 15), + backgroundColor: AppColors.primaryBlue, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(4), + side: const BorderSide( + color: AppColors.black16)), ), - )), - const Icon( - Icons.arrow_forward, - color: AppColors.primaryBlue, - ) - ], - )) - : widget.application.status == - InspectionStatus.sentForInspection - ? TextButton( - onPressed: () { - _submitInspection(); - }, - style: TextButton.styleFrom( - // primary: Colors.white, - padding: - const EdgeInsets.only(left: 15, right: 15), - backgroundColor: AppColors.primaryBlue, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(4), - side: const BorderSide( - color: AppColors.black16)), - ), - child: Text( - AppLocalizations.of(context)!.inspectionCompleted, - style: GoogleFonts.lato( - color: Colors.white, - fontWeight: FontWeight.w700, - fontSize: 14, - ), - ), - ) - : const Center(), - ], - ), - )), + child: Text( + AppLocalizations.of(context)! + .inspectionCompleted, + style: GoogleFonts.lato( + color: Colors.white, + fontWeight: FontWeight.w700, + fontSize: 14, + ), + ), + ) + : const Center(), + ], + ), + ) + ]))), ); } } diff --git a/lib/pages/home_page.dart b/lib/pages/home_page.dart index 20f857ddbb603e48dcb9dfb8db26ea97d11209fe..2df0c63138a0414ce2cbe61eb18dc816cf2041e6 100644 --- a/lib/pages/home_page.dart +++ b/lib/pages/home_page.dart @@ -7,6 +7,7 @@ import 'package:smf_mobile/models/application_model.dart'; import 'package:smf_mobile/pages/login_email_page.dart'; import 'package:smf_mobile/pages/past_applications.dart'; import 'package:smf_mobile/repositories/application_repository.dart'; +import 'package:smf_mobile/repositories/login_repository.dart'; import 'package:smf_mobile/util/helper.dart'; import 'package:smf_mobile/widgets/application_card.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; @@ -41,7 +42,7 @@ class _HomePageState extends State<HomePage> { } } - Future<dynamic> _getApplications(context) async { + Future<dynamic> _getApplications() async { _validateUser(); _allApplications = await Provider.of<ApplicationRespository>(context, listen: false) @@ -75,6 +76,13 @@ class _HomePageState extends State<HomePage> { return _allApplications; } + Future<void> _logout() async { + await Provider.of<LoginRespository>(context, listen: false).clearData(); + Navigator.of(context).pushReplacement(MaterialPageRoute( + builder: (context) => const LoginEmailPage(), + )); + } + Future<void> _pullRefresh() async { setState(() {}); } @@ -96,7 +104,41 @@ class _HomePageState extends State<HomePage> { fontWeight: FontWeight.w600, ), ), - // centerTitle: true, + actions: [ + SizedBox.fromSize( + size: const Size(0, 10), + child: IconButton( + icon: const Icon(Icons.more_vert), + color: AppColors.black87, + iconSize: 20, + onPressed: () {}, + )), + PopupMenuButton<String>( + // initialValue: _dropdownOptions[0], + onSelected: (String result) { + switch (result) { + case 'logout': + _logout(); + break; + default: + } + }, + itemBuilder: (BuildContext context) => <PopupMenuEntry<String>>[ + PopupMenuItem<String>( + value: 'logout', + child: Text( + 'Logout', + style: GoogleFonts.lato( + color: AppColors.black87, + fontSize: 14.0, + letterSpacing: 0.12, + fontWeight: FontWeight.w500, + ), + ), + ), + ], + ) + ], ), // Tab controller body: Container( @@ -106,7 +148,7 @@ class _HomePageState extends State<HomePage> { minHeight: MediaQuery.of(context).size.height - 150, ), child: FutureBuilder( - future: _getApplications(context), + future: _getApplications(), builder: (context, AsyncSnapshot<dynamic> snapshot) { if (snapshot.hasData && snapshot.data != null) { return RefreshIndicator( @@ -117,17 +159,39 @@ class _HomePageState extends State<HomePage> { mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [ - Container( - width: double.infinity, - margin: const EdgeInsets.only(top: 10, bottom: 20), - child: Text(AppLocalizations.of(context)!.today, - style: GoogleFonts.lato( - color: AppColors.black87, - fontSize: 16.0, - letterSpacing: 0.12, - fontWeight: FontWeight.w600, - )), - ), + _pendingApplications.isEmpty && + _upcomingApplications.isEmpty + ? Container( + width: double.infinity, + height: + MediaQuery.of(context).size.height - 250, + margin: const EdgeInsets.only( + top: 10, bottom: 20), + child: Center( + child: Text('No applications at the moment', + style: GoogleFonts.lato( + color: AppColors.black87, + fontSize: 16.0, + letterSpacing: 0.12, + fontWeight: FontWeight.w600, + )), + )) + : const Center(), + _pendingApplications.isNotEmpty + ? Container( + width: double.infinity, + margin: const EdgeInsets.only( + top: 10, bottom: 20), + child: + Text(AppLocalizations.of(context)!.today, + style: GoogleFonts.lato( + color: AppColors.black87, + fontSize: 16.0, + letterSpacing: 0.12, + fontWeight: FontWeight.w600, + )), + ) + : const Center(), ListView.builder( shrinkWrap: true, physics: const NeverScrollableScrollPhysics(), @@ -137,17 +201,21 @@ class _HomePageState extends State<HomePage> { application: _pendingApplications[i]); }, ), - Container( - width: double.infinity, - margin: const EdgeInsets.only(top: 20, bottom: 20), - child: Text(AppLocalizations.of(context)!.upcoming, - style: GoogleFonts.lato( - color: AppColors.black87, - fontSize: 16.0, - letterSpacing: 0.12, - fontWeight: FontWeight.w600, - )), - ), + _upcomingApplications.isNotEmpty + ? Container( + width: double.infinity, + margin: const EdgeInsets.only( + top: 20, bottom: 20), + child: Text( + AppLocalizations.of(context)!.upcoming, + style: GoogleFonts.lato( + color: AppColors.black87, + fontSize: 16.0, + letterSpacing: 0.12, + fontWeight: FontWeight.w600, + )), + ) + : const Center(), ListView.builder( shrinkWrap: true, physics: const NeverScrollableScrollPhysics(), diff --git a/lib/pages/inspection_summary.dart b/lib/pages/inspection_summary.dart index 91a6039ffcee2a8ebe476bef6cbd5bf28f1dcf3a..8856f68333ede7939f2290ba17fd4bce76cf9798 100644 --- a/lib/pages/inspection_summary.dart +++ b/lib/pages/inspection_summary.dart @@ -219,9 +219,11 @@ class _InspectionSummaryPageState extends State<InspectionSummaryPage> { : const Center(), for (int i = 0; i < _inspectors.length; i++) if (_leadInspectorId == _inspectors[i]['id']) - PeopleCard( - inspector: _inspectors[i], - ), + Container( + margin: const EdgeInsets.fromLTRB(20, 0, 20, 0), + child: PeopleCard( + inspector: _inspectors[i], + )), Container( margin: const EdgeInsets.fromLTRB(20, 10, 20, 15), child: Text( @@ -235,9 +237,11 @@ class _InspectionSummaryPageState extends State<InspectionSummaryPage> { )), for (int i = 0; i < _inspectors.length; i++) if (_leadInspectorId != _inspectors[i]['id']) - PeopleCard( - inspector: _inspectors[i], - ), + Container( + margin: const EdgeInsets.fromLTRB(20, 0, 20, 0), + child: PeopleCard( + inspector: _inspectors[i], + )), const Divider(), Container( margin: const EdgeInsets.fromLTRB(20, 10, 20, 0), diff --git a/lib/repositories/login_repository.dart b/lib/repositories/login_repository.dart index 295db22eee5aaeb5056ea9381f438cce8448f948..6f733ad15f90b1d5408fb66b7b373d60cc8d6d1f 100644 --- a/lib/repositories/login_repository.dart +++ b/lib/repositories/login_repository.dart @@ -43,12 +43,14 @@ class LoginRespository with ChangeNotifier { _errorMessage = _data['statusInfo']['errorMessage']; } else { _loginDetails = Login.fromJson(_data['responseData']); - _storage.write(key: 'id', value: '${_loginDetails.id}'); - _storage.write(key: 'username', value: _loginDetails.username); - _storage.write(key: 'email', value: _loginDetails.email); - _storage.write(key: 'firstName', value: _loginDetails.firstName); - _storage.write(key: 'lastName', value: _loginDetails.lastName); - _storage.write(key: 'authToken', value: _loginDetails.authToken); + _storage.write(key: 'smf_user_id', value: '${_loginDetails.id}'); + _storage.write(key: 'smf_user_username', value: _loginDetails.username); + _storage.write(key: 'smf_user_email', value: _loginDetails.email); + _storage.write( + key: 'smf_user_first_name', value: _loginDetails.firstName); + _storage.write(key: 'smf_user_last_name', value: _loginDetails.lastName); + _storage.write( + key: 'smf_user_auth_token', value: _loginDetails.authToken); _firebaseMessaging.getToken().then((token) async { final request = await LoginService.updateUserDeviceToken( token.toString(), @@ -76,10 +78,10 @@ class LoginRespository with ChangeNotifier { provisional: false, sound: true, ); - print('User granted permission: ${settings.authorizationStatus}'); + // print('User granted permission: ${settings.authorizationStatus}'); FirebaseMessaging.onMessage.listen((RemoteMessage message) { - print('message.notification...'); + // print('message.notification...'); if (message.notification != null) { // int uniqueNotificationId = Helper.getUniqueId(); String body = message.notification!.body.toString(); diff --git a/lib/repositories/user_repository.dart b/lib/repositories/user_repository.dart index e45fdf8ee5a4b020ab3a2e17a97fc8876f486541..89153f6c979d61c5b4bc84b066c111cc7227a4c7 100644 --- a/lib/repositories/user_repository.dart +++ b/lib/repositories/user_repository.dart @@ -18,12 +18,7 @@ class UserRespository with ChangeNotifier { if (_data['statusInfo']['statusCode'] != 200) { _errorMessage = _data['statusInfo']['errorMessage']; - } else { - // _applications = [ - // for (final item in _data['responseData']) Application.fromJson(item) - // ]; } - // return _applications; return _data; } diff --git a/lib/services/base_service.dart b/lib/services/base_service.dart index fb56f8e079ce64735fd52bf45c2b32668b5d66e6..ae76f9943a8ffa3a922327156df739f9f5541167 100644 --- a/lib/services/base_service.dart +++ b/lib/services/base_service.dart @@ -12,7 +12,7 @@ abstract class BaseService { 'Accept': 'application/json', 'Content-Type': 'application/json; charset=utf-8', }; - var authToken = await _storage.read(key: 'authToken'); + var authToken = await _storage.read(key: 'smf_user_auth_token'); if (authToken != '' && authToken != null) { headers['Authorization'] = authToken; } diff --git a/lib/util/helper.dart b/lib/util/helper.dart index 92e1dde7010a64e2ded097d24c88f57b24eb27d2..cf6800d963bad4a1fd16a4139ab67b6ad7146f84 100644 --- a/lib/util/helper.dart +++ b/lib/util/helper.dart @@ -2,8 +2,10 @@ import 'dart:math'; import 'package:flutter/material.dart'; import 'package:fluttertoast/fluttertoast.dart'; +import 'package:intl/intl.dart'; import 'package:jwt_decoder/jwt_decoder.dart'; import 'package:flutter_secure_storage/flutter_secure_storage.dart'; +import 'package:smf_mobile/constants/app_constants.dart'; const _storage = FlutterSecureStorage(); @@ -26,15 +28,16 @@ class Helper { } static int getDateDiffence(DateTime today, DateTime dateTimeCreatedAt) { - String month = today.month < 10 ? '0${today.month}' : '${today.month}'; - DateTime dateTimeNow = DateTime.parse('${today.year}-$month-${today.day}'); - final differenceInDays = dateTimeNow.difference(dateTimeCreatedAt).inDays; + // print('$today, $dateTimeCreatedAt'); + // String month = today.month < 10 ? '0${today.month}' : '${today.month}'; + // DateTime dateTimeNow = DateTime.parse('${today.year}-03-${today.day}'); + final differenceInDays = today.difference(dateTimeCreatedAt).inDays; return differenceInDays; } static Future<bool> isTokenExpired() async { bool isTokenExpired = true; - var authToken = await _storage.read(key: 'authToken'); + var authToken = await _storage.read(key: 'smf_user_auth_token'); if (authToken != null) { isTokenExpired = JwtDecoder.isExpired(authToken); } @@ -60,4 +63,27 @@ class Helper { int notificationId = id1 + id2 + _now.millisecond; return notificationId; } + + static formatDate(String date) { + List temp = date.split("-"); + temp = List.from(temp.reversed); + return DateFormat.yMMMEd().format(DateTime.parse(temp.join('-'))); + } + + static capitalize(String string) => string.isNotEmpty + ? '${string[0].toUpperCase()}${string.substring(1).toLowerCase()}' + : ''; + + static getInspectionStatus(String status) { + String _inspectionStatus = ''; + if (status == InspectionStatus.inspectionCompleted) { + _inspectionStatus = 'Completed'; + } else if (status == InspectionStatus.sentForInspection) { + _inspectionStatus = 'Pending'; + } else { + _inspectionStatus = capitalize(_inspectionStatus); + } + // print(_inspectionStatus); + return _inspectionStatus; + } } diff --git a/lib/widgets/application_card.dart b/lib/widgets/application_card.dart index 0838d56b480d2f4c6e8d40aeba0d63e937a9e35e..4a3a02f36490902c4a63a017c67d91163c1c56b4 100644 --- a/lib/widgets/application_card.dart +++ b/lib/widgets/application_card.dart @@ -1,10 +1,10 @@ import 'package:flutter/material.dart'; import 'package:google_fonts/google_fonts.dart'; -import 'package:smf_mobile/constants/app_constants.dart'; import 'package:smf_mobile/constants/app_urls.dart'; import 'package:smf_mobile/constants/color_constants.dart'; import 'package:smf_mobile/models/application_model.dart'; import 'package:smf_mobile/pages/application_details_page.dart'; +import 'package:smf_mobile/util/helper.dart'; class ApplicationCard extends StatefulWidget { static const route = AppUrl.homePage; @@ -17,29 +17,11 @@ class ApplicationCard extends StatefulWidget { } class _ApplicationCardState extends State<ApplicationCard> { - String _inspectionStatus = ''; @override void initState() { super.initState(); - _getInspectionStatus(); } - void _getInspectionStatus() { - if (widget.application.status == InspectionStatus.inspectionCompleted) { - _inspectionStatus = 'Completed'; - } else if (widget.application.status == - InspectionStatus.sentForInspection) { - _inspectionStatus = 'Pending'; - } else { - _inspectionStatus = _toCapitalized(widget.application.status); - } - setState(() {}); - } - - _toCapitalized(String string) => string.isNotEmpty - ? '${string[0].toUpperCase()}${string.substring(1).toLowerCase()}' - : ''; - @override Widget build(BuildContext context) { return InkWell( @@ -87,7 +69,8 @@ class _ApplicationCardState extends State<ApplicationCard> { ), Padding( padding: const EdgeInsets.only(bottom: 10), - child: Text('Scheduled on: ${widget.application.createdDate}', + child: Text( + 'Scheduled on: ${Helper.formatDate(widget.application.scheduledDate)}', style: GoogleFonts.lato( color: AppColors.black60, fontSize: 14.0, @@ -109,7 +92,8 @@ class _ApplicationCardState extends State<ApplicationCard> { ), Padding( padding: const EdgeInsets.only(bottom: 10), - child: Text(_inspectionStatus, + child: Text( + Helper.getInspectionStatus(widget.application.status), style: GoogleFonts.lato( color: AppColors.black60, fontSize: 14.0, diff --git a/lib/widgets/assistant_inspector_application_field.dart b/lib/widgets/assistant_inspector_application_field.dart new file mode 100644 index 0000000000000000000000000000000000000000..ad7a4433e1df137e7f0895bf979d3046b20207be --- /dev/null +++ b/lib/widgets/assistant_inspector_application_field.dart @@ -0,0 +1,324 @@ +import 'package:flutter/material.dart'; +import 'package:google_fonts/google_fonts.dart'; +import 'package:smf_mobile/constants/color_constants.dart'; +import 'package:flutter_gen/gen_l10n/app_localizations.dart'; +import 'package:smf_mobile/util/helper.dart'; + +class AssistantInspectorApplicationField extends StatefulWidget { + final String fieldName; + final Map fieldData; + final Map leadInspectorData; + final ValueChanged<Map> parentAction; + const AssistantInspectorApplicationField({ + Key? key, + required this.fieldName, + required this.fieldData, + required this.leadInspectorData, + required this.parentAction, + }) : super(key: key); + @override + _AssistantInspectorApplicationFieldState createState() => + _AssistantInspectorApplicationFieldState(); +} + +class _AssistantInspectorApplicationFieldState + extends State<AssistantInspectorApplicationField> { + String _radioValue = ''; + String _inspectionValue = ''; + String _inspectionComment = ''; + String _noteText = ''; + + @override + void initState() { + super.initState(); + try { + _inspectionComment = widget.leadInspectorData['comments']; + _radioValue = widget.leadInspectorData['value']; + _inspectionValue = widget.leadInspectorData['inspectionValue']; + } catch (_) { + return; + } + // print('$_inspectionComment, $_radioValue, $_inspectionValue'); + } + + triggerUpdate(Map dialogData) { + Map data = { + widget.fieldName: { + widget.fieldData.keys.elementAt(0): { + 'value': _radioValue, + 'comments': dialogData['noteText'], + 'inspectionValue': dialogData['inspectionValue'] + } + } + }; + // print(data); + setState(() { + _noteText = dialogData['noteText']; + _inspectionValue = dialogData['inspectionValue']; + }); + widget.parentAction(data); + } + + @override + Widget build(BuildContext context) { + return SingleChildScrollView( + reverse: true, + child: Container( + margin: const EdgeInsets.fromLTRB(20, 0, 20, 20), + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + width: double.infinity, + margin: const EdgeInsets.only(top: 20), + padding: const EdgeInsets.all(20), + decoration: const BoxDecoration( + borderRadius: BorderRadius.only( + topLeft: Radius.circular(4), + topRight: Radius.circular(4)), + color: Colors.white, + boxShadow: [ + BoxShadow( + color: AppColors.black16, + offset: Offset(0, 2), + blurRadius: 2) + ], + ), + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: const EdgeInsets.only(top: 5), + child: Text( + widget.fieldName, + style: GoogleFonts.lato( + color: AppColors.black87, + fontSize: 14.0, + letterSpacing: 0.25, + fontWeight: FontWeight.w700, + ), + ), + ), + Container( + margin: const EdgeInsets.only(top: 10), + padding: const EdgeInsets.fromLTRB(15, 10, 15, 10), + width: double.infinity, + decoration: BoxDecoration( + border: Border.all(color: AppColors.black16), + ), + child: Text( + widget.fieldData.keys.elementAt(0), + style: GoogleFonts.lato( + color: AppColors.black87, + fontSize: 14.0, + letterSpacing: 0.25, + fontWeight: FontWeight.w400, + ), + ), + ) + ], + ), + ), + Container( + width: double.infinity, + padding: const EdgeInsets.all(20), + decoration: const BoxDecoration( + borderRadius: BorderRadius.only( + bottomLeft: Radius.circular(4), + bottomRight: Radius.circular(4)), + color: AppColors.fieldBackground, + boxShadow: [ + BoxShadow( + color: AppColors.black16, + offset: Offset(0, 2), + blurRadius: 2) + ], + ), + child: SizedBox( + width: double.infinity, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + width: MediaQuery.of(context).size.width, + padding: const EdgeInsets.only(bottom: 10), + child: Text( + AppLocalizations.of(context)! + .isGivenInformationCorrect, + style: GoogleFonts.lato( + color: AppColors.black60, + fontWeight: FontWeight.w700, + fontSize: 14.0, + letterSpacing: 0.25, + ), + )), + Container( + // width: MediaQuery.of(context).size.width, + margin: const EdgeInsets.only(bottom: 0), + child: Container( + padding: + const EdgeInsets.fromLTRB(15, 10, 15, 10), + margin: const EdgeInsets.only(right: 15), + decoration: BoxDecoration( + color: Colors.transparent, + borderRadius: const BorderRadius.all( + Radius.circular(4.0)), + border: Border.all( + color: AppColors.black16, + ), + ), + child: Text( + Helper.capitalize(_radioValue), + style: GoogleFonts.lato( + color: AppColors.black87, + fontWeight: FontWeight.w400, + fontSize: 14.0, + letterSpacing: 0.25, + ), + ), + ), + ), + _radioValue == 'incorrect' + ? Wrap(children: [ + Container( + width: + MediaQuery.of(context).size.width, + padding: + const EdgeInsets.only(top: 20), + child: Text( + 'Reason for the incorrect selection', + style: GoogleFonts.lato( + color: AppColors.black60, + fontWeight: FontWeight.w700, + fontSize: 14.0, + letterSpacing: 0.25, + ), + )), + Container( + width: + MediaQuery.of(context).size.width, + margin: + const EdgeInsets.only(bottom: 0), + child: Container( + padding: const EdgeInsets.fromLTRB( + 15, 10, 15, 10), + margin: + const EdgeInsets.only(top: 10), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: + const BorderRadius.all( + Radius.circular(4.0)), + border: Border.all( + color: AppColors.black08, + ), + ), + child: Text( + _inspectionComment, + style: GoogleFonts.lato( + color: AppColors.black87, + fontWeight: FontWeight.w400, + fontSize: 14.0, + letterSpacing: 0.25, + ), + ), + ), + ), + Container( + width: + MediaQuery.of(context).size.width, + padding: + const EdgeInsets.only(top: 20), + child: Text( + AppLocalizations.of(context)! + .actualValue, + style: GoogleFonts.lato( + color: AppColors.black60, + fontWeight: FontWeight.w700, + fontSize: 14.0, + letterSpacing: 0.25, + ), + )), + Container( + width: + MediaQuery.of(context).size.width, + margin: + const EdgeInsets.only(bottom: 0), + child: Container( + padding: const EdgeInsets.fromLTRB( + 15, 10, 15, 10), + margin: + const EdgeInsets.only(top: 10), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: + const BorderRadius.all( + Radius.circular(4.0)), + border: Border.all( + color: AppColors.black08, + ), + ), + child: Text( + _inspectionValue, + style: GoogleFonts.lato( + color: AppColors.black87, + fontWeight: FontWeight.w400, + fontSize: 14.0, + letterSpacing: 0.25, + ), + ), + ), + ), + // Container( + // width: + // MediaQuery.of(context).size.width, + // padding: + // const EdgeInsets.only(top: 20), + // child: Text( + // "Instiute's comment", + // style: GoogleFonts.lato( + // color: AppColors.black60, + // fontWeight: FontWeight.w700, + // fontSize: 14.0, + // letterSpacing: 0.25, + // ), + // )), + // Container( + // width: + // MediaQuery.of(context).size.width, + // margin: + // const EdgeInsets.only(bottom: 0), + // child: Container( + // padding: const EdgeInsets.fromLTRB( + // 15, 10, 15, 10), + // margin: + // const EdgeInsets.only(top: 10), + // decoration: BoxDecoration( + // color: Colors.white, + // borderRadius: + // const BorderRadius.all( + // Radius.circular(4.0)), + // border: Border.all( + // color: AppColors.black08, + // ), + // ), + // child: Text( + // 'Omne animal, simul atque integre iudicante itaque turbent.', + // style: GoogleFonts.lato( + // color: AppColors.black87, + // fontWeight: FontWeight.w400, + // fontSize: 14.0, + // letterSpacing: 0.25, + // ), + // ), + // ), + // ), + ]) + : const Center() + ], + ))), + ]))); + } +} diff --git a/lib/widgets/assistant_inspector_dialog.dart b/lib/widgets/assistant_inspector_dialog.dart new file mode 100644 index 0000000000000000000000000000000000000000..b279de80490101bd8977b63f7072597d1ab309ae --- /dev/null +++ b/lib/widgets/assistant_inspector_dialog.dart @@ -0,0 +1,205 @@ +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'package:google_fonts/google_fonts.dart'; +import 'package:smf_mobile/constants/color_constants.dart'; +// import 'package:flutter_gen/gen_l10n/app_localizations.dart'; + +class AssistantInspectorDialog extends StatefulWidget { + final String noteText; + final ValueChanged<Map> parentAction; + const AssistantInspectorDialog({ + Key? key, + required this.noteText, + required this.parentAction, + }) : super(key: key); + + @override + _AssistantInspectorDialogState createState() => + _AssistantInspectorDialogState(); +} + +class _AssistantInspectorDialogState extends State<AssistantInspectorDialog> { + final TextEditingController _noteController = TextEditingController(); + bool inspectionUpdated = false; + Map data = {}; + @override + void initState() { + super.initState(); + _noteController.text = widget.noteText; + } + + _saveData(bool status) { + Map data = {'status': status, 'note': _noteController.text}; + widget.parentAction(data); + } + + saveNoteText(String text) {} + + @override + Widget build(BuildContext context) { + return Stack( + children: [ + Align( + alignment: FractionalOffset.topCenter, + child: Container( + margin: const EdgeInsets.only(top: 150), + decoration: BoxDecoration( + color: Colors.white, borderRadius: BorderRadius.circular(4)), + constraints: const BoxConstraints(minHeight: 290, maxHeight: 290), + width: MediaQuery.of(context).size.width - 40, + child: Material( + child: Padding( + padding: const EdgeInsets.all(20), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + height: 185, + child: ListView( + shrinkWrap: true, + physics: const AlwaysScrollableScrollPhysics(), + scrollDirection: Axis.vertical, + children: [ + Padding( + padding: const EdgeInsets.all(0), + child: Text( + 'Add note', + style: GoogleFonts.lato( + color: AppColors.black87, + fontWeight: FontWeight.w700, + fontSize: 14, + letterSpacing: 0.25, + ), + )), + Container( + margin: const EdgeInsets.only(top: 15), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(4), + border: Border.all(color: AppColors.black16), + ), + child: Material( + color: Colors.white, + borderRadius: BorderRadius.circular(8), + child: Focus( + child: TextFormField( + // autofocus: true, + controller: _noteController, + textCapitalization: + TextCapitalization.sentences, + textInputAction: TextInputAction.done, + keyboardType: TextInputType.multiline, + minLines: + 8, //Normal textInputField will be displayed + maxLines: 8, // wh + onEditingComplete: () { + SystemChannels.textInput + .invokeMethod('TextInput.hide'); + return; + }, + style: const TextStyle( + color: AppColors.black87, fontSize: 14), + decoration: const InputDecoration( + border: InputBorder.none, + hintText: 'Type here', + hintStyle: TextStyle( + fontSize: 14.0, + color: AppColors.black60), + contentPadding: EdgeInsets.all(10.0), + ), + ), + ), + ), + ), + ]), + ), + Container( + margin: const EdgeInsets.only(top: 15), + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + ButtonTheme( + child: OutlinedButton( + onPressed: () { + Navigator.of(context).pop(false); + _saveData(false); + }, + style: OutlinedButton.styleFrom( + // primary: Colors.white, + side: const BorderSide( + width: 1, color: AppColors.primaryBlue), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(4), + ), + // onSurface: Colors.grey, + ), + child: Text( + 'Cancel', + style: GoogleFonts.lato( + color: AppColors.primaryBlue, + fontSize: 14, + fontWeight: FontWeight.w700), + ), + ), + ), + const Spacer(), + ButtonTheme( + child: OutlinedButton( + onPressed: () { + Navigator.of(context).pop(false); + _saveData(true); + }, + style: OutlinedButton.styleFrom( + // primary: Colors.white, + side: const BorderSide( + width: 1, color: AppColors.primaryBlue), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(4), + ), + // onSurface: Colors.grey, + ), + child: Text( + 'Skip', + style: GoogleFonts.lato( + color: AppColors.primaryBlue, + fontSize: 14, + fontWeight: FontWeight.w700), + ), + ), + ), + Padding( + padding: const EdgeInsets.only(left: 10), + child: TextButton( + onPressed: () { + Navigator.of(context).pop(false); + _saveData(true); + }, + style: TextButton.styleFrom( + // primary: Colors.white, + padding: const EdgeInsets.only( + left: 15, right: 15), + backgroundColor: AppColors.primaryBlue, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(4), + side: const BorderSide( + color: AppColors.black16)), + ), + child: Text( + 'Submit', + style: GoogleFonts.lato( + color: Colors.white, + fontWeight: FontWeight.w700, + fontSize: 14, + ), + ), + ), + ) + ], + )) + ], + ), + )), + )), + ], + ); + } +} diff --git a/lib/widgets/application_field.dart b/lib/widgets/lead_inspector_application_field.dart similarity index 97% rename from lib/widgets/application_field.dart rename to lib/widgets/lead_inspector_application_field.dart index ac8f84414cf3f4ddaa62702ed2901dcb24a5577c..e2430c04b2aac35b496a14446f97e22c1cfe9e3e 100644 --- a/lib/widgets/application_field.dart +++ b/lib/widgets/lead_inspector_application_field.dart @@ -2,17 +2,17 @@ import 'package:flutter/material.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:smf_mobile/constants/app_constants.dart'; import 'package:smf_mobile/constants/color_constants.dart'; -import 'package:smf_mobile/widgets/application_field_dialog.dart'; +import 'package:smf_mobile/widgets/lead_inspector_dialog.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; -class ApplicationField extends StatefulWidget { +class LeadInspectorApplicationField extends StatefulWidget { final String fieldName; final Map fieldData; final String fieldType; final List fieldOptions; final String applicationStatus; final ValueChanged<Map> parentAction; - const ApplicationField({ + const LeadInspectorApplicationField({ Key? key, required this.fieldName, required this.fieldData, @@ -22,10 +22,12 @@ class ApplicationField extends StatefulWidget { required this.parentAction, }) : super(key: key); @override - _ApplicationFieldState createState() => _ApplicationFieldState(); + _LeadInspectorApplicationFieldState createState() => + _LeadInspectorApplicationFieldState(); } -class _ApplicationFieldState extends State<ApplicationField> { +class _LeadInspectorApplicationFieldState + extends State<LeadInspectorApplicationField> { late Map _data; late String _radioValue; String _inspectionValue = ''; @@ -69,7 +71,7 @@ class _ApplicationFieldState extends State<ApplicationField> { return showDialog( context: context, builder: (context) => StatefulBuilder(builder: (context, setState) { - return ApplicationFieldDialog( + return LeadInspectorDialog( summaryText: _summaryText, inspectionValue: _inspectionValue, fieldType: widget.fieldType, @@ -169,7 +171,7 @@ class _ApplicationFieldState extends State<ApplicationField> { padding: const EdgeInsets.only(bottom: 10), child: Text( AppLocalizations.of(context)! - .sessionExpiredMessage, + .isGivenInformationCorrect, style: GoogleFonts.lato( color: AppColors.black60, fontWeight: FontWeight.w700, diff --git a/lib/widgets/application_field_dialog.dart b/lib/widgets/lead_inspector_dialog.dart similarity index 97% rename from lib/widgets/application_field_dialog.dart rename to lib/widgets/lead_inspector_dialog.dart index 616befd2a3ae45dfa72a7c8d2085a778f12f5161..8e788cd248b3a86d9e4b39089877ddc9f2ea4bdf 100644 --- a/lib/widgets/application_field_dialog.dart +++ b/lib/widgets/lead_inspector_dialog.dart @@ -7,15 +7,15 @@ import 'package:smf_mobile/widgets/questions/dropdown_question.dart'; import 'package:smf_mobile/widgets/questions/multi_select_question.dart'; import 'package:smf_mobile/widgets/questions/radio_question.dart'; import 'package:smf_mobile/widgets/questions/text_question.dart'; -import 'package:flutter_gen/gen_l10n/app_localizations.dart'; +// import 'package:flutter_gen/gen_l10n/app_localizations.dart'; -class ApplicationFieldDialog extends StatefulWidget { +class LeadInspectorDialog extends StatefulWidget { final String summaryText; final String inspectionValue; final String fieldType; final List fieldOptions; final ValueChanged<Map> parentAction; - const ApplicationFieldDialog({ + const LeadInspectorDialog({ Key? key, required this.summaryText, required this.inspectionValue, @@ -25,10 +25,10 @@ class ApplicationFieldDialog extends StatefulWidget { }) : super(key: key); @override - _ApplicationFieldDialogState createState() => _ApplicationFieldDialogState(); + _LeadInspectorDialogState createState() => _LeadInspectorDialogState(); } -class _ApplicationFieldDialogState extends State<ApplicationFieldDialog> { +class _LeadInspectorDialogState extends State<LeadInspectorDialog> { final TextEditingController _summaryController = TextEditingController(); String _inspectionValue = ''; bool inspectionUpdated = false; diff --git a/lib/widgets/people_card.dart b/lib/widgets/people_card.dart index 63d80a2392031524488dcad6a324bf41d6ade7df..08d9e320e81a88a4e66b04a950b7adb7a666b194 100644 --- a/lib/widgets/people_card.dart +++ b/lib/widgets/people_card.dart @@ -15,7 +15,7 @@ class PeopleCard extends StatelessWidget { return Container( color: Colors.white, // width: double.infinity, - margin: const EdgeInsets.only(left: 20, right: 20, bottom: 10.0), + margin: const EdgeInsets.only(left: 0, right: 00, bottom: 10.0), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [