chore: Adjust styles and animations

This commit is contained in:
Christian Kußowski 2026-03-12 12:03:03 +01:00
parent 5c88133691
commit 9724b852bb
No known key found for this signature in database
GPG key ID: E067ECD60F1A0652
5 changed files with 656 additions and 761 deletions

View file

@ -462,21 +462,18 @@ class ChatController extends State<ChatPageWithRoom>
scrollUpBannerEventId = eventId;
});
bool firstUpdateReceived = false;
void updateView() {
if (!mounted) return;
setReadMarker();
setState(() {});
setState(() {
firstUpdateReceived = true;
});
}
Future<void>? loadTimelineFuture;
int? animateInEventIndex;
void onInsert(int i) {
// setState will be called by updateView() anyway
if (timeline?.allowNewEvent == true) animateInEventIndex = i;
}
Future<void> _getTimeline({String? eventContextId}) async {
await Matrix.of(context).client.roomsLoading;
await Matrix.of(context).client.accountDataLoading;
@ -489,15 +486,11 @@ class ChatController extends State<ChatPageWithRoom>
timeline = await room.getTimeline(
onUpdate: updateView,
eventContextId: eventContextId,
onInsert: onInsert,
);
} catch (e, s) {
Logs().w('Unable to load timeline on event ID $eventContextId', e, s);
if (!mounted) return;
timeline = await room.getTimeline(
onUpdate: updateView,
onInsert: onInsert,
);
timeline = await room.getTimeline(onUpdate: updateView);
if (!mounted) return;
if (e is TimeoutException || e is IOException) {
_showScrollUpMaterialBanner(eventContextId!);

View file

@ -35,7 +35,6 @@ class ChatEventList extends StatelessWidget {
final events = timeline.events.filterByVisibleInGui(
threadId: controller.activeThreadId,
);
final animateInEventIndex = controller.animateInEventIndex;
// create a map of eventId --> index to greatly improve performance of
// ListView's findChildIndexCallback
@ -120,10 +119,7 @@ class ChatEventList extends StatelessWidget {
// The message at this index:
final event = events[i];
final animateIn =
animateInEventIndex != null &&
timeline.events.length > animateInEventIndex &&
event == timeline.events[animateInEventIndex];
final animateIn = i == 0 && controller.firstUpdateReceived;
final nextEvent = i + 1 < events.length ? events[i + 1] : null;
final previousEvent = i > 0 ? events[i - 1] : null;
@ -139,16 +135,13 @@ class ChatEventList extends StatelessWidget {
!controller.expandedEventIds.contains(event.eventId);
return AutoScrollTag(
key: ValueKey(event.eventId),
key: ValueKey(event.transactionId ?? event.eventId),
index: i,
controller: controller.scrollController,
child: Message(
event,
bigEmojis: controller.bigEmojis,
animateIn: animateIn,
resetAnimateIn: () {
controller.animateInEventIndex = null;
},
onSwipe: () => controller.replyAction(replyTo: event),
onInfoTab: controller.showEventInfo,
onMention: () => controller.sendController.text +=

File diff suppressed because it is too large Load diff

View file

@ -2,7 +2,6 @@ import 'package:flutter/material.dart';
import 'package:file_picker/file_picker.dart';
import 'package:fluffychat/config/app_config.dart';
import 'package:fluffychat/config/setting_keys.dart';
import 'package:fluffychat/utils/account_config.dart';
import 'package:fluffychat/utils/file_selector.dart';
@ -111,32 +110,6 @@ class SettingsStyleController extends State<SettingsStyle> {
ThemeMode get currentTheme => ThemeController.of(context).themeMode;
Color? get currentColor => ThemeController.of(context).primaryColor;
static final List<Color?> customColors = [
null,
AppConfig.chatColor,
Colors.indigo,
Colors.blue,
Colors.blueAccent,
Colors.teal,
Colors.tealAccent,
Colors.green,
Colors.greenAccent,
Colors.yellow,
Colors.yellowAccent,
Colors.orange,
Colors.orangeAccent,
Colors.red,
Colors.redAccent,
Colors.pink,
Colors.pinkAccent,
Colors.purple,
Colors.purpleAccent,
Colors.blueGrey,
Colors.grey,
Colors.white,
Colors.black,
];
void switchTheme(ThemeMode? newTheme) {
if (newTheme == null) return;
switch (newTheme) {

View file

@ -82,14 +82,13 @@ class SettingsStyleView extends StatelessWidget {
Theme.of(context).brightness == Brightness.light
? light?.primary
: dark?.primary;
final colors = List<Color?>.from(
SettingsStyleController.customColors,
);
final colors = [null, AppConfig.chatColor, ...Colors.primaries];
if (systemColor == null) {
colors.remove(null);
}
return GridView.builder(
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
gridDelegate: const SliverGridDelegateWithMaxCrossAxisExtent(
maxCrossAxisExtent: 64,
),