Merge pull request #1521 from krille-chan/krille/fix-analyzer-warnings-new-flutter

refactor: Fix new lints coming with flutter 3.27
pull/1532/head
Krille-chan 7 months ago committed by GitHub
commit 73f448e40a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -1,2 +1,2 @@
FLUTTER_VERSION=3.24.5
FLUTTER_VERSION=3.27.0
JAVA_VERSION=17

@ -818,7 +818,9 @@ class ChatController extends State<ChatPageWithRoom>
for (final event in selectedEvents) {
if (!event.status.isSent) return false;
if (event.canRedact == false &&
!(clients!.any((cl) => event.senderId == cl!.userID))) return false;
!(clients!.any((cl) => event.senderId == cl!.userID))) {
return false;
}
}
return true;
}

@ -52,7 +52,7 @@ class ChatEmojiPicker extends StatelessWidget {
categoryViewConfig: CategoryViewConfig(
backspaceColor: theme.colorScheme.primary,
iconColor:
theme.colorScheme.primary.withOpacity(0.5),
theme.colorScheme.primary.withAlpha(128),
iconColorSelected: theme.colorScheme.primary,
indicatorColor: theme.colorScheme.primary,
),

@ -364,7 +364,7 @@ class ChatView extends StatelessWidget {
),
if (controller.dragging)
Container(
color: theme.scaffoldBackgroundColor.withOpacity(0.9),
color: theme.scaffoldBackgroundColor.withAlpha(230),
alignment: Alignment.center,
child: const Icon(
Icons.upload_outlined,

@ -5,7 +5,6 @@ import 'package:flutter_highlighter/flutter_highlighter.dart';
import 'package:flutter_highlighter/themes/shades-of-purple.dart';
import 'package:flutter_html/flutter_html.dart';
import 'package:flutter_html_table/flutter_html_table.dart';
import 'package:flutter_math_fork/flutter_math.dart';
import 'package:html/dom.dart' as dom;
import 'package:linkify/linkify.dart';
import 'package:matrix/matrix.dart';
@ -133,9 +132,6 @@ class HtmlMessage extends StatelessWidget {
extensions: [
RoomPillExtension(context, room, fontSize, linkColor),
CodeExtension(fontSize: fontSize),
MatrixMathExtension(
style: TextStyle(fontSize: fontSize, color: textColor),
),
const TableHtmlExtension(),
SpoilerExtension(textColor: textColor),
const ImageExtension(),
@ -331,39 +327,6 @@ class SpoilerExtension extends HtmlExtension {
}
}
class MatrixMathExtension extends HtmlExtension {
final TextStyle? style;
MatrixMathExtension({this.style});
@override
Set<String> get supportedTags => {'div'};
@override
bool matches(ExtensionContext context) {
if (context.elementName != 'div') return false;
final mathData = context.element?.attributes['data-mx-maths'];
return mathData != null;
}
@override
InlineSpan build(ExtensionContext context) {
final data = context.element?.attributes['data-mx-maths'] ?? '';
return WidgetSpan(
child: Math.tex(
data,
textStyle: style,
onErrorFallback: (e) {
Logs().d('Flutter math parse error', e);
return Text(
data,
style: style,
);
},
),
);
}
}
class CodeExtension extends HtmlExtension {
final double fontSize;

@ -39,7 +39,7 @@ class ReplyContent extends StatelessWidget {
return Material(
color: backgroundColor ??
theme.colorScheme.surface.withOpacity(ownMessage ? 0.2 : 0.33),
theme.colorScheme.surface.withAlpha(ownMessage ? 50 : 80),
borderRadius: borderRadius,
child: Row(
mainAxisSize: MainAxisSize.min,

@ -126,7 +126,7 @@ class PresenceAvatar extends StatelessWidget {
const statusMsgBubbleElevation = 6.0;
final statusMsgBubbleShadowColor = theme.colorScheme.surface;
final statusMsgBubbleColor = Colors.white.withOpacity(0.9);
final statusMsgBubbleColor = Colors.white.withAlpha(230);
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 8.0),
child: SizedBox(

@ -60,7 +60,9 @@ class DevicesSettingsController extends State<DevicesSettings> {
message: L10n.of(context).removeDevicesDescription,
isDestructive: true,
) ==
OkCancelResult.cancel) return;
OkCancelResult.cancel) {
return;
}
final matrix = Matrix.of(context);
final deviceIds = <String>[];
for (final userDevice in devices) {

@ -330,8 +330,6 @@ Map<PIPViewCorner, Offset> _calculateOffsets({
return Offset(left, bottom);
case PIPViewCorner.bottomRight:
return Offset(right, bottom);
default:
throw Exception('Not implemented.');
}
}

@ -14,13 +14,13 @@ class ImageViewerView extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.black.withOpacity(0.5),
backgroundColor: Colors.black.withAlpha(128),
extendBodyBehindAppBar: true,
appBar: AppBar(
elevation: 0,
leading: IconButton(
style: IconButton.styleFrom(
backgroundColor: Colors.black.withOpacity(0.5),
backgroundColor: Colors.black.withAlpha(128),
),
icon: const Icon(Icons.close),
onPressed: Navigator.of(context).pop,
@ -31,7 +31,7 @@ class ImageViewerView extends StatelessWidget {
actions: [
IconButton(
style: IconButton.styleFrom(
backgroundColor: Colors.black.withOpacity(0.5),
backgroundColor: Colors.black.withAlpha(128),
),
icon: const Icon(Icons.reply_outlined),
onPressed: controller.forwardAction,
@ -41,7 +41,7 @@ class ImageViewerView extends StatelessWidget {
const SizedBox(width: 8),
IconButton(
style: IconButton.styleFrom(
backgroundColor: Colors.black.withOpacity(0.5),
backgroundColor: Colors.black.withAlpha(128),
),
icon: const Icon(Icons.download_outlined),
onPressed: () => controller.saveFileAction(context),
@ -56,7 +56,7 @@ class ImageViewerView extends StatelessWidget {
child: Builder(
builder: (context) => IconButton(
style: IconButton.styleFrom(
backgroundColor: Colors.black.withOpacity(0.5),
backgroundColor: Colors.black.withAlpha(128),
),
onPressed: () => controller.shareFileAction(context),
tooltip: L10n.of(context).share,

@ -10,6 +10,7 @@ import 'package:fluffychat/config/setting_keys.dart';
import 'package:fluffychat/config/themes.dart';
import 'package:fluffychat/pages/chat/events/state_message.dart';
import 'package:fluffychat/utils/account_config.dart';
import 'package:fluffychat/utils/color_value.dart';
import 'package:fluffychat/widgets/avatar.dart';
import 'package:fluffychat/widgets/layouts/max_width_body.dart';
import 'package:fluffychat/widgets/matrix.dart';
@ -100,7 +101,7 @@ class SettingsStyleView extends StatelessWidget {
child: Tooltip(
message: color == null
? L10n.of(context).systemTheme
: '#${color.value.toRadixString(16).toUpperCase()}',
: '#${color.hexValue.toRadixString(16).toUpperCase()}',
child: InkWell(
borderRadius: BorderRadius.circular(colorPickerSize),
onTap: () => controller.setChatColor(color),

@ -0,0 +1,14 @@
import 'package:flutter/widgets.dart';
extension ColorValue on Color {
int get hexValue {
return _floatToInt8(a) << 24 |
_floatToInt8(r) << 16 |
_floatToInt8(g) << 8 |
_floatToInt8(b) << 0;
}
static int _floatToInt8(double x) {
return (x * 255.0).round() & 0xff;
}
}

@ -79,7 +79,7 @@ class _VideoRendererState extends State<VideoRenderer> {
filterQuality: FilterQuality.medium,
objectFit: widget.fit,
placeholderBuilder: (_) =>
Container(color: Colors.white.withOpacity(0.18)),
Container(color: Colors.white.withAlpha(45)),
);
},
);

@ -86,7 +86,6 @@ extension on SyncStatusUpdate {
case SyncStatus.processing:
case SyncStatus.cleaningUp:
case SyncStatus.finished:
default:
return L10n.of(context).synchronizingPleaseWait;
}
}

@ -35,7 +35,7 @@ class _FluffyChatErrorWidgetState extends State<FluffyChatErrorWidget> {
child: Placeholder(
child: Center(
child: Material(
color: Colors.white.withOpacity(0.9),
color: Colors.white.withAlpha(230),
borderRadius: BorderRadius.circular(8),
),
),

@ -78,7 +78,6 @@ extension on LogEvent {
case Level.debug:
return Colors.white;
case Level.verbose:
default:
return Colors.grey;
}
}

@ -56,13 +56,13 @@ class QrCodeViewer extends StatelessWidget {
final theme = Theme.of(context);
final inviteLink = 'https://matrix.to/#/$content';
return Scaffold(
backgroundColor: Colors.black.withOpacity(0.5),
backgroundColor: Colors.black.withAlpha(128),
extendBodyBehindAppBar: true,
appBar: AppBar(
elevation: 0,
leading: IconButton(
style: IconButton.styleFrom(
backgroundColor: Colors.black.withOpacity(0.5),
backgroundColor: Colors.black.withAlpha(128),
),
icon: const Icon(Icons.close),
onPressed: Navigator.of(context).pop,
@ -73,7 +73,7 @@ class QrCodeViewer extends StatelessWidget {
actions: [
IconButton(
style: IconButton.styleFrom(
backgroundColor: Colors.black.withOpacity(0.5),
backgroundColor: Colors.black.withAlpha(128),
),
icon: Icon(Icons.adaptive.share_outlined),
onPressed: () => FluffyShare.share(
@ -86,7 +86,7 @@ class QrCodeViewer extends StatelessWidget {
const SizedBox(width: 8),
IconButton(
style: IconButton.styleFrom(
backgroundColor: Colors.black.withOpacity(0.5),
backgroundColor: Colors.black.withAlpha(128),
),
icon: const Icon(Icons.download_outlined),
onPressed: () => _save(context),

@ -5,6 +5,8 @@ import 'package:dynamic_color/dynamic_color.dart';
import 'package:provider/provider.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:fluffychat/utils/color_value.dart';
class ThemeBuilder extends StatefulWidget {
final Widget Function(
BuildContext context,
@ -72,7 +74,7 @@ class ThemeController extends State<ThemeBuilder> {
} else {
await preferences.setInt(
widget.primaryColorSettingsKey,
newPrimaryColor.value,
newPrimaryColor.hexValue,
);
}
setState(() {

@ -5,23 +5,23 @@ 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"
_macros:
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"
animations:
dependency: "direct main"
description:
@ -178,10 +178,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"
colorize:
dependency: transitive
description:
@ -247,12 +247,13 @@ packages:
source: hosted
version: "1.0.8"
dart_webrtc:
dependency: transitive
dependency: "direct overridden"
description:
name: dart_webrtc
sha256: c664ad88d5646735753add421ee2118486c100febef5e92b7f59cdbabf6a51f6
url: "https://pub.dev"
source: hosted
path: "."
ref: f27d27c7af41ceeebe31b295af4fb38e7b4d793e
resolved-ref: f27d27c7af41ceeebe31b295af4fb38e7b4d793e
url: "https://github.com/flutter-webrtc/dart-webrtc.git"
source: git
version: "1.4.9"
dbus:
dependency: transitive
@ -597,14 +598,6 @@ packages:
url: "https://pub.dev"
source: hosted
version: "6.2.1"
flutter_math_fork:
dependency: "direct main"
description:
name: flutter_math_fork
sha256: "94bee4642892a94939af0748c6a7de0ff8318feee588379dcdfea7dc5cba06c8"
url: "https://pub.dev"
source: hosted
version: "0.7.2"
flutter_native_splash:
dependency: "direct dev"
description:
@ -702,14 +695,6 @@ packages:
url: "https://github.com/krille-chan/flutter_shortcuts.git"
source: git
version: "1.4.0"
flutter_svg:
dependency: transitive
description:
name: flutter_svg
sha256: "7b4ca6cf3304575fe9c8ec64813c8d02ee41d2afe60bcfe0678bcb5375d596a2"
url: "https://pub.dev"
source: hosted
version: "2.0.10+1"
flutter_test:
dependency: "direct dev"
description: flutter
@ -1062,18 +1047,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:
@ -1142,10 +1127,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"
markdown:
dependency: transitive
description:
@ -1298,14 +1283,6 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.9.0"
path_parsing:
dependency: transitive
description:
name: path_parsing
sha256: e3e67b1629e6f7e8100b367d3db6ba6af4b1f0bb80f64db18ef1fbabd2fa9ccf
url: "https://pub.dev"
source: hosted
version: "1.0.1"
path_provider:
dependency: "direct main"
description:
@ -1790,7 +1767,7 @@ packages:
dependency: transitive
description: flutter
source: sdk
version: "0.0.99"
version: "0.0.0"
slugify:
dependency: "direct main"
description:
@ -1875,10 +1852,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"
stream_channel:
dependency: transitive
description:
@ -1891,10 +1868,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"
string_validator:
dependency: transitive
description:
@ -1947,26 +1924,26 @@ packages:
dependency: transitive
description:
name: test
sha256: "7ee44229615f8f642b68120165ae4c2a75fe77ae2065b1e55ae4711f6cf0899e"
sha256: "713a8789d62f3233c46b4a90b174737b2c04cb6ae4500f2aa8b1be8f03f5e67f"
url: "https://pub.dev"
source: hosted
version: "1.25.7"
version: "1.25.8"
test_api:
dependency: transitive
description:
name: test_api
sha256: "5b8a98dafc4d5c4c9c72d8b31ab2b23fc13422348d2997120294d3bac86b4ddb"
sha256: "664d3a9a64782fcdeb83ce9c6b39e78fd2971d4e37827b9b06c3aa1edc5e760c"
url: "https://pub.dev"
source: hosted
version: "0.7.2"
version: "0.7.3"
test_core:
dependency: transitive
description:
name: test_core
sha256: "55ea5a652e38a1dfb32943a7973f3681a60f872f8c3a05a14664ad54ef9c6696"
sha256: "12391302411737c176b0b5d6491f466b0dd56d4763e347b6714efbaa74d7953d"
url: "https://pub.dev"
source: hosted
version: "0.6.4"
version: "0.6.5"
timezone:
dependency: transitive
description:
@ -1999,14 +1976,6 @@ packages:
url: "https://pub.dev"
source: hosted
version: "0.0.5"
tuple:
dependency: transitive
description:
name: tuple
sha256: a97ce2013f240b2f3807bcbaf218765b6f301c3eff91092bcfa23a039e7dd151
url: "https://pub.dev"
source: hosted
version: "2.0.2"
typed_data:
dependency: transitive
description:
@ -2175,30 +2144,6 @@ packages:
url: "https://pub.dev"
source: hosted
version: "4.5.1"
vector_graphics:
dependency: transitive
description:
name: vector_graphics
sha256: "32c3c684e02f9bc0afb0ae0aa653337a2fe022e8ab064bcd7ffda27a74e288e3"
url: "https://pub.dev"
source: hosted
version: "1.1.11+1"
vector_graphics_codec:
dependency: transitive
description:
name: vector_graphics_codec
sha256: c86987475f162fadff579e7320c7ddda04cd2fdeffbe1129227a85d9ac9e03da
url: "https://pub.dev"
source: hosted
version: "1.1.11+1"
vector_graphics_compiler:
dependency: transitive
description:
name: vector_graphics_compiler
sha256: "12faff3f73b1741a36ca7e31b292ddeb629af819ca9efe9953b70bd63fc8cd81"
url: "https://pub.dev"
source: hosted
version: "1.1.11+1"
vector_math:
dependency: transitive
description:
@ -2259,10 +2204,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"
wakelock_plus:
dependency: "direct main"
description:
@ -2315,10 +2260,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"
webkit_inspection_protocol:
dependency: transitive
description:

@ -40,7 +40,6 @@ dependencies:
flutter_localizations:
sdk: flutter
flutter_map: ^6.1.0
flutter_math_fork: ^0.7.2
flutter_olm: 1.3.2 # Keep in sync with scripts/prepare-web.sh ! 1.4.0 does currently not build on Android
flutter_openssl_crypto: ^0.3.0
flutter_ringtone_player: ^4.0.0+2
@ -152,4 +151,9 @@ msix_config:
install_certificate: false
dependency_overrides:
win32: 5.5.3
# For Flutter 3.27 until https://github.com/flutter-webrtc/dart-webrtc/pull/54 is merged
dart_webrtc:
git:
url: https://github.com/flutter-webrtc/dart-webrtc.git
ref: f27d27c7af41ceeebe31b295af4fb38e7b4d793e
win32: 5.5.3
Loading…
Cancel
Save