diff --git a/apps/health_campaign_field_worker_app/lib/widgets/sidebar/side_bar.dart b/apps/health_campaign_field_worker_app/lib/widgets/sidebar/side_bar.dart index 1fc7fc0ac..f51d997b1 100644 --- a/apps/health_campaign_field_worker_app/lib/widgets/sidebar/side_bar.dart +++ b/apps/health_campaign_field_worker_app/lib/widgets/sidebar/side_bar.dart @@ -33,222 +33,215 @@ class SideBar extends StatelessWidget { : false; return BlocBuilder(builder: (context, state) { - return Stack(children: [ - SingleChildScrollView( - child: Column(children: [ - Container( - color: theme.colorScheme.secondary.withOpacity(0.12), - child: SizedBox( - width: MediaQuery.of(context).size.width, - child: state.maybeMap( - authenticated: (value) => Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - const SizedBox( - height: 16.0, - ), - Text( - value.userModel.name.toString(), - style: theme.textTheme.displayMedium, - ), - Text( - value.userModel.mobileNumber.toString(), - style: theme.textTheme.labelSmall, - ), - const SizedBox( - height: 16.0, - ), - GestureDetector( - onTap: () { - Navigator.of(context, rootNavigator: true).pop(); - context.router.push(UserQRDetailsRoute()); - }, - child: Container( - height: 155, - width: 155, - alignment: Alignment.center, - decoration: BoxDecoration( - border: Border.all( - width: 2, - color: DigitTheme.instance.colorScheme.secondary, - ), - ), - child: QrImageView( - data: context.loggedInUserUuid, - version: QrVersions.auto, - size: 150.0, + return SingleChildScrollView( + child: Column(children: [ + Container( + color: theme.colorScheme.secondary.withOpacity(0.12), + child: SizedBox( + width: MediaQuery.of(context).size.width, + child: state.maybeMap( + authenticated: (value) => Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + const SizedBox( + height: 16.0, + ), + Text( + value.userModel.name.toString(), + style: theme.textTheme.displayMedium, + ), + Text( + value.userModel.mobileNumber.toString(), + style: theme.textTheme.labelSmall, + ), + const SizedBox( + height: 16.0, + ), + GestureDetector( + onTap: () { + Navigator.of(context, rootNavigator: true).pop(); + context.router.push(UserQRDetailsRoute()); + }, + child: Container( + height: 155, + width: 155, + alignment: Alignment.center, + decoration: BoxDecoration( + border: Border.all( + width: 2, + color: DigitTheme.instance.colorScheme.secondary, ), ), + child: QrImageView( + data: context.loggedInUserUuid, + version: QrVersions.auto, + size: 150.0, + ), ), - ], - ), - orElse: () => const Offstage(), + ), + ], ), + orElse: () => const Offstage(), ), ), - DigitIconTile( - title: AppLocalizations.of(context).translate( - i18.common.coreCommonHome, - ), - icon: Icons.home, - onPressed: () { - Navigator.of(context, rootNavigator: true).pop(); - context.router.replaceAll([HomeRoute()]); - }, + ), + DigitIconTile( + title: AppLocalizations.of(context).translate( + i18.common.coreCommonHome, ), - BlocBuilder( - builder: (context, state) { - if (state is! AppInitialized) return const Offstage(); + icon: Icons.home, + onPressed: () { + Navigator.of(context, rootNavigator: true).pop(); + context.router.replaceAll([HomeRoute()]); + }, + ), + BlocBuilder( + builder: (context, state) { + if (state is! AppInitialized) return const Offstage(); - final appConfig = state.appConfiguration; - final languages = state.appConfiguration.languages; - final localizationModulesList = - state.appConfiguration.backendInterface; + final appConfig = state.appConfiguration; + final languages = state.appConfiguration.languages; + final localizationModulesList = + state.appConfiguration.backendInterface; - return DigitIconTile( - title: AppLocalizations.of(context).translate( - i18.common.coreCommonlanguage, - ), - icon: Icons.language, - onPressed: () {}, - content: Offstage( - offstage: languages == null, - child: BlocBuilder( - builder: (context, localizationState) { - return localizationModulesList != null - ? Padding( - padding: const EdgeInsets.only(top: 16), - child: DigitRowCard( - onChanged: (value) { - int index = languages.indexWhere( - (ele) => - ele.value.toString() == - value.value.toString(), - ); - context.read().add( - LocalizationEvent - .onLoadLocalization( - module: localizationModulesList - .interfaces - .where((element) => - element.type == - Modules.localizationModule) - .map((e) => e.name.toString()) - .join(',') - .toString(), - tenantId: - appConfig.tenantId ?? "default", - locale: value.value.toString(), - path: Constants.localizationApiPath, - )); + return DigitIconTile( + title: AppLocalizations.of(context).translate( + i18.common.coreCommonlanguage, + ), + icon: Icons.language, + onPressed: () {}, + content: Offstage( + offstage: languages == null, + child: BlocBuilder( + builder: (context, localizationState) { + return localizationModulesList != null + ? Padding( + padding: const EdgeInsets.only(top: 16), + child: DigitRowCard( + onChanged: (value) { + int index = languages.indexWhere( + (ele) => + ele.value.toString() == + value.value.toString(), + ); + context.read().add( + LocalizationEvent + .onLoadLocalization( + module: localizationModulesList + .interfaces + .where((element) => + element.type == + Modules.localizationModule) + .map((e) => e.name.toString()) + .join(',') + .toString(), + tenantId: + appConfig.tenantId ?? "default", + locale: value.value.toString(), + path: Constants.localizationApiPath, + )); - context.read().add( - OnUpdateLocalizationIndexEvent( - index: index, - code: value.value.toString(), - ), - ); - }, - rowItems: languages!.map((e) { - var index = languages.indexOf(e); + context.read().add( + OnUpdateLocalizationIndexEvent( + index: index, + code: value.value.toString(), + ), + ); + }, + rowItems: languages!.map((e) { + var index = languages.indexOf(e); - return DigitRowCardModel( - label: e.label, - value: e.value, - isSelected: getSelectedLanguage( - state, - index, - ), - ); - }).toList(), - width: (MediaQuery.of(context).size.width * - 0.56 / - languages.length) - - (4 * languages.length), - ), - ) - : const Offstage(); - }, - ), + return DigitRowCardModel( + label: e.label, + value: e.value, + isSelected: getSelectedLanguage( + state, + index, + ), + ); + }).toList(), + width: (MediaQuery.of(context).size.width * + 0.56 / + languages.length) - + (4 * languages.length), + ), + ) + : const Offstage(); + }, ), - ); - }, - ), - BlocBuilder(builder: (ctx, state) { - return DigitIconTile( - title: AppLocalizations.of(context).translate( - i18.common.coreCommonProfile, ), - icon: Icons.person, - onPressed: () async { - final connectivityResult = - await (Connectivity().checkConnectivity()); - final isOnline = - connectivityResult == ConnectivityResult.wifi || - connectivityResult == ConnectivityResult.mobile; + ); + }, + ), + BlocBuilder(builder: (ctx, state) { + return DigitIconTile( + title: AppLocalizations.of(context).translate( + i18.common.coreCommonProfile, + ), + icon: Icons.person, + onPressed: () async { + final connectivityResult = + await (Connectivity().checkConnectivity()); + final isOnline = + connectivityResult == ConnectivityResult.wifi || + connectivityResult == ConnectivityResult.mobile; - if (isOnline) { - if (context.mounted) { - Navigator.of(context, rootNavigator: true).pop(); - context.router.push(ProfileRoute()); - } - } else { - if (context.mounted) { - DigitDialog.show( - context, - options: DigitDialogOptions( - titleText: AppLocalizations.of(context).translate( - i18.common.connectionLabel, - ), - contentText: AppLocalizations.of(context).translate( - i18.common.connectionContent, - ), - primaryAction: DigitDialogActions( - label: AppLocalizations.of(context).translate( - i18.common.coreCommonOk, - ), - action: (ctx) => - Navigator.of(context, rootNavigator: true) - .pop(), + if (isOnline) { + if (context.mounted) { + Navigator.of(context, rootNavigator: true).pop(); + context.router.push(ProfileRoute()); + } + } else { + if (context.mounted) { + DigitDialog.show( + context, + options: DigitDialogOptions( + titleText: AppLocalizations.of(context).translate( + i18.common.connectionLabel, + ), + contentText: AppLocalizations.of(context).translate( + i18.common.connectionContent, + ), + primaryAction: DigitDialogActions( + label: AppLocalizations.of(context).translate( + i18.common.coreCommonOk, ), + action: (ctx) => + Navigator.of(context, rootNavigator: true) + .pop(), ), - ); - } + ), + ); } - }, - ); - }), - if (isDistributor) - DigitIconTile( - title: AppLocalizations.of(context).translate( - i18.common.coreCommonViewDownloadedData, - ), - icon: Icons.download, - onPressed: () { - Navigator.of(context, rootNavigator: true).pop(); - context.router.push(const BeneficiariesReportRoute()); - }, - ), + } + }, + ); + }), + if (isDistributor) DigitIconTile( - title: AppLocalizations.of(context) - .translate(i18.common.coreCommonLogout), - icon: Icons.logout, + title: AppLocalizations.of(context).translate( + i18.common.coreCommonViewDownloadedData, + ), + icon: Icons.download, onPressed: () { - context.read().add(const BoundaryResetEvent()); - context.read().add(const AuthLogoutEvent()); + Navigator.of(context, rootNavigator: true).pop(); + context.router.push(const BeneficiariesReportRoute()); }, - ) - ]), - ), - Positioned( - bottom: 20, - left: 0, - right: 0, - child: PoweredByDigit( + ), + DigitIconTile( + title: AppLocalizations.of(context) + .translate(i18.common.coreCommonLogout), + icon: Icons.logout, + onPressed: () { + context.read().add(const BoundaryResetEvent()); + context.read().add(const AuthLogoutEvent()); + }, + ), + PoweredByDigit( version: Constants().version, ), - ), - ]); + ]), + ); }); } } diff --git a/packages/survey_form/lib/pages/survey_form_preview.dart b/packages/survey_form/lib/pages/survey_form_preview.dart index fa3959cbc..fbc0bae7e 100644 --- a/packages/survey_form/lib/pages/survey_form_preview.dart +++ b/packages/survey_form/lib/pages/survey_form_preview.dart @@ -215,7 +215,7 @@ class SurveyFormPreviewPageState extends LocalizedState { 'SingleValueList' ? localizations .translate( - e.value.toString().toUpperCase(), + '${item2?.code ?? ''}.${e.value.toString().toUpperCase()}', ) : e.value ?? "", ),