mirror of
https://github.com/smmarty/friflex_flutter_starter.git
synced 2025-12-22 01:20:46 +00:00
refactor(full refactor): Рефакторинг стартера (#8)
This commit is contained in:
54
lib/features/debug/screens/icons_screen.dart
Normal file
54
lib/features/debug/screens/icons_screen.dart
Normal file
@@ -0,0 +1,54 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:friflex_starter/app/app_box.dart';
|
||||
import 'package:friflex_starter/gen/assets.gen.dart';
|
||||
|
||||
/// {@template IconsScreen}
|
||||
/// Экран для отрисовки иконок
|
||||
/// {@endtemplate}
|
||||
class IconsScreen extends StatelessWidget {
|
||||
/// {@macro IconsScreen}
|
||||
const IconsScreen({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final iconList = Assets.icons.values
|
||||
.map(
|
||||
(icon) => _ItemIcon(icon: icon.svg(), name: icon.path),
|
||||
)
|
||||
.toList();
|
||||
return Scaffold(
|
||||
appBar: AppBar(title: const Text('Иконки')),
|
||||
body: Center(
|
||||
child: ListView.separated(
|
||||
padding: const EdgeInsets.all(16),
|
||||
itemBuilder: (context, index) {
|
||||
return iconList[index];
|
||||
},
|
||||
separatorBuilder: (context, index) => const Divider(),
|
||||
itemCount: iconList.length,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Приватный класс для реализации элемента списка иконок
|
||||
class _ItemIcon extends StatelessWidget {
|
||||
/// Создает экземпляр элемента списка иконок
|
||||
///
|
||||
/// Принимает:
|
||||
/// - [icon] - иконка
|
||||
/// - [name] - название иконки
|
||||
const _ItemIcon({required this.icon, required this.name});
|
||||
|
||||
/// Иконка
|
||||
final Widget icon;
|
||||
|
||||
/// Название иконки
|
||||
final String name;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Row(children: [icon, const WBox(16), Text(name)]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user