Wait 2 sec before refresh ressources (on create)

This commit is contained in:
Thomas Fransolet 2024-03-14 15:04:43 +01:00
parent 8824609fad
commit fb0a8674d1
2 changed files with 19 additions and 12 deletions

View File

@ -42,17 +42,21 @@ class _SliderInputContainerState extends State<SliderInputContainer> {
), ),
Padding( Padding(
padding: const EdgeInsets.all(10.0), padding: const EdgeInsets.all(10.0),
child: Slider( child: SliderTheme(
value: currentValue!, data: SliderThemeData(
onChanged: (value) { showValueIndicator: ShowValueIndicator.always),
setState(() => currentValue = value); child: Slider(
widget.onChanged(value); value: currentValue!,
}, onChanged: (value) {
divisions: widget.max - widget.min, setState(() => currentValue = value);
min: widget.min.toDouble(), widget.onChanged(value);
max: widget.max.toDouble(), },
label: "$currentValue", divisions: widget.max - widget.min,
activeColor: widget.color, min: widget.min.toDouble(),
max: widget.max.toDouble(),
label: "$currentValue",
activeColor: widget.color,
),
), ),
), ),
], ],

View File

@ -68,7 +68,10 @@ class _ResourcesScreenState extends State<ResourcesScreen> {
if (result != null) if (result != null)
{ {
await create(result[0], result[1], result[2], appContext, context); await create(result[0], result[1], result[2], appContext, context);
setState(() {}); // For refresh Future.delayed(Duration(seconds: 2), () {
setState(() {});
});
// For refresh
} }
} else { } else {
var result = await showResource(value, appContext, context, size); var result = await showResource(value, appContext, context, size);