mirror of
https://github.com/flutter/holobooth.git
synced 2025-05-17 13:25:59 +08:00

<!-- Thanks for contributing! Provide a description of your changes below and a general summary in the title Please look at the following checklist to ensure that your PR can be accepted quickly: --> ## Description Changes: - Bump min dart SDK to 2.19.0 - Bump Flutter version to 3.7.12 - Used Very Good Analysis 4.0.0 - Corrected new analyzer issues - Dart format ## Type of Change <!--- Put an `x` in all the boxes that apply: --> - [ ] ✨ New feature (non-breaking change which adds functionality) - [ ] 🛠️ Bug fix (non-breaking change which fixes an issue) - [ ] ❌ Breaking change (fix or feature that would cause existing functionality to change) - [ ] 🧹 Code refactor - [ ] ✅ Build configuration change - [ ] 📝 Documentation - [X] 🗑️ Chore
78 lines
1.9 KiB
Dart
78 lines
1.9 KiB
Dart
import 'package:camera/camera.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:holobooth/l10n/l10n.dart';
|
|
import 'package:holobooth_ui/holobooth_ui.dart';
|
|
|
|
class CameraErrorView extends StatelessWidget {
|
|
const CameraErrorView({required this.error, super.key});
|
|
|
|
final CameraException error;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
switch (error.code) {
|
|
case 'CameraAccessDenied':
|
|
return const CameraAccessDeniedErrorView();
|
|
default:
|
|
return const CameraNotFoundErrorView();
|
|
}
|
|
}
|
|
}
|
|
|
|
class CameraNotFoundErrorView extends StatelessWidget {
|
|
const CameraNotFoundErrorView({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final l10n = context.l10n;
|
|
|
|
return _CameraErrorViewContent(errorMessage: l10n.cameraNotFoundMessage);
|
|
}
|
|
}
|
|
|
|
class CameraAccessDeniedErrorView extends StatelessWidget {
|
|
const CameraAccessDeniedErrorView({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final l10n = context.l10n;
|
|
|
|
return _CameraErrorViewContent(
|
|
errorMessage: l10n.cameraAccessDeniedMessage,
|
|
);
|
|
}
|
|
}
|
|
|
|
class _CameraErrorViewContent extends StatelessWidget {
|
|
const _CameraErrorViewContent({required this.errorMessage});
|
|
|
|
final String errorMessage;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return BlurryContainer(
|
|
color: HoloBoothColors.blurrySurface,
|
|
blur: 7.5,
|
|
borderRadius: BorderRadius.circular(38),
|
|
padding: const EdgeInsets.symmetric(horizontal: 32, vertical: 16),
|
|
child: Row(
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
const Icon(
|
|
Icons.videocam_off,
|
|
color: HoloBoothColors.white,
|
|
),
|
|
const SizedBox(width: 12),
|
|
Text(
|
|
errorMessage,
|
|
style: Theme.of(context)
|
|
.textTheme
|
|
.bodyLarge
|
|
?.copyWith(color: HoloBoothColors.white),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|