fix, remote toolbar, border radius

Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
fufesou 2023-10-31 19:15:13 +08:00
parent fa39982a8f
commit f63d81826a

View File

@ -143,13 +143,14 @@ class _ToolbarTheme {
overlayColor: MaterialStatePropertyAll(Colors.transparent), overlayColor: MaterialStatePropertyAll(Colors.transparent),
); );
static Widget borderWrapper(Widget child) { static Widget borderWrapper(Widget child, BorderRadius borderRadius) {
return Container( return Container(
decoration: BoxDecoration( decoration: BoxDecoration(
border: Border.all( border: Border.all(
color: borderColor, color: borderColor,
width: 1, width: 1,
), ),
borderRadius: borderRadius,
), ),
child: child, child: child,
); );
@ -433,6 +434,9 @@ class _RemoteToolbarState extends State<RemoteToolbar> {
if (show.isTrue && _dragging.isFalse) { if (show.isTrue && _dragging.isFalse) {
triggerAutoHide(); triggerAutoHide();
} }
final borderRadius = BorderRadius.vertical(
bottom: Radius.circular(5),
);
return Align( return Align(
alignment: FractionalOffset(_fractionX.value, 0), alignment: FractionalOffset(_fractionX.value, 0),
child: Offstage( child: Offstage(
@ -440,14 +444,16 @@ class _RemoteToolbarState extends State<RemoteToolbar> {
child: Material( child: Material(
elevation: _ToolbarTheme.elevation, elevation: _ToolbarTheme.elevation,
shadowColor: MyTheme.color(context).shadow, shadowColor: MyTheme.color(context).shadow,
child: _ToolbarTheme.borderWrapper(_DraggableShowHide( borderRadius: borderRadius,
child: _DraggableShowHide(
sessionId: widget.ffi.sessionId, sessionId: widget.ffi.sessionId,
dragging: _dragging, dragging: _dragging,
fractionX: _fractionX, fractionX: _fractionX,
show: show, show: show,
setFullscreen: _setFullscreen, setFullscreen: _setFullscreen,
setMinimize: _minimize, setMinimize: _minimize,
)), borderRadius: borderRadius,
),
), ),
), ),
); );
@ -488,13 +494,14 @@ class _RemoteToolbarState extends State<RemoteToolbar> {
} }
toolbarItems.add(_RecordMenu()); toolbarItems.add(_RecordMenu());
toolbarItems.add(_CloseMenu(id: widget.id, ffi: widget.ffi)); toolbarItems.add(_CloseMenu(id: widget.id, ffi: widget.ffi));
final toolbarBorderRadius = BorderRadius.all(Radius.circular(4.0));
return Column( return Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
Material( Material(
elevation: _ToolbarTheme.elevation, elevation: _ToolbarTheme.elevation,
shadowColor: MyTheme.color(context).shadow, shadowColor: MyTheme.color(context).shadow,
borderRadius: BorderRadius.all(Radius.circular(4.0)), borderRadius: toolbarBorderRadius,
color: Theme.of(context) color: Theme.of(context)
.menuBarTheme .menuBarTheme
.style .style
@ -504,13 +511,15 @@ class _RemoteToolbarState extends State<RemoteToolbar> {
scrollDirection: Axis.horizontal, scrollDirection: Axis.horizontal,
child: Theme( child: Theme(
data: themeData(), data: themeData(),
child: _ToolbarTheme.borderWrapper(Row( child: _ToolbarTheme.borderWrapper(
children: [ Row(
SizedBox(width: _ToolbarTheme.buttonHMargin * 2), children: [
...toolbarItems, SizedBox(width: _ToolbarTheme.buttonHMargin * 2),
SizedBox(width: _ToolbarTheme.buttonHMargin * 2) ...toolbarItems,
], SizedBox(width: _ToolbarTheme.buttonHMargin * 2)
)), ],
),
toolbarBorderRadius),
), ),
), ),
), ),
@ -2084,6 +2093,7 @@ class _DraggableShowHide extends StatefulWidget {
final RxDouble fractionX; final RxDouble fractionX;
final RxBool dragging; final RxBool dragging;
final RxBool show; final RxBool show;
final BorderRadius borderRadius;
final Function(bool) setFullscreen; final Function(bool) setFullscreen;
final Function() setMinimize; final Function() setMinimize;
@ -2096,6 +2106,7 @@ class _DraggableShowHide extends StatefulWidget {
required this.show, required this.show,
required this.setFullscreen, required this.setFullscreen,
required this.setMinimize, required this.setMinimize,
required this.borderRadius,
}) : super(key: key); }) : super(key: key);
@override @override
@ -2232,9 +2243,11 @@ class _DraggableShowHideState extends State<_DraggableShowHide> {
.style .style
?.backgroundColor ?.backgroundColor
?.resolve(MaterialState.values.toSet()), ?.resolve(MaterialState.values.toSet()),
borderRadius: BorderRadius.vertical( border: Border.all(
bottom: Radius.circular(5), color: _ToolbarTheme.borderColor,
width: 1,
), ),
borderRadius: widget.borderRadius,
), ),
child: SizedBox( child: SizedBox(
height: 20, height: 20,