From 06249bfc3d5e69b1902f62fc9cca24eaa7408913 Mon Sep 17 00:00:00 2001 From: checkedear <271323618+checkedear@users.noreply.github.com> Date: Sat, 18 Apr 2026 13:38:44 +0200 Subject: [PATCH] fix: timetable style --- .../ui/phone/pages/home/home_timetable.dart | 46 +++++++------ .../lib/ui/phone/widgets/bottom_tt_icon.dart | 67 ++++++++++++------- 2 files changed, 68 insertions(+), 45 deletions(-) diff --git a/firka/lib/ui/phone/pages/home/home_timetable.dart b/firka/lib/ui/phone/pages/home/home_timetable.dart index 84fdf12..e336872 100644 --- a/firka/lib/ui/phone/pages/home/home_timetable.dart +++ b/firka/lib/ui/phone/pages/home/home_timetable.dart @@ -2,6 +2,7 @@ import 'dart:async'; import 'package:carousel_slider/carousel_slider.dart'; import 'package:firka/api/client/kreta_stream.dart'; +import 'package:intl/intl.dart'; import 'package:kreta_api/kreta_api.dart'; import 'package:firka/core/debug_helper.dart'; import 'package:firka/core/extensions.dart'; @@ -287,7 +288,7 @@ class _HomeTimetableScreen extends FirkaState active = -1; const double cardWidth = 40.0; - const double spacing = 18.0; + const double spacing = 16.0; final double totalCardWidth = cardWidth + spacing; // Calculate animation positions based on real display indices @@ -409,7 +410,7 @@ class _HomeTimetableScreen extends FirkaState Stack( children: [ ttWidget, - Transform.translate(offset: Offset(38, -10), child: BubbleTest()), + Transform.translate(offset: Offset(34, -9), child: BubbleTest()), ], ), ); @@ -464,10 +465,11 @@ class _HomeTimetableScreen extends FirkaState ); } - Widget ttAnimatedCard = Card( - color: Colors.transparent, - shadowColor: Colors.transparent, - child: SizedBox(width: 40, height: 54), + Widget ttAnimatedCard = BottomTimeTableNavIconWidget( + widget.data.l10n, + () => {}, + false, + null, ); if (_cardOffsetAnimation != null && _showAnimatedCard) { @@ -476,10 +478,11 @@ class _HomeTimetableScreen extends FirkaState builder: (context, child) { return Transform.translate( offset: _cardOffsetAnimation!.value, - child: Card( - color: appStyle.colors.buttonSecondaryFill, - shadowColor: Colors.transparent, - child: SizedBox(width: 40, height: 54), + child: BottomTimeTableNavIconWidget( + widget.data.l10n, + () => {}, + true, + null, ), ); }, @@ -600,6 +603,7 @@ class _HomeTimetableScreen extends FirkaState ), GestureDetector( child: Row( + spacing: 4, children: [ Text( now!.format( @@ -610,7 +614,6 @@ class _HomeTimetableScreen extends FirkaState color: appStyle.colors.textPrimary, ), ), - SizedBox(width: 4), if (showABTimetable) ...[ Text( "•", @@ -618,7 +621,6 @@ class _HomeTimetableScreen extends FirkaState color: appStyle.colors.accent, ), ), - SizedBox(width: 4), Text( now!.isAWeek() ? widget.data.l10n.a_week @@ -672,6 +674,7 @@ class _HomeTimetableScreen extends FirkaState ), Column( mainAxisAlignment: MainAxisAlignment.end, + crossAxisAlignment: CrossAxisAlignment.stretch, children: [ Expanded( child: TransparentPointer( @@ -701,7 +704,7 @@ class _HomeTimetableScreen extends FirkaState ), ), Container( - padding: EdgeInsets.only(bottom: 12), + padding: EdgeInsets.only(bottom: 2), decoration: ShapeDecoration( color: Colors.transparent, shape: RoundedRectangleBorder( @@ -710,17 +713,18 @@ class _HomeTimetableScreen extends FirkaState shadows: [ BoxShadow( color: appStyle.colors.background, - blurRadius: 30, - spreadRadius: 20, - offset: Offset(0, -25), + blurRadius: 36, + offset: Offset(0, -27), ), ], ), - child: Stack( - children: [ - ttAnimatedCard, - Wrap(spacing: 10, children: ttWidgets), - ], + child: Center( + child: Stack( + children: [ + ttAnimatedCard, + Wrap(spacing: 16, children: ttWidgets), + ], + ), ), ), ], diff --git a/firka/lib/ui/phone/widgets/bottom_tt_icon.dart b/firka/lib/ui/phone/widgets/bottom_tt_icon.dart index dd84b52..0afb4da 100644 --- a/firka/lib/ui/phone/widgets/bottom_tt_icon.dart +++ b/firka/lib/ui/phone/widgets/bottom_tt_icon.dart @@ -1,5 +1,6 @@ import 'package:firka/core/extensions.dart'; import 'package:firka/l10n/app_localizations.dart'; +import 'package:firka_common/ui/components/firka_card.dart'; import 'package:flutter/material.dart'; import 'package:firka/ui/theme/style.dart'; @@ -8,7 +9,7 @@ class BottomTimeTableNavIconWidget extends StatelessWidget { final AppLocalizations l10n; final void Function() onTap; final bool active; - final DateTime date; + final DateTime? date; const BottomTimeTableNavIconWidget( this.l10n, @@ -25,30 +26,48 @@ class BottomTimeTableNavIconWidget extends StatelessWidget { onTap: () { onTap(); }, - child: Card( - color: active - ? appStyle.colors.buttonSecondaryFill - : Colors.transparent, - shadowColor: active ? appStyle.colors.shadowColor : Colors.transparent, - child: SizedBox( - width: 40, - height: 54, + child: Container( + width: 40, + height: 54, + decoration: ShapeDecoration( + shadows: active + ? [ + BoxShadow( + color: appStyle.colors.shadowColor, + offset: const Offset(0, 1), + ), + ] + : [], + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(12), + ), + color: active + ? appStyle.colors.buttonSecondaryFill + : Colors.transparent, + ), + child: Center( child: Column( - children: [ - SizedBox(height: 6), - Text( - date.format(l10n, FormatMode.da), - style: appStyle.fonts.H_16px.apply( - color: appStyle.colors.textPrimary, - ), - ), - Text( - date.format(l10n, FormatMode.dd), - style: appStyle.fonts.B_16R.apply( - color: appStyle.colors.textSecondary, - ), - ), - ], + mainAxisSize: MainAxisSize.min, + children: date != null + ? [ + Text( + date!.format(l10n, FormatMode.da), + style: appStyle.fonts.H_16px.apply( + color: active + ? appStyle.colors.textPrimary + : appStyle.colors.textTeritary, + ), + ), + Text( + date!.format(l10n, FormatMode.dd), + style: appStyle.fonts.B_16R.apply( + color: active + ? appStyle.colors.textSecondary + : appStyle.colors.textTeritary, + ), + ), + ] + : [], ), ), ),