- Created generated_plugin_registrant.cc and generated_plugin_registrant.h to manage plugin registration. - Added generated_plugins.cmake for plugin configuration in CMake. - Implemented CMakeLists.txt for the Windows runner, defining build settings and dependencies. - Created Runner.rc for application resources including versioning and icons. - Developed flutter_window.cpp and flutter_window.h to manage the Flutter window lifecycle. - Implemented main.cpp as the entry point for the Windows application. - Added resource.h for resource definitions. - Included app icon in resources. - Created runner.exe.manifest for application settings. - Developed utils.cpp and utils.h for console management and command line argument handling. - Implemented win32_window.cpp and win32_window.h for high DPI-aware window management.
59 lines
1.7 KiB
Dart
59 lines
1.7 KiB
Dart
import 'dart:math';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
class MyTabIndicationPainter extends CustomPainter {
|
|
late Paint painter;
|
|
late double dxTarget;
|
|
late double dxEntry;
|
|
late double radius;
|
|
late double dy;
|
|
final double indicatorWidth, xPadding, indicatorRadius, yPadding;
|
|
|
|
final PageController? pageController;
|
|
final Color? selectedBackground;
|
|
|
|
MyTabIndicationPainter(
|
|
{required this.indicatorWidth,
|
|
required this.xPadding,
|
|
required this.indicatorRadius,
|
|
required this.yPadding,
|
|
this.pageController,
|
|
this.selectedBackground})
|
|
: super(repaint: pageController) {
|
|
dxTarget = indicatorWidth;
|
|
dxEntry = xPadding;
|
|
radius = indicatorRadius;
|
|
dy = yPadding;
|
|
painter = Paint()
|
|
..color = selectedBackground!
|
|
..style = PaintingStyle.fill;
|
|
}
|
|
|
|
@override
|
|
void paint(Canvas canvas, Size size) {
|
|
final pos = pageController!.position;
|
|
double fullExtent =
|
|
(pos.maxScrollExtent - pos.minScrollExtent + pos.viewportDimension);
|
|
|
|
double pageOffset = pos.extentBefore / fullExtent;
|
|
|
|
bool left2right = dxEntry < dxTarget;
|
|
Offset entry = Offset(left2right ? dxEntry : dxTarget, dy);
|
|
Offset target = Offset(left2right ? dxTarget : dxEntry, dy);
|
|
|
|
Path path = Path();
|
|
path.addArc(
|
|
Rect.fromCircle(center: entry, radius: radius), 0.5 * pi, 1 * pi);
|
|
path.addRect(Rect.fromLTRB(entry.dx, dy - radius, target.dx, dy + radius));
|
|
path.addArc(
|
|
Rect.fromCircle(center: target, radius: radius), 1.5 * pi, 1 * pi);
|
|
|
|
canvas.translate(size.width * pageOffset, 0.0);
|
|
canvas.drawPath(path, painter);
|
|
}
|
|
|
|
@override
|
|
bool shouldRepaint(MyTabIndicationPainter oldDelegate) => true;
|
|
}
|