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",
|
"version": "0.2.0",
|
||||||
"configurations": [
|
"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",
|
"type": "cppdbg",
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
"program": "${fileDirname}/${fileBasenameNoExtension}",
|
"program": "${workspaceFolder}/raycaster",
|
||||||
"args": [],
|
"args": [],
|
||||||
"stopAtEntry": false,
|
"stopAtEntry": false,
|
||||||
"cwd": "${fileDirname}",
|
"cwd": "${workspaceFolder}",
|
||||||
"environment": [],
|
"environment": [],
|
||||||
"externalConsole": false,
|
"externalConsole": false,
|
||||||
"MIMode": "lldb",
|
"MIMode": "lldb",
|
||||||
"preLaunchTask": "C/C++: clang build active file"
|
"preLaunchTask": "Build raycaster"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
Vendored
+24
@@ -1,6 +1,30 @@
|
|||||||
{
|
{
|
||||||
"version": "2.0.0",
|
"version": "2.0.0",
|
||||||
"tasks": [
|
"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",
|
"type": "cppbuild",
|
||||||
"label": "C/C++: clang build active file",
|
"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:
|
analyzer:
|
||||||
exclude:
|
exclude:
|
||||||
|
|||||||
+53
-3
@@ -1,4 +1,5 @@
|
|||||||
import 'package:flutter/material.dart';
|
import "package:flutter/material.dart";
|
||||||
|
import "package:flutter/rendering.dart";
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
runApp(const MainApp());
|
runApp(const MainApp());
|
||||||
@@ -9,8 +10,57 @@ class MainApp extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return const MaterialApp(
|
return LayoutBuilder(
|
||||||
home: Scaffold(body: Center(child: Text('Hello World!'))),
|
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
|
name: raycaster
|
||||||
description: "A new Flutter project."
|
description: "A new Flutter project."
|
||||||
publish_to: 'none'
|
publish_to: "none"
|
||||||
version: 0.1.0+1
|
version: 0.1.0+1
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
@@ -11,9 +11,9 @@ dependencies:
|
|||||||
sdk: flutter
|
sdk: flutter
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
|
arcane_analysis: ^1.0.5
|
||||||
flutter_test:
|
flutter_test:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
flutter_lints: ^6.0.0
|
|
||||||
|
|
||||||
flutter:
|
flutter:
|
||||||
uses-material-design: true
|
uses-material-design: true
|
||||||
|
|||||||
Reference in New Issue
Block a user