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 { with AutomaticKeepAliveClientMixin {
var _menuPos = RelativeRect.fill; var _menuPos = RelativeRect.fill;
final double _cardRadius = 16; final double _cardRadius = 16;
final double _tileRadius = 5;
final double _borderWidth = 2; final double _borderWidth = 2;
@override @override
@ -116,27 +117,32 @@ class _PeerCardState extends State<_PeerCard>
Widget _buildDesktop() { Widget _buildDesktop() {
final peer = super.widget.peer; final peer = super.widget.peer;
var deco = Rx<BoxDecoration?>(BoxDecoration( var deco = Rx<BoxDecoration?>(
BoxDecoration(
border: Border.all(color: Colors.transparent, width: _borderWidth), border: Border.all(color: Colors.transparent, width: _borderWidth),
borderRadius: peerCardUiType.value == PeerUiType.grid borderRadius: BorderRadius.circular(
? BorderRadius.circular(_cardRadius) peerCardUiType.value == PeerUiType.grid ? _cardRadius : _tileRadius,
: null)); ),
),
);
return MouseRegion( return MouseRegion(
onEnter: (evt) { onEnter: (evt) {
deco.value = BoxDecoration( deco.value = BoxDecoration(
border: Border.all( border: Border.all(
color: Theme.of(context).colorScheme.primary, color: Theme.of(context).colorScheme.primary,
width: _borderWidth), width: _borderWidth),
borderRadius: peerCardUiType.value == PeerUiType.grid borderRadius: BorderRadius.circular(
? BorderRadius.circular(_cardRadius) peerCardUiType.value == PeerUiType.grid ? _cardRadius : _tileRadius,
: null); ),
);
}, },
onExit: (evt) { onExit: (evt) {
deco.value = BoxDecoration( deco.value = BoxDecoration(
border: Border.all(color: Colors.transparent, width: _borderWidth), border: Border.all(color: Colors.transparent, width: _borderWidth),
borderRadius: peerCardUiType.value == PeerUiType.grid borderRadius: BorderRadius.circular(
? BorderRadius.circular(_cardRadius) peerCardUiType.value == PeerUiType.grid ? _cardRadius : _tileRadius,
: null); ),
);
}, },
child: GestureDetector( child: GestureDetector(
onDoubleTap: () => widget.connect(context, peer.id), onDoubleTap: () => widget.connect(context, peer.id),
@ -163,6 +169,10 @@ class _PeerCardState extends State<_PeerCard>
Container( Container(
decoration: BoxDecoration( decoration: BoxDecoration(
color: str2color('${peer.id}${peer.platform}', 0x7f), color: str2color('${peer.id}${peer.platform}', 0x7f),
borderRadius: BorderRadius.only(
topLeft: Radius.circular(_tileRadius),
bottomLeft: Radius.circular(_tileRadius),
),
), ),
alignment: Alignment.center, alignment: Alignment.center,
width: 42, width: 42,
@ -171,7 +181,12 @@ class _PeerCardState extends State<_PeerCard>
Expanded( Expanded(
child: Container( child: Container(
decoration: BoxDecoration( 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( child: Row(
children: [ children: [
Expanded( 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/tabbar_widget.dart';
import 'package:flutter_hbb/desktop/widgets/material_mod_popup_menu.dart' import 'package:flutter_hbb/desktop/widgets/material_mod_popup_menu.dart'
as mod_menu; as mod_menu;
import 'package:flutter_hbb/models/file_model.dart';
import 'package:flutter_hbb/models/peer_tab_model.dart'; import 'package:flutter_hbb/models/peer_tab_model.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:get/get_rx/src/rx_workers/utils/debouncer.dart'; import 'package:get/get_rx/src/rx_workers/utils/debouncer.dart';
@ -446,7 +445,7 @@ class _PeerSortDropdownState extends State<PeerSortDropdown> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return DropdownButton<String>( return DropdownButton<String>(
value: _sortType == "" ? 'id' : _sortType, value: _sortType.isEmpty ? 'id' : _sortType,
elevation: 16, elevation: 16,
underline: SizedBox(), underline: SizedBox(),
onChanged: (v) { onChanged: (v) {

View File

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