1
0
forked from firka/firka

Merge branch 'fix-issue-16' into dev

This commit is contained in:
checkedear
2026-03-28 16:27:18 +01:00
2 changed files with 69 additions and 122 deletions

View File

@@ -321,34 +321,31 @@ class _HomeMainScreen extends FirkaState<HomeMainScreen> {
noticeBoardWidgets.add(( noticeBoardWidgets.add((
GestureDetector( GestureDetector(
child: FirkaCard( child: FirkaCard(
left: [], left: [
extra: Row( GradeWidget(grade),
children: [ SizedBox(width: 8),
GradeWidget(grade), Expanded(
SizedBox(width: 8), child: Column(
Expanded( crossAxisAlignment: CrossAxisAlignment.start,
child: Column( children: [
crossAxisAlignment: CrossAxisAlignment.start, Text(
children: [ (grade.topic ?? grade.type.description!).firstUpper(),
Text( style: appStyle.fonts.B_16SB.apply(
(grade.topic ?? grade.type.description!).firstUpper(), color: appStyle.colors.textPrimary,
style: appStyle.fonts.B_16SB.apply(
color: appStyle.colors.textPrimary,
),
), ),
grade.mode?.description != null ),
? Text( grade.mode?.description != null
grade.mode!.description!.firstUpper(), ? Text(
style: appStyle.fonts.B_16R.apply( grade.mode!.description!.firstUpper(),
color: appStyle.colors.textSecondary, style: appStyle.fonts.B_16R.apply(
), color: appStyle.colors.textSecondary,
) ),
: SizedBox(), )
], : SizedBox(),
), ],
), ),
], ),
), ],
), ),
onTap: () { onTap: () {
showGradeBottomSheet(context, widget.data, grade); showGradeBottomSheet(context, widget.data, grade);

View File

@@ -7,9 +7,9 @@ enum Attach { none, bottom, top }
class FirkaCard extends StatelessWidget { class FirkaCard extends StatelessWidget {
final List<Widget> left; final List<Widget> left;
final List<Widget>? center; final List<Widget> center;
final double? height; final double? height;
final List<Widget>? right; final List<Widget> right;
final bool shadow; final bool shadow;
final Widget? extra; final Widget? extra;
final Attach? attached; final Attach? attached;
@@ -19,10 +19,10 @@ class FirkaCard extends StatelessWidget {
const FirkaCard({ const FirkaCard({
required this.left, required this.left,
this.shadow = true, this.shadow = true,
this.center, this.center = const [],
this.right, this.right = const [],
this.extra, this.extra,
this.attached, this.attached = Attach.none,
this.color, this.color,
this.height, this.height,
this.isLightMode, this.isLightMode,
@@ -31,107 +31,57 @@ class FirkaCard extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
var right = this.right ?? [];
var attached = this.attached != null ? this.attached! : Attach.none;
final defaultRounding = 16.0; final defaultRounding = 16.0;
final attachedRounding = 8.0; final attachedRounding = 8.0;
final isLight = final isLight =
isLightMode ?? Theme.of(context).brightness == Brightness.light; isLightMode ?? Theme.of(context).brightness == Brightness.light;
if (extra != null) { final leftRow = Row(children: this.left);
return SizedBox(
width: MediaQuery.of(context).size.width, final alignedRow = this.right.isEmpty && this.center.isEmpty
height: height, ? leftRow
child: FirkaShadow( : Row(
shadow: shadow, mainAxisAlignment: MainAxisAlignment.spaceBetween,
isLightMode: isLight, children: [
child: Card( leftRow,
color: color ?? appStyle.colors.card, Row(children: this.center),
shadowColor: isLight && shadow ? null : Colors.transparent, Row(children: this.right),
shape: RoundedRectangleBorder( ],
borderRadius: BorderRadius.only( );
topLeft: Radius.circular(
attached == Attach.top ? attachedRounding : defaultRounding, return SizedBox(
), width: MediaQuery.of(context).size.width,
topRight: Radius.circular( height: height,
attached == Attach.top ? attachedRounding : defaultRounding, child: FirkaShadow(
), shadow: shadow,
bottomLeft: Radius.circular( isLightMode: isLight,
attached == Attach.bottom child: Card(
? attachedRounding color: color ?? appStyle.colors.card,
: defaultRounding, shadowColor: isLight && shadow ? null : Colors.transparent,
), shape: RoundedRectangleBorder(
bottomRight: Radius.circular( borderRadius: BorderRadius.only(
attached == Attach.bottom topLeft: Radius.circular(
? attachedRounding attached == Attach.top ? attachedRounding : defaultRounding,
: defaultRounding,
),
), ),
), topRight: Radius.circular(
child: Padding( attached == Attach.top ? attachedRounding : defaultRounding,
padding: const EdgeInsets.all(12.0), ),
child: Column( bottomLeft: Radius.circular(
children: [ attached == Attach.bottom ? attachedRounding : defaultRounding,
Row( ),
mainAxisAlignment: MainAxisAlignment.spaceBetween, bottomRight: Radius.circular(
children: [ attached == Attach.bottom ? attachedRounding : defaultRounding,
Row(children: left),
Row(children: center ?? []),
Row(children: right),
],
),
extra ?? const SizedBox(),
],
), ),
), ),
), ),
), child: Padding(
); padding: const EdgeInsets.all(12.0),
} else { child: this.extra == null
return SizedBox( ? alignedRow
width: MediaQuery.of(context).size.width, : Column(children: [alignedRow, this.extra!]),
height: height,
child: FirkaShadow(
shadow: shadow,
isLightMode: isLight,
child: Card(
color: color ?? appStyle.colors.card,
shadowColor: isLight && shadow ? null : Colors.transparent,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(
attached == Attach.top ? attachedRounding : defaultRounding,
),
topRight: Radius.circular(
attached == Attach.top ? attachedRounding : defaultRounding,
),
bottomLeft: Radius.circular(
attached == Attach.bottom
? attachedRounding
: defaultRounding,
),
bottomRight: Radius.circular(
attached == Attach.bottom
? attachedRounding
: defaultRounding,
),
),
),
child: Padding(
padding: const EdgeInsets.all(12.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(children: left),
Row(children: center ?? []),
Row(children: right),
],
),
),
), ),
), ),
); ),
} );
} }
} }