Fix DMs
This commit is contained in:
parent
50c56206db
commit
a4d60e6c83
3 changed files with 2 additions and 57 deletions
|
|
@ -1,6 +1,5 @@
|
||||||
import "package:color_hash/color_hash.dart";
|
import "package:color_hash/color_hash.dart";
|
||||||
import "package:flutter/material.dart";
|
import "package:flutter/material.dart";
|
||||||
import "package:flutter/widgets.dart";
|
|
||||||
|
|
||||||
class AvatarOrHash extends StatelessWidget {
|
class AvatarOrHash extends StatelessWidget {
|
||||||
final Uri? avatar;
|
final Uri? avatar;
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ class Sidebar extends HookConsumerWidget {
|
||||||
return NavigationRail(
|
return NavigationRail(
|
||||||
scrollable: true,
|
scrollable: true,
|
||||||
onDestinationSelected: (value) {
|
onDestinationSelected: (value) {
|
||||||
selectedSpaceNotifier.set(spaces[value].roomData?.id);
|
selectedSpaceNotifier.set(spaces[value].id);
|
||||||
selectedRoomNotifier.set(
|
selectedRoomNotifier.set(
|
||||||
spaces[value].children.firstOrNull?.roomData.id,
|
spaces[value].children.firstOrNull?.roomData.id,
|
||||||
);
|
);
|
||||||
|
|
@ -151,7 +151,7 @@ class Sidebar extends HookConsumerWidget {
|
||||||
hasBadge: room.roomData.hasNewMessages,
|
hasBadge: room.roomData.hasNewMessages,
|
||||||
room.avatar,
|
room.avatar,
|
||||||
room.title,
|
room.title,
|
||||||
fallback: selectedSpace == 1
|
fallback: selectedSpace == "dms"
|
||||||
? null
|
? null
|
||||||
: Icon(Icons.numbers),
|
: Icon(Icons.numbers),
|
||||||
headers: space.client.headers,
|
headers: space.client.headers,
|
||||||
|
|
|
||||||
|
|
@ -1,54 +0,0 @@
|
||||||
import "package:flutter/material.dart";
|
|
||||||
import "package:flutter_hooks/flutter_hooks.dart";
|
|
||||||
|
|
||||||
class RadioDialog<T> extends HookWidget {
|
|
||||||
final T? value;
|
|
||||||
final String title;
|
|
||||||
final List<T> options;
|
|
||||||
final void Function(T value)? onChanged;
|
|
||||||
final String Function(T option) getName;
|
|
||||||
const RadioDialog({
|
|
||||||
super.key,
|
|
||||||
required this.title,
|
|
||||||
required this.value,
|
|
||||||
required this.options,
|
|
||||||
required this.onChanged,
|
|
||||||
required this.getName,
|
|
||||||
});
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
final mutValue = useState<T?>(null);
|
|
||||||
return AlertDialog(
|
|
||||||
title: Text(title),
|
|
||||||
content: Column(
|
|
||||||
mainAxisSize: MainAxisSize.min,
|
|
||||||
children: options
|
|
||||||
.map(
|
|
||||||
(option) => RadioListTile<T>(
|
|
||||||
value: option,
|
|
||||||
groupValue: mutValue.value ?? value,
|
|
||||||
onChanged: onChanged == null
|
|
||||||
? null
|
|
||||||
: (value) =>
|
|
||||||
mutValue.value = value ?? mutValue.value ?? value,
|
|
||||||
title: Text(getName(option)),
|
|
||||||
dense: true,
|
|
||||||
),
|
|
||||||
)
|
|
||||||
.toList(),
|
|
||||||
),
|
|
||||||
actions: [
|
|
||||||
TextButton(onPressed: Navigator.of(context).pop, child: Text("Cancel")),
|
|
||||||
if (onChanged != null)
|
|
||||||
TextButton(
|
|
||||||
onPressed: () {
|
|
||||||
if (mutValue.value != null) onChanged!(mutValue.value as T);
|
|
||||||
Navigator.of(context).pop();
|
|
||||||
},
|
|
||||||
child: Text("OK"),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue