-
Notifications
You must be signed in to change notification settings - Fork 29.8k
Closed
flutter/engine
#53320Labels
P1High-priority issues at the top of the work listHigh-priority issues at the top of the work liste: impellerImpeller rendering backend issues and features requestsImpeller rendering backend issues and features requestsengineflutter/engine related. See also e: labels.flutter/engine related. See also e: labels.found in release: 3.23Found to occur in 3.23Found to occur in 3.23has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onr: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer versionteam-engineOwned by Engine teamOwned by Engine teamtriaged-engineTriaged by Engine teamTriaged by Engine team
Description
Steps to reproduce
Error occurs on real device when taking screenshot
Expected results
This is the result on ios simulator:
Actual results
This is the result on a real machine:
Code sample
Code sample
import 'dart:io';
import 'dart:typed_data';
import 'dart:ui';
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:path_provider/path_provider.dart';
void main() {
WidgetsFlutterBinding.ensureInitialized();
runApp(const MyApp());
}
class MyApp extends StatefulWidget {
const MyApp({super.key});
@override
_MyAppState createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> with SingleTickerProviderStateMixin {
final boundaryKey = GlobalKey();
String? backgroundPath;
@override
void initState() {
super.initState();
}
@override
void dispose() {
super.dispose();
}
Future<void> saveBackground() async {
backgroundPath = null;
setState(() {
});
Directory tempDic;
if (Platform.isIOS) {
tempDic = await getApplicationSupportDirectory();
} else {
tempDic = await getTemporaryDirectory();
}
final path = '${tempDic.path}/background.png';
var file = File(path);
bool exist = await file.exists();
if (exist) {
await file.delete();
}
final boundary = boundaryKey.currentContext?.findRenderObject();
if (boundary != null && boundary is RenderRepaintBoundary) {
final image = await boundary.toImage(pixelRatio: 2);
ByteData? byteData = await image.toByteData(format: ImageByteFormat.png);
if (byteData != null) {
Uint8List imageData = byteData.buffer.asUint8List();
await File(path).writeAsBytes(imageData);
print("path : $path");
backgroundPath = path;
setState(() {});
}
}
}
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Stack(
children: [
RepaintBoundary(
key: boundaryKey,
child: ImageFiltered(
imageFilter: ImageFilter.blur(
// sigmaX: 66,
// sigmaY: 66,
sigmaX: 500,
sigmaY: 500,
// sigmaX: 0,
// sigmaY: 0,
),
child: SizedBox(
width: MediaQuery.of(context).size.width,
height: MediaQuery.of(context).size.height,
child: Stack(
alignment: Alignment.center,
children: [
Stack(
children: [
Container(),
Positioned(
top: MediaQuery.of(context).padding.top,
left: 0,
child: Container(
width: MediaQuery.of(context).size.width * .5,
height: MediaQuery.of(context).size.width * .5,
decoration: BoxDecoration(
color: const Color(0xFFfcce95).withOpacity(1),
shape: BoxShape.circle,
),
),
),
Positioned(
top: MediaQuery.of(context).size.height * .3,
left: -(MediaQuery.of(context).size.height * .6 * .7),
child: Container(
width: MediaQuery.of(context).size.height * .6,
height: MediaQuery.of(context).size.height * .6,
decoration: BoxDecoration(
color: const Color(0xFFfcce95).withOpacity(1),
shape: BoxShape.circle,
),
),
),
Positioned(
top: MediaQuery.of(context).size.height * .2,
right: -(MediaQuery.of(context).size.height * .6 * .7),
child: Container(
width: MediaQuery.of(context).size.height * .6,
height: MediaQuery.of(context).size.height * .6,
decoration: BoxDecoration(
color: const Color(0xFF80d9ff).withOpacity(1),
shape: BoxShape.circle,
),
),
)
],
),
],
),
),
),
),
Positioned(
bottom: 100,
right: 50,
child: ElevatedButton(
onPressed: () {
saveBackground();
},
child: const Text("screenshot"),
),
),
if(backgroundPath != null)
Positioned(
bottom: 200,
right: 100,
child: Material(
color: Colors.transparent,
child: Column(
children: [
Text("screenshot result"),
SizedBox(
width: 200,
child: AspectRatio(
aspectRatio: MediaQuery.of(context).size.width/MediaQuery.of(context).size.width,
child: Container(
decoration: BoxDecoration(
image: DecorationImage(
image: FileImage(File(backgroundPath!)),
)
),
),
),
),
],
),
)
)
],
),
);
}
}
Screenshots or Video
Screenshots / Video demonstration
[Upload media here]
Logs
Logs
[Paste your logs here]Flutter Doctor output
Doctor output
Flutter (Channel master, 3.23.0-13.0.pre.165, on macOS 14.4 23E214 darwin-arm64, locale zh-Hans-CN)
• Flutter version 3.23.0-13.0.pre.165 on channel master at /Users/vincent/development/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 034c0d03f8 (2 hours ago), 2024-06-07 16:51:47 -0700
• Engine revision 1cdbebee19
• Dart version 3.5.0 (build 3.5.0-236.0.dev)
• DevTools version 2.36.0
Metadata
Metadata
Assignees
Labels
P1High-priority issues at the top of the work listHigh-priority issues at the top of the work liste: impellerImpeller rendering backend issues and features requestsImpeller rendering backend issues and features requestsengineflutter/engine related. See also e: labels.flutter/engine related. See also e: labels.found in release: 3.23Found to occur in 3.23Found to occur in 3.23has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onr: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer versionteam-engineOwned by Engine teamOwned by Engine teamtriaged-engineTriaged by Engine teamTriaged by Engine team