forked from firka/firka
- Create firka_common package with core helpers (debug, json, icon), theme, and shared widgets (FirkaCard, FirkaShadow, GradeWidget, GradeSmallCard, ClassIconWidget, FirkaIconWidget, DelayedSpinnerWidget, CounterDigitWidget) - Keep Isar models (GenericCacheModel, TimetableCacheModel, HomeworkCacheModel, DatedCacheEntry, util) in firka and firka_wear - not moved to firka_common - Update firka and firka_wear to depend on firka_common for shared UI only - Add configurable roundGrade thresholds for firka settings - Add package param to FirkaIconWidget for app asset paths
47 lines
1.2 KiB
Dart
47 lines
1.2 KiB
Dart
import 'dart:typed_data';
|
|
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_svg/svg.dart';
|
|
import 'package:majesticons_flutter/majesticons_flutter.dart';
|
|
|
|
enum FirkaIconType { icons, majesticons, majesticonsLocal }
|
|
|
|
class FirkaIconWidget extends StatelessWidget {
|
|
final FirkaIconType iconType;
|
|
final Object iconData;
|
|
final Color color;
|
|
final double? size;
|
|
final String? package;
|
|
|
|
const FirkaIconWidget(
|
|
this.iconType,
|
|
this.iconData, {
|
|
super.key,
|
|
this.color = Colors.white,
|
|
this.size,
|
|
this.package,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
switch (iconType) {
|
|
case FirkaIconType.icons:
|
|
return SvgPicture.asset(
|
|
'assets/icons/${iconData as String}.svg',
|
|
color: color,
|
|
height: size,
|
|
package: package,
|
|
);
|
|
case FirkaIconType.majesticons:
|
|
return Majesticon(iconData as Uint8List, color: color, size: size);
|
|
case FirkaIconType.majesticonsLocal:
|
|
return SvgPicture.asset(
|
|
'assets/majesticons/${iconData as String}.svg',
|
|
color: color,
|
|
height: size,
|
|
package: package,
|
|
);
|
|
}
|
|
}
|
|
}
|