2024-05-19 22:08:04 +02:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
|
|
|
class IconPage extends StatelessWidget {
|
|
|
|
final IconData selectedIcon;
|
|
|
|
final ValueChanged<IconData> onIconSelected;
|
|
|
|
|
2024-06-02 22:44:29 +02:00
|
|
|
const IconPage({Key? key, required this.selectedIcon, required this.onIconSelected}) : super(key: key);
|
2024-05-19 22:08:04 +02:00
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
final List<IconData> 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'),
|
|
|
|
),
|
2024-06-02 22:44:29 +02:00
|
|
|
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,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
},
|
2024-05-19 22:08:04 +02:00
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|