FreekakeApp/lib/components/navbar_container.dart
2025-05-07 13:56:17 +07:00

113 lines
2.7 KiB
Dart

import 'package:flutter/material.dart';
class NavbarContainer extends StatelessWidget {
const NavbarContainer({super.key});
@override
Widget build(BuildContext context) {
var screen = MediaQuery.of(context).size;
return Positioned(
child: Container(
width: screen.width,
height: screen.height,
color: const Color.fromARGB(255, 38, 139, 92),
child: CustomPaint(child: CustomPaint(painter: MyShape())),
),
);
}
}
class MyShape extends CustomPainter {
@override
void paint(Canvas canvas, Size size) {
// TODO: implement paint
Paint paint =
Paint()
..color = const Color.fromARGB(255, 166, 12, 66)
..style = PaintingStyle.fill;
Path path = Path();
path.moveTo(20, size.height / 2); // Start at bottom-left
// shape curve kiri
path.quadraticBezierTo(
size.width * 0.04,
size.height * 0.7, // Control point
size.width * 0.09, // almost half
size.height * 0.8, // End point
);
path.lineTo(size.width * 0.92, size.height - 20);
// Curve kanan bawah
path.quadraticBezierTo(
size.width * 0.96,
size.height * 0.7, // Control point
size.width * 0.964,
size.height / 2, // End point (bottom-right)
);
// curve ujung kanan atas
path.quadraticBezierTo(
size.width * 0.95,
size.height * 0.28, // Control point
size.width * 0.91,
size.height * 0.23, // End point (bottom-right)
);
path.lineTo(size.width / 2 + 80, size.height * 0.23);
// ==========
// sebelum curve tengah
path.quadraticBezierTo(
size.width / 2 + 30,
18,
size.width / 2 + 10,
5, // End point (bottom-right)
);
// ==========================================
//==========================================
// curve tengah sebelah kanan
path.quadraticBezierTo(
size.width / 2 - 20,
13,
size.width / 2 + 2,
size.height * 0.030,
);
// sebelah kiri curve
path.quadraticBezierTo(
(size.width / 2) * 0.92,
size.height * 0.189,
size.width / 2 - 40,
18,
);
// ===============================================
// setelah curve tengah
path.quadraticBezierTo(
size.width / 2 - 30,
size.height * 0.188, // Control point
size.width / 2 - 80,
20, // End point (bottom-right)
);
path.lineTo(size.width * 0.1, 20);
path.quadraticBezierTo(
24,
size.height * 0.2, // Control point
20,
size.height / 2, // End point (bottom-right)
);
path.close();
canvas.drawPath(path, paint);
}
@override
bool shouldRepaint(covariant CustomPainter oldDelegate) {
// TODO: implement shouldRepaint
throw false;
}
}