I have also experienced the same thing but I have been able to resolve it with the snippet below
```
class _CameraDemoState extends State<CameraDemo> {
late CameraController controller;
@override
void initState() {
super.initState();
controller = CameraController(cameras[0], ResolutionPreset.max);
controller.initialize().then((_) {
if (!mounted) {
return;
}
setState(() {});
});
}
@override
Widget build(BuildContext context) {
final mediaSize = MediaQuery.of(context).size;
return SafeArea(
child: Scaffold(
body: controller.value.isInitialized
? Transform.scale(
alignment: Alignment.topCenter,
scale: 1 /
(controller.value.aspectRatio *
mediaSize.width /
mediaSize.height),
child: CameraPreview(controller),
)
: const Center(child: CircularProgressIndicator()),
),
);
}
}
```
Your screen resolution doesn't necessarily match you camera resolution, you should use camera's resolution and aspect ratio to get proper image.
Take a look at the [aspectRatio](https://pub.dev/documentation/camera/latest/camera/CameraValue/aspectRatio.html) property that you can get from `CameraValue` after initialization.
---
**UPDATE:**
Actually, you don't even need `aspectRatio`. You can just use the `DevicePreview` directly. If the parent widget is fullscreen, the preview will be fullscreen as well. E.g. the official example in [camera](https://pub.dev/packages/camera) package is rendered like that:
[![enter image description here][1]][1]
Example code:
```dart
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:camera/camera.dart';
List<CameraDescription> cameras;
Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();
cameras = await availableCameras();
runApp(CameraApp());
}
class CameraApp extends StatefulWidget {
@override
_CameraAppState createState() => _CameraAppState();
}
class _CameraAppState extends State<CameraApp> {
CameraController controller;
@override
void initState() {
super.initState();
controller = CameraController(cameras[0], ResolutionPreset.max);
controller.initialize().then((_) {
if (!mounted) {
return;
}
setState(() {});
});
}
@override
void dispose() {
controller?.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
if (!controller.value.isInitialized) {
return Container();
}
return MaterialApp(
home: CameraPreview(controller),
);
}
}
````
[1]: https://i.sstatic.net/VxrSr.jpg