Skip to content

Commit

Permalink
Set default floatingButtonOffset based on platform
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidMina96 committed Mar 19, 2023
1 parent 35bdf17 commit 79d354f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 3 additions & 1 deletion example/lib/providers/bug_reporting_state.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import 'dart:io';

import 'package:flutter/material.dart';

import 'package:instabug_flutter/instabug_flutter.dart';
Expand Down Expand Up @@ -70,7 +72,7 @@ class BugReportingState with ChangeNotifier {
notifyListeners();
}

var _floatingButtonOffset = 100;
var _floatingButtonOffset = Platform.isIOS ? 100 : 250;
int get floatingButtonOffset => _floatingButtonOffset;
set floatingButtonOffset(int offset) {
_floatingButtonOffset = offset;
Expand Down
5 changes: 4 additions & 1 deletion example/lib/screens/bug_reporting_screen.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import 'dart:io';

import 'package:flutter/material.dart';
import 'package:provider/provider.dart';

Expand Down Expand Up @@ -283,7 +285,8 @@ class BugReportingScreen extends StatelessWidget {
enableInteractiveSelection: true,
onChanged: (value) {
if (value.isEmpty) {
state.floatingButtonOffset = 100;
state.floatingButtonOffset =
Platform.isIOS ? 100 : 250;
} else {
state.floatingButtonOffset = int.parse(value);
}
Expand Down

0 comments on commit 79d354f

Please sign in to comment.