fixed size of icon

This commit is contained in:
hannathkadher
2024-11-27 20:16:04 +04:00
parent 79b3d116ca
commit 49a732edb2
4 changed files with 92 additions and 45 deletions

View File

@ -0,0 +1,74 @@
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:syncrow_web/utils/color_manager.dart';
class IconSelectionDialog extends StatelessWidget {
final List<String> spaceIconList;
final Function(String selectedIcon) onIconSelected;
const IconSelectionDialog({
Key? key,
required this.spaceIconList,
required this.onIconSelected,
}) : super(key: key);
@override
Widget build(BuildContext context) {
final screenWidth = MediaQuery.of(context).size.width;
final screenHeight = MediaQuery.of(context).size.height;
return Dialog(
elevation: 0,
backgroundColor: ColorsManager.transparentColor,
child: Container(
width: screenWidth * 0.44,
height: screenHeight * 0.45,
decoration: BoxDecoration(
color: ColorsManager.whiteColors,
borderRadius: BorderRadius.circular(12),
boxShadow: [
BoxShadow(
color: Colors.black.withOpacity(0.2), // Shadow color
blurRadius: 20, // Spread of the blur
offset: const Offset(0, 8), // Offset of the shadow
),
],
),
child: AlertDialog(
title: Text('Space Icon',style: Theme.of(context).textTheme.headlineMedium),
backgroundColor: ColorsManager.whiteColors,
content: Container(
width: screenWidth * 0.4,
height: screenHeight * 0.45,
padding: const EdgeInsets.all(12),
decoration: BoxDecoration(
color: ColorsManager.boxColor,
borderRadius: BorderRadius.circular(12),
),
child: GridView.builder(
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 7,
crossAxisSpacing: 8,
mainAxisSpacing: 16,
),
itemCount: spaceIconList.length,
itemBuilder: (BuildContext context, int index) {
return GestureDetector(
onTap: () {
onIconSelected(spaceIconList[index]);
Navigator.of(context).pop();
},
child: SvgPicture.asset(
spaceIconList[index],
width: screenWidth * 0.03,
height: screenWidth * 0.03,
),
);
},
),
),
),
),
);
}
}