import 'package:comwell_key_app/.generated/assets/assets.gen.dart';
import 'package:comwell_key_app/themes/app_spaces.dart';
import 'package:comwell_key_app/themes/comwell_colors.dart';
import 'package:comwell_key_app/utils/context_utils.dart';
import 'package:comwell_key_app/utils/text_style_utils.dart';
import 'package:flutter/material.dart';
class PermissionScreenTemplate extends StatelessWidget {
const PermissionScreenTemplate({
super.key,
required this.title,
required this.primaryButtonText,
required this.image,
this.subtitle = "",
this.secondaryButtonText = "",
this.primaryButtonOnClick,
this.secondaryButtonOnClick,
this.primaryButtonIsLoading = false,
this.showCloseButton = false,
});
final SvgGenImage image;
final String title;
final String subtitle;
final String primaryButtonText;
final String secondaryButtonText;
final VoidCallback? primaryButtonOnClick;
final VoidCallback? secondaryButtonOnClick;
final bool primaryButtonIsLoading;
final bool showCloseButton;
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: sandColor,
appBar: AppBar(
backgroundColor: sandColor,
automaticallyImplyLeading: false,
actions: [if (showCloseButton) const CloseButton()],
),
body: Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
AppSpaces.gap80,
image.svg(),
AppSpaces.gap120,
Text(title, style: context.textStyles.headingMedium.white),
AppSpaces.gap12,
Text(
subtitle,
style: context.textStyles.body.white,
textAlign: TextAlign.center,
),
const Spacer(),
SafeArea(
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
TextButton(
onPressed: primaryButtonOnClick,
style: context.buttonStyles.primaryMainDefault,
child: Center(
child: Text(primaryButtonText, style: context.textStyles.headingSmall),
),
),
if (secondaryButtonOnClick != null) AppSpaces.gap08,
if (secondaryButtonOnClick != null)
TextButton(
onPressed: secondaryButtonOnClick,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
secondaryButtonText,
style: context.textStyles.body.white,
),
],
),
),
],
),
),
],
),
),
);
}
}