mirror of
https://github.com/immich-app/immich
synced 2025-11-07 17:27:20 +00:00
refactor(mobile): Use switch expression when possible (#15852)
refactor: Use `switch` expression when possible Co-authored-by: Alex <alex.tran1502@gmail.com>
This commit is contained in:
parent
4efacfbb91
commit
96a6cc20b7
17 changed files with 219 additions and 374 deletions
|
|
@ -136,23 +136,16 @@ class PermissionOnboardingPage extends HookConsumerWidget {
|
|||
);
|
||||
}
|
||||
|
||||
final Widget child;
|
||||
switch (permission) {
|
||||
case PermissionStatus.limited:
|
||||
child = buildPermissionLimited();
|
||||
break;
|
||||
case PermissionStatus.denied:
|
||||
child = buildRequestPermission();
|
||||
break;
|
||||
case PermissionStatus.granted:
|
||||
case PermissionStatus.provisional:
|
||||
child = buildPermissionGranted();
|
||||
break;
|
||||
case PermissionStatus.restricted:
|
||||
case PermissionStatus.permanentlyDenied:
|
||||
child = buildPermissionDenied();
|
||||
break;
|
||||
}
|
||||
final Widget child = switch (permission) {
|
||||
PermissionStatus.limited => buildPermissionLimited(),
|
||||
PermissionStatus.denied => buildRequestPermission(),
|
||||
PermissionStatus.granted ||
|
||||
PermissionStatus.provisional =>
|
||||
buildPermissionGranted(),
|
||||
PermissionStatus.restricted ||
|
||||
PermissionStatus.permanentlyDenied =>
|
||||
buildPermissionDenied()
|
||||
};
|
||||
|
||||
return Scaffold(
|
||||
body: SafeArea(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue