diff --git a/lib/redux/app/app_reducer.dart b/lib/redux/app/app_reducer.dart index 473819c475..d6bff13ad9 100644 --- a/lib/redux/app/app_reducer.dart +++ b/lib/redux/app/app_reducer.dart @@ -67,8 +67,6 @@ AppState appReducer(AppState state, dynamic action) { return state.rebuild((b) => b ..isLoading = loadingReducer(state.isLoading, action) ..isSaving = savingReducer(state.isSaving, action) - ..dismissedFlutterWebWarning = dismissedFlutterWebWarningReducer( - state.dismissedFlutterWebWarning, action) ..lastError = lastErrorReducer(state.lastError, action) ..authState.replace(authReducer(state.authState, action)) ..staticState.replace(staticReducer(state.staticState, action)) @@ -165,12 +163,3 @@ final lastErrorReducer = combineReducers([ return '${action.error}'; }), ]); - -final dismissedFlutterWebWarningReducer = combineReducers([ - TypedReducer((state, action) { - return true; - }), - TypedReducer((state, action) { - return true; - }), -]); diff --git a/lib/redux/app/app_state.dart b/lib/redux/app/app_state.dart index c0224e8e32..246a6b030d 100644 --- a/lib/redux/app/app_state.dart +++ b/lib/redux/app/app_state.dart @@ -93,7 +93,6 @@ abstract class AppState implements Built { isSaving: false, isTesting: false, isWhiteLabeled: isWhiteLabeled, - dismissedFlutterWebWarning: false, lastError: '', authState: AuthState( url: url, @@ -126,8 +125,6 @@ abstract class AppState implements Built { bool get isWhiteLabeled; - bool get dismissedFlutterWebWarning; - String get lastError; AuthState get authState; diff --git a/lib/redux/app/app_state.g.dart b/lib/redux/app/app_state.g.dart index d9e5844223..898b0458f4 100644 --- a/lib/redux/app/app_state.g.dart +++ b/lib/redux/app/app_state.g.dart @@ -30,9 +30,6 @@ class _$AppStateSerializer implements StructuredSerializer { 'isWhiteLabeled', serializers.serialize(object.isWhiteLabeled, specifiedType: const FullType(bool)), - 'dismissedFlutterWebWarning', - serializers.serialize(object.dismissedFlutterWebWarning, - specifiedType: const FullType(bool)), 'lastError', serializers.serialize(object.lastError, specifiedType: const FullType(String)), @@ -84,10 +81,6 @@ class _$AppStateSerializer implements StructuredSerializer { result.isWhiteLabeled = serializers.deserialize(value, specifiedType: const FullType(bool))! as bool; break; - case 'dismissedFlutterWebWarning': - result.dismissedFlutterWebWarning = serializers.deserialize(value, - specifiedType: const FullType(bool))! as bool; - break; case 'lastError': result.lastError = serializers.deserialize(value, specifiedType: const FullType(String))! as String; @@ -131,8 +124,6 @@ class _$AppState extends AppState { @override final bool isWhiteLabeled; @override - final bool dismissedFlutterWebWarning; - @override final String lastError; @override final AuthState authState; @@ -153,7 +144,6 @@ class _$AppState extends AppState { required this.isSaving, required this.isTesting, required this.isWhiteLabeled, - required this.dismissedFlutterWebWarning, required this.lastError, required this.authState, required this.staticState, @@ -166,8 +156,6 @@ class _$AppState extends AppState { BuiltValueNullFieldError.checkNotNull(isTesting, r'AppState', 'isTesting'); BuiltValueNullFieldError.checkNotNull( isWhiteLabeled, r'AppState', 'isWhiteLabeled'); - BuiltValueNullFieldError.checkNotNull( - dismissedFlutterWebWarning, r'AppState', 'dismissedFlutterWebWarning'); BuiltValueNullFieldError.checkNotNull(lastError, r'AppState', 'lastError'); BuiltValueNullFieldError.checkNotNull(authState, r'AppState', 'authState'); BuiltValueNullFieldError.checkNotNull( @@ -193,7 +181,6 @@ class _$AppState extends AppState { isSaving == other.isSaving && isTesting == other.isTesting && isWhiteLabeled == other.isWhiteLabeled && - dismissedFlutterWebWarning == other.dismissedFlutterWebWarning && lastError == other.lastError && authState == other.authState && staticState == other.staticState && @@ -211,7 +198,6 @@ class _$AppState extends AppState { _$hash = $jc(_$hash, isSaving.hashCode); _$hash = $jc(_$hash, isTesting.hashCode); _$hash = $jc(_$hash, isWhiteLabeled.hashCode); - _$hash = $jc(_$hash, dismissedFlutterWebWarning.hashCode); _$hash = $jc(_$hash, lastError.hashCode); _$hash = $jc(_$hash, authState.hashCode); _$hash = $jc(_$hash, staticState.hashCode); @@ -243,11 +229,6 @@ class AppStateBuilder implements Builder { set isWhiteLabeled(bool? isWhiteLabeled) => _$this._isWhiteLabeled = isWhiteLabeled; - bool? _dismissedFlutterWebWarning; - bool? get dismissedFlutterWebWarning => _$this._dismissedFlutterWebWarning; - set dismissedFlutterWebWarning(bool? dismissedFlutterWebWarning) => - _$this._dismissedFlutterWebWarning = dismissedFlutterWebWarning; - String? _lastError; String? get lastError => _$this._lastError; set lastError(String? lastError) => _$this._lastError = lastError; @@ -287,7 +268,6 @@ class AppStateBuilder implements Builder { _isSaving = $v.isSaving; _isTesting = $v.isTesting; _isWhiteLabeled = $v.isWhiteLabeled; - _dismissedFlutterWebWarning = $v.dismissedFlutterWebWarning; _lastError = $v.lastError; _authState = $v.authState.toBuilder(); _staticState = $v.staticState.toBuilder(); @@ -326,10 +306,6 @@ class AppStateBuilder implements Builder { isTesting, r'AppState', 'isTesting'), isWhiteLabeled: BuiltValueNullFieldError.checkNotNull( isWhiteLabeled, r'AppState', 'isWhiteLabeled'), - dismissedFlutterWebWarning: BuiltValueNullFieldError.checkNotNull( - dismissedFlutterWebWarning, - r'AppState', - 'dismissedFlutterWebWarning'), lastError: BuiltValueNullFieldError.checkNotNull( lastError, r'AppState', 'lastError'), authState: authState.build(), diff --git a/lib/ui/app/important_message_banner.dart b/lib/ui/app/important_message_banner.dart index 3a7ce3463e..91fb43aa08 100644 --- a/lib/ui/app/important_message_banner.dart +++ b/lib/ui/app/important_message_banner.dart @@ -42,6 +42,7 @@ class _ImportantMessageBannerState extends State { @override Widget build(BuildContext context) { final store = StoreProvider.of(context); + final state = store.state; final localization = AppLocalization.of(context)!; final calculatedLayout = calculateLayout(context); @@ -49,13 +50,14 @@ class _ImportantMessageBannerState extends State { String? messageType; if (!_dismissedMessage.containsKey(MESSAGE_TYPE_FLUTTER_WEB)) { - if (kIsWeb || !kReleaseMode) { + if ((kIsWeb && !state.prefState.hideFlutterWebWarning) || !kReleaseMode) { //message = localization.flutterWebWarning; //messageType = MESSAGE_TYPE_FLUTTER_WEB; } } - if (!_dismissedMessage.containsKey(MESSAGE_TYPE_LAYOUT)) { + if (message == null && + !_dismissedMessage.containsKey(MESSAGE_TYPE_LAYOUT)) { if (widget.appLayout == AppLayout.mobile && widget.suggestedLayout == AppLayout.mobile && calculatedLayout == AppLayout.desktop) { @@ -98,27 +100,28 @@ class _ImportantMessageBannerState extends State { setState(() => _dismissedMessage[messageType!] = true); }, ), - AppTextButton( - label: localization.change, - color: Colors.white, - onPressed: () { - final layout = - widget.suggestedLayout == AppLayout.desktop - ? AppLayout.mobile - : AppLayout.desktop; - store - .dispatch(UpdateUserPreferences(appLayout: layout)); - AppBuilder.of(context)!.rebuild(); - WidgetsBinding.instance - .addPostFrameCallback((duration) { - if (layout == AppLayout.mobile) { - store.dispatch(ViewDashboard()); - } else { - store.dispatch(ViewMainScreen(addDelay: true)); - } - }); - }, - ), + if (messageType == MESSAGE_TYPE_LAYOUT) + AppTextButton( + label: localization.change, + color: Colors.white, + onPressed: () { + final layout = + widget.suggestedLayout == AppLayout.desktop + ? AppLayout.mobile + : AppLayout.desktop; + store.dispatch( + UpdateUserPreferences(appLayout: layout)); + AppBuilder.of(context)!.rebuild(); + WidgetsBinding.instance + .addPostFrameCallback((duration) { + if (layout == AppLayout.mobile) { + store.dispatch(ViewDashboard()); + } else { + store.dispatch(ViewMainScreen(addDelay: true)); + } + }); + }, + ), ], ), ), diff --git a/lib/ui/invoice/edit/invoice_edit_desktop.dart b/lib/ui/invoice/edit/invoice_edit_desktop.dart index e6ea57c16b..acdac05008 100644 --- a/lib/ui/invoice/edit/invoice_edit_desktop.dart +++ b/lib/ui/invoice/edit/invoice_edit_desktop.dart @@ -270,7 +270,7 @@ class InvoiceEditDesktopState extends State Flexible( flex: 3, child: Column( - key: ValueKey('__invoice_${invoice.id}_${invoice.updatedAt}__'), + key: ValueKey('__invoice_${invoice.id}__'), children: [ Row( crossAxisAlignment: CrossAxisAlignment.start, @@ -456,7 +456,8 @@ class InvoiceEditDesktopState extends State }, ), DatePicker( - key: ValueKey('__terms_${client.id}__'), + key: ValueKey( + '__due_date_${client.id}_${invoice.updatedAt}__'), labelText: entityType == EntityType.invoice || entityType == EntityType.purchaseOrder ? localization.dueDate