reorganize files
This commit is contained in:
parent
6e0dd8c33d
commit
ccd8513cde
3 changed files with 2 additions and 2 deletions
45
lib/widgets/event_wrapper.dart
Normal file
45
lib/widgets/event_wrapper.dart
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
import "package:flutter/material.dart";
|
||||
import "package:nexus/models/event.dart";
|
||||
import "package:nexus/widgets/reaction_row.dart";
|
||||
|
||||
class EventWrapper extends StatelessWidget {
|
||||
final Event event;
|
||||
final Widget child;
|
||||
final bool isFlashing;
|
||||
const EventWrapper(
|
||||
this.event,
|
||||
this.child, {
|
||||
this.isFlashing = false,
|
||||
super.key,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final theme = Theme.of(context);
|
||||
|
||||
return ClipRRect(
|
||||
borderRadius: BorderRadius.all(Radius.circular(12)),
|
||||
child: AnimatedContainer(
|
||||
padding: isFlashing ? EdgeInsets.all(8) : EdgeInsets.all(0),
|
||||
color: isFlashing
|
||||
? Theme.of(context).colorScheme.onSurface.withAlpha(50)
|
||||
: Colors.transparent,
|
||||
duration: Duration(milliseconds: 250),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
child,
|
||||
if (event.sendError != null && event.sendError != "not sent")
|
||||
Text(
|
||||
event.sendError!,
|
||||
style: theme.textTheme.labelSmall?.copyWith(
|
||||
color: theme.colorScheme.error,
|
||||
),
|
||||
),
|
||||
ReactionRow(event),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
117
lib/widgets/reaction_row.dart
Normal file
117
lib/widgets/reaction_row.dart
Normal file
|
|
@ -0,0 +1,117 @@
|
|||
import "package:cross_cache/cross_cache.dart";
|
||||
import "package:flutter/material.dart";
|
||||
import "package:flutter_hooks/flutter_hooks.dart";
|
||||
import "package:flutter_riverpod/flutter_riverpod.dart";
|
||||
import "package:nexus/controllers/client_state_controller.dart";
|
||||
import "package:nexus/controllers/cross_cache_controller.dart";
|
||||
import "package:nexus/controllers/room_chat_controller.dart";
|
||||
import "package:nexus/helpers/extensions/get_headers.dart";
|
||||
import "package:nexus/helpers/extensions/mxc_to_https.dart";
|
||||
import "package:nexus/main.dart";
|
||||
import "package:nexus/models/event.dart";
|
||||
|
||||
class ReactionRow extends ConsumerWidget {
|
||||
final Event event;
|
||||
const ReactionRow(this.event, {super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final clientState = ref.watch(ClientStateController.provider);
|
||||
|
||||
return SizedBox.shrink();
|
||||
|
||||
// TODO: IMPL
|
||||
// return Wrap(
|
||||
// spacing: 4,
|
||||
// runSpacing: 4,
|
||||
// children: clientState?.homeserverUrl == null
|
||||
// ? []
|
||||
// : event.reactions
|
||||
// .mapTo(
|
||||
// (reaction, reactors) => HookBuilder(
|
||||
// builder: (context) {
|
||||
// final enabled = useState(true);
|
||||
// final selected = reactors.contains(clientState!.userId);
|
||||
// return Tooltip(
|
||||
// message: reactors.join(", "),
|
||||
// child: ChoiceChip(
|
||||
// showCheckmark: false,
|
||||
// selected: selected,
|
||||
// label: Row(
|
||||
// mainAxisSize: MainAxisSize.min,
|
||||
// spacing: 8,
|
||||
// children: [
|
||||
// Flexible(
|
||||
// child: reaction.startsWith("mxc://")
|
||||
// ? Image(
|
||||
// height: 20,
|
||||
// image: CachedNetworkImage(
|
||||
// headers: ref.headers,
|
||||
// Uri.parse(reaction)
|
||||
// .mxcToHttps(
|
||||
// clientState.homeserverUrl!,
|
||||
// )
|
||||
// .toString(),
|
||||
// ref.watch(
|
||||
// CrossCacheController.provider,
|
||||
// ),
|
||||
// ),
|
||||
// )
|
||||
// : Text(
|
||||
// reaction,
|
||||
// overflow: TextOverflow.ellipsis,
|
||||
// ),
|
||||
// ),
|
||||
// Text(
|
||||
// reactors.length.toString(),
|
||||
// overflow: TextOverflow.ellipsis,
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// onSelected: enabled.value
|
||||
// ? (value) async {
|
||||
// enabled.value = false;
|
||||
// try {
|
||||
// final roomId = ref.watch(
|
||||
// SelectedRoomController.provider.select(
|
||||
// (value) => value?.metadata?.id,
|
||||
// ),
|
||||
// );
|
||||
// if (roomId == null ||
|
||||
// clientState.userId == null) {
|
||||
// return;
|
||||
// }
|
||||
|
||||
// final controller = ref.watch(
|
||||
// RoomChatController.provider(
|
||||
// roomId,
|
||||
// ).notifier,
|
||||
// );
|
||||
|
||||
// if (selected) {
|
||||
// await controller
|
||||
// .removeReaction(
|
||||
// reaction,
|
||||
// event,
|
||||
// clientState.userId!,
|
||||
// )
|
||||
// .onError(showError);
|
||||
// } else {
|
||||
// await controller
|
||||
// .sendReaction(reaction, event)
|
||||
// .onError(showError);
|
||||
// }
|
||||
// } finally {
|
||||
// enabled.value = true;
|
||||
// }
|
||||
// }
|
||||
// : null,
|
||||
// ),
|
||||
// );
|
||||
// },
|
||||
// ),
|
||||
// )
|
||||
// .toList(),
|
||||
// );
|
||||
}
|
||||
}
|
||||
|
|
@ -21,7 +21,7 @@ import "package:nexus/widgets/emoji_picker_button.dart";
|
|||
import "package:nexus/widgets/renderers/event.dart";
|
||||
import "package:nexus/widgets/member_list.dart";
|
||||
import "package:nexus/widgets/room_appbar.dart";
|
||||
import "package:nexus/widgets/wrappers/event_wrapper.dart";
|
||||
import "package:nexus/widgets/event_wrapper.dart";
|
||||
import "package:nexus/widgets/error_dialog.dart";
|
||||
import "package:nexus/widgets/form_text_input.dart";
|
||||
import "package:nexus/main.dart";
|
||||
|
|
|
|||
Loading…
Reference in a new issue