π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
[auth][perf] Cache timer progress widget
Neeraj Gupta815dd6b4b657
diff --git a/auth/lib/ui/code_timer_progress.dart b/auth/lib/ui/code_timer_progress.dartindex 98538788ed..a825a6ca43 100644--- a/auth/lib/ui/code_timer_progress.dart+++ b/auth/lib/ui/code_timer_progress.dart@@ -2,6 +2,17 @@ import 'package:ente_auth/theme/ente_theme.dart';import 'package:flutter/material.dart';import 'package:flutter/scheduler.dart';+class CodeTimerProgressCache {+ static final Map<int, CodeTimerProgress> _cache = {};++ static CodeTimerProgress getCachedWidget(int period) {+ if (!_cache.containsKey(period)) {+ _cache[period] = CodeTimerProgress(period: period);+ }+ return _cache[period]!;+ }+}+class CodeTimerProgress extends StatefulWidget {final int period;diff --git a/auth/lib/ui/code_widget.dart b/auth/lib/ui/code_widget.dartindex 4cd263be5a..cb073e5dea 100644--- a/auth/lib/ui/code_widget.dart+++ b/auth/lib/ui/code_widget.dart@@ -111,8 +111,8 @@ class _CodeWidgetState extends State<CodeWidget> {mainAxisAlignment: MainAxisAlignment.spaceBetween,children: [if (widget.code.type.isTOTPCompatible)- CodeTimerProgress(- period: widget.code.period,+ CodeTimerProgressCache.getCachedWidget(+ widget.code.period,),const SizedBox(height: 28),Row(