fix entry-point no detachLocal
This commit is contained in:
parent
618ad783da
commit
afd1d006d4
|
@ -8,7 +8,8 @@ import 'package:flutter/rendering.dart';
|
|||
|
||||
const double _kTabHeight = 46.0;
|
||||
|
||||
typedef _LayoutCallback = void Function(List<double> xOffsets, TextDirection textDirection, double width);
|
||||
typedef _LayoutCallback = void Function(
|
||||
List<double> xOffsets, TextDirection textDirection, double width);
|
||||
|
||||
class _TabLabelBarRenderer extends RenderFlex {
|
||||
_TabLabelBarRenderer({
|
||||
|
@ -33,7 +34,8 @@ class _TabLabelBarRenderer extends RenderFlex {
|
|||
RenderBox? child = firstChild;
|
||||
final List<double> xOffsets = <double>[];
|
||||
while (child != null) {
|
||||
final FlexParentData childParentData = child.parentData! as FlexParentData;
|
||||
final FlexParentData childParentData =
|
||||
child.parentData! as FlexParentData;
|
||||
xOffsets.add(childParentData.offset.dx);
|
||||
assert(child.parentData == childParentData);
|
||||
child = childParentData.nextSibling;
|
||||
|
@ -82,7 +84,8 @@ class _TabLabelBar extends Flex {
|
|||
}
|
||||
|
||||
@override
|
||||
void updateRenderObject(BuildContext context, _TabLabelBarRenderer renderObject) {
|
||||
void updateRenderObject(
|
||||
BuildContext context, _TabLabelBarRenderer renderObject) {
|
||||
super.updateRenderObject(context, renderObject);
|
||||
renderObject.onPerformLayout = onPerformLayout;
|
||||
}
|
||||
|
@ -133,7 +136,8 @@ class _IndicatorPainter extends CustomPainter {
|
|||
assert(_currentTabOffsets!.isNotEmpty);
|
||||
assert(tabIndex >= 0);
|
||||
assert(tabIndex <= maxTabIndex);
|
||||
return (_currentTabOffsets![tabIndex] + _currentTabOffsets![tabIndex + 1]) / 2.0;
|
||||
return (_currentTabOffsets![tabIndex] + _currentTabOffsets![tabIndex + 1]) /
|
||||
2.0;
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -188,10 +192,12 @@ class _TabBarScrollPosition extends ScrollPositionWithSingleContext {
|
|||
// ballistic scroll activity.
|
||||
if (!_viewportDimensionWasNonZero || _needsPixelsCorrection) {
|
||||
_needsPixelsCorrection = false;
|
||||
correctPixels(tabBar._initialScrollOffset(viewportDimension, minScrollExtent, maxScrollExtent));
|
||||
correctPixels(tabBar._initialScrollOffset(
|
||||
viewportDimension, minScrollExtent, maxScrollExtent));
|
||||
result = false;
|
||||
}
|
||||
return super.applyContentDimensions(minScrollExtent, maxScrollExtent) && result;
|
||||
return super.applyContentDimensions(minScrollExtent, maxScrollExtent) &&
|
||||
result;
|
||||
}
|
||||
|
||||
void markNeedsPixelsCorrection() {
|
||||
|
@ -207,7 +213,8 @@ class _TabBarScrollController extends ScrollController {
|
|||
final _FlutterFlowButtonTabBarState tabBar;
|
||||
|
||||
@override
|
||||
ScrollPosition createScrollPosition(ScrollPhysics physics, ScrollContext context, ScrollPosition? oldPosition) {
|
||||
ScrollPosition createScrollPosition(ScrollPhysics physics,
|
||||
ScrollContext context, ScrollPosition? oldPosition) {
|
||||
return _TabBarScrollPosition(
|
||||
physics: physics,
|
||||
context: context,
|
||||
|
@ -218,7 +225,8 @@ class _TabBarScrollController extends ScrollController {
|
|||
}
|
||||
|
||||
/// A Flutterflow Design widget that displays a horizontal row of tabs.
|
||||
class FlutterFlowButtonTabBar extends StatefulWidget implements PreferredSizeWidget {
|
||||
class FlutterFlowButtonTabBar extends StatefulWidget
|
||||
implements PreferredSizeWidget {
|
||||
/// The [tabs] argument must not be null and its length must match the [controller]'s
|
||||
/// [TabController.length].
|
||||
///
|
||||
|
@ -352,14 +360,17 @@ class FlutterFlowButtonTabBar extends StatefulWidget implements PreferredSizeWid
|
|||
maxHeight = math.max(itemHeight, maxHeight);
|
||||
}
|
||||
}
|
||||
return Size.fromHeight(maxHeight + labelPadding.vertical + buttonMargin.vertical);
|
||||
return Size.fromHeight(
|
||||
maxHeight + labelPadding.vertical + buttonMargin.vertical);
|
||||
}
|
||||
|
||||
@override
|
||||
State<FlutterFlowButtonTabBar> createState() => _FlutterFlowButtonTabBarState();
|
||||
State<FlutterFlowButtonTabBar> createState() =>
|
||||
_FlutterFlowButtonTabBarState();
|
||||
}
|
||||
|
||||
class _FlutterFlowButtonTabBarState extends State<FlutterFlowButtonTabBar> with TickerProviderStateMixin {
|
||||
class _FlutterFlowButtonTabBarState extends State<FlutterFlowButtonTabBar>
|
||||
with TickerProviderStateMixin {
|
||||
ScrollController? _scrollController;
|
||||
TabController? _controller;
|
||||
_IndicatorPainter? _indicatorPainter;
|
||||
|
@ -383,7 +394,8 @@ class _FlutterFlowButtonTabBarState extends State<FlutterFlowButtonTabBar> with
|
|||
|
||||
/// The animation duration is 2/3 of the tab scroll animation duration in
|
||||
/// Material design (kTabScrollDuration).
|
||||
_animationController = AnimationController(vsync: this, duration: const Duration(milliseconds: 200));
|
||||
_animationController = AnimationController(
|
||||
vsync: this, duration: const Duration(milliseconds: 200));
|
||||
|
||||
// so the buttons start in their "final" state (color)
|
||||
_animationController
|
||||
|
@ -401,7 +413,8 @@ class _FlutterFlowButtonTabBarState extends State<FlutterFlowButtonTabBar> with
|
|||
bool get _controllerIsValid => _controller?.animation != null;
|
||||
|
||||
void _updateTabController() {
|
||||
final TabController? newController = widget.controller ?? DefaultTabController.maybeOf(context);
|
||||
final TabController? newController =
|
||||
widget.controller ?? DefaultTabController.maybeOf(context);
|
||||
assert(() {
|
||||
if (newController == null) {
|
||||
throw FlutterError(
|
||||
|
@ -486,7 +499,8 @@ class _FlutterFlowButtonTabBarState extends State<FlutterFlowButtonTabBar> with
|
|||
|
||||
int get maxTabIndex => _indicatorPainter!.maxTabIndex;
|
||||
|
||||
double _tabScrollOffset(int index, double viewportWidth, double minExtent, double maxExtent) {
|
||||
double _tabScrollOffset(
|
||||
int index, double viewportWidth, double minExtent, double maxExtent) {
|
||||
if (!widget.isScrollable) {
|
||||
return 0.0;
|
||||
}
|
||||
|
@ -502,27 +516,34 @@ class _FlutterFlowButtonTabBarState extends State<FlutterFlowButtonTabBar> with
|
|||
break;
|
||||
}
|
||||
|
||||
return clampDouble(tabCenter + paddingStart - viewportWidth / 2.0, minExtent, maxExtent);
|
||||
return clampDouble(
|
||||
tabCenter + paddingStart - viewportWidth / 2.0, minExtent, maxExtent);
|
||||
}
|
||||
|
||||
double _tabCenteredScrollOffset(int index) {
|
||||
final ScrollPosition position = _scrollController!.position;
|
||||
return _tabScrollOffset(index, position.viewportDimension, position.minScrollExtent, position.maxScrollExtent);
|
||||
return _tabScrollOffset(index, position.viewportDimension,
|
||||
position.minScrollExtent, position.maxScrollExtent);
|
||||
}
|
||||
|
||||
double _initialScrollOffset(double viewportWidth, double minExtent, double maxExtent) {
|
||||
double _initialScrollOffset(
|
||||
double viewportWidth, double minExtent, double maxExtent) {
|
||||
return _tabScrollOffset(_currentIndex, viewportWidth, minExtent, maxExtent);
|
||||
}
|
||||
|
||||
void _scrollToCurrentIndex() {
|
||||
final double offset = _tabCenteredScrollOffset(_currentIndex);
|
||||
_scrollController!.animateTo(offset, duration: kTabScrollDuration, curve: Curves.ease);
|
||||
_scrollController!
|
||||
.animateTo(offset, duration: kTabScrollDuration, curve: Curves.ease);
|
||||
}
|
||||
|
||||
void _scrollToControllerValue() {
|
||||
final double? leadingPosition = _currentIndex > 0 ? _tabCenteredScrollOffset(_currentIndex - 1) : null;
|
||||
final double? leadingPosition =
|
||||
_currentIndex > 0 ? _tabCenteredScrollOffset(_currentIndex - 1) : null;
|
||||
final double middlePosition = _tabCenteredScrollOffset(_currentIndex);
|
||||
final double? trailingPosition = _currentIndex < maxTabIndex ? _tabCenteredScrollOffset(_currentIndex + 1) : null;
|
||||
final double? trailingPosition = _currentIndex < maxTabIndex
|
||||
? _tabCenteredScrollOffset(_currentIndex + 1)
|
||||
: null;
|
||||
|
||||
final double index = _controller!.index.toDouble();
|
||||
final double value = _controller!.animation!.value;
|
||||
|
@ -534,9 +555,13 @@ class _FlutterFlowButtonTabBarState extends State<FlutterFlowButtonTabBar> with
|
|||
} else if (value == index) {
|
||||
offset = middlePosition;
|
||||
} else if (value < index) {
|
||||
offset = leadingPosition == null ? middlePosition : lerpDouble(middlePosition, leadingPosition, index - value)!;
|
||||
offset = leadingPosition == null
|
||||
? middlePosition
|
||||
: lerpDouble(middlePosition, leadingPosition, index - value)!;
|
||||
} else {
|
||||
offset = trailingPosition == null ? middlePosition : lerpDouble(middlePosition, trailingPosition, value - index)!;
|
||||
offset = trailingPosition == null
|
||||
? middlePosition
|
||||
: lerpDouble(middlePosition, trailingPosition, value - index)!;
|
||||
}
|
||||
|
||||
_scrollController!.jumpTo(offset);
|
||||
|
@ -574,7 +599,8 @@ class _FlutterFlowButtonTabBarState extends State<FlutterFlowButtonTabBar> with
|
|||
}
|
||||
|
||||
// Called each time layout completes.
|
||||
void _saveTabOffsets(List<double> tabOffsets, TextDirection textDirection, double width) {
|
||||
void _saveTabOffsets(
|
||||
List<double> tabOffsets, TextDirection textDirection, double width) {
|
||||
_tabStripWidth = width;
|
||||
_indicatorPainter?.saveTabOffsets(tabOffsets, textDirection);
|
||||
}
|
||||
|
@ -586,7 +612,7 @@ class _FlutterFlowButtonTabBarState extends State<FlutterFlowButtonTabBar> with
|
|||
}
|
||||
|
||||
Widget _buildStyledTab(Widget child, int index) {
|
||||
final TabBarTheme tabBarTheme = TabBarTheme.of(context);
|
||||
final TabBarTheme tabBarTheme = TabBarTheme.of(context) as TabBarTheme;
|
||||
|
||||
final double animationValue;
|
||||
if (index == _currentIndex) {
|
||||
|
@ -598,34 +624,52 @@ class _FlutterFlowButtonTabBarState extends State<FlutterFlowButtonTabBar> with
|
|||
}
|
||||
|
||||
final TextStyle? textStyle = TextStyle.lerp(
|
||||
(widget.unselectedLabelStyle ?? tabBarTheme.labelStyle ?? DefaultTextStyle.of(context).style).copyWith(
|
||||
(widget.unselectedLabelStyle ??
|
||||
tabBarTheme.labelStyle ??
|
||||
DefaultTextStyle.of(context).style)
|
||||
.copyWith(
|
||||
color: widget.unselectedLabelColor,
|
||||
),
|
||||
(widget.labelStyle ?? tabBarTheme.labelStyle ?? DefaultTextStyle.of(context).style).copyWith(
|
||||
(widget.labelStyle ??
|
||||
tabBarTheme.labelStyle ??
|
||||
DefaultTextStyle.of(context).style)
|
||||
.copyWith(
|
||||
color: widget.labelColor,
|
||||
),
|
||||
animationValue);
|
||||
|
||||
final Color? textColor = Color.lerp(widget.unselectedLabelColor, widget.labelColor, animationValue);
|
||||
final Color? textColor = Color.lerp(
|
||||
widget.unselectedLabelColor, widget.labelColor, animationValue);
|
||||
|
||||
final Color? borderColor = Color.lerp(widget.unselectedBorderColor, widget.borderColor, animationValue);
|
||||
final Color? borderColor = Color.lerp(
|
||||
widget.unselectedBorderColor, widget.borderColor, animationValue);
|
||||
|
||||
BoxDecoration? boxDecoration = BoxDecoration.lerp(
|
||||
BoxDecoration(
|
||||
color: widget.unselectedDecoration?.color ?? widget.unselectedBackgroundColor ?? Colors.transparent,
|
||||
color: widget.unselectedDecoration?.color ??
|
||||
widget.unselectedBackgroundColor ??
|
||||
Colors.transparent,
|
||||
boxShadow: widget.unselectedDecoration?.boxShadow,
|
||||
gradient: widget.unselectedDecoration?.gradient,
|
||||
borderRadius: widget.useToggleButtonStyle ? null : BorderRadius.circular(widget.borderRadius),
|
||||
borderRadius: widget.useToggleButtonStyle
|
||||
? null
|
||||
: BorderRadius.circular(widget.borderRadius),
|
||||
),
|
||||
BoxDecoration(
|
||||
color: widget.decoration?.color ?? widget.backgroundColor ?? Colors.transparent,
|
||||
color: widget.decoration?.color ??
|
||||
widget.backgroundColor ??
|
||||
Colors.transparent,
|
||||
boxShadow: widget.decoration?.boxShadow,
|
||||
gradient: widget.decoration?.gradient,
|
||||
borderRadius: widget.useToggleButtonStyle ? null : BorderRadius.circular(widget.borderRadius),
|
||||
borderRadius: widget.useToggleButtonStyle
|
||||
? null
|
||||
: BorderRadius.circular(widget.borderRadius),
|
||||
),
|
||||
animationValue);
|
||||
|
||||
if (widget.useToggleButtonStyle && widget.borderWidth > 0 && boxDecoration != null) {
|
||||
if (widget.useToggleButtonStyle &&
|
||||
widget.borderWidth > 0 &&
|
||||
boxDecoration != null) {
|
||||
if (index == 0) {
|
||||
boxDecoration = boxDecoration.copyWith(
|
||||
border: Border(
|
||||
|
@ -659,11 +703,13 @@ class _FlutterFlowButtonTabBarState extends State<FlutterFlowButtonTabBar> with
|
|||
return Padding(
|
||||
key: _tabKeys[index],
|
||||
// padding for the buttons
|
||||
padding: widget.useToggleButtonStyle ? EdgeInsets.zero : widget.buttonMargin,
|
||||
padding:
|
||||
widget.useToggleButtonStyle ? EdgeInsets.zero : widget.buttonMargin,
|
||||
child: TextButton(
|
||||
onPressed: () => _handleTap(index),
|
||||
style: ButtonStyle(
|
||||
elevation: WidgetStateProperty.all(widget.useToggleButtonStyle ? 0 : widget.elevation),
|
||||
elevation: WidgetStateProperty.all(
|
||||
widget.useToggleButtonStyle ? 0 : widget.elevation),
|
||||
|
||||
/// give a pretty small minimum size
|
||||
minimumSize: WidgetStateProperty.all(const Size(10, 10)),
|
||||
|
@ -729,11 +775,14 @@ class _FlutterFlowButtonTabBarState extends State<FlutterFlowButtonTabBar> with
|
|||
|
||||
if (_controller!.length == 0) {
|
||||
return Container(
|
||||
height: _kTabHeight + widget.labelPadding.vertical + widget.buttonMargin.vertical,
|
||||
height: _kTabHeight +
|
||||
widget.labelPadding.vertical +
|
||||
widget.buttonMargin.vertical,
|
||||
);
|
||||
}
|
||||
|
||||
final List<Widget> wrappedTabs = List<Widget>.generate(widget.tabs.length, (int index) {
|
||||
final List<Widget> wrappedTabs =
|
||||
List<Widget>.generate(widget.tabs.length, (int index) {
|
||||
return _buildStyledTab(widget.tabs[index], index);
|
||||
});
|
||||
|
||||
|
|
|
@ -6,11 +6,9 @@ abstract class LocalsLocalDataSource {
|
|||
}
|
||||
|
||||
class LocalsLocalDataSourceImpl {
|
||||
|
||||
Future<void> unlinkLocal() async {
|
||||
await StorageHelper().set(KeychainStorageKey.clientUUID.value, '');
|
||||
await StorageHelper().set(KeychainStorageKey.clientName.value, '');
|
||||
await StorageHelper().set(KeychainStorageKey.ownerName.value, '');
|
||||
await StorageHelper().set(KeychainStorageKey.clientUUID.value, '');
|
||||
await StorageHelper().set(KeychainStorageKey.clientName.value, '');
|
||||
await StorageHelper().set(KeychainStorageKey.ownerName.value, '');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -20,14 +20,15 @@ import 'package:hub/shared/utils/snackbar_util.dart';
|
|||
abstract class LocalsRemoteDataSource {
|
||||
Future<void> linkLocal(BuildContext context);
|
||||
Future<bool> checkLocals(BuildContext context);
|
||||
Future<bool> processLocals(BuildContext context) ;
|
||||
Future<bool> processLocals(BuildContext context);
|
||||
Future<bool> processData(BuildContext context);
|
||||
Future<bool> selectLocal(BuildContext context, ApiCallResponse? response) ;
|
||||
Future<void> detachLocal(BuildContext context);
|
||||
Future<bool> selectLocal(BuildContext context, ApiCallResponse? response);
|
||||
Future<bool> detachLocal(BuildContext context);
|
||||
}
|
||||
|
||||
class LocalsRemoteDataSourceImpl implements LocalsRemoteDataSource {
|
||||
static final LocalsRemoteDataSourceImpl _instance = LocalsRemoteDataSourceImpl._internal();
|
||||
static final LocalsRemoteDataSourceImpl _instance =
|
||||
LocalsRemoteDataSourceImpl._internal();
|
||||
factory LocalsRemoteDataSourceImpl() => _instance;
|
||||
LocalsRemoteDataSourceImpl._internal();
|
||||
|
||||
|
@ -53,7 +54,8 @@ class LocalsRemoteDataSourceImpl implements LocalsRemoteDataSource {
|
|||
|
||||
final List<dynamic> locals = response.jsonBody['locais'] ?? [];
|
||||
final bool isEmpty = locals.isEmpty;
|
||||
final bool isActive = locals.where((local) => local['CLU_STATUS'] != 'B').isNotEmpty;
|
||||
final bool isActive =
|
||||
locals.where((local) => local['CLU_STATUS'] != 'B').isNotEmpty;
|
||||
final bool isEnable = !isEmpty && isActive;
|
||||
|
||||
if (isEnable) {
|
||||
|
@ -71,7 +73,7 @@ class LocalsRemoteDataSourceImpl implements LocalsRemoteDataSource {
|
|||
|
||||
@override
|
||||
Future<bool> processLocals(BuildContext context) async {
|
||||
log('() => processLocals');
|
||||
log('() => processLocals');
|
||||
try {
|
||||
final GetLocalsCall callback = PhpGroup.getLocalsCall;
|
||||
final ApiCallResponse response = await callback.call();
|
||||
|
@ -98,7 +100,8 @@ class LocalsRemoteDataSourceImpl implements LocalsRemoteDataSource {
|
|||
final bool isInactived = await LocalUtil.isInactived(locals);
|
||||
final bool isPending = LocalUtil.isPending(locals);
|
||||
final bool isUnique = locals.length == 1;
|
||||
final bool isBlocked = locals.where((local) => local['CLU_STATUS'] == 'B').isNotEmpty;
|
||||
final bool isBlocked =
|
||||
locals.where((local) => local['CLU_STATUS'] == 'B').isNotEmpty;
|
||||
final bool isEnabled = isUnique && isActive;
|
||||
final bool isDisabled = isUnique && isBlocked;
|
||||
final bool isUnselected = await LocalUtil.isUnselected();
|
||||
|
@ -145,8 +148,10 @@ class LocalsRemoteDataSourceImpl implements LocalsRemoteDataSource {
|
|||
|
||||
@override
|
||||
Future<bool> checkLocals(BuildContext context) async {
|
||||
String cliUUID = (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? '';
|
||||
String cliName = (await StorageHelper().get(KeychainStorageKey.clientName.value)) ?? '';
|
||||
String cliUUID =
|
||||
(await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? '';
|
||||
String cliName =
|
||||
(await StorageHelper().get(KeychainStorageKey.clientName.value)) ?? '';
|
||||
return cliUUID.isEmpty && cliName.isEmpty;
|
||||
}
|
||||
|
||||
|
@ -170,7 +175,8 @@ class LocalsRemoteDataSourceImpl implements LocalsRemoteDataSource {
|
|||
if (isError == true) {
|
||||
final GetLocalsCall callback = PhpGroup.getLocalsCall;
|
||||
response = await callback.call();
|
||||
final String errorMsg = response.jsonBody['error_msg'] ?? 'Local indisponível';
|
||||
final String errorMsg =
|
||||
response.jsonBody['error_msg'] ?? 'Local indisponível';
|
||||
// await DialogUtil.error(context, errorMsg).whenComplete(() async => await selectLocal(context, response));
|
||||
return false;
|
||||
} else {
|
||||
|
@ -189,7 +195,8 @@ class LocalsRemoteDataSourceImpl implements LocalsRemoteDataSource {
|
|||
}
|
||||
|
||||
@override
|
||||
Future<bool> selectLocal(BuildContext context, ApiCallResponse? response) async {
|
||||
Future<bool> selectLocal(
|
||||
BuildContext context, ApiCallResponse? response) async {
|
||||
return await showModalBottomSheet(
|
||||
isScrollControlled: true,
|
||||
backgroundColor: Colors.transparent,
|
||||
|
@ -209,23 +216,20 @@ class LocalsRemoteDataSourceImpl implements LocalsRemoteDataSource {
|
|||
}
|
||||
|
||||
@override
|
||||
Future<void> detachLocal(BuildContext context) async {
|
||||
Future<bool> detachLocal(BuildContext context) async {
|
||||
String content;
|
||||
try {
|
||||
content = FFLocalizations.of(context).getVariableText(
|
||||
enText: 'Device unlinked successfully',
|
||||
ptText: 'Dispositivo desvinculado com sucesso',
|
||||
);
|
||||
|
||||
await PhpGroup.resopndeVinculo.call(tarefa: 'I').then((value) async {
|
||||
final bool status =
|
||||
await PhpGroup.resopndeVinculo.call(tarefa: 'I').then((value) async {
|
||||
if (value.jsonBody['error'] == false) {
|
||||
await StorageHelper().set(KeychainStorageKey.clientName.value, '');
|
||||
await StorageHelper().set(KeychainStorageKey.ownerName.value, '');
|
||||
await StorageHelper().set(KeychainStorageKey.clientUUID.value, '');
|
||||
context.pop();
|
||||
context.go('/homePage', extra: {'update': LocalsRepositoryImpl().update});
|
||||
SnackBarUtil.showSnackBar(context, content);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}).catchError((err, stack) {
|
||||
context.pop();
|
||||
content = FFLocalizations.of(context).getVariableText(
|
||||
|
@ -233,7 +237,9 @@ class LocalsRemoteDataSourceImpl implements LocalsRemoteDataSource {
|
|||
ptText: 'Erro ao desvincular dispositivo',
|
||||
);
|
||||
SnackBarUtil.showSnackBar(context, content, isError: true);
|
||||
return false;
|
||||
});
|
||||
return status;
|
||||
} catch (err, stack) {
|
||||
context.pop();
|
||||
log(err.toString(), stackTrace: stack);
|
||||
|
@ -242,8 +248,7 @@ class LocalsRemoteDataSourceImpl implements LocalsRemoteDataSource {
|
|||
ptText: 'Erro ao desvincular dispositivo',
|
||||
);
|
||||
SnackBarUtil.showSnackBar(context, content, isError: true);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ import 'dart:developer';
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:hub/backend/notifications/firebase_messaging_service.dart';
|
||||
import 'package:hub/flutter_flow/nav/nav.dart';
|
||||
import 'package:hub/shared/components/molecules/locals/index.dart';
|
||||
import 'package:hub/shared/components/molecules/menu/presentation/blocs/menu_bloc.dart';
|
||||
import 'package:hub/shared/components/molecules/modules/index.dart';
|
||||
|
@ -32,21 +33,23 @@ class LocalsRepositoryImpl implements LocalsRepository {
|
|||
}
|
||||
|
||||
Future<void> select(BuildContext context) async {
|
||||
await localDataSource.unlinkLocal();
|
||||
await update(context);
|
||||
await localDataSource.unlinkLocal();
|
||||
await update(context);
|
||||
}
|
||||
|
||||
Future<void> check(BuildContext context) async {
|
||||
final String? cliUUID = await StorageHelper().get(KeychainStorageKey.clientUUID.value);
|
||||
final String? ownerUUID = await StorageHelper().get(KeychainStorageKey.ownerUUID.value);
|
||||
final String? cliUUID =
|
||||
await StorageHelper().get(KeychainStorageKey.clientUUID.value);
|
||||
final String? ownerUUID =
|
||||
await StorageHelper().get(KeychainStorageKey.ownerUUID.value);
|
||||
final bool haveCli = cliUUID != null && cliUUID.isNotEmpty;
|
||||
final bool haveOwner = ownerUUID != null && ownerUUID.isNotEmpty;
|
||||
if (!haveCli && !haveOwner) {
|
||||
await update(context);
|
||||
await FirebaseMessagingService().updateDeviceToken();
|
||||
await update(context);
|
||||
await FirebaseMessagingService().updateDeviceToken();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Future<bool> _handleReponse(BuildContext context) async {
|
||||
bool response = false;
|
||||
final bool isUnselected = await remoteDataSource.checkLocals(context);
|
||||
|
@ -75,15 +78,17 @@ class LocalsRepositoryImpl implements LocalsRepository {
|
|||
}
|
||||
|
||||
Future<void> _notifyBlocs(BuildContext context) async {
|
||||
|
||||
context.read<LocalProfileBloc>().add(LocalProfileEvent());
|
||||
context.read<MenuBloc>().add(MenuEvent());
|
||||
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> unlinkLocal(BuildContext context) async {
|
||||
await remoteDataSource.detachLocal(context);
|
||||
await select(context);
|
||||
final bool response = await remoteDataSource.detachLocal(context);
|
||||
if (!response) return;
|
||||
await localDataSource.unlinkLocal();
|
||||
context.pop();
|
||||
context.go('/homePage', extra: {'update': update});
|
||||
await update(context);
|
||||
}
|
||||
}
|
||||
|
|
48
pubspec.lock
48
pubspec.lock
|
@ -5,10 +5,10 @@ packages:
|
|||
dependency: transitive
|
||||
description:
|
||||
name: _fe_analyzer_shared
|
||||
sha256: f256b0c0ba6c7577c15e2e4e114755640a875e885099367bf6e012b19314c834
|
||||
sha256: "16e298750b6d0af7ce8a3ba7c18c69c3785d11b15ec83f6dcd0ad2a0009b3cab"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "72.0.0"
|
||||
version: "76.0.0"
|
||||
_flutterfire_internals:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -21,15 +21,15 @@ packages:
|
|||
dependency: transitive
|
||||
description: dart
|
||||
source: sdk
|
||||
version: "0.3.2"
|
||||
version: "0.3.3"
|
||||
analyzer:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: analyzer
|
||||
sha256: b652861553cd3990d8ed361f7979dc6d7053a9ac8843fa73820ab68ce5410139
|
||||
sha256: "1f14db053a8c23e260789e9b0980fa27f2680dd640932cae5e1137cce0e46e1e"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "6.7.0"
|
||||
version: "6.11.0"
|
||||
app_links:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
|
@ -274,10 +274,10 @@ packages:
|
|||
dependency: "direct main"
|
||||
description:
|
||||
name: collection
|
||||
sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a
|
||||
sha256: a1ace0a119f20aabc852d165077c036cd864315bd99b7eaa10a60100341941bf
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.18.0"
|
||||
version: "1.19.0"
|
||||
convert:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -1013,18 +1013,18 @@ packages:
|
|||
dependency: transitive
|
||||
description:
|
||||
name: leak_tracker
|
||||
sha256: "3f87a60e8c63aecc975dda1ceedbc8f24de75f09e4856ea27daf8958f2f0ce05"
|
||||
sha256: "7bb2830ebd849694d1ec25bf1f44582d6ac531a57a365a803a6034ff751d2d06"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "10.0.5"
|
||||
version: "10.0.7"
|
||||
leak_tracker_flutter_testing:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: leak_tracker_flutter_testing
|
||||
sha256: "932549fb305594d82d7183ecd9fa93463e9914e1b67cacc34bc40906594a1806"
|
||||
sha256: "9491a714cca3667b60b5c420da8217e6de0d1ba7a5ec322fab01758f6998f379"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.0.5"
|
||||
version: "3.0.8"
|
||||
leak_tracker_testing:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -1093,10 +1093,10 @@ packages:
|
|||
dependency: transitive
|
||||
description:
|
||||
name: macros
|
||||
sha256: "0acaed5d6b7eab89f63350bccd82119e6c602df0f391260d0e32b5e23db79536"
|
||||
sha256: "1d9e801cd66f7ea3663c45fc708450db1fa57f988142c64289142c9b7ee80656"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.1.2-main.4"
|
||||
version: "0.1.3-main.0"
|
||||
matcher:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -1541,7 +1541,7 @@ packages:
|
|||
dependency: transitive
|
||||
description: flutter
|
||||
source: sdk
|
||||
version: "0.0.99"
|
||||
version: "0.0.0"
|
||||
source_gen:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -1618,10 +1618,10 @@ packages:
|
|||
dependency: transitive
|
||||
description:
|
||||
name: stack_trace
|
||||
sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b"
|
||||
sha256: "9f47fd3630d76be3ab26f0ee06d213679aa425996925ff3feffdec504931c377"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.11.1"
|
||||
version: "1.12.0"
|
||||
state_notifier:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -1650,10 +1650,10 @@ packages:
|
|||
dependency: transitive
|
||||
description:
|
||||
name: string_scanner
|
||||
sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde"
|
||||
sha256: "688af5ed3402a4bde5b3a6c15fd768dbf2621a614950b17f04626c431ab3c4c3"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.2.0"
|
||||
version: "1.3.0"
|
||||
sync_http:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -1682,10 +1682,10 @@ packages:
|
|||
dependency: transitive
|
||||
description:
|
||||
name: test_api
|
||||
sha256: "5b8a98dafc4d5c4c9c72d8b31ab2b23fc13422348d2997120294d3bac86b4ddb"
|
||||
sha256: "664d3a9a64782fcdeb83ce9c6b39e78fd2971d4e37827b9b06c3aa1edc5e760c"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.7.2"
|
||||
version: "0.7.3"
|
||||
timeago:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
|
@ -1818,10 +1818,10 @@ packages:
|
|||
dependency: transitive
|
||||
description:
|
||||
name: vm_service
|
||||
sha256: "5c5f338a667b4c644744b661f309fb8080bb94b18a7e91ef1dbd343bed00ed6d"
|
||||
sha256: f6be3ed8bd01289b34d679c2b62226f63c0e69f9fd2e50a6b3c1c729a961041b
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "14.2.5"
|
||||
version: "14.3.0"
|
||||
watcher:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -1858,10 +1858,10 @@ packages:
|
|||
dependency: transitive
|
||||
description:
|
||||
name: webdriver
|
||||
sha256: "003d7da9519e1e5f329422b36c4dcdf18d7d2978d1ba099ea4e45ba490ed845e"
|
||||
sha256: "3d773670966f02a646319410766d3b5e1037efb7f07cc68f844d5e06cd4d61c8"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.0.3"
|
||||
version: "3.0.4"
|
||||
webview_flutter:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
|
|
|
@ -20,7 +20,7 @@ dependencies:
|
|||
flutter_inappwebview: ^6.0.0
|
||||
webview_flutter: ^4.8.0
|
||||
rxdart: ^0.28.0
|
||||
collection: 1.18.0
|
||||
collection: ^1.19.0
|
||||
app_links: ^6.3.2
|
||||
# crop_your_image: 1.1.0
|
||||
csv: 6.0.0
|
||||
|
|
Loading…
Reference in New Issue