Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
YuJuncen committed Aug 5, 2023
1 parent 4f624fb commit a1f7a40
Showing 1 changed file with 71 additions and 69 deletions.
140 changes: 71 additions & 69 deletions lib/components/chat_room.dart
Original file line number Diff line number Diff line change
Expand Up @@ -91,76 +91,78 @@ class ListPane extends StatelessWidget {

@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
systemOverlayStyle: SystemUiOverlayStyle(
statusBarBrightness: Theme.of(context).brightness),
backgroundColor: Theme.of(context).colorScheme.background,
toolbarHeight: 0,
),
primary: false,
floatingActionButton: Obx(() => NewChatButton(
pctl: pctl,
)),
body: GetX<comp.ChatRoomController>(builder: (roomCtrl) {
return EasyRefresh(
refreshOnStart: true,
onRefresh: () => roomCtrl.loadChatRooms(),
child: ListView(
restorationId: 'chat_room_list_view',
padding: const EdgeInsets.symmetric(vertical: 8),
children: roomCtrl.roomList
.asMap()
.map((index, room) {
final colorSeed = room.createTime.millisecondsSinceEpoch;
final avatarColor = getColor(colorSeed);
return MapEntry(
index,
ListTile(
isThreeLine: false,
subtitle: room.firstMessage != null
? Text.rich(
TextSpan(children: [
TextSpan(
text: "${room.firstMessage!.userName}: ",
style: const TextStyle(
fontSize: 18,
)),
TextSpan(
text: room.firstMessage!.message,
style: const TextStyle(
fontSize: 18,
overflow: TextOverflow.ellipsis,
))
]),
maxLines: 1,
overflow: TextOverflow.ellipsis,
)
: null,
onTap: () {
onSelect(index);
},
selected: selectedIndex == index,
leading: ExcludeSemantics(
child: CircleAvatar(
backgroundColor: avatarColor,
foregroundColor: Colors.white,
child: Text(room.name[0])),
),
title: Text(
room.name,
style: const TextStyle(
// fontWeight: FontWeight.bold,
fontSize: 18,
return SafeArea(
child: Scaffold(
appBar: AppBar(
systemOverlayStyle: SystemUiOverlayStyle(
statusBarBrightness: Theme.of(context).brightness),
backgroundColor: Theme.of(context).colorScheme.background,
toolbarHeight: 0,
),
primary: false,
floatingActionButton: Obx(() => NewChatButton(
pctl: pctl,
)),
body: GetX<comp.ChatRoomController>(builder: (roomCtrl) {
return EasyRefresh(
refreshOnStart: true,
onRefresh: () => roomCtrl.loadChatRooms(),
child: ListView(
restorationId: 'chat_room_list_view',
padding: const EdgeInsets.symmetric(vertical: 8),
children: roomCtrl.roomList
.asMap()
.map((index, room) {
final colorSeed = room.createTime.millisecondsSinceEpoch;
final avatarColor = getColor(colorSeed);
return MapEntry(
index,
ListTile(
isThreeLine: false,
subtitle: room.firstMessage != null
? Text.rich(
TextSpan(children: [
TextSpan(
text: "${room.firstMessage!.userName}: ",
style: const TextStyle(
fontSize: 18,
)),
TextSpan(
text: room.firstMessage!.message,
style: const TextStyle(
fontSize: 18,
overflow: TextOverflow.ellipsis,
))
]),
maxLines: 1,
overflow: TextOverflow.ellipsis,
)
: null,
onTap: () {
onSelect(index);
},
selected: selectedIndex == index,
leading: ExcludeSemantics(
child: CircleAvatar(
backgroundColor: avatarColor,
foregroundColor: Colors.white,
child: Text(room.name[0])),
),
),
));
})
.values
.toList(),
),
);
}),
title: Text(
room.name,
style: const TextStyle(
// fontWeight: FontWeight.bold,
fontSize: 18,
),
),
));
})
.values
.toList(),
),
);
}),
),
);
}
}
Expand Down

0 comments on commit a1f7a40

Please sign in to comment.