Skip to content

Commit

Permalink
Support flutter 3.10.0
Browse files Browse the repository at this point in the history
Signed-off-by: Joel Jothiprakasam <[email protected]>
  • Loading branch information
jjoelj committed May 16, 2023
1 parent 2315b80 commit 13a1479
Show file tree
Hide file tree
Showing 31 changed files with 93 additions and 96 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ class CustomBouncingScrollPhysics extends ScrollPhysics {

@override
Simulation? createBallisticSimulation(ScrollMetrics position, double velocity) {
final Tolerance tolerance = this.tolerance;
final Tolerance tolerance = toleranceFor(position);
if (velocity.abs() >= tolerance.velocity || position.outOfRange) {
return BouncingScrollSimulation(
spring: spring,
Expand Down
13 changes: 6 additions & 7 deletions lib/app/layouts/chat_creator/chat_creator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import 'package:bluebubbles/app/wrappers/stateful_boilerplate.dart';
import 'package:bluebubbles/main.dart';
import 'package:bluebubbles/models/models.dart';
import 'package:bluebubbles/services/services.dart';
import 'package:collection/collection.dart';
import 'package:dio/dio.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/foundation.dart';
Expand Down Expand Up @@ -425,22 +424,22 @@ class ChatCreatorState extends OptimizedState<ChatCreator> {
fillColor: context.theme.colorScheme.bubble(context, iMessage).withOpacity(0.2),
splashColor: context.theme.colorScheme.bubble(context, iMessage).withOpacity(0.2),
children: [
Row(
const Row(
children: [
const Padding(
Padding(
padding: EdgeInsets.all(8.0),
child: Text("iMessage"),
),
const Icon(CupertinoIcons.chat_bubble, size: 16),
Icon(CupertinoIcons.chat_bubble, size: 16),
],
),
Row(
const Row(
children: [
const Padding(
Padding(
padding: EdgeInsets.all(8.0),
child: Text("SMS Forwarding"),
),
const Icon(Icons.messenger_outline, size: 16),
Icon(Icons.messenger_outline, size: 16),
],
),
],
Expand Down
12 changes: 6 additions & 6 deletions lib/app/layouts/conversation_list/pages/search/search_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -261,22 +261,22 @@ class SearchViewState extends OptimizedState<SearchView> {
fillColor: context.theme.colorScheme.primary.withOpacity(0.2),
splashColor: context.theme.colorScheme.primary.withOpacity(0.2),
children: [
Row(
const Row(
children: [
const Padding(
Padding(
padding: EdgeInsets.all(8.0),
child: Text("Search Device"),
),
const Icon(Icons.storage_outlined, size: 16),
Icon(Icons.storage_outlined, size: 16),
],
),
Row(
const Row(
children: [
const Padding(
Padding(
padding: EdgeInsets.all(8.0),
child: Text("Search Mac"),
),
const Icon(Icons.cloud_outlined, size: 16),
Icon(Icons.cloud_outlined, size: 16),
],
),
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import 'package:bluebubbles/app/layouts/settings/settings_page.dart';
import 'package:bluebubbles/app/layouts/setup/setup_view.dart';
import 'package:bluebubbles/app/wrappers/theme_switcher.dart';
import 'package:bluebubbles/app/wrappers/titlebar_wrapper.dart';
import 'package:bluebubbles/main.dart';
import 'package:bluebubbles/models/models.dart';
import 'package:bluebubbles/services/services.dart';
import 'package:flutter/foundation.dart';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import 'package:bluebubbles/helpers/helpers.dart';
import 'package:bluebubbles/helpers/ui/theme_helpers.dart';
import 'package:bluebubbles/app/layouts/conversation_list/pages/conversation_list.dart';
import 'package:bluebubbles/app/layouts/conversation_list/widgets/header/header_widgets.dart';
import 'package:bluebubbles/app/layouts/conversation_list/pages/search/search_view.dart';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import 'package:bluebubbles/app/wrappers/stateful_boilerplate.dart';
import 'package:bluebubbles/main.dart';
import 'package:bluebubbles/models/models.dart';
import 'package:bluebubbles/services/services.dart';
import 'package:collection/collection.dart';
import 'package:faker/faker.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ class CupertinoHeader extends StatelessWidget implements PreferredSizeWidget {
return;
}
controller.close();
while (Get.isOverlaysOpen) {
Get.back();
if (Get.isSnackbarOpen) {
Get.closeAllSnackbars();
}
Navigator.of(context).pop();
},
Expand All @@ -73,8 +73,8 @@ class CupertinoHeader extends StatelessWidget implements PreferredSizeWidget {
return;
}
controller.close();
while (Get.isOverlaysOpen) {
Get.back();
if (Get.isSnackbarOpen) {
Get.closeAllSnackbars();
}
Navigator.of(context).pop();
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,8 @@ class MaterialHeader extends StatelessWidget implements PreferredSizeWidget {
);
} else if (value == 1) {
controller.chat.toggleArchived(!controller.chat.isArchived!);
while (Get.isOverlaysOpen) {
Get.back();
if (Get.isSnackbarOpen) {
Get.closeAllSnackbars();
}
Navigator.of(context).pop();
} else if (value == 2) {
Expand All @@ -144,8 +144,8 @@ class MaterialHeader extends StatelessWidget implements PreferredSizeWidget {
TextButton(
child: Text("No", style: context.theme.textTheme.bodyLarge!.copyWith(color: context.theme.colorScheme.primary)),
onPressed: () {
while (Get.isOverlaysOpen) {
Get.back();
if (Get.isSnackbarOpen) {
Get.closeAllSnackbars();
}
Navigator.of(context).pop();
},
Expand All @@ -155,8 +155,8 @@ class MaterialHeader extends StatelessWidget implements PreferredSizeWidget {
onPressed: () async {
chats.removeChat(controller.chat);
Chat.softDelete(controller.chat);
while (Get.isOverlaysOpen) {
Get.back();
if (Get.isSnackbarOpen) {
Get.closeAllSnackbars();
}
Navigator.of(context).pop();
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import 'package:bluebubbles/app/wrappers/stateful_boilerplate.dart';
import 'package:bluebubbles/helpers/ui/theme_helpers.dart';
import 'package:bluebubbles/models/models.dart';
import 'package:bluebubbles/services/services.dart';
import 'package:collection/collection.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import 'package:bluebubbles/app/wrappers/theme_switcher.dart';
import 'package:bluebubbles/models/global/platform_file.dart';
import 'package:bluebubbles/services/services.dart';
import 'package:chunked_stream/chunked_stream.dart';
import 'package:collection/collection.dart';
import 'package:file_picker/file_picker.dart' hide PlatformFile;
import 'package:file_picker/file_picker.dart' as pf;
import 'package:flex_color_picker/flex_color_picker.dart';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import 'package:bluebubbles/app/wrappers/stateful_boilerplate.dart';
import 'package:bluebubbles/helpers/helpers.dart';
import 'package:bluebubbles/models/models.dart';
import 'package:bluebubbles/services/services.dart';
import 'package:collection/collection.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ class _MessagePopupState extends OptimizedState<MessagePopup> with SingleTickerP
List<Message> reactions = [];
late double messageOffset = Get.height - widget.childPosition.dy - widget.size.height;
late double materialOffset = widget.childPosition.dy +
EdgeInsets.fromWindowPadding(
WidgetsBinding.instance.window.viewInsets,
WidgetsBinding.instance.window.devicePixelRatio,
EdgeInsets.fromViewPadding(
View.of(context).viewInsets,
View.of(context).devicePixelRatio,
).bottom;
late int numberToShow = 5;
late Chat? dmChat = chats.chats
Expand Down Expand Up @@ -756,7 +756,7 @@ class _MessagePopupState extends OptimizedState<MessagePopup> with SingleTickerP
: TextButton(
child: Text("Close", style: context.theme.textTheme.bodyLarge!.copyWith(color: Get.context!.theme.colorScheme.primary)),
onPressed: () async {
if (Get.isSnackbarOpen ?? false) {
if (Get.isSnackbarOpen) {
Get.close(1);
}
Navigator.of(context).pop();
Expand Down Expand Up @@ -837,7 +837,7 @@ class _MessagePopupState extends OptimizedState<MessagePopup> with SingleTickerP
: TextButton(
child: Text("Close", style: context.theme.textTheme.bodyLarge!.copyWith(color: Get.context!.theme.colorScheme.primary)),
onPressed: () async {
if (Get.isSnackbarOpen ?? false) {
if (Get.isSnackbarOpen) {
Get.close(1);
}
Navigator.of(context).pop();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import 'dart:ui';

import 'package:bluebubbles/app/layouts/conversation_view/widgets/message/popup/message_popup.dart';
import 'package:bluebubbles/app/wrappers/stateful_boilerplate.dart';
import 'package:bluebubbles/helpers/helpers.dart';
Expand Down Expand Up @@ -43,7 +41,7 @@ class _MessagePopupHolderState extends OptimizedState<MessagePopupHolder> {
final size = globalKey.currentContext?.size;
Offset? childPos = (globalKey.currentContext?.findRenderObject() as RenderBox?)?.localToGlobal(Offset.zero);
if (size == null || childPos == null) return;
childPos = Offset(childPos.dx - MediaQueryData.fromWindow(window).padding.left, childPos.dy);
childPos = Offset(childPos.dx - MediaQueryData.fromView(View.of(context)).padding.left, childPos.dy);
final tuple = await ss.getServerDetails();
final version = tuple.item4;
final minSierra = await ss.isMinSierra;
Expand Down
3 changes: 2 additions & 1 deletion lib/app/layouts/settings/pages/misc/about_panel.dart
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,8 @@ class _AboutPanelState extends OptimizedState<AboutPanel> {
child: SingleChildScrollView(
child: DataTable(
columnSpacing: 5,
dataRowHeight: 75,
dataRowMinHeight: 75,
dataRowMaxHeight: 75,
dataTextStyle: context.theme.textTheme.bodyLarge,
headingTextStyle: context.theme.textTheme.bodyLarge!.copyWith(fontStyle: FontStyle.italic),
columns: const <DataColumn>[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import 'package:bluebubbles/app/layouts/settings/widgets/settings_widgets.dart';
import 'package:bluebubbles/models/models.dart';
import 'package:bluebubbles/app/wrappers/stateful_boilerplate.dart';
import 'package:bluebubbles/services/services.dart';
import 'package:collection/collection.dart';
import 'package:dio/dio.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import 'package:bluebubbles/models/models.dart';
import 'package:bluebubbles/services/services.dart';
import 'package:bluebubbles/utils/logger.dart';
import 'package:bluebubbles/utils/share.dart';
import 'package:collection/collection.dart';
import 'package:device_info_plus/device_info_plus.dart';
import 'package:dio/dio.dart';
import 'package:file_picker/file_picker.dart';
Expand Down
2 changes: 1 addition & 1 deletion lib/app/layouts/settings/pages/theming/theming_panel.dart
Original file line number Diff line number Diff line change
Expand Up @@ -656,7 +656,7 @@ class _ThemingPanelState extends CustomState<ThemingPanel, void, ThemingPanelCon
: TextButton(
child: Text("Close", style: context.theme.textTheme.bodyLarge!.copyWith(color: context.theme.colorScheme.primary)),
onPressed: () async {
if (Get.isSnackbarOpen ?? false) {
if (Get.isSnackbarOpen) {
Get.close(1);
}
Get.back();
Expand Down
2 changes: 1 addition & 1 deletion lib/app/layouts/settings/settings_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -706,7 +706,7 @@ class _SettingsPageState extends OptimizedState<SettingsPage> {
backgroundColor: tileColor,
onTap: () async {
void closeDialog() {
if (Get.isSnackbarOpen ?? false) {
if (Get.isSnackbarOpen) {
Get.close(1);
}
Navigator.of(context).pop();
Expand Down
1 change: 0 additions & 1 deletion lib/helpers/types/helpers/contact_helpers.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import 'package:bluebubbles/helpers/helpers.dart';
import 'package:bluebubbles/models/models.dart';
import 'package:collection/collection.dart';
import 'package:get/get.dart';
import 'package:libphonenumber_plugin/libphonenumber_plugin.dart';

Expand Down
25 changes: 12 additions & 13 deletions lib/helpers/ui/ui_helpers.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import 'package:bluebubbles/utils/logger.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/scheduler.dart';
import 'package:flutter/services.dart';
import 'package:gesture_x_detector/gesture_x_detector.dart';
import 'package:get/get.dart';
Expand All @@ -29,8 +28,8 @@ class BackButton extends StatelessWidget {
onTap: !kIsDesktop ? null : (details) {
final result = onPressed?.call() ?? false;
if (!result) {
while (Get.isOverlaysOpen) {
Get.back();
if (Get.isSnackbarOpen) {
Get.closeAllSnackbars();
}
Navigator.of(context).pop();
}
Expand All @@ -44,8 +43,8 @@ class BackButton extends StatelessWidget {
onPressed: kIsDesktop ? null : () {
final result = onPressed?.call() ?? false;
if (!result) {
while (Get.isOverlaysOpen) {
Get.back();
if (Get.isSnackbarOpen) {
Get.closeAllSnackbars();
}
Navigator.of(context).pop();
}
Expand All @@ -65,8 +64,8 @@ Widget buildBackButton(BuildContext context, {EdgeInsets padding = EdgeInsets.ze
onTap: !kIsDesktop ? null : (details) {
final result = callback?.call() ?? true;
if (result) {
while (Get.isOverlaysOpen) {
Get.back();
if (Get.isSnackbarOpen) {
Get.closeAllSnackbars();
}
Navigator.of(context).pop();
}
Expand All @@ -81,8 +80,8 @@ Widget buildBackButton(BuildContext context, {EdgeInsets padding = EdgeInsets.ze
if (kIsDesktop) return;
final result = callback?.call() ?? true;
if (result) {
while (Get.isOverlaysOpen) {
Get.back();
if (Get.isSnackbarOpen) {
Get.closeAllSnackbars();
}
Navigator.of(context).pop();
}
Expand Down Expand Up @@ -356,7 +355,7 @@ IconData getAttachmentIcon(String mimeType) {
}

void showSnackbar(String title, String message,
{int animationMs = 250, int durationMs = 1500, Function(GetBar)? onTap, TextButton? button}) {
{int animationMs = 250, int durationMs = 1500, Function(GetSnackBar)? onTap, TextButton? button}) {
Get.snackbar(title, message,
snackPosition: SnackPosition.BOTTOM,
colorText: Get.theme.colorScheme.onInverseSurface,
Expand All @@ -368,8 +367,8 @@ void showSnackbar(String title, String message,
animationDuration: Duration(milliseconds: animationMs),
mainButton: button,
onTap: onTap ??
(GetBar bar) {
if (Get.isSnackbarOpen ?? false) Get.back();
(GetSnackBar bar) {
if (Get.isSnackbarOpen) Get.back();
});
}

Expand Down Expand Up @@ -420,7 +419,7 @@ Future<void> paintGroupAvatar({
required bool usingParticipantsOverride,
}) async {
late final ThemeData theme;
final bool systemDark = SchedulerBinding.instance.window.platformBrightness == Brightness.dark;
final bool systemDark = PlatformDispatcher.instance.platformBrightness == Brightness.dark;
if (!ls.isAlive) {
if (systemDark) {
theme = ThemeStruct.getDarkTheme().data;
Expand Down
2 changes: 1 addition & 1 deletion lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ Future<Null> initApp(bool bubble, List<String> arguments) async {
home: SplashScreen(shouldNavigate: false),
theme: ThemeData(
colorScheme: ColorScheme.fromSwatch(
backgroundColor: SchedulerBinding.instance.window.platformBrightness == Brightness.dark ? Colors.black : Colors.white),
backgroundColor: PlatformDispatcher.instance.platformBrightness == Brightness.dark ? Colors.black : Colors.white),
)));
}

Expand Down
3 changes: 1 addition & 2 deletions lib/models/html/handle.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import 'package:bluebubbles/helpers/helpers.dart';
import 'package:bluebubbles/models/html/contact.dart';
import 'package:bluebubbles/models/html/objectbox.dart';
import 'package:bluebubbles/services/services.dart';
import 'package:collection/collection.dart';
import 'package:faker/faker.dart';
import 'package:get/get.dart';
import 'package:tuple/tuple.dart';
Expand Down Expand Up @@ -48,7 +47,7 @@ class Handle {
// Split by a space or special character delimiter, take each of the items and
// reduce it to just the capitalized first letter. Then join the array by an empty char
String reduced = importantChars
.split(RegExp(r' |-|_'))
.split(RegExp(r'[ \-_]'))
.take(2)
.map((e) => e.isEmpty ? '' : e[0].toUpperCase())
.join('');
Expand Down
1 change: 0 additions & 1 deletion lib/services/network/socket_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import 'package:bluebubbles/utils/crypto_utils.dart';
import 'package:bluebubbles/utils/logger.dart';
import 'package:bluebubbles/helpers/helpers.dart';
import 'package:bluebubbles/services/services.dart';
import 'package:collection/collection.dart';
import 'package:connectivity_plus/connectivity_plus.dart';
import 'package:flutter/foundation.dart';
import 'package:get/get.dart';
Expand Down
1 change: 0 additions & 1 deletion lib/services/ui/attachments_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import 'package:bluebubbles/models/models.dart';
import 'package:bluebubbles/services/services.dart';
import 'package:bluebubbles/helpers/helpers.dart';
import 'package:bluebubbles/utils/logger.dart';
import 'package:collection/collection.dart';
import 'package:connectivity_plus/connectivity_plus.dart';
import 'package:exif/exif.dart';
import 'package:file_picker/file_picker.dart' hide PlatformFile;
Expand Down
Loading

0 comments on commit 13a1479

Please sign in to comment.