Update launch config and use a custom painter
Signed-off-by: Hans Kokx <hans.d.kokx@gmail.com>
This commit is contained in:
Vendored
+24
-4
@@ -1,18 +1,38 @@
|
||||
{
|
||||
// Use IntelliSense to learn about possible attributes.
|
||||
// Hover to view descriptions of existing attributes.
|
||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "clang - Build and debug active file",
|
||||
"name": "Flutter",
|
||||
"request": "launch",
|
||||
"type": "dart"
|
||||
},
|
||||
{
|
||||
"name": "Flutter (profile mode)",
|
||||
"request": "launch",
|
||||
"type": "dart",
|
||||
"flutterMode": "profile"
|
||||
},
|
||||
{
|
||||
"name": "Flutter (release mode)",
|
||||
"request": "launch",
|
||||
"type": "dart",
|
||||
"flutterMode": "release"
|
||||
},
|
||||
{
|
||||
"name": "Raycaster (C)",
|
||||
"type": "cppdbg",
|
||||
"request": "launch",
|
||||
"program": "${fileDirname}/${fileBasenameNoExtension}",
|
||||
"program": "${workspaceFolder}/raycaster",
|
||||
"args": [],
|
||||
"stopAtEntry": false,
|
||||
"cwd": "${fileDirname}",
|
||||
"cwd": "${workspaceFolder}",
|
||||
"environment": [],
|
||||
"externalConsole": false,
|
||||
"MIMode": "lldb",
|
||||
"preLaunchTask": "C/C++: clang build active file"
|
||||
"preLaunchTask": "Build raycaster"
|
||||
}
|
||||
]
|
||||
}
|
||||
Vendored
+24
@@ -1,6 +1,30 @@
|
||||
{
|
||||
"version": "2.0.0",
|
||||
"tasks": [
|
||||
{
|
||||
"type": "cppbuild",
|
||||
"label": "Build raycaster",
|
||||
"command": "/usr/bin/clang",
|
||||
"args": [
|
||||
"-g",
|
||||
"${workspaceFolder}/raycaster.c",
|
||||
"-o",
|
||||
"${workspaceFolder}/raycaster",
|
||||
"-framework",
|
||||
"OpenGL",
|
||||
"-framework",
|
||||
"GLUT",
|
||||
"-Wno-deprecated-declarations"
|
||||
],
|
||||
"options": {
|
||||
"cwd": "${workspaceFolder}"
|
||||
},
|
||||
"problemMatcher": [
|
||||
"$gcc"
|
||||
],
|
||||
"group": "build",
|
||||
"detail": "Builds raycaster.c explicitly"
|
||||
},
|
||||
{
|
||||
"type": "cppbuild",
|
||||
"label": "C/C++: clang build active file",
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
include: package:flutter_lints/flutter.yaml
|
||||
include: package:arcane_analysis/analysis_options.yaml
|
||||
|
||||
analyzer:
|
||||
exclude:
|
||||
|
||||
+53
-3
@@ -1,4 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import "package:flutter/material.dart";
|
||||
import "package:flutter/rendering.dart";
|
||||
|
||||
void main() {
|
||||
runApp(const MainApp());
|
||||
@@ -9,8 +10,57 @@ class MainApp extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return const MaterialApp(
|
||||
home: Scaffold(body: Center(child: Text('Hello World!'))),
|
||||
return LayoutBuilder(
|
||||
builder: (context, constraints) => CustomPaint(
|
||||
size: constraints.biggest,
|
||||
painter: Sky(),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class Sky extends CustomPainter {
|
||||
@override
|
||||
void paint(Canvas canvas, Size size) {
|
||||
final Rect rect = Offset.zero & size;
|
||||
const RadialGradient gradient = RadialGradient(
|
||||
center: Alignment(0.7, -0.6),
|
||||
radius: 0.2,
|
||||
colors: <Color>[Color(0xFFFFFF00), Color(0xFF0099FF)],
|
||||
stops: <double>[0.4, 1.0],
|
||||
);
|
||||
canvas.drawRect(rect, Paint()..shader = gradient.createShader(rect));
|
||||
}
|
||||
|
||||
@override
|
||||
SemanticsBuilderCallback get semanticsBuilder {
|
||||
return (Size size) {
|
||||
// Annotate a rectangle containing the picture of the sun
|
||||
// with the label "Sun". When text to speech feature is enabled on the
|
||||
// device, a user will be able to locate the sun on this picture by
|
||||
// touch.
|
||||
Rect rect = Offset.zero & size;
|
||||
final double width = size.shortestSide * 0.4;
|
||||
rect = const Alignment(0.8, -0.9).inscribe(Size(width, width), rect);
|
||||
return <CustomPainterSemantics>[
|
||||
CustomPainterSemantics(
|
||||
rect: rect,
|
||||
properties: const SemanticsProperties(
|
||||
label: "Sun",
|
||||
textDirection: TextDirection.ltr,
|
||||
),
|
||||
),
|
||||
];
|
||||
};
|
||||
}
|
||||
|
||||
// Since this Sky painter has no fields, it always paints
|
||||
// the same thing and semantics information is the same.
|
||||
// Therefore we return false here. If we had fields (set
|
||||
// from the constructor) then we would return true if any
|
||||
// of them differed from the same fields on the oldDelegate.
|
||||
@override
|
||||
bool shouldRepaint(Sky oldDelegate) => false;
|
||||
@override
|
||||
bool shouldRebuildSemantics(Sky oldDelegate) => false;
|
||||
}
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
name: raycaster
|
||||
description: "A new Flutter project."
|
||||
publish_to: 'none'
|
||||
publish_to: "none"
|
||||
version: 0.1.0+1
|
||||
|
||||
environment:
|
||||
@@ -11,9 +11,9 @@ dependencies:
|
||||
sdk: flutter
|
||||
|
||||
dev_dependencies:
|
||||
arcane_analysis: ^1.0.5
|
||||
flutter_test:
|
||||
sdk: flutter
|
||||
flutter_lints: ^6.0.0
|
||||
|
||||
flutter:
|
||||
uses-material-design: true
|
||||
|
||||
Reference in New Issue
Block a user