// ignore_for_file: library_private_types_in_public_api import 'dart:io'; import 'dart:typed_data'; import 'package:fikoyt_mesaici/core/fikoyt.service.dart'; import 'package:fikoyt_mesaici/core/widgets/fiko_ui/fiko_button/fiko_button.dart'; import 'package:fl_chart/fl_chart.dart'; import 'package:flutter/material.dart'; import 'package:flutter/scheduler.dart'; import 'package:get/get.dart'; import 'package:vrouter/vrouter.dart'; import '../../../../core/widgets/base_page/base_page_view.dart'; import '../../../../core/widgets/draggable_home.dart'; import '../../../../core/widgets/fikoyt_elastic/fikoyt_elastic.dart'; import '../../base_page_mesaici_view.dart'; import '../../widgets/kullanici_bilgi_navigasyon/kullanici_bilgi_navigasyon.dart'; import '../../widgets/uygulama_baslik/uygulama_baslik.dart'; class PageMesaiciRaporlarLogic extends GetxController { @override void onInit() async { super.onInit(); } } class PageMesaiciRaporlar extends StatefulWidget { const PageMesaiciRaporlar({super.key}); @override _PageMesaiciRaporlarState createState() => _PageMesaiciRaporlarState(); } class _PageMesaiciRaporlarState extends State { PageMesaiciRaporlarLogic logic = Get.put(PageMesaiciRaporlarLogic()); BasePageLogic basePageLogic = Get.put(BasePageLogic()); BasePageMesaiciLogic basePageMesaiciLogic = Get.put(BasePageMesaiciLogic()); //---> int touchedIndex = 0; @override Widget build(BuildContext context) { SchedulerBinding.instance.addPostFrameCallback((_) { basePageLogic.subTitle.value = "📝 Raporlar"; }); ScreenSizeTypes screenType = FikoYTElastic.getScreenSizeType(context); [ // ScreenSizeTypes.small, ScreenSizeTypes.mini, ScreenSizeTypes.extraMini ].contains(screenType); return DraggableHome( leading: const UygulamaBaslikSol(), title: UygulamaBaslikOrta(), actions: const [ UygulamaBaslikSag(), ], headerWidget: PageView( children: [ Container( color: Colors.transparent, //Colors.orange, height: 300 - kToolbarHeight - 10, margin: const EdgeInsets.only(top: kToolbarHeight, bottom: 10, right: 10, left: 10), child: KullaniciBilgiNavigasyon( simge: const Text( "📝", style: TextStyle( fontSize: 54, ), ), ), ), ], ), body: [ Padding( padding: const EdgeInsets.only(top: 30.0), child: Stack( children: [ Card( child: Container( height: 100.0, ), ), const FractionalTranslation( translation: Offset(0.0, -0.4), child: Align( alignment: FractionalOffset(0.5, 0.0), child: CircleAvatar( // backgroundColor: Colors.redAccent.shade200, radius: 25.0, child: Text( "📝", style: TextStyle(fontSize: 24), ), ), ), ), Padding( padding: const EdgeInsets.only(top: 48), child: Align( alignment: const FractionalOffset(0.5, 0.5), child: Text( "Herhangi Bir Çalışma Kaydınız Bulunamadı", style: TextStyle(fontSize: 16, fontWeight: FontWeight.w300, color: Colors.blueAccent.shade400), textAlign: TextAlign.center, ), ), ), ], ), ), /** */ Stack( alignment: Alignment.center, children: [ Container( color: Colors.transparent, //Colors.orange, height: 250, margin: const EdgeInsets.all(40), child: AspectRatio( aspectRatio: 1.4, child: PieChart( PieChartData( pieTouchData: PieTouchData( touchCallback: (FlTouchEvent event, pieTouchResponse) { setState(() { if (!event.isInterestedForInteractions || pieTouchResponse == null || pieTouchResponse.touchedSection == null) { touchedIndex = -1; return; } touchedIndex = pieTouchResponse.touchedSection!.touchedSectionIndex; }); }, ), borderData: FlBorderData( show: true, ), startDegreeOffset: 0, titleSunbeamLayout: false, sectionsSpace: 2, centerSpaceRadius: 100, sections: showingSections(), ), ), ), ), ], ), Wrap( spacing: 5, alignment: WrapAlignment.center, crossAxisAlignment: WrapCrossAlignment.center, children: [ Row( spacing: 4, mainAxisSize: MainAxisSize.min, children: [ Container( width: 14, height: 14, color: Colors.red, ), const Text("Ç.Süresi:"), const Text("272 saat"), ], ), Row( spacing: 4, mainAxisSize: MainAxisSize.min, children: [ Container( width: 14, height: 14, color: Colors.red, ), const Text("Ç.Günü Mesaileri:"), const Text("27 saat"), ], ), Row( spacing: 4, mainAxisSize: MainAxisSize.min, children: [ Container( width: 14, height: 14, color: Colors.red, ), const Text("D.Günü Mesaileri:"), const Text("15 saat"), ], ), Row( spacing: 4, mainAxisSize: MainAxisSize.min, children: [ Container( width: 14, height: 14, color: Colors.red, ), const Text("H.Tatili Mesaileri:"), const Text("7 saat"), ], ), ], ), ], headerExpandedHeight: 315, // stretchMaxHeight: 100, fullyStretchable: false, backgroundColor: Colors.grey.shade200, bodyColor: Colors.white, centerTitle: true, alwaysShowLeadingAndAction: true, appBarColor: Colors.blue.shade500, alwaysShowTitle: true, curvedBodyRadius: 0, onStretchTrigger: () async { context.vRouter.to("/"); }, ); } @override void dispose() { Get.delete(); super.dispose(); } List showingSections() { return List.generate(4, (i) { final isTouched = i == touchedIndex; final fontSize = isTouched ? 16.0 : 12.0; final radius = isTouched ? 45.0 : 35.0; final widgetSize = isTouched ? 45.0 : 30.0; const shadows = [Shadow(color: Colors.black, blurRadius: 2)]; switch (i) { case 0: return PieChartSectionData( gradient: LinearGradient( colors: [ Colors.lightBlue.shade50, Colors.lightBlueAccent, ], transform: GradientRotation(0.5), ), value: 40, title: '40%', radius: radius, titleStyle: TextStyle( fontSize: fontSize, fontWeight: FontWeight.bold, color: const Color(0xffffffff), shadows: shadows, ), badgePositionPercentageOffset: .98, ); case 1: return PieChartSectionData( gradient: LinearGradient( colors: [ Colors.amber.shade50, Colors.amber, ], ), value: 30, title: '30%', radius: radius, titleStyle: TextStyle( fontSize: fontSize, fontWeight: FontWeight.bold, color: const Color(0xffffffff), shadows: shadows, ), badgePositionPercentageOffset: .98, ); case 2: return PieChartSectionData( gradient: LinearGradient( colors: [ Colors.purple.shade50, Colors.purple, ], ), value: 16, title: '16%', radius: radius, titleStyle: TextStyle( fontSize: fontSize, fontWeight: FontWeight.bold, color: const Color(0xffffffff), shadows: shadows, ), // badgeWidget: _Badge( // 'assets/icons/fitness-svgrepo-com.svg', // size: widgetSize, // borderColor: Colors.black54, // ), badgePositionPercentageOffset: .98, ); case 3: return PieChartSectionData( gradient: const LinearGradient( colors: [ Colors.green, Colors.greenAccent, ], ), value: 15, title: '15%', radius: radius, titleStyle: TextStyle( fontSize: fontSize, fontWeight: FontWeight.bold, color: const Color(0xffffffff), shadows: shadows, ), badgePositionPercentageOffset: .98, ); default: throw Exception('Oh no'); } }); } } class _Badge extends StatelessWidget { const _Badge( this.svgAsset, { required this.size, required this.borderColor, }); final String svgAsset; final double size; final Color borderColor; @override Widget build(BuildContext context) { return AnimatedContainer( duration: PieChart.defaultDuration, width: size, height: size, decoration: BoxDecoration( color: Colors.white, shape: BoxShape.circle, border: Border.all( color: borderColor, width: 2, ), boxShadow: [ BoxShadow( color: Colors.black.withOpacity(.5), offset: const Offset(3, 3), blurRadius: 3, ), ], ), padding: EdgeInsets.all(size * .15), child: const Center( child: Text("👨🏻‍💼"), ), ); } } /** * */