build: Update to flutter 3.27
This commit is contained in:
parent
21196a108f
commit
dbe8c1b9f4
20 changed files with 81 additions and 152 deletions
|
|
@ -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),
|
||||
|
|
|
|||
14
lib/utils/color_value.dart
Normal file
14
lib/utils/color_value.dart
Normal file
|
|
@ -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(() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue