Skip to content

Commit

Permalink
Disable Flutter warning
Browse files Browse the repository at this point in the history
  • Loading branch information
hillelcoren committed Apr 11, 2024
1 parent 0beb722 commit 5bccbc4
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 61 deletions.
11 changes: 0 additions & 11 deletions lib/redux/app/app_reducer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -165,12 +163,3 @@ final lastErrorReducer = combineReducers<String>([
return '${action.error}';
}),
]);

final dismissedFlutterWebWarningReducer = combineReducers<bool>([
TypedReducer<bool, DismissFlutterWebWarning>((state, action) {
return true;
}),
TypedReducer<bool, DismissFlutterWebWarningPermanently>((state, action) {
return true;
}),
]);
3 changes: 0 additions & 3 deletions lib/redux/app/app_state.dart
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ abstract class AppState implements Built<AppState, AppStateBuilder> {
isSaving: false,
isTesting: false,
isWhiteLabeled: isWhiteLabeled,
dismissedFlutterWebWarning: false,
lastError: '',
authState: AuthState(
url: url,
Expand Down Expand Up @@ -126,8 +125,6 @@ abstract class AppState implements Built<AppState, AppStateBuilder> {

bool get isWhiteLabeled;

bool get dismissedFlutterWebWarning;

String get lastError;

AuthState get authState;
Expand Down
24 changes: 0 additions & 24 deletions lib/redux/app/app_state.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

49 changes: 26 additions & 23 deletions lib/ui/app/important_message_banner.dart
Original file line number Diff line number Diff line change
Expand Up @@ -42,20 +42,22 @@ class _ImportantMessageBannerState extends State<ImportantMessageBanner> {
@override
Widget build(BuildContext context) {
final store = StoreProvider.of<AppState>(context);
final state = store.state;
final localization = AppLocalization.of(context)!;

final calculatedLayout = calculateLayout(context);
String? message;
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) {
Expand Down Expand Up @@ -98,27 +100,28 @@ class _ImportantMessageBannerState extends State<ImportantMessageBanner> {
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));
}
});
},
),
],
),
),
Expand Down

0 comments on commit 5bccbc4

Please sign in to comment.