optimize style of peer card
Signed-off-by: 21pages <pages21@163.com>
This commit is contained in:
parent
7c9f799f05
commit
bb64690ac9
BIN
flutter/assets/peer_searchbar.ttf
Normal file
BIN
flutter/assets/peer_searchbar.ttf
Normal file
Binary file not shown.
@ -41,15 +41,18 @@ late final iconRestart = MemoryImage(Uint8List.fromList(base64Decode(
|
|||||||
'iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAACXBIWXMAAB7BAAAewQHDaVRTAAAAGXRFWHRTb2Z0d2FyZQB3d3cuaW5rc2NhcGUub3Jnm+48GgAAAbhJREFUWIXVlrFqFGEUhb+7UYxaWCQKlrKKxaZSQVGDJih2tj6MD2DnMwiWvoAIRnENIpZiYxEro6IooiS7SPwsMgNLkk3mjmYmnmb45/73nMNwz/x/qH3gMu2gH6rAU+Blw+Lngau4jpmGxVF7qp1iPWjaQKnZ2WnXbuP/NqAeUPc3ZkA9XDwvqc+BVWCgPlJ7tRwUKThZce819b46VH+pfXVRXVO/q2cSul3VOgZUl0ejq86r39TXI8mqZKDuDEwCw3IREQvAbWAGmMsQZQ0sAl3gHPB1Q+0e8BuYzRDuy2yOiFVgaUxtRf0ETGc4syk4rc6PqU0Cx9j8Zf6dAeAK8Fi9sUXtFjABvEgxJlNwRP2svlNPjbw/q35U36oTFbnyMSwabxb/gB/qA3VBHagrauV7RW0DRfP1IvMlXqkXkhz1DYyQTKtHa/Z2VVMx3IiI+PI3/bCHjuOpFrSnAMpL6QfgTcMGesDx0kBr2BMzsNyi/vtQu8CJlgwsRbZDnWP90NkKaxHxJMOXMqAeAn5u0ydwMCKGY+qbkB3C2W3EKWoXk5zVoHbUZ+6Mh7tl4G4F8RJ3qvL+AfV3r5Vdpj70AAAAAElFTkSuQmCC')));
|
'iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAACXBIWXMAAB7BAAAewQHDaVRTAAAAGXRFWHRTb2Z0d2FyZQB3d3cuaW5rc2NhcGUub3Jnm+48GgAAAbhJREFUWIXVlrFqFGEUhb+7UYxaWCQKlrKKxaZSQVGDJih2tj6MD2DnMwiWvoAIRnENIpZiYxEro6IooiS7SPwsMgNLkk3mjmYmnmb45/73nMNwz/x/qH3gMu2gH6rAU+Blw+Lngau4jpmGxVF7qp1iPWjaQKnZ2WnXbuP/NqAeUPc3ZkA9XDwvqc+BVWCgPlJ7tRwUKThZce819b46VH+pfXVRXVO/q2cSul3VOgZUl0ejq86r39TXI8mqZKDuDEwCw3IREQvAbWAGmMsQZQ0sAl3gHPB1Q+0e8BuYzRDuy2yOiFVgaUxtRf0ETGc4syk4rc6PqU0Cx9j8Zf6dAeAK8Fi9sUXtFjABvEgxJlNwRP2svlNPjbw/q35U36oTFbnyMSwabxb/gB/qA3VBHagrauV7RW0DRfP1IvMlXqkXkhz1DYyQTKtHa/Z2VVMx3IiI+PI3/bCHjuOpFrSnAMpL6QfgTcMGesDx0kBr2BMzsNyi/vtQu8CJlgwsRbZDnWP90NkKaxHxJMOXMqAeAn5u0ydwMCKGY+qbkB3C2W3EKWoXk5zVoHbUZ+6Mh7tl4G4F8RJ3qvL+AfV3r5Vdpj70AAAAAElFTkSuQmCC')));
|
||||||
|
|
||||||
class IconFont {
|
class IconFont {
|
||||||
static const _family = 'iconfont';
|
static const _family1 = 'Tabbar';
|
||||||
|
static const _family2 = 'PeerSearchbar';
|
||||||
IconFont._();
|
IconFont._();
|
||||||
|
|
||||||
static const IconData max = IconData(0xe606, fontFamily: _family);
|
static const IconData max = IconData(0xe606, fontFamily: _family1);
|
||||||
static const IconData restore = IconData(0xe607, fontFamily: _family);
|
static const IconData restore = IconData(0xe607, fontFamily: _family1);
|
||||||
static const IconData close = IconData(0xe668, fontFamily: _family);
|
static const IconData close = IconData(0xe668, fontFamily: _family1);
|
||||||
static const IconData min = IconData(0xe609, fontFamily: _family);
|
static const IconData min = IconData(0xe609, fontFamily: _family1);
|
||||||
static const IconData add = IconData(0xe664, fontFamily: _family);
|
static const IconData add = IconData(0xe664, fontFamily: _family1);
|
||||||
static const IconData menu = IconData(0xe628, fontFamily: _family);
|
static const IconData menu = IconData(0xe628, fontFamily: _family1);
|
||||||
|
static const IconData search = IconData(0xe6a4, fontFamily: _family2);
|
||||||
|
static const IconData round_close = IconData(0xe6ed, fontFamily: _family2);
|
||||||
}
|
}
|
||||||
|
|
||||||
class ColorThemeExtension extends ThemeExtension<ColorThemeExtension> {
|
class ColorThemeExtension extends ThemeExtension<ColorThemeExtension> {
|
||||||
|
@ -63,20 +63,18 @@ class _ConnectionPageState extends State<ConnectionPage> {
|
|||||||
mainAxisSize: MainAxisSize.max,
|
mainAxisSize: MainAxisSize.max,
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
|
Expanded(
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
getUpdateUI(),
|
getUpdateUI(),
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
getSearchBarUI(context),
|
getSearchBarUI(context),
|
||||||
],
|
],
|
||||||
).marginOnly(top: 22, left: 22),
|
).marginOnly(top: 22),
|
||||||
SizedBox(height: 12),
|
SizedBox(height: 12),
|
||||||
Divider(
|
Divider(),
|
||||||
thickness: 1,
|
|
||||||
indent: 22,
|
|
||||||
endIndent: 22,
|
|
||||||
),
|
|
||||||
Expanded(
|
Expanded(
|
||||||
// TODO: move all tab info into _PeerTabbedPage
|
|
||||||
child: _PeerTabbedPage(
|
child: _PeerTabbedPage(
|
||||||
tabs: [
|
tabs: [
|
||||||
translate('Recent Sessions'),
|
translate('Recent Sessions'),
|
||||||
@ -88,34 +86,6 @@ class _ConnectionPageState extends State<ConnectionPage> {
|
|||||||
RecentPeerWidget(),
|
RecentPeerWidget(),
|
||||||
FavoritePeerWidget(),
|
FavoritePeerWidget(),
|
||||||
DiscoveredPeerWidget(),
|
DiscoveredPeerWidget(),
|
||||||
// AddressBookPeerWidget(),
|
|
||||||
// FutureBuilder<Widget>(
|
|
||||||
// future: getPeers(rType: RemoteType.recently),
|
|
||||||
// builder: (context, snapshot) {
|
|
||||||
// if (snapshot.hasData) {
|
|
||||||
// return snapshot.data!;
|
|
||||||
// } else {
|
|
||||||
// return Offstage();
|
|
||||||
// }
|
|
||||||
// }),
|
|
||||||
// FutureBuilder<Widget>(
|
|
||||||
// future: getPeers(rType: RemoteType.favorite),
|
|
||||||
// builder: (context, snapshot) {
|
|
||||||
// if (snapshot.hasData) {
|
|
||||||
// return snapshot.data!;
|
|
||||||
// } else {
|
|
||||||
// return Offstage();
|
|
||||||
// }
|
|
||||||
// }),
|
|
||||||
// FutureBuilder<Widget>(
|
|
||||||
// future: getPeers(rType: RemoteType.discovered),
|
|
||||||
// builder: (context, snapshot) {
|
|
||||||
// if (snapshot.hasData) {
|
|
||||||
// return snapshot.data!;
|
|
||||||
// } else {
|
|
||||||
// return Offstage();
|
|
||||||
// }
|
|
||||||
// }),
|
|
||||||
FutureBuilder<Widget>(
|
FutureBuilder<Widget>(
|
||||||
future: buildAddressBook(context),
|
future: buildAddressBook(context),
|
||||||
builder: (context, snapshot) {
|
builder: (context, snapshot) {
|
||||||
@ -126,7 +96,10 @@ class _ConnectionPageState extends State<ConnectionPage> {
|
|||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
).marginSymmetric(horizontal: 6)),
|
)),
|
||||||
|
],
|
||||||
|
).marginSymmetric(horizontal: 22),
|
||||||
|
),
|
||||||
Divider(),
|
Divider(),
|
||||||
SizedBox(height: 50, child: Obx(() => buildStatus()))
|
SizedBox(height: 50, child: Obx(() => buildStatus()))
|
||||||
.paddingSymmetric(horizontal: 12.0)
|
.paddingSymmetric(horizontal: 12.0)
|
||||||
@ -193,7 +166,7 @@ class _ConnectionPageState extends State<ConnectionPage> {
|
|||||||
});
|
});
|
||||||
var w = Container(
|
var w = Container(
|
||||||
width: 320 + 20 * 2,
|
width: 320 + 20 * 2,
|
||||||
padding: EdgeInsets.only(left: 20, right: 20, bottom: 22, top: 24),
|
padding: EdgeInsets.fromLTRB(20, 24, 20, 22),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: MyTheme.color(context).bg,
|
color: MyTheme.color(context).bg,
|
||||||
borderRadius: const BorderRadius.all(Radius.circular(13)),
|
borderRadius: const BorderRadius.all(Radius.circular(13)),
|
||||||
@ -977,25 +950,22 @@ class _PeerTabbedPage extends StatefulWidget {
|
|||||||
|
|
||||||
class _PeerTabbedPageState extends State<_PeerTabbedPage>
|
class _PeerTabbedPageState extends State<_PeerTabbedPage>
|
||||||
with SingleTickerProviderStateMixin {
|
with SingleTickerProviderStateMixin {
|
||||||
late TabController _tabController;
|
late PageController _pageController = PageController();
|
||||||
RxInt _tabIndex = 0.obs;
|
RxInt _tabIndex = 0.obs;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
_tabController =
|
|
||||||
TabController(vsync: this, length: super.widget.tabs.length);
|
|
||||||
_tabController.addListener(_handleTabSelection);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// hard code for now
|
// hard code for now
|
||||||
void _handleTabSelection() {
|
void _handleTabSelection(int index) {
|
||||||
if (_tabController.indexIsChanging) {
|
|
||||||
// reset search text
|
// reset search text
|
||||||
peerSearchText.value = "";
|
peerSearchText.value = "";
|
||||||
peerSearchTextController.clear();
|
peerSearchTextController.clear();
|
||||||
_tabIndex.value = _tabController.index;
|
_tabIndex.value = index;
|
||||||
switch (_tabController.index) {
|
_pageController.jumpToPage(index);
|
||||||
|
switch (index) {
|
||||||
case 0:
|
case 0:
|
||||||
bind.mainLoadRecentPeers();
|
bind.mainLoadRecentPeers();
|
||||||
break;
|
break;
|
||||||
@ -1009,106 +979,150 @@ class _PeerTabbedPageState extends State<_PeerTabbedPage>
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
_tabController.dispose();
|
_pageController.dispose();
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
// return DefaultTabController(
|
|
||||||
// length: 4,
|
|
||||||
// child: Column(
|
|
||||||
// crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
// children: [
|
|
||||||
// _createTabBar(),
|
|
||||||
// _createTabBarView(),
|
|
||||||
// ],
|
|
||||||
// ));
|
|
||||||
|
|
||||||
return Column(
|
return Column(
|
||||||
|
textBaseline: TextBaseline.ideographic,
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Row(
|
Container(
|
||||||
|
height: 28,
|
||||||
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
Expanded(child: _createTabBar(context)),
|
Expanded(child: _createTabBar(context)),
|
||||||
_createSearchBar(context),
|
_createSearchBar(context),
|
||||||
_createPeerViewTypeSwitch(context),
|
_createPeerViewTypeSwitch(context),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
),
|
||||||
_createTabBarView(),
|
_createTabBarView(),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _createTabBar(BuildContext context) {
|
Widget _createTabBar(BuildContext context) {
|
||||||
return TabBar(
|
return ListView(
|
||||||
isScrollable: true,
|
scrollDirection: Axis.horizontal,
|
||||||
indicatorSize: TabBarIndicatorSize.label,
|
shrinkWrap: true,
|
||||||
indicatorColor: Colors.transparent,
|
children: super.widget.tabs.asMap().entries.map((t) {
|
||||||
indicatorWeight: 0.1,
|
return Obx(() => GestureDetector(
|
||||||
controller: _tabController,
|
child: Container(
|
||||||
labelPadding: EdgeInsets.zero,
|
padding: EdgeInsets.symmetric(horizontal: 8),
|
||||||
padding: EdgeInsets.only(left: 16),
|
|
||||||
tabs: super.widget.tabs.asMap().entries.map((t) {
|
|
||||||
return Obx(() => Container(
|
|
||||||
padding: EdgeInsets.symmetric(horizontal: 8, vertical: 6),
|
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color:
|
color: _tabIndex.value == t.key
|
||||||
_tabIndex.value == t.key ? MyTheme.color(context).bg : null,
|
? MyTheme.color(context).bg
|
||||||
|
: null,
|
||||||
borderRadius: BorderRadius.circular(2),
|
borderRadius: BorderRadius.circular(2),
|
||||||
),
|
),
|
||||||
|
child: Align(
|
||||||
|
alignment: Alignment.center,
|
||||||
child: Text(
|
child: Text(
|
||||||
t.value,
|
t.value,
|
||||||
|
textAlign: TextAlign.center,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
height: 1,
|
height: 1,
|
||||||
|
fontSize: 14,
|
||||||
color: _tabIndex.value == t.key
|
color: _tabIndex.value == t.key
|
||||||
? MyTheme.color(context).text
|
? MyTheme.color(context).text
|
||||||
: MyTheme.color(context).lightText),
|
: MyTheme.color(context).lightText),
|
||||||
)));
|
),
|
||||||
|
)),
|
||||||
|
onTap: () => _handleTabSelection(t.key),
|
||||||
|
));
|
||||||
}).toList());
|
}).toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _createTabBarView() {
|
Widget _createTabBarView() {
|
||||||
return Expanded(
|
return Expanded(
|
||||||
child: TabBarView(
|
child: PageView(
|
||||||
controller: _tabController, children: super.widget.children)
|
controller: _pageController, children: super.widget.children)
|
||||||
.paddingSymmetric(horizontal: 12.0, vertical: 4.0));
|
.marginSymmetric(vertical: 12));
|
||||||
}
|
}
|
||||||
|
|
||||||
_createSearchBar(BuildContext context) {
|
_createSearchBar(BuildContext context) {
|
||||||
|
RxBool focused = false.obs;
|
||||||
|
FocusNode focusNode = FocusNode();
|
||||||
|
focusNode.addListener(() => focused.value = focusNode.hasFocus);
|
||||||
|
RxBool rowHover = false.obs;
|
||||||
|
RxBool clearHover = false.obs;
|
||||||
return Container(
|
return Container(
|
||||||
width: 175,
|
width: 120,
|
||||||
height: 30,
|
height: 25,
|
||||||
margin: EdgeInsets.only(right: 16),
|
margin: EdgeInsets.only(right: 13),
|
||||||
decoration: BoxDecoration(color: Colors.white),
|
decoration: BoxDecoration(color: MyTheme.color(context).bg),
|
||||||
child: Obx(
|
child: Obx(() => Row(
|
||||||
() => TextField(
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: MouseRegion(
|
||||||
|
onEnter: (_) => rowHover.value = true,
|
||||||
|
onExit: (_) => rowHover.value = false,
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Icon(
|
||||||
|
IconFont.search,
|
||||||
|
size: 16,
|
||||||
|
color: MyTheme.color(context).placeholder,
|
||||||
|
).marginSymmetric(horizontal: 4),
|
||||||
|
Expanded(
|
||||||
|
child: TextField(
|
||||||
controller: peerSearchTextController,
|
controller: peerSearchTextController,
|
||||||
onChanged: (searchText) {
|
onChanged: (searchText) {
|
||||||
peerSearchText.value = searchText;
|
peerSearchText.value = searchText;
|
||||||
},
|
},
|
||||||
|
focusNode: focusNode,
|
||||||
|
textAlign: TextAlign.start,
|
||||||
|
maxLines: 1,
|
||||||
|
cursorColor: MyTheme.color(context).lightText,
|
||||||
|
cursorHeight: 18,
|
||||||
|
cursorWidth: 1,
|
||||||
|
style: TextStyle(fontSize: 14),
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
prefixIcon: Icon(
|
contentPadding: EdgeInsets.symmetric(vertical: 6),
|
||||||
Icons.search,
|
hintText:
|
||||||
size: 20,
|
focused.value ? null : translate("Search ID"),
|
||||||
),
|
hintStyle: TextStyle(
|
||||||
contentPadding: EdgeInsets.zero,
|
fontSize: 14,
|
||||||
hintText: translate("Search ID"),
|
color: MyTheme.color(context).placeholder),
|
||||||
hintStyle: TextStyle(fontSize: 14),
|
border: InputBorder.none,
|
||||||
border: OutlineInputBorder(),
|
|
||||||
isDense: true,
|
isDense: true,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Offstage(
|
||||||
|
offstage: !(peerSearchText.value.isNotEmpty &&
|
||||||
|
(rowHover.value || clearHover.value)),
|
||||||
|
child: InkWell(
|
||||||
|
onHover: (value) => clearHover.value = value,
|
||||||
|
child: Icon(
|
||||||
|
IconFont.round_close,
|
||||||
|
size: 16,
|
||||||
|
color: clearHover.value
|
||||||
|
? MyTheme.color(context).text
|
||||||
|
: MyTheme.color(context).placeholder,
|
||||||
|
).marginSymmetric(horizontal: 4),
|
||||||
|
onTap: () {
|
||||||
|
peerSearchTextController.clear();
|
||||||
|
peerSearchText.value = "";
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
)),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
_createPeerViewTypeSwitch(BuildContext context) {
|
_createPeerViewTypeSwitch(BuildContext context) {
|
||||||
final activeDeco = BoxDecoration(color: Colors.white);
|
final activeDeco = BoxDecoration(color: MyTheme.color(context).bg);
|
||||||
return Row(
|
return Row(
|
||||||
children: [
|
children: [
|
||||||
Obx(
|
Obx(
|
||||||
@ -1122,8 +1136,10 @@ class _PeerTabbedPageState extends State<_PeerTabbedPage>
|
|||||||
},
|
},
|
||||||
child: Icon(
|
child: Icon(
|
||||||
Icons.grid_view_rounded,
|
Icons.grid_view_rounded,
|
||||||
size: 20,
|
size: 18,
|
||||||
color: Colors.black54,
|
color: peerCardUiType.value == PeerUiType.grid
|
||||||
|
? MyTheme.color(context).text
|
||||||
|
: MyTheme.color(context).lightText,
|
||||||
)),
|
)),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -1138,12 +1154,14 @@ class _PeerTabbedPageState extends State<_PeerTabbedPage>
|
|||||||
},
|
},
|
||||||
child: Icon(
|
child: Icon(
|
||||||
Icons.list,
|
Icons.list,
|
||||||
size: 24,
|
size: 18,
|
||||||
color: Colors.black54,
|
color: peerCardUiType.value == PeerUiType.list
|
||||||
|
? MyTheme.color(context).text
|
||||||
|
: MyTheme.color(context).lightText,
|
||||||
)),
|
)),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
).paddingOnly(right: 16.0);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -107,9 +107,10 @@ class _DesktopHomePageState extends State<DesktopHomePage>
|
|||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Container(
|
Container(
|
||||||
height: 15,
|
height: 25,
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
translate("ID"),
|
translate("ID"),
|
||||||
@ -133,7 +134,7 @@ class _DesktopHomePageState extends State<DesktopHomePage>
|
|||||||
readOnly: true,
|
readOnly: true,
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
border: InputBorder.none,
|
border: InputBorder.none,
|
||||||
contentPadding: EdgeInsets.only(bottom: 8),
|
contentPadding: EdgeInsets.only(bottom: 18),
|
||||||
),
|
),
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 22,
|
fontSize: 22,
|
||||||
@ -239,19 +240,11 @@ class _DesktopHomePageState extends State<DesktopHomePage>
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
child: Obx(
|
child: Obx(
|
||||||
() => Container(
|
() => CircleAvatar(
|
||||||
decoration: BoxDecoration(
|
radius: 12,
|
||||||
// borderRadius: BorderRadius.circular(10),
|
backgroundColor: hover.value
|
||||||
shape: BoxShape.circle,
|
|
||||||
boxShadow: [
|
|
||||||
BoxShadow(
|
|
||||||
color: hover.value
|
|
||||||
? MyTheme.color(context).grayBg!
|
? MyTheme.color(context).grayBg!
|
||||||
: MyTheme.color(context).bg!,
|
: MyTheme.color(context).bg!,
|
||||||
spreadRadius: 2)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
child: Center(
|
|
||||||
child: Icon(
|
child: Icon(
|
||||||
Icons.more_vert_outlined,
|
Icons.more_vert_outlined,
|
||||||
size: 20,
|
size: 20,
|
||||||
@ -261,7 +254,6 @@ class _DesktopHomePageState extends State<DesktopHomePage>
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
|
||||||
onHover: (value) => hover.value = value,
|
onHover: (value) => hover.value = value,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -100,10 +100,10 @@ class _PeerWidgetState extends State<_PeerWidget> with WindowListener {
|
|||||||
offstage: super.widget._offstageFunc(peer),
|
offstage: super.widget._offstageFunc(peer),
|
||||||
child: Obx(
|
child: Obx(
|
||||||
() => Container(
|
() => Container(
|
||||||
width: 225,
|
width: 220,
|
||||||
height: peerCardUiType.value == PeerUiType.grid
|
height: peerCardUiType.value == PeerUiType.grid
|
||||||
? 150
|
? 140
|
||||||
: 50,
|
: 42,
|
||||||
child: VisibilityDetector(
|
child: VisibilityDetector(
|
||||||
key: Key('${peer.id}'),
|
key: Key('${peer.id}'),
|
||||||
onVisibilityChanged: (info) {
|
onVisibilityChanged: (info) {
|
||||||
|
@ -36,29 +36,31 @@ class _PeerCard extends StatefulWidget {
|
|||||||
class _PeerCardState extends State<_PeerCard>
|
class _PeerCardState extends State<_PeerCard>
|
||||||
with AutomaticKeepAliveClientMixin {
|
with AutomaticKeepAliveClientMixin {
|
||||||
var _menuPos;
|
var _menuPos;
|
||||||
|
final double _cardRadis = 20;
|
||||||
|
final double _borderWidth = 2;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
super.build(context);
|
super.build(context);
|
||||||
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: 1.0),
|
border: Border.all(color: Colors.transparent, width: _borderWidth),
|
||||||
borderRadius: peerCardUiType.value == PeerUiType.grid
|
borderRadius: peerCardUiType.value == PeerUiType.grid
|
||||||
? BorderRadius.circular(20)
|
? BorderRadius.circular(_cardRadis)
|
||||||
: null));
|
: null));
|
||||||
return MouseRegion(
|
return MouseRegion(
|
||||||
onEnter: (evt) {
|
onEnter: (evt) {
|
||||||
deco.value = BoxDecoration(
|
deco.value = BoxDecoration(
|
||||||
border: Border.all(color: Colors.blue, width: 1.0),
|
border: Border.all(color: MyTheme.button, width: _borderWidth),
|
||||||
borderRadius: peerCardUiType.value == PeerUiType.grid
|
borderRadius: peerCardUiType.value == PeerUiType.grid
|
||||||
? BorderRadius.circular(20)
|
? BorderRadius.circular(_cardRadis)
|
||||||
: null);
|
: null);
|
||||||
},
|
},
|
||||||
onExit: (evt) {
|
onExit: (evt) {
|
||||||
deco.value = BoxDecoration(
|
deco.value = BoxDecoration(
|
||||||
border: Border.all(color: Colors.transparent, width: 1.0),
|
border: Border.all(color: Colors.transparent, width: _borderWidth),
|
||||||
borderRadius: peerCardUiType.value == PeerUiType.grid
|
borderRadius: peerCardUiType.value == PeerUiType.grid
|
||||||
? BorderRadius.circular(20)
|
? BorderRadius.circular(_cardRadis)
|
||||||
: null);
|
: null);
|
||||||
},
|
},
|
||||||
child: GestureDetector(
|
child: GestureDetector(
|
||||||
@ -71,25 +73,25 @@ class _PeerCardState extends State<_PeerCard>
|
|||||||
|
|
||||||
Widget _buildPeerTile(
|
Widget _buildPeerTile(
|
||||||
BuildContext context, Peer peer, Rx<BoxDecoration?> deco) {
|
BuildContext context, Peer peer, Rx<BoxDecoration?> deco) {
|
||||||
final greyStyle = TextStyle(fontSize: 12, color: Colors.grey);
|
final greyStyle =
|
||||||
|
TextStyle(fontSize: 12, color: MyTheme.color(context).lighterText);
|
||||||
|
RxBool iconHover = false.obs;
|
||||||
return Obx(
|
return Obx(
|
||||||
() => Container(
|
() => Container(
|
||||||
decoration: deco.value,
|
foregroundDecoration: deco.value,
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisSize: MainAxisSize.max,
|
mainAxisSize: MainAxisSize.max,
|
||||||
children: [
|
children: [
|
||||||
Container(
|
Container(
|
||||||
height: 50,
|
|
||||||
width: 50,
|
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: str2color('${peer.id}${peer.platform}', 0x7f),
|
color: str2color('${peer.id}${peer.platform}', 0x7f),
|
||||||
),
|
),
|
||||||
alignment: Alignment.center,
|
alignment: Alignment.center,
|
||||||
child: _getPlatformImage('${peer.platform}').paddingAll(8.0),
|
child: _getPlatformImage('${peer.platform}', 30).paddingAll(6),
|
||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Container(
|
child: Container(
|
||||||
decoration: BoxDecoration(color: Colors.white),
|
decoration: BoxDecoration(color: MyTheme.color(context).bg),
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
@ -98,17 +100,17 @@ class _PeerCardState extends State<_PeerCard>
|
|||||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||||
children: [
|
children: [
|
||||||
Row(children: [
|
Row(children: [
|
||||||
Text(
|
|
||||||
'${peer.id}',
|
|
||||||
style: TextStyle(fontWeight: FontWeight.w400),
|
|
||||||
),
|
|
||||||
Padding(
|
Padding(
|
||||||
padding: EdgeInsets.fromLTRB(4, 4, 8, 4),
|
padding: EdgeInsets.fromLTRB(0, 4, 4, 4),
|
||||||
child: CircleAvatar(
|
child: CircleAvatar(
|
||||||
radius: 5,
|
radius: 5,
|
||||||
backgroundColor: peer.online
|
backgroundColor: peer.online
|
||||||
? Colors.green
|
? Colors.green
|
||||||
: Colors.yellow)),
|
: Colors.yellow)),
|
||||||
|
Text(
|
||||||
|
'${peer.id}',
|
||||||
|
style: TextStyle(fontWeight: FontWeight.w400),
|
||||||
|
),
|
||||||
]),
|
]),
|
||||||
Align(
|
Align(
|
||||||
alignment: Alignment.centerLeft,
|
alignment: Alignment.centerLeft,
|
||||||
@ -122,6 +124,7 @@ class _PeerCardState extends State<_PeerCard>
|
|||||||
: snapshot.data!;
|
: snapshot.data!;
|
||||||
return Tooltip(
|
return Tooltip(
|
||||||
message: name,
|
message: name,
|
||||||
|
waitDuration: Duration(seconds: 1),
|
||||||
child: Text(
|
child: Text(
|
||||||
name,
|
name,
|
||||||
style: greyStyle,
|
style: greyStyle,
|
||||||
@ -145,7 +148,19 @@ class _PeerCardState extends State<_PeerCard>
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
InkWell(
|
InkWell(
|
||||||
child: Icon(Icons.more_vert),
|
child: CircleAvatar(
|
||||||
|
radius: 12,
|
||||||
|
backgroundColor: iconHover.value
|
||||||
|
? MyTheme.color(context).grayBg!
|
||||||
|
: MyTheme.color(context).bg!,
|
||||||
|
child: Icon(
|
||||||
|
Icons.more_vert,
|
||||||
|
size: 18,
|
||||||
|
color: iconHover.value
|
||||||
|
? MyTheme.color(context).text
|
||||||
|
: MyTheme.color(context).lightText,
|
||||||
|
),
|
||||||
|
),
|
||||||
onTapDown: (e) {
|
onTapDown: (e) {
|
||||||
final x = e.globalPosition.dx;
|
final x = e.globalPosition.dx;
|
||||||
final y = e.globalPosition.dy;
|
final y = e.globalPosition.dy;
|
||||||
@ -153,9 +168,11 @@ class _PeerCardState extends State<_PeerCard>
|
|||||||
},
|
},
|
||||||
onTap: () {
|
onTap: () {
|
||||||
_showPeerMenu(context, peer.id);
|
_showPeerMenu(context, peer.id);
|
||||||
}),
|
},
|
||||||
|
onHover: (value) => iconHover.value = value,
|
||||||
|
),
|
||||||
],
|
],
|
||||||
).paddingSymmetric(horizontal: 8.0),
|
).paddingSymmetric(horizontal: 4.0),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
@ -166,24 +183,23 @@ class _PeerCardState extends State<_PeerCard>
|
|||||||
|
|
||||||
Widget _buildPeerCard(
|
Widget _buildPeerCard(
|
||||||
BuildContext context, Peer peer, Rx<BoxDecoration?> deco) {
|
BuildContext context, Peer peer, Rx<BoxDecoration?> deco) {
|
||||||
|
RxBool iconHover = false.obs;
|
||||||
return Card(
|
return Card(
|
||||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(20)),
|
color: Colors.transparent,
|
||||||
|
elevation: 0,
|
||||||
|
margin: EdgeInsets.zero,
|
||||||
child: Obx(
|
child: Obx(
|
||||||
() => Container(
|
() => Container(
|
||||||
decoration: deco.value,
|
foregroundDecoration: deco.value,
|
||||||
|
child: ClipRRect(
|
||||||
|
borderRadius: BorderRadius.circular(_cardRadis - _borderWidth),
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Container(
|
child: Container(
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: str2color('${peer.id}${peer.platform}', 0x7f),
|
color: str2color('${peer.id}${peer.platform}', 0x7f),
|
||||||
borderRadius: BorderRadius.only(
|
|
||||||
topLeft: Radius.circular(20),
|
|
||||||
topRight: Radius.circular(20),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
@ -192,7 +208,8 @@ class _PeerCardState extends State<_PeerCard>
|
|||||||
children: [
|
children: [
|
||||||
Container(
|
Container(
|
||||||
padding: const EdgeInsets.all(6),
|
padding: const EdgeInsets.all(6),
|
||||||
child: _getPlatformImage('${peer.platform}'),
|
child:
|
||||||
|
_getPlatformImage('${peer.platform}', 60),
|
||||||
),
|
),
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
@ -207,6 +224,7 @@ class _PeerCardState extends State<_PeerCard>
|
|||||||
: snapshot.data!;
|
: snapshot.data!;
|
||||||
return Tooltip(
|
return Tooltip(
|
||||||
message: name,
|
message: name,
|
||||||
|
waitDuration: Duration(seconds: 1),
|
||||||
child: Text(
|
child: Text(
|
||||||
name,
|
name,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
@ -240,7 +258,9 @@ class _PeerCardState extends State<_PeerCard>
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Row(
|
Container(
|
||||||
|
color: MyTheme.color(context).bg,
|
||||||
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
Row(children: [
|
Row(children: [
|
||||||
@ -248,12 +268,22 @@ class _PeerCardState extends State<_PeerCard>
|
|||||||
padding: EdgeInsets.fromLTRB(0, 4, 8, 4),
|
padding: EdgeInsets.fromLTRB(0, 4, 8, 4),
|
||||||
child: CircleAvatar(
|
child: CircleAvatar(
|
||||||
radius: 5,
|
radius: 5,
|
||||||
backgroundColor:
|
backgroundColor: peer.online
|
||||||
peer.online ? Colors.green : Colors.yellow)),
|
? Colors.green
|
||||||
|
: Colors.yellow)),
|
||||||
Text('${peer.id}')
|
Text('${peer.id}')
|
||||||
]),
|
]),
|
||||||
InkWell(
|
InkWell(
|
||||||
child: Icon(Icons.more_vert),
|
child: CircleAvatar(
|
||||||
|
radius: 12,
|
||||||
|
backgroundColor: iconHover.value
|
||||||
|
? MyTheme.color(context).grayBg!
|
||||||
|
: MyTheme.color(context).bg!,
|
||||||
|
child: Icon(Icons.more_vert,
|
||||||
|
size: 18,
|
||||||
|
color: iconHover.value
|
||||||
|
? MyTheme.color(context).text
|
||||||
|
: MyTheme.color(context).lightText)),
|
||||||
onTapDown: (e) {
|
onTapDown: (e) {
|
||||||
final x = e.globalPosition.dx;
|
final x = e.globalPosition.dx;
|
||||||
final y = e.globalPosition.dy;
|
final y = e.globalPosition.dy;
|
||||||
@ -261,13 +291,16 @@ class _PeerCardState extends State<_PeerCard>
|
|||||||
},
|
},
|
||||||
onTap: () {
|
onTap: () {
|
||||||
_showPeerMenu(context, peer.id);
|
_showPeerMenu(context, peer.id);
|
||||||
}),
|
},
|
||||||
|
onHover: (value) => iconHover.value = value),
|
||||||
],
|
],
|
||||||
).paddingSymmetric(vertical: 8.0, horizontal: 12.0)
|
).paddingSymmetric(vertical: 8.0, horizontal: 12.0),
|
||||||
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -365,12 +398,12 @@ class _PeerCardState extends State<_PeerCard>
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Get the image for the current [platform].
|
/// Get the image for the current [platform].
|
||||||
Widget _getPlatformImage(String platform) {
|
Widget _getPlatformImage(String platform, double size) {
|
||||||
platform = platform.toLowerCase();
|
platform = platform.toLowerCase();
|
||||||
if (platform == 'mac os')
|
if (platform == 'mac os')
|
||||||
platform = 'mac';
|
platform = 'mac';
|
||||||
else if (platform != 'linux' && platform != 'android') platform = 'win';
|
else if (platform != 'linux' && platform != 'android') platform = 'win';
|
||||||
return Image.asset('assets/$platform.png', height: 50);
|
return Image.asset('assets/$platform.png', height: size, width: size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _abEditTag(String id) {
|
void _abEditTag(String id) {
|
||||||
|
@ -514,8 +514,10 @@ class ActionIcon extends StatelessWidget {
|
|||||||
RxBool hover = false.obs;
|
RxBool hover = false.obs;
|
||||||
return Obx(() => Tooltip(
|
return Obx(() => Tooltip(
|
||||||
message: translate(message),
|
message: translate(message),
|
||||||
|
waitDuration: Duration(seconds: 1),
|
||||||
child: InkWell(
|
child: InkWell(
|
||||||
hoverColor: is_close ? Colors.red : theme.hoverColor,
|
hoverColor:
|
||||||
|
is_close ? Color.fromARGB(255, 196, 43, 28) : theme.hoverColor,
|
||||||
onHover: (value) => hover.value = value,
|
onHover: (value) => hover.value = value,
|
||||||
child: Container(
|
child: Container(
|
||||||
height: _kTabBarHeight - 1,
|
height: _kTabBarHeight - 1,
|
||||||
|
@ -107,9 +107,14 @@ flutter:
|
|||||||
- family: GestureIcons
|
- family: GestureIcons
|
||||||
fonts:
|
fonts:
|
||||||
- asset: assets/gestures.ttf
|
- asset: assets/gestures.ttf
|
||||||
- family: IconFont
|
- family: Tabbar
|
||||||
fonts:
|
fonts:
|
||||||
- asset: assets/tabbar.ttf
|
- asset: assets/tabbar.ttf
|
||||||
|
- family: PeerSearchbar
|
||||||
|
fonts:
|
||||||
|
- asset: assets/peer_searchbar.ttf
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# An image asset can refer to one or more resolution-specific "variants", see
|
# An image asset can refer to one or more resolution-specific "variants", see
|
||||||
# https://flutter.dev/assets-and-images/#resolution-aware.
|
# https://flutter.dev/assets-and-images/#resolution-aware.
|
||||||
|
Loading…
Reference in New Issue
Block a user