81 lines
2.6 KiB
Dart
81 lines
2.6 KiB
Dart
import 'package:flutter/material.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: const TextStyle(
|
|
fontFamily: 'Gilroy-Bold',
|
|
fontSize: 18,
|
|
fontWeight: FontWeight.w700,
|
|
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: const TextStyle(
|
|
fontFamily: 'Gilroy-Medium',
|
|
fontSize: 14,
|
|
height: 1.6,
|
|
color: Colors.black54,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
actionsPadding: const EdgeInsets.only(right: 10, bottom: 8),
|
|
actions: [
|
|
TextButton(
|
|
onPressed: () => Navigator.of(ctx).pop(),
|
|
child: const Text(
|
|
"Close",
|
|
style: TextStyle(
|
|
fontFamily: 'Gilroy-SemiBold',
|
|
fontSize: 14,
|
|
color: Color(0xFF6A4BFC),
|
|
),
|
|
),
|
|
),
|
|
],
|
|
);
|
|
},
|
|
);
|
|
}
|
|
}
|