feat(api_service): Update try-catch funtion and handle exception
update(loading_animation): Update loading animation using Lottie
This commit is contained in:
anhtunz
2025-06-09 14:29:43 +07:00
parent 477646ab9d
commit 3a8fa3633c
44 changed files with 1659 additions and 1065 deletions

View 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,
),
);
}
}

View 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,
),
);
}
}

View File

@@ -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;
}
}