marco.pms.mobileapp/lib/helpers/widgets/my_tab_indicator_painter.dart
Vaibhav Surve a5dd5e19fc Add Windows runner implementation for Flutter application
- Created CMakeLists.txt for Flutter and runner components.
- Implemented resource script (Runner.rc) for application metadata.
- Developed main entry point (main.cpp) for the Windows application.
- Added FlutterWindow class to manage the Flutter view within a Win32 window.
- Implemented utility functions for console management and command line argument parsing.
- Established Win32Window class for high DPI-aware window handling.
- Included application icon and manifest for proper Windows integration.
- Set up build configurations and dependencies for the Flutter application on Windows.
2025-04-23 09:55:31 +05:30

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;
}