Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

[AUTH] Made dart analyzer happy (#3226)

Kishan Dhankecha8b43f18f6a5a
diff --git a/auth/lib/ente_theme_data.dart b/auth/lib/ente_theme_data.dart
index 2eb19bf27c..b6f65d12dc 100644
--- a/auth/lib/ente_theme_data.dart
+++ b/auth/lib/ente_theme_data.dart
@@ -66,24 +66,25 @@ final lightThemeData = ThemeData(
color: Colors.black,
width: 2,
),
- fillColor: MaterialStateProperty.resolveWith((states) {
- return states.contains(MaterialState.selected)
+ fillColor: WidgetStateProperty.resolveWith((states) {
+ return states.contains(WidgetState.selected)
? const Color.fromRGBO(0, 0, 0, 1)
: const Color.fromRGBO(255, 255, 255, 1);
}),
- checkColor: MaterialStateProperty.resolveWith((states) {
- return states.contains(MaterialState.selected)
+ checkColor: WidgetStateProperty.resolveWith((states) {
+ return states.contains(WidgetState.selected)
? const Color.fromRGBO(255, 255, 255, 1)
: const Color.fromRGBO(0, 0, 0, 1);
}),
),
+
radioTheme: RadioThemeData(
fillColor:
- MaterialStateProperty.resolveWith<Color?>((Set<MaterialState> states) {
- if (states.contains(MaterialState.disabled)) {
+ WidgetStateProperty.resolveWith<Color?>((Set<WidgetState> states) {
+ if (states.contains(WidgetState.disabled)) {
return null;
}
- if (states.contains(MaterialState.selected)) {
+ if (states.contains(WidgetState.selected)) {
return const Color.fromRGBO(102, 187, 106, 1);
}
return null;
@@ -91,21 +92,21 @@ final lightThemeData = ThemeData(
),
switchTheme: SwitchThemeData(
thumbColor:
- MaterialStateProperty.resolveWith<Color?>((Set<MaterialState> states) {
- if (states.contains(MaterialState.disabled)) {
+ WidgetStateProperty.resolveWith<Color?>((Set<WidgetState> states) {
+ if (states.contains(WidgetState.disabled)) {
return null;
}
- if (states.contains(MaterialState.selected)) {
+ if (states.contains(WidgetState.selected)) {
return const Color.fromRGBO(102, 187, 106, 1);
}
return null;
}),
trackColor:
- MaterialStateProperty.resolveWith<Color?>((Set<MaterialState> states) {
- if (states.contains(MaterialState.disabled)) {
+ WidgetStateProperty.resolveWith<Color?>((Set<WidgetState> states) {
+ if (states.contains(WidgetState.disabled)) {
return null;
}
- if (states.contains(MaterialState.selected)) {
+ if (states.contains(WidgetState.selected)) {
return const Color.fromRGBO(102, 187, 106, 1);
}
return null;
@@ -114,7 +115,7 @@ final lightThemeData = ThemeData(
colorScheme: const ColorScheme.light(
primary: Colors.black,
secondary: Color.fromARGB(255, 163, 163, 163),
- ).copyWith(background: const Color.fromRGBO(255, 255, 255, 1)),
+ ).copyWith(surface: const Color.fromRGBO(255, 255, 255, 1)),
);
final darkThemeData = ThemeData(
@@ -176,15 +177,15 @@ final darkThemeData = ThemeData(
color: Colors.grey,
width: 2,
),
- fillColor: MaterialStateProperty.resolveWith((states) {
- if (states.contains(MaterialState.selected)) {
+ fillColor: WidgetStateProperty.resolveWith((states) {
+ if (states.contains(WidgetState.selected)) {
return const Color.fromRGBO(158, 158, 158, 1);
} else {
return const Color.fromRGBO(0, 0, 0, 1);
}
}),
- checkColor: MaterialStateProperty.resolveWith((states) {
- if (states.contains(MaterialState.selected)) {
+ checkColor: WidgetStateProperty.resolveWith((states) {
+ if (states.contains(WidgetState.selected)) {
return const Color.fromRGBO(0, 0, 0, 1);
} else {
return const Color.fromRGBO(158, 158, 158, 1);
@@ -193,11 +194,11 @@ final darkThemeData = ThemeData(
),
radioTheme: RadioThemeData(
fillColor:
- MaterialStateProperty.resolveWith<Color?>((Set<MaterialState> states) {
- if (states.contains(MaterialState.disabled)) {
+ WidgetStateProperty.resolveWith<Color?>((Set<WidgetState> states) {
+ if (states.contains(WidgetState.disabled)) {
return null;
}
- if (states.contains(MaterialState.selected)) {
+ if (states.contains(WidgetState.selected)) {
return const Color.fromRGBO(102, 187, 106, 1);
}
return null;
@@ -205,28 +206,28 @@ final darkThemeData = ThemeData(
),
switchTheme: SwitchThemeData(
thumbColor:
- MaterialStateProperty.resolveWith<Color?>((Set<MaterialState> states) {
- if (states.contains(MaterialState.disabled)) {
+ WidgetStateProperty.resolveWith<Color?>((Set<WidgetState> states) {
+ if (states.contains(WidgetState.disabled)) {
return null;
}
- if (states.contains(MaterialState.selected)) {
+ if (states.contains(WidgetState.selected)) {
return const Color.fromRGBO(102, 187, 106, 1);
}
return null;
}),
trackColor:
- MaterialStateProperty.resolveWith<Color?>((Set<MaterialState> states) {
- if (states.contains(MaterialState.disabled)) {
+ WidgetStateProperty.resolveWith<Color?>((Set<WidgetState> states) {
+ if (states.contains(WidgetState.disabled)) {
return null;
}
- if (states.contains(MaterialState.selected)) {
+ if (states.contains(WidgetState.selected)) {
return const Color.fromRGBO(102, 187, 106, 1);
}
return null;
}),
),
colorScheme: const ColorScheme.dark(primary: Colors.white)
- .copyWith(background: const Color.fromRGBO(0, 0, 0, 1)),
+ .copyWith(surface: const Color.fromRGBO(0, 0, 0, 1)),
);
TextTheme _buildTextTheme(Color textColor) {
@@ -458,17 +459,17 @@ OutlinedButtonThemeData buildOutlinedButtonThemeData({
fontSize: 18,
),
).copyWith(
- backgroundColor: MaterialStateProperty.resolveWith<Color>(
- (Set<MaterialState> states) {
- if (states.contains(MaterialState.disabled)) {
+ backgroundColor: WidgetStateProperty.resolveWith<Color>(
+ (Set<WidgetState> states) {
+ if (states.contains(WidgetState.disabled)) {
return bgDisabled;
}
return bgEnabled;
},
),
- foregroundColor: MaterialStateProperty.resolveWith<Color>(
- (Set<MaterialState> states) {
- if (states.contains(MaterialState.disabled)) {
+ foregroundColor: WidgetStateProperty.resolveWith<Color>(
+ (Set<WidgetState> states) {
+ if (states.contains(WidgetState.disabled)) {
return fgDisabled;
}
return fgEnabled;
diff --git a/auth/lib/onboarding/view/view_qr_page.dart b/auth/lib/onboarding/view/view_qr_page.dart
index 687f810e35..995db1387c 100644
--- a/auth/lib/onboarding/view/view_qr_page.dart
+++ b/auth/lib/onboarding/view/view_qr_page.dart
@@ -31,11 +31,11 @@ class ViewQrPage extends StatelessWidget {
data: code!.rawData,
eyeStyle: QrEyeStyle(
eyeShape: QrEyeShape.square,
- color: Theme.of(context).colorScheme.onBackground,
+ color: Theme.of(context).colorScheme.onSurface,
),
dataModuleStyle: QrDataModuleStyle(
dataModuleShape: QrDataModuleShape.square,
- color: Theme.of(context).colorScheme.onBackground,
+ color: Theme.of(context).colorScheme.onSurface,
),
version: QrVersions.auto,
size: qrSize,
diff --git a/auth/lib/services/user_service.dart b/auth/lib/services/user_service.dart
index 313e96a8b1..5ad356e89e 100644
--- a/auth/lib/services/user_service.dart
+++ b/auth/lib/services/user_service.dart
@@ -585,9 +585,8 @@ class UserService {
final clientS = client.calculateSecret(serverB);
final clientM = client.calculateClientEvidenceMessage();
- late Response _;
if (setKeysRequest == null) {
- _ = await _enteDio.post(
+ await _enteDio.post(
"/users/srp/complete",
data: {
'setupID': setupSRPResponse.setupID,
@@ -595,7 +594,7 @@ class UserService {
},
);
} else {
- _ = await _enteDio.post(
+ await _enteDio.post(
"/users/srp/update",
data: {
'setupID': setupSRPResponse.setupID,
diff --git a/auth/lib/ui/common/bottom_shadow.dart b/auth/lib/ui/common/bottom_shadow.dart
index a57e5232a6..2de7e944e2 100644
--- a/auth/lib/ui/common/bottom_shadow.dart
+++ b/auth/lib/ui/common/bottom_shadow.dart
@@ -1,5 +1,3 @@
-
-
import 'package:flutter/material.dart';
class BottomShadowWidget extends StatelessWidget {
@@ -15,7 +13,7 @@ class BottomShadowWidget extends StatelessWidget {
color: Colors.transparent,
boxShadow: [
BoxShadow(
- color: shadowColor ?? Theme.of(context).colorScheme.background,
+ color: shadowColor ?? Theme.of(context).colorScheme.surface,
spreadRadius: 42,
blurRadius: 42,
offset: Offset(0, offsetDy), // changes position of shadow
diff --git a/auth/lib/ui/common/dynamic_fab.dart b/auth/lib/ui/common/dynamic_fab.dart
index 8ccd9b8554..f7860674b2 100644
--- a/auth/lib/ui/common/dynamic_fab.dart
+++ b/auth/lib/ui/common/dynamic_fab.dart
@@ -24,7 +24,7 @@ class DynamicFAB extends StatelessWidget {
decoration: BoxDecoration(
boxShadow: [
BoxShadow(
- color: Theme.of(context).colorScheme.background,
+ color: Theme.of(context).colorScheme.surface,
spreadRadius: 200,
blurRadius: 100,
offset: const Offset(0, 230),
diff --git a/auth/lib/ui/home/coach_mark_widget.dart b/auth/lib/ui/home/coach_mark_widget.dart
index b0e15d7d2b..b14e97a25b 100644
--- a/auth/lib/ui/home/coach_mark_widget.dart
+++ b/auth/lib/ui/home/coach_mark_widget.dart
@@ -22,7 +22,7 @@ class CoachMarkWidget extends StatelessWidget {
Expanded(
child: Container(
width: double.infinity,
- color: Theme.of(context).colorScheme.background.withOpacity(0.1),
+ color: Theme.of(context).colorScheme.surface.withOpacity(0.1),
child: BackdropFilter(
filter: ImageFilter.blur(sigmaX: 8, sigmaY: 8),
child: Row(
diff --git a/auth/lib/ui/home/home_empty_state.dart b/auth/lib/ui/home/home_empty_state.dart
index 0768f04919..0632364ea4 100644
--- a/auth/lib/ui/home/home_empty_state.dart
+++ b/auth/lib/ui/home/home_empty_state.dart
@@ -75,7 +75,7 @@ class HomeEmptyStateWidget extends StatelessWidget {
onTap: () {
showModalBottomSheet<void>(
backgroundColor:
- Theme.of(context).colorScheme.background,
+ Theme.of(context).colorScheme.surface,
barrierColor: Colors.black87,
context: context,
builder: (context) {
diff --git a/auth/lib/ui/home_page.dart b/auth/lib/ui/home_page.dart
index a4c581dc85..44927d4af0 100644
--- a/auth/lib/ui/home_page.dart
+++ b/auth/lib/ui/home_page.dart
@@ -230,7 +230,7 @@ class _HomePageState extends State<HomePage> {
final l10n = context.l10n;
return PopScope(
- onPopInvoked: (_) async {
+ onPopInvokedWithResult: (_, result) async {
if (_isSettingsOpen) {
scaffoldKey.currentState!.closeDrawer();
return;
@@ -540,7 +540,7 @@ class _HomePageState extends State<HomePage> {
foregroundColor: Theme.of(context).colorScheme.fabForegroundColor,
backgroundColor: Theme.of(context).colorScheme.fabBackgroundColor,
overlayOpacity: 0.5,
- overlayColor: Theme.of(context).colorScheme.background,
+ overlayColor: Theme.of(context).colorScheme.surface,
elevation: 8.0,
animationCurve: Curves.elasticInOut,
children: [
diff --git a/auth/lib/ui/settings/app_update_dialog.dart b/auth/lib/ui/settings/app_update_dialog.dart
index 176abc4b19..8741b84365 100644
--- a/auth/lib/ui/settings/app_update_dialog.dart
+++ b/auth/lib/ui/settings/app_update_dialog.dart
@@ -62,8 +62,8 @@ class _AppUpdateDialogState extends State<AppUpdateDialog> {
height: 64,
child: OutlinedButton(
style: Theme.of(context).outlinedButtonTheme.style!.copyWith(
- textStyle: MaterialStateProperty.resolveWith<TextStyle?>(
- (Set<MaterialState> states) {
+ textStyle: WidgetStateProperty.resolveWith<TextStyle?>(
+ (Set<WidgetState> states) {
return Theme.of(context).textTheme.titleMedium;
},
),
diff --git a/auth/lib/ui/settings/support_section_widget.dart b/auth/lib/ui/settings/support_section_widget.dart
index b445748650..057c5dd389 100644
--- a/auth/lib/ui/settings/support_section_widget.dart
+++ b/auth/lib/ui/settings/support_section_widget.dart
@@ -44,7 +44,7 @@ class _SupportSectionWidgetState extends State<SupportSectionWidget> {
onTap: () async {
// ignore: unawaited_futures
showModalBottomSheet<void>(
- backgroundColor: Theme.of(context).colorScheme.background,
+ backgroundColor: Theme.of(context).colorScheme.surface,
barrierColor: Colors.black87,
context: context,
builder: (context) {
diff --git a/auth/lib/utils/dialog_util.dart b/auth/lib/utils/dialog_util.dart
index 158db3dec1..6c58e1f861 100644
--- a/auth/lib/utils/dialog_util.dart
+++ b/auth/lib/utils/dialog_util.dart
@@ -109,14 +109,14 @@ String parseErrorForUI(
final DioException dioError = error;
if (dioError.type == DioExceptionType.badResponse) {
if (dioError.response?.data["code"] != null) {
- errorInfo = "Reason: " + dioError.response!.data["code"];
+ errorInfo = "Reason: ${dioError.response!.data["code"]}";
} else {
- errorInfo = "Reason: " + dioError.response!.data.toString();
+ errorInfo = "Reason: ${dioError.response!.data}";
}
} else if (dioError.type == DioExceptionType.unknown) {
- errorInfo = "Reason: " + dioError.error.toString();
+ errorInfo = "Reason: $dioError.error";
} else {
- errorInfo = "Reason: " + dioError.type.toString();
+ errorInfo = "Reason: $dioError.type";
}
} else {
if (kDebugMode) {
diff --git a/auth/lib/utils/window_protocol_handler.dart b/auth/lib/utils/window_protocol_handler.dart
index a1436ef01f..a09b43e003 100644
--- a/auth/lib/utils/window_protocol_handler.dart
+++ b/auth/lib/utils/window_protocol_handler.dart
@@ -36,7 +36,7 @@ class WindowsProtocolHandler {
hKey,
txtKey,
txtValue,
- REG_SZ,
+ REG_VALUE_TYPE.REG_SZ,
txtData,
txtData.length * 2 + 2,
);