Update
Logging data Try-catch function
This commit is contained in:
@@ -5,7 +5,6 @@ import 'dart:async';
|
||||
import 'package:flutter/material.dart';
|
||||
import '../../../bloc/group_detail_bloc.dart';
|
||||
import '../../../product/shared/shared_loading_animation.dart';
|
||||
import '../../../product/shared/shared_snack_bar.dart';
|
||||
import 'group_detail_model.dart';
|
||||
import '../../../product/base/bloc/base_bloc.dart';
|
||||
import '../../../product/constant/app/app_constants.dart';
|
||||
@@ -325,7 +324,7 @@ class _DetailGroupScreenState extends State<DetailGroupScreen> {
|
||||
Future.delayed(context.lowDuration).then(
|
||||
(value) => Navigator.pop(context),
|
||||
);
|
||||
try {
|
||||
await apiServices.execute(context, () async {
|
||||
int statusCode = await apiServices
|
||||
.deleteGroup(widget.group);
|
||||
showSnackBarResponseByStatusCode(
|
||||
@@ -335,11 +334,7 @@ class _DetailGroupScreenState extends State<DetailGroupScreen> {
|
||||
.notification_delete_group_success,
|
||||
appLocalization(context)
|
||||
.notification_delete_group_failed);
|
||||
} catch (e) {
|
||||
if (!context.mounted) return;
|
||||
showErrorTopSnackBarCustom(
|
||||
context, e.toString());
|
||||
}
|
||||
});
|
||||
},
|
||||
child: Text(
|
||||
appLocalization(context)
|
||||
|
||||
@@ -39,7 +39,7 @@ class _GroupsScreenState extends State<GroupsScreen> {
|
||||
const duration = Duration(seconds: 5);
|
||||
getAllGroupsTimer = Timer.periodic(
|
||||
duration,
|
||||
(Timer t) => interFamilyBloc.getAllGroup(widget.role),
|
||||
(Timer t) => interFamilyBloc.getAllGroup(context, widget.role),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ class _GroupsScreenState extends State<GroupsScreen> {
|
||||
stream: interFamilyBloc.streamCurrentGroups,
|
||||
builder: (context, groupsSnapshot) {
|
||||
if (groupsSnapshot.data == null) {
|
||||
interFamilyBloc.getAllGroup(widget.role);
|
||||
interFamilyBloc.getAllGroup(context,widget.role);
|
||||
return const SharedLoadingAnimation();
|
||||
} else if (groupsSnapshot.data!.isEmpty) {
|
||||
return Center(
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:qr_flutter/qr_flutter.dart';
|
||||
|
||||
import '../../../bloc/inter_family_bloc.dart';
|
||||
import '../../../product/constant/icon/icon_constants.dart';
|
||||
import '../../../product/extension/context_extension.dart';
|
||||
import '../../../product/services/language_services.dart';
|
||||
|
||||
import 'groups_model.dart';
|
||||
|
||||
shareGroup(BuildContext context, Group group) {
|
||||
@@ -80,7 +80,8 @@ showActionDialog(
|
||||
if (dialogTitle == appLocalization(context).delete_group_title) {
|
||||
Navigator.of(dialogContext).pop();
|
||||
await interFamilyBloc.deleteGroup(context, group.id!);
|
||||
interFamilyBloc.getAllGroup(role);
|
||||
// ignore: use_build_context_synchronously
|
||||
interFamilyBloc.getAllGroup(context,role);
|
||||
} else {}
|
||||
},
|
||||
child: Text(
|
||||
|
||||
@@ -122,7 +122,7 @@ createOrJoinGroupDialog(
|
||||
try {
|
||||
await interFamilyBloc.createGroup(
|
||||
context, groupName, description);
|
||||
interFamilyBloc.getAllGroup(role);
|
||||
interFamilyBloc.getAllGroup(context, role);
|
||||
Navigator.of(dialogContext).pop();
|
||||
} catch (e) {
|
||||
// log("Lỗi khi tạo nhóm: $e");
|
||||
@@ -133,7 +133,7 @@ createOrJoinGroupDialog(
|
||||
try {
|
||||
await interFamilyBloc.changeGroupInformation(
|
||||
context, groupID, groupName, description);
|
||||
interFamilyBloc.getAllGroup(role);
|
||||
interFamilyBloc.getAllGroup(context, role);
|
||||
Navigator.of(dialogContext).pop();
|
||||
} catch (e) {
|
||||
// log("Lỗi khi sửa nhóm: $e");
|
||||
|
||||
Reference in New Issue
Block a user