import 'package:flutter/material.dart'; import 'package:flutter_ruler_picker/flutter_ruler_picker.dart' as r; import 'package:get/get.dart'; import 'package:trackoffical_app/screen.dart'; typedef ValueChangedCallback = void Function(int value); class RulerPicker extends StatelessWidget { final ValueChangedCallback onValueChange; final int beginValue; final int endValue; final int initValue; final String Function(int index, int rulerScaleValue)? onBuildRulerScaleText; const RulerPicker({ super.key, required this.beginValue, required this.endValue, required this.onValueChange, this.onBuildRulerScaleText, this.initValue = 0, }); @override Widget build(BuildContext context) { final scaleBackgroundColor = context.theme.colorScheme.primary.withAlpha(10); final barsColor = scaleBackgroundColor.withAlpha(200); final scaleLineColor = context.theme.colorScheme.primary; return r.RulerPicker( beginValue: beginValue, endValue: endValue, initValue: initValue, onValueChange: onValueChange, onBuildRulerScalueText: onBuildRulerScaleText, scaleLineStyleList: [ r.ScaleLineStyle( color: scaleLineColor, width: 1.5, height: 30, scale: 0), r.ScaleLineStyle( color: scaleLineColor, width: 1, height: 25, scale: 5), r.ScaleLineStyle( color: scaleLineColor, width: 1, height: 15, scale: -1) ], rulerBackgroundColor: scaleBackgroundColor, width: MediaQuery.of(context).size.width, height: 15.0.wp, rulerMarginTop: 2, marker: Container( width: 8, height: 38, decoration: BoxDecoration( color: barsColor, borderRadius: BorderRadius.circular(5))), ); } }