flutter_uvc_camera 1.0.0
flutter_uvc_camera: ^1.0.0 copied to clipboard
Flutter plugin, allowing apps in the Flutter project to use UVC cameras connected to the device.
import 'package:flutter/material.dart';
import 'camera.dart';
import 'features_demo.dart';
import 'streams_demo.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
title: 'UVC Camera Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
useMaterial3: true,
colorScheme: ColorScheme.fromSeed(seedColor: Colors.blue),
appBarTheme: const AppBarTheme(
centerTitle: true,
elevation: 0,
),
),
home: const HomeScreen(),
);
}
}
class HomeScreen extends StatelessWidget {
const HomeScreen({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('UVC Camera Demo'),
backgroundColor: Theme.of(context).colorScheme.primaryContainer,
),
body: SingleChildScrollView(
padding: const EdgeInsets.all(24.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
const Icon(Icons.camera_alt, size: 80, color: Colors.blue),
const SizedBox(height: 24),
const Text(
'UVC Camera Test Application',
style: TextStyle(fontSize: 24, fontWeight: FontWeight.bold),
),
const SizedBox(height: 12),
const Text(
'Control and test UVC camera devices',
style: TextStyle(fontSize: 16, color: Colors.grey),
textAlign: TextAlign.center,
),
const SizedBox(height: 40),
_buildFeatureCard(
context,
title: 'Basic Camera Test',
description:
'Test basic camera operations like preview, taking photos and recording videos',
icon: Icons.camera,
color: Colors.blue,
onTap: () {
Navigator.push(
context,
MaterialPageRoute(builder: (context) => const CameraTest()),
);
},
),
const SizedBox(height: 20),
_buildFeatureCard(
context,
title: 'Camera Features Control',
description:
'Adjust camera settings like brightness, zoom, focus, white balance, etc.',
icon: Icons.settings_suggest,
color: Colors.green,
onTap: () {
Navigator.push(
context,
MaterialPageRoute(builder: (context) => const FeaturesDemo()),
);
},
),
const SizedBox(height: 20),
_buildFeatureCard(
context,
title: 'Video Streaming',
description:
'Test advanced streaming features and frame processing',
icon: Icons.stream,
color: Colors.orange,
onTap: () {
Navigator.push(
context,
MaterialPageRoute(builder: (context) => const StreamsDemo()),
);
},
),
const SizedBox(height: 40),
const Text(
'Important: Make sure your UVC camera is connected before testing',
style: TextStyle(
fontSize: 14,
fontStyle: FontStyle.italic,
color: Colors.red,
),
textAlign: TextAlign.center,
),
],
),
),
);
}
Widget _buildFeatureCard(
BuildContext context, {
required String title,
required String description,
required IconData icon,
required Color color,
required VoidCallback onTap,
}) {
return Card(
elevation: 4,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(16),
),
child: InkWell(
onTap: onTap,
borderRadius: BorderRadius.circular(16),
child: Padding(
padding: const EdgeInsets.all(20.0),
child: Row(
children: [
CircleAvatar(
radius: 30,
backgroundColor: color.withOpacity(0.2),
child: Icon(icon, color: color, size: 32),
),
const SizedBox(width: 20),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
title,
style: const TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold,
),
),
const SizedBox(height: 8),
Text(
description,
style: TextStyle(
fontSize: 14,
color: Colors.grey.shade700,
),
),
],
),
),
const Icon(Icons.arrow_forward_ios, size: 16),
],
),
),
),
);
}
}