update
feat(api_service): Update try-catch funtion and handle exception update(loading_animation): Update loading animation using Lottie
This commit is contained in:
23
lib/product/shared/shared_component_loading_animation.dart
Normal file
23
lib/product/shared/shared_component_loading_animation.dart
Normal file
@@ -0,0 +1,23 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:lottie/lottie.dart';
|
||||
|
||||
class SharedComponentLoadingAnimation extends StatefulWidget {
|
||||
const SharedComponentLoadingAnimation({super.key});
|
||||
|
||||
@override
|
||||
State<SharedComponentLoadingAnimation> createState() => _SharedComponentLoadingAnimationState();
|
||||
}
|
||||
|
||||
class _SharedComponentLoadingAnimationState extends State<SharedComponentLoadingAnimation> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Center(
|
||||
child: LottieBuilder.asset(
|
||||
'assets/animations/component_loading.json',
|
||||
width: 80,
|
||||
height: 80,
|
||||
fit: BoxFit.fill,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
23
lib/product/shared/shared_loading_animation.dart
Normal file
23
lib/product/shared/shared_loading_animation.dart
Normal file
@@ -0,0 +1,23 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:lottie/lottie.dart';
|
||||
|
||||
class SharedLoadingAnimation extends StatefulWidget {
|
||||
const SharedLoadingAnimation({super.key});
|
||||
|
||||
@override
|
||||
State<SharedLoadingAnimation> createState() => _SharedLoadingAnimationState();
|
||||
}
|
||||
|
||||
class _SharedLoadingAnimationState extends State<SharedLoadingAnimation> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Center(
|
||||
child: LottieBuilder.asset(
|
||||
'assets/animations/loading.json',
|
||||
width: 100,
|
||||
height: 100,
|
||||
fit: BoxFit.fill,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -182,23 +182,23 @@ class _SharedPieChartState extends State<SharedPieChart> {
|
||||
switch (originalIndex) {
|
||||
case 0: // OFFLINE_STATE
|
||||
log("Touched Index device state = -1");
|
||||
widget.devicesManagerBloc.getDeviceByState(-1);
|
||||
widget.devicesManagerBloc.getDeviceByState(context,-1);
|
||||
break;
|
||||
case 1: // NORMAL_STATE
|
||||
log("Touched Index Get device state = 0");
|
||||
widget.devicesManagerBloc.getDeviceByState(0);
|
||||
widget.devicesManagerBloc.getDeviceByState(context,0);
|
||||
break;
|
||||
case 2: // WARNING_STATE
|
||||
log("Touched Index Get device state = 1");
|
||||
widget.devicesManagerBloc.getDeviceByState(1);
|
||||
widget.devicesManagerBloc.getDeviceByState(context,1);
|
||||
break;
|
||||
case 3: // INPROGRESS_STATE
|
||||
log("Touched Index Get device state = 2");
|
||||
widget.devicesManagerBloc.getDeviceByState(2);
|
||||
widget.devicesManagerBloc.getDeviceByState(context,2);
|
||||
break;
|
||||
case 4: // ERROR_STATE
|
||||
log("Touched Index Get device state = 3");
|
||||
widget.devicesManagerBloc.getDeviceByState(3);
|
||||
widget.devicesManagerBloc.getDeviceByState(context,3);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user