cpd/lib/pages/iconpage.dart

57 lines
1.4 KiB
Dart

import 'package:flutter/material.dart';
class IconPage extends StatelessWidget {
final IconData selectedIcon;
final ValueChanged<IconData> onIconSelected;
const IconPage({super.key, required this.selectedIcon, required this.onIconSelected});
@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
// Füge weitere Icons hinzu
];
return Scaffold(
appBar: AppBar(
title: const Text('Choose your icon'),
),
body: GridView.builder(
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 4,
),
itemCount: icons.length,
itemBuilder: (context, index) {
return IconButton(
icon: Icon(icons[index]),
onPressed: () {
onIconSelected(icons[index]);
Navigator.pop(context, icons[index]);
},
);
},
),
);
}
}