feat: type dialog

This commit is contained in:
efrilm
2025-08-01 01:17:00 +07:00
parent 74460c921b
commit f3e6d49a27
4 changed files with 172 additions and 59 deletions
+62 -57
View File
@@ -1,5 +1,6 @@
import 'package:enaklo_pos/core/components/spaces.dart';
import 'package:enaklo_pos/core/constants/colors.dart';
import 'package:enaklo_pos/core/extensions/build_context_ext.dart';
import 'package:flutter/material.dart';
class CustomModalDialog extends StatelessWidget {
@@ -24,71 +25,75 @@ class CustomModalDialog extends StatelessWidget {
),
child: ConstrainedBox(
constraints: BoxConstraints(
minWidth: 200,
maxWidth: 600,
minHeight: 200,
maxHeight: 600,
minWidth: context.deviceWidth * 0.3,
maxWidth: context.deviceWidth * 0.8,
minHeight: context.deviceHeight * 0.3,
maxHeight: context.deviceHeight * 0.8,
),
child: Column(
children: [
Container(
padding: const EdgeInsets.all(16),
width: double.infinity,
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [
AppColors.primary,
const Color.fromARGB(255, 67, 69, 195)
],
begin: Alignment.topLeft,
end: Alignment.bottomRight,
child: IntrinsicWidth(
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Container(
padding: const EdgeInsets.all(16),
width: double.infinity,
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [
const Color.fromARGB(255, 81, 40, 134),
AppColors.primary,
],
begin: Alignment.topLeft,
end: Alignment.bottomRight,
),
borderRadius: BorderRadius.vertical(
top: Radius.circular(16),
),
),
borderRadius: BorderRadius.vertical(
top: Radius.circular(16),
),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
title,
style: TextStyle(
color: AppColors.white,
fontSize: 20,
fontWeight: FontWeight.bold,
),
),
if (subtitle != null)
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
subtitle ?? '',
title,
style: TextStyle(
color: AppColors.grey,
fontSize: 16,
color: AppColors.white,
fontSize: 20,
fontWeight: FontWeight.bold,
),
),
],
if (subtitle != null)
Text(
subtitle ?? '',
style: TextStyle(
color: AppColors.grey,
fontSize: 16,
fontWeight: FontWeight.w500,
),
),
],
),
),
),
SpaceWidth(12),
IconButton(
icon: Icon(Icons.close, color: AppColors.white),
onPressed: () {
if (onClose != null) {
onClose!();
} else {
Navigator.of(context).pop();
}
},
),
],
SpaceWidth(12),
IconButton(
icon: Icon(Icons.close, color: AppColors.white),
onPressed: () {
if (onClose != null) {
onClose!();
} else {
Navigator.of(context).pop();
}
},
),
],
),
),
),
child,
],
child,
],
),
),
),
);
+1 -1
View File
@@ -3,7 +3,6 @@ import 'package:flutter/material.dart';
class AppColors {
/// primary = #3949AB
static const Color primary = Color(0xff36175e);
static const Color secondary = Color(0xfff1eaf9);
/// grey = #B7B7B7
static const Color grey = Color(0xffB7B7B7);
@@ -19,6 +18,7 @@ class AppColors {
/// white = #FFFFFF
static const Color white = Color(0xffFFFFFF);
static const Color whiteText = Color(0xfff1eaf9);
/// green = #50C474
static const Color green = Color(0xff50C474);