mirror of
https://gitlab.com/famedly/fluffychat.git
synced 2024-11-06 20:19:30 +01:00
design: Nicer selected mark on chatlists
This commit is contained in:
parent
1a23e5fa23
commit
42f64393c8
@ -17,7 +17,6 @@ import '../avatar.dart';
|
|||||||
import '../../pages/send_file_dialog.dart';
|
import '../../pages/send_file_dialog.dart';
|
||||||
import 'package:future_loading_dialog/future_loading_dialog.dart';
|
import 'package:future_loading_dialog/future_loading_dialog.dart';
|
||||||
import '../matrix.dart';
|
import '../matrix.dart';
|
||||||
import '../mouse_over_builder.dart';
|
|
||||||
|
|
||||||
enum ArchivedRoomAction { delete, rejoin }
|
enum ArchivedRoomAction { delete, rejoin }
|
||||||
|
|
||||||
@ -152,20 +151,17 @@ class ChatListItem extends StatelessWidget {
|
|||||||
color: FluffyThemes.chatListItemColor(context, activeChat, selected),
|
color: FluffyThemes.chatListItemColor(context, activeChat, selected),
|
||||||
child: ListTile(
|
child: ListTile(
|
||||||
onLongPress: onLongPress,
|
onLongPress: onLongPress,
|
||||||
leading: MouseOverBuilder(
|
leading: selected
|
||||||
builder: (context, hover) =>
|
|
||||||
onLongPress != null && (hover || selected)
|
|
||||||
? Container(
|
? Container(
|
||||||
width: Avatar.defaultSize,
|
width: Avatar.defaultSize,
|
||||||
height: Avatar.defaultSize,
|
height: Avatar.defaultSize,
|
||||||
alignment: Alignment.center,
|
child: Material(
|
||||||
child: Checkbox(
|
color: Theme.of(context).primaryColor,
|
||||||
value: selected,
|
borderRadius: BorderRadius.circular(Avatar.defaultSize),
|
||||||
onChanged: (_) => onLongPress(),
|
child: Icon(Icons.check, color: Colors.white),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
: Avatar(room.avatar, room.displayname),
|
: Avatar(room.avatar, room.displayname, onTap: onLongPress),
|
||||||
),
|
|
||||||
title: Row(
|
title: Row(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Expanded(
|
Expanded(
|
||||||
|
@ -1,28 +0,0 @@
|
|||||||
import 'package:flutter/material.dart';
|
|
||||||
|
|
||||||
class MouseOverBuilder extends StatefulWidget {
|
|
||||||
final Function(BuildContext, bool) builder;
|
|
||||||
|
|
||||||
const MouseOverBuilder({Key key, this.builder}) : super(key: key);
|
|
||||||
@override
|
|
||||||
_MouseOverBuilderState createState() => _MouseOverBuilderState();
|
|
||||||
}
|
|
||||||
|
|
||||||
class _MouseOverBuilderState extends State<MouseOverBuilder> {
|
|
||||||
bool _hover = false;
|
|
||||||
|
|
||||||
void _toggleHover(bool hover) {
|
|
||||||
if (_hover != hover) {
|
|
||||||
setState(() => _hover = hover);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return MouseRegion(
|
|
||||||
onEnter: (_) => _toggleHover(true),
|
|
||||||
onExit: (_) => _toggleHover(false),
|
|
||||||
child: widget.builder != null ? widget.builder(context, _hover) : null,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user