forked from firka/firka
Compare commits
7 Commits
dev
...
backup/dev
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
38f2837034 | ||
|
|
b3b40b5e39 | ||
|
|
85c2576804 | ||
|
|
22d17f6969 | ||
|
|
7f09c507eb | ||
|
|
1d00505ca7 | ||
|
|
94e6a13ab7 |
1
firka/android/app/src/main/java/org/brotli
Submodule
1
firka/android/app/src/main/java/org/brotli
Submodule
Submodule firka/android/app/src/main/java/org/brotli added at da8f329432
@@ -16,6 +16,7 @@ import 'package:firka/core/bloc/theme_cubit.dart';
|
||||
import 'package:firka/core/firka_bundle.dart';
|
||||
import 'package:firka/routing/app_router.dart';
|
||||
import 'package:firka/services/watch_sync_helper.dart';
|
||||
import 'package:firka/ui/theme/style.dart';
|
||||
import 'package:firka/ui/phone/pages/extras/main_wear_pair.dart';
|
||||
import 'package:firka/l10n/app_localizations.dart';
|
||||
import 'package:flutter_localizations/flutter_localizations.dart';
|
||||
@@ -34,6 +35,23 @@ class _InitializationScreenState extends State<InitializationScreen> {
|
||||
const Duration(seconds: 20),
|
||||
);
|
||||
|
||||
ThemeData _buildTheme(FirkaStyle style) {
|
||||
return ThemeData(
|
||||
scaffoldBackgroundColor: style.colors.background,
|
||||
canvasColor: style.colors.background,
|
||||
bottomSheetTheme: const BottomSheetThemeData(
|
||||
backgroundColor: Colors.transparent,
|
||||
),
|
||||
colorScheme: ColorScheme.fromSeed(
|
||||
seedColor: style.colors.accent,
|
||||
brightness: style.isLight ? Brightness.light : Brightness.dark,
|
||||
background: style.colors.background,
|
||||
surface: style.colors.card,
|
||||
),
|
||||
useMaterial3: false,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return FutureBuilder<AppInitialization>(
|
||||
@@ -180,14 +198,34 @@ class _InitializationScreenState extends State<InitializationScreen> {
|
||||
BlocProvider<ReauthCubit>.value(value: reauthCubit),
|
||||
BlocProvider<HomeRefreshCubit>.value(value: homeRefreshCubit),
|
||||
],
|
||||
child: MaterialApp.router(
|
||||
child: BlocBuilder<ThemeCubit, ThemeState>(
|
||||
builder: (context, themeState) {
|
||||
final isLight = themeState.isLightMode;
|
||||
final overlay = SystemUiOverlayStyle(
|
||||
statusBarColor: Colors.transparent,
|
||||
statusBarIconBrightness:
|
||||
isLight ? Brightness.dark : Brightness.light,
|
||||
statusBarBrightness:
|
||||
isLight ? Brightness.light : Brightness.dark,
|
||||
systemStatusBarContrastEnforced: false,
|
||||
);
|
||||
|
||||
final themeMode =
|
||||
isLight ? ThemeMode.light : ThemeMode.dark;
|
||||
|
||||
final fallbackBg = isLight
|
||||
? lightStyle.colors.background
|
||||
: darkStyle.colors.background;
|
||||
|
||||
SystemChrome.setSystemUIOverlayStyle(overlay);
|
||||
|
||||
return MaterialApp.router(
|
||||
title: 'Firka',
|
||||
key: const ValueKey('firkaApp'),
|
||||
routerConfig: _router!,
|
||||
theme: ThemeData(
|
||||
primarySwatch: Colors.lightGreen,
|
||||
visualDensity: VisualDensity.adaptivePlatformDensity,
|
||||
),
|
||||
theme: _buildTheme(lightStyle),
|
||||
darkTheme: _buildTheme(darkStyle),
|
||||
themeMode: themeMode,
|
||||
localizationsDelegates: const [
|
||||
AppLocalizations.delegate,
|
||||
GlobalMaterialLocalizations.delegate,
|
||||
@@ -195,25 +233,12 @@ class _InitializationScreenState extends State<InitializationScreen> {
|
||||
],
|
||||
supportedLocales: AppLocalizations.supportedLocales,
|
||||
builder: (context, child) {
|
||||
return BlocBuilder<ThemeCubit, ThemeState>(
|
||||
builder: (context, themeState) {
|
||||
final isLight = themeState.isLightMode;
|
||||
final overlay = SystemUiOverlayStyle(
|
||||
statusBarColor: Colors.transparent,
|
||||
statusBarIconBrightness: isLight
|
||||
? Brightness.dark
|
||||
: Brightness.light,
|
||||
statusBarBrightness: isLight
|
||||
? Brightness.light
|
||||
: Brightness.dark,
|
||||
systemStatusBarContrastEnforced: false,
|
||||
);
|
||||
|
||||
SystemChrome.setSystemUIOverlayStyle(overlay);
|
||||
|
||||
return AnnotatedRegion<SystemUiOverlayStyle>(
|
||||
value: overlay,
|
||||
child: ColoredBox(
|
||||
color: fallbackBg,
|
||||
child: child ?? const SizedBox.shrink(),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
Submodule firka/lib/l10n updated: 2ac00c3bea...c65b8073ca
@@ -1048,9 +1048,13 @@ class _GradeCalculatorSheetContent extends StatefulWidget {
|
||||
class _GradeCalculatorSheetContentState
|
||||
extends State<_GradeCalculatorSheetContent> {
|
||||
int selectedGrade = 3;
|
||||
int weightPercent = 100;
|
||||
int weightIndex = 1; // 0-based index into _snapPoints
|
||||
final List<(int grade, int weight)> entries = [];
|
||||
|
||||
static const _snapPoints = [50, 100, 200, 300, 500];
|
||||
|
||||
int get weightPercent => _snapPoints[weightIndex];
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Column(
|
||||
@@ -1184,11 +1188,12 @@ class _GradeCalculatorSheetContentState
|
||||
trackHeight: 8,
|
||||
),
|
||||
child: Slider(
|
||||
value: weightPercent.toDouble(),
|
||||
min: 1,
|
||||
max: 500,
|
||||
divisions: 499,
|
||||
onChanged: (v) => setState(() => weightPercent = v.round()),
|
||||
value: weightIndex.toDouble(),
|
||||
min: 0,
|
||||
max: (_snapPoints.length - 1).toDouble(),
|
||||
divisions: _snapPoints.length - 1,
|
||||
label: '${weightPercent}%',
|
||||
onChanged: (v) => setState(() => weightIndex = v.round()),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -55,7 +55,7 @@ class _HomeMainScreen extends FirkaState<HomeMainScreen> {
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> fetchData({bool cacheOnly = true}) async {
|
||||
Future<void> fetchData({bool cacheOnly = false}) async {
|
||||
final midnight = now.getMidnight();
|
||||
|
||||
var lessonsFetched = 0;
|
||||
|
||||
@@ -69,6 +69,7 @@ class _LoginScreenState extends FirkaState<LoginScreen> {
|
||||
"assets/images/carousel_dark/slide3.webp",
|
||||
"assets/images/carousel_dark/slide4.webp",
|
||||
"assets/images/logos/colored_logo.webp",
|
||||
"assets/images/logos/loading.gif",
|
||||
];
|
||||
try {
|
||||
await ImagePreloader.preloadMultipleAssets(FirkaBundle(), imagePaths);
|
||||
@@ -816,32 +817,42 @@ class _FloatingCardsSlideState extends State<_FloatingCardsSlide>
|
||||
double vx = _velocities[i].dx;
|
||||
double vy = _velocities[i].dy;
|
||||
|
||||
// capture incoming velocity components before any bounce damping
|
||||
final double preVx = vx;
|
||||
final double preVy = vy;
|
||||
double impactSpeed = 0.0; // normal to the wall
|
||||
|
||||
bool hit = false;
|
||||
|
||||
if (pos.dx < minX) {
|
||||
pos = Offset(minX, pos.dy);
|
||||
vx = vx.abs() * _bounceDamping;
|
||||
impactSpeed = math.max(impactSpeed, preVx.abs());
|
||||
hit = true;
|
||||
} else if (pos.dx > maxX) {
|
||||
pos = Offset(maxX, pos.dy);
|
||||
vx = -vx.abs() * _bounceDamping;
|
||||
impactSpeed = math.max(impactSpeed, preVx.abs());
|
||||
hit = true;
|
||||
}
|
||||
|
||||
if (pos.dy < minY) {
|
||||
pos = Offset(pos.dx, minY);
|
||||
vy = vy.abs() * _bounceDamping;
|
||||
impactSpeed = math.max(impactSpeed, preVy.abs());
|
||||
hit = true;
|
||||
} else if (pos.dy > maxY) {
|
||||
pos = Offset(pos.dx, maxY);
|
||||
vy = -vy.abs() * _bounceDamping;
|
||||
impactSpeed = math.max(impactSpeed, preVy.abs());
|
||||
hit = true;
|
||||
}
|
||||
|
||||
_velocities[i] = _clampVel(Offset(vx, vy));
|
||||
_positions[i] = pos;
|
||||
|
||||
if (hit && _velocities[i].distance > _vibrateSpeedThreshold) {
|
||||
// vibrate only when the component toward the wall exceeded threshold
|
||||
if (hit && impactSpeed > _vibrateSpeedThreshold) {
|
||||
wallHitThisTick = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,6 +93,27 @@ class _GradeChartState extends State<GradeChart> {
|
||||
}
|
||||
}
|
||||
|
||||
List<FlSpot> _smoothSpots(List<FlSpot> input) {
|
||||
if (input.length < 3) return input;
|
||||
|
||||
final smoothed = <FlSpot>[];
|
||||
for (var i = 0; i < input.length; i++) {
|
||||
if (i == 0 || i == input.length - 1) {
|
||||
smoothed.add(input[i]);
|
||||
continue;
|
||||
}
|
||||
|
||||
final prev = input[i - 1].y;
|
||||
final curr = input[i].y;
|
||||
final next = input[i + 1].y;
|
||||
final blended = (0.25 * prev) + (0.5 * curr) + (0.25 * next);
|
||||
|
||||
smoothed.add(FlSpot(input[i].x, blended));
|
||||
}
|
||||
|
||||
return smoothed;
|
||||
}
|
||||
|
||||
@override
|
||||
void didUpdateWidget(covariant GradeChart oldWidget) {
|
||||
super.didUpdateWidget(oldWidget);
|
||||
@@ -213,8 +234,10 @@ class _GradeChartState extends State<GradeChart> {
|
||||
}
|
||||
|
||||
LineChartData avgData() {
|
||||
var firstX = spots.first.x;
|
||||
var lastX = spots.last.x;
|
||||
final smoothedSpots = _smoothSpots(spots);
|
||||
|
||||
var firstX = smoothedSpots.first.x;
|
||||
var lastX = smoothedSpots.last.x;
|
||||
if (firstX == lastX) {
|
||||
lastX = firstX + 1;
|
||||
}
|
||||
@@ -359,12 +382,12 @@ class _GradeChartState extends State<GradeChart> {
|
||||
|
||||
lineBarsData: [
|
||||
LineChartBarData(
|
||||
spots: spots,
|
||||
spots: smoothedSpots,
|
||||
isCurved: true,
|
||||
curveSmoothness: 0.35,
|
||||
curveSmoothness: 0.5,
|
||||
showingIndicators: _touchedIndex != null ? [_touchedIndex!] : [],
|
||||
gradient: LinearGradient(
|
||||
colors: [for (final s in spots) colorForY(s.y)],
|
||||
colors: [for (final s in smoothedSpots) colorForY(s.y)],
|
||||
),
|
||||
barWidth: 5,
|
||||
isStrokeCapRound: true,
|
||||
@@ -373,7 +396,8 @@ class _GradeChartState extends State<GradeChart> {
|
||||
show: true,
|
||||
gradient: LinearGradient(
|
||||
colors: [
|
||||
for (final s in spots) colorForY(s.y).withValues(alpha: 0.1),
|
||||
for (final s in smoothedSpots)
|
||||
colorForY(s.y).withValues(alpha: 0.1),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
@@ -276,15 +276,10 @@ class _LoginWebviewWidgetState extends FirkaState<LoginWebviewWidget>
|
||||
child: Container(
|
||||
color: appStyle.colors.background,
|
||||
child: Center(
|
||||
child: SizedBox(
|
||||
width: 32,
|
||||
height: 32,
|
||||
child: CircularProgressIndicator(
|
||||
strokeWidth: 3,
|
||||
valueColor: AlwaysStoppedAnimation<Color>(
|
||||
appStyle.colors.accent,
|
||||
),
|
||||
),
|
||||
child: Image.asset(
|
||||
"assets/images/logos/loading.gif",
|
||||
width: 50,
|
||||
height: 50,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -81,6 +81,7 @@ flutter:
|
||||
- .env
|
||||
- assets/images/logos/colored_logo.webp
|
||||
- assets/images/logos/dave.svg
|
||||
- assets/images/logos/loading.gif
|
||||
- assets/images/carousel/
|
||||
- assets/images/carousel_dark/
|
||||
- assets/images/icons/
|
||||
|
||||
Reference in New Issue
Block a user