forked from firka/firka
fix: timetable style
This commit is contained in:
@@ -2,6 +2,7 @@ import 'dart:async';
|
|||||||
|
|
||||||
import 'package:carousel_slider/carousel_slider.dart';
|
import 'package:carousel_slider/carousel_slider.dart';
|
||||||
import 'package:firka/api/client/kreta_stream.dart';
|
import 'package:firka/api/client/kreta_stream.dart';
|
||||||
|
import 'package:intl/intl.dart';
|
||||||
import 'package:kreta_api/kreta_api.dart';
|
import 'package:kreta_api/kreta_api.dart';
|
||||||
import 'package:firka/core/debug_helper.dart';
|
import 'package:firka/core/debug_helper.dart';
|
||||||
import 'package:firka/core/extensions.dart';
|
import 'package:firka/core/extensions.dart';
|
||||||
@@ -287,7 +288,7 @@ class _HomeTimetableScreen extends FirkaState<HomeTimetableScreen>
|
|||||||
active = -1;
|
active = -1;
|
||||||
|
|
||||||
const double cardWidth = 40.0;
|
const double cardWidth = 40.0;
|
||||||
const double spacing = 18.0;
|
const double spacing = 16.0;
|
||||||
final double totalCardWidth = cardWidth + spacing;
|
final double totalCardWidth = cardWidth + spacing;
|
||||||
|
|
||||||
// Calculate animation positions based on real display indices
|
// Calculate animation positions based on real display indices
|
||||||
@@ -409,7 +410,7 @@ class _HomeTimetableScreen extends FirkaState<HomeTimetableScreen>
|
|||||||
Stack(
|
Stack(
|
||||||
children: [
|
children: [
|
||||||
ttWidget,
|
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<HomeTimetableScreen>
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget ttAnimatedCard = Card(
|
Widget ttAnimatedCard = BottomTimeTableNavIconWidget(
|
||||||
color: Colors.transparent,
|
widget.data.l10n,
|
||||||
shadowColor: Colors.transparent,
|
() => {},
|
||||||
child: SizedBox(width: 40, height: 54),
|
false,
|
||||||
|
null,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (_cardOffsetAnimation != null && _showAnimatedCard) {
|
if (_cardOffsetAnimation != null && _showAnimatedCard) {
|
||||||
@@ -476,10 +478,11 @@ class _HomeTimetableScreen extends FirkaState<HomeTimetableScreen>
|
|||||||
builder: (context, child) {
|
builder: (context, child) {
|
||||||
return Transform.translate(
|
return Transform.translate(
|
||||||
offset: _cardOffsetAnimation!.value,
|
offset: _cardOffsetAnimation!.value,
|
||||||
child: Card(
|
child: BottomTimeTableNavIconWidget(
|
||||||
color: appStyle.colors.buttonSecondaryFill,
|
widget.data.l10n,
|
||||||
shadowColor: Colors.transparent,
|
() => {},
|
||||||
child: SizedBox(width: 40, height: 54),
|
true,
|
||||||
|
null,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
@@ -600,6 +603,7 @@ class _HomeTimetableScreen extends FirkaState<HomeTimetableScreen>
|
|||||||
),
|
),
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
child: Row(
|
child: Row(
|
||||||
|
spacing: 4,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
now!.format(
|
now!.format(
|
||||||
@@ -610,7 +614,6 @@ class _HomeTimetableScreen extends FirkaState<HomeTimetableScreen>
|
|||||||
color: appStyle.colors.textPrimary,
|
color: appStyle.colors.textPrimary,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
SizedBox(width: 4),
|
|
||||||
if (showABTimetable) ...[
|
if (showABTimetable) ...[
|
||||||
Text(
|
Text(
|
||||||
"•",
|
"•",
|
||||||
@@ -618,7 +621,6 @@ class _HomeTimetableScreen extends FirkaState<HomeTimetableScreen>
|
|||||||
color: appStyle.colors.accent,
|
color: appStyle.colors.accent,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
SizedBox(width: 4),
|
|
||||||
Text(
|
Text(
|
||||||
now!.isAWeek()
|
now!.isAWeek()
|
||||||
? widget.data.l10n.a_week
|
? widget.data.l10n.a_week
|
||||||
@@ -672,6 +674,7 @@ class _HomeTimetableScreen extends FirkaState<HomeTimetableScreen>
|
|||||||
),
|
),
|
||||||
Column(
|
Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.end,
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
child: TransparentPointer(
|
child: TransparentPointer(
|
||||||
@@ -701,7 +704,7 @@ class _HomeTimetableScreen extends FirkaState<HomeTimetableScreen>
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
Container(
|
Container(
|
||||||
padding: EdgeInsets.only(bottom: 12),
|
padding: EdgeInsets.only(bottom: 2),
|
||||||
decoration: ShapeDecoration(
|
decoration: ShapeDecoration(
|
||||||
color: Colors.transparent,
|
color: Colors.transparent,
|
||||||
shape: RoundedRectangleBorder(
|
shape: RoundedRectangleBorder(
|
||||||
@@ -710,17 +713,18 @@ class _HomeTimetableScreen extends FirkaState<HomeTimetableScreen>
|
|||||||
shadows: [
|
shadows: [
|
||||||
BoxShadow(
|
BoxShadow(
|
||||||
color: appStyle.colors.background,
|
color: appStyle.colors.background,
|
||||||
blurRadius: 30,
|
blurRadius: 36,
|
||||||
spreadRadius: 20,
|
offset: Offset(0, -27),
|
||||||
offset: Offset(0, -25),
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
child: Stack(
|
child: Center(
|
||||||
children: [
|
child: Stack(
|
||||||
ttAnimatedCard,
|
children: [
|
||||||
Wrap(spacing: 10, children: ttWidgets),
|
ttAnimatedCard,
|
||||||
],
|
Wrap(spacing: 16, children: ttWidgets),
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import 'package:firka/core/extensions.dart';
|
import 'package:firka/core/extensions.dart';
|
||||||
import 'package:firka/l10n/app_localizations.dart';
|
import 'package:firka/l10n/app_localizations.dart';
|
||||||
|
import 'package:firka_common/ui/components/firka_card.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
import 'package:firka/ui/theme/style.dart';
|
import 'package:firka/ui/theme/style.dart';
|
||||||
@@ -8,7 +9,7 @@ class BottomTimeTableNavIconWidget extends StatelessWidget {
|
|||||||
final AppLocalizations l10n;
|
final AppLocalizations l10n;
|
||||||
final void Function() onTap;
|
final void Function() onTap;
|
||||||
final bool active;
|
final bool active;
|
||||||
final DateTime date;
|
final DateTime? date;
|
||||||
|
|
||||||
const BottomTimeTableNavIconWidget(
|
const BottomTimeTableNavIconWidget(
|
||||||
this.l10n,
|
this.l10n,
|
||||||
@@ -25,30 +26,48 @@ class BottomTimeTableNavIconWidget extends StatelessWidget {
|
|||||||
onTap: () {
|
onTap: () {
|
||||||
onTap();
|
onTap();
|
||||||
},
|
},
|
||||||
child: Card(
|
child: Container(
|
||||||
color: active
|
width: 40,
|
||||||
? appStyle.colors.buttonSecondaryFill
|
height: 54,
|
||||||
: Colors.transparent,
|
decoration: ShapeDecoration(
|
||||||
shadowColor: active ? appStyle.colors.shadowColor : Colors.transparent,
|
shadows: active
|
||||||
child: SizedBox(
|
? [
|
||||||
width: 40,
|
BoxShadow(
|
||||||
height: 54,
|
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(
|
child: Column(
|
||||||
children: [
|
mainAxisSize: MainAxisSize.min,
|
||||||
SizedBox(height: 6),
|
children: date != null
|
||||||
Text(
|
? [
|
||||||
date.format(l10n, FormatMode.da),
|
Text(
|
||||||
style: appStyle.fonts.H_16px.apply(
|
date!.format(l10n, FormatMode.da),
|
||||||
color: appStyle.colors.textPrimary,
|
style: appStyle.fonts.H_16px.apply(
|
||||||
),
|
color: active
|
||||||
),
|
? appStyle.colors.textPrimary
|
||||||
Text(
|
: appStyle.colors.textTeritary,
|
||||||
date.format(l10n, FormatMode.dd),
|
),
|
||||||
style: appStyle.fonts.B_16R.apply(
|
),
|
||||||
color: appStyle.colors.textSecondary,
|
Text(
|
||||||
),
|
date!.format(l10n, FormatMode.dd),
|
||||||
),
|
style: appStyle.fonts.B_16R.apply(
|
||||||
],
|
color: active
|
||||||
|
? appStyle.colors.textSecondary
|
||||||
|
: appStyle.colors.textTeritary,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
]
|
||||||
|
: [],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
Reference in New Issue
Block a user