update
feat(api_service): Update try-catch funtion and handle exception update(loading_animation): Update loading animation using Lottie
This commit is contained in:
@@ -3,69 +3,97 @@ import 'status_card.dart';
|
||||
import '../../../product/extension/context_extension.dart';
|
||||
import '../../../product/services/language_services.dart';
|
||||
|
||||
class OverviewCard extends StatelessWidget {
|
||||
class OverviewCard extends StatefulWidget {
|
||||
final bool isOwner;
|
||||
final int total;
|
||||
final int active;
|
||||
final int inactive;
|
||||
final int warning;
|
||||
final int unused;
|
||||
final bool showTotal;
|
||||
final bool showActive;
|
||||
final bool showInactive;
|
||||
final bool showWarning;
|
||||
final bool showUnused;
|
||||
|
||||
const OverviewCard(
|
||||
{super.key,
|
||||
required this.isOwner,
|
||||
required this.total,
|
||||
required this.active,
|
||||
required this.inactive,
|
||||
required this.warning,
|
||||
required this.unused});
|
||||
const OverviewCard({
|
||||
super.key,
|
||||
required this.isOwner,
|
||||
required this.total,
|
||||
required this.active,
|
||||
required this.inactive,
|
||||
required this.warning,
|
||||
required this.unused,
|
||||
this.showTotal = true,
|
||||
this.showActive = true,
|
||||
this.showInactive = true,
|
||||
this.showWarning = true,
|
||||
this.showUnused = true,
|
||||
});
|
||||
|
||||
@override
|
||||
State<OverviewCard> createState() => _OverviewCardState();
|
||||
}
|
||||
|
||||
class _OverviewCardState extends State<OverviewCard> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Card(
|
||||
elevation: 8,
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(15)),
|
||||
child: Padding(
|
||||
padding: context.paddingNormal,
|
||||
child: Column(
|
||||
children: [
|
||||
Text(
|
||||
isOwner
|
||||
? appLocalization(context).overview_message
|
||||
: appLocalization(context).interfamily_page_name,
|
||||
style: context.h2,
|
||||
),
|
||||
SizedBox(height: context.normalValue),
|
||||
Column(
|
||||
return FittedBox(
|
||||
alignment: Alignment.topCenter,
|
||||
child: SizedBox(
|
||||
width: context.width,
|
||||
child: Card(
|
||||
// elevation: 8,
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(15)),
|
||||
child: Padding(
|
||||
padding: context.paddingNormal,
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
StatusCard(
|
||||
label: appLocalization(context).total_nof_devices_message,
|
||||
count: total,
|
||||
color: Colors.blue,
|
||||
Text(
|
||||
widget.isOwner
|
||||
? appLocalization(context).overview_message
|
||||
: appLocalization(context).interfamily_page_name,
|
||||
style: context.h2,
|
||||
),
|
||||
StatusCard(
|
||||
label: appLocalization(context).active_devices_message,
|
||||
count: active,
|
||||
color: Colors.green,
|
||||
),
|
||||
StatusCard(
|
||||
label: appLocalization(context).inactive_devices_message,
|
||||
count: inactive,
|
||||
color: Colors.grey,
|
||||
),
|
||||
StatusCard(
|
||||
label: appLocalization(context).warning_devices_message,
|
||||
count: warning,
|
||||
color: Colors.orange,
|
||||
),
|
||||
StatusCard(
|
||||
label: appLocalization(context).unused_devices_message,
|
||||
count: unused,
|
||||
color: Colors.yellow,
|
||||
SizedBox(height: context.normalValue),
|
||||
Column(
|
||||
children: [
|
||||
if (widget.showTotal)
|
||||
StatusCard(
|
||||
label: appLocalization(context).total_nof_devices_message,
|
||||
count: widget.total,
|
||||
color: Colors.blue,
|
||||
),
|
||||
if (widget.showActive)
|
||||
StatusCard(
|
||||
label: appLocalization(context).active_devices_message,
|
||||
count: widget.active,
|
||||
color: Colors.green,
|
||||
),
|
||||
if (widget.showInactive)
|
||||
StatusCard(
|
||||
label: appLocalization(context).inactive_devices_message,
|
||||
count: widget.inactive,
|
||||
color: Colors.grey,
|
||||
),
|
||||
if (widget.showWarning)
|
||||
StatusCard(
|
||||
label: appLocalization(context).warning_devices_message,
|
||||
count: widget.warning,
|
||||
color: Colors.orange,
|
||||
),
|
||||
if (widget.showUnused)
|
||||
StatusCard(
|
||||
label: appLocalization(context).unused_devices_message,
|
||||
count: widget.unused,
|
||||
color: Colors.yellow,
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user