Files
Yuriy Panov 2f97873095 Fix import paths and test issues
- Fixed test file import paths to point to correct Bloc file locations
- Fixed Bloc file import paths for models (../../../models/models.dart)
- Added explicit type annotations to resolve null safety warnings
- Fixed null safety issues in wishlist_bloc_test.dart
- All 70 tests now passing
2026-02-04 15:28:59 +06:00

270 lines
10 KiB
Dart
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import '../../bloc/app_bloc.dart';
import '../../bloc/app_event.dart';
import '../../../models/models.dart';
class ScannerScreen extends StatelessWidget {
const ScannerScreen({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.black,
body: Stack(
children: [
// Camera placeholder
Container(
color: Colors.black87,
width: double.infinity,
height: double.infinity,
),
// Header
Positioned(
top: 48,
left: 0,
right: 0,
child: Container(
padding: const EdgeInsets.symmetric(horizontal: 16),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
IconButton(
onPressed: () {
context
.read<AppBloc>()
.add(const ScreenChanged(AppScreen.addBook));
},
icon: Container(
padding: const EdgeInsets.all(12),
decoration: BoxDecoration(
color: Colors.black.withValues(alpha: 0.4),
shape: BoxShape.circle,
),
child: const Icon(Icons.close, color: Colors.white, size: 24),
),
),
Container(
padding: const EdgeInsets.symmetric(
horizontal: 16,
vertical: 6,
),
decoration: BoxDecoration(
color: Colors.black.withValues(alpha: 0.4),
borderRadius: BorderRadius.circular(20),
border: Border.all(
color: Colors.white.withValues(alpha: 0.1),
),
),
child: const Text(
'СКАНЕР',
style: TextStyle(
color: Colors.white,
fontSize: 12,
fontWeight: FontWeight.w500,
letterSpacing: 1,
),
),
),
const SizedBox(width: 40),
],
),
),
),
// Scanner frame
Center(
child: Container(
width: MediaQuery.of(context).size.width * 0.75,
height: MediaQuery.of(context).size.width * 0.75 * 1.5,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(16),
border: Border.all(
color: Colors.white.withValues(alpha: 0.2),
width: 2,
),
),
child: Stack(
children: [
// Corner accents - top left
Positioned(
top: -2,
left: -2,
child: ClipRRect(
borderRadius: const BorderRadius.only(
topLeft: Radius.circular(8),
),
child: Container(
width: 32,
height: 32,
decoration: BoxDecoration(
border: Border(
left: const BorderSide(color: Color(0xFF17CF54), width: 4),
top: const BorderSide(color: Color(0xFF17CF54), width: 4),
right: const BorderSide(color: Colors.transparent, width: 4),
bottom: const BorderSide(color: Colors.transparent, width: 4),
),
),
),
),
),
// Corner accents - top right
Positioned(
top: -2,
right: -2,
child: ClipRRect(
borderRadius: const BorderRadius.only(
topRight: Radius.circular(8),
),
child: Container(
width: 32,
height: 32,
decoration: BoxDecoration(
border: Border(
right: const BorderSide(color: Color(0xFF17CF54), width: 4),
top: const BorderSide(color: Color(0xFF17CF54), width: 4),
left: const BorderSide(color: Colors.transparent, width: 4),
bottom: const BorderSide(color: Colors.transparent, width: 4),
),
),
),
),
),
// Corner accents - bottom left
Positioned(
bottom: -2,
left: -2,
child: ClipRRect(
borderRadius: const BorderRadius.only(
bottomLeft: Radius.circular(8),
),
child: Container(
width: 32,
height: 32,
decoration: BoxDecoration(
border: Border(
left: const BorderSide(color: Color(0xFF17CF54), width: 4),
bottom: const BorderSide(color: Color(0xFF17CF54), width: 4),
right: const BorderSide(color: Colors.transparent, width: 4),
top: const BorderSide(color: Colors.transparent, width: 4),
),
),
),
),
),
// Corner accents - bottom right
Positioned(
bottom: -2,
right: -2,
child: ClipRRect(
borderRadius: const BorderRadius.only(
bottomRight: Radius.circular(8),
),
child: Container(
width: 32,
height: 32,
decoration: BoxDecoration(
border: Border(
right: const BorderSide(color: Color(0xFF17CF54), width: 4),
bottom: const BorderSide(color: Color(0xFF17CF54), width: 4),
left: const BorderSide(color: Colors.transparent, width: 4),
top: const BorderSide(color: Colors.transparent, width: 4),
),
),
),
),
),
// Scan line animation
Center(
child: Container(
height: 2,
width: double.infinity,
margin: const EdgeInsets.symmetric(horizontal: 16),
decoration: BoxDecoration(
color: const Color(0xFF17CF54),
boxShadow: [
BoxShadow(
color: const Color(0xFF17CF54).withValues(alpha: 0.8),
blurRadius: 15,
spreadRadius: 2,
),
],
),
),
),
],
),
),
),
// Instructions
Positioned(
bottom: 120,
left: 0,
right: 0,
child: Column(
children: [
const Text(
'Поместите обложку в рамку',
style: TextStyle(
color: Colors.white,
fontSize: 16,
fontWeight: FontWeight.w500,
),
),
const SizedBox(height: 16),
const Text(
'Камера будет добавлена в будущих обновлениях',
style: TextStyle(
color: Color(0xFF17CF54),
fontSize: 14,
fontWeight: FontWeight.w500,
),
textAlign: TextAlign.center,
),
],
),
),
// Capture button
Positioned(
bottom: 40,
left: 0,
right: 0,
child: Center(
child: GestureDetector(
onTap: () {
// Simulate detection
context.read<AppBloc>().add(
BookDetected({
'title': 'Новая книга',
'author': 'Неизвестный автор',
'genre': 'Неизвестный жанр',
'annotation': 'Добавьте описание книги',
}),
);
},
child: Container(
width: 80,
height: 80,
decoration: BoxDecoration(
color: Colors.white,
shape: BoxShape.circle,
border: Border.all(
color: Colors.white.withValues(alpha: 0.3),
width: 4,
),
boxShadow: [
BoxShadow(
color: Colors.white.withValues(alpha: 0.3),
blurRadius: 20,
spreadRadius: 2,
),
],
),
),
),
),
),
],
),
);
}
}