Трепетать радиальные перезагрузки после максимального значения вместо зажима или реверса ⇐ Android
-
Anonymous
Трепетать радиальные перезагрузки после максимального значения вместо зажима или реверса
Я использую виджет Sfradialgauge в Flutter, чтобы пользователи могли выбрать сумму кредита, перетаскивая указатель. Значение имеет максимальное значение 10 000 000. В идеале он должен остановиться на максимуме или позволить пользователю перетаскивать назад оттуда. < /P>
Вот снимок эмулятора: < /p>
Widget build(BuildContext context) {
return SizedBox(
height: 300,
width: MediaQuery.of(context).size.width,
child: Center(
child: Container(
decoration: BoxDecoration(
shape: BoxShape.circle,
color: const Color.fromARGB(
255, 228, 233, 244), // Circle background color
),
child: ClipOval(
child: SizedBox(
height: 450,
width: 450,
child: Center(
child: Stack(
alignment: Alignment.center,
children: [
SfRadialGauge(
axes: [
RadialAxis(
// radiusFactor: 0.8,
isInversed: false,
numberFormat: NumberFormat.currency(locale: 'IN'),
startAngle: 270,
endAngle: 270,
minimum: 1000,
maximum: maxLoanAmount,
showLabels: false,
showTicks: false,
radiusFactor: 0.9,
axisLineStyle: AxisLineStyle(
thickness: 0.135,
thicknessUnit: GaugeSizeUnit.factor,
color: Color(0xFFDBE2F4),
),
ranges: [
GaugeRange(
startValue: 1000,
endValue: _value,
gradient: const SweepGradient(
colors: [
Color.fromARGB(255, 146, 200, 238),
Color.fromARGB(255, 6, 96, 191),
],
),
startWidth: 20,
endWidth: 20,
),
],
pointers: [
WidgetPointer(
value: _value,
enableDragging: true,
onValueChanged: (newValue) {
log('sfvsd $newValue');
setState(() {
_value = ((newValue / 1000).round() * 1000)
.toDouble()
.clamp(1000, maxLoanAmount);
});
log('svfs ${_value}');
log('svfs1 ${widget.onValueChanged}');
//here
if (widget.onValueChanged != null)
widget.onValueChanged!(_value);
},
child: Container(
width: 30,
height: 30,
decoration: BoxDecoration(
color: Colors.white,
shape: BoxShape.circle,
border:
Border.all(color: Colors.white, width: 1),
),
child: Center(
child: Container(
width: 7,
height: 7,
decoration: BoxDecoration(
color: Colors.blue.shade900,
shape: BoxShape.circle,
),
),
),
),
),
],
annotations: [
GaugeAnnotation(
widget: Text(
"${indianFormat.format(_value)}",
style: TextStyle(
fontSize: 34,
fontWeight: FontWeight.w900,
color: Colors.blue.shade900,
),
),
positionFactor: 0.1,
angle: 90,
),
],
),
],
),
// Circular Overlay (formerly Positioned)
Container(
width: 200,
height: 200,
decoration: BoxDecoration(
shape: BoxShape.circle,
border: Border.all(
color: const Color.fromARGB(255, 98, 173, 248),
width: 3,
),
),
),
],
),
),
),
),
),
),
);
}
}
Подробнее здесь: https://stackoverflow.com/questions/795 ... -reversing
Я использую виджет Sfradialgauge в Flutter, чтобы пользователи могли выбрать сумму кредита, перетаскивая указатель. Значение имеет максимальное значение 10 000 000. В идеале он должен остановиться на максимуме или позволить пользователю перетаскивать назад оттуда. < /P>
Вот снимок эмулятора: < /p>
Widget build(BuildContext context) {
return SizedBox(
height: 300,
width: MediaQuery.of(context).size.width,
child: Center(
child: Container(
decoration: BoxDecoration(
shape: BoxShape.circle,
color: const Color.fromARGB(
255, 228, 233, 244), // Circle background color
),
child: ClipOval(
child: SizedBox(
height: 450,
width: 450,
child: Center(
child: Stack(
alignment: Alignment.center,
children: [
SfRadialGauge(
axes: [
RadialAxis(
// radiusFactor: 0.8,
isInversed: false,
numberFormat: NumberFormat.currency(locale: 'IN'),
startAngle: 270,
endAngle: 270,
minimum: 1000,
maximum: maxLoanAmount,
showLabels: false,
showTicks: false,
radiusFactor: 0.9,
axisLineStyle: AxisLineStyle(
thickness: 0.135,
thicknessUnit: GaugeSizeUnit.factor,
color: Color(0xFFDBE2F4),
),
ranges: [
GaugeRange(
startValue: 1000,
endValue: _value,
gradient: const SweepGradient(
colors: [
Color.fromARGB(255, 146, 200, 238),
Color.fromARGB(255, 6, 96, 191),
],
),
startWidth: 20,
endWidth: 20,
),
],
pointers: [
WidgetPointer(
value: _value,
enableDragging: true,
onValueChanged: (newValue) {
log('sfvsd $newValue');
setState(() {
_value = ((newValue / 1000).round() * 1000)
.toDouble()
.clamp(1000, maxLoanAmount);
});
log('svfs ${_value}');
log('svfs1 ${widget.onValueChanged}');
//here
if (widget.onValueChanged != null)
widget.onValueChanged!(_value);
},
child: Container(
width: 30,
height: 30,
decoration: BoxDecoration(
color: Colors.white,
shape: BoxShape.circle,
border:
Border.all(color: Colors.white, width: 1),
),
child: Center(
child: Container(
width: 7,
height: 7,
decoration: BoxDecoration(
color: Colors.blue.shade900,
shape: BoxShape.circle,
),
),
),
),
),
],
annotations: [
GaugeAnnotation(
widget: Text(
"${indianFormat.format(_value)}",
style: TextStyle(
fontSize: 34,
fontWeight: FontWeight.w900,
color: Colors.blue.shade900,
),
),
positionFactor: 0.1,
angle: 90,
),
],
),
],
),
// Circular Overlay (formerly Positioned)
Container(
width: 200,
height: 200,
decoration: BoxDecoration(
shape: BoxShape.circle,
border: Border.all(
color: const Color.fromARGB(255, 98, 173, 248),
width: 3,
),
),
),
],
),
),
),
),
),
),
);
}
}
Подробнее здесь: https://stackoverflow.com/questions/795 ... -reversing
Мобильная версия