taxgilde/lib/consts/comman_popup.dart
2026-04-15 12:32:30 +05:30

78 lines
2.5 KiB
Dart

import 'package:flutter/material.dart';
import 'package:taxglide/consts/app_style.dart';
class CommonInfoPopup {
/// 🔹 Show a reusable popup dialog
static void show({
required BuildContext context,
required String title,
required String content,
}) {
final ScrollController scrollController = ScrollController();
showDialog(
context: context,
barrierDismissible: true,
builder: (BuildContext ctx) {
return AlertDialog(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(18),
),
backgroundColor: Colors.white,
titlePadding: const EdgeInsets.fromLTRB(20, 20, 20, 10),
contentPadding: const EdgeInsets.fromLTRB(20, 0, 20, 10),
title: Text(
title,
style: AppTextStyles.bold.copyWith(
fontSize: 18,
color: Colors.black87,
),
),
content: ConstrainedBox(
constraints: const BoxConstraints(maxHeight: 300),
child: ScrollbarTheme(
data: ScrollbarThemeData(
thumbColor: WidgetStateProperty.all(
const Color(0xFF6A4BFC),
), // 💜 Custom scrollbar color
trackColor: WidgetStateProperty.all(Colors.transparent),
radius: const Radius.circular(8),
thickness: WidgetStateProperty.all(4),
),
child: Scrollbar(
controller: scrollController,
thumbVisibility: true,
child: SingleChildScrollView(
controller: scrollController,
child: Text(
content,
textAlign: TextAlign.justify,
style: AppTextStyles.regular.copyWith(
fontSize: 14,
height: 1.6,
color: Colors.black54,
),
),
),
),
),
),
actionsPadding: const EdgeInsets.only(right: 10, bottom: 8),
actions: [
TextButton(
onPressed: () => Navigator.of(ctx).pop(),
child: Text(
"Close",
style: AppTextStyles.regular.copyWith(
fontSize: 14,
color: const Color(0xFF6A4BFC),
),
),
),
],
);
},
);
}
}