opt: titlebar height autofit

Signed-off-by: Kingtous <kingtous@qq.com>
This commit is contained in:
Kingtous 2022-06-02 14:51:09 +08:00
parent aefc968246
commit 1f9655d632
3 changed files with 48 additions and 55 deletions

View File

@ -64,37 +64,34 @@ class _ConnectionTabPageState extends State<ConnectionTabPage>
animationDuration: Duration.zero, animationDuration: Duration.zero,
child: Column( child: Column(
children: [ children: [
SizedBox( DesktopTitleBar(
height: 50, child: TabBar(
child: DesktopTitleBar( isScrollable: true,
child: TabBar( labelColor: Colors.white,
isScrollable: true, physics: NeverScrollableScrollPhysics(),
labelColor: Colors.white, indicatorColor: Colors.white,
physics: NeverScrollableScrollPhysics(), tabs: connectionIds
indicatorColor: Colors.white, .map((e) => Tab(
tabs: connectionIds child: Row(
.map((e) => Tab( mainAxisSize: MainAxisSize.min,
child: Row( crossAxisAlignment: CrossAxisAlignment.center,
mainAxisSize: MainAxisSize.min, children: [
crossAxisAlignment: CrossAxisAlignment.center, Text(e),
children: [ SizedBox(
Text(e), width: 4,
SizedBox( ),
width: 4, InkWell(
), onTap: () {
InkWell( onRemoveId(e);
onTap: () { },
onRemoveId(e); child: Icon(
}, Icons.highlight_remove,
child: Icon( size: 20,
Icons.highlight_remove, ))
size: 20, ],
)) ),
], ))
), .toList()),
))
.toList()),
),
), ),
Expanded( Expanded(
child: TabBarView( child: TabBarView(

View File

@ -20,20 +20,16 @@ class _DesktopHomePageState extends State<DesktopHomePage> {
return Scaffold( return Scaffold(
body: Column( body: Column(
children: [ children: [
Row( DesktopTitleBar(
children: [ child: Center(
DesktopTitleBar( child: Text(
child: Center( "RustDesk",
child: Text( style: TextStyle(
"RustDesk", color: Colors.white,
style: TextStyle( fontSize: 20,
color: Colors.white, fontWeight: FontWeight.bold),
fontSize: 20, ),
fontWeight: FontWeight.bold), ),
),
),
)
],
), ),
Expanded( Expanded(
child: Container( child: Container(

View File

@ -12,16 +12,16 @@ class DesktopTitleBar extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Expanded( return Container(
child: Container( decoration: const BoxDecoration(
decoration: const BoxDecoration( gradient: LinearGradient(
gradient: LinearGradient( begin: Alignment.topCenter,
begin: Alignment.topCenter, end: Alignment.bottomCenter,
end: Alignment.bottomCenter, colors: [backgroundStartColor, backgroundEndColor],
colors: [backgroundStartColor, backgroundEndColor], stops: [0.0, 1.0]),
stops: [0.0, 1.0]), ),
), child: WindowTitleBarBox(
child: WindowTitleBarBox( child: SizedBox(
child: Row( child: Row(
children: [ children: [
Expanded( Expanded(