rounded tiles

This commit is contained in:
NicKoehler 2023-03-07 20:31:20 +01:00
parent d40aed6ac2
commit 43da918630
No known key found for this signature in database
GPG Key ID: BAE01394EB51AC58
3 changed files with 32 additions and 18 deletions

View File

@ -42,6 +42,7 @@ class _PeerCardState extends State<_PeerCard>
with AutomaticKeepAliveClientMixin {
var _menuPos = RelativeRect.fill;
final double _cardRadius = 16;
final double _tileRadius = 5;
final double _borderWidth = 2;
@override
@ -116,27 +117,32 @@ class _PeerCardState extends State<_PeerCard>
Widget _buildDesktop() {
final peer = super.widget.peer;
var deco = Rx<BoxDecoration?>(BoxDecoration(
var deco = Rx<BoxDecoration?>(
BoxDecoration(
border: Border.all(color: Colors.transparent, width: _borderWidth),
borderRadius: peerCardUiType.value == PeerUiType.grid
? BorderRadius.circular(_cardRadius)
: null));
borderRadius: BorderRadius.circular(
peerCardUiType.value == PeerUiType.grid ? _cardRadius : _tileRadius,
),
),
);
return MouseRegion(
onEnter: (evt) {
deco.value = BoxDecoration(
border: Border.all(
color: Theme.of(context).colorScheme.primary,
width: _borderWidth),
borderRadius: peerCardUiType.value == PeerUiType.grid
? BorderRadius.circular(_cardRadius)
: null);
border: Border.all(
color: Theme.of(context).colorScheme.primary,
width: _borderWidth),
borderRadius: BorderRadius.circular(
peerCardUiType.value == PeerUiType.grid ? _cardRadius : _tileRadius,
),
);
},
onExit: (evt) {
deco.value = BoxDecoration(
border: Border.all(color: Colors.transparent, width: _borderWidth),
borderRadius: peerCardUiType.value == PeerUiType.grid
? BorderRadius.circular(_cardRadius)
: null);
border: Border.all(color: Colors.transparent, width: _borderWidth),
borderRadius: BorderRadius.circular(
peerCardUiType.value == PeerUiType.grid ? _cardRadius : _tileRadius,
),
);
},
child: GestureDetector(
onDoubleTap: () => widget.connect(context, peer.id),
@ -163,6 +169,10 @@ class _PeerCardState extends State<_PeerCard>
Container(
decoration: BoxDecoration(
color: str2color('${peer.id}${peer.platform}', 0x7f),
borderRadius: BorderRadius.only(
topLeft: Radius.circular(_tileRadius),
bottomLeft: Radius.circular(_tileRadius),
),
),
alignment: Alignment.center,
width: 42,
@ -171,7 +181,12 @@ class _PeerCardState extends State<_PeerCard>
Expanded(
child: Container(
decoration: BoxDecoration(
color: Theme.of(context).colorScheme.background),
color: Theme.of(context).colorScheme.background,
borderRadius: BorderRadius.only(
topRight: Radius.circular(_tileRadius),
bottomRight: Radius.circular(_tileRadius),
),
),
child: Row(
children: [
Expanded(

View File

@ -12,7 +12,6 @@ import 'package:flutter_hbb/desktop/widgets/popup_menu.dart';
import 'package:flutter_hbb/desktop/widgets/tabbar_widget.dart';
import 'package:flutter_hbb/desktop/widgets/material_mod_popup_menu.dart'
as mod_menu;
import 'package:flutter_hbb/models/file_model.dart';
import 'package:flutter_hbb/models/peer_tab_model.dart';
import 'package:get/get.dart';
import 'package:get/get_rx/src/rx_workers/utils/debouncer.dart';
@ -446,7 +445,7 @@ class _PeerSortDropdownState extends State<PeerSortDropdown> {
@override
Widget build(BuildContext context) {
return DropdownButton<String>(
value: _sortType == "" ? 'id' : _sortType,
value: _sortType.isEmpty ? 'id' : _sortType,
elevation: 16,
underline: SizedBox(),
onChanged: (v) {

View File

@ -211,7 +211,7 @@ class _PeersViewState extends State<_PeersView> with WindowListener {
p1.username.toLowerCase().compareTo(p2.username.toLowerCase()));
break;
case 'status':
peers.sort((p1, p2) => p1.online ? 1 : -1);
peers.sort((p1, p2) => p1.online ? -1 : 1);
break;
}
}