First Commit

This commit is contained in:
2025-11-18 14:18:26 -07:00
parent 33eb6e3707
commit 27277ec342
6106 changed files with 3571167 additions and 0 deletions

View File

@@ -0,0 +1,45 @@
/*
This file is part of KDDockWidgets.
SPDX-FileCopyrightText: 2023 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
Author: Sérgio Martins <sergio.martins@kdab.com>
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
Contact KDAB at <info@kdab.com> for commercial licensing options.
*/
import 'dart:io';
import 'package:flutter/material.dart';
// ignore: must_be_immutable
class MyWidget extends StatelessWidget {
static int nextImageId = 0;
final int imageId;
MyWidget({super.key}) : imageId = nextImageId {
MyWidget.nextImageId++;
}
String imageName() {
switch (imageId % 2) {
case 0:
return 'assets/KDAB_bubble_fulcolor.png';
case 1:
return 'assets/KDAB_bubble_blue.png';
}
return 'assets/KDAB_bubble_fulcolor.png';
}
@override
Widget build(BuildContext context) {
return Container(
color: Colors.white,
padding: const EdgeInsets.all(40.0),
child: Image.file(
File(imageName()),
fit: BoxFit.contain,
),
);
}
}

View File

@@ -0,0 +1,40 @@
/*
This file is part of KDDockWidgets.
SPDX-FileCopyrightText: 2024 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
Author: Sérgio Martins <sergio.martins@kdab.com>
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
Contact KDAB at <info@kdab.com> for commercial licensing options.
*/
import 'dart:io';
import 'dart:ui';
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter_test/flutter_test.dart';
Map<String, int> _s_count = {};
String _screenshotDirectory() {
return '${Directory(Platform.script.toFilePath()).parent.path}/../reference-images/images/flutter';
}
Future<void> saveScreenShot(WidgetTester tester,
{required String prefix}) async {
final renderObject = tester.firstRenderObject(find.byType(RepaintBoundary));
final image =
await (renderObject as RenderRepaintBoundary).toImage(pixelRatio: 2);
final byteDataFuture = image.toByteData(format: ImageByteFormat.png);
final byteData = await byteDataFuture;
final buffer = byteData!.buffer.asUint8List();
_s_count[prefix] = (_s_count[prefix] ?? 0) + 1;
final file =
File('${_screenshotDirectory()}/${prefix}_${_s_count[prefix]}.png');
file.writeAsBytesSync(buffer);
}