diff --git a/lib/src/configuration/app_bar_configuration.dart b/lib/src/configuration/app_bar_configuration.dart index e22c94e7..6a38a397 100644 --- a/lib/src/configuration/app_bar_configuration.dart +++ b/lib/src/configuration/app_bar_configuration.dart @@ -5,10 +5,12 @@ class AppBarConfiguration { final bool? canBack; final bool? showProgress; final Widget? trailing; + final bool? showCancelButton; const AppBarConfiguration({ required this.canBack, required this.showProgress, + this.showCancelButton = true, this.leading, this.trailing, }); diff --git a/lib/src/views/widget/survey_app_bar.dart b/lib/src/views/widget/survey_app_bar.dart index 59cfe4c3..ac51bd37 100644 --- a/lib/src/views/widget/survey_app_bar.dart +++ b/lib/src/views/widget/survey_app_bar.dart @@ -34,18 +34,19 @@ class SurveyAppBar extends StatelessWidget { : Container(), title: _showProgress ? SurveyProgress() : SizedBox.shrink(), actions: [ - TextButton( - child: appBarConfiguration.trailing ?? - Text( - context.read?>()?['cancel'] ?? 'Cancel', - style: TextStyle( - color: Theme.of(context).primaryColor, + if (appBarConfiguration.showCancelButton ?? true) + TextButton( + child: appBarConfiguration.trailing ?? + Text( + context.read?>()?['cancel'] ?? 'Cancel', + style: TextStyle( + color: Theme.of(context).primaryColor, + ), ), - ), - onPressed: () => surveyController.closeSurvey( - context: context, + onPressed: () => surveyController.closeSurvey( + context: context, + ), ), - ), ], ); }