69 lines
1.5 KiB
Dart
69 lines
1.5 KiB
Dart
part of 'index.dart';
|
|
|
|
interface class Category extends Archive {
|
|
final int id;
|
|
final Color color;
|
|
final String title;
|
|
|
|
Category({
|
|
required this.id,
|
|
required this.color,
|
|
required this.title,
|
|
});
|
|
|
|
factory Category.fromDesc(String desc) {
|
|
return Category(
|
|
id: 0,
|
|
color: Colors.transparent,
|
|
title: desc,
|
|
);
|
|
}
|
|
|
|
static Color isSelected() => Colors.black;
|
|
}
|
|
|
|
class CategoryItem extends StatelessComponent {
|
|
final Category category;
|
|
|
|
const CategoryItem({
|
|
super.key,
|
|
required this.category,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final backgroundTheme = FlutterFlowTheme.of(context).primaryBackground;
|
|
return ColoredBox(
|
|
color: backgroundTheme,
|
|
child: Padding(
|
|
padding: const EdgeInsets.all(8.0),
|
|
child: Column(
|
|
children: [
|
|
Container(
|
|
padding: const EdgeInsets.all(8.0),
|
|
decoration: BoxDecoration(
|
|
color: category.color,
|
|
shape: BoxShape.circle,
|
|
),
|
|
child: Icon(
|
|
Icons.folder,
|
|
color: Colors.white,
|
|
size: 40,
|
|
),
|
|
),
|
|
const SizedBox(height: 8),
|
|
Text(
|
|
category.title,
|
|
style: TextStyle(
|
|
color: category.color,
|
|
fontWeight: FontWeight.bold,
|
|
),
|
|
overflow: TextOverflow.ellipsis,
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|