information dialog added.
parent
6e1b63cef8
commit
2349925ed1
@ -0,0 +1,86 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:test_sa/extensions/context_extension.dart';
|
||||
import 'package:test_sa/extensions/int_extensions.dart';
|
||||
import 'package:test_sa/extensions/text_extensions.dart';
|
||||
import 'package:test_sa/extensions/widget_extensions.dart';
|
||||
import 'package:test_sa/new_views/app_style/app_color.dart';
|
||||
import 'package:test_sa/new_views/common_widgets/app_filled_button.dart';
|
||||
|
||||
class InfoContent {
|
||||
final String? title;
|
||||
final String? message;
|
||||
|
||||
InfoContent({this.title, this.message});
|
||||
}
|
||||
|
||||
class InfoDialog extends StatelessWidget {
|
||||
final String? title;
|
||||
final String? message;
|
||||
final List<InfoContent> content;
|
||||
|
||||
final String? okTitle;
|
||||
final VoidCallback? onTap;
|
||||
final VoidCallback? onCloseTap;
|
||||
|
||||
const InfoDialog({Key? key, this.title, this.message, this.content = const [], this.okTitle, this.onTap, this.onCloseTap}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Dialog(
|
||||
backgroundColor: AppColor.background(context),
|
||||
shape: const RoundedRectangleBorder(),
|
||||
insetPadding: const EdgeInsets.only(left: 21, right: 21),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(left: 20, right: 20, top: 18, bottom: 28),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text(
|
||||
title ?? "Information",
|
||||
style: TextStyle(fontSize: 24, fontWeight: FontWeight.w600, color: AppColor.headingTextColor(context), height: 35 / 24, letterSpacing: -0.96),
|
||||
).paddingOnly(top: 16),
|
||||
),
|
||||
IconButton(
|
||||
padding: EdgeInsets.zero,
|
||||
icon: const Icon(Icons.close),
|
||||
color: AppColor.iconColor(context),
|
||||
constraints: const BoxConstraints(),
|
||||
onPressed: () => onCloseTap ?? Navigator.pop(context),
|
||||
// onPressed: () => Navigator.pop(context),
|
||||
)
|
||||
],
|
||||
),
|
||||
message != null ? message!.bodyText(context).custom(color: context.isDark ? AppColor.neutral10 : AppColor.neutral20) : const SizedBox(),
|
||||
8.height,
|
||||
ListView.separated(
|
||||
shrinkWrap: true,
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
itemBuilder: (cxt, index) => RichText(
|
||||
text: TextSpan(
|
||||
text: "${content[index].title}: ",
|
||||
style: AppTextStyles.heading6.copyWith(fontWeight: FontWeight.w600, color: AppColor.textColor(context)),
|
||||
children: [
|
||||
TextSpan(text: content[index].message, style: AppTextStyles.bodyText.copyWith(color: context.isDark ? AppColor.neutral10 : AppColor.neutral20)),
|
||||
],
|
||||
),
|
||||
),
|
||||
separatorBuilder: (cxt, index) => 6.height,
|
||||
itemCount: content.length),
|
||||
24.height,
|
||||
AppFilledButton(
|
||||
label: okTitle ?? "OK",
|
||||
onPressed: onTap ?? () => Navigator.pop(context),
|
||||
textColor: Colors.white,
|
||||
//color: Ap.green,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue