import 'package:flutter/material.dart'; class IconPage extends StatelessWidget { final IconData selectedIcon; final ValueChanged onIconSelected; const IconPage({ super.key, required this.selectedIcon, required this.onIconSelected}); @override Widget build(BuildContext context) { final List icons = [ Icons.star, Icons.favorite, Icons.check, Icons.home, Icons.access_alarm, Icons.import_contacts_rounded, Icons.code, Icons.face, Icons.format_paint, Icons.book, Icons.event_busy, Icons.self_improvement_outlined, Icons.snowshoeing, Icons.family_restroom, Icons.notification_important, Icons.local_drink, Icons.music_note, Icons.edit_note, Icons.healing, Icons.tv ]; return Scaffold( appBar: AppBar( title: const Text('Choose your icon'), ), body: Padding( padding: const EdgeInsets.all(10.0), child: GridView.builder( gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount( crossAxisCount: 4, crossAxisSpacing: 8.0, mainAxisSpacing: 8.0, ), itemCount: icons.length, itemBuilder: (context, index) { return InkWell( onTap: () { onIconSelected(icons[index]); Navigator.pop(context, icons[index]); }, child: Container( decoration: BoxDecoration( color: Colors.grey[200], borderRadius: BorderRadius.circular(10.0), ), child: Icon( icons[index], size: 35.0, color: selectedIcon == icons[index] ? Colors.purple : Colors.black, ), ), ); }, ), ), ); } }