1
0
forked from firka/firka
Files
firka/firka_common/lib/ui/components/firka_shadow.dart
Armand 32936c2aa5 firka: extract firka_common package with shared widgets (Isar kept separate)
- 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
2026-03-03 15:33:11 +01:00

53 lines
1.2 KiB
Dart

import 'package:flutter/material.dart';
import 'package:firka_common/ui/theme/style.dart';
class FirkaShadow extends StatelessWidget {
final Widget child;
final bool shadow;
final double radius;
final bool? isLightMode;
const FirkaShadow({
required this.shadow,
required this.child,
this.radius = 16.0,
this.isLightMode,
super.key,
});
@override
Widget build(BuildContext context) {
final isLight =
isLightMode ?? Theme.of(context).brightness == Brightness.light;
final borderRadius = BorderRadius.circular(radius);
final shadowBox = BoxDecoration(
color: Colors.transparent,
shape: BoxShape.rectangle,
boxShadow: [
BoxShadow(
color: appStyle.colors.shadowColor,
spreadRadius: -4,
blurRadius: 0,
offset: const Offset(0, 2),
),
],
borderRadius: BorderRadius.all(Radius.circular(radius)),
);
if (!shadow) {
return ClipRRect(borderRadius: borderRadius, child: child);
}
if (isLight) {
return child;
} else {
return Container(
decoration: shadowBox,
child: ClipRRect(borderRadius: borderRadius, child: child),
);
}
}
}